Test that Premium hooks are executed [PREMIUM-2]

This commit is contained in:
Alexey Stoletniy
2017-03-21 21:36:36 +03:00
parent d686f75222
commit 32097b4512
10 changed files with 263 additions and 11 deletions

28
lib/WP/Hooks.php Normal file
View 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);
}
}