public function GeoIpHandlerV1::__construct in GeoIP API 7.2
Load the required libraries and store some meta information.
Throws
\Exception
File
- src/
GeoIpHandlerV1.php, line 36 - The GeoIP API handler for version 1 - legacy.
Class
Namespace
Drupal\geoipCode
public function __construct() {
// Ensure we exit with a proper exception if the library isn't available.
if (($library = libraries_load('geoip-api-php')) && empty($library['loaded'])) {
throw new \Exception('Unable to load GeoIP1 API.');
}
// Make this conditional so that even if the required file is just included
// once we don't overwrite already set vars.
if (isset($GLOBALS['GEOIP_REGION_NAME'])) {
self::$vars = $GLOBALS['GEOIP_REGION_NAME'];
}
}