PHP Class Piwik\Plugins\UserCountry\LocationProvider\GeoIp\ServerBased

To make this provider available, make sure the GEOIP_ADDR server variable is set.
Inheritance: extends Piwik\Plugins\UserCountry\LocationProvider\GeoIp
Afficher le fichier Open project: piwik/piwik

Méthodes publiques

Méthode Description
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.

Method Details

getInfo() public méthode

array( 'id' => 'geoip_serverbased', 'title' => '...', 'description' => '...' );
public getInfo ( ) : array
Résultat array

getLocation() public méthode

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.
Résultat array

getSupportedLocationInfo() public méthode

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
Résultat array

isAvailable() public méthode

There's a special check for the Apache module, but we can't check specifically for anything else.
public isAvailable ( ) : boolean | string
Résultat boolean | string

isSameOrAnonymizedIp() public static méthode

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.
Résultat boolean

isWorking() public méthode

Returns true if the GEOIP_ADDR server variable is defined.
public isWorking ( ) : boolean
Résultat boolean