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,82 @@
<?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\Model;
use Magento\Framework\Exception\LocalizedException;
use Plumrocket\GeoIPLookup\Api\GeoLocationValidatorInterface;
use Plumrocket\GlobalPrivacyControl\Api\GeoTargetingInterface;
use Plumrocket\GlobalPrivacyControl\Helper\Config;
use Plumrocket\GlobalPrivacyControl\Helper\Config\Geotargeting as GeotargetingConfig;
use Psr\Log\LoggerInterface;
class Geotargeting implements GeoTargetingInterface
{
/**
* @var \Plumrocket\GlobalPrivacyControl\Helper\Config
*/
private $config;
/**
* @var \Plumrocket\GlobalPrivacyControl\Helper\Config\Geotargeting
*/
private $geotargetingConfig;
/**
* @var \Plumrocket\GeoIPLookup\Api\GeoLocationValidatorInterface
*/
private $geoLocationValidator;
/**
* @var \Psr\Log\LoggerInterface
*/
private $logger;
/**
* @param \Plumrocket\GlobalPrivacyControl\Helper\Config $config
* @param \Plumrocket\GlobalPrivacyControl\Helper\Config\Geotargeting $geotargetingConfig
* @param \Plumrocket\GeoIPLookup\Api\GeoLocationValidatorInterface $geoLocationValidator
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
Config $config,
GeotargetingConfig $geotargetingConfig,
GeoLocationValidatorInterface $geoLocationValidator,
LoggerInterface $logger
) {
$this->config = $config;
$this->geotargetingConfig = $geotargetingConfig;
$this->geoLocationValidator = $geoLocationValidator;
$this->logger = $logger;
}
/**
* @return bool
*/
public function isApplicable(): bool
{
if (! $this->config->isModuleEnabled()) {
return false;
}
if (! $this->geotargetingConfig->isEnabled()) {
return true;
}
try {
return $this->geoLocationValidator->validateByMergedOptions(
$this->geotargetingConfig->getTargetCountries(),
$this->geotargetingConfig->getTargetUsStates()
);
} catch (LocalizedException $e) {
$this->logger->critical($e->getMessage());
return true;
}
}
}
@@ -0,0 +1,48 @@
<?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\Model;
use Magento\Framework\Stdlib\BooleanUtils;
use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
use Plumrocket\GlobalPrivacyControl\Api\IsGpcSignalHandledInterface;
class IsGpcSignalHandled implements IsGpcSignalHandledInterface
{
/**
* @var \Magento\Framework\Stdlib\BooleanUtils
*/
private $booleanUtils;
/**
* @var \Magento\Framework\Stdlib\Cookie\CookieReaderInterface
*/
private $cookieReader;
/**
* @param \Magento\Framework\Stdlib\BooleanUtils $booleanUtils
* @param \Magento\Framework\Stdlib\Cookie\CookieReaderInterface $cookieReader
*/
public function __construct(
BooleanUtils $booleanUtils,
CookieReaderInterface $cookieReader
) {
$this->booleanUtils = $booleanUtils;
$this->cookieReader = $cookieReader;
}
/**
* @return bool
*/
public function execute(): bool
{
$status = $this->cookieReader->getCookie(self::COOKIE_NAME);
return $status && $this->booleanUtils->toBoolean($status);
}
}