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,93 @@
<?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\ViewModel;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Api\SortOrderBuilder;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Plumrocket\CookieConsent\Api\CategoryRepositoryInterface;
use Plumrocket\CookieConsent\Api\Data\CategoryInterface;
use Plumrocket\CookieConsent\Model\ResourceModel\Category as CategoryResource;
/**
* @since 1.7.0
*/
class CategoryProvider implements ArgumentInterface
{
/**
* @var null|\Plumrocket\CookieConsent\Api\Data\CategoryInterface[]
*/
private $categories;
/**
* @var \Plumrocket\CookieConsent\Api\CategoryRepositoryInterface
*/
private $categoryRepository;
/**
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;
/**
* @var \Magento\Framework\Api\SortOrderBuilder
*/
private $sortOrderBuilder;
/**
* @param \Plumrocket\CookieConsent\Api\CategoryRepositoryInterface $categoryRepository
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Magento\Framework\Api\SortOrderBuilder $sortOrderBuilder
*/
public function __construct(
CategoryRepositoryInterface $categoryRepository,
SearchCriteriaBuilder $searchCriteriaBuilder,
SortOrderBuilder $sortOrderBuilder
) {
$this->categoryRepository = $categoryRepository;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->sortOrderBuilder = $sortOrderBuilder;
}
/**
* Get active categories.
*
* @return \Plumrocket\CookieConsent\Api\Data\CategoryInterface[]
*/
public function get(): array
{
if (null === $this->categories) {
$this->searchCriteriaBuilder->addFilter('status', 1);
$this->searchCriteriaBuilder->addSortOrder(
$this->sortOrderBuilder
->setField(CategoryInterface::SORT_ORDER)
->setAscendingDirection()
->create()
);
$this->searchCriteriaBuilder->addSortOrder(
$this->sortOrderBuilder
->setField(CategoryInterface::CREATED_AT)
->setAscendingDirection()
->create()
);
// During installation all categories will have same created_at
// so order by id keep right order for this case
$this->searchCriteriaBuilder->addSortOrder(
$this->sortOrderBuilder
->setField(CategoryResource::ID_FIELD_NAME)
->setAscendingDirection()
->create()
);
$this->categories = $this->categoryRepository->getList($this->searchCriteriaBuilder->create())->getItems();
}
return $this->categories;
}
}
@@ -0,0 +1,79 @@
<?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\ViewModel;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Plumrocket\CookieConsent\Api\CookieRepositoryInterface;
use Plumrocket\CookieConsent\Api\Data\CategoryInterface;
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
/**
* @since 1.7.0
*/
class CookieProvider implements ArgumentInterface
{
/**
* @var null|\Plumrocket\CookieConsent\Api\Data\CookieInterface[]
*/
private $cookies;
/**
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;
/**
* @var \Plumrocket\CookieConsent\Api\CookieRepositoryInterface
*/
private $cookieRepository;
/**
* @var \Plumrocket\CookieConsent\ViewModel\CategoryProvider
*/
private $categoryProvider;
/**
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Plumrocket\CookieConsent\Api\CookieRepositoryInterface $cookieRepository
* @param \Plumrocket\CookieConsent\ViewModel\CategoryProvider $categoryProvider
*/
public function __construct(
SearchCriteriaBuilder $searchCriteriaBuilder,
CookieRepositoryInterface $cookieRepository,
CategoryProvider $categoryProvider
) {
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->cookieRepository = $cookieRepository;
$this->categoryProvider = $categoryProvider;
}
/**
* Get cookie data for render.
*
* @return \Plumrocket\CookieConsent\Api\Data\CookieInterface[]
*/
public function get(): array
{
if (null === $this->cookies) {
$categoriesKeys = array_map(static function (CategoryInterface $category) {
return $category->getKey();
}, $this->categoryProvider->get());
$this->searchCriteriaBuilder->addFilter(
CookieInterface::CATEGORY_KEY,
$categoriesKeys,
'in'
);
$this->cookies = $this->cookieRepository->getList($this->searchCriteriaBuilder->create())->getItems();
}
return $this->cookies;
}
}
@@ -0,0 +1,37 @@
<?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\ViewModel;
use Plumrocket\CookieConsent\Api\Data\CategoryInterface;
/**
* @since 1.0.0
*/
class ExtractCategoryData
{
/**
* Get data for js usage.
*
* @param \Plumrocket\CookieConsent\Api\Data\CategoryInterface $category
* @return array
*/
public function execute(CategoryInterface $category): array
{
return [
CategoryInterface::KEY => $category->getKey(),
CategoryInterface::IS_ESSENTIAL => $category->isEssential(),
CategoryInterface::IS_PRE_CHECKED => $category->isPreChecked(),
CategoryInterface::NAME => $category->getName(),
CategoryInterface::DESCRIPTION => $category->getDescription(),
CategoryInterface::SORT_ORDER => $category->getSortOrder(),
];
}
}
@@ -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\ViewModel;
use Plumrocket\CookieConsent\Api\Data\CookieInterface;
use Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\Type;
use Plumrocket\CookieConsent\Model\Cookie\Domain;
use Plumrocket\CookieConsent\Model\Cookie\Duration;
/**
* @since 1.0.0
*/
class ExtractCookieData
{
/**
* @var \Plumrocket\CookieConsent\Model\Cookie\Domain
*/
private $cookieDomain;
/**
* @var \Plumrocket\CookieConsent\Model\Cookie\Duration
*/
private $cookieDuration;
/**
* @var \Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\Type
*/
private $type;
/**
* @param \Plumrocket\CookieConsent\Model\Cookie\Domain $cookieDomain
* @param \Plumrocket\CookieConsent\Model\Cookie\Duration $cookieDuration
* @param \Plumrocket\CookieConsent\Model\Cookie\Attribute\Source\Type $type
*/
public function __construct(
Domain $cookieDomain,
Duration $cookieDuration,
Type $type
) {
$this->cookieDomain = $cookieDomain;
$this->cookieDuration = $cookieDuration;
$this->type = $type;
}
/**
* Get data for js usage.
*
* @param \Plumrocket\CookieConsent\Api\Data\CookieInterface $cookie
* @return array
*/
public function execute(CookieInterface $cookie): array
{
return [
CookieInterface::NAME => $cookie->getName(),
CookieInterface::CATEGORY_KEY => $cookie->getCategoryKey(),
CookieInterface::TYPE => $cookie->getType(),
'typeLabel' => $this->type->getOptionText($cookie->getType()),
CookieInterface::DOMAIN => $cookie->getDomain(),
'domainLabel' => $this->cookieDomain->getLabel($cookie),
CookieInterface::DURATION => $cookie->getDuration(),
'durationLabel' => $this->cookieDuration->getLabel($cookie),
CookieInterface::DESCRIPTION => $cookie->getDescription(),
];
}
}
@@ -0,0 +1,48 @@
<?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\ViewModel\Integration\AdobeCommerce;
use Magento\Framework\View\Element\Block\ArgumentInterface;
/**
* @since 2.0.4
*/
class DataCollection implements ArgumentInterface
{
/**
* @var \Plumrocket\CookieConsent\Model\Integration\AdobeCommerce\DataCollection
*/
private $dataCollection;
/**
* @param \Plumrocket\CookieConsent\Model\Integration\AdobeCommerce\DataCollection $dataCollection
*/
public function __construct(
\Plumrocket\CookieConsent\Model\Integration\AdobeCommerce\DataCollection $dataCollection
) {
$this->dataCollection = $dataCollection;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
return $this->dataCollection->isEnabled();
}
/**
* @return string
*/
public function getAssociatedCategoryKey(): string
{
return $this->dataCollection->getAssociatedCategoryKey();
}
}
@@ -0,0 +1,52 @@
<?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\ViewModel\Integration;
use Magento\Framework\View\Element\Block\ArgumentInterface;
/**
* @since 2.0.4
*/
class NoCookieYoutube implements ArgumentInterface
{
/**
* @var \Plumrocket\CookieConsent\Model\Integration\NoCookieYoutube
*/
private $noCookieYoutube;
/**
* @param \Plumrocket\CookieConsent\Model\Integration\NoCookieYoutube $noCookieYoutube
*/
public function __construct(\Plumrocket\CookieConsent\Model\Integration\NoCookieYoutube $noCookieYoutube)
{
$this->noCookieYoutube = $noCookieYoutube;
}
/**
* Check if no cookie is enabled.
*
* @return bool
*/
public function isEnabled(): bool
{
return $this->noCookieYoutube->isEnabled();
}
/**
* Get key of associated cookie category.
*
* @return string
*/
public function getAssociatedCategoryKey(): string
{
return $this->noCookieYoutube->getAssociatedCategoryKey();
}
}
@@ -0,0 +1,19 @@
<?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\ViewModel;
/**
* @since 1.9.0
* @deprecated since 2.0.4
* @see \Plumrocket\CookieConsent\ViewModel\Integration\NoCookieYoutube
*/
class NoCookieYoutube extends \Plumrocket\CookieConsent\ViewModel\Integration\NoCookieYoutube
{
}