PHP Class wpengine\GeoIp

Afficher le fichier Open project: wpengine/geoip

Méthodes publiques

Свойство Type Description
$countries A list of countries and their continents
$geos The geographical data loaded from the environment

Méthodes publiques

Méthode Description
action_admin_init_check_plugin_dependencies ( ) Checks if environment variable depencies are available on the server
action_admin_notices ( ) Displays notice in the admin area if the dependent environment variables are not present
action_init_register_shortcodes ( ) : null Register the shortcode(s)
city ( ) : mixed Get City
compare_location_type ( $a, $b ) Compare the location types
continent ( $country = '' ) : string Get Continent
country ( ) : string Get Country
distance_to ( $lat, $lng, $metric = false ) : float Utility function: Calculate distance to point
do_shortcode_city ( $atts ) : string Output the current city
do_shortcode_content ( $atts, $content = null ) : string Output the content filtered by region
do_shortcode_continent ( $atts ) : string Output the current continent
do_shortcode_country ( $atts ) : string Output the current country
do_shortcode_latitude ( $atts ) : string Output the current latitude
do_shortcode_location ( $atts ) : string Output the current human readable location, in a smart way.
do_shortcode_longitude ( $atts ) : string Output the current longitude
do_shortcode_postal_code ( $atts ) : string Output the current postal code
do_shortcode_region ( $atts ) : string Output the current region
get_actuals ( ) : array Here we extract the data from headers set by nginx -- lets only send them if they are part of the cache key
get_test_parameters ( $geos ) : array We want people to be able to test the plugin, so we'll include some url parameters that will spoof a location
init ( ) Initialize hooks and setup environment variables
instance ( ) Register singleton
latitude ( ) : mixed Get Latitude
longitude ( ) : mixed Get Longitude
postal_code ( ) : mixed Get Postal Code
region ( ) : string Get Region
setup ( ) Setup environment variables

Private Methods

Méthode Description
match_label_synonyms ( $label ) : string As a favor to users, let's match some common synonyms

Method Details

action_admin_init_check_plugin_dependencies() public méthode

Checks if environment variable depencies are available on the server
Since: 0.5.0

action_admin_notices() public méthode

Displays notice in the admin area if the dependent environment variables are not present
Since: 0.5.0

action_init_register_shortcodes() public méthode

Register the shortcode(s)
Since: 0.5.0
public action_init_register_shortcodes ( ) : null
Résultat null

city() public méthode

Get City
Since: 0.5.0
public city ( ) : mixed
Résultat mixed Description

compare_location_type() public méthode

Used for sorting location types from largest area to smallest area
Since: 1.1.2
public compare_location_type ( $a, $b )

continent() public méthode

Get Continent
Since: 1.1.0
public continent ( $country = '' ) : string
Résultat string Two-letter continent code, e.g. EU for Europe

country() public méthode

Get Country
Since: 0.5.0
public country ( ) : string
Résultat string Two-letter country code, e.g.) US for the United States of America

distance_to() public méthode

Provided a lat/lng, calculate the distance from visitor's location Uses the Haversine Formula, accurate for short distance but not over poles or the equator Note: Test against a return value of false to make sure you got a calculated distance. Example: $geo = WPEngine\GeoIp::instance(); if ( false !== $geo->distance_to( $latitude, $longitude ) ) { Do something }
public distance_to ( $lat, $lng, $metric = false ) : float
Résultat float distance in miles

do_shortcode_city() public méthode

Output the current city
Since: 0.5.0
public do_shortcode_city ( $atts ) : string
Résultat string City name

do_shortcode_content() public méthode

Output the content filtered by region
Since: 1.1.0
public do_shortcode_content ( $atts, $content = null ) : string
Résultat string HTML

do_shortcode_continent() public méthode

Output the current continent
Since: 1.1.0
public do_shortcode_continent ( $atts ) : string
Résultat string Two-letter continent code

do_shortcode_country() public méthode

Output the current country
Since: 0.5.0
public do_shortcode_country ( $atts ) : string
Résultat string Two-letter country code

do_shortcode_latitude() public méthode

Output the current latitude
Since: 0.6.0
public do_shortcode_latitude ( $atts ) : string
Résultat string latitude

do_shortcode_location() public méthode

Output the current human readable location, in a smart way.
Since: 0.5.0
public do_shortcode_location ( $atts ) : string
Résultat string $html

do_shortcode_longitude() public méthode

Output the current longitude
Since: 0.6.0
public do_shortcode_longitude ( $atts ) : string
Résultat string longitude

do_shortcode_postal_code() public méthode

Output the current postal code
Since: 0.6.0
public do_shortcode_postal_code ( $atts ) : string
Résultat string postal code

do_shortcode_region() public méthode

Output the current region
Since: 0.5.0
public do_shortcode_region ( $atts ) : string
Résultat string Two-letter region code

get_actuals() public méthode

Here we extract the data from headers set by nginx -- lets only send them if they are part of the cache key
Since: 0.1.0
public get_actuals ( ) : array
Résultat array All of the GeoIP related environment variables available on the current server instance

get_test_parameters() public méthode

We want people to be able to test the plugin, so we'll include some url parameters that will spoof a location
Since: 1.1.0
public get_test_parameters ( $geos ) : array
Résultat array modified version of the GeoIP location array based on url parameters

init() public static méthode

Initialize hooks and setup environment variables
Since: 0.1.0
public static init ( )

instance() public static méthode

Register singleton
Since: 0.1.0
public static instance ( )

latitude() public méthode

Get Latitude
Since: 0.6.0
public latitude ( ) : mixed
Résultat mixed Description

longitude() public méthode

Get Longitude
Since: 0.6.0
public longitude ( ) : mixed
Résultat mixed Description

postal_code() public méthode

Get Postal Code
Since: 0.6.0
public postal_code ( ) : mixed
Résultat mixed Description

region() public méthode

Get Region
Since: 0.5.0
public region ( ) : string
Résultat string Two-letter region code. e.g.) CA for California

setup() public méthode

Setup environment variables
Since: 0.1.0
public setup ( )

Property Details

$countries public_oe property

A list of countries and their continents
public $countries

$geos public_oe property

The geographical data loaded from the environment
public $geos