ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,60 @@
<?php
/**
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Plugin\Cookie;
use Magento\Cookie\Helper\Cookie;
use Plumrocket\CookieConsent\Api\CanManageCookieInterface;
use Plumrocket\CookieConsent\Helper\Config;
/**
* @since 1.0.0
*/
class RestrictionMode
{
/**
* @var \Plumrocket\CookieConsent\Api\CanManageCookieInterface
*/
private $canManageCookie;
/**
* @var \Plumrocket\CookieConsent\Helper\Config
*/
private $config;
/**
* RestrictionMode constructor.
*
* @param \Plumrocket\CookieConsent\Api\CanManageCookieInterface $canManageCookie
* @param \Plumrocket\CookieConsent\Helper\Config $config
*/
public function __construct(
CanManageCookieInterface $canManageCookie,
Config $config
) {
$this->canManageCookie = $canManageCookie;
$this->config = $config;
}
/**
* Change magento restriction mode.
*
* @param \Magento\Cookie\Helper\Cookie $subject
* @param string|null|bool $result
* @return bool
*/
public function afterIsCookieRestrictionModeEnabled(Cookie $subject, $result)
{
if ($this->config->isModuleEnabled()) {
return $this->canManageCookie->execute();
}
return $result;
}
}
@@ -0,0 +1,72 @@
<?php
/**
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 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\Stdlib\Cookie\PublicCookieMetadata;
use Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata;
use Magento\Framework\Stdlib\CookieManagerInterface;
use Plumrocket\CookieConsent\Api\IsAllowedCookieInterface;
/**
* @since 1.0.0
*/
class CookieManagerPlugin
{
/**
* @var \Plumrocket\CookieConsent\Api\IsAllowedCookieInterface
*/
private $isAllowCookie;
/**
* @param \Plumrocket\CookieConsent\Api\IsAllowedCookieInterface $isAllowCookie
*/
public function __construct(IsAllowedCookieInterface $isAllowCookie)
{
$this->isAllowCookie = $isAllowCookie;
}
/**
* @param \Magento\Framework\Stdlib\CookieManagerInterface $subject
* @param callable $proceed
* @param $name
* @param $value
* @param \Magento\Framework\Stdlib\Cookie\PublicCookieMetadata|null $metadata
*/
public function aroundSetPublicCookie(
CookieManagerInterface $subject,
callable $proceed,
$name,
$value,
?PublicCookieMetadata $metadata = null
) {
if ($this->isAllowCookie->execute($name)) {
$proceed($name, $value, $metadata);
}
}
/**
* @param \Magento\Framework\Stdlib\CookieManagerInterface $subject
* @param callable $proceed
* @param $name
* @param $value
* @param \Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata|null $metadata
*/
public function aroundSetSensitiveCookie(
CookieManagerInterface $subject,
callable $proceed,
$name,
$value,
?SensitiveCookieMetadata $metadata = null
) {
if ($this->isAllowCookie->execute($name)) {
$proceed($name, $value, $metadata);
}
}
}
@@ -0,0 +1,21 @@
<?php
/**
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2024 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Plugin\Gtm;
use Plumrocket\CookieConsent\Plugin\Html\HeadScripts;
/**
* @since 2.0.2
* @deprecated since 2.0.4
* @see \Plumrocket\CookieConsent\Plugin\Html\HeadScripts
*/
class UpdateHtmlTags extends HeadScripts
{
}
@@ -0,0 +1,54 @@
<?php
/**
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Plugin\Html;
use Magento\Framework\App\Response\Http;
use Plumrocket\CookieConsent\Block\Html\HeadScripts as HeadScriptsBlock;
use Plumrocket\CookieConsent\Helper\Config;
/**
* @since 2.0.4
*/
class HeadScripts
{
/**
* @var \Plumrocket\CookieConsent\Helper\Config
*/
private $config;
/**
* @param \Plumrocket\CookieConsent\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
{
if (! $this->config->isModuleEnabled()) {
return;
}
$content = $subject->getContent();
if(! is_string($content) || strpos($content, HeadScriptsBlock::SCRIPT_TAG_REPLACEMENT) === false) {
return;
}
$subject->setContent(
str_replace(HeadScriptsBlock::SCRIPT_TAG_REPLACEMENT, 'script', $content)
);
}
}
@@ -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;
}
}