Open Journal Systems  3.3.0
GeoLocationTool Class Reference

Public Member Functions

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

Data Fields

 $_geoLocationTool
 
 $_isDbFilePresent
 
 $_regionName
 

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.

Constructor & Destructor Documentation

◆ __construct()

GeoLocationTool::__construct ( )

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.

Member Function Documentation

◆ _getCountryCodeOnList()

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.

References $_geoLocationTool, and $tool.

Referenced by get2LettersCountryCode(), and get3LettersCountryCode().

◆ get2LettersCountryCode()

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

◆ get3LettersCountryCode()

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

◆ getAllCountryCodes()

GeoLocationTool::getAllCountryCodes ( )

Get all country codes.

Returns
mixed array or null

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

References $_geoLocationTool, and $tool.

◆ getGeoLocation()

GeoLocationTool::getGeoLocation (   $ip)

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

Parameters
$ipstring
Returns
array

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

◆ getRegions()

GeoLocationTool::getRegions (   $countryId)

Get regions by country.

Parameters
$countryIdint
Returns
array

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

References $_regionName.

◆ isPresent()

GeoLocationTool::isPresent ( )

Identify if the geolocation database tool is available for use.

Returns
boolean

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

References $_isDbFilePresent.

Field Documentation

◆ $_geoLocationTool

GeoLocationTool::$_geoLocationTool

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

Referenced by _getCountryCodeOnList(), and getAllCountryCodes().

◆ $_isDbFilePresent

GeoLocationTool::$_isDbFilePresent

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

Referenced by isPresent().

◆ $_regionName

GeoLocationTool::$_regionName

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

Referenced by getRegions().


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