mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Docs: Correct @param type for the function parameter in tests_add_filter() and _test_filter_build_unique_id().
Synchronize documentation for `add_filter()`, `tests_add_filter()`, `_wp_filter_build_unique_id()`, `_test_filter_build_unique_id()`. Add a note that `$tag` and `$priority` are no longer used in `_wp_filter_build_unique_id()` since [46220], and the function always returns a string now. Props donmhico, remcotolsma, SergeyBiryukov. Fixes #47407. See #48303. git-svn-id: https://develop.svn.wordpress.org/trunk@46801 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -93,15 +93,15 @@ if ( ! isset( $wp_current_filter ) ) {
|
||||
*
|
||||
* @since 0.71
|
||||
*
|
||||
* @global array $wp_filter A multidimensional array of all hooks and the callbacks hooked to them.
|
||||
* @global array $wp_filter A multidimensional array of all hooks and the callbacks hooked to them.
|
||||
*
|
||||
* @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. Default 10.
|
||||
* 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.
|
||||
* 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
|
||||
*/
|
||||
@@ -119,7 +119,7 @@ function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters.
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
*
|
||||
* @param string $tag The name of the filter hook.
|
||||
* @param callable|bool $function_to_check Optional. The callback to check for. Default false.
|
||||
@@ -170,7 +170,7 @@ function has_filter( $tag, $function_to_check = false ) {
|
||||
*
|
||||
* @since 0.71
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters.
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last.
|
||||
*
|
||||
* @param string $tag The name of the filter hook.
|
||||
@@ -218,8 +218,8 @@ function apply_filters( $tag, $value ) {
|
||||
* @see apply_filters() This function is identical, but the arguments passed to the
|
||||
* functions hooked to `$tag` are supplied using an array.
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last.
|
||||
*
|
||||
* @param string $tag The name of the filter hook.
|
||||
* @param array $args The arguments supplied to the functions hooked to $tag.
|
||||
@@ -266,7 +266,7 @@ function apply_filters_ref_array( $tag, $args ) {
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
*
|
||||
* @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.
|
||||
@@ -292,7 +292,7 @@ function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
*
|
||||
* @param string $tag The filter to remove hooks from.
|
||||
* @param int|bool $priority Optional. The priority number to remove. Default false.
|
||||
@@ -433,9 +433,9 @@ function add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1
|
||||
* @since 5.3.0 Formalized the existing and already documented `...$arg` parameter
|
||||
* by adding it to the function signature.
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
* @global array $wp_actions Increments the amount of times action was triggered.
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last.
|
||||
*
|
||||
* @param string $tag The name of the action to be executed.
|
||||
* @param mixed ...$arg Optional. Additional arguments which are passed on to the
|
||||
@@ -507,9 +507,9 @@ function did_action( $tag ) {
|
||||
*
|
||||
* @see do_action() This function is identical, but the arguments passed to the
|
||||
* functions hooked to `$tag` are supplied using an array.
|
||||
* @global array $wp_filter Stores all of the filters
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
* @global array $wp_actions Increments the amount of times action was triggered.
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last
|
||||
* @global array $wp_current_filter Stores the list of current filters with the current one last.
|
||||
*
|
||||
* @param string $tag The name of the action to be executed.
|
||||
* @param array $args The arguments supplied to the functions hooked to `$tag`.
|
||||
@@ -867,7 +867,7 @@ function register_uninstall_hook( $file, $callback ) {
|
||||
* @since 2.5.0
|
||||
* @access private
|
||||
*
|
||||
* @global array $wp_filter Stores all of the filters
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
*
|
||||
* @param array $args The collected parameters from the hook that was called.
|
||||
*/
|
||||
@@ -897,19 +897,19 @@ function _wp_call_all_hook( $args ) {
|
||||
* @link https://core.trac.wordpress.org/ticket/3875
|
||||
*
|
||||
* @since 2.2.3
|
||||
* @since 5.3.0 Removed workarounds for spl_object_hash().
|
||||
* `$tag` and `$priority` are no longer used,
|
||||
* and the function always returns a string.
|
||||
* @access private
|
||||
*
|
||||
* @global array $wp_filter Storage for all of the filters and actions.
|
||||
* @global array $wp_filter Stores all of the filters and actions.
|
||||
* @staticvar int $filter_id_count
|
||||
*
|
||||
* @param string $tag Used in counting how many hooks were applied
|
||||
* @param callable $function Used for creating unique id
|
||||
* @param int|bool $priority Used in counting how many hooks were applied. If === false
|
||||
* and $function is an object reference, we return the unique
|
||||
* id only if it already has one, false otherwise.
|
||||
* @return string|false Unique ID for usage as array key or false if $priority === false
|
||||
* and $function is an object reference, and it does not already have
|
||||
* a unique id.
|
||||
* @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.
|
||||
* @return string Unique ID for usage as array key.
|
||||
*/
|
||||
function _wp_filter_build_unique_id( $tag, $function, $priority ) {
|
||||
global $wp_filter;
|
||||
@@ -920,17 +920,17 @@ function _wp_filter_build_unique_id( $tag, $function, $priority ) {
|
||||
}
|
||||
|
||||
if ( is_object( $function ) ) {
|
||||
// Closures are currently implemented as objects
|
||||
// Closures are currently implemented as objects.
|
||||
$function = array( $function, '' );
|
||||
} else {
|
||||
$function = (array) $function;
|
||||
}
|
||||
|
||||
if ( is_object( $function[0] ) ) {
|
||||
// Object Class Calling
|
||||
// Object class calling.
|
||||
return spl_object_hash( $function[0] ) . $function[1];
|
||||
} elseif ( is_string( $function[0] ) ) {
|
||||
// Static Calling
|
||||
// Static calling.
|
||||
return $function[0] . '::' . $function[1];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user