-
Notifications
You must be signed in to change notification settings - Fork 9
/
Data.php
executable file
·88 lines (81 loc) · 1.88 KB
/
Data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
*
* Copyright © MagePal LLC. All rights reserved.
* See COPYING.txt for license details.
* http://www.magepal.com | [email protected]
*/
namespace MagePal\GeoIp\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Store\Model\ScopeInterface;
/**
* Class Data
* @package MagePal\GeoIp\Helper
*/
class Data extends AbstractHelper
{
/**
* Is enabled
*
* @param null $store_id
* @return bool
*/
public function isEnabled($store_id = null)
{
return $this->isSetFlag('general/active', $store_id);
}
/**
* @return array
*/
public function getIgnoreUserAgentArray()
{
return (array) array_map(
"trim",
explode(',', $this->getConfigValue('restriction/ignore_user_agent'))
);
}
/**
* @return array
*/
public function getIgnoreIpAddressArray()
{
return (array) array_map(
"trim",
explode(',', $this->getConfigValue('restriction/ignore_ip_address'))
);
}
/**
* Get system config
*
* @param String path
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigValue($path, $store_id = null)
{
$path = 'geo_ip/' . $path;
//return value from core config
return $this->scopeConfig->getValue(
$path,
ScopeInterface::SCOPE_STORE,
$store_id
);
}
/**
* Get system config
*
* @param String path
* @param ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function isSetFlag($path, $store_id = null)
{
$path = 'geo_ip/' . $path;
//return value from core config
return $this->scopeConfig->isSetFlag(
$path,
ScopeInterface::SCOPE_STORE,
$store_id
);
}
}