]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/plugin.php
Wordpress 3.5
[autoinstalls/wordpress.git] / wp-includes / plugin.php
index 945461c55dc4d20b36828894c6a042fd8d8f019d..7e38708034815743b5a993a61d95c9dd3823e960 100644 (file)
@@ -80,8 +80,11 @@ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1)
  * @global array $wp_filter Stores all of the filters
  *
  * @param string $tag The name of the filter hook.
- * @param callback $function_to_check optional.  If specified, return the priority of that function on this hook or false if not attached.
- * @return int|boolean Optionally returns the priority on that hook for the specified function.
+ * @param callback $function_to_check optional.
+ * @return mixed 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.
+ *     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.
  */
 function has_filter($tag, $function_to_check = false) {
        global $wp_filter;
@@ -251,10 +254,10 @@ function apply_filters_ref_array($tag, $args) {
  * @param string $tag The filter hook to which the function to be removed is hooked.
  * @param callback $function_to_remove The name of the function which should be removed.
  * @param int $priority optional. The priority of the function (default: 10).
- * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
+ * @param int $accepted_args optional. The number of arguments the function accepts (default: 1).
  * @return boolean Whether the function existed before it was removed.
  */
-function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
+function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
        $function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
 
        $r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
@@ -308,7 +311,6 @@ function current_filter() {
        return end( $wp_current_filter );
 }
 
-
 /**
  * Hooks a function on to a specific action.
  *
@@ -332,7 +334,6 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
        return add_filter($tag, $function_to_add, $priority, $accepted_args);
 }
 
-
 /**
  * Execute functions hooked on a specific action hook.
  *
@@ -410,7 +411,7 @@ function do_action($tag, $arg = '') {
 }
 
 /**
- * Retrieve the number times an action is fired.
+ * Retrieve the number of times an action is fired.
  *
  * @package WordPress
  * @subpackage Plugin
@@ -499,8 +500,11 @@ function do_action_ref_array($tag, $args) {
  * @see has_filter() has_action() is an alias of has_filter().
  *
  * @param string $tag The name of the action hook.
- * @param callback $function_to_check optional.  If specified, return the priority of that function on this hook or false if not attached.
- * @return int|boolean Optionally returns the priority on that hook for the specified function.
+ * @param callback $function_to_check optional.
+ * @return mixed 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.
+ *     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.
  */
 function has_action($tag, $function_to_check = false) {
        return has_filter($tag, $function_to_check);
@@ -520,11 +524,10 @@ function has_action($tag, $function_to_check = false) {
  * @param string $tag The action hook to which the function to be removed is hooked.
  * @param callback $function_to_remove The name of the function which should be removed.
  * @param int $priority optional The priority of the function (default: 10).
- * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
  * @return boolean Whether the function is removed.
  */
-function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
-       return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
+function remove_action( $tag, $function_to_remove, $priority = 10 ) {
+       return remove_filter( $tag, $function_to_remove, $priority );
 }
 
 /**
@@ -744,8 +747,8 @@ function _wp_call_all_hook($args) {
  * @global array $wp_filter Storage for all of the filters and actions
  * @param string $tag Used in counting how many hooks were applied
  * @param callback $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|bool 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 uniqe 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|bool 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.
  */
 function _wp_filter_build_unique_id($tag, $function, $priority) {
        global $wp_filter;
@@ -784,5 +787,3 @@ function _wp_filter_build_unique_id($tag, $function, $priority) {
                return $function[0].$function[1];
        }
 }
-
-?>