![]() 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/Plugin/Framework/App/Action/ |
<?php declare(strict_types=1); /** * @author Amasty Team * @copyright Copyright (c) Amasty (https://www.amasty.com) * @package Shop by Seo for Magento 2 (System) */ namespace Amasty\ShopbySeo\Plugin\Framework\App\Action; use Amasty\ShopbySeo\Helper\Url; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\Action\Forward as ForwardAction; class Forward { /** * @var Url */ private $urlHelper; /** * @var array */ private $suffixModules = ['catalog', 'amshopby', 'ambrand']; public function __construct(Url $urlHelper) { $this->urlHelper = $urlHelper; } /** * @param ForwardAction $subject * @param callable $proceed * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function aroundDispatch(ForwardAction $subject, callable $proceed, RequestInterface $request) { /** * @TODO does not work for catalog pages with filters */ if ($request->getMetaData(\Amasty\ShopbySeo\Helper\Data::SEO_REDIRECT_FLAG) && $request->getModuleName()) { $request->setDispatched(true); return $subject->getResponse(); } elseif ($request->getMetaData(\Amasty\ShopbySeo\Helper\Data::SEO_REDIRECT_MISSED_SUFFIX_FLAG) && in_array($request->getModuleName(), $this->suffixModules) && $this->urlHelper->isAddSuffixToShopby() ) { $request->setMetaData(\Amasty\ShopbySeo\Helper\Data::SEO_REDIRECT_FLAG, true); if ($request->getModuleName()) { $request->setDispatched(true); return $subject->getResponse(); } } return $proceed($request); } }