<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[50807] trunk/src/wp-includes: Plugins: Standardize the terminology used for actions, filters, and callback functions.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/50807">50807</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/50807","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-05-04 10:46:26 +0000 (Tue, 04 May 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Plugins: Standardize the terminology used for actions, filters, and callback functions.
Use `$hook_name` when referring to a filter or action hook name, and `$callback` when referring to a callback function.
This brings more consistency to parameter names in Plugin API functions.
Includes minor code layout fixes for better readability and reordering some functions in a more logical order.
Props johnbillion, jrf, SergeyBiryukov.
Fixes <a href="https://core.trac.wordpress.org/ticket/50531">#50531</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswphookphp">trunk/src/wp-includes/class-wp-hook.php</a></li>
<li><a href="#trunksrcwpincludespluginphp">trunk/src/wp-includes/plugin.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswphookphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-hook.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-hook.php 2021-05-03 14:33:21 UTC (rev 50806)
+++ trunk/src/wp-includes/class-wp-hook.php 2021-05-04 10:46:26 UTC (rev 50807)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,25 +58,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> private $doing_action = false;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Hooks a function or method to a specific filter action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds a callback function to the specified filter hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the filter to hook the $function_to_add callback to.
- * @param callable $function_to_add The callback to be run when the filter is applied.
- * @param int $priority The order in which the functions associated with a particular action
- * are executed. Lower numbers correspond with earlier execution,
- * and functions with the same priority are executed in the order
- * in which they were added to the action.
- * @param int $accepted_args The number of arguments the function accepts.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the filter to add the callback to.
+ * @param callable $callback The callback to be run when the filter is applied.
+ * @param int $priority The order in which the functions associated with a particular action
+ * are executed. Lower numbers correspond with earlier execution,
+ * and functions with the same priority are executed in the order
+ * in which they were added to the action.
+ * @param int $accepted_args The number of arguments the function accepts.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
- $idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function add_filter( $hook_name, $callback, $priority, $accepted_args ) {
+ $idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $priority_existed = isset( $this->callbacks[ $priority ] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->callbacks[ $priority ][ $idx ] = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'function' => $function_to_add,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'function' => $callback,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'accepted_args' => $accepted_args,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,12 +108,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->iterations as $index => $iteration ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->iterations[ $index ] = $new_priorities;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $min = min( $new_priorities );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->iterations as $index => &$iteration ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $current = current( $iteration );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> // If we're already at the end of this iteration, just leave the array pointer where it is.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( false === $current ) {
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,6 +149,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Otherwise, just go back to the previous element.
</span><span class="cx" style="display: block; padding: 0 10px"> $prev = prev( $iteration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( false === $prev ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Start of the array. Reset, and go about our day.
</span><span class="cx" style="display: block; padding: 0 10px"> reset( $iteration );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -155,55 +159,61 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> unset( $iteration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Unhooks a function or method from a specific filter action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes a callback function from the specified filter hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The filter hook to which the function to be removed is hooked.
- * @param callable $function_to_remove The callback to be removed from running when the filter is applied.
- * @param int $priority The exact priority used when adding the original filter callback.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The filter hook to which the function to be removed is hooked.
+ * @param callable $callback The callback to be removed from running when the filter is applied.
+ * @param int $priority The exact priority used when adding the original filter callback.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether the callback existed before it was removed.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function remove_filter( $tag, $function_to_remove, $priority ) {
- $function_key = _wp_filter_build_unique_id( $tag, $function_to_remove, $priority );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function remove_filter( $hook_name, $callback, $priority ) {
+ $function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $exists = isset( $this->callbacks[ $priority ][ $function_key ] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $exists ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $this->callbacks[ $priority ][ $function_key ] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->callbacks[ $priority ] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $this->callbacks[ $priority ] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->nesting_level > 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->resort_active_iterations();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $exists;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Checks if a specific action has been registered for this hook.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Checks if a specific callback has been registered for this hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * When using the `$function_to_check` argument, this function may return a non-boolean value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * When using the `$callback` argument, this function may return a non-boolean value
</ins><span class="cx" style="display: block; padding: 0 10px"> * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag Optional. The name of the filter hook. Default empty.
- * @param callable|false $function_to_check Optional. The callback to check for. Default false.
- * @return bool|int If `$function_to_check` is omitted, returns boolean for whether the hook has
- * anything registered. When checking a specific function, the priority of that
- * hook is returned, or false if the function is not attached.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name Optional. The name of the filter hook. Default empty.
+ * @param callable|false $callback Optional. The callback to check for. Default false.
+ * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
+ * anything registered. When checking a specific function, the priority
+ * of that hook is returned, or false if the function is not attached.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function has_filter( $tag = '', $function_to_check = false ) {
- if ( false === $function_to_check ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function has_filter( $hook_name = '', $callback = false ) {
+ if ( false === $callback ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $this->has_filters();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $function_key = _wp_filter_build_unique_id( $tag, $function_to_check, false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $function_key = _wp_filter_build_unique_id( $hook_name, $callback, false );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $function_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,6 +240,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -334,6 +345,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> do {
</span><span class="cx" style="display: block; padding: 0 10px"> $priority = current( $this->iterations[ $nesting_level ] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->callbacks[ $priority ] as $the_ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> call_user_func_array( $the_['function'], $args );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -348,7 +360,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return int|false If the hook is running, return the current priority level. If it isn't running, return false.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return int|false If the hook is running, return the current priority level.
+ * If it isn't running, return false.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function current_priority() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( false === current( $this->iterations ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -391,11 +404,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Hook[] $normalized */
</span><span class="cx" style="display: block; padding: 0 10px"> $normalized = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( $filters as $tag => $callback_groups ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $filters as $hook_name => $callback_groups ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_object( $callback_groups ) && $callback_groups instanceof WP_Hook ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $normalized[ $tag ] = $callback_groups;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $normalized[ $hook_name ] = $callback_groups;
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $hook = new WP_Hook();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Loop through callback groups.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -403,11 +417,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Loop through callbacks.
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $callbacks as $cb ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $hook->add_filter( $tag, $cb['function'], $priority, $cb['accepted_args'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $hook->add_filter( $hook_name, $cb['function'], $priority, $cb['accepted_args'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $normalized[ $tag ] = $hook;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $normalized[ $hook_name ] = $hook;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $normalized;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludespluginphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/plugin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/plugin.php 2021-05-03 14:33:21 UTC (rev 50806)
+++ trunk/src/wp-includes/plugin.php 2021-05-04 10:46:26 UTC (rev 50807)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,7 +48,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Hook a function or method to a specific filter action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds a callback function to a filter hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * WordPress offers filter hooks to allow plugins to modify
</span><span class="cx" style="display: block; padding: 0 10px"> * various types of internal data at runtime.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,58 +101,34 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Hook[] $wp_filter A multidimensional array of all hooks and the callbacks hooked to them.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the filter to hook the $function_to_add callback to.
- * @param callable $function_to_add The callback to be run when the filter is applied.
- * @param int $priority Optional. Used to specify the order in which the functions
- * associated with a particular action are executed.
- * Lower numbers correspond with earlier execution,
- * and functions with the same priority are executed
- * in the order in which they were added to the action. Default 10.
- * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1.
- * @return true
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the filter to add the callback to.
+ * @param callable $callback The callback to be run when the filter is applied.
+ * @param int $priority Optional. Used to specify the order in which the functions
+ * associated with a particular filter are executed.
+ * Lower numbers correspond with earlier execution,
+ * and functions with the same priority are executed
+ * in the order in which they were added to the filter. Default 10.
+ * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1.
+ * @return true Always returns true.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function add_filter( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_filter[ $tag ] ) ) {
- $wp_filter[ $tag ] = new WP_Hook();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( ! isset( $wp_filter[ $hook_name ] ) ) {
+ $wp_filter[ $hook_name ] = new WP_Hook();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_filter[ $tag ]->add_filter( $tag, $function_to_add, $priority, $accepted_args );
- return true;
-}
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Checks if any filter has been registered for a hook.
- *
- * When using the `$function_to_check` argument, this function may return a non-boolean value
- * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
- *
- * @since 2.5.0
- *
- * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
- *
- * @param string $tag The name of the filter hook.
- * @param callable|false $function_to_check Optional. The callback to check for. Default false.
- * @return bool|int If `$function_to_check` is omitted, returns boolean for whether the hook has
- * anything registered. When checking a specific function, the priority of that
- * hook is returned, or false if the function is not attached.
- */
-function has_filter( $tag, $function_to_check = false ) {
- global $wp_filter;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_filter[ $hook_name ]->add_filter( $hook_name, $callback, $priority, $accepted_args );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_filter[ $tag ] ) ) {
- return false;
- }
-
- return $wp_filter[ $tag ]->has_filter( $tag, $function_to_check );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Calls the callback functions that have been added to a filter hook.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The callback functions attached to the filter hook are invoked by calling
- * this function. This function can be used to create a new filter hook by
- * simply calling this function with the name of the new hook specified using
- * the `$tag` parameter.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function invokes all functions attached to filter hook `$hook_name`.
+ * It is possible to create new filter hooks by simply calling this function,
+ * specifying the name of the new hook using the `$hook_name` parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The function also allows for multiple additional arguments to be passed to hooks.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -179,12 +155,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the filter hook.
- * @param mixed $value The value to filter.
- * @param mixed ...$args Additional parameters to pass to the callback functions.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the filter hook.
+ * @param mixed $value The value to filter.
+ * @param mixed ...$args Additional parameters to pass to the callback functions.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return mixed The filtered value after all hooked functions are applied to it.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function apply_filters( $tag, $value ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function apply_filters( $hook_name, $value ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter, $wp_current_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $args = func_get_args();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -191,25 +167,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Do 'all' actions first.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> _wp_call_all_hook( $args );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_filter[ $tag ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $wp_filter[ $hook_name ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $value;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't pass the tag name to WP_Hook.
</span><span class="cx" style="display: block; padding: 0 10px"> array_shift( $args );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -222,37 +199,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see apply_filters() This function is identical, but the arguments passed to the
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * functions hooked to `$tag` are supplied using an array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * functions hooked to `$hook_name` are supplied using an array.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the filter hook.
- * @param array $args The arguments supplied to the functions hooked to $tag.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the filter hook.
+ * @param array $args The arguments supplied to the functions hooked to `$hook_name`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return mixed The filtered value after all hooked functions are applied to it.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function apply_filters_ref_array( $tag, $args ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function apply_filters_ref_array( $hook_name, $args ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter, $wp_current_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Do 'all' actions first.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
</span><span class="cx" style="display: block; padding: 0 10px"> _wp_call_all_hook( $all_args );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_filter[ $tag ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $wp_filter[ $hook_name ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $args[0];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $filtered = $wp_filter[ $tag ]->apply_filters( $args[0], $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filtered = $wp_filter[ $hook_name ]->apply_filters( $args[0], $args );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -260,13 +238,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Removes a function from a specified filter hook.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Checks if any filter has been registered for a hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This function removes a function attached to a specified filter hook. This
- * method can be used to remove default functions attached to a specific filter
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * When using the `$callback` argument, this function may return a non-boolean value
+ * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
+ *
+ * @since 2.5.0
+ *
+ * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
+ *
+ * @param string $hook_name The name of the filter hook.
+ * @param callable|false $callback Optional. The callback to check for. Default false.
+ * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
+ * anything registered. When checking a specific function, the priority
+ * of that hook is returned, or false if the function is not attached.
+ */
+function has_filter( $hook_name, $callback = false ) {
+ global $wp_filter;
+
+ if ( ! isset( $wp_filter[ $hook_name ] ) ) {
+ return false;
+ }
+
+ return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback );
+}
+
+/**
+ * Removes a callback function from a filter hook.
+ *
+ * This can be used to remove default functions attached to a specific filter
</ins><span class="cx" style="display: block; padding: 0 10px"> * hook and possibly replace them with a substitute.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * To remove a hook, the $function_to_remove and $priority arguments must match
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * To remove a hook, the `$callback` and `$priority` arguments must match
</ins><span class="cx" style="display: block; padding: 0 10px"> * when the hook was added. This goes for both filters and actions. No warning
</span><span class="cx" style="display: block; padding: 0 10px"> * will be given on removal failure.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -274,19 +277,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The filter hook to which the function to be removed is hooked.
- * @param callable $function_to_remove The name of the function which should be removed.
- * @param int $priority Optional. The priority of the function. Default 10.
- * @return bool Whether the function existed before it was removed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The filter hook to which the function to be removed is hooked.
+ * @param callable $callback The name of the function which should be removed.
+ * @param int $priority Optional. The priority of the function. Default 10.
+ * @return bool Whether the function existed before it was removed.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function remove_filter( $hook_name, $callback, $priority = 10 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $r = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $wp_filter[ $tag ] ) ) {
- $r = $wp_filter[ $tag ]->remove_filter( $tag, $function_to_remove, $priority );
- if ( ! $wp_filter[ $tag ]->callbacks ) {
- unset( $wp_filter[ $tag ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( isset( $wp_filter[ $hook_name ] ) ) {
+ $r = $wp_filter[ $hook_name ]->remove_filter( $hook_name, $callback, $priority );
+
+ if ( ! $wp_filter[ $hook_name ]->callbacks ) {
+ unset( $wp_filter[ $hook_name ] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -294,23 +299,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove all of the hooks from a filter.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes all of the callback functions from a filter hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The filter to remove hooks from.
- * @param int|false $priority Optional. The priority number to remove. Default false.
- * @return true True when finished.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The filter to remove callbacks from.
+ * @param int|false $priority Optional. The priority number to remove them from.
+ * Default false.
+ * @return true Always returns true.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function remove_all_filters( $tag, $priority = false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function remove_all_filters( $hook_name, $priority = false ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $wp_filter[ $tag ] ) ) {
- $wp_filter[ $tag ]->remove_all_filters( $priority );
- if ( ! $wp_filter[ $tag ]->has_filters() ) {
- unset( $wp_filter[ $tag ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $wp_filter[ $hook_name ] ) ) {
+ $wp_filter[ $hook_name ]->remove_all_filters( $priority );
+
+ if ( ! $wp_filter[ $hook_name ]->has_filters() ) {
+ unset( $wp_filter[ $hook_name ] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -318,39 +325,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the name of the current filter or action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the name of the current filter hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $wp_current_filter Stores the list of current filters with the current one last
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string Hook name of the current filter or action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Hook name of the current filter.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function current_filter() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_current_filter;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return end( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the name of the current action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns whether or not a filter hook is currently being processed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 3.9.0
- *
- * @return string Hook name of the current action.
- */
-function current_action() {
- return current_filter();
-}
-
-/**
- * Retrieve the name of a filter currently being processed.
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * The function current_filter() only returns the most recent filter or action
</span><span class="cx" style="display: block; padding: 0 10px"> * being executed. did_action() returns true once the action is initially
</span><span class="cx" style="display: block; padding: 0 10px"> * processed.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This function allows detection for any filter currently being
- * executed (despite not being the most recent filter to fire, in the case of
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function allows detection for any filter currently being executed
+ * (regardless of whether it's the most recent filter to fire, in the case of
</ins><span class="cx" style="display: block; padding: 0 10px"> * hooks called from hook callbacks) to be verified.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.9.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -359,36 +356,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @see did_action()
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $wp_current_filter Current filter.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param null|string $filter Optional. Filter to check. Defaults to null, which
- * checks if any filter is currently being run.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param null|string $hook_name Optional. Filter hook to check. Defaults to null,
+ * which checks if any filter is currently being run.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether the filter is currently in the stack.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function doing_filter( $filter = null ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function doing_filter( $hook_name = null ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_current_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( null === $filter ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( null === $hook_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return ! empty( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return in_array( $filter, $wp_current_filter, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return in_array( $hook_name, $wp_current_filter, true );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the name of an action currently being processed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds a callback function to an action hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 3.9.0
- *
- * @param string|null $action Optional. Action to check. Defaults to null, which checks
- * if any action is currently being run.
- * @return bool Whether the action is currently in the stack.
- */
-function doing_action( $action = null ) {
- return doing_filter( $action );
-}
-
-/**
- * Hooks a function on to a specific action.
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * Actions are the hooks that the WordPress core launches at specific points
</span><span class="cx" style="display: block; padding: 0 10px"> * during execution, or when specific events occur. Plugins can specify that
</span><span class="cx" style="display: block; padding: 0 10px"> * one or more of its PHP functions are executed at these points, using the
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -396,26 +380,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the action to which the $function_to_add is hooked.
- * @param callable $function_to_add The name of the function you wish to be called.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the action to add the callback to.
+ * @param callable $callback The callback to be run when the action is called.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $priority Optional. Used to specify the order in which the functions
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * associated with a particular action are executed. Default 10.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * associated with a particular action are executed.
</ins><span class="cx" style="display: block; padding: 0 10px"> * Lower numbers correspond with earlier execution,
</span><span class="cx" style="display: block; padding: 0 10px"> * and functions with the same priority are executed
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * in the order in which they were added to the action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * in the order in which they were added to the action. Default 10.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $accepted_args Optional. The number of arguments the function accepts. Default 1.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return true Will always return true.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return true Always returns true.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
- return add_filter( $tag, $function_to_add, $priority, $accepted_args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function add_action( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) {
+ return add_filter( $hook_name, $callback, $priority, $accepted_args );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Execute functions hooked on a specific action hook.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Calls the callback functions that have been added to an action hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This function invokes all functions attached to action hook `$tag`. It is
- * possible to create new action hooks by simply calling this function,
- * specifying the name of the new hook using the `$tag` parameter.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function invokes all functions attached to action hook `$hook_name`.
+ * It is possible to create new action hooks by simply calling this function,
+ * specifying the name of the new hook using the `$hook_name` parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * You can pass extra arguments to the hooks, much like you can with `apply_filters()`.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -443,35 +427,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @global int[] $wp_actions Stores the number of times each action was triggered.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the action to be executed.
- * @param mixed ...$arg Optional. Additional arguments which are passed on to the
- * functions hooked to the action. Default empty.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the action to be executed.
+ * @param mixed ...$arg Optional. Additional arguments which are passed on to the
+ * functions hooked to the action. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function do_action( $tag, ...$arg ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function do_action( $hook_name, ...$arg ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter, $wp_actions, $wp_current_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_actions[ $tag ] ) ) {
- $wp_actions[ $tag ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $wp_actions[ $hook_name ] ) ) {
+ $wp_actions[ $hook_name ] = 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ++$wp_actions[ $tag ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ++$wp_actions[ $hook_name ];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Do 'all' actions first.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
</span><span class="cx" style="display: block; padding: 0 10px"> _wp_call_all_hook( $all_args );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_filter[ $tag ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $wp_filter[ $hook_name ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $arg ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -481,74 +466,55 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $arg[0] = $arg[0][0];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_filter[ $tag ]->do_action( $arg );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_filter[ $hook_name ]->do_action( $arg );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve the number of times an action is fired.
- *
- * @since 2.1.0
- *
- * @global int[] $wp_actions Stores the number of times each action was triggered.
- *
- * @param string $tag The name of the action hook.
- * @return int The number of times action hook $tag is fired.
- */
-function did_action( $tag ) {
- global $wp_actions;
-
- if ( ! isset( $wp_actions[ $tag ] ) ) {
- return 0;
- }
-
- return $wp_actions[ $tag ];
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Calls the callback functions that have been added to an action hook, specifying arguments in an array.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see do_action() This function is identical, but the arguments passed to the
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * functions hooked to `$tag` are supplied using an array.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * functions hooked to `$hook_name` are supplied using an array.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Hook[] $wp_filter Stores all of the filters and actions.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global int[] $wp_actions Stores the number of times each action was triggered.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string[] $wp_current_filter Stores the list of current filters with the current one last.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the action to be executed.
- * @param array $args The arguments supplied to the functions hooked to `$tag`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the action to be executed.
+ * @param array $args The arguments supplied to the functions hooked to `$hook_name`.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function do_action_ref_array( $tag, $args ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function do_action_ref_array( $hook_name, $args ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wp_filter, $wp_actions, $wp_current_filter;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_actions[ $tag ] ) ) {
- $wp_actions[ $tag ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $wp_actions[ $hook_name ] ) ) {
+ $wp_actions[ $hook_name ] = 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ++$wp_actions[ $tag ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ++$wp_actions[ $hook_name ];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Do 'all' actions first.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> $all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
</span><span class="cx" style="display: block; padding: 0 10px"> _wp_call_all_hook( $all_args );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! isset( $wp_filter[ $tag ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! isset( $wp_filter[ $hook_name ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $wp_filter['all'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $wp_filter['all'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_current_filter[] = $tag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_current_filter[] = $hook_name;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_filter[ $tag ]->do_action( $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_filter[ $hook_name ]->do_action( $args );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> array_pop( $wp_current_filter );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -556,7 +522,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Checks if any action has been registered for a hook.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * When using the `$function_to_check` argument, this function may return a non-boolean value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * When using the `$callback` argument, this function may return a non-boolean value
</ins><span class="cx" style="display: block; padding: 0 10px"> * that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -563,48 +529,96 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see has_filter() has_action() is an alias of has_filter().
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the action hook.
- * @param callable|false $function_to_check Optional. The callback to check for. Default false.
- * @return bool|int If `$function_to_check` is omitted, returns boolean for whether the hook has
- * anything registered. When checking a specific function, the priority of that
- * hook is returned, or false if the function is not attached.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the action hook.
+ * @param callable|false $callback Optional. The callback to check for. Default false.
+ * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
+ * anything registered. When checking a specific function, the priority
+ * of that hook is returned, or false if the function is not attached.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function has_action( $tag, $function_to_check = false ) {
- return has_filter( $tag, $function_to_check );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function has_action( $hook_name, $callback = false ) {
+ return has_filter( $hook_name, $callback );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Removes a function from a specified action hook.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes a callback function from an action hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This function removes a function attached to a specified action hook. This
- * method can be used to remove default functions attached to a specific filter
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This can be used to remove default functions attached to a specific action
</ins><span class="cx" style="display: block; padding: 0 10px"> * hook and possibly replace them with a substitute.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * To remove a hook, the `$callback` and `$priority` arguments must match
+ * when the hook was added. This goes for both filters and actions. No warning
+ * will be given on removal failure.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 1.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The action hook to which the function to be removed is hooked.
- * @param callable $function_to_remove The name of the function which should be removed.
- * @param int $priority Optional. The priority of the function. Default 10.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The action hook to which the function to be removed is hooked.
+ * @param callable $callback The name of the function which should be removed.
+ * @param int $priority Optional. The priority of the function. Default 10.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether the function is removed.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function remove_action( $tag, $function_to_remove, $priority = 10 ) {
- return remove_filter( $tag, $function_to_remove, $priority );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function remove_action( $hook_name, $callback, $priority = 10 ) {
+ return remove_filter( $hook_name, $callback, $priority );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove all of the hooks from an action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes all of the callback functions from an action hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.7.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The action to remove hooks from.
- * @param int|false $priority The priority number to remove them from. Default false.
- * @return true True when finished.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The action to remove callbacks from.
+ * @param int|false $priority Optional. The priority number to remove them from.
+ * Default false.
+ * @return true Always returns true.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function remove_all_actions( $tag, $priority = false ) {
- return remove_all_filters( $tag, $priority );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function remove_all_actions( $hook_name, $priority = false ) {
+ return remove_all_filters( $hook_name, $priority );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the name of the current action hook.
+ *
+ * @since 3.9.0
+ *
+ * @return string Hook name of the current action.
+ */
+function current_action() {
+ return current_filter();
+}
+
+/**
+ * Returns whether or not an action hook is currently being processed.
+ *
+ * @since 3.9.0
+ *
+ * @param string|null $hook_name Optional. Action hook to check. Defaults to null,
+ * which checks if any action is currently being run.
+ * @return bool Whether the action is currently in the stack.
+ */
+function doing_action( $hook_name = null ) {
+ return doing_filter( $hook_name );
+}
+
+/**
+ * Retrieves the number of times an action has been fired during the current request.
+ *
+ * @since 2.1.0
+ *
+ * @global int[] $wp_actions Stores the number of times each action was triggered.
+ *
+ * @param string $hook_name The name of the action hook.
+ * @return int The number of times the action hook has been fired.
+ */
+function did_action( $hook_name ) {
+ global $wp_actions;
+
+ if ( ! isset( $wp_actions[ $hook_name ] ) ) {
+ return 0;
+ }
+
+ return $wp_actions[ $hook_name ];
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Fires functions attached to a deprecated filter hook.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * When a filter hook is deprecated, the apply_filters() call is replaced with
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -624,20 +638,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see _deprecated_hook()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the filter hook.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the filter hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $args Array of additional function arguments to be passed to apply_filters().
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $version The version of WordPress that deprecated the hook.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $replacement Optional. The hook that should have been used. Default empty.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $message Optional. A message regarding the change. Default empty.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function apply_filters_deprecated( $tag, $args, $version, $replacement = '', $message = '' ) {
- if ( ! has_filter( $tag ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) {
+ if ( ! has_filter( $hook_name ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $args[0];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _deprecated_hook( $tag, $version, $replacement, $message );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _deprecated_hook( $hook_name, $version, $replacement, $message );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return apply_filters_ref_array( $tag, $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return apply_filters_ref_array( $hook_name, $args );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -651,20 +665,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @see _deprecated_hook()
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag The name of the action hook.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name The name of the action hook.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param array $args Array of additional function arguments to be passed to do_action().
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $version The version of WordPress that deprecated the hook.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $replacement Optional. The hook that should have been used. Default empty.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $message Optional. A message regarding the change. Default empty.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function do_action_deprecated( $tag, $args, $version, $replacement = '', $message = '' ) {
- if ( ! has_action( $tag ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function do_action_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) {
+ if ( ! has_action( $hook_name ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _deprecated_hook( $tag, $version, $replacement, $message );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _deprecated_hook( $hook_name, $version, $replacement, $message );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- do_action_ref_array( $tag, $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ do_action_ref_array( $hook_name, $args );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> //
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -690,6 +704,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $file = wp_normalize_path( $file );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> arsort( $wp_plugin_paths );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $wp_plugin_paths as $dir => $realdir ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( strpos( $file, $realdir ) === 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $file = $dir . substr( $file, strlen( $realdir ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -724,6 +739,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Normalize, but store as static to avoid recalculation of a constant value.
</span><span class="cx" style="display: block; padding: 0 10px"> static $wp_plugin_path = null, $wpmu_plugin_path = null;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $wp_plugin_path ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR );
</span><span class="cx" style="display: block; padding: 0 10px"> $wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -783,15 +799,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $file The filename of the plugin including the path.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param callable $function The function hooked to the 'activate_PLUGIN' action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param callable $callback The function hooked to the 'activate_PLUGIN' action.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function register_activation_hook( $file, $function ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function register_activation_hook( $file, $callback ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $file = plugin_basename( $file );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'activate_' . $file, $function );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_action( 'activate_' . $file, $callback );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set the deactivation hook for a plugin.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets the deactivation hook for a plugin.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is
</span><span class="cx" style="display: block; padding: 0 10px"> * called. In the name of this hook, PLUGINNAME is replaced with the name
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -806,15 +822,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $file The filename of the plugin including the path.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param callable $function The function hooked to the 'deactivate_PLUGIN' action.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param callable $callback The function hooked to the 'deactivate_PLUGIN' action.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function register_deactivation_hook( $file, $function ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function register_deactivation_hook( $file, $callback ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $file = plugin_basename( $file );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'deactivate_' . $file, $function );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_action( 'deactivate_' . $file, $callback );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set the uninstallation hook for a plugin.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets the uninstallation hook for a plugin.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Registers the uninstall hook that will be called when the user clicks on the
</span><span class="cx" style="display: block; padding: 0 10px"> * uninstall link that calls for the plugin to uninstall itself. The link won't
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -852,6 +868,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_basename = plugin_basename( $file );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $uninstallable_plugins[ $plugin_basename ] = $callback;
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'uninstall_plugins', $uninstallable_plugins );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -859,7 +876,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Call the 'all' hook, which will process the functions hooked into it.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Calls the 'all' hook, which will process the functions hooked into it.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The 'all' hook passes all of the arguments or parameters that were used for
</span><span class="cx" style="display: block; padding: 0 10px"> * the hook, which this function was called for.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -883,7 +900,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Build Unique ID for storage and retrieval.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Builds Unique ID for storage and retrieval.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The old way to serialize the callback caused issues and this function is the
</span><span class="cx" style="display: block; padding: 0 10px"> * solution. It works by checking for objects and creating a new property in
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -903,33 +920,33 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.2.3
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.3.0 Removed workarounds for spl_object_hash().
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * `$tag` and `$priority` are no longer used,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * `$hook_name` and `$priority` are no longer used,
</ins><span class="cx" style="display: block; padding: 0 10px"> * and the function always returns a string.
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $tag Unused. The name of the filter to build ID for.
- * @param callable $function The function to generate ID for.
- * @param int $priority Unused. The order in which the functions
- * associated with a particular action are executed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $hook_name Unused. The name of the filter to build ID for.
+ * @param callable $callback The function to generate ID for.
+ * @param int $priority Unused. The order in which the functions
+ * associated with a particular action are executed.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Unique function ID for usage as array key.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function _wp_filter_build_unique_id( $tag, $function, $priority ) {
- if ( is_string( $function ) ) {
- return $function;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function _wp_filter_build_unique_id( $hook_name, $callback, $priority ) {
+ if ( is_string( $callback ) ) {
+ return $callback;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_object( $function ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_object( $callback ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Closures are currently implemented as objects.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $function = array( $function, '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $callback = array( $callback, '' );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $function = (array) $function;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $callback = (array) $callback;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_object( $function[0] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_object( $callback[0] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Object class calling.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return spl_object_hash( $function[0] ) . $function[1];
- } elseif ( is_string( $function[0] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return spl_object_hash( $callback[0] ) . $callback[1];
+ } elseif ( is_string( $callback[0] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Static calling.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $function[0] . '::' . $function[1];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $callback[0] . '::' . $callback[1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>