PHP Class WPDKGeo

Since: 1.6.0
Author: =undo= ([email protected])
显示文件 Open project: wpxtreme/wpdk Class Usage Examples

Public Methods

Method Description
__construct ( ) : WPDKGeo Create an instance of WPDKGeo class
geoIP ( string $ip = '' ) : array | boolean Return the geo IP information by ip address.
init ( ) : WPDKGeo Return a singleton instance of WPDKGeo class
reverseGeocoding ( array $geo = false ) : array Return an array with reverse geocoding information.
reverseGeocodingWithLatLng ( float $lat, float $lng ) : array Return an array with reverse geocoding information.
route ( array $reverse_geocoding ) : string Return the route.
street_number ( array $reverse_geocoding ) : string Return the street number.

Private Methods

Method Description
getWithType ( array $reverse_geocoding, string $type, string $property = 'long_name' ) : mixed Return a single property/type.

Method Details

__construct() public method

Create an instance of WPDKGeo class
public __construct ( ) : WPDKGeo
return WPDKGeo

geoIP() public method

array(17) { ["longitude"]=> float(12.4833) ["latitude"]=> float(41.9) ["asn"]=> string(6) "AS3269" ["offset"]=> string(1) "2" ["ip"]=> string(12) "87.3.222.157" ["area_code"]=> string(1) "0" ["continent_code"]=> string(2) "EU" ["dma_code"]=> string(1) "0" ["city"]=> string(4) "Rome" ["timezone"]=> string(11) "Europe/Rome" ["region"]=> string(5) "Lazio" ["country_code"]=> string(2) "IT" ["isp"]=> string(21) "Telecom Italia S.p.a." ["postal_code"]=> string(5) "00141" ["country"]=> string(5) "Italy" ["country_code3"]=> string(3) "ITA" ["region_code"]=> string(2) "07" }
public geoIP ( string $ip = '' ) : array | boolean
$ip string Optional. The ip address or empty for `$_SERVER['REMOTE_ADDR']`,
return array | boolean

init() public static method

Return a singleton instance of WPDKGeo class
public static init ( ) : WPDKGeo
return WPDKGeo

reverseGeocoding() public method

Return an array with reverse geocoding information.
public reverseGeocoding ( array $geo = false ) : array
$geo array Optional. Array retuned by `self::geoIP()` method. If empty `self::geoIP()` without ip is called.
return array

reverseGeocodingWithLatLng() public method

Return an array with reverse geocoding information.
public reverseGeocodingWithLatLng ( float $lat, float $lng ) : array
$lat float Latitude value.
$lng float Longitude value.
return array

route() public method

Return the route.
public route ( array $reverse_geocoding ) : string
$reverse_geocoding array The array with reverse geocoding information retuned by `reverseGeocodingWithLatLng()`
return string

street_number() public method

Return the street number.
public street_number ( array $reverse_geocoding ) : string
$reverse_geocoding array The array with reverse geocoding information retuned by `reverseGeocodingWithLatLng()`
return string