iQ Block Country - Version 1.1.38

Version Description

  • Bugfix: Only shows warning of incompatible caching plugin if frontend blocking is on.
  • Change: Better error handling
Download this release

Release Info

Developer iqpascal
Plugin Icon 128x128 iQ Block Country
Version 1.1.38
Comparing to
See all releases

Code changes from version 1.1.37 to 1.1.38

iq-block-country.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: https://www.webence.nl/plugins/iq-block-country-the-wordpress-plugin-that-blocks-countries-for-you/
5
- Version: 1.1.37
6
  Author: Pascal
7
  Author URI: https://www.webence.nl/
8
  Description: Block visitors from visiting your website and backend website based on which country their IP address is from. The Maxmind GeoIP lite database is used for looking up from which country an ip address is from.
2
  /*
3
  Plugin Name: iQ Block Country
4
  Plugin URI: https://www.webence.nl/plugins/iq-block-country-the-wordpress-plugin-that-blocks-countries-for-you/
5
+ Version: 1.1.38
6
  Author: Pascal
7
  Author URI: https://www.webence.nl/
8
  Description: Block visitors from visiting your website and backend website based on which country their IP address is from. The Maxmind GeoIP lite database is used for looking up from which country an ip address is from.
libs/blockcountry-checks.php CHANGED
@@ -70,7 +70,10 @@ function iqblockcountry_retrieve_geoipapi($ipaddress)
70
  )
71
  )
72
  );
73
- if ( 200 == $result['response']['code'] ) {
 
 
 
74
  $body = $result['body'];
75
  $xml = new SimpleXmlElement($body);
76
  if (isset($xml->country)) { return (string) $xml->country; }
@@ -449,6 +452,11 @@ function iqblockcountry_is_caching_active() {
449
  $found = TRUE;
450
  }
451
 
 
 
 
 
 
452
  return $found;
453
  }
454
 
70
  )
71
  )
72
  );
73
+ if ( is_wp_error( $result ) ) {
74
+ return "Unknown";
75
+ }
76
+ elseif ( 200 == $result['response']['code'] ) {
77
  $body = $result['body'];
78
  $xml = new SimpleXmlElement($body);
79
  if (isset($xml->country)) { return (string) $xml->country; }
452
  $found = TRUE;
453
  }
454
 
455
+ if (get_option('blockcountry_blockfrontend') == FALSE)
456
+ {
457
+ $found = FALSE;
458
+ }
459
+
460
  return $found;
461
  }
462
 
libs/blockcountry-tracking.php CHANGED
@@ -80,7 +80,10 @@ function iqblockcountry_tracking_retrieve_xml()
80
  )
81
  );
82
 
83
- if ( 200 == $result['response']['code'] ) {
 
 
 
84
  $body = $result['body'];
85
  $xml = new SimpleXmlElement($body);
86
  $banlist = array();
80
  )
81
  );
82
 
83
+ if ( is_wp_error( $result ) ) {
84
+ return FALSE;
85
+ }
86
+ elseif ( 200 == $result['response']['code'] ) {
87
  $body = $result['body'];
88
  $xml = new SimpleXmlElement($body);
89
  $banlist = array();
libs/blockcountry-validation.php CHANGED
@@ -90,7 +90,11 @@ function iqblockcountry_check_geoapikey($input)
90
  );
91
  $message = "";
92
  $type = "updated";
93
- if ( 200 == $result['response']['code'] ) {
 
 
 
 
94
  $body = $result['body'];
95
  $xml = new SimpleXmlElement($body);
96
  if ($xml->check != "Ok")
@@ -137,7 +141,10 @@ function iqblockcountry_check_adminapikey($input)
137
  );
138
  $message = "";
139
  $type = "updated";
140
- if ( 200 == $result['response']['code'] ) {
 
 
 
141
  $body = $result['body'];
142
  $xml = new SimpleXmlElement($body);
143
  if ($xml->check != "Ok")
@@ -182,8 +189,11 @@ function iqblockcountry_get_licensedate_geoapikey($apikey)
182
  'api-key' => $apikey
183
  )
184
  )
185
- );
186
- if ( 200 == $result['response']['code'] ) {
 
 
 
187
  $body = $result['body'];
188
  $xml = new SimpleXmlElement($body);
189
  if ($xml->check == "Ok")
90
  );
91
  $message = "";
92
  $type = "updated";
93
+ if ( is_wp_error( $result ) ) {
94
+ return FALSE;
95
+ }
96
+
97
+ elseif ( 200 == $result['response']['code'] ) {
98
  $body = $result['body'];
99
  $xml = new SimpleXmlElement($body);
100
  if ($xml->check != "Ok")
141
  );
142
  $message = "";
143
  $type = "updated";
144
+ if ( is_wp_error( $result ) ) {
145
+ return FALSE;
146
+ }
147
+ elseif ( 200 == $result['response']['code'] ) {
148
  $body = $result['body'];
149
  $xml = new SimpleXmlElement($body);
150
  if ($xml->check != "Ok")
189
  'api-key' => $apikey
190
  )
191
  )
192
+ );
193
+ if ( is_wp_error( $result ) ) {
194
+ return "";
195
+ }
196
+ elseif ( 200 == $result['response']['code'] ) {
197
  $body = $result['body'];
198
  $xml = new SimpleXmlElement($body);
199
  if ($xml->check == "Ok")
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.webence.nl/plugins/donate
4
  Tags: spam, block, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, blacklist, whitelist, security
5
  Requires at least: 3.5.2
6
  Tested up to: 4.6.1
7
- Stable tag: 1.1.37
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -40,6 +40,8 @@ If you cannot or do not want to download the GeoIP database from Maxmind you can
40
  If you want to use the GeoLite database from Maxmind you will have to download the GeoIP database from MaxMind directly and upload it to your site.
41
  The Wordpress license does not allow this plugin to download the MaxMind Geo database for you.
42
 
 
 
43
  = Using this plugin with a caching plugin =
44
 
45
  Please note that many of the caching plugins are not compatible with this plugin. The nature of caching is that a dynamically build web page is cached into a static page.
@@ -213,6 +215,11 @@ As the basic rule is to block all and every post you have to configure this in a
213
 
214
  == Changelog ==
215
 
 
 
 
 
 
216
  = 1.1.37 =
217
 
218
  * Change: Small adjustment to prevent wp_mail declaration as much as possible.
4
  Tags: spam, block, country, comments, ban, geo, geo blocking, geo ip, block country, block countries, ban countries, ban country, blacklist, whitelist, security
5
  Requires at least: 3.5.2
6
  Tested up to: 4.6.1
7
+ Stable tag: 1.1.38
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
40
  If you want to use the GeoLite database from Maxmind you will have to download the GeoIP database from MaxMind directly and upload it to your site.
41
  The Wordpress license does not allow this plugin to download the MaxMind Geo database for you.
42
 
43
+ Do you need help with this plugin? Please email support@webence.nl or use the WordPress forums.
44
+
45
  = Using this plugin with a caching plugin =
46
 
47
  Please note that many of the caching plugins are not compatible with this plugin. The nature of caching is that a dynamically build web page is cached into a static page.
215
 
216
  == Changelog ==
217
 
218
+ = 1.1.38 =
219
+
220
+ * Bugfix: Only shows warning of incompatible caching plugin if frontend blocking is on.
221
+ * Change: Better error handling
222
+
223
  = 1.1.37 =
224
 
225
  * Change: Small adjustment to prevent wp_mail declaration as much as possible.