-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from magefan/6959-maxmindapi
Add download GeoIp Database via MaxMind API
- Loading branch information
Showing
5 changed files
with
190 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Copyright © Magefan ([email protected]). All rights reserved. | ||
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php). | ||
*/ | ||
|
||
namespace Magefan\GeoIp\Model; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Config | ||
{ | ||
const XML_PATH_LICENSE_KEY = 'mfgeoip/update_geoip/key'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* Config constructor. | ||
* @param ScopeConfigInterface $scopeConfig | ||
*/ | ||
public function __construct( | ||
ScopeConfigInterface $scopeConfig | ||
) { | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* @param $path | ||
* @param null $storeId | ||
* @return mixed | ||
*/ | ||
public function getConfig($path, $storeId = null) | ||
{ | ||
return $this->scopeConfig->getValue( | ||
$path, | ||
ScopeInterface::SCOPE_STORE, | ||
$storeId | ||
); | ||
} | ||
|
||
/** | ||
* @param null $storeId | ||
* @return bool | ||
*/ | ||
public function getLicenseKey($storeId = null) | ||
{ | ||
return (string)$this->getConfig( | ||
self::XML_PATH_LICENSE_KEY, | ||
$storeId | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters