WordPress.org

Make WordPress Core

Ticket #8640: 8640.diff

File 8640.diff, 2.9 KB (added by Denis-de-Bernardy, 9 years ago)
  • Users/denis/Sites/sem-pro/wp-includes/plugin.php

     
    7272}
    7373
    7474/**
     75 * Hooks multiple functions to a specific filter action.
     76 *
     77 * <code>
     78 * function example_hook($example) { echo $example; }
     79 * add_filter(array('example_filter1', 'example_filter2'), 'example_hook');
     80 * </code>
     81 *
     82 * @package WordPress
     83 * @subpackage Plugin
     84 * @since 2.8
     85 * @global array $wp_filter Stores all of the filters added in the form of
     86 *      wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
     87 * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process.
     88 *
     89 * @param array of string $tag The names of the filters to hook the $function_to_add to.
     90 * @param callback $function_to_add The name of the function to be called when the filter is applied.
     91 * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). 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.
     92 * @param int $accepted_args optional. The number of arguments the function accept (default 1).
     93 * @return boolean true
     94 */
     95
     96function add_filters($tags, $function_to_add, $priority = 10, $accepted_args = 1) {
     97        foreach ( (array) $tags as $tag ) {
     98                add_filter($tag, $function_to_add, $priority, $accepted_args);
     99        }
     100        return true;
     101}
     102
     103
     104/**
    75105 * Check if any filter has been registered for a hook.
    76106 *
    77107 * @package WordPress
     
    273303}
    274304
    275305
     306
    276307/**
     308 * Hooks a function on to multiple actions.
     309 *
     310 * @uses add_filters() Adds an action. Parameter list and functionality are the same.
     311 *
     312 * @package WordPress
     313 * @subpackage Plugin
     314 * @since 1.8
     315 *
     316 * @param array of string $tag The names of the actions to which the $function_to_add is hooked.
     317 * @param callback $function_to_add The name of the function you wish to be called.
     318 * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). 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.
     319 * @param int $accepted_args optional. The number of arguments the function accept (default 1).
     320 */
     321function add_actions($tags, $function_to_add, $priority = 10, $accepted_args = 1) {
     322        return add_filters($tags, $function_to_add, $priority, $accepted_args);
     323}
     324
     325
     326/**
    277327 * Execute functions hooked on a specific action hook.
    278328 *
    279329 * This function invokes all functions attached to action hook $tag. It is