ltsecurityinc安防产品在线商城代码
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_GlobalPrivacyControl
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc.
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\GlobalPrivacyControl\Plugin\Html;
|
||||
|
||||
use Magento\Framework\App\Response\Http;
|
||||
use Plumrocket\GlobalPrivacyControl\Block\ComponentInit as ComponentInitBlock;
|
||||
use Plumrocket\GlobalPrivacyControl\Helper\Config;
|
||||
|
||||
class ReplaceComponentInitScriptPlaceholderPlugin
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\GlobalPrivacyControl\Helper\Config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\GlobalPrivacyControl\Helper\Config $config
|
||||
*/
|
||||
public function __construct(
|
||||
Config $config
|
||||
) {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Response\Http $subject
|
||||
* @return void
|
||||
*/
|
||||
public function beforeSendResponse(Http $subject): void
|
||||
{
|
||||
$content = $subject->getContent();
|
||||
if(! is_string($content) || strpos($content, ComponentInitBlock::SCRIPT_TAG_REPLACEMENT) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$subject->setContent(
|
||||
str_replace(ComponentInitBlock::SCRIPT_TAG_REPLACEMENT, 'script', $content)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user