ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<?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_GeoIPLookup
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\GeoIPLookup\Model\System\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
use Plumrocket\GeoIPLookup\Helper\Config;
|
||||
use Plumrocket\GeoIPLookup\Model\LocationsList;
|
||||
|
||||
/**
|
||||
* @since 1.2.2
|
||||
*/
|
||||
class GeoTargeting implements OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\GeoIPLookup\Helper\Config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var \Plumrocket\GeoIPLookup\Model\LocationsList
|
||||
*/
|
||||
private $locationsList;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\GeoIPLookup\Helper\Config $config
|
||||
* @param \Plumrocket\GeoIPLookup\Model\LocationsList $locationsList
|
||||
*/
|
||||
public function __construct(
|
||||
Config $config,
|
||||
LocationsList $locationsList
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->locationsList = $locationsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toOptionArray(): array
|
||||
{
|
||||
$regions = $this->locationsList->getRegions();
|
||||
$countries = $this->locationsList->getCountries();
|
||||
|
||||
if (! $this->config->isConfiguredForUse()) {
|
||||
$regions = array_map([$this, 'addDisabledAttribute'], $regions);
|
||||
$countries = array_map([$this, 'addDisabledAttribute'], $countries);
|
||||
}
|
||||
|
||||
return [
|
||||
[
|
||||
'label' => __('By Region'),
|
||||
'value' => $regions,
|
||||
],
|
||||
[
|
||||
'label' => __('By Country'),
|
||||
'value' => $countries,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $option
|
||||
* @return mixed
|
||||
*/
|
||||
public function addDisabledAttribute($option)
|
||||
{
|
||||
if (LocationsList::ALL !== $option['value']) {
|
||||
$option['params']['disabled'] = 'disabled';
|
||||
}
|
||||
|
||||
return $option;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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_GeoIPLookup
|
||||
* @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\GeoIPLookup\Model\System\Config\Source;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
use Plumrocket\GeoIPLookup\Api\LocationsListInterface;
|
||||
|
||||
/**
|
||||
* @since 1.2.2
|
||||
*/
|
||||
class GeoTargetingStates implements OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\GeoIPLookup\Api\LocationsListInterface
|
||||
*/
|
||||
private $locationsList;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\GeoIPLookup\Api\LocationsListInterface $locationsList
|
||||
*/
|
||||
public function __construct(
|
||||
LocationsListInterface $locationsList
|
||||
) {
|
||||
$this->locationsList = $locationsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return $this->locationsList->getCountryStates('United States');
|
||||
}
|
||||
}
|
||||
+48
@@ -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_GeoIPLookup
|
||||
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\GeoIPLookup\Model\System\Config\Source;
|
||||
|
||||
class Installmethods implements \Magento\Framework\Option\ArrayInterface
|
||||
{
|
||||
/**
|
||||
* Apply automatic installation
|
||||
*/
|
||||
const AUTOMATIC = 'automatic';
|
||||
|
||||
/**
|
||||
* Apply manual installation
|
||||
*/
|
||||
const MANUAL = 'manual';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function toOptionArray()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'value' => self::AUTOMATIC,
|
||||
'label' => __('Automatic Installation'),
|
||||
],
|
||||
[
|
||||
'value' => self::MANUAL,
|
||||
'label' => __('Manual Installation'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user