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

Наследование: extends Piwik\Plugins\UserCountry\LocationProvider\GeoIp
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( array | boolean $customDbNames = false ) Constructor.
__destruct ( ) Closes all open geoip instances.
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 Returns true if this location provider is available. Piwik ships w/ the MaxMind PHP library, so this provider is available if a location GeoIP database can be found.
isWorking ( ) : boolean | string Returns true if this provider has been setup correctly, the error message if otherwise.

Приватные методы

Метод Описание
getGeoIpInstance ( string $key ) : object | false Returns a GeoIP instance. Creates it if necessary.

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

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

Constructor.
public __construct ( array | boolean $customDbNames = false )
$customDbNames array | boolean The possible filenames for each type of GeoIP database. eg array( 'loc' => array('GeoLiteCity.dat'), 'isp' => array('GeoIP.dat', 'GeoIPISP.dat') 'org' => array('GeoIPOrg.dat') ) If a key is missing (or the parameter not supplied), then the default database names are used.

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

Closes all open geoip instances.
public __destruct ( )

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

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

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

This function will return different results based on the data used. If a city database is used, it may return the country code, region code, city name, area code, latitude, longitude and postal code of the visitor. Alternatively, if used with a country database, only the country code will be returned.
public getLocation ( array $info ) : array
$info array Must have an 'ip' field.
Результат array

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

The location info this provider supports depends on what GeoIP databases it can find. This provider will always support country & continent information. If a region database is found, then region code & name information will be supported. If a city database is found, then region code, region name, city name, area code, latitude, longitude & postal code are all supported. If an organization database is found, organization information is supported. If an ISP database is found, ISP information is supported.
public getSupportedLocationInfo ( ) : array
Результат array

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

Returns true if this location provider is available. Piwik ships w/ the MaxMind PHP library, so this provider is available if a location GeoIP database can be found.
public isAvailable ( ) : boolean
Результат boolean

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

Returns true if this provider has been setup correctly, the error message if otherwise.
public isWorking ( ) : boolean | string
Результат boolean | string