GeoIP Detection - Version 4.2.3

Version Description

  • FIX: Further improve the Maxmind admin notice UI
  • Update some smaller libraries
Download this release

Release Info

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

Code changes from version 4.2.2 to 4.2.3

check_compatibility.php CHANGED
@@ -82,11 +82,8 @@ class Maxmind {
82
  }
83
 
84
  function checkCompatible() {
85
- if (empty($_GET['page'])) {
86
- return;
87
- }
88
-
89
- if ($_GET['page'] !== 'geoip-detect/geoip-detect.php') {
90
  return;
91
  }
92
 
@@ -105,7 +102,7 @@ class Maxmind {
105
  BODY;
106
  $this->adminNotices[] = [
107
  'id' => 'maxmind_vendor_old_' . md5($data),
108
- 'title' => __('Geolocation IP Detection: Error: Old Maxmind Libraries detected.', 'geoip-detect'),
109
  'body' => $body,
110
  ];
111
  add_action( 'all_admin_notices', [$this, 'admin_notice'] );
@@ -116,7 +113,7 @@ BODY;
116
 
117
  function admin_notice() {
118
  foreach ($this->adminNotices as $notice) {
119
- geoip_detect_admin_notice_template($notice['id'], $notice['title'], $notice['body']);
120
  }
121
  }
122
  }
82
  }
83
 
84
  function checkCompatible() {
85
+ // Only show on plugin pages
86
+ if (empty($_GET['page']) || $_GET['page'] !== 'geoip-detect/geoip-detect.php') {
 
 
 
87
  return;
88
  }
89
 
102
  BODY;
103
  $this->adminNotices[] = [
104
  'id' => 'maxmind_vendor_old_' . md5($data),
105
+ 'title' => __('Geolocation IP Detection: Warning: Old Maxmind Libraries detected.', 'geoip-detect'),
106
  'body' => $body,
107
  ];
108
  add_action( 'all_admin_notices', [$this, 'admin_notice'] );
113
 
114
  function admin_notice() {
115
  foreach ($this->adminNotices as $notice) {
116
+ geoip_detect_admin_notice_template($notice['id'], $notice['title'], $notice['body'], true);
117
  }
118
  }
119
  }
composer.json CHANGED
@@ -22,8 +22,8 @@
22
  },
23
  "require-dev": {
24
  "phpunit/phpunit": "7.5.20",
25
- "roots/wordpress": "5.7.1",
26
- "wp-phpunit/wp-phpunit": "5.7.1"
27
  },
28
  "scripts": {
29
  "test": "phpunit"
22
  },
23
  "require-dev": {
24
  "phpunit/phpunit": "7.5.20",
25
+ "roots/wordpress": "5.8",
26
+ "wp-phpunit/wp-phpunit": "5.7.2"
27
  },
28
  "scripts": {
29
  "test": "phpunit"
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: 4.2.2
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: 5.0
16
  Requires PHP: 7.2.5
17
  */
18
 
19
- define('GEOIP_DETECT_VERSION', '4.2.2');
20
 
21
  /*
22
  Copyright 2013-2021 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: 4.2.3
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: 7.2.5
17
  */
18
 
19
+ define('GEOIP_DETECT_VERSION', '4.2.3');
20
 
21
  /*
22
  Copyright 2013-2021 Yellow Tree, Siegen, Germany
init.php CHANGED
@@ -79,7 +79,7 @@ function geoip_detect_is_ignored_notice($id) {
79
  return false;
80
  }
81
 
82
- function geoip_detect_admin_notice_template($id, $title, $body) {
83
  if (geoip_detect_is_ignored_notice($id))
84
  return;
85
  ?>
@@ -91,6 +91,11 @@ function geoip_detect_admin_notice_template($id, $title, $body) {
91
  <h3><?php echo $title; ?></h3>
92
 
93
  <?php echo $body; ?>
 
 
 
 
 
94
  </div>
95
  <?php
96
  }
79
  return false;
80
  }
81
 
82
+ function geoip_detect_admin_notice_template($id, $title, $body, $addButtonDismiss = false) {
83
  if (geoip_detect_is_ignored_notice($id))
84
  return;
85
  ?>
91
  <h3><?php echo $title; ?></h3>
92
 
93
  <?php echo $body; ?>
94
+ <?php if ($addButtonDismiss) : ?>
95
+ <p>
96
+ <a class="button button-secondary" href="?geoip_detect_dismiss_notice=<?= $id ?>">Hide this notice</a>
97
+ </p>
98
+ <?php endif; ?>
99
  </div>
100
  <?php
101
  }
js/body_classes.test.js CHANGED
@@ -1,8 +1,11 @@
 
 
 
 
1
  import { getTestRecord, getTestRecordError } from "./test-lib/test-records";
2
  import { calc_classes } from "./body_classes";
3
  import Record from "./models/record";
4
 
5
-
6
  const emptyRecord = new Record();
7
  const defaultRecord = getTestRecord();
8
  const errorRecord = getTestRecordError();
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
  import { getTestRecord, getTestRecordError } from "./test-lib/test-records";
6
  import { calc_classes } from "./body_classes";
7
  import Record from "./models/record";
8
 
 
9
  const emptyRecord = new Record();
10
  const defaultRecord = getTestRecord();
11
  const errorRecord = getTestRecordError();
js/lookup.test.js CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  import { set_override, get_info } from "./lookup";
2
  import { getTestRecord } from "./test-lib/test-records";
3
  import Record from "./models/record";
@@ -5,7 +9,6 @@ import Record from "./models/record";
5
  const defaultRecord = getTestRecord();
6
  const emptyRecord = new Record();
7
 
8
-
9
  test('override', async () => {
10
  let record;
11
 
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
  import { set_override, get_info } from "./lookup";
6
  import { getTestRecord } from "./test-lib/test-records";
7
  import Record from "./models/record";
9
  const defaultRecord = getTestRecord();
10
  const emptyRecord = new Record();
11
 
 
12
  test('override', async () => {
13
  let record;
14
 
js/shortcodes/show-if.test.js CHANGED
@@ -1,9 +1,12 @@
 
 
 
 
1
  const { getTestRecordError, getTestRecord } = require("../test-lib/test-records");
2
  import { geoip_detect2_shortcode_evaluate_conditions } from './show-if';
3
 
4
  const testFixture = require('../../tests/fixture_shortcode_show_if.json');
5
 
6
-
7
  test.each(testFixture)('Show if Test #%d: %s', (nb, input, expected, parsed, opt) => {
8
  const record = getTestRecord(opt.lang);
9
  const result = geoip_detect2_shortcode_evaluate_conditions(parsed, opt, record);
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
  const { getTestRecordError, getTestRecord } = require("../test-lib/test-records");
6
  import { geoip_detect2_shortcode_evaluate_conditions } from './show-if';
7
 
8
  const testFixture = require('../../tests/fixture_shortcode_show_if.json');
9
 
 
10
  test.each(testFixture)('Show if Test #%d: %s', (nb, input, expected, parsed, opt) => {
11
  const record = getTestRecord(opt.lang);
12
  const result = geoip_detect2_shortcode_evaluate_conditions(parsed, opt, record);
package.json CHANGED
@@ -23,10 +23,10 @@
23
  "@babel/core": "7.13.8",
24
  "@babel/plugin-transform-runtime": "7.13.9",
25
  "@babel/preset-env": "7.13.9",
26
- "babel-jest": "26.6.3",
27
  "babel-plugin-transform-class-properties": "6.24.1",
28
- "eslint": "7.25.0",
29
- "jest": "26.6.3",
30
  "parcel-bundler": "1.12.5",
31
  "parcel-plugin-assets-list": "1.7.1"
32
  }
23
  "@babel/core": "7.13.8",
24
  "@babel/plugin-transform-runtime": "7.13.9",
25
  "@babel/preset-env": "7.13.9",
26
+ "babel-jest": "27.0.6",
27
  "babel-plugin-transform-class-properties": "6.24.1",
28
+ "eslint": "7.31.0",
29
+ "jest": "27.0.6",
30
  "parcel-bundler": "1.12.5",
31
  "parcel-plugin-assets-list": "1.7.1"
32
  }
readme.txt CHANGED
@@ -165,6 +165,10 @@ If you use Maxmind "Automatic download" then you need to upgrade to this plugin
165
 
166
  == Changelog ==
167
 
 
 
 
 
168
  = 4.2.2 =
169
  * FIX: Show Maxmind admin notice only on GeoIP pages to make it less intrusive
170
 
165
 
166
  == Changelog ==
167
 
168
+ = 4.2.3 =
169
+ * FIX: Further improve the Maxmind admin notice UI
170
+ * Update some smaller libraries
171
+
172
  = 4.2.2 =
173
  * FIX: Show Maxmind admin notice only on GeoIP pages to make it less intrusive
174