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,34 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Attribute;
use Plumrocket\CookieConsent\Model\Cookie;
use Plumrocket\CookieConsent\Model\ResourceModel\AbstractAttributeCollection;
/**
* @since 1.0.0
*/
class Collection extends AbstractAttributeCollection
{
/**
* @var string
*/
protected $entityCode = Cookie::ENTITY;
}
@@ -0,0 +1,47 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
use Magento\Catalog\Model\ResourceModel\Collection\AbstractCollection;
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
use Plumrocket\CookieConsent\Model\Cookie;
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie as CookieResource;
/**
* @since 1.0.0
* @method CookieInterface[]|Cookie[] getItems()
*/
class Collection extends AbstractCollection
{
/**
* @var string
*/
protected $idFieldName = CookieResource::ID_FIELD_NAME;
/**
* Resource initialization.
*
* @return void
*/
protected function _construct()
{
$this->_init(Cookie::class, CookieResource::class);
}
}
@@ -0,0 +1,69 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
use Magento\Framework\App\ResourceConnection;
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
class GetCategoryKey
{
/**
* @var \Magento\Framework\App\ResourceConnection
*/
private $resourceConnection;
/**
* @var string[]
*/
private $categoryKey = [];
/**
* GetIdByName constructor.
*
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
*/
public function __construct(ResourceConnection $resourceConnection)
{
$this->resourceConnection = $resourceConnection;
}
/**
* @param string $name
* @param bool $forceReload
* @return string
*/
public function execute(string $name, bool $forceReload = false): string
{
if (! isset($this->categoryKey[$name]) || $forceReload) {
$connection = $this->resourceConnection->getConnection();
$select = $connection
->select()
->from($this->resourceConnection->getTableName(Cookie::MAIN_TABLE_NAME), 'category_key')
->where('name = :name');
$bind = [':name' => $name];
$this->categoryKey[$name] = (string) $connection->fetchOne($select, $bind);
}
return $this->categoryKey[$name];
}
}
@@ -0,0 +1,63 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
use Magento\Framework\App\ResourceConnection;
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
/**
* Get all names with * symbol
*
* @since 1.1.1
*/
class GetDynamicNames
{
/**
* @var \Magento\Framework\App\ResourceConnection
*/
private $resourceConnection;
/**
* GetNames constructor.
*
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
*/
public function __construct(ResourceConnection $resourceConnection)
{
$this->resourceConnection = $resourceConnection;
}
/**
* @return string[]
*/
public function execute(): array
{
$connection = $this->resourceConnection->getConnection();
$select = $connection
->select()
->from(
['main_table' => $this->resourceConnection->getTableName(Cookie::MAIN_TABLE_NAME)],
['name']
)->where('name LIKE \'%*%\'');
return $connection->fetchCol($select);
}
}
@@ -0,0 +1,73 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
use Magento\Framework\App\ResourceConnection;
use Plumrocket\CookieConsent\Api\GetCookieIdByNameInterface;
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
/**
* Retrieve cookie id by cookie name
*
* @since 1.0.0
*/
class GetIdByName implements GetCookieIdByNameInterface
{
/**
* @var \Magento\Framework\App\ResourceConnection
*/
private $resourceConnection;
/**
* @var int[]
*/
private $ids = [];
/**
* GetIdByName constructor.
*
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
*/
public function __construct(ResourceConnection $resourceConnection)
{
$this->resourceConnection = $resourceConnection;
}
/**
* @inheritDoc
*/
public function execute(string $name, bool $forceReload = false): int
{
if (! isset($this->ids[$name]) || $forceReload) {
$connection = $this->resourceConnection->getConnection();
$select = $connection
->select()
->from($this->resourceConnection->getTableName(Cookie::MAIN_TABLE_NAME), 'entity_id')
->where('name = :name');
$bind = [':name' => $name];
$this->ids[$name] = (int) $connection->fetchOne($select, $bind);
}
return $this->ids[$name];
}
}
@@ -0,0 +1,58 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
use Magento\Framework\App\ResourceConnection;
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
class GetNames
{
/**
* @var \Magento\Framework\App\ResourceConnection
*/
private $resourceConnection;
/**
* GetNames constructor.
*
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
*/
public function __construct(ResourceConnection $resourceConnection)
{
$this->resourceConnection = $resourceConnection;
}
/**
* @return array
*/
public function execute() : array
{
$connection = $this->resourceConnection->getConnection();
$select = $connection
->select()
->from(
['main_table' => $this->resourceConnection->getTableName(Cookie::MAIN_TABLE_NAME)],
['name']
);
return $connection->fetchCol($select);
}
}
@@ -0,0 +1,111 @@
<?php
/**
* Plumrocket Inc.
* NOTICE OF LICENSE
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Grid;
use Plumrocket\CookieConsent\Model\ResourceModel\Cookie\Collection as CookieCollection;
use Magento\Framework\Session\Config\ConfigInterface;
use Magento\Framework\Data\Collection\EntityFactory;
use Psr\Log\LoggerInterface;
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface;
use Magento\Framework\Event\ManagerInterface;
use Magento\Eav\Model\Config;
use Magento\Framework\App\ResourceConnection;
use Magento\Eav\Model\EntityFactory as EavEntityFactory;
use Magento\Eav\Model\ResourceModel\Helper;
use Magento\Framework\Validator\UniversalFactory;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\Type;
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
/**
* @since 1.0.0
*/
class Collection extends CookieCollection
{
public const DOMAIN_LABEL = 'domain_label';
/**
* @var \Magento\Framework\Session\Config\ConfigInterface
*/
private $sessionConfig;
/**
* Collection constructor.
*
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param \Magento\Eav\Model\Config $eavConfig
* @param \Magento\Framework\App\ResourceConnection $resource
* @param \Magento\Eav\Model\EntityFactory $eavEntityFactory
* @param \Magento\Eav\Model\ResourceModel\Helper $resourceHelper
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\Session\Config\ConfigInterface $sessionConfig
* @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection
*/
public function __construct(
EntityFactory $entityFactory,
LoggerInterface $logger,
FetchStrategyInterface $fetchStrategy,
ManagerInterface $eventManager,
Config $eavConfig,
ResourceConnection $resource,
EavEntityFactory $eavEntityFactory,
Helper $resourceHelper,
UniversalFactory $universalFactory,
StoreManagerInterface $storeManager,
ConfigInterface $sessionConfig,
?AdapterInterface $connection = null
) {
$this->sessionConfig = $sessionConfig;
parent::__construct(
$entityFactory,
$logger,
$fetchStrategy,
$eventManager,
$eavConfig,
$resource,
$eavEntityFactory,
$resourceHelper,
$universalFactory,
$storeManager,
$connection
);
}
/**
* @return $this
*/
protected function _initSelect(): self
{
parent::_initSelect();
$cookieDomain = $this->sessionConfig->getCookieDomain();
$domainColumn = CookieInterface::DOMAIN;
$typeColumn = CookieInterface::TYPE;
$expression = 'IF(' . $typeColumn . ' = "' . Type::TYPE_FIRST . '" AND isnull(' . $domainColumn . '), "' .
$cookieDomain . '", ' . $domainColumn .') AS ' . self::DOMAIN_LABEL . ' ';
$this->getSelect()->columns(new \Zend_Db_Expr($expression));
return $this;
}
}
@@ -0,0 +1,55 @@
<?php
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_CookieConsent
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsent\Model\ResourceModel\Cookie;
/**
* Retrieve if there's cookie with requested name in the database
*
* @since 1.0.0
*/
class IsKnown
{
/**
* @var \Plumrocket\CookieConsent\Model\ResourceModel\Cookie\GetCategoryKey
*/
private $getCookieCategoryKey;
/**
* @param \Plumrocket\CookieConsent\Model\ResourceModel\Cookie\GetCategoryKey $getCategoryKey
*/
public function __construct(GetCategoryKey $getCategoryKey)
{
$this->getCookieCategoryKey = $getCategoryKey;
}
/**
* @param string $name
* @param bool $forceReload
* @return bool
*/
public function execute(string $name, bool $forceReload = false): bool
{
/**
* As category_key is required field for cookie, if GetCategoryKey returns '' it means that cookie unknown
* So, we optimize request count to database, because GetCategoryKey has local cache
*/
return (bool) $this->getCookieCategoryKey->execute($name, $forceReload);
}
}