3 | | // |
4 | | // Filter functions, the core of the WP plugin architecture. |
5 | | // |
6 | | |
| 3 | /** |
| 4 | * Hooks a function to a specific filter action. |
| 5 | * |
| 6 | * Filters are the hooks that WordPress launches to modify text of various types |
| 7 | * before adding it to the database or sending it to the browser screen. Plugins |
| 8 | * can specify that one or more of its PHP functions is executed to |
| 9 | * modify specific types of text at these times, using the Filter API. |
| 10 | * See the [Plugin API] for a list of filter hooks. |
| 11 | * |
| 12 | * @param string $tag The name of the filter to hook the <tt>$function_to_add</tt> to. |
| 13 | * @param callback $function_to_add The name of the function to be called when the filter is applied. |
| 14 | * @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. |
| 15 | * @param int $accepted_args optional. The number of arguments the function accept (default 1). In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run. |
| 16 | * @return boolean true if the <tt>$function_to_add</tt> is added succesfully to filter <tt>$tag</tt>. How many arguments your function takes. In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching <tt>do_action()</tt> or <tt>apply_filters()</tt> call is run. For example, the action <tt>comment_id_not_found</tt> will pass any functions that hook onto it the ID of the requested comment. |
| 17 | */ |
| 36 | /** |
| 37 | * Call the functions added to a filter hook. |
| 38 | * |
| 39 | * The callback functions attached to filter hook <tt>$tag</tt> are invoked by |
| 40 | * calling this function. This function can be used to create a new filter hook |
| 41 | * by simply calling this function with the name of the new hook specified using |
| 42 | * the <tt>$tag</a> parameter. |
| 43 | * @uses merge_filters Merges the filter hooks using this function. |
| 44 | * @param string $tag The name of the filter hook. |
| 45 | * @param string $string The text on which the filters hooked to <tt>$tag</tt> are applied on. |
| 46 | * @param mixed $var,... Additional variables passed to the functions hooked to <tt>$tag</tt>. |
| 47 | * @return string The text in <tt>$string</tt> after all hooked functions are applied to it. |
| 48 | */ |
| 104 | /** |
| 105 | * Removes a function from a specified filter hook. |
| 106 | * |
| 107 | * This function removes a function attached to a specified filter hook. This |
| 108 | * method can be used to remove default functions attached to a specific filter |
| 109 | * hook and possibly replace them with a substitute. |
| 110 | * @param string $tag The filter hook to which the function to be removed is hooked. |
| 111 | * @param callback $function_to_remove The name of the function which should be removed. |
| 112 | * @param int $priority optional. The priority of the function (default: 10). |
| 113 | * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). |
| 114 | * @return boolean Whether the function is removed. |
| 115 | */ |
86 | | // |
87 | | // Action functions |
88 | | // |
89 | | |
| 131 | /** |
| 132 | * Hooks a function on to a specific action. |
| 133 | * |
| 134 | * Actions are the hooks that the WordPress core launches at specific points |
| 135 | * during execution, or when specific events occur. Plugins can specify that |
| 136 | * one or more of its PHP functions are executed at these points, using the |
| 137 | * Action API. |
| 138 | * |
| 139 | * @param string $tag The name of the action to which the <tt>$function_to-add</tt> is hooked. |
| 140 | * @param callback $function_to_add The name of the function you wish to be called. Note: any of the syntaxes explained in the PHP documentation for the 'callback' type (http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback) are valid. |
| 141 | * @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. |
| 142 | * @param int $accepted_args optional. The number of arguments the function accept (default 1). In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run. |
| 143 | * @return boolean Always true. |
| 144 | */ |
| 249 | /** |
| 250 | * Removes a function from a specified action hook. |
| 251 | * |
| 252 | * This function removes a function attached to a specified action hook. This |
| 253 | * method can be used to remove default functions attached to a specific filter |
| 254 | * hook and possibly replace them with a substitute. |
| 255 | * @param string $tag The action hook to which the function to be removed is hooked. |
| 256 | * @param callback $function_to_remove The name of the function which should be removed. |
| 257 | * @param int $priority optional The priority of the function (default: 10). |
| 258 | * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). |
| 259 | * @return boolean Whether the function is removed. |
| 260 | */ |
| 282 | /** |
| 283 | * Hook a function on a plugin activation action hook. |
| 284 | * |
| 285 | * When a plugin is activated, the action 'activate_PLUGINNAME' hook is |
| 286 | * activated. In the name of this hook, PLUGINNAME is replaced with the name of |
| 287 | * the plugin, including the optional subdirectory. For example, when the plugin |
| 288 | * is located in <tt>wp-content/plugin/sampleplugin/sample.php</tt>, then the |
| 289 | * name of this hook will become 'activate_sampleplugin/sample.php'. |
| 290 | * When the plugin consists of only one file and is (as by default) located at |
| 291 | * <tt>wp-content/plugin/sample.php</tt> the name of this hook will be |
| 292 | * 'activate_sample.php'. |
| 293 | * @param string $file The filename of the plugin including the path. |
| 294 | * @param string $function the function hooked to the 'activate_PLUGIN' action. |
| 295 | */ |
| 301 | /** |
| 302 | * Hook a function on a plugin deactivation action hook. |
| 303 | * |
| 304 | * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is |
| 305 | * deactivated. In the name of this hook, PLUGINNAME is replaced with the name of |
| 306 | * the plugin, including the optional subdirectory. For example, when the plugin |
| 307 | * is located in <tt>wp-content/plugin/sampleplugin/sample.php</tt>, then the |
| 308 | * name of this hook will become 'activate_sampleplugin/sample.php'. |
| 309 | * When the plugin consists of only one file and is (as by default) located at |
| 310 | * <tt>wp-content/plugin/sample.php</tt> the name of this hook will be |
| 311 | * 'activate_sample.php'. |
| 312 | * @param string $file The filename of the plugin including the path. |
| 313 | * @param string $function the function hooked to the 'activate_PLUGIN' action. |
| 314 | */ |