Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Data.php
Go to the documentation of this file.
1 <?php
7 
15 {
19  const XML_PATH_DEV_ALLOW_IPS = 'dev/restrict/allow_ips';
20 
27  public function isDevAllowed($storeId = null)
28  {
29  $allow = true;
30 
31  $allowedIps = $this->scopeConfig->getValue(
32  self::XML_PATH_DEV_ALLOW_IPS,
33  \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
34  $storeId
35  );
36  $remoteAddr = $this->_remoteAddress->getRemoteAddress();
37  if (!empty($allowedIps) && !empty($remoteAddr)) {
38  $allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY);
39  if (array_search($remoteAddr, $allowedIps) === false
40  && array_search($this->_httpHeader->getHttpHost(), $allowedIps) === false
41  ) {
42  $allow = false;
43  }
44  }
45 
46  return $allow;
47  }
48 }
isDevAllowed($storeId=null)
Definition: Data.php:27