Load GeoLite2 Reader when creating a new instance of WC_Geolite_Integration

This commit is contained in:
Claudio Sanches 2018-03-15 17:30:17 -03:00
parent 774a54b8ee
commit 827d957d66
1 changed files with 4 additions and 4 deletions

View File

@ -38,6 +38,10 @@ class WC_Geolite_Integration {
*/
public function __construct( $database ) {
$this->database = $database;
if ( ! class_exists( 'MaxMind\\Db\\Reader', false ) ) {
$this->require_geolite_library();
}
}
/**
@ -48,10 +52,6 @@ class WC_Geolite_Integration {
* @return string
*/
public function get_country_iso( $ip_address ) {
if ( ! class_exists( 'MaxMind\\Db\\Reader', false ) ) {
$this->require_geolite_library();
}
$iso_code = '';
try {