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/magento/module-email/Model/Template/Css/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-email/Model/Template/Css/Processor.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Email\Model\Template\Css;

use Magento\Framework\View\Asset\NotationResolver\Variable;
use Magento\Framework\View\Asset\Repository;

/**
 * Class for processing css placeholders
 */
class Processor
{
    /**
     * @var Repository
     */
    private $assetRepository;

    /**
     * @param Repository $assetRepository
     */
    public function __construct(Repository $assetRepository)
    {
        $this->assetRepository = $assetRepository;
    }

    /**
     * Process css placeholders
     *
     * @param string $css
     * @return string
     */
    public function process($css)
    {
        $matches = [];
        if ($css !== null && preg_match_all(Variable::VAR_REGEX, $css, $matches, PREG_SET_ORDER)) {
            $replacements = [];
            foreach ($matches as $match) {
                if (!isset($replacements[$match[0]])) {
                    $replacements[$match[0]] = $this->getPlaceholderValue($match[1]);
                }
            }
            $css = str_replace(array_keys($replacements), $replacements, $css);
        }
        return $css;
    }

    /**
     * Retrieve placeholder value
     *
     * @param string $placeholder
     * @return string
     */
    private function getPlaceholderValue($placeholder)
    {
        /** @var \Magento\Framework\View\Asset\File\FallbackContext $context */
        $context = $this->assetRepository->getStaticViewFileContext();

        switch ($placeholder) {
            case 'base_url_path':
                return $context->getBaseUrl();
            case 'locale':
                return $context->getLocale();
            default:
                return '';
        }
    }
}

Spamworldpro Mini