GeoIP Detection - Version 3.2.1

Version Description

This update fixes an issue of 3.2.0 if your installation has WP_DEBUG enabled.

Download this release

Release Info

Developer benjamin4
Plugin Icon 128x128 GeoIP Detection
Version 3.2.1
Comparing to
See all releases

Code changes from version 3.2.0 to 3.2.1

data-sources/auto.php CHANGED
@@ -322,6 +322,7 @@ HTML;
322
  }
323
  }
324
 
 
325
  if (WP_DEBUG && !empty($_GET['test_auto_update_now'])) {
326
  add_filter('plugins_loaded', function() {
327
  if (current_user_can('manage_options')) {
@@ -329,6 +330,7 @@ if (WP_DEBUG && !empty($_GET['test_auto_update_now'])) {
329
  }
330
  }, 60);
331
  };
 
332
 
333
  geoip_detect2_register_source(new AutoDataSource());
334
 
322
  }
323
  }
324
 
325
+ /*
326
  if (WP_DEBUG && !empty($_GET['test_auto_update_now'])) {
327
  add_filter('plugins_loaded', function() {
328
  if (current_user_can('manage_options')) {
330
  }
331
  }, 60);
332
  };
333
+ */
334
 
335
  geoip_detect2_register_source(new AutoDataSource());
336
 
data-sources/header.php CHANGED
@@ -139,8 +139,9 @@ HTML;
139
  'provider' => $provider,
140
  ) );
141
  } catch ( \Exception $e ) {
142
- if (WP_DEBUG)
143
- echo printf(__('Error while creating reader for "%s": %s', 'geoip-detect'), $filename, $e->getMessage ());
 
144
  }
145
  }
146
 
139
  'provider' => $provider,
140
  ) );
141
  } catch ( \Exception $e ) {
142
+ if (WP_DEBUG) {
143
+ trigger_error(sprintf(__('Error while creating reader for "%s": %s', 'geoip-detect'), $filename, $e->getMessage ()), E_USER_NOTICE);
144
+ }
145
  }
146
  }
147
 
data-sources/manual.php CHANGED
@@ -192,7 +192,7 @@ HTML;
192
  $reader = new \GeoIp2\Database\Reader ( $data_file, $locales );
193
  } catch ( \Exception $e ) {
194
  if (WP_DEBUG)
195
- printf(__('Error while creating reader for "%s": %s', 'geoip-detect'), $data_file, $e->getMessage());
196
  }
197
  }
198
 
192
  $reader = new \GeoIp2\Database\Reader ( $data_file, $locales );
193
  } catch ( \Exception $e ) {
194
  if (WP_DEBUG)
195
+ trigger_error(sprintf(__('Error while creating reader for "%s": %s', 'geoip-detect'), $data_file, $e->getMessage()), E_USER_NOTICE);
196
  }
197
  }
198
 
geoip-detect-lib.php CHANGED
@@ -331,11 +331,14 @@ function geoip_detect_sanitize_ip_list($ip_list) {
331
  function geoip_detect_is_ip_equal($actual, $expected) {
332
  try {
333
  return IpUtils::checkIp($actual, $expected);
334
- } catch(Exception $e) {
335
- if (WP_DEBUG) {
336
- throw $e;
 
 
 
 
337
  }
338
- return false;
339
  }
340
  }
341
 
331
  function geoip_detect_is_ip_equal($actual, $expected) {
332
  try {
333
  return IpUtils::checkIp($actual, $expected);
334
+ } catch(\Exception $e) {
335
+ // IPv6 not supported by PHP
336
+ // Do string comparison instead (very rough: no subnet, no IP noramlization)
337
+ if (is_array($expected)) {
338
+ return in_array($actual, $expected, true);
339
+ } else {
340
+ return $actual === $expected;
341
  }
 
342
  }
343
  }
344
 
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.2.0
9
  License: GPLv3 or later
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: geoip-detect
@@ -16,7 +16,7 @@ Requires WP: 4.0
16
  Requires PHP: 5.6
17
  */
18
 
19
- define('GEOIP_DETECT_VERSION', '3.2.0');
20
 
21
  /*
22
  Copyright 2013-2020 Yellow Tree, Siegen, Germany
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.2.1
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.2.1');
20
 
21
  /*
22
  Copyright 2013-2020 Yellow Tree, Siegen, Germany
init.php CHANGED
@@ -207,9 +207,11 @@ function on_uninstall() {
207
  register_uninstall_hook(GEOIP_PLUGIN_FILE, __NAMESPACE__ . '\\on_uninstall');
208
 
209
  // For Debugging purposes ...
 
210
  if (WP_DEBUG && isset($_GET['uninstall']) && $_GET['uninstall'] == 'asdf') {
211
 
212
  add_action('plugins_loaded', function() {
213
  on_uninstall();
214
  });
215
  }
 
207
  register_uninstall_hook(GEOIP_PLUGIN_FILE, __NAMESPACE__ . '\\on_uninstall');
208
 
209
  // For Debugging purposes ...
210
+ /*
211
  if (WP_DEBUG && isset($_GET['uninstall']) && $_GET['uninstall'] == 'asdf') {
212
 
213
  add_action('plugins_loaded', function() {
214
  on_uninstall();
215
  });
216
  }
217
+ */
readme.txt CHANGED
@@ -115,6 +115,9 @@ Or maybe you are using a site cache plugin. Then enable the option `Disable cach
115
 
116
  == Upgrade Notice ==
117
 
 
 
 
118
  = 3.2.0 =
119
 
120
  This plugin version simplifies complying the the EULA of Maxmind by automatically retrieving and honoring their Privacy Exclusion List.
@@ -166,6 +169,9 @@ New: Shortcode for showing/hiding content!
166
 
167
  == Changelog ==
168
 
 
 
 
169
  = 3.2.0 =
170
  * 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.
171
  * FIX: If timeZone is unknown, leave empty value instead of NULL
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.
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
+
175
  = 3.2.0 =
176
  * 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.
177
  * FIX: If timeZone is unknown, leave empty value instead of NULL