Skip to content

Commit 5b770d4

Browse files
author
Benjamin Pick
committed
Merge branch 'beta'
2 parents 78690e5 + f6e98dc commit 5b770d4

File tree

15 files changed

+75
-363
lines changed

15 files changed

+75
-363
lines changed

README.md

Lines changed: 8 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -121,56 +121,20 @@ See [Documentation](https://github.com/yellowtree/geoip-detect/wiki) for more in
121121
1. Lookup page (under Tools > Geolocation Lookup)
122122
2. Options page (under Preferences > Geolocation IP Detection)
123123

124-
= 5.0.0 =
125-
126-
If you are using AJAX mode, please read the changelog.
127-
128-
= 4.0.1 =
129-
130-
Hotfix - avoid fatal erros if another plugin also has the Maxmind library included
131-
132-
= 4.0.0 =
133-
134-
Improving Shortcodes (and Shortcodes for AJAX!)
135-
New Minimum Requirements: PHP 7.2.5, and if you use WooCommerce it needs to be 3.9.0 or later.
136-
137-
= 3.3.0 =
138-
139-
Improving AJAX mode - now you can use it for specific pages.
140-
141-
= 3.2.1 =
142-
143-
This update fixes an issue of 3.2.0 if your installation has WP_DEBUG enabled.
144-
145-
= 3.2.0 =
146-
147-
This plugin version simplifies complying the the EULA of Maxmind by automatically retrieving and honoring their Privacy Exclusion List.
148-
You need to enter your Account ID in the options.
149-
Find more information about the Privacy Exclusion API in the FAQ of the plugin.
124+
= 5.5.0 =
150125

151-
= 3.1.0 =
126+
When using the default datasource "hostip.info", the region code (i.e. CA) is now correctly moved to the property `mostSpecificSubdivision` (previously, it was part of the property `city`)
152127

153-
The property access for shortcodes has been rewritten so that property names such as "extra.original.zip" (Datasource: ipstack) are possible now.
154-
155-
= 3.0.3.1 =
156-
157-
Hotfix for the Manual download Maxmind datasource.
158-
The Plugin was renamed to Geolocation IP Detection in order to prevent trademark issues.
159-
160-
= 3.0.3 =
161-
162-
The Plugin was renamed to Geolocation IP Detection in order to prevent trademark issues.
163-
164-
= 3.0.1 =
165-
166-
3.0 was not compatible with the WooCommerce plugin.
167-
168-
= 3.0 =
128+
= 5.0.0 =
169129

170-
If you use Maxmind "Automatic download" then you need to upgrade to this plugin version in order to continue to receive database update. The Database license changed and you will need to register at their website and agree to the EULA.
130+
If you are using AJAX mode, please read the changelog.
171131

172132
## Changelog ##
173133

134+
= 5.5.0 =
135+
* FIX [!]: In the datasource "hostip.info", the region code (i.e. CA) is now correctly moved to the property `mostSpecificSubdivision` (previously, it was part of the property `city`)
136+
* Library updates
137+
174138
= 5.4.1 =
175139
* NEW: JS now emit events 'geoip-detect-shortcodes-done' and 'geoip-detect-body-classes-done', see https://github.com/yellowtree/geoip-detect/wiki/API:-AJAX#events
176140
* FIX: Remove Fatal Error in check_requirements ("Undefined constand GEOIP_DETECT_DEBUG")
@@ -246,123 +210,6 @@ Other minor changes:
246210
* Update some internal libraries & dev tools
247211
* Checked compatibility with PHP 8.1
248212

249-
= 4.2.3 =
250-
* FIX: Further improve the Maxmind admin notice UI
251-
* Update some smaller libraries
252-
253-
= 4.2.2 =
254-
* FIX: Show Maxmind admin notice only on GeoIP pages to make it less intrusive
255-
256-
= 4.2.1 =
257-
* FIX: Do not disable lookup automatically when potentially incompatible Maxmind libraries are found.
258-
259-
= 4.2.0 =
260-
* NEW: Show a warning on the options page when there are incompatibilities with other plugins that also use the Maxmind libraries.
261-
* FIX: Remove an incompatibility of the libraries with Toolset or other Laravel-based plugins
262-
* NEW: In CF7, you can now add any property to the mail body with a special syntax, e.g. `[geoip_detect2_property_country__iso_code]`
263-
* FIX (JS): Replace the internally used library 'lodash' with 'just' to reduce the JS file size
264-
* FIX (JS): Improve error handling in AJAX mode
265-
* FIX: Port numbers in reverse proxies are ignored now (removes incompatibility with Azure reverse proxies)
266-
* FIX: Prevent Cloudflare APO from caching when using AJAX mode or page caching is disabled in the plugin options
267-
268-
= 4.1.0 =
269-
* NEW: An `else` shortcode for `geoip_detect2_show_if` and `geoip_detect2_hide_if`: `[geoip_detect2_show_if city="Berlin"]You are in Berlin[else]You are not in Berlin[/geoip_detect2_show_if]`
270-
* FIX: The JS for AJAX wasn't working for Safari browsers
271-
* FIX: Improving some edge cases of `Record.get_with_locales()` and other methods of `Record` to be consistent with non-AJAX mode
272-
* FIX: Revert more Maxmind libraries to fix incompatibility with WooCommerce
273-
274-
= 4.0.1 =
275-
* FIX: Revert Maxmind library to 2.10.0 for now as the most current version seems to be incompatible with Wordfence and other plugins using the older version of the Maxmind library
276-
277-
= 4.0.0 =
278-
This version has many changes regarding the Shortcodes API. It is a major version because it increases some system requirements (see below).
279-
280-
* NEW: Shortcodes can now also be resolved in AJAX mode (without coding JS).
281-
If you are using a page cache, AJAX mode is the best solution for you. And thanks to shortcodes, this doesn't need custom coding anymore.
282-
You can keep using the same shortcodes as before - just tick the options "Enable AJAX endpoint" and "Resolve shortcodes (via AJAX)".
283-
Instead of doing the geo-lookup while generating the HTML, it will generate boilerplate HTML (for the cache) that will be filled by the plugin's JS automatically (in the client's browser).
284-
* NEW: JS has a new function called `set_override(record, duration_in_days)` (see [AJAX documentation](https://github.com/yellowtree/geoip-detect/wiki/API:-AJAX)) so that the record information can be overridden manually (e.g. when the user selects a certain country manually). A PHP equivalent will follow.
285-
* NEW: The JS syntax of the shortcodes now supports both underscore_case and camelCase (e.g. both country.is_in_european_union and country.isInEuropeanUnion are valid)
286-
* NEW: [geoip_detect2_show_if] and [geoip_detect2_hide_if] now have a new attribute `operator="OR"` - this can be used to create conditions such as "continent = EU OR country = US"
287-
288-
Other Improvements:
289-
* NEW (UI): Add a "Empty Cache"-Button on the Lookup page if the data source is caching the results
290-
* FIX: In some cases, the Privacy Exclusions Update wasn't rescheduled properly before
291-
* FIX: Ipstack: The property country.isInEuropeanUnion is now filled properly.
292-
* Updated vendor code
293-
294-
Also note:
295-
* The minimum PHP version is now 7.2.5
296-
* Minimum Wordpress version is now 5.0
297-
* The plugin is now using PHP Type-Hinting for API functions - if you used the PHP API, please check if you see PHP errors
298-
* If you are using WooCommerce, you need at least version 3.9.0 (released Jan 2020) - otherwise this plugin lookup disables itself
299-
300-
As always, if you are happy about the plugin, please consider [donating](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BSYUZHS8FH3CL), [becoming a Beta-Tester](https://github.com/yellowtree/geoip-detect/wiki/Beta_Testing) or otherwise [contributing](https://github.com/yellowtree/geoip-detect/blob/master/CONTRIBUTING.md) to it.
301-
302-
303-
= 3.3.0 =
304-
* NEW shortcode `[geoip_detect2_enqueue_javascript]` if you are using AJAX mode, but only on certain wordpress pages.
305-
* NEW option "Add a country-specific CSS class to the <body>-Tag (via AJAX)." It is enabled automatically when upgrading the plugin, if the options "AJAX" and the "body tag" was enabled before.
306-
* Some UI fixes
307-
308-
= 3.2.1 =
309-
* FIX: Fix a fatal error that can occur in 3.2.0 if WP_DEBUG is enabled on your installation.
310-
311-
= 3.2.0 =
312-
* NEW: The plugin now integrates the Maxmind Privacy Exclusion API. If you are using a Maxmind datasource, the plugin will return an empty result when looking up an IP that is on the privacy blacklist. You need to enter your Account ID for this.
313-
* FIX: If timeZone is unknown, leave empty value instead of NULL
314-
* FIX: Improve compatibility with PHP 8.0
315-
* UI: Improving some strings for clearer documentation
316-
* AJAX mode is now declared stable (no code change)
317-
318-
= 3.1.2 =
319-
* NEW: The shortcode `[geoip_detect2_text_input]` now has a parameter `type` for hidden or other HTML5 input types (see [Postal code example](https://github.com/yellowtree/geoip-detect/wiki/API:-Shortcodes-for-Contact-Form-7#create-a-text-input-that-is-prefilled-with-a-geodetected-property))
320-
* FIX: The Backend UI "Lookup" does not show an empty timezone anymore if there is no data attached to this IP.
321-
* NEW: In all datasources, the new record property `$record->extra->currencyCode` for the currency code of the detected country has been added
322-
* FIX: Compatibility with PHP 8.0
323-
324-
= 3.1.1 =
325-
* NEW: Add the possibility to access the ISO-3166 alpha3 version of `$record->country`: `$record->extra->countryIsoCode3` or `[geoip_detect2 property="extra.countryIsoCode3"]`
326-
* FIX: The (CF7) shortcode `[geoip_detect2_countries]` now selects the selected country on page reload (the HTML tag autocomplete is set to `off` now)
327-
* FIX: Subnets can now be entered in the preferences of the reverse proxy again (this was a regression of the Admin UI changes in 3.0.3)
328-
* FIX: Do not log "It has not changed since the last update." as a cron-related error that should be shown to the user.
329-
330-
= 3.1.0 =
331-
* FIX: The property access for shortcodes has been rewritten so that property names such as "extra.original.zip" (Datasource: ipstack) are possible now.
332-
* FIX: The lookup page now also shows subdivisions (e.g. for IPs from Uk that have 2 levels of subdivisions)
333-
* NEW: The (CF7) shortcode `[geoip_detect2_countries mycountry include_blank flag tel]` now adds the flag emoji (or ISO code in Windows) and the telephone international code to the country name
334-
* FIX: AJAX mode: Using localStorage instead of Cookies for caching (as we hit the Cookie size limitation sometimes)
335-
* FIX: AJAX mode: Remove jQuery dependency
336-
* FIX: AJAX mode: `geoip_detect2_enqueue_javascript()` can be used now in function.php or templates (see [PHP Example](https://github.com/yellowtree/geoip-detect/wiki/API-Usage-Examples#ajax-enqueue-the-js-file-manually))
337-
338-
= 3.0.4 =
339-
* When an error occurs during the Cron update of the Maxmind database, it is now shown in the backend.
340-
* FIX: All times shown in the Admin backend now use the timezone set by Wordpress
341-
* FIX: In the Admin Options, it was not possible to revert an hardcoded "External IP of this server" back to "automatic detection"
342-
* FIX: `[geoip_detect2_show_if property="country.isInEuropeanUnion" property_value="true"]Products list for EU[/geoip_detect2_show_if]` now works properly (boolean values can be "true"/"yes" or "false"/"no")
343-
* FIX: `[geoip_detect2_current_flag]` now compatible with the [SVG Flags](https://wordpress.org/plugins/svg-flags-lite/) version 0.9.0. See [Documentation](https://github.com/yellowtree/geoip-detect/wiki/API:-Shortcodes#add-a-flag-of-the-visitors-country) for more infos.
344-
* Minor admin improvement: If the value "IPs of trusted proxies" is set, but "The server is behind a reverse proxy" is not ticked, issue an warning
345-
346-
= 3.0.3.1 =
347-
* Hotfix: The filename specified in the manual datasource can be changed properly again.
348-
349-
= 3.0.3 =
350-
* The Plugin has been renamed to "Geolocation IP Detection" in order to prevent trademark issues
351-
* FIX: Minor improvements in the backend UI
352-
* FIX: Security hardening against XSS
353-
354-
= 3.0.2 =
355-
(Was not released)
356-
357-
= 3.0.1 =
358-
* FIX: Button "Update now" now works also on the lookup page.
359-
* FIX: Reverted the vendor code to the one used in 2.13 because it broke installations with the WooCommerce-plugin. I will update the vendor code again once we found a long-term solution for this interdepency.
360-
361-
= 3.0 =
362-
* MAJOR CHANGE: Due to legal reasons, Maxmind now requires registration and some use cases are no longer allowed with the free data. If you use the Maxmind data source with automatic update, the update will fail for versions < 3.0 or if you have not entered a license key yet.
363-
* Updated the Maxmind update mechanism
364-
* Updated Maxmind vendor code
365-
366213
The code of the plugin has not changed much, I have named this version 3.0 to indicate the major change on Maxmind's side of things. They explain it in this blog post:
367214
https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
368215

data-sources/hostinfo.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ public function city($ip) {
3636
$r['country']['iso_code'] = strtoupper($data['country_code']);
3737

3838
if ($data['city']) {
39+
// In USA, region code is part of the city parameter
40+
$cityParts = explode(',', $data['city']);
41+
$data['city'] = trim($cityParts[0]);
42+
if (!empty($cityParts[1])) {
43+
$region = trim($cityParts[1]);
44+
if (!empty($region)) {
45+
$r['subdivisions'][0] = array(
46+
'iso_code' => $region,
47+
'names' => array('en' => $region),
48+
);
49+
}
50+
}
51+
3952
$r['city']['names'] = [ 'en' => $data['city'] ];
4053
}
4154

@@ -80,6 +93,7 @@ private function api_call($ip) {
8093
if ($key == 'country_code' && $value == 'XX')
8194
$value = '';
8295
}
96+
8397
$hasInfo = $data['country_name'] || $data['country_code'] || $data['city'];
8498
}
8599

data-sources/ipstack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function city($ip) {
8484
if (!empty($data['country_code']))
8585
$r['country']['iso_code'] = strtoupper($data['country_code']);
8686

87-
if (!empty($data['region_code'])) {
87+
if (!empty($data['region_code'])) {
8888
$r['subdivisions'][0] = array(
8989
'iso_code' => $data['region_code'],
9090
'names' => $this->locales($locale, $data['region_name']),

geoip-detect.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Description: Provides geographic information detected by an IP adress.
66
Author: Yellow Tree (Benjamin Pick)
77
Author URI: http://www.yellowtree.de
8-
Version: 5.4.1
8+
Version: 5.5.0
99
License: GPLv3 or later
1010
License URI: http://www.gnu.org/licenses/gpl-3.0.html
1111
Text Domain: geoip-detect
@@ -16,7 +16,7 @@
1616
Requires PHP: 7.2.5
1717
*/
1818

19-
define('GEOIP_DETECT_VERSION', '5.4.1');
19+
define('GEOIP_DETECT_VERSION', '5.5.0');
2020

2121
/*
2222
Copyright 2013-2023 Yellow Tree, Siegen, Germany

js/dist/frontend_base.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/dist/frontend_full.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/dist/frontend_minimal.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/geonames/data/country-info.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
// Generated at Mon, 14 Aug 2023 10:51:50 +0200
2+
// Generated at Mon, 13 Jan 2025 15:06:50 +0000
33
return array (
44
'countries' =>
55
array (
@@ -3246,7 +3246,7 @@
32463246
'continent' => 'AS',
32473247
'location' =>
32483248
array (
3249-
'latitude' => 21.131296248312502,
3249+
'latitude' => 21.2152279209553,
32503250
'longitude' => 82.93322521645375,
32513251
),
32523252
'extra' =>
@@ -4796,8 +4796,8 @@
47964796
'continent' => 'AS',
47974797
'location' =>
47984798
array (
4799-
'latitude' => 3.1953621375,
4800-
'longitude' => 73.152777619,
4799+
'latitude' => 3.195189949496238,
4800+
'longitude' => 73.1527255694414,
48014801
),
48024802
'extra' =>
48034803
array (
@@ -5123,7 +5123,7 @@
51235123
'geoname_id' => 2750405,
51245124
'names' =>
51255125
array (
5126-
'en' => 'Netherlands',
5126+
'en' => 'The Netherlands',
51275127
'de' => 'Niederlande',
51285128
'it' => 'Paesi Bassi',
51295129
'es' => 'Holanda',
@@ -6952,7 +6952,7 @@
69526952
'geoname_id' => 298795,
69536953
'names' =>
69546954
array (
6955-
'en' => 'Turkey',
6955+
'en' => 'Türkiye',
69566956
'de' => 'Türkei',
69576957
'it' => 'Turchia',
69586958
'es' => 'Turquía',

lib/geonames/data/country-names.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
// Generated at Mon, 14 Aug 2023 10:51:50 +0200
2+
// Generated at Mon, 13 Jan 2025 15:06:50 +0000
33
return array (
44
'en' =>
55
array (
@@ -156,7 +156,6 @@
156156
'NA' => 'Namibia',
157157
'NR' => 'Nauru',
158158
'NP' => 'Nepal',
159-
'NL' => 'Netherlands',
160159
'NC' => 'New Caledonia',
161160
'NZ' => 'New Zealand',
162161
'NI' => 'Nicaragua',
@@ -224,16 +223,17 @@
224223
'TZ' => 'Tanzania',
225224
'TH' => 'Thailand',
226225
'GM' => 'The Gambia',
226+
'NL' => 'The Netherlands',
227227
'TL' => 'Timor-Leste',
228228
'TG' => 'Togo',
229229
'TK' => 'Tokelau',
230230
'TO' => 'Tonga',
231231
'TT' => 'Trinidad and Tobago',
232232
'TN' => 'Tunisia',
233-
'TR' => 'Turkey',
234233
'TM' => 'Turkmenistan',
235234
'TC' => 'Turks and Caicos Islands',
236235
'TV' => 'Tuvalu',
236+
'TR' => 'Türkiye',
237237
'UM' => 'U.S. Outlying Islands',
238238
'VI' => 'U.S. Virgin Islands',
239239
'UG' => 'Uganda',

lib/geonames/generators/geonames.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21-
// Usage: $ php lib/geonames/generators/geonames.php {api_username}
21+
// Usage: $ php lib/geonames/generators/geonames.php [api_username]
2222
// Requires PHP 5.4
2323

2424
if (php_sapi_name() != "cli")

0 commit comments

Comments
 (0)