Open Journal Systems  2.4.8
 All Classes Namespaces Functions Variables Groups Pages
GeoLocationTool Class Reference

Public Member Functions

 _getCountryCodeOnList ($countryCode, $countryCodeListName)
 
 GeoLocationTool ()
 
 get2LettersCountryCode ($countryCode3)
 
 get3LettersCountryCode ($countryCode)
 
 getAllCountryCodes ()
 
 getGeoLocation ($ip)
 
 getRegions ($countryId)
 
 isPresent ()
 

Detailed Description

Geo location by ip wrapper class.

GeoIp tool for geo location based on ip

Definition at line 19 of file GeoLocationTool.inc.php.

Member Function Documentation

GeoLocationTool::_getCountryCodeOnList (   $countryCode,
  $countryCodeListName 
)

Get the passed country code inside the passed list.

Parameters
$countryCodeThe 2 letters country code.
$countryCodeListarray Any geoip country code list.
Returns
mixed String or null.

Definition at line 144 of file GeoLocationTool.inc.php.

Referenced by get2LettersCountryCode(), and get3LettersCountryCode().

GeoLocationTool::GeoLocationTool ( )

Constructor. If we cannot find the database file, an empty object will be constructed. Use the method isPresent() to check if the database file is present before use.

Definition at line 32 of file GeoLocationTool.inc.php.

GeoLocationTool::get2LettersCountryCode (   $countryCode3)

Return the 2 letter version of country codes based on the passed 3 letters version.

Parameters
$countryCode3string
Returns
mixed string or null

Definition at line 117 of file GeoLocationTool.inc.php.

References _getCountryCodeOnList().

GeoLocationTool::get3LettersCountryCode (   $countryCode)

Return the 3 letters version of country codes based on the passed 2 letters version.

Parameters
$countryCodestring
Returns
mixed string or null

Definition at line 107 of file GeoLocationTool.inc.php.

References _getCountryCodeOnList().

GeoLocationTool::getAllCountryCodes ( )

Get all country codes.

Returns
mixed array or null

Definition at line 89 of file GeoLocationTool.inc.php.

GeoLocationTool::getGeoLocation (   $ip)

Return country code and city name for the passed ip address.

Parameters
$ipstring
Returns
array

Definition at line 55 of file GeoLocationTool.inc.php.

GeoLocationTool::getRegions (   $countryId)

Get regions by country.

Parameters
$countryIdint
Returns
array

Definition at line 126 of file GeoLocationTool.inc.php.

GeoLocationTool::isPresent ( )

Identify if the geolocation database tool is available for use.

Returns
boolean

Definition at line 81 of file GeoLocationTool.inc.php.


The documentation for this class was generated from the following file: