Declares the hooks (actions and filters) functions so you wouldn't have to go through the OOP calling with the global class every time.
PHP-Hooks: https://github.com/bainternet/PHP-Hooks
Declares the hooks (actions and filters) functions so you wouldn't have to go through the OOP calling with the global class every time.
PHP-Hooks: https://github.com/bainternet/PHP-Hooks
| <?php | |
| /** | |
| * @link https://github.com/bainternet/PHP-Hooks | |
| */ | |
| function hooks() { | |
| global $hooks; | |
| if ( !isset($hooks) || !($hooks instanceof \Hooks) ) { | |
| $hooks = new \Hooks; | |
| } | |
| return $hooks; | |
| } | |
| function add_filter() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function remove_filter() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function remove_all_filters() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function has_filter() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function apply_filters() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function apply_filters_ref_array() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function add_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function has_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function remove_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function remove_all_actions() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function do_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function do_action_ref_array() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function did_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function current_filter() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function current_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function doing_filter() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } | |
| function doing_action() { | |
| return call_user_func_array(array(hooks(), __FUNCTION__), func_get_args()); | |
| } |