Skip to content

Commit ddfc63e

Browse files
committed
Updating to Current WP Repo Version 1.2
1 parent 8dbe6b4 commit ddfc63e

File tree

3 files changed

+7
-69
lines changed

3 files changed

+7
-69
lines changed

inc/country-list.php

100755100644
File mode changed.

readme.txt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
Contributors: wpengine, markkelnar, stevenkword, stephenlin, ryanshoover, taylor4484
33
Tags: wpe, wpengine, geoip, localization, geolocation
44
Requires at least: 3.0.1
5-
Tested up to: 4.3.1
6-
Stable tag: 1.2.0
7-
5+
Tested up to: 4.4.2
6+
Stable tag: 1.1.3
87
License: GPLv2 or later
98
License URI: http://www.gnu.org/licenses/gpl-2.0.html
109

@@ -55,7 +54,7 @@ You can use any of the following location variable shortcodes to return the vari
5554
3) Region: `[geoip-region]`
5655

5756
* In the US region will return States
58-
* In Canada region will return Provinces
57+
* In Canada region will return Providences
5958
* Outside the US/CA this will return a Region number. Please note region numbers are not unique between countries
6059

6160
4) City: `[geoip-city]`
@@ -99,7 +98,7 @@ Below are all the supported negative geography options, this allows to you HIDE
9998
* not_postalcode
10099

101100
= Examples of the Content Shortcode =
102-
This will display “Content just for US visitors” strictly for visitors viewing from the United States.
101+
This will display “Content just for US visitors” strictly for visitors viewing from the United States.
103102
`[geoip-content country="US"] Content just for US visitors [/geoip-content]`
104103

105104

@@ -173,20 +172,6 @@ You want to show an ad written in Spanish to all of South America except for Bra
173172
[geoip_content city="Brasilia"]Venta de la Navidad en los adaptadores USB[/geoip_content]
174173
```
175174

176-
== Calculate distance between points ==
177-
178-
You have a utility function that will calculate the distance from your provided lat/lng coordinate to the visitor's location in either miles or kilometers. This can be useful for determining approximate distances, as results may be cached at the state or country level, depending on your configuration.
179-
180-
Example use:
181-
```
182-
$latitude = 30.268246;
183-
$longitude = -97.745992;
184-
$geo = WPEngine\GeoIp::instance();
185-
if ( false !== $geo->distance_to( $latitude, $longitude ) ) {
186-
$miles_to_wp_engine = $geo->distance_to( $latitude, $longitude );
187-
}
188-
```
189-
190175
== Testing Parameters ==
191176
You can use the following URL parameters to test how your localized content will appear to visitors from various geographic locations. You can add any of the parameters below to any URL of a page using the GeoIP shortcodes or API calls:
192177

@@ -236,8 +221,8 @@ Please contact the WP Engine [Support Team](https://my.wpengine.com/support#gene
236221

237222
== Changelog ==
238223

239-
= 1.2.0 =
240-
- Adds a utility function for calculating distances
224+
= 1.1.3 =
225+
- Bumps version number for WP 4.4.2 compatibility
241226

242227
= 1.1.2 =
243228
- Fixes logic for nested parameter selectors in content shortcode

wpengine-geoip.php

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/*
33
Plugin Name: WP Engine GeoIP
4-
Version: 1.1.2
4+
Version: 1.1.3
55
Description: Create a personalized user experienced based on location.
66
Author: WP Engine
77
Author URI: http://wpengine.com
@@ -578,53 +578,6 @@ private function match_label_synonyms( $label ) {
578578

579579
return $label;
580580
}
581-
582-
/**
583-
* Utility function: Calculate distance to point
584-
*
585-
* Provided a lat/lng, calculate the distance from visitor's location
586-
* Uses the Haversine Formula, accurate for short distance but not over poles or the equator
587-
*
588-
* Note: Test against a return value of false to make sure you got a calculated distance. Example:
589-
* $geo = WPEngine\GeoIp::instance();
590-
* if ( false !== $geo->distance_to( $latitude, $longitude ) ) {
591-
* // Do something
592-
* }
593-
*
594-
* @link http://andrew.hedges.name/experiments/haversine/
595-
* @param float Latitude of the destination in degrees
596-
* @param float Longitude of the destination in degrees
597-
* @param bool Whether to calculate the distance in kilometers or miles
598-
* @return float distance in miles
599-
* @since 1.2
600-
*/
601-
public function distance_to( $lat, $lng, $metric = false ) {
602-
$start_lat = deg2rad( $this->latitude() );
603-
$start_lng = deg2rad( $this->longitude() );
604-
605-
// Test for null values passed into the function or a 0,0 coordinate for the user
606-
// If either exist, abort. (0,0 is the result when coordinates fail)
607-
if ( is_null( $lat ) || is_null( $lng ) || ( empty( $start_lat ) && empty( $start_lng ) ) ) {
608-
return false;
609-
}
610-
611-
// Choose the right radius for the results: radius of the Earth in kilometers and miles
612-
$radius = $metric ? 6373 : 3961;
613-
614-
// Sanitize the user submitted variables
615-
$lat = floatval( $lat );
616-
$lng = floatval( $lng );
617-
618-
$dlng = $lng - $start_lng;
619-
$dlat = $lat - $start_lat;
620-
621-
// Calculate the distance
622-
$a = ( sin( $dlat / 2 ) * sin( $dlat / 2 ) ) + ( cos( $lat ) * cos( $start_lat ) * sin( $dlng / 2 ) * sin( $dlng / 2 ) );
623-
$c = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) );
624-
$d = $radius * $c;
625-
626-
return $d;
627-
}
628581
}
629582

630583
// Register the GeoIP instance

0 commit comments

Comments
 (0)