Test that Premium hooks are executed [PREMIUM-2]
This commit is contained in:
28
lib/WP/Hooks.php
Normal file
28
lib/WP/Hooks.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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 addAction() {
|
||||
return self::callWithFallback('add_action', func_get_args());
|
||||
}
|
||||
|
||||
static function doAction() {
|
||||
return self::callWithFallback('do_action', 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