ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?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\Model\Config\Backend;
|
||||
|
||||
use Magento\Config\Model\Config\Backend\Serialized\ArraySerialized;
|
||||
use Magento\Framework\App\Cache\TypeListInterface;
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Framework\Data\Collection\AbstractDb;
|
||||
use Magento\Framework\Model\Context;
|
||||
use Magento\Framework\Model\ResourceModel\AbstractResource;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\Serialize\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class ConsentTypes extends ArraySerialized
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Serialize\SerializerInterface
|
||||
*/
|
||||
private $jsonSerializer;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Model\Context $context
|
||||
* @param \Magento\Framework\Registry $registry
|
||||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
|
||||
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
|
||||
* @param \Magento\Framework\Serialize\SerializerInterface $jsonSerializer
|
||||
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
|
||||
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $registry,
|
||||
ScopeConfigInterface $config,
|
||||
TypeListInterface $cacheTypeList,
|
||||
SerializerInterface $jsonSerializer,
|
||||
?AbstractResource $resource = null,
|
||||
?AbstractDb $resourceCollection = null,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct(
|
||||
$context,
|
||||
$registry,
|
||||
$config,
|
||||
$cacheTypeList,
|
||||
$resource,
|
||||
$resourceCollection,
|
||||
$data
|
||||
);
|
||||
$this->jsonSerializer = $jsonSerializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function beforeSave()
|
||||
{
|
||||
parent::beforeSave();
|
||||
$value = $this->getValue();
|
||||
if ($value === '[]') {
|
||||
$this->_dataSaveAllowed = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix get old value.
|
||||
*
|
||||
* We have array as default value and magento cannot resolve it by itself
|
||||
* because it doesn't know how to convert it to string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOldValue(): string
|
||||
{
|
||||
$oldValue = $this->_config->getValue(
|
||||
$this->getPath(),
|
||||
$this->getScope() ?: ScopeConfigInterface::SCOPE_TYPE_DEFAULT,
|
||||
$this->getScopeCode()
|
||||
);
|
||||
|
||||
if (is_array($oldValue)) {
|
||||
$oldValue = $this->jsonSerializer->serialize($oldValue);
|
||||
}
|
||||
|
||||
return (string) $oldValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace Plumrocket\CookieConsent\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
use Magento\Framework\View\Asset\Repository;
|
||||
use Plumrocket\ExtendedAdminUi\Api\ImageRadioButtonSourceInterface;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BannerDisplayStyle implements OptionSourceInterface, ImageRadioButtonSourceInterface
|
||||
{
|
||||
public const POPUP = 'popup';
|
||||
public const BOTTOM = 'bottom';
|
||||
public const WALL = 'wall';
|
||||
|
||||
/**
|
||||
* @var Repository
|
||||
*/
|
||||
private $viewAssetRepository;
|
||||
|
||||
/**
|
||||
* ReviewPageStructure constructor.
|
||||
*
|
||||
* @param Repository $viewAssetRepository
|
||||
*/
|
||||
public function __construct(Repository $viewAssetRepository)
|
||||
{
|
||||
$this->viewAssetRepository = $viewAssetRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::POPUP,
|
||||
'label' => __('Cookie Consent Popup'),
|
||||
'image' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/banner-style/consent_popup.png'
|
||||
),
|
||||
'image2x' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/banner-style/consent_popup@2x.png'
|
||||
),
|
||||
],
|
||||
[
|
||||
'value' => self::BOTTOM,
|
||||
'label' => __('Bottom Cookie Banner'),
|
||||
'image' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/banner-style/bottom_panel.png'
|
||||
),
|
||||
'image2x' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/banner-style/bottom_panel@2x.png'
|
||||
),
|
||||
],
|
||||
[
|
||||
'value' => self::WALL,
|
||||
'label' => __('Full-Screen Cookie Wall'),
|
||||
'image' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/banner-style/full_screen.png'
|
||||
),
|
||||
'image2x' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/banner-style/full_screen@2x.png'
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
namespace Plumrocket\CookieConsent\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
class CategoryStatus implements OptionSourceInterface
|
||||
{
|
||||
public const ENABLED = 1;
|
||||
public const DISABLED = 0;
|
||||
public const COMPLETED = 'completed';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::ENABLED,
|
||||
'label' => __('Enabled'),
|
||||
],
|
||||
[
|
||||
'value' => self::DISABLED,
|
||||
'label' => __('Disabled'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class SettingsButtonType implements OptionSourceInterface
|
||||
{
|
||||
public const BUTTON = 'button';
|
||||
public const LINK = 'link';
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::BUTTON,
|
||||
'label' => __('Button'),
|
||||
],
|
||||
[
|
||||
'value' => self::LINK,
|
||||
'label' => __('Link'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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\Model\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
use Magento\Framework\View\Asset\Repository;
|
||||
use Plumrocket\ExtendedAdminUi\Api\ImageRadioButtonSourceInterface;
|
||||
|
||||
/**
|
||||
* @since 1.7.0
|
||||
*/
|
||||
class SettingsPanelDisplayStyle implements OptionSourceInterface, ImageRadioButtonSourceInterface
|
||||
{
|
||||
|
||||
public const LEFT_BAR = 'left_bar';
|
||||
public const ACCORDION_POPUP = 'accordions_popup';
|
||||
|
||||
/**
|
||||
* @var Repository
|
||||
*/
|
||||
private $viewAssetRepository;
|
||||
|
||||
/**
|
||||
* ReviewPageStructure constructor.
|
||||
*
|
||||
* @param Repository $viewAssetRepository
|
||||
*/
|
||||
public function __construct(Repository $viewAssetRepository)
|
||||
{
|
||||
$this->viewAssetRepository = $viewAssetRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::LEFT_BAR,
|
||||
'label' => __('Left Sidebar'),
|
||||
'image' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/left_bar.png'
|
||||
),
|
||||
'image2x' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/left_bar@2x.png'
|
||||
),
|
||||
],
|
||||
[
|
||||
'value' => self::ACCORDION_POPUP,
|
||||
'label' => __('Popup'),
|
||||
'image' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/popup.png'
|
||||
),
|
||||
'image2x' => $this->viewAssetRepository->getUrl(
|
||||
'Plumrocket_CookieConsent::images/system_config/popup@2x.png'
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user