Move WPHooks methods to WPFunctions
This commit is contained in:
@@ -24,6 +24,34 @@ class Functions {
|
||||
return call_user_func_array('wp_remote_retrieve_response_message', func_get_args());
|
||||
}
|
||||
|
||||
function addFilter() {
|
||||
return call_user_func_array('add_filter', func_get_args());
|
||||
}
|
||||
|
||||
function applyFilters() {
|
||||
return call_user_func_array('apply_filters', func_get_args());
|
||||
}
|
||||
|
||||
function removeFilter() {
|
||||
return call_user_func_array('remove_filter', func_get_args());
|
||||
}
|
||||
|
||||
function addAction() {
|
||||
return call_user_func_array('add_action', func_get_args());
|
||||
}
|
||||
|
||||
function doAction() {
|
||||
return call_user_func_array('do_action', func_get_args());
|
||||
}
|
||||
|
||||
function removeAction() {
|
||||
return call_user_func_array('remove_action', func_get_args());
|
||||
}
|
||||
|
||||
function removeAllFilters() {
|
||||
return call_user_func_array('remove_all_filters', func_get_args());
|
||||
}
|
||||
|
||||
function currentTime() {
|
||||
return call_user_func_array('current_time', func_get_args());
|
||||
}
|
||||
|
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
namespace MailPoet\WP;
|
||||
|
||||
class Hooks {
|
||||
static function addFilter() {
|
||||
return self::callWithFallback('add_filter', func_get_args());
|
||||
}
|
||||
|
||||
static function applyFilters() {
|
||||
return self::callWithFallback('apply_filters', func_get_args());
|
||||
}
|
||||
|
||||
static function removeFilter() {
|
||||
return self::callWithFallback('remove_filter', func_get_args());
|
||||
}
|
||||
|
||||
static function addAction() {
|
||||
return self::callWithFallback('add_action', func_get_args());
|
||||
}
|
||||
|
||||
static function doAction() {
|
||||
return self::callWithFallback('do_action', func_get_args());
|
||||
}
|
||||
|
||||
static function removeAction() {
|
||||
return self::callWithFallback('remove_action', func_get_args());
|
||||
}
|
||||
|
||||
static function removeAllFilters() {
|
||||
return self::callWithFallback('remove_all_filters', func_get_args());
|
||||
}
|
||||
|
||||
private static function callWithFallback($func, $args) {
|
||||
$local_func = __NAMESPACE__ . '\\' . $func;
|
||||
if(function_exists($local_func)) {
|
||||
return call_user_func_array($local_func, $args);
|
||||
}
|
||||
return call_user_func_array($func, $args);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user