Piwik\Plugins\UserCountry\LocationProvider\GeoIp::getRegionNameFromCodes PHP Method

getRegionNameFromCodes() public static method

Returns a region name for a country code + region code.
public static getRegionNameFromCodes ( string $countryCode, string $regionCode ) : string
$countryCode string
$regionCode string
return string The region name or 'Unknown' (translated).
    public static function getRegionNameFromCodes($countryCode, $regionCode)
    {
        $regionNames = self::getRegionNames();
        $countryCode = strtoupper($countryCode);
        $regionCode = strtoupper($regionCode);
        if (isset($regionNames[$countryCode][$regionCode])) {
            return $regionNames[$countryCode][$regionCode];
        } else {
            return Piwik::translate('General_Unknown');
        }
    }

Usage Example

Esempio n. 1
0
 public function getRegionName()
 {
     $region = $this->getRegionCode();
     if ($region != '' && $region != Visit::UNKNOWN_CODE) {
         return GeoIp::getRegionNameFromCodes($this->details['location_country'], $region);
     }
     return null;
 }
All Usage Examples Of Piwik\Plugins\UserCountry\LocationProvider\GeoIp::getRegionNameFromCodes