Version Description
Improving AJAX mode - now you can use it for specific pages.
Download this release
Release Info
Developer | benjamin4 |
Plugin | GeoIP Detection |
Version | 3.3.0 |
Comparing to | |
See all releases |
Code changes from version 3.2.1 to 3.3.0
- admin-ui.php +2 -2
- ajax.php +5 -4
- api.php +3 -2
- check_requirements.php +1 -1
- data-sources/auto.php +11 -4
- data-sources/header.php +1 -1
- data-sources/ipstack.php +1 -1
- data-sources/manual.php +1 -1
- data-sources/precision.php +1 -1
- data-sources/registry.php +1 -1
- filter.php +1 -1
- geoip-detect-lib.php +1 -1
- geoip-detect.php +3 -3
- legacy-api.php +1 -1
- lib/ccpa.php +1 -1
- lib/geonames/geonames-country-info.php +1 -1
- lib/get-client-ip.php +1 -1
- readme.txt +8 -79
- shortcode.php +8 -2
- upgrade-plugin.php +12 -1
- views/options.php +15 -6
admin-ui.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
@@ -136,7 +136,7 @@ function geoip_detect_option_page() {
|
|
136 |
|
137 |
$messages = array();
|
138 |
|
139 |
-
$numeric_options = array('set_css_country', 'has_reverse_proxy', 'disable_pagecache', 'ajax_enabled', 'ajax_enqueue_js');
|
140 |
$text_options = array('external_ip', 'trusted_proxy_ips');
|
141 |
$option_names = array_merge($numeric_options, $text_options);
|
142 |
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
136 |
|
137 |
$messages = array();
|
138 |
|
139 |
+
$numeric_options = array('set_css_country', 'has_reverse_proxy', 'disable_pagecache', 'ajax_enabled', 'ajax_enqueue_js', 'ajax_set_css_country', 'ajax_shortcodes');
|
140 |
$text_options = array('external_ip', 'trusted_proxy_ips');
|
141 |
$option_names = array_merge($numeric_options, $text_options);
|
142 |
|
ajax.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2013-
|
5 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
6 |
|
7 |
This program is free software; you can redistribute it and/or modify
|
@@ -155,14 +155,15 @@ function _geoip_detect_register_javascript() {
|
|
155 |
$data = [
|
156 |
'ajaxurl' => admin_url('/admin-ajax.php'),
|
157 |
'default_locales' => apply_filters('geoip_detect2_locales', null),
|
158 |
-
'do_body_classes' => (bool) get_option('geoip-detect-
|
|
|
159 |
'cookie_name' => 'geoip-detect-result', /* If you don't want to use the cookie cache, empty this value via the filter */
|
160 |
'cookie_duration_in_days' => 1, /* If you set this to 0, then the cookie will expire when the window closes. */
|
161 |
];
|
162 |
$data = apply_filters('geoip_detect2_ajax_localize_script_data', $data);
|
163 |
wp_localize_script('geoip-detect-js', 'geoip_detect', [ 'options' => $data ] );
|
164 |
-
|
165 |
-
if (
|
166 |
geoip_detect2_enqueue_javascript();
|
167 |
}
|
168 |
}
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
5 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
6 |
|
7 |
This program is free software; you can redistribute it and/or modify
|
155 |
$data = [
|
156 |
'ajaxurl' => admin_url('/admin-ajax.php'),
|
157 |
'default_locales' => apply_filters('geoip_detect2_locales', null),
|
158 |
+
'do_body_classes' => (bool) get_option('geoip-detect-ajax_set_css_country'),
|
159 |
+
'do_shortcodes' => (bool) get_option('geoip-detect-ajax_shortcodes'),
|
160 |
'cookie_name' => 'geoip-detect-result', /* If you don't want to use the cookie cache, empty this value via the filter */
|
161 |
'cookie_duration_in_days' => 1, /* If you set this to 0, then the cookie will expire when the window closes. */
|
162 |
];
|
163 |
$data = apply_filters('geoip_detect2_ajax_localize_script_data', $data);
|
164 |
wp_localize_script('geoip-detect-js', 'geoip_detect', [ 'options' => $data ] );
|
165 |
+
|
166 |
+
if (get_option('geoip-detect-ajax_enqueue_js') && !is_admin()) {
|
167 |
geoip_detect2_enqueue_javascript();
|
168 |
}
|
169 |
}
|
api.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
@@ -242,7 +242,8 @@ function geoip_detect2_get_external_ip_adress($unfiltered = false) {
|
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
-
* Call this function if you want to register the JS script for AJAX mode only for specific pages
|
|
|
246 |
* @see https://github.com/yellowtree/geoip-detect/wiki/API-Usage-Examples#ajax-enqueue-the-js-file-manually
|
247 |
*/
|
248 |
function geoip_detect2_enqueue_javascript() {
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
+
* Call this function if you want to register the JS script for AJAX mode only for specific pages.
|
246 |
+
* Can be called via the shortcode `[geoip_detect2_enqueue_javascript]`
|
247 |
* @see https://github.com/yellowtree/geoip-detect/wiki/API-Usage-Examples#ajax-enqueue-the-js-file-manually
|
248 |
*/
|
249 |
function geoip_detect2_enqueue_javascript() {
|
check_requirements.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
data-sources/auto.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
@@ -229,8 +229,6 @@ HTML;
|
|
229 |
if (!\is_writable(dirname($outFile)))
|
230 |
return sprintf(__('Database could not be written (%s).', 'geoip-detect'), $outFile);
|
231 |
|
232 |
-
$phar = new \PharData( $downloadedFilename );
|
233 |
-
|
234 |
$outDir = get_temp_dir() . 'geoip-detect/';
|
235 |
|
236 |
global $wp_filesystem;
|
@@ -245,7 +243,16 @@ HTML;
|
|
245 |
}
|
246 |
|
247 |
mkdir($outDir);
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($outDir));
|
251 |
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
229 |
if (!\is_writable(dirname($outFile)))
|
230 |
return sprintf(__('Database could not be written (%s).', 'geoip-detect'), $outFile);
|
231 |
|
|
|
|
|
232 |
$outDir = get_temp_dir() . 'geoip-detect/';
|
233 |
|
234 |
global $wp_filesystem;
|
243 |
}
|
244 |
|
245 |
mkdir($outDir);
|
246 |
+
|
247 |
+
try {
|
248 |
+
$phar = new \PharData( $downloadedFilename );
|
249 |
+
$phar->extractTo($outDir, null, true);
|
250 |
+
} catch(\Throwable $e) {
|
251 |
+
// Fallback method of unpacking?
|
252 |
+
unlink($downloadedFilename); // Do not try to unpack this file again, instead re-download
|
253 |
+
return __('The downloaded file seems to be corrupt. Try again ...', 'geoip-detect');
|
254 |
+
}
|
255 |
+
|
256 |
|
257 |
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($outDir));
|
258 |
|
data-sources/header.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
data-sources/ipstack.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
data-sources/manual.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
data-sources/precision.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
data-sources/registry.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
filter.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
geoip-detect-lib.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
geoip-detect.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.yellowtree.de
|
|
5 |
Description: Retrieving Geo-Information using the Maxmind GeoIP (Lite) Database.
|
6 |
Author: Yellow Tree (Benjamin Pick)
|
7 |
Author URI: http://www.yellowtree.de
|
8 |
-
Version: 3.
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
Text Domain: geoip-detect
|
@@ -16,10 +16,10 @@ Requires WP: 4.0
|
|
16 |
Requires PHP: 5.6
|
17 |
*/
|
18 |
|
19 |
-
define('GEOIP_DETECT_VERSION', '3.
|
20 |
|
21 |
/*
|
22 |
-
Copyright 2013-
|
23 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
5 |
Description: Retrieving Geo-Information using the Maxmind GeoIP (Lite) Database.
|
6 |
Author: Yellow Tree (Benjamin Pick)
|
7 |
Author URI: http://www.yellowtree.de
|
8 |
+
Version: 3.3.0
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
Text Domain: geoip-detect
|
16 |
Requires PHP: 5.6
|
17 |
*/
|
18 |
|
19 |
+
define('GEOIP_DETECT_VERSION', '3.3.0');
|
20 |
|
21 |
/*
|
22 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
23 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
legacy-api.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
lib/ccpa.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2013-
|
5 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
6 |
|
7 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
5 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
6 |
|
7 |
This program is free software; you can redistribute it and/or modify
|
lib/geonames/geonames-country-info.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
lib/get-client-ip.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
Copyright 2013-
|
5 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
6 |
|
7 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
5 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
6 |
|
7 |
This program is free software; you can redistribute it and/or modify
|
readme.txt
CHANGED
@@ -115,11 +115,13 @@ Or maybe you are using a site cache plugin. Then enable the option `Disable cach
|
|
115 |
|
116 |
== Upgrade Notice ==
|
117 |
|
|
|
|
|
|
|
118 |
= 3.2.1 =
|
119 |
This update fixes an issue of 3.2.0 if your installation has WP_DEBUG enabled.
|
120 |
|
121 |
= 3.2.0 =
|
122 |
-
|
123 |
This plugin version simplifies complying the the EULA of Maxmind by automatically retrieving and honoring their Privacy Exclusion List.
|
124 |
You need to enter your Account ID in the options.
|
125 |
Find more information about the Privacy Exclusion API in the FAQ of the plugin.
|
@@ -142,33 +144,13 @@ The Plugin was renamed to Geolocation IP Detection in order to prevent trademark
|
|
142 |
|
143 |
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.
|
144 |
|
145 |
-
= 2.13.0 =
|
146 |
-
|
147 |
-
PHP 5.6 is required now. If you are using the AJAX mode, this version will drastically reduce the number of requests as it will store the visitor's geo-information in a cookie.
|
148 |
-
|
149 |
-
= 2.12.0 =
|
150 |
-
|
151 |
-
New: Ipstack.com can be used as data source
|
152 |
-
|
153 |
-
= 2.11.0 =
|
154 |
-
|
155 |
-
The Download code of the automatically updated Maxmind file was rewritten for better performance. Also, AJAX support is now in beta (see documentation).
|
156 |
-
|
157 |
-
= 2.9.2 =
|
158 |
-
|
159 |
-
Hotfix: In 2.9.1, this plugin was incompatible with other Contact Form 7-Special Mailtags (https://contactform7.com/special-mail-tags/).
|
160 |
-
|
161 |
-
= 2.9.1 =
|
162 |
-
|
163 |
-
Online Shops: Be careful to comply to (EU) 2018/302 (going into effect 03 Dec 2018) in how you use this plugin !
|
164 |
-
|
165 |
-
= 2.9.0 =
|
166 |
-
|
167 |
-
There have been changes to the reverse proxy logic. If you have enabled a reverse proxy, check if the detected IP is correct.
|
168 |
-
New: Shortcode for showing/hiding content!
|
169 |
-
|
170 |
== Changelog ==
|
171 |
|
|
|
|
|
|
|
|
|
|
|
172 |
= 3.2.1 =
|
173 |
* FIX: Fix a fatal error that can occur in 3.2.0 if WP_DEBUG is enabled on your installation.
|
174 |
|
@@ -230,57 +212,4 @@ New: Shortcode for showing/hiding content!
|
|
230 |
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:
|
231 |
https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
|
232 |
|
233 |
-
= 2.13 =
|
234 |
-
* NEW: JS/AJAX mode now caches the response as a cookie so that every user only needs to call the AJAX requests once
|
235 |
-
* NEW: If you install the plugin [SVG Flags](https://wordpress.org/plugins/svg-flags-lite/), you can use this shortcode to show the flag of the current country: `[geoip_detect2_current_flag]`. See [Documentation](https://github.com/yellowtree/geoip-detect/wiki/API:-Shortcodes#add-a-flag-of-the-visitors-country) for more infos.
|
236 |
-
* FIX: Example PHP code on Lookup page now displays nicer array syntax (and fixing a deprecation warning)
|
237 |
-
* Updated Maxmind vendor code - PHP 5.6 is required now
|
238 |
-
|
239 |
-
= 2.12.1 =
|
240 |
-
* NEW: With the new Wordpress filter `geoip_detect2_record_data_after_cache` you can change the record data for testing purposes (see https://github.com/yellowtree/geoip-detect/wiki/API-Usage-Examples#change-record-data-eg-for-testing-purposes)
|
241 |
-
* NEW: All datasources now also have the properties `extra->flag` (containing the flag as Unicode Emoji) and `extra->tel` (containing the country dial code)
|
242 |
-
* Some cleanup in ipstack & showing all properties in backend.
|
243 |
-
|
244 |
-
= 2.12.0 =
|
245 |
-
* NEW: It is now possible to use ipstack.com as a data source.
|
246 |
-
* The Backend Lookup UI now can show all properties and you can choose if you want to see the PHP, Shortcode or JS syntax.
|
247 |
-
* The property "extra->original" now contains the original Web Answer array from the datasources ipstack & hostinfo
|
248 |
-
|
249 |
-
= 2.11.2 =
|
250 |
-
* The auto-updater of the Maxmind City Lite source now updates more often (every 1-2weeks) in order to get more accurate data.
|
251 |
-
|
252 |
-
= 2.11.1 =
|
253 |
-
* FIX: When activating the plugin on Wordpress MultiSite, an error was thrown before
|
254 |
-
* NEW: Add body class "geoip-country-is-in-european-union" if the detected country is inside of the European Union
|
255 |
-
* JS/AJAX support for cached pages (Public BETA now. See https://github.com/yellowtree/geoip-detect/wiki/API%3A-AJAX)
|
256 |
-
* NEW: If AJAX and body classes are enabled, body classes are added via AJAX.
|
257 |
-
|
258 |
-
= 2.11.0 =
|
259 |
-
* NEW: JS/AJAX support for cached pages (This is in **BETA**. Read https://github.com/yellowtree/geoip-detect/wiki/API%3A-AJAX on how to activate it)
|
260 |
-
* FIX: Improve performance of unpacking the Maxmind file (Source: Automatic download) - important for hosts with a low max_execution_time
|
261 |
-
* NEW: On removal (in the Backend), the plugin will delete its options from the database and the downloaded Maxmind file
|
262 |
-
|
263 |
-
= 2.10.0 =
|
264 |
-
* NEW: The whitelisted proxies can now be subnets such as `11.11.11.0/24`
|
265 |
-
* NEW: Add a ContactForm7-Tag `geoip_detect2_text_input` (see https://github.com/yellowtree/geoip-detect/wiki/API:-Shortcodes-for-Contact-Form-7#create-a-text-input-that-is-prefilled-with-a-geodetected-property)
|
266 |
-
* NEW: A new wordpress filter allows overriding of the detected geo-information inside the `geoip_detect2_shortcode_show_if`-Shortcode. Use the already-existing filter `geoip_detect2_record_information` instead if you want to override this information for all shortcodes and API calls.
|
267 |
-
* Updated Maxmind vendor code
|
268 |
-
* Increased WP minimum version to 4.0
|
269 |
-
|
270 |
-
= 2.9.2 =
|
271 |
-
* FIX: ContactForm7-Mailtag disabled mailtags from other plugins.
|
272 |
-
|
273 |
-
= 2.9.1 =
|
274 |
-
* NEW: Add ContactForm7-Mailtags so that the user information formatting can be customized: `geoip_detect2_get_client_ip`, `geoip_detect2_get_current_source_description`, `geoip_detect2_property_country`, `geoip_detect2_property_state`, `geoip_detect2_property_city`. Of course you can still use `geoip_detect2_user_info` as shortcode for all these informations.
|
275 |
-
* FIX: On some server, the plugin had wrongly assumed that PHP was compiled without IPv6-support.
|
276 |
-
|
277 |
-
= 2.9.0 =
|
278 |
-
* Add default Privacy text for GDPR compliance.
|
279 |
-
* The reverse proxy logic was heavily changed. If you run into configuration errors, try the debug panel (see link after the reverse proxy option).
|
280 |
-
* NEW: Reverse proxies can now be whitelisted - all non-whitelisted proxies are treated as user IP.
|
281 |
-
* NEW: Shortcode to show/hide content dynamically. (`[geoip_detect2_show_if country="US" not_state="Texas"]TEXT[/geoip_detect2_show_if]`) (Thanks to @DynAggelos!)
|
282 |
-
* NEW: All shortcodes now support multiple subdivisions (`[geoip_detect2 property="subdivisions.0.isoCode"]`)
|
283 |
-
* NEW: The CSS classes that are added to the body-tag (if enabled in the options) now also include the most specific subdivision (`geoip-province-HE`).
|
284 |
-
* Maxmind vendor code was updated to the current version (2.9.0).
|
285 |
-
|
286 |
[Older changelog](https://github.com/yellowtree/geoip-detect/blob/master/CHANGELOG.md)
|
115 |
|
116 |
== Upgrade Notice ==
|
117 |
|
118 |
+
= 3.3.0 =
|
119 |
+
Improving AJAX mode - now you can use it for specific pages.
|
120 |
+
|
121 |
= 3.2.1 =
|
122 |
This update fixes an issue of 3.2.0 if your installation has WP_DEBUG enabled.
|
123 |
|
124 |
= 3.2.0 =
|
|
|
125 |
This plugin version simplifies complying the the EULA of Maxmind by automatically retrieving and honoring their Privacy Exclusion List.
|
126 |
You need to enter your Account ID in the options.
|
127 |
Find more information about the Privacy Exclusion API in the FAQ of the plugin.
|
144 |
|
145 |
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.
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= 3.3.0 =
|
150 |
+
* NEW shortcode `[geoip_detect2_enqueue_javascript]` if you are using AJAX mode, but only on certain wordpress pages.
|
151 |
+
* 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.
|
152 |
+
* Some UI fixes
|
153 |
+
|
154 |
= 3.2.1 =
|
155 |
* FIX: Fix a fatal error that can occur in 3.2.0 if WP_DEBUG is enabled on your installation.
|
156 |
|
212 |
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:
|
213 |
https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
|
214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
[Older changelog](https://github.com/yellowtree/geoip-detect/blob/master/CHANGELOG.md)
|
shortcode.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
@@ -819,4 +819,10 @@ function geoip_detect2_shortcode_current_flag($attr, $content = '', $shortcodeNa
|
|
819 |
|
820 |
return $html;
|
821 |
}
|
822 |
-
add_shortcode('geoip_detect2_current_flag', 'geoip_detect2_shortcode_current_flag');
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
819 |
|
820 |
return $html;
|
821 |
}
|
822 |
+
add_shortcode('geoip_detect2_current_flag', 'geoip_detect2_shortcode_current_flag');
|
823 |
+
|
824 |
+
function geoip_detect2_shortcode_enqueue_javascript() {
|
825 |
+
geoip_detect2_enqueue_javascript();
|
826 |
+
return '';
|
827 |
+
}
|
828 |
+
add_shortcode('geoip_detect2_enqueue_javascript', 'geoip_detect2_shortcode_enqueue_javascript');
|
upgrade-plugin.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2013-
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
@@ -66,6 +66,17 @@ function geoip_detect_do_upgrade($old_version) {
|
|
66 |
if (version_compare('2.11.1', $old_version, '>')) {
|
67 |
delete_option('geoip-detect-ajax_beta');
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
/**
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2013-2021 Yellow Tree, Siegen, Germany
|
4 |
Author: Benjamin Pick (wp-geoip-detect| |posteo.de)
|
5 |
|
6 |
This program is free software; you can redistribute it and/or modify
|
66 |
if (version_compare('2.11.1', $old_version, '>')) {
|
67 |
delete_option('geoip-detect-ajax_beta');
|
68 |
}
|
69 |
+
|
70 |
+
// v3.3.0 AJAX css body classes new option - set default value to avoid bc break
|
71 |
+
if (version_compare('3.3.0', $old_version, '>')) {
|
72 |
+
$value = get_option('geoip-detect-set_css_country') && get_option('geoip-detect-ajax_enabled');
|
73 |
+
if ($value) {
|
74 |
+
update_option('geoip-detect-ajax_set_css_country', '1');
|
75 |
+
update_option('geoip-detect-ajax_enqueue_js', '1');
|
76 |
+
update_option('geoip-detect-set_css_country', '0');
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
}
|
81 |
|
82 |
/**
|
views/options.php
CHANGED
@@ -67,7 +67,7 @@ $currentSourceId = $currentSource->getId();
|
|
67 |
<?php wp_nonce_field( 'geoip_detect_options' ); ?>
|
68 |
<h3><?php _e('General Options', 'geoip-detect'); ?></h3>
|
69 |
<p>
|
70 |
-
<label><input type="checkbox" name="options[set_css_country]" value="1" <?php if (!empty($wp_options['set_css_country'])) { echo 'checked="checked"'; } ?>> <?php _e('Add a country-specific CSS class to the <body>-Tag.', 'geoip-detect'); ?></label><br />
|
71 |
</p>
|
72 |
<p>
|
73 |
<label><input type="checkbox" name="options[disable_pagecache]" value="1" <?php if (!empty($wp_options['disable_pagecache'])) { echo 'checked="checked"'; } ?>> <?php _e('Disable caching a page that contains a shortcode or API call to geo-dependent functions.', 'geoip-detect'); ?></label><br />
|
@@ -80,16 +80,25 @@ $currentSourceId = $currentSource->getId();
|
|
80 |
</p>
|
81 |
|
82 |
<p>
|
83 |
-
<label><input type="checkbox" name="options[ajax_enabled]" value="1" <?php if (!empty($wp_options['ajax_enabled'])) { echo 'checked="checked"'; }
|
84 |
</p>
|
85 |
<?php if (in_array($currentSourceId, array('precision', 'ipstack')) && !empty($wp_options['ajax_enabled'])): ?>
|
86 |
<span class="geoip_detect_error" style="margin-top: 0;"><?php printf(__('Warning: In theory, other websites could use your API credits over AJAX, this cannot be prevented completely (see <a href="%s" target="_blank">documentation</a> for more infos). You should use a different data source or disable AJAX.', 'geoip-detect'), 'https://github.com/yellowtree/geoip-detect/wiki/JS-API-Documentation'); ?></span>
|
87 |
<?php endif; ?>
|
88 |
-
<p style="margin-left:
|
89 |
-
<label><input type="checkbox" name="options[ajax_enqueue_js]" value="1" <?php if (!empty($wp_options['ajax_enqueue_js'])) { echo 'checked="checked"'; }
|
90 |
<span class="detail-box">
|
91 |
-
<?php _e('
|
92 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
</p>
|
94 |
<p>
|
95 |
|
@@ -103,7 +112,7 @@ $currentSourceId = $currentSource->getId();
|
|
103 |
<?php endif; ?>
|
104 |
</span>
|
105 |
</p>
|
106 |
-
<p>
|
107 |
<label><?php _e('IPs of trusted proxies:', 'geoip-detect'); ?><input type="text" name="options[trusted_proxy_ips]" value="<?php echo esc_attr($wp_options['trusted_proxy_ips']); ?>" placeholder="1.1.1.1, 1234::1, 2.2.2.2/24" />
|
108 |
<span class="detail-box">
|
109 |
<?php if (empty($wp_options['has_reverse_proxy']) && !empty($wp_options['trusted_proxy_ips'])) : ?>
|
67 |
<?php wp_nonce_field( 'geoip_detect_options' ); ?>
|
68 |
<h3><?php _e('General Options', 'geoip-detect'); ?></h3>
|
69 |
<p>
|
70 |
+
<label><input type="checkbox" name="options[set_css_country]" value="1" <?php if (!empty($wp_options['set_css_country'])) { echo 'checked="checked"'; } ?>> <?php _e('Add a country-specific CSS class to the <body>-Tag on every page.', 'geoip-detect'); ?></label><br />
|
71 |
</p>
|
72 |
<p>
|
73 |
<label><input type="checkbox" name="options[disable_pagecache]" value="1" <?php if (!empty($wp_options['disable_pagecache'])) { echo 'checked="checked"'; } ?>> <?php _e('Disable caching a page that contains a shortcode or API call to geo-dependent functions.', 'geoip-detect'); ?></label><br />
|
80 |
</p>
|
81 |
|
82 |
<p>
|
83 |
+
<label><input type="checkbox" name="options[ajax_enabled]" value="1" <?php if (!empty($wp_options['ajax_enabled'])) { echo 'checked="checked"'; } ?>> <?php _e('Enable AJAX endpoint to get the information for the current IP even on cached pages.', 'geoip-detect'); ?></label>
|
84 |
</p>
|
85 |
<?php if (in_array($currentSourceId, array('precision', 'ipstack')) && !empty($wp_options['ajax_enabled'])): ?>
|
86 |
<span class="geoip_detect_error" style="margin-top: 0;"><?php printf(__('Warning: In theory, other websites could use your API credits over AJAX, this cannot be prevented completely (see <a href="%s" target="_blank">documentation</a> for more infos). You should use a different data source or disable AJAX.', 'geoip-detect'), 'https://github.com/yellowtree/geoip-detect/wiki/JS-API-Documentation'); ?></span>
|
87 |
<?php endif; ?>
|
88 |
+
<p style="margin-left: 30px;">
|
89 |
+
<label><input type="checkbox" name="options[ajax_enqueue_js]" value="1" <?php if (!empty($wp_options['ajax_enqueue_js'])) { echo 'checked="checked"'; } ?>> <?php _e('Add JS Helper functions to all pages.', 'geoip-detect'); ?></label>
|
90 |
<span class="detail-box">
|
91 |
+
<?php _e('This enables you code geo-dependent behavior in JS (see <a href="https://github.com/yellowtree/geoip-detect/wiki/API%3A-AJAX" target="_blank">documentation</a>)', 'geoip-detect'); ?>
|
92 |
</span>
|
93 |
+
<label><input type="checkbox" name="options[ajax_set_css_country]" value="1" <?php if (!empty($wp_options['ajax_set_css_country'])) { echo 'checked="checked"'; } ?>> <?php _e('Add a country-specific CSS class to the <body>-Tag (via AJAX).', 'geoip-detect'); ?></label>
|
94 |
+
<span class="detail-box">
|
95 |
+
<?php _e('This requires the JS Helper functions, either by ticking the option above, or by enqueuing it manually for the sites that need it.', 'geoip-detect'); ?>
|
96 |
+
</span>
|
97 |
+
<label style="color:#777"><input type="checkbox" name="options[ajax_shortcodes]" disabled value="1" <?php if (!empty($wp_options['ajax_shortcodes'])) { echo 'checked="checked"'; } ?>><?php _e('Resolve shortcodes (via AJAX).', 'geoip-detect'); ?></label>
|
98 |
+
<span class="detail-box">
|
99 |
+
<?php _e('(Shortcodes are not supported yet.)', 'geoip-detect'); ?>
|
100 |
+
</span>
|
101 |
+
|
102 |
</p>
|
103 |
<p>
|
104 |
|
112 |
<?php endif; ?>
|
113 |
</span>
|
114 |
</p>
|
115 |
+
<p style="margin-left: 30px;">
|
116 |
<label><?php _e('IPs of trusted proxies:', 'geoip-detect'); ?><input type="text" name="options[trusted_proxy_ips]" value="<?php echo esc_attr($wp_options['trusted_proxy_ips']); ?>" placeholder="1.1.1.1, 1234::1, 2.2.2.2/24" />
|
117 |
<span class="detail-box">
|
118 |
<?php if (empty($wp_options['has_reverse_proxy']) && !empty($wp_options['trusted_proxy_ips'])) : ?>
|