Piwik\Plugins\UserCountry\LocationProvider\GeoIp::getRegionNames PHP Метод

getRegionNames() публичный статический Метод

Returns an array of region names mapped by country code & region code.
public static getRegionNames ( ) : array
Результат array
    public static function getRegionNames()
    {
        if (is_null(self::$regionNames)) {
            $GEOIP_REGION_NAME = array();
            require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipregionvars.php';
            self::$regionNames = $GEOIP_REGION_NAME;
        }
        return self::$regionNames;
    }

Usage Example

Пример #1
0
 /**
  * Returns a GeoIP instance. Creates it if necessary.
  *
  * @param string $key 'loc', 'isp' or 'org'. Determines the type of GeoIP database
  *                    to load.
  * @return object|false
  */
 private function getGeoIpInstance($key)
 {
     if (empty($this->geoIpCache[$key])) {
         // make sure region names are loaded & saved first
         parent::getRegionNames();
         require_once PIWIK_INCLUDE_PATH . '/libs/MaxMindGeoIP/geoipcity.inc';
         $pathToDb = self::getPathToGeoIpDatabase($this->customDbNames[$key]);
         if ($pathToDb !== false) {
             $this->geoIpCache[$key] = geoip_open($pathToDb, GEOIP_STANDARD);
             // TODO support shared memory
         }
     }
     return empty($this->geoIpCache[$key]) ? false : $this->geoIpCache[$key];
 }