PHP Class Piwik\Plugins\UserCountry\LocationProvider\GeoIp

Inheritance: extends Piwik\Plugins\UserCountry\LocationProvider
显示文件 Open project: piwik/piwik Class Usage Examples

Public Properties

Property Type Description
$dbNames array Stores possible database file names categorized by the type of information GeoIP databases hold.
$geoIPDatabaseDir

Public Methods

Method Description
completeLocationResult ( array &$location ) Attempts to fill in some missing information in a GeoIP location.
getGeoIPDatabaseTypeFromFilename ( string $filename ) : string | false Returns the type of GeoIP database ('loc', 'isp' or 'org') based on the filename (eg, 'GeoLiteCity.dat', 'GeoIPISP.dat', etc).
getPathForGeoIpDatabase ( string $filename ) : string Returns full path for a GeoIP database managed by Piwik.
getPathToGeoIpDatabase ( array $possibleFileNames ) : string | false Returns the path of an existing GeoIP database or false if none can be found.
getRegionNameFromCodes ( string $countryCode, string $regionCode ) : string Returns a region name for a country code + region code.
getRegionNames ( ) : array Returns an array of region names mapped by country code & region code.
isDatabaseInstalled ( ) : boolean Returns true if there is a GeoIP database in the 'misc' directory.
isWorking ( ) : boolean | string Returns true if this provider has been setup correctly, the error message if otherwise.

Protected Methods

Method Description
fixupLocation ( &$location ) Fix up data to work with our SVG maps which include 'Tib' boundaries

Private Methods

Method Description
getTestIpAndResult ( ) : array Returns test IP used by isWorking and expected result.

Method Details

completeLocationResult() public method

This method will call LocationProvider::completeLocationResult and then try to set the region name of the location if the country code & region code are set.
public completeLocationResult ( array &$location )
$location array The location information to modify.

fixupLocation() protected method

Fix up data to work with our SVG maps which include 'Tib' boundaries
protected fixupLocation ( &$location )

getGeoIPDatabaseTypeFromFilename() public static method

Returns the type of GeoIP database ('loc', 'isp' or 'org') based on the filename (eg, 'GeoLiteCity.dat', 'GeoIPISP.dat', etc).
public static getGeoIPDatabaseTypeFromFilename ( string $filename ) : string | false
$filename string
return string | false 'loc', 'isp', 'org', or false if cannot find a database type.

getPathForGeoIpDatabase() public static method

Returns full path for a GeoIP database managed by Piwik.
public static getPathForGeoIpDatabase ( string $filename ) : string
$filename string Name of the .dat file.
return string

getPathToGeoIpDatabase() public static method

Returns the path of an existing GeoIP database or false if none can be found.
public static getPathToGeoIpDatabase ( array $possibleFileNames ) : string | false
$possibleFileNames array The list of possible file names for the GeoIP database.
return string | false

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).

getRegionNames() public static method

Returns an array of region names mapped by country code & region code.
public static getRegionNames ( ) : array
return array

isDatabaseInstalled() public static method

Returns true if there is a GeoIP database in the 'misc' directory.
public static isDatabaseInstalled ( ) : boolean
return boolean

isWorking() public method

Returns true if this provider has been setup correctly, the error message if otherwise.
public isWorking ( ) : boolean | string
return boolean | string

Property Details

$dbNames public_oe static_oe property

Stores possible database file names categorized by the type of information GeoIP databases hold.
public static array $dbNames
return array

$geoIPDatabaseDir public_oe static_oe property

public static $geoIPDatabaseDir