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-seomarkup/Plugin/Product/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

namespace MageWorx\SeoMarkup\Plugin\Product;

use Magento\Framework\App\RequestInterface;
use Magento\Framework\View\Page\Config as PageConfig;
use MageWorx\SeoMarkup\Helper\Product as HelperProduct;

class RemoveMarkupAttrFromBodyPlugin
{
    /**
     * @var RequestInterface
     */
    protected $request;

    /**
     * @var HelperProduct
     */
    protected $helperProduct;

    /**
     * RemoveMarkupAttrFromBodyPlugin constructor.
     *
     * @param RequestInterface $request
     * @param HelperProduct $helperProduct
     */
    public function __construct(RequestInterface $request, HelperProduct $helperProduct)
    {
        $this->request       = $request;
        $this->helperProduct = $helperProduct;
    }

    /**
     * @param PageConfig $subject
     * @param callable $proceed
     * @param string $elementType
     * @return string[]
     */
    public function aroundGetElementAttributes(PageConfig $subject, callable $proceed, $elementType)
    {
        $fullActionName = $this->request->getFullActionName();
        $result         = $proceed($elementType);

        if ($fullActionName == 'catalog_product_view'
            && $elementType == PageConfig::ELEMENT_TYPE_BODY
            && $this->helperProduct->isRsEnabled()
        ) {
            if (isset($result['itemtype'])) {
                unset($result['itemtype']);
            }

            if (isset($result['itemscope'])) {
                unset($result['itemscope']);
            }
        }

        return $result;
    }
}

Spamworldpro Mini