PHP Класс Piwik\Plugins\UserCountry\LocationProvider\GeoIp\ServerBased

To make this provider available, make sure the GEOIP_ADDR server variable is set.
Наследование: extends Piwik\Plugins\UserCountry\LocationProvider\GeoIp
Показать файл Открыть проект

Открытые методы

Метод Описание
getInfo ( ) : array Returns information about this location provider. Contains an id, title & description:
getLocation ( array $info ) : array Uses a GeoIP database to get a visitor's location based on their IP address.
getSupportedLocationInfo ( ) : array Returns an array describing the types of location information this provider will return.
isAvailable ( ) : boolean | string Checks if an HTTP server module has been installed. It checks by looking for the GEOIP_ADDR server variable.
isSameOrAnonymizedIp ( string $ip, string $currentIp ) : boolean Checks if two IP addresses are the same or if the first is the anonymized version of the other.
isWorking ( ) : boolean Returns true if the GEOIP_ADDR server variable is defined.

Описание методов

getInfo() публичный Метод

array( 'id' => 'geoip_serverbased', 'title' => '...', 'description' => '...' );
public getInfo ( ) : array
Результат array

getLocation() публичный Метод

This function will return different results based on the data used and based on how the GeoIP module is configured. If a region database is used, it may return the country code, region code, city name, area code, latitude, longitude and postal code of the visitor. Alternatively, only the country code may be returned for another database. If your HTTP server is not configured to include all GeoIP information, some information will not be available to Piwik.
public getLocation ( array $info ) : array
$info array Must have an 'ip' field.
Результат array

getSupportedLocationInfo() публичный Метод

There's no way to tell exactly what database the HTTP server is using, so we just assume country and continent information is available. This can make diagnostics a bit more difficult, unfortunately.
public getSupportedLocationInfo ( ) : array
Результат array

isAvailable() публичный Метод

There's a special check for the Apache module, but we can't check specifically for anything else.
public isAvailable ( ) : boolean | string
Результат boolean | string

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

Checks if two IP addresses are the same or if the first is the anonymized version of the other.
public static isSameOrAnonymizedIp ( string $ip, string $currentIp ) : boolean
$ip string
$currentIp string This IP should not be anonymized.
Результат boolean

isWorking() публичный Метод

Returns true if the GEOIP_ADDR server variable is defined.
public isWorking ( ) : boolean
Результат boolean