'cart', '/checkout' => 'checkout', '/my-account' => 'account', '/account' => 'account', '/shop' => 'archive', ); foreach ($slug_map as $slug => $label) { if ($path === $slug || strpos($path, $slug . '/') === 0) { return $cached = $label; } } if (strpos($path, '/product/') === 0) { return $cached = 'product'; } foreach (array('/product-category/', '/product-tag/', '/product-brand/', '/product-need/', '/product-supplier/', '/marca/', '/brand/') as $prefix) { if (strpos($path, $prefix) === 0) { return $cached = 'archive'; } } if ($path === '/') { return $cached = 'homepage'; } return $cached = 'other_frontend'; } public static function reset_context_cache() { } public static function manifest() { return array( 'AIEO_DMM_Sticky_ATC' => array('product', 'frontend_ajax'), 'AIEO_DMM_Complementary' => array('product', 'cart', 'frontend_ajax'), 'AIEO_DMM_Variations_Gallery' => array('product', 'frontend_ajax'), 'AIEO_DMM_Product_Video' => array('product'), 'AIEO_DMM_Product_Meta' => array('product'), 'AIEO_DMM_Trust_Badges' => array('product', 'cart', 'checkout'), 'AIEO_DMM_Add_To_Cart_Text' => array('product', 'archive', 'frontend_ajax'), 'AIEO_DMM_Product_Labels' => array('product', 'archive'), 'AIEO_DMM_Side_Cart' => array('cart', 'product', 'archive', 'frontend_ajax'), 'AIEO_DMM_Min_Order' => array('cart', 'checkout', 'frontend_ajax'), 'AIEO_DMM_Payment_Gating' => array('checkout', 'frontend_ajax'), 'AIEO_DMM_Payment_Logos' => array('checkout'), 'AIEO_DMM_Checkout_Modal' => array('checkout', 'cart'), 'AIEO_DMM_Checkout_Invoicing' => array('checkout', 'frontend_ajax'), 'AIEO_DMM_Checkout_Product_Images'=> array('checkout'), 'AIEO_DMM_Address_Autocomplete' => array('checkout', 'frontend_ajax'), 'AIEO_DMM_Account_Handling' => array('account', 'frontend_ajax'), 'AIEO_DMM_Header_Actions' => array('admin', 'admin_ajax'), 'AIEO_DMM_Free_Shipping_Display' => array('cart', 'product', 'archive', 'frontend_ajax'), 'AIEO_DMM_Wishlist_Display' => array('product', 'archive', 'account', 'frontend_ajax'), 'AIEO_DMM_Ratings_Display' => array('product', 'archive', 'account', 'frontend_ajax'), 'AIEO_DMM_Waitlist_Display' => array('product', 'archive', 'frontend_ajax'), 'AIEO_DMM_Web_Push_Display' => array('always_frontend'), 'AIEO_DMM_Navigator' => array('always_frontend'), 'AIEO_DMM_Swatches' => array('product', 'archive', 'frontend_ajax'), 'AIEO_DMM_Role_Pricing' => array('product', 'archive', 'cart', 'checkout', 'frontend_ajax', 'rest_api'), 'AIEO_DMM_Brand_Discounts' => array('product', 'archive', 'cart', 'checkout', 'frontend_ajax', 'rest_api'), 'AIEO_DMM_Brand_Gifts' => array('cart', 'checkout', 'frontend_ajax'), ); } public static function should_load($module_class, $context = null) { if (!self::is_enabled()) { return true; } $manifest = self::manifest(); if (!isset($manifest[$module_class])) { return true; } $contexts = (array) $manifest[$module_class]; if (in_array('always_frontend', $contexts, true)) { $ctx = $context ?: self::resolve_context(); return !in_array($ctx, array('admin', 'admin_ajax', 'rest_api', 'cron'), true); } return in_array($context ?: self::resolve_context(), $contexts, true); } }