| 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 | */ |
|---|
| | 26 | /** |
|---|
| | 27 | * Call the functions added to a filter hook. |
|---|
| | 28 | * |
|---|
| | 29 | * The callback functions attached to filter hook <tt>$tag</tt> are invoked by |
|---|
| | 30 | * calling this function. This function can be used to create a new filter hook |
|---|
| | 31 | * by simply calling this function with the name of the new hook specified using |
|---|
| | 32 | * the <tt>$tag</a> parameter. |
|---|
| | 33 | * @uses merge_filters Merges the filter hooks using this function. |
|---|
| | 34 | * @param string $tag The name of the filter hook. |
|---|
| | 35 | * @param string $string The text on which the filters hooked to <tt>$tag</tt> are applied on. |
|---|
| | 36 | * @param mixed $var,... Additional variables passed to the functions hooked to <tt>$tag</tt>. |
|---|
| | 37 | * @return string The text in <tt>$string</tt> after all hooked functions are applied to it. |
|---|
| | 38 | */ |
|---|
| | 82 | /** |
|---|
| | 83 | * Removes a function from a specified filter hook. |
|---|
| | 84 | * |
|---|
| | 85 | * This function removes a function attached to a specified filter hook. This |
|---|
| | 86 | * method can be used to remove default functions attached to a specific filter |
|---|
| | 87 | * hook and possibly replace them with a substitute. |
|---|
| | 88 | * @param string $tag The filter hook to which the function to be removed is hooked. |
|---|
| | 89 | * @param callback $function_to_remove The name of the function which should be removed. |
|---|
| | 90 | * @param int $priority optional. The priority of the function (default: 10). |
|---|
| | 91 | * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). |
|---|
| | 92 | * @return boolean Whether the function is removed. |
|---|
| | 93 | */ |
|---|
| 57 | | // |
|---|
| 58 | | // Action functions |
|---|
| 59 | | // |
|---|
| 60 | | |
|---|
| | 102 | /** |
|---|
| | 103 | * Hooks a function on to a specific action. |
|---|
| | 104 | * |
|---|
| | 105 | * Actions are the hooks that the WordPress core launches at specific points |
|---|
| | 106 | * during execution, or when specific events occur. Plugins can specify that |
|---|
| | 107 | * one or more of its PHP functions are executed at these points, using the |
|---|
| | 108 | * Action API. |
|---|
| | 109 | * |
|---|
| | 110 | * @param string $tag The name of the action to which the <tt>$function_to-add</tt> is hooked. |
|---|
| | 111 | * @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. |
|---|
| | 112 | * @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. |
|---|
| | 113 | * @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. |
|---|
| | 114 | * @return boolean Always true. |
|---|
| | 115 | */ |
|---|
| | 200 | /** |
|---|
| | 201 | * Removes a function from a specified action hook. |
|---|
| | 202 | * |
|---|
| | 203 | * This function removes a function attached to a specified action hook. This |
|---|
| | 204 | * method can be used to remove default functions attached to a specific filter |
|---|
| | 205 | * hook and possibly replace them with a substitute. |
|---|
| | 206 | * @param string $tag The action hook to which the function to be removed is hooked. |
|---|
| | 207 | * @param callback $function_to_remove The name of the function which should be removed. |
|---|
| | 208 | * @param int $priority optional The priority of the function (default: 10). |
|---|
| | 209 | * @param int $accepted_args optional. The number of arguments the function accpets (default: 1). |
|---|
| | 210 | * @return boolean Whether the function is removed. |
|---|
| | 211 | */ |
|---|
| | 233 | /** |
|---|
| | 234 | * Hook a function on a plugin activation action hook. |
|---|
| | 235 | * |
|---|
| | 236 | * When a plugin is activated, the action 'activate_PLUGINNAME' hook is |
|---|
| | 237 | * activated. In the name of this hook, PLUGINNAME is replaced with the name of |
|---|
| | 238 | * the plugin, including the optional subdirectory. For example, when the plugin |
|---|
| | 239 | * is located in <tt>wp-content/plugin/sampleplugin/sample.php</tt>, then the |
|---|
| | 240 | * name of this hook will become 'activate_sampleplugin/sample.php'. |
|---|
| | 241 | * When the plugin consists of only one file and is (as by default) located at |
|---|
| | 242 | * <tt>wp-content/plugin/sample.php</tt> the name of this hook will be |
|---|
| | 243 | * 'activate_sample.php'. |
|---|
| | 244 | * @param string $file The filename of the plugin including the path. |
|---|
| | 245 | * @param string $function the function hooked to the 'activate_PLUGIN' action. |
|---|
| | 246 | */ |
|---|
| | 252 | /** |
|---|
| | 253 | * Hook a function on a plugin deactivation action hook. |
|---|
| | 254 | * |
|---|
| | 255 | * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is |
|---|
| | 256 | * deactivated. In the name of this hook, PLUGINNAME is replaced with the name of |
|---|
| | 257 | * the plugin, including the optional subdirectory. For example, when the plugin |
|---|
| | 258 | * is located in <tt>wp-content/plugin/sampleplugin/sample.php</tt>, then the |
|---|
| | 259 | * name of this hook will become 'activate_sampleplugin/sample.php'. |
|---|
| | 260 | * When the plugin consists of only one file and is (as by default) located at |
|---|
| | 261 | * <tt>wp-content/plugin/sample.php</tt> the name of this hook will be |
|---|
| | 262 | * 'activate_sample.php'. |
|---|
| | 263 | * @param string $file The filename of the plugin including the path. |
|---|
| | 264 | * @param string $function the function hooked to the 'activate_PLUGIN' action. |
|---|
| | 265 | */ |
|---|