Make WordPress Core

Changeset 32615


Ignore:
Timestamp:
05/27/2015 03:55:35 PM (9 years ago)
Author:
wonderboymusic
Message:

Add missing doc blocks to plugin.php.
has_filter() can use strict comparison when checking $has internally.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/plugin.php

    r32545 r32615  
    7777 *                                  in the order in which they were added to the action.
    7878 * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
    79  * @return boolean true
     79 * @return true
    8080 */
    8181function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
     
    9797 * @param string        $tag               The name of the filter hook.
    9898 * @param callback|bool $function_to_check Optional. The callback to check for. Default false.
    99  * @return bool|int If $function_to_check is omitted, returns boolean for whether the hook has
    100  *                  anything registered. When checking a specific function, the priority of that
    101  *                  hook is returned, or false if the function is not attached. When using the
    102  *                  $function_to_check argument, this function may return a non-boolean value
    103  *                  that evaluates to false (e.g.) 0, so use the === operator for testing the
    104  *                  return value.
     99 * @return false|int If $function_to_check is omitted, returns boolean for whether the hook has
     100 *                   anything registered. When checking a specific function, the priority of that
     101 *                   hook is returned, or false if the function is not attached. When using the
     102 *                   $function_to_check argument, this function may return a non-boolean value
     103 *                   that evaluates to false (e.g.) 0, so use the === operator for testing the
     104 *                   return value.
    105105 */
    106106function has_filter($tag, $function_to_check = false) {
     
    125125    }
    126126
    127     if ( false === $function_to_check || false == $has )
     127    if ( false === $function_to_check || false === $has )
    128128        return $has;
    129129
     
    289289 * @since 1.2.0
    290290 *
     291 * @global array $wp_filter         Stores all of the filters
     292 * @global array $merged_filters    Merges the filter hooks using this function.
     293 *
    291294 * @param string   $tag                The filter hook to which the function to be removed is hooked.
    292295 * @param callback $function_to_remove The name of the function which should be removed.
    293296 * @param int      $priority           Optional. The priority of the function. Default 10.
    294  * @return boolean Whether the function existed before it was removed.
     297 * @return bool    Whether the function existed before it was removed.
    295298 */
    296299function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
     
    318321 * @since 2.7.0
    319322 *
     323 * @global array $wp_filter         Stores all of the filters
     324 * @global array $merged_filters    Merges the filter hooks using this function.
     325 *
    320326 * @param string   $tag      The filter to remove hooks from.
    321327 * @param int|bool $priority Optional. The priority number to remove. Default false.
    322  * @return bool True when finished.
     328 * @return true True when finished.
    323329 */
    324330function remove_all_filters( $tag, $priority = false ) {
     
    342348 *
    343349 * @since 2.5.0
     350 *
     351 * @global array $wp_current_filter Stores the list of current filters with the current one last
    344352 *
    345353 * @return string Hook name of the current filter or action.
     
    423431 *                                  in the order in which they were added to the action.
    424432 * @param int      $accepted_args   Optional. The number of arguments the function accept. Default 1.
    425  * @return bool Will always return true.
     433 * @return true Will always return true.
    426434 */
    427435function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
     
    441449 * @since 1.2.0
    442450 *
    443  * @global array $wp_filter  Stores all of the filters
    444  * @global array $wp_actions Increments the amount of times action was triggered.
     451 * @global array $wp_filter         Stores all of the filters
     452 * @global array $wp_actions        Increments the amount of times action was triggered.
     453 * @global array $merged_filters    Merges the filter hooks using this function.
     454 * @global array $wp_current_filter Stores the list of current filters with the current one last
    445455 *
    446456 * @param string $tag The name of the action to be executed.
    447457 * @param mixed  $arg Optional. Additional arguments which are passed on to the
    448458 *                    functions hooked to the action. Default empty.
    449  * @return null Will return null if $tag does not exist in $wp_filter array.
    450459 */
    451460function do_action($tag, $arg = '') {
     
    525534 * @see do_action() This function is identical, but the arguments passed to the
    526535 *                  functions hooked to $tag< are supplied using an array.
    527  * @global array $wp_filter  Stores all of the filters
    528  * @global array $wp_actions Increments the amount of times action was triggered.
     536 * @global array $wp_filter         Stores all of the filters
     537 * @global array $wp_actions        Increments the amount of times action was triggered.
     538 * @global array $merged_filters    Merges the filter hooks using this function.
     539 * @global array $wp_current_filter Stores the list of current filters with the current one last
    529540 *
    530541 * @param string $tag  The name of the action to be executed.
    531542 * @param array  $args The arguments supplied to the functions hooked to `$tag`.
    532  * @return null Will return null if `$tag` does not exist in `$wp_filter` array.
    533543 */
    534544function do_action_ref_array($tag, $args) {
     
    619629 * @param string   $tag      The action to remove hooks from.
    620630 * @param int|bool $priority The priority number to remove them from. Default false.
    621  * @return bool True when finished.
     631 * @return true True when finished.
    622632 */
    623633function remove_all_actions($tag, $priority = false) {
     
    635645 *
    636646 * @since 1.5.0
     647 *
     648 * @global array $wp_plugin_paths
    637649 *
    638650 * @param string $file The filename of plugin.
     
    665677 *
    666678 * @see plugin_basename()
     679 *
     680 * @global array $wp_plugin_paths
     681 *
     682 * @staticvar string $wp_plugin_path
     683 * @staticvar string $wpmu_plugin_path
    667684 *
    668685 * @param string $file Known path to the file.
     
    820837 * @access private
    821838 *
     839 * @global array $wp_filter  Stores all of the filters
     840 *
    822841 * @param array $args The collected parameters from the hook that was called.
    823842 */
     
    857876 *
    858877 * @global array $wp_filter Storage for all of the filters and actions.
     878 * @staticvar int $filter_id_count
    859879 *
    860880 * @param string   $tag      Used in counting how many hooks were applied
     
    863883 *                           and $function is an object reference, we return the unique
    864884 *                           id only if it already has one, false otherwise.
    865  * @return string|bool Unique ID for usage as array key or false if $priority === false
    866  *                     and $function is an object reference, and it does not already have
    867  *                     a unique id.
     885 * @return string|false Unique ID for usage as array key or false if $priority === false
     886 *                      and $function is an object reference, and it does not already have
     887 *                      a unique id.
    868888 */
    869889function _wp_filter_build_unique_id($tag, $function, $priority) {
Note: See TracChangeset for help on using the changeset viewer.