ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_CookieConsent
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\CookieConsent\Plugin;
|
||||
|
||||
use Magento\Framework\App\ResponseInterface;
|
||||
use Magento\Framework\View\Result\Page;
|
||||
use Plumrocket\CookieConsent\Model\Integration\NoCookieYoutube;
|
||||
|
||||
/**
|
||||
* @since 1.9.0
|
||||
*/
|
||||
class YouTubeNoCookiePlugin
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\CookieConsent\Model\Integration\NoCookieYoutube
|
||||
*/
|
||||
private $noCookieYoutube;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\CookieConsent\Model\Integration\NoCookieYoutube $noCookieYoutube
|
||||
*/
|
||||
public function __construct(
|
||||
NoCookieYoutube $noCookieYoutube
|
||||
) {
|
||||
$this->noCookieYoutube = $noCookieYoutube;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\View\Result\Page $subject
|
||||
* @param $result
|
||||
* @param \Magento\Framework\App\ResponseInterface $response
|
||||
* @return mixed
|
||||
*/
|
||||
public function afterRenderResult(Page $subject, $result, ResponseInterface $response)
|
||||
{
|
||||
if (! $response->getBody() || ! $this->noCookieYoutube->isEnabled()) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$response->setBody($this->noCookieYoutube->convertHtml((string) $response->getBody()));
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user