simplify fqn + remove unused code.
This commit is contained in:
parent
dc9d8e024a
commit
ee9ce755ee
|
@ -8,6 +8,7 @@
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Automattic\WooCommerce\HooksRegistry;
|
||||
use Automattic\WooCommerce\Internal\AssignDefaultCategory;
|
||||
use Automattic\WooCommerce\Internal\BatchProcessing\BatchProcessingController;
|
||||
use Automattic\WooCommerce\Internal\ComingSoon\ComingSoonAdminBarBadge;
|
||||
|
@ -707,7 +708,7 @@ final class WooCommerce {
|
|||
*/
|
||||
include_once WC_ABSPATH . 'includes/wccom-site/class-wc-wccom-site.php';
|
||||
|
||||
\Automattic\WooCommerce\HooksRegistry::load_hooks();
|
||||
HooksRegistry::load_hooks();
|
||||
|
||||
/**
|
||||
* Libraries and packages.
|
||||
|
|
|
@ -8,13 +8,6 @@ namespace Automattic\WooCommerce;
|
|||
*/
|
||||
class HooksRegistry {
|
||||
|
||||
/**
|
||||
* Whether the hooks are already loaded or not.
|
||||
*
|
||||
* @var bool $hooks_loaded
|
||||
*/
|
||||
public static bool $hooks_loaded = false;
|
||||
|
||||
/**
|
||||
* List of all actions that should be registered for all requests.
|
||||
*
|
||||
|
@ -107,18 +100,12 @@ class HooksRegistry {
|
|||
foreach ( self::$frontend_filters as $filter ) {
|
||||
call_user_func_array( 'add_filter', $filter );
|
||||
}
|
||||
|
||||
self::$hooks_loaded = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* DANGEROUS: This method is used for testing and benchmarking. Do not call, unless you really know what you are doing.
|
||||
*/
|
||||
public static function unload_hooks() {
|
||||
if ( ! self::$hooks_loaded ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_admin() ) {
|
||||
foreach ( self::$admin_actions as $action ) {
|
||||
call_user_func_array( 'remove_action', $action );
|
||||
|
@ -146,7 +133,5 @@ class HooksRegistry {
|
|||
foreach ( self::$all_request_filters as $filter ) {
|
||||
call_user_func_array( 'remove_filter', $filter );
|
||||
}
|
||||
|
||||
self::$hooks_loaded = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue