Spamworldpro Mini Shell
Spamworldpro


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/Plugin/Framework/App/PageCache/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/amasty/shopby/Plugin/Framework/App/PageCache/Identifier.php
<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Improved Layered Navigation Base for Magento 2
 */

namespace Amasty\Shopby\Plugin\Framework\App\PageCache;

class Identifier
{
    public const IDENTIFIER_PREFIX = 'amasty_mobile_';

    /**
     * @var array
     */
    public static $mobileAgents = [
        'iPad',
        'iPod',
        'iPhone',
        'Android',
        'BlackBerry',
        'SymbianOS',
        'SCH-M\d+',
        'Opera Mini',
        'Windows CE',
        'Nokia',
        'SonyEricsson',
        'webOS',
        'PalmOS'
    ];

    /**
     * @var \Magento\Framework\App\RequestInterface
     */
    private $request;

    /**
     * @var \Magento\PageCache\Model\Config
     */
    private $config;

    public function __construct(
        \Magento\Framework\App\RequestInterface $request,
        \Magento\PageCache\Model\Config $config
    ) {
        $this->request = $request;
        $this->config = $config;
    }

    /**
     * @param \Magento\Framework\App\PageCache\Identifier $subject
     * @param string $result
     * @return string
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function afterGetValue(\Magento\Framework\App\PageCache\Identifier $subject, $result)
    {
        if ($this->config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->config->isEnabled()) {
            $userAgent = (string) $this->request->getServer('HTTP_USER_AGENT');
            $mobileAgentsPattern = implode('|', self::$mobileAgents);
            $pattern = '/(' . $mobileAgentsPattern . ')/i';
            if (preg_match($pattern, $userAgent)) {
                $result = self::IDENTIFIER_PREFIX . $result;
            }
        }

        return $result;
    }
}

Spamworldpro Mini