context = adp_context(); } public function withContext(Context $context) { $this->context = $context; } public function start() { /** * @var CustomizerExtensions $customizer * @var DiscountMessage $discountMessage * @var Engine $engine * @var ExternalHooksSuppressor $hookSuppressor * @var StructuredData $structuredData */ $customizer = Factory::get("CustomizerExtensions_CustomizerExtensions"); $discountMessage = Factory::get("Advertising_DiscountMessage", $customizer); $engine = Factory::get("Engine", WC()->cart); $structuredData = Factory::get("SEO_StructuredData", $engine); $structuredData->install(); $hookSuppressor = new ExternalHooksSuppressor(); $this->engine = $engine; $discountTable = new RangeDiscountTableDisplay($customizer, $engine); ProductRangeDiscountTableShortcode::register($customizer, $engine); CategoryRangeDiscountTableShortcode::register($customizer, $engine); $customizer->register(); if ($this->context->getOption('support_shortcode_products_on_sale')) { /** @see OnSaleProductsShortCode::register() */ Factory::callStaticMethod("Shortcodes_OnSaleProducts", 'register'); } if ($this->context->getOption('support_shortcode_products_bogo')) { /** @see BogoProductsShortCode::register() */ Factory::callStaticMethod("Shortcodes_BogoProducts", 'register'); } if ($this->context->getOption('suppress_other_pricing_plugins')) { $hookSuppressor->registerHookSuppressor(); } $wcCartStatsCollector = new WcCartStatsCollector(); $wcCartStatsCollector->setActionCheckoutOrderProcessed(); $engine->installCartProcessAction(); if (is_super_admin($this->context->getCurrentUser()->ID)) { $profiler = $engine->getProfiler(); $this->installReportAdminBounceBackAction($profiler); if ($this->context->getOption("show_debug_bar")) { $profiler->installActionCollectReport(); $this->installDebugBar($profiler); } } $discountMessage->setThemeOptions($customizer); $discountTable->installRenderHooks(); $cartExtensions = new CartExtensions(); $cartExtensions->hideCouponWordInTotals(); $cartExtensions->removeDeleteLinkForAdpCoupons(); $cartExtensions->attachCssClassToGiftedCartItems(); $cartExtensions->fillCartItemWhenOrderAgain(); $cartExtensions->forceCartUpdateForShipping(); $cartExtensions->readOnlyPriceForFreeProducts(); /** @see Functions::install() */ Factory::callStaticMethod("Functions", 'install', $engine); /** @var WcProductCustomAttributesCache $productAttributesCache */ $productAttributesCache = Factory::get("WC_WcProductCustomAttributesCache"); $productAttributesCache->installHooks(); $wcffCmp = new WcffCmp(); $wcffCmp->installRenderHooks(); $tmExtraOptions = new TmExtraOptionsCmp($this->context); $tmExtraOptions->installRenderHooks(); Utils::addPersistentProductsToSaleQuery(); } /** * @param CalculationProfiler $profiler */ public function installDebugBar(CalculationProfiler $profiler) { /** @var DebugBar $debugBar */ $debugBar = Factory::get("Debug_DebugBar", $profiler); $debugBar->register_assets(); $debugBar->install_action_to_render_bar_templates(); $debugBar->installActionToAddIframe(); $debugBar->installActionToRenderBar(); } public function installReportAdminBounceBackAction(CalculationProfiler $profiler) { /** @var AdminBounceBack $adminBounceBack */ $adminBounceBack = Factory::get("Debug_AdminBounceBack", $profiler); $adminBounceBack->catchBounceEvent(); } }