![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/amasty/shopby-seo/Observer/ |
<?php /** * @author Amasty Team * @copyright Copyright (c) Amasty (https://www.amasty.com) * @package Shop by Seo for Magento 2 (System) */ namespace Amasty\ShopbySeo\Observer; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\Action\Action; class FrontControllerActionPredispatch implements \Magento\Framework\Event\ObserverInterface { /** * @var array */ private $suffixModules = ['catalog', 'amshopby', 'ambrand']; /** * @var RequestInterface */ private $request; /** * @var \Magento\Framework\App\ActionFlag */ private $actionFlag; /** * @var \Amasty\ShopbySeo\Helper\Url */ private $urlHelper; public function __construct( RequestInterface $request, \Magento\Framework\App\ActionFlag $actionFlag, \Amasty\ShopbySeo\Helper\Url $urlHelper ) { $this->request = $request; $this->actionFlag = $actionFlag; $this->urlHelper = $urlHelper; } /** * @param \Magento\Framework\Event\Observer $observer * @return $this */ public function execute(\Magento\Framework\Event\Observer $observer) { if ($this->request->getMetaData(\Amasty\ShopbySeo\Helper\Data::SEO_REDIRECT_FLAG) && $this->request->getModuleName() ) { $this->request->setDispatched(true); $this->actionFlag->set('', Action::FLAG_NO_DISPATCH, true); } elseif ($this->request->getMetaData(\Amasty\ShopbySeo\Helper\Data::SEO_REDIRECT_MISSED_SUFFIX_FLAG) && $this->urlHelper->isAddSuffixToShopby() && in_array($this->request->getModuleName(), $this->suffixModules) ) { $this->request->setMetaData(\Amasty\ShopbySeo\Helper\Data::SEO_REDIRECT_FLAG, true); $this->request->setDispatched(true); $this->actionFlag->set('', Action::FLAG_NO_DISPATCH, true); } return $this; } }