IP Geo Block - Version 3.0.11

Version Description

  • Improvement: To comply with GDPR, IP address in logs/cache will be always encrypted. The option of "Anonymize IP address" was renamed to "Privacy friendly" in "Privacy and record settings". It will not only anonymize an IP address but also will restrict on sending to the 3rd parties such as geolocation APIs and whois service.
  • Improvement: Update geolocation APIs and add a new one.
  • Improvement: Change the JavaScript compressor from Google Closure Compiler to UglifyJS 2 to prevent "Uncaught TypeError: Cannot read property toLowerCase of undefined" in a certain environment.
  • Fix: Fix the issue that blocking occurred immediately instead of displaying the login page again when login failed, even the number of times did not exceed the limit.
  • See 3.0.11 release note for some details.
Download this release

Release Info

Developer tokkonopapa
Plugin Icon 128x128 IP Geo Block
Version 3.0.11
Comparing to
See all releases

Code changes from version 3.0.10.4 to 3.0.11

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
Tags: security, firewall, brute force, vulnerability, login, wp-admin, admin, ajax, xmlrpc, comment, pingback, trackback, spam, IP address, geo, geolocation, buddypress, bbPress
5
Requires at least: 3.7
6
Tested up to: 4.9.5
7
- Stable tag: 3.0.10.4
8
License: GPLv3
9
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10
@@ -14,12 +14,15 @@ It blocks spam posts, login attempts and malicious access to the back-end reques
14
15
A considerable number of WordPress vulnerabilities in plugins and themes have been disclosed every month on a site like [WPScan Vulnerability Database](https://wpvulndb.com/ "WPScan Vulnerability Database") and [Exploits Database](https://www.exploit-db.com/ "Exploits Database by Offensive Security"). It means that we're always exposed to the threats of being exploited caused by them.
16
17
- This plugin guards your site against threats of attack to back-end of your site such as login form, XML-RPC (login attempt) and admin area. It also blocks undesired comment spam, trackback and pingback spam and any requests to public facing pages aka front-end from undesired countries.
18
19
After several days of installation, you'll be supprised to find many malicious or undesirable accesses are blocked especially if you enable Zero-day Expoit Prevention.
20
21
= Features =
22
23
* **Immigration control:**
24
Access to the basic and important entrances into back-end such as `wp-comments-post.php`, `xmlrpc.php`, `wp-login.php`, `wp-signup.php`, `wp-admin/admin.php`, `wp-admin/admin-ajax.php`, `wp-admin/admin-post.php` will be validated by means of a country code based on IP address. It allows you to configure either whitelist or blacklist to [specify the countires](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia"), [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia") for a range of IP addresses and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") for a group of IP networks.
25
@@ -46,17 +49,17 @@ After several days of installation, you'll be supprised to find many malicious o
46
47
* **Multiple source of IP Geolocation databases:**
48
[MaxMind GeoLite2 free databases](http://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+) and [IP2Location LITE databases](http://www.ip2location.com/ "IP Address Geolocation to Identify Website Visitor's Geographical Location") can be installed in this plugin. Also free Geolocation REST APIs and whois information can be available for audit purposes.
49
- Father more, if you use CloudFlare or CloudFront as a reverse proxy service, you can install the [dedicated API class libraries](http://www.ipgeoblock.com/article/api-class-library.html "CloudFlare & CloudFront API class library | IP Geo Block") for these services.
50
51
* **Customizing response:**
52
HTTP response code can be selectable as `403 Forbidden` to deny access pages, `404 Not Found` to hide pages or even `200 OK` to redirect to the top page.
53
- You can also have a human friendly page (like `404.php`) in your theme template directory or child theme directory to fit your theme.
54
55
* **Validation logs:**
56
- Validation logs can be recorded with useful information to audit attack patterns.
57
58
* **Cooperation with full spec security plugin:**
59
- This plugin is simple and lite enough to be able to cooperate with other full spec security plugin such as [Wordfence Security](https://wordpress.org/plugins/wordfence/ "Wordfence Security — WordPress Plugins"). See [this report](http://www.ipgeoblock.com/codex/page-speed-performance.html "Page speed performance | IP Geo Block") about page speed performance.
60
61
* **Extendability:**
62
You can customize the behavior of this plugin via `add_filter()` with [pre-defined filter hook](http://www.ipgeoblock.com/codex/ "Codex | IP Geo Block"). See various use cases in [samples.php](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/blob/master/ip-geo-block/samples.php "WordPress-IP-Geo-Block/samples.php at master - tokkonopapa/WordPress-IP-Geo-Block - GitHub") bundled within this package.
@@ -74,13 +77,13 @@ This package includes GeoLite2 library distributed by MaxMind, available from [M
74
75
Also thanks for providing the following great services and REST APIs for free.
76
77
- * [http://freegeoip.net/](http://freegeoip.net/ "freegeoip.net: FREE IP Geolocation Web Service") (IPv4 / free)
78
- * [http://ipinfo.io/](http://ipinfo.io/ "ipinfo.io - ip address information including geolocation, hostname and network details") (IPv4, IPv6 / free)
79
* [http://geoip.nekudo.com/](http://geoip.nekudo.com/ "Free IP GeoLocation/GeoIp API - geoip.nekudo.com") (IPv4, IPv6 / free)
80
- * [http://xhanch.com/](http://xhanch.com/xhanch-api-ip-get-detail/ "Xhanch API – IP Get Detail | Xhanch Studio") (IPv4 / free)
81
* [http://geoiplookup.net/](http://geoiplookup.net/ "What Is My IP Address | GeoIP Lookup") (IPv4, IPv6 / free)
82
* [http://ip-api.com/](http://ip-api.com/ "IP-API.com - Free Geolocation API") (IPv4, IPv6 / free for non-commercial use)
83
- * [http://ipinfodb.com/](http://ipinfodb.com/ "IPInfoDB | Free IP Address Geolocation Tools") (IPv4, IPv6 / free for registered user, need API key)
84
85
= Development =
86
@@ -96,7 +99,7 @@ All contributions will always be welcome. Or visit my [development blog](http://
96
2. Search for 'IP Geo Block'
97
3. Click 'Install Now'
98
4. Activate the plugin on the Plugin dashboard
99
- 5. Try 'Best settings' button for easy setup at the bottom of this plugin's setting page.
100
101
Please refer to [the document](http://www.ipgeoblock.com/codex/ "Codex | IP Geo Block")
102
or following descriptions for your best setup.
@@ -106,16 +109,16 @@ or following descriptions for your best setup.
106
* **Matching rule**
107
Choose either `White list` (recommended) or `Black list` to specify the countries from which you want to pass or block.
108
109
- * **Country code for matching rule**
110
Specify the country code with two letters (see [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia")). Each of them should be separated by comma.
111
112
- * **White/Black list of extra IPs for prior validation**
113
- The list of extra IP addresses prior to the validation of country code. [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia, the free encyclopedia") and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") are also acceptable to specify the range.
114
-
115
* **Use Autonomous System Number (ASN)**
116
It enables you to use "AS number" in the whitelist and blacklist of extra IP addresses to specify a group of IP networks.
117
118
- * **$_SERVER keys for extra IPs**
119
Additional IP addresses will be validated if some of keys in `$_SERVER` variable are specified in this textfield. Typically `HTTP_X_FORWARDED_FOR`.
120
121
* **Bad signatures in query**
@@ -128,6 +131,9 @@ or following descriptions for your best setup.
128
Choose one of the [response code](http://tools.ietf.org/html/rfc2616#section-10 "RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1") to be sent when it blocks a comment.
129
The 2xx code will lead to your top page, the 3xx code will redirect to [Black Hole Server](http://blackhole.webpagetest.org/), the 4xx code will lead to WordPress error page, and the 5xx will pretend an server error.
130
131
* **Validation timing**
132
Choose **"init" action hook** or **"mu-plugins" (ip-geo-block-mu.php)** to specify the timing of validation.
133
@@ -165,6 +171,9 @@ or following descriptions for your best setup.
165
* **Validation target**
166
Specify the single and archive page by post type, category and tag as blocking target.
167
168
* **UA string and qualification**
169
Additional rules targeted at SEO which can specify acceptable requests based on user agent.
170
@@ -184,26 +193,30 @@ or following descriptions for your best setup.
184
* **Auto updating (once a month)**
185
If `Enable`, geolocation databases will be downloaded automatically by WordPress cron job.
186
187
- = Record settings =
188
189
- * **Record validation statistics**
190
If `Enable`, you can see `Statistics of validation` on Statistics tab.
191
192
- * **Record validation logs**
193
If you choose anything but `Disable`, you can see `Validation logs` on Logs tab.
194
195
- * **$_POST keys in logs**
196
Normally, you can see just keys at `$_POST data:` on Logs tab. If you put some of interested keys into this textfield, you can see the value of key like `key=value`.
197
198
- * **Anonymize IP address**
199
- It will mask the last three digits of IP address when it is recorded into the log.
200
-
201
- = Cache settings =
202
203
- * **Expiration time [sec]**
204
Maximum time in sec to keep cache.
205
206
- * **Garbage collection period [sec]**
207
Period of garbage collection to clean cache.
208
209
= Submission settings =
@@ -213,12 +226,25 @@ or following descriptions for your best setup.
213
214
= Plugin settings =
215
216
- * **Remove settings at uninstallation**
217
If you checked this option, all settings will be removed when this plugin is uninstalled for clean uninstalling.
218
219
== Frequently Asked Questions ==
220
221
- = Does it support multisite? =
222
223
It works on multisite, but there's no network setting at this moment.
224
@@ -356,6 +382,13 @@ Please refer to "[How can I fix permission troubles?](http://www.ipgeoblock.com/
356
357
== Changelog ==
358
359
= 3.0.10.4 =
360
* **Fix:** JavaScript error caused by bad handling form tag without method property. This error was happened with Wordfence Live Traffic.
361
* **Fix:** Inconsistent tags on the settings dashboard.
4
Tags: security, firewall, brute force, vulnerability, login, wp-admin, admin, ajax, xmlrpc, comment, pingback, trackback, spam, IP address, geo, geolocation, buddypress, bbPress
5
Requires at least: 3.7
6
Tested up to: 4.9.5
7
+ Stable tag: 3.0.11
8
License: GPLv3
9
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10
14
15
A considerable number of WordPress vulnerabilities in plugins and themes have been disclosed every month on a site like [WPScan Vulnerability Database](https://wpvulndb.com/ "WPScan Vulnerability Database") and [Exploits Database](https://www.exploit-db.com/ "Exploits Database by Offensive Security"). It means that we're always exposed to the threats of being exploited caused by them.
16
17
+ This plugin guards your site against threats of attack to the back-end of your site such as login form, XML-RPC (login attempt) and admin area. It also blocks undesired comment spam, trackback and pingback spam and any requests to public facing pages aka front-end from undesired countries.
18
19
After several days of installation, you'll be supprised to find many malicious or undesirable accesses are blocked especially if you enable Zero-day Expoit Prevention.
20
21
= Features =
22
23
+ * **Privacy friendly:**
24
+ IP address is always encrypted on recording in logs/cache. Moreover, it can be anonymized and restricted on sending to the 3rd parties such as geolocation APIs or whois service.
25
+
26
* **Immigration control:**
27
Access to the basic and important entrances into back-end such as `wp-comments-post.php`, `xmlrpc.php`, `wp-login.php`, `wp-signup.php`, `wp-admin/admin.php`, `wp-admin/admin-ajax.php`, `wp-admin/admin-post.php` will be validated by means of a country code based on IP address. It allows you to configure either whitelist or blacklist to [specify the countires](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia"), [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia") for a range of IP addresses and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") for a group of IP networks.
28
49
50
* **Multiple source of IP Geolocation databases:**
51
[MaxMind GeoLite2 free databases](http://www.maxmind.com "MaxMind - IP Geolocation and Online Fraud Prevention") (it requires PHP 5.4.0+) and [IP2Location LITE databases](http://www.ip2location.com/ "IP Address Geolocation to Identify Website Visitor's Geographical Location") can be installed in this plugin. Also free Geolocation REST APIs and whois information can be available for audit purposes.
52
+ Father more, [dedicated API class libraries](http://www.ipgeoblock.com/article/api-class-library.html "CloudFlare & CloudFront API class library | IP Geo Block") can be installed for CloudFlare and CloudFront as a reverse proxy service.
53
54
* **Customizing response:**
55
HTTP response code can be selectable as `403 Forbidden` to deny access pages, `404 Not Found` to hide pages or even `200 OK` to redirect to the top page.
56
+ You can also have a human friendly page (like `404.php`) in your parent/child theme template directory to fit your site design.
57
58
* **Validation logs:**
59
+ Validation logs for useful information to audit attack patterns can be manageable.
60
61
* **Cooperation with full spec security plugin:**
62
+ This plugin is lite enough to be able to cooperate with other full spec security plugin such as [Wordfence Security](https://wordpress.org/plugins/wordfence/ "Wordfence Security — WordPress Plugins"). See [this report](http://www.ipgeoblock.com/codex/page-speed-performance.html "Page speed performance | IP Geo Block") about page speed performance.
63
64
* **Extendability:**
65
You can customize the behavior of this plugin via `add_filter()` with [pre-defined filter hook](http://www.ipgeoblock.com/codex/ "Codex | IP Geo Block"). See various use cases in [samples.php](https://github.com/tokkonopapa/WordPress-IP-Geo-Block/blob/master/ip-geo-block/samples.php "WordPress-IP-Geo-Block/samples.php at master - tokkonopapa/WordPress-IP-Geo-Block - GitHub") bundled within this package.
77
78
Also thanks for providing the following great services and REST APIs for free.
79
80
+ * [https://ipdata.co/](https://ipdata.co/ "ipdata.co - IP Geolocation and Threat Data API") (IPv4, IPv6 / free)
81
+ * [https://ipinfo.io/](https://ipinfo.io/ "IP Address API and Data Solutions") (IPv4, IPv6 / free)
82
* [http://geoip.nekudo.com/](http://geoip.nekudo.com/ "Free IP GeoLocation/GeoIp API - geoip.nekudo.com") (IPv4, IPv6 / free)
83
* [http://geoiplookup.net/](http://geoiplookup.net/ "What Is My IP Address | GeoIP Lookup") (IPv4, IPv6 / free)
84
* [http://ip-api.com/](http://ip-api.com/ "IP-API.com - Free Geolocation API") (IPv4, IPv6 / free for non-commercial use)
85
+ * [https://ipinfodb.com/](https://ipinfodb.com/ "Free IP Geolocation Tools and API| IPInfoDB") (IPv4, IPv6 / free for registered user, need API key)
86
+ * [https://ipstack.com/](https://ipstack.com/ "ipstack - Free IP Geolocation API") (IPv4, IPv6 / free for registered user, need API key)
87
88
= Development =
89
99
2. Search for 'IP Geo Block'
100
3. Click 'Install Now'
101
4. Activate the plugin on the Plugin dashboard
102
+ 5. Try 'Best for Back-end' button for easy setup at the bottom of this plugin's setting page.
103
104
Please refer to [the document](http://www.ipgeoblock.com/codex/ "Codex | IP Geo Block")
105
or following descriptions for your best setup.
109
* **Matching rule**
110
Choose either `White list` (recommended) or `Black list` to specify the countries from which you want to pass or block.
111
112
+ * **Whitelist/Blacklist of country code**
113
Specify the country code with two letters (see [ISO 3166-1 alpha-2](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements "ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia")). Each of them should be separated by comma.
114
115
* **Use Autonomous System Number (ASN)**
116
It enables you to use "AS number" in the whitelist and blacklist of extra IP addresses to specify a group of IP networks.
117
118
+ * **Whitelist/Blacklist of extra IP addresses prior to country code**
119
+ The list of extra IP addresses prior to the validation of country code. [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing "Classless Inter-Domain Routing - Wikipedia, the free encyclopedia") and [AS number](https://en.wikipedia.org/wiki/Autonomous_system_(Internet) "Autonomous system (Internet) - Wikipedia") are also acceptable to specify the range.
120
+
121
+ * **$_SERVER keys to retrieve extra IP addresses**
122
Additional IP addresses will be validated if some of keys in `$_SERVER` variable are specified in this textfield. Typically `HTTP_X_FORWARDED_FOR`.
123
124
* **Bad signatures in query**
131
Choose one of the [response code](http://tools.ietf.org/html/rfc2616#section-10 "RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1") to be sent when it blocks a comment.
132
The 2xx code will lead to your top page, the 3xx code will redirect to [Black Hole Server](http://blackhole.webpagetest.org/), the 4xx code will lead to WordPress error page, and the 5xx will pretend an server error.
133
134
+ * **Max number of failed login attempts per IP address**
135
+ Set the maximum number of login attempts to accept the requests to the login process.
136
+
137
* **Validation timing**
138
Choose **"init" action hook** or **"mu-plugins" (ip-geo-block-mu.php)** to specify the timing of validation.
139
171
* **Validation target**
172
Specify the single and archive page by post type, category and tag as blocking target.
173
174
+ * **Block badly-behaved bots and crawlers**
175
+ Specify the allowable request frequency over a period of time.
176
+
177
* **UA string and qualification**
178
Additional rules targeted at SEO which can specify acceptable requests based on user agent.
179
193
* **Auto updating (once a month)**
194
If `Enable`, geolocation databases will be downloaded automatically by WordPress cron job.
195
196
+ * **Download database**
197
+ Fetch all the databases from their server if those are updated.
198
+
199
+ = Privacy and record settings =
200
201
+ * **Privacy friendly**
202
+ It makes an IP address anonymous on recording into the database (e.g. logs, IP address cache) and restricted on sending to the 3rd parties (e.g. geolocation APIs, whois).
203
+
204
+ * **Record "Statistics"**
205
If `Enable`, you can see `Statistics of validation` on Statistics tab.
206
207
+ * **Record "Logs"**
208
If you choose anything but `Disable`, you can see `Validation logs` on Logs tab.
209
210
+ * **$_POST keys to be recorded with their values in "Logs"**
211
Normally, you can see just keys at `$_POST data:` on Logs tab. If you put some of interested keys into this textfield, you can see the value of key like `key=value`.
212
213
+ * **Record "IP address cache"**
214
+ It enables to record the pare of IP address and country code into the cache on database to minimize the impact on site speed.
215
216
+ * **Expiration time [sec] for IP address cache**
217
Maximum time in sec to keep cache.
218
219
+ * **Garbage collection period [sec] for IP address cache**
220
Period of garbage collection to clean cache.
221
222
= Submission settings =
226
227
= Plugin settings =
228
229
+ * **Network wide settings**
230
+ Synchronize all settings over the network wide based on the settings of main blog.
231
+
232
+ * **Remove all settings at uninstallation**
233
If you checked this option, all settings will be removed when this plugin is uninstalled for clean uninstalling.
234
235
+ * **Export / Import settings**
236
+ All settings data can be saved as json file which enables to export/import to the dashboard.
237
+
238
+ * **Import pre-defined settings**
239
+ Reset all settings data as initial values, or set as recommended values for "Back-end target settings".
240
+
241
== Frequently Asked Questions ==
242
243
+ = Does the site using this plugin comply with GDPR? =
244
+
245
+ Using this plugin itself should not be the problem, because from version 3.0.11 IP addresses in logs and cache of this plugin are encrypted by default in preparation for personal data breach. It also not only provides a way to manually erase them but also has the functionality to remove them when those are exceeded a certain amount/time. The option "Plivacy friendly" helps you to restrict sending the ip address to the 3rd parties such as geolocaiton APIs and whois service equiped in this plugin. However, these functions are part of the requirements that GDPR requires and do not guarantee that the site is compliant with GDPR. Refer to [3.0.11 release note](http://www.ipgeoblock.com/changelog/release-3.0.11.html) for details.
246
+
247
+ = Does this plugin support multisite? =
248
249
It works on multisite, but there's no network setting at this moment.
250
382
383
== Changelog ==
384
385
+ = 3.0.11 =
386
+ * **Improvement:** To comply with GDPR, IP address in logs/cache will be always encrypted. The option of "**Anonymize IP address**" was renamed to "**Privacy friendly**" in "**Privacy and record settings**". It will not only anonymize an IP address but also will restrict on sending to the 3rd parties such as geolocation APIs and whois service.
387
+ * **Improvement:** Update geolocation APIs and add a new one.
388
+ * **Improvement:** Change the JavaScript compressor from Google Closure Compiler to UglifyJS 2 to prevent "Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined" in a certain environment.
389
+ * **Fix:** Fix the issue that blocking occurred immediately instead of displaying the login page again when login failed, even the number of times did not exceed the limit.
390
+ * See [3.0.11 release note](http://www.ipgeoblock.com/changelog/release-3.0.11.html) for some details.
391
+
392
= 3.0.10.4 =
393
* **Fix:** JavaScript error caused by bad handling form tag without method property. This error was happened with Wordfence Live Traffic.
394
* **Fix:** Inconsistent tags on the settings dashboard.
admin/class-ip-geo-block-admin.php CHANGED
@@ -8,7 +8,7 @@
8
* @link http://www.ipgeoblock.com/
9
* @copyright 2013-2018 tokkonopapa
10
*/
11
-
12
class IP_Geo_Block_Admin {
13
14
/**
@@ -66,7 +66,7 @@ class IP_Geo_Block_Admin {
66
67
if ( is_multisite() ) {
68
require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
69
- $this->is_network = is_plugin_active_for_network( IP_GEO_BLOCK_BASE );
70
71
add_action( 'network_admin_menu', array( $this, 'setup_admin_page' ) );
72
add_action( 'wpmu_new_blog', array( $this, 'create_blog' ), 10, 6 ); // on creating a new blog @since MU
@@ -333,9 +333,9 @@ class IP_Geo_Block_Admin {
333
*
334
*/
335
public function add_action_links( $links ) {
336
- // over network
337
return array_merge(
338
- array( 'settings' => '<a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME ), $this->dashboard_url( $this->is_network ) ) ) . '">' . __( 'Settings' ) . '</a>' ),
339
$links
340
);
341
}
@@ -395,14 +395,13 @@ class IP_Geo_Block_Admin {
395
396
// Network wide or not
397
$admin_menu = ( 'admin_menu' === current_filter() ); // @since: 2.5 `admin_menu` or `network_admin_menu`
398
- $this->is_network &= ( current_user_can( 'manage_network_options' ) && $settings['network_wide'] );
399
400
// Verify tab number
401
if ( $this->is_network ) {
402
if ( $admin_menu ) {
403
- $this->admin_tab = min( 4, max( 1, $this->admin_tab ) );
404
- } elseif ( ! in_array( $this->admin_tab, array( 0, 5 ), TRUE ) ) {
405
- $this->admin_tab = 0;
406
}
407
} else {
408
$this->admin_tab = min( 4, $this->admin_tab ); // exclude `Site List`
@@ -410,7 +409,7 @@ class IP_Geo_Block_Admin {
410
411
if ( $admin_menu ) {
412
// `settings-updated` would be added just after settings updated.
413
- if ( ! empty( $_REQUEST['settings-updated'] ) && $this->is_network &&
414
! empty( $_REQUEST['page'] ) && IP_Geo_Block::PLUGIN_NAME === $_REQUEST['page'] ) {
415
$this->update_multisite_settings( $settings );
416
wp_safe_redirect( esc_url_raw( add_query_arg(
@@ -430,7 +429,7 @@ class IP_Geo_Block_Admin {
430
);
431
}
432
433
- elseif ( $this->is_network ) {
434
// Add a settings page for this plugin to the Settings menu.
435
$hook = add_menu_page(
436
__( 'IP Geo Block', 'ip-geo-block' ),
@@ -440,14 +439,16 @@ class IP_Geo_Block_Admin {
440
array( $this, 'display_plugin_admin_page' )
441
//'dashicons-admin-site' // or 'data:image/svg+xml;base64...'
442
);
443
- add_submenu_page(
444
- IP_Geo_Block::PLUGIN_NAME,
445
- __( 'IP Geo Block', 'ip-geo-block' ),
446
- __( 'Settings', 'ip-geo-block' ),
447
- 'manage_network_options',
448
- IP_Geo_Block::PLUGIN_NAME,
449
- array( $this, 'display_plugin_admin_page' )
450
- );
451
add_submenu_page(
452
IP_Geo_Block::PLUGIN_NAME,
453
__( 'IP Geo Block', 'ip-geo-block' ),
@@ -476,7 +477,7 @@ class IP_Geo_Block_Admin {
476
private function diagnose_admin_screen() {
477
$settings = IP_Geo_Block::get_option();
478
$updating = get_transient( IP_Geo_Block::CRON_NAME );
479
- $adminurl = $this->dashboard_url( $this->is_network );
480
481
// Check version and compatibility
482
if ( version_compare( get_bloginfo( 'version' ), '3.7.0' ) < 0 )
@@ -542,23 +543,21 @@ class IP_Geo_Block_Admin {
542
break;
543
}
544
}
545
-
546
// Check activation of IP Geo Allow
547
if ( $settings['validation']['timing'] && is_plugin_active( 'ip-geo-allow/index.php' ) ) {
548
self::add_admin_notice( 'error',
549
__( '&#8220;mu-plugins&#8221; (ip-geo-block-mu.php) at &#8220;Validation timing&#8221; is imcompatible with <strong>IP Geo Allow</strong>. Please select &#8220;init&#8221; action hook.', 'ip-geo-block' )
550
);
551
}
552
-
553
- if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ) {
554
- // Check creation of database table
555
- if ( $settings['validation']['reclogs'] ) {
556
- if ( ( $warn = IP_Geo_Block_Logs::diag_tables() ) &&
557
- ( FALSE === IP_Geo_Block_Logs::create_tables() ) ) {
558
- self::add_admin_notice( 'notice-warning', $warn );
559
- }
560
- }
561
- }
562
}
563
564
/**
@@ -676,22 +675,27 @@ class IP_Geo_Block_Admin {
676
// Target page that depends on the network multisite or not.
677
if ( 'options-general.php' === $GLOBALS['pagenow'] ) {
678
$action = 'options.php';
679
-
680
- if ( $this->is_network ) {
681
- unset( $tabs[0], $tabs[5] ); // Settings, Site List
682
$title .= ' <span class="ip-geo-block-menu-link">';
683
- $title .= ' [ <a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 0 ), $this->dashboard_url( TRUE ) ) ) . '" target="_self">' . __( 'Settings', 'ip-geo-block' ) . '</a> ]';
684
- $title .= ' [ <a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => 5 ), $this->dashboard_url( TRUE ) ) ) . '" target="_self">' . __( 'Site List', 'ip-geo-block' ) . '</a> ]';
685
$title .= '</span>';
686
- } else {
687
- unset( $tabs[5] ); // Site List
688
}
689
- } else {
690
// `edit.php` is an action handler for Multisite administration panels.
691
// `edit.php` ==> do action `network_admin_edit_IP_GEO_BLOCK` ==> `validate_network_settings()`
692
$action = 'edit.php?action=' . IP_Geo_Block::PLUGIN_NAME;
693
-
694
- if ( $settings['network_wide'] ) {
695
unset( $tabs[1], $tabs[4], $tabs[2], $tabs[3] ); // Statistics, Logs, Search, Attribution
696
$title .= ' <span class="ip-geo-block-menu-link">';
697
$title .= '[ ' . __( 'Network wide', 'ip-geo-block' ) . ' ]';
@@ -800,10 +804,10 @@ class IP_Geo_Block_Admin {
800
( FALSE === $val && ! empty( $args['value'][ $key ] ) ) ||
801
( is_string( $val ) && ! empty( $args['value'][ $key ] ) ); ?>
802
<li>
803
- <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="<?php echo $val; ?>"<?php checked( $stat ); ?> />
804
<label for="<?php echo $id; ?>"><?php echo '<dfn title="', esc_attr( $args['titles'][ $key ] ), '">', $key, '</dfn>'; ?></label>
805
<?php if ( is_string( $val ) ) { ?>
806
- <input type="text" class="regular-text code" name="<?php echo $name; ?>" value="<?php echo esc_attr( isset( $args['value'][ $key ] ) ? $args['value'][ $key ] : '' ); ?>"<?php if ( ! isset( $val ) ) disabled( TRUE, TRUE ); ?> />
807
<?php } ?>
808
</li>
809
<?php }
@@ -867,14 +871,14 @@ class IP_Geo_Block_Admin {
867
868
case 'text': ?>
869
<input type="text" class="regular-text code" id="<?php echo $id, $sub_id; ?>" name="<?php echo $name, $sub_name; ?>" value="<?php echo esc_attr( $args['value'] ); ?>"<?php
870
- disabled( ! empty( $args['disabled'] ), TRUE );
871
if ( isset( $args['placeholder'] ) ) echo ' placeholder="', esc_html( $args['placeholder'] ), '"'; ?> />
872
<?php
873
break; // disabled @since 3.0
874
875
case 'textarea': ?>
876
<textarea class="regular-text code" id="<?php echo $id, $sub_id; ?>" name="<?php echo $name, $sub_name; ?>"<?php
877
- disabled( ! empty( $args['disabled'] ), TRUE );
878
if ( isset( $args['placeholder'] ) ) echo ' placeholder="', esc_html( $args['placeholder'] ), '"'; ?>><?php
879
echo esc_html( $args['value'] ); ?></textarea>
880
<?php
@@ -882,7 +886,7 @@ class IP_Geo_Block_Admin {
882
883
case 'button': ?>
884
<input type="button" class="button-secondary" id="<?php echo $id; ?>" value="<?php echo esc_attr( $args['value'] ); ?>"
885
- <?php disabled( ! empty( $args['disabled'] ), TRUE ); ?>/>
886
<?php
887
break;
888
@@ -1057,7 +1061,7 @@ class IP_Geo_Block_Admin {
1057
// Initialize not on the form (mainly unchecked checkbox)
1058
public function preprocess_options( $output, $default ) {
1059
// initialize checkboxes not in the form (added after 2.0.0, just in case)
1060
- foreach ( array( 'providers', 'save_statistics', 'anonymize', 'network_wide', 'clean_uninstall' ) as $key ) {
1061
$output[ $key ] = is_array( $default[ $key ] ) ? array() : 0;
1062
}
1063
@@ -1211,7 +1215,7 @@ class IP_Geo_Block_Admin {
1211
unset( $bref_stack[ key( $bref_stack ) ] );
1212
1213
foreach ( array_keys( $head ) as $key ) {
1214
- if ( isset( $key, $bref ) && is_array( $bref[ $key ] ) && is_array( $head[ $key ] ) ) {
1215
$bref_stack[] = &$bref[ $key ];
1216
$head_stack[] = $head [ $key ];
1217
} else {
@@ -1450,16 +1454,16 @@ class IP_Geo_Block_Admin {
1450
$res = IP_Geo_Block_Util::get_registered_actions( TRUE );
1451
break;
1452
1453
- case 'get-blocked': // Get blocked actions and pages
1454
- $res = IP_Geo_Block_Admin_Ajax::get_blocked_queries( $which );
1455
- break;
1456
-
1457
case 'restore-cache': // Restore cache from database and format for DataTables
1458
- $res = IP_Geo_Block_Admin_Ajax::restore_cache( $which );
1459
break;
1460
1461
case 'bulk-action-remove': // Delete specified IP addresses from cache
1462
- $res = IP_Geo_Block_Logs::delete_cache_entry( @$which['IP'] );
1463
break;
1464
1465
case 'bulk-action-ip-white':
@@ -1503,21 +1507,19 @@ class IP_Geo_Block_Admin {
1503
break;
1504
1505
case 'live-start': // Restore live log
1506
- if ( ! is_wp_error( $res = IP_Geo_Block_Logs::catch_live_log() ) )
1507
- $res = IP_Geo_Block_Admin_Ajax::restore_live_log( $which, $settings );
1508
- else
1509
$res = array( 'error' => $res->get_error_message() );
1510
break;
1511
1512
case 'live-pause': // Pause live log
1513
- if ( ! is_wp_error( $res = IP_Geo_Block_Logs::catch_live_log() ) )
1514
$res = array( 'data' => array() );
1515
else
1516
$res = array( 'error' => $res->get_error_message() );
1517
break;
1518
1519
case 'live-stop': // Stop live log
1520
- if ( ! is_wp_error( $res = IP_Geo_Block_Logs::release_live_log() ) )
1521
$res = array( 'data' => array() );
1522
else
1523
$res = array( 'error' => $res->get_error_message() );
8
* @link http://www.ipgeoblock.com/
9
* @copyright 2013-2018 tokkonopapa
10
*/
11
+ define( 'IP_GEO_BLOCK_NETWORK', FALSE );
12
class IP_Geo_Block_Admin {
13
14
/**
66
67
if ( is_multisite() ) {
68
require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
69
+ $this->is_network = is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) && current_user_can( 'manage_network_options' );
70
71
add_action( 'network_admin_menu', array( $this, 'setup_admin_page' ) );
72
add_action( 'wpmu_new_blog', array( $this, 'create_blog' ), 10, 6 ); // on creating a new blog @since MU
333
*
334
*/
335
public function add_action_links( $links ) {
336
+ $settings = IP_Geo_Block::get_option();
337
return array_merge(
338
+ array( 'settings' => '<a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME ), $this->dashboard_url( $settings['network_wide'] ) ) ) . '">' . __( 'Settings' ) . '</a>' ),
339
$links
340
);
341
}
395
396
// Network wide or not
397
$admin_menu = ( 'admin_menu' === current_filter() ); // @since: 2.5 `admin_menu` or `network_admin_menu`
398
399
// Verify tab number
400
if ( $this->is_network ) {
401
if ( $admin_menu ) {
402
+ $this->admin_tab = min( 4, max( $settings['network_wide'] ? 1 : 0, $this->admin_tab ) );
403
+ } elseif ( ! in_array( $this->admin_tab, $settings['network_wide'] ? array( 0, 5 ) : array( 5 ), TRUE ) ) {
404
+ $this->admin_tab = $settings['network_wide'] ? 0 : 5;
405
}
406
} else {
407
$this->admin_tab = min( 4, $this->admin_tab ); // exclude `Site List`
409
410
if ( $admin_menu ) {
411
// `settings-updated` would be added just after settings updated.
412
+ if ( ! empty( $_REQUEST['settings-updated'] ) && $this->is_network && $settings['network_wide'] &&
413
! empty( $_REQUEST['page'] ) && IP_Geo_Block::PLUGIN_NAME === $_REQUEST['page'] ) {
414
$this->update_multisite_settings( $settings );
415
wp_safe_redirect( esc_url_raw( add_query_arg(
429
);
430
}
431
432
+ elseif ( IP_GEO_BLOCK_NETWORK && $this->is_network ) {
433
// Add a settings page for this plugin to the Settings menu.
434
$hook = add_menu_page(
435
__( 'IP Geo Block', 'ip-geo-block' ),
439
array( $this, 'display_plugin_admin_page' )
440
//'dashicons-admin-site' // or 'data:image/svg+xml;base64...'
441
);
442
+ if ( $settings['network_wide'] ) {
443
+ add_submenu_page(
444
+ IP_Geo_Block::PLUGIN_NAME,
445
+ __( 'IP Geo Block', 'ip-geo-block' ),
446
+ __( 'Settings', 'ip-geo-block' ),
447
+ 'manage_network_options',
448
+ IP_Geo_Block::PLUGIN_NAME,
449
+ array( $this, 'display_plugin_admin_page' )
450
+ );
451
+ }
452
add_submenu_page(
453
IP_Geo_Block::PLUGIN_NAME,
454
__( 'IP Geo Block', 'ip-geo-block' ),
477
private function diagnose_admin_screen() {
478
$settings = IP_Geo_Block::get_option();
479
$updating = get_transient( IP_Geo_Block::CRON_NAME );
480
+ $adminurl = $this->dashboard_url( $this->is_network && $settings['network_wide'] );
481
482
// Check version and compatibility
483
if ( version_compare( get_bloginfo( 'version' ), '3.7.0' ) < 0 )
543
break;
544
}
545
}
546
+ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
547
+ // Check database tables
548
+ if ( $settings['cache_hold'] || $settings['validation']['reclogs'] ) {
549
+ if ( ( $warn = IP_Geo_Block_Logs::diag_tables() ) &&
550
+ ( TRUE !== IP_Geo_Block_Logs::create_tables() ) ) {
551
+ self::add_admin_notice( 'notice-warning', $warn );
552
+ }
553
+ }
554
+ endif;
555
// Check activation of IP Geo Allow
556
if ( $settings['validation']['timing'] && is_plugin_active( 'ip-geo-allow/index.php' ) ) {
557
self::add_admin_notice( 'error',
558
__( '&#8220;mu-plugins&#8221; (ip-geo-block-mu.php) at &#8220;Validation timing&#8221; is imcompatible with <strong>IP Geo Allow</strong>. Please select &#8220;init&#8221; action hook.', 'ip-geo-block' )
559
);
560
}
561
}
562
563
/**
675
// Target page that depends on the network multisite or not.
676
if ( 'options-general.php' === $GLOBALS['pagenow'] ) {
677
$action = 'options.php';
678
+ unset( $tabs[5] ); // Site List
679
+ if ( IP_GEO_BLOCK_NETWORK && $this->is_network ) {
680
+ if ( $settings['network_wide'] ) {
681
+ unset( $tabs[0] ); // Settings
682
+ }
683
$title .= ' <span class="ip-geo-block-menu-link">';
684
+ $title .= ' [ <a href="' . esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME ), $this->dashboard_url( TRUE ) ) ) . '" target="_self">' . __( 'Network wide', 'ip-geo-block' ) . '</a> ]';
685
$title .= '</span>';
686
}
687
+ }
688
+
689
+ // '/wp-admin/network/admin.php'
690
+ else {
691
// `edit.php` is an action handler for Multisite administration panels.
692
// `edit.php` ==> do action `network_admin_edit_IP_GEO_BLOCK` ==> `validate_network_settings()`
693
$action = 'edit.php?action=' . IP_Geo_Block::PLUGIN_NAME;
694
+ if ( $this->is_network ) {
695
+ if ( ! $settings['network_wide'] ) {
696
+ $tab = 5; // forct to Site List
697
+ unset( $tabs[0] ); // Settings
698
+ }
699
unset( $tabs[1], $tabs[4], $tabs[2], $tabs[3] ); // Statistics, Logs, Search, Attribution
700
$title .= ' <span class="ip-geo-block-menu-link">';
701
$title .= '[ ' . __( 'Network wide', 'ip-geo-block' ) . ' ]';
804
( FALSE === $val && ! empty( $args['value'][ $key ] ) ) ||
805
( is_string( $val ) && ! empty( $args['value'][ $key ] ) ); ?>
806
<li>
807
+ <input type="checkbox" id="<?php echo $id; ?>" name="<?php echo $name; ?>" value="<?php echo $val; ?>"<?php checked( $stat && -1 !== (int)$val ); disabled( -1 === (int)$val ); ?> class="<?php echo in_array( $key, $args['local'], TRUE ) ? 'API-local' : 'API-remote'; ?>" />
808
<label for="<?php echo $id; ?>"><?php echo '<dfn title="', esc_attr( $args['titles'][ $key ] ), '">', $key, '</dfn>'; ?></label>
809
<?php if ( is_string( $val ) ) { ?>
810
+ <input type="text" class="regular-text code" name="<?php echo $name; ?>" value="<?php echo esc_attr( isset( $args['value'][ $key ] ) ? $args['value'][ $key ] : '' ); ?>" placeholder="API key" />
811
<?php } ?>
812
</li>
813
<?php }
871
872
case 'text': ?>
873
<input type="text" class="regular-text code" id="<?php echo $id, $sub_id; ?>" name="<?php echo $name, $sub_name; ?>" value="<?php echo esc_attr( $args['value'] ); ?>"<?php
874
+ disabled( ! empty( $args['disabled'] ) );
875
if ( isset( $args['placeholder'] ) ) echo ' placeholder="', esc_html( $args['placeholder'] ), '"'; ?> />
876
<?php
877
break; // disabled @since 3.0
878
879
case 'textarea': ?>
880
<textarea class="regular-text code" id="<?php echo $id, $sub_id; ?>" name="<?php echo $name, $sub_name; ?>"<?php
881
+ disabled( ! empty( $args['disabled'] ) );
882
if ( isset( $args['placeholder'] ) ) echo ' placeholder="', esc_html( $args['placeholder'] ), '"'; ?>><?php
883
echo esc_html( $args['value'] ); ?></textarea>
884
<?php
886
887
case 'button': ?>
888
<input type="button" class="button-secondary" id="<?php echo $id; ?>" value="<?php echo esc_attr( $args['value'] ); ?>"
889
+ <?php disabled( ! empty( $args['disabled'] ) ); ?>/>
890
<?php
891
break;
892
1061
// Initialize not on the form (mainly unchecked checkbox)
1062
public function preprocess_options( $output, $default ) {
1063
// initialize checkboxes not in the form (added after 2.0.0, just in case)
1064
+ foreach ( array( 'providers', 'save_statistics', 'cache_hold', 'anonymize', 'network_wide', 'clean_uninstall' ) as $key ) {
1065
$output[ $key ] = is_array( $default[ $key ] ) ? array() : 0;
1066
}
1067
1215
unset( $bref_stack[ key( $bref_stack ) ] );
1216
1217
foreach ( array_keys( $head ) as $key ) {
1218
+ if ( isset( $key, $bref, $bref[ $key ], $head[ $key ] ) && is_array( $bref[ $key ] ) && is_array( $head[ $key ] ) ) {
1219
$bref_stack[] = &$bref[ $key ];
1220
$head_stack[] = $head [ $key ];
1221
} else {
1454
$res = IP_Geo_Block_Util::get_registered_actions( TRUE );
1455
break;
1456
1457
case 'restore-cache': // Restore cache from database and format for DataTables
1458
+ $res = IP_Geo_Block_Admin_Ajax::restore_cache( $which, $settings['anonymize'] );
1459
break;
1460
1461
case 'bulk-action-remove': // Delete specified IP addresses from cache
1462
+ $res = IP_Geo_Block_Logs::delete_cache_entry( $which['IP'] );
1463
+ break;
1464
+
1465
+ case 'bulk-action-ip-erase':
1466
+ $res = IP_Geo_Block_Logs::delete_logs_entry( $which['IP'] );
1467
break;
1468
1469
case 'bulk-action-ip-white':
1507
break;
1508
1509
case 'live-start': // Restore live log
1510
+ if ( is_wp_error( $res = IP_Geo_Block_Admin_Ajax::restore_live_log( $which, $settings ) ) )
1511
$res = array( 'error' => $res->get_error_message() );
1512
break;
1513
1514
case 'live-pause': // Pause live log
1515
+ if ( ! is_wp_error( $res = IP_Geo_Block_Admin_Ajax::catch_live_log() ) )
1516
$res = array( 'data' => array() );
1517
else
1518
$res = array( 'error' => $res->get_error_message() );
1519
break;
1520
1521
case 'live-stop': // Stop live log
1522
+ if ( ! is_wp_error( $res = IP_Geo_Block_Admin_Ajax::release_live_log() ) )
1523
$res = array( 'data' => array() );
1524
else
1525
$res = array( 'error' => $res->get_error_message() );
admin/css/admin.css CHANGED
@@ -63,9 +63,6 @@ label {
63
.ip-geo-block-navi-link {
64
text-align: left;
65
}
66
- .ip-geo-block-navi-link label {
67
- vertical-align: text-top;
68
- }
69
.ip-geo-block-help-link {
70
float: right;
71
font-size: 90%;
@@ -77,11 +74,10 @@ label {
77
78
/* style legend and fieldset */
79
fieldset label {
80
- vertical-align: middle;
81
}
82
- fieldset label dfn,
83
- fieldset li label {
84
- vertical-align: text-top;
85
}
86
fieldset.ip-geo-block-field {
87
/* padding: 0 10px;*/
@@ -148,6 +144,14 @@ fieldset.ip-geo-block-field textarea.regular-text {
148
font-size: 95%;
149
}
150
151
/* Folding */
152
.ip-geo-block-settings-folding {
153
margin: 0.5em 0;
@@ -191,6 +195,10 @@ fieldset.ip-geo-block-field textarea.regular-text {
191
margin-top: 1em;
192
list-style: disc inside;
193
}
194
.ip-geo-block-border {
195
border-top: inherit;
196
}
@@ -583,10 +591,13 @@ table.dataTable > tbody > tr > td span {
583
}
584
585
/* Checkbox */
586
table.dataTable input[type="checkbox"] {
587
- height: 16px;
588
- width: 16px;
589
- margin: -4px 1px 0 0;
590
}
591
table.dataTable > thead > tr > th:first-child,
592
table.dataTable > tbody > tr > td:first-child {
@@ -629,11 +640,12 @@ table.collapsed > tbody > tr.parent > td:first-child::before {
629
}
630
table.collapsed > tbody > tr > td:first-child::before {
631
border-left: 5px solid #555;
632
left: -2px;
633
}
634
table.collapsed > tbody > tr.parent > td:first-child::before {
635
border-top: 5px solid #555;
636
- top: 3px;
637
left: -4px;
638
}
639
table.collapsed > tbody > tr.child > td:first-child::before {
63
.ip-geo-block-navi-link {
64
text-align: left;
65
}
66
.ip-geo-block-help-link {
67
float: right;
68
font-size: 90%;
74
75
/* style legend and fieldset */
76
fieldset label {
77
+ vertical-align: text-middle;
78
}
79
+ fieldset input[type="checkbox"] {
80
+ margin: 1px 2px 0;
81
}
82
fieldset.ip-geo-block-field {
83
/* padding: 0 10px;*/
144
font-size: 95%;
145
}
146
147
+ /* Plugins/Themes area, Geolocation API settings */
148
+ input[id*="ip_geo_block_settings_rewrite_"] + label {
149
+ margin-left: 0.25em;
150
+ }
151
+ input[id*="ip_geo_block_settings_providers"] + label {
152
+ min-width: 7em;
153
+ }
154
+
155
/* Folding */
156
.ip-geo-block-settings-folding {
157
margin: 0.5em 0;
195
margin-top: 1em;
196
list-style: disc inside;
197
}
198
+ .ip-geo-block-note li {
199
+ text-indent: -1em;
200
+ padding-left: 1em;
201
+ }
202
.ip-geo-block-border {
203
border-top: inherit;
204
}
591
}
592
593
/* Checkbox */
594
+ .ip-geo-block-settings-folding input[type="checkbox"] {
595
+ margin-right: 0.5em;
596
+ }
597
table.dataTable input[type="checkbox"] {
598
+ max-height: 16px;
599
+ max-width: 16px;
600
+ margin: 0;
601
}
602
table.dataTable > thead > tr > th:first-child,
603
table.dataTable > tbody > tr > td:first-child {
640
}
641
table.collapsed > tbody > tr > td:first-child::before {
642
border-left: 5px solid #555;
643
+ top: 1px;
644
left: -2px;
645
}
646
table.collapsed > tbody > tr.parent > td:first-child::before {
647
border-top: 5px solid #555;
648
+ top: 4px;
649
left: -4px;
650
}
651
table.collapsed > tbody > tr.child > td:first-child::before {
admin/css/admin.min.css CHANGED
@@ -3,4 +3,4 @@
3
* Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
* This software is released under the MIT License.
5
*/
6
- .ip-geo-block-navi-link label,fieldset label dfn,fieldset li label{vertical-align:text-top}dfn{cursor:help;border-bottom:1px dotted #888}.ip-geo-block-icon,svg a,table.dataTable>tbody>tr{cursor:pointer}fieldset,legend{padding:0;margin:0;border:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}fieldset{min-width:0}legend{display:block;line-height:inherit;width:100%}.panel-body,label{display:inline-block}label{max-width:100%}.panel{border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#f5f5f5}#ip-geo-block-back-to-top a,#ip-geo-block-toggle-sections,.ip-geo-block-help-link a{box-shadow:none}.panel-heading{float:left!important;background:#fff}.panel-default>.panel-heading{border-color:inherit}.panel-body{width:100%;padding:0 1em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.panel-body:after,.panel-body:before{content:" ";display:table}.panel-body:after{clear:both}.ip-geo-block-navi-link{text-align:left}.ip-geo-block-help-link{float:right;font-size:90%;font-weight:400}fieldset label{vertical-align:middle}fieldset.ip-geo-block-field{margin:1em 0}fieldset.ip-geo-block-field h2,fieldset.ip-geo-block-field h3{padding:0;margin:0;font-size:14px!important}fieldset.ip-geo-block-field h4{margin:.75em 0 .5em}fieldset.ip-geo-block-field legend.panel-heading{padding:10px}fieldset.ip-geo-block-field .ip-geo-block-dropdown,fieldset.ip-geo-block-field .ip-geo-block-dropup{cursor:pointer;position:relative;padding-left:1em}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before,fieldset.ip-geo-block-field .ip-geo-block-dropup:before{content:'';height:0;width:0;border:.4em solid transparent;position:absolute}fieldset.ip-geo-block-field .ip-geo-block-dropup:before{border-left:.4em solid #555;left:2px;top:18%}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before{border-top:.4em solid #555;left:-2px;top:38%}fieldset.ip-geo-block-field .form-table .ip-geo-block-dropdown,fieldset.ip-geo-block-field .form-table .ip-geo-block-dropup{margin-top:.75em}fieldset.ip-geo-block-field ul.ip-geo-block-dropup:before{top:.25em}fieldset.ip-geo-block-field ul.ip-geo-block-dropdown:before{top:.5em}fieldset.ip-geo-block-field table.form-table{margin:0 0 .5em;width:100%}textarea.regular-text{width:25em}fieldset.ip-geo-block-field input.regular-text,fieldset.ip-geo-block-field textarea.regular-text{font-size:95%}.ip-geo-block-settings-folding{margin:.5em 0}.ip-geo-block-settings-folding ul{margin-bottom:0}.ip-geo-block-settings-folding li{margin:.5em 0}.folding-disable{pointer-events:none;opacity:.5}.folding-inactive{opacity:.5;font-style:oblique!important}.ip-geo-block-float li{display:inline-block;width:18em;margin-top:0}.ip-geo-block-checked{list-style-type:disc}.ip-geo-block-ip-addr{display:inline-block;padding-top:5px}.ip-geo-block-hide{display:none}.ip-geo-block-sup{margin-left:.2em;display:inline-block}.ip-geo-block-note{margin-top:1em;list-style:disc inside}.ip-geo-block-border{border-top:inherit}.ip-geo-block-notice{color:#dd3d36}.ip-geo-block-title{width:100px;display:inline-block}.ip-geo-block-result{color:#2786C2;display:inline-block}#ip-geo-block-live-loading,.ip-geo-block-loading{background-size:16px 16px;background-position:center center;background-repeat:no-repeat;height:16px;width:16px;margin-left:1em;margin-top:.2em;display:inline-block;vertical-align:top}.ip-geo-block-loading{background-image:url(data:image/gif;base64,R0lGODlhEAAQAPIGAAAAAMLCwkJCQpKSkmJiYoKCgv///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgAGACwAAAAAEAAQAAADM2i63P4wyklrC0IEKgAQnAdOmGYFBLExwboQWcG2rlHEwTDQLUsUOd2mBxkUCgNKa+dIAAAh+QQJCgAGACwAAAIACgAOAAADLWgWIqHQCABEVLPe1R4MBOFFRFNsRUNsYDFewTC8iixvQ1EMyxjEvyBLODQkAAAh+QQJCgAGACwAAAAACgAOAAADLWi6IRJrCQCECoU0ag1xxeBARuEQ0UUU5DUM7fK+qTEUYR0EcM3Ev51uB7wAEwAh+QQJCgAGACwAAAAADgAKAAADLWi6URQrLiJEkSaM0eqrkLFtAVEEAgAIylAUQ5SuSqCFNZjhWG3zmB8wOJQkAAAh+QQJCgAGACwCAAAADgAKAAADK2hqMRMrLuekCnCU8gqBDCZ2glBcYkSUxIJJgQdaUVDOtAAAAr3oPN/llgAAIfkECQoABgAsBgAAAAoADgAAAytoEdauiz0Yx5BQFTvN2EMXWNgUFETZFIJQdERLiGgZtKohAIDQ7T0RrpEAACH5BAkKAAYALAYAAgAKAA4AAAMqaKoR+609Fie1K4zhZiibNRSg1XAQUXQPIQgE835voQgAIARqh+ummSUBACH5BAUKAAYALAIABgAOAAoAAAMsaLpsES2+F9mEddEgBFbBMGACAAiMOCrlGRBFWBQD2L0dYYjfUuQZEKynSAAAOw==)}#ip-geo-block-map{height:400px;margin:1em auto}.gm-style-iw{width:18em;height:auto!important;height:100%;min-height:100%:}.gm-style-iw ul{margin:.1em}.gm-style-iw li{margin:.2em}svg a:hover>text{fill:#0096dd}svg a>text{fill:#0073aa;text-decoration:underline}table.ip-geo-block-statistics-table{float:right}table.ip-geo-block-statistics-table td,table.ip-geo-block-statistics-table th{width:12em;margin:0;padding:.2em;text-align:right;line-height:1.5em;word-wrap:break-word}table.ip-geo-block-statistics-table tr:nth-child(even){background-color:#eee}table.ip-geo-block-table{margin:1em 0;white-space:normal;word-wrap:break-word;word-break:break-all}table.ip-geo-block-table td:first-child{min-width:4.3em}@media screen and (max-width:782px){#ip-geo-block-whois .panel-body{padding:0 .5em}}#ip-geo-block-scan-code{vertical-align:middle}#ip-geo-block-code-list{display:none;margin-bottom:0}#ip-geo-block-chart-countries{height:200px}#ip-geo-block-chart-daily{height:240px}#ip_geo_block_settings_validation_mimetype+label{padding-top:.25em}#ip_geo_block_settings_validation_mimetype+label+ul{margin-top:.7em}#ip_geo_block_settings_create_user{margin-bottom:.5em}#ip-geo-block-wp-info textarea{margin-top:.5em;overflow:auto;width:100%;word-wrap:normal;word-break:normal;white-space:pre}#ip-geo-block-preferred{color:#fff;background:#00838f!important;border-color:#00707a!important;text-shadow:none}#ip-geo-block-preferred:hover{background-color:#00919e!important;border-color:#00525a!important}.ip-geo-block-icon,.ip-geo-block-list-exceptions a.ip-geo-block-icon{background-color:transparent;box-shadow:none;text-decoration:none;outline:0}#ip-geo-block-back-to-top{margin:0;text-align:right}#ip-geo-block-live-update,#ip-geo-block-open-new{margin-left:1em}.ip-geo-block-menu-link{font-size:13px!important}dfn~.ip-geo-block-icon{margin-left:.6em}.ip-geo-block-icon{position:relative}.ip-geo-block-icon:active{top:1px}.ip-geo-block-icon span{height:16px;width:16px;margin:0;border:none;display:inline-block;vertical-align:middle;background-size:16px 16px;background-position:center center;background-repeat:no-repeat}.ip-geo-block-icon-cidr span{vertical-align:text-top}.ip-geo-block-icon-cycle span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAh1BMVEUAda2otLp+rsSHprWHr8IBd7EpfKRGhaNajqeUqrRymKuKoq5yo7prlKgAcqoVe6w8gqQmgq5Tj6wIdqsVdKIshrEMea1Uhp+Anqw0hawDdq4gfKhljqE7hqoLdKYbgbM4jLQygKUGeK8CdawQd6gVeKcad6NKkrSerrZAj7UAc6sAc6rc3NySrVGQAAAALXRSTlP//////////////////////////////////////////////////////////wCl7wv9AAACOklEQVR4Ae2W15rzKgxF9xTZzhTX9B7S/gN6/9ebYqzzGZsw/S7LV3FZgCSIwD/kQ8FVcBU8xatZUczy8luC/ABNOn0DSHEsvyZ4PgLatNCYR3efFxyhTQ8g+qQgJxgv2JefERzJXATRh4LHOUwAHD4S7OGEztRJaN86hAUxtaNWDUf/bRdDBbQMWVDAO8jn89WUhag1MeyCAh6hHofyrliLgZKggDMYgzF3eVAwFq0uCZq5KY0TezjIHDDzC0qqmkwe2ctGDOQVLMkgu+F3/rGXwb4xIPcJ6P3JgkM8wFjmfcFAWfeKQywaAz33BJVuHsUcAt09gVbuLDThAJkdR687ggLmf4gDJLIGV7BydtB8yn3u+fbtuj/LS7G9wZAd1AKK+yxJ1x+aBmibTtgCcEHGHsh0wdbOgNLek4L7lI5BigY8nWuZUQ3qGEXes9JzOKGJztPaGtLslu3lIXJirdxCWkASHGDTMqg7V1DKPplygDG61YJukLHjEErGSXqCSos6xNSOgzP3BDmsQBcchNwkoV8oiNnPA78zIefUgCdJeGIfE7LmFWXsFTCFdzTJ/RlfEMRiSGnFXXbkC7AIeqcKDu4ynseozeouKJiSEYBDwkJyIC1nRUjgblkNWp/e/1vXc2gjoAoLksYgjrrFMi0oDgjEEIDij1scBXMJSH6DAj6RNl7o8MkuLak8Co15/Pk+MRmT0xilQJV/sdWNKg2kTaeroudvNNsDjmejYjSL+e6v2/2r4Cp4BXNajr0H7hRfAAAAAElFTkSuQmCC)}.ip-geo-block-icon-lock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3Ny3y9Zzq8dRmb7M1dlXnsIFdK0AcawAcqwphrYAcKvZ29wAb6oJd680jrqlw9MBcqxmo8MUfbJLl75eoMI7kbzX2ttqp8VSmL1YnL8NeK+Tu89DlL1ImMEOebBNmL4OkqMoAAAAAXRSTlMAQObYZgAAAPlJREFUeAG9kAWyhTAQBIPOsCzufv9TPnf4Ll0CSbpmxXwNy3Yc23rz2fV8kPA99433AIQIiGDTCD0lojiOQPXCDSFJIbF16CMWItkQMkF+inZzSLYhFKLl+a9UKTZaqJTZJYtarZuo40chrv9CqJTN+behVi+Cm7RdDgRld6AMgLxrE/dxBz0BEjwBEmD/uIsWPAOAF9A+CE56ufSryr8oqfOYcBbQJ8YkES7COkFOYzTypqCDOTDo2wljaEw4vp1APYyWKd8WMBozylvCpcvmXeHQ5fCegHia4s1FgZcIVeVFeFx1M4MvYG4eBHdYWufC+addBtf8E3vdjBNhWnVQqAAAAABJRU5ErkJggg==)}.ip-geo-block-icon-unlock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NyzydRzq8dRmb7I09hYnsEFdK0AcawAcqzP1toqhrYAcKvZ29wAb6oMeK8zjbqrxtQBcazBz9Zko8MVfbLF0thMmL07kbtpp8WjwtJSmL1YnL+Tu89DlL1JmMEPebBFV++UAAAAAXRSTlMAQObYZgAAAONJREFUeAG9kAWChDAMAIMmJaTFXf7/ynXflvMbnE5j8DU8Pwh8D1yEUYxEGEchWFEJEjEflESBhTQSQm2MRpIotQhZTmgKgMIg5ZlFKBmrGg7UFXJpEQKW8qIKN7YeikJdBJI2BTtXwfyx0L3XoPphvBEliNU49OoxqEa6g4cTST/OYshvi3hV8+FxSNfluG3jqxG8C6h7gF6jU+AODnTsFGSCA5O4I8wpQDq7I5CUAKWQW+AZYOYtoQPoGDeECWDaioBmWQxeBduoWURso+5WpBdw7R4ENTVDcGE435tJwT+xB+vMEnZRNB0YAAAAAElFTkSuQmCC)}.ip-geo-block-icon-find span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NzS19rD0NWHtMpGk7kYfbAGda0Req+WtcTT1temwM4AcasAcqwAc6wAcKydvMt1pr8Ab6pqpcLX2doggrKoxdNYm7yzw8u/y9HO1tkKdq4th7Td3t6DrcLL0taxyNPGe/YhAAAAAXRSTlMAQObYZgAAARVJREFUeAGtkkeiwyAMRP2xDfxoRjElvd3/lOkNUlZ5u0GPruan/Bnz96Xadr21rvP/7+ujXsAjom78rj4ApCoERIipqfGB1H7wPmYhw1DXjZI6nOel1oJhVAmdUP0tTEDkVC4AYvqIbaDOCqFV6vwRF0tIeYoo6J/X7ICuPAJl9ZynwiIfB5DXxZlRChulbh8xZci0EHZK3TziJFDL504rEOZ+iR5cVj82DoS7XtSshLJpKqaB0Dg3ZjcsQWKaKiF1gVQlITwh/bw2pgKeEeURhE29yKSzUFF03p1V7Wqj2Y7GfrY9X/NirJsPxKsxfBLSSs5GmH8yjAWPSNd8Yoez4f4/G1nIsksqFtGK1i9e39o0P+EAqaoRLlQ+r94AAAAASUVORK5CYII=)}.ip-geo-block-icon-alert span,span.ip-geo-block-icon-alert{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAkFBMVEXc3Nzc2trWl5DHRDTFOyvOgXfc1tXCLBrEMiHEMyLNcmfaxMLDMSDDLx7bu7jRiYHDLhzDMB/LX1PaxsTDLh3YtrHMY1bWmpPJVknSjYXUkYnZuLTMZVnENCPWlI3QhXzENiXXrqrDLRzXsa3Oal7Pe3Hc2NjVn5nNbmPayMbbwb7ay8rUj4fc09Lbw8Db0dDBbRUDAAAAAXRSTlMAQObYZgAAAPVJREFUeAG9ktXWwyAQBonC12brFvff5f2frr4nBredK2DnTFS8Gst2XM8XZmypIGeWcT4PFABaGIXlClfWG1NiC4Ubu705oKRcY32wTAHl2MdTYEqEK8hIiHgHSnSJeaogMyEWO4BijZCvwII2MS9UJ2BXTh+hQidoEttboBOwq3WBnkCNpQlA2iyAhol2hRu71n97p4fw0Z9/ugoPHCfFA+o/iLfCkyBglRJdICBas7uuey+R56fF14wNanj+/QjwY3aX23cBFn6EiHmHNT/ICYxystv/wJy4UHWGlN2cuPB72tFqAq3dP/Hk3zs0E5LZVryGC/hqGNnUa0SVAAAAAElFTkSuQmCC);vertical-align:bottom}table.form-table th .ip-geo-block-cycle span{vertical-align:text-bottom}.ip-geo-block-list{margin-top:0;margin-bottom:.7em}@media screen and (min-width:782px){ul.ip-geo-block-list .code{width:15em}}.ip-geo-block-list-exceptions label{display:inline-block}.ip-geo-block-list-exceptions dfn{border:none}.dataTables_wrapper.no-footer .dataTables_scrollBody,table.dataTable.no-footer,table.dataTable>thead>tr>td,table.dataTable>thead>tr>th{border-bottom:1px solid #ddd}.ip-geo-block-list-exceptions span.dashicons{font-size:14px}.ip-geo-block-list-exceptions a.ip-geo-block-icon{margin-left:.3em}.form-table td p.ip-geo-block-desc,.form-table td p.ip-geo-block-find-desc{color:#666;font-size:13px!important;margin:4px 0 .5em .5em}.ip-geo-block-find-desc{display:none}.ip-geo-block-admin-post{color:#c43322;margin-left:.25em}.ip-geo-block-warn{color:#c43322;font-weight:700}input#ip_geo_block_settings_behavior_view,input#ip_geo_block_settings_behavior_time {width:3.5em}.ip-geo-block-top-list{display:inline-table;list-style-position:outside;margin:0 2em .5em 1.75em}.ip-geo-block-top-list h4{margin:1em 0}.ip-geo-block-top-list li code{background:0 0}.ip-geo-block-network{margin-bottom:1em}.ip-geo-block-container{margin:0 auto;padding:0 1em;position:relative;width:100%}.ip-geo-block-row{display:flex;flex-direction:column;align-items:flex-start;align-items:stretch;padding:0;width:100%}.ip-geo-block-row .ip-geo-block-column{display:block;flex:1 1 auto;align-self:flex-start;margin-left:0;max-width:100%;width:100%}.ip-geo-block-row .ip-geo-block-column.column-20{flex:0 0 20%;max-width:20%}.ip-geo-block-row .ip-geo-block-column.column-25{flex:0 0 25%;max-width:25%}.ip-geo-block-row .ip-geo-block-column.column-33{flex:0 0 33.3333%;max-width:33.3333%}.ip-geo-block-row .ip-geo-block-column.column-50{flex:0 0 50%;max-width:50%}@media (min-width:40rem){.ip-geo-block-row{flex-direction:row;margin-left:-2em;width:calc(100% + 2em)}.ip-geo-block-row .ip-geo-block-column{margin-bottom:inherit;padding:0 1em}}table.dataTable{clear:none!important}table.dataTable td,table.dataTable th{text-align:right}table.dataTable td:nth-child(n+2),table.dataTable th:nth-child(n+2){padding-left:0!important}table.dataTable th{white-space:nowrap}table.dataTable>thead>tr{line-height:1.8em}table.dataTable thead td,table.dataTable thead th{padding:10px 16px}#ip-geo-block-statistics-cache td:nth-child(3),#ip-geo-block-validation-logs td:nth-child(4){min-width:1.6em}table.dataTable.nowrap td,table.dataTable>tbody>tr>td span{white-space:normal!important;word-wrap:break-word!important;word-break:break-all!important}table.dataTable>tbody>tr>td span{display:inline-block}table.dataTable input[type=checkbox]{height:16px;width:16px;margin:-4px 1px 0 0}table.dataTable>tbody>tr>td:first-child,table.dataTable>thead>tr>th:first-child{padding:8px 4px 8px 1.4em;text-align:left}table.collapsed>tbody>tr>td.dataTables_empty:first-child::before,table.dataTable>tbody>tr>td.dataTables_empty{border:none;text-align:center}table.dataTable thead>tr>th:first-child.sorting_asc{background-image:none!important}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.display tbody tr:hover>.sorting_1{background-color:inherit!important}table.dataTable.collapsed>tbody>tr>td:first-child{padding:8px 4px 8px 8px!important}table.collapsed>tbody>tr.parent>td:first-child::before,table.collapsed>tbody>tr>td:first-child::before{content:'';height:0;width:0;display:inline-block;border-radius:0;border:5px solid transparent;box-shadow:none;position:relative;background-color:transparent}table.collapsed>tbody>tr>td:first-child::before{border-left:5px solid #555;left:-2px}table.collapsed>tbody>tr.parent>td:first-child::before{border-top:5px solid #555;top:3px;left:-4px}table.collapsed>tbody>tr.child>td:first-child::before{border:none}table.collapsed>tbody>tr.child>td.child>ul li{border:none;padding:0;margin:0;line-height:1.8em}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data,table.collapsed>tbody>tr.child>td.child>ul li span.dtr-title{font-size:13px!important;display:block;white-space:normal;word-wrap:break-word;word-break:break-all}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data{margin-left:1.25em;margin-right:.3em}.dataTables_wrapper .dataTables_paginate{float:none;text-align:center;margin-bottom:1em}.dataTables_wrapper .dataTables_paginate a.paginate_button,.dataTables_wrapper .dataTables_paginate a.paginate_button.current,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate a.paginate_button:active,.dataTables_wrapper .dataTables_paginate a.paginate_button:hover,.dataTables_wrapper .dataTables_paginate span.ellipsis{min-width:2em;background:inherit;border-color:#ddd;border-radius:0;border-image:none;border-style:solid;border-width:1px 1px 1px 0;box-shadow:none;margin:.5em 0 0;padding:.25em 0;display:inline-block;text-decoration:none}#ip-geo-block-1 #ip-geo-block-section-2 .panel-body,#ip-geo-block-4 #ip-geo-block-section-0 .panel-body,mark{padding:0}.dataTables_wrapper .dataTables_paginate:active>a.paginate_button:first-child,.dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:first-child,.dataTables_wrapper .dataTables_paginate>a.paginate_button:first-child{border-left-width:1px;border-bottom-left-radius:4px;border-top-left-radius:4px}.dataTables_wrapper .dataTables_paginate:active>a.paginate_button:last-child,.dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:last-child,.dataTables_wrapper .dataTables_paginate>a.paginate_button:last-child{border-bottom-right-radius:4px;border-top-right-radius:4px}.dataTables_wrapper .dataTables_paginate a.paginate_button{color:#0073aa!important}.dataTables_wrapper .dataTables_paginate a.paginate_button:hover{color:#0096dd!important;background-color:#fff}.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate span.ellipsis{cursor:default;color:#999!important;background-color:transparent}.dataTables_wrapper .dataTables_paginate a.paginate_button.current,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover{cursor:default;color:#444!important;background-color:#fff!important}#ip-geo-block-1 #ip-geo-block-section-2 table.form-table,#ip-geo-block-4 #ip-geo-block-section-0 table.form-table{margin-left:1em;max-width:95%}#ip-geo-block-live-log,#ip-geo-block-select-duration,#ip-geo-block-select-layout,#ip-geo-block-select-target{margin:0}#ip-geo-block-select-duration li,#ip-geo-block-select-layout li,#ip-geo-block-select-target li{float:left;margin-right:1.5em}#ip-geo-block-select-duration li label,#ip-geo-block-select-target li label{cursor:pointer}#ip_geo_block_settings_search_filter{width:16em;padding-top:3px}table.dataTable.display tbody tr.ip-geo-block-passed{background-color:#edf6ff!important}table.dataTable.display tbody tr.ip-geo-block-blocked{background-color:#ffefef!important}.ip-geo-block-new-passed{animation:ip-geo-block-flash-passed 1s ease-out 0s 1 normal both running}.ip-geo-block-new-blocked{animation:ip-geo-block-flash-blocked 1s ease-out 0s 1 normal both running}@keyframes ip-geo-block-flash-passed{0%{background-color:gold}100%{background-color:#edf6ff}}@keyframes ip-geo-block-flash-blocked{0%{background-color:gold}100%{background-color:#ffefef}}mark{background:gold}#ip-geo-block-live-log li{float:left;margin-right:3em}#ip-geo-block-live-log li:last-child{margin-right:0}#ip-geo-block-live-log li input[type=radio]{visibility:hidden;position:absolute}#ip-geo-block-live-log li input[type=radio]+label{display:inline-block;margin:-2px -2px 0;padding:4px 12px;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);border-bottom-color:#b3b3b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}#ip-geo-block-live-log li input[type=radio]:checked+label{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);background-color:#e0e0e0}.ip-geo-block-live-timer{height:1em;width:1em;margin:0;position:relative;top:0;left:0}.ip-geo-block-live-timer:before{content:"";display:block;height:1em;width:1em;background:radial-gradient(#0073aa,#72777c);border-radius:50%;position:absolute;top:0;left:0}.ip-geo-block-live-timer:after{display:none}.ip-geo-block-live-timer>div{position:absolute;width:1em;height:1em;clip:rect(0,1em,1em,.5em)}.ip-geo-block-live-timer>div:before{content:" ";position:absolute;width:1em;height:1em;border-radius:.5em;clip:rect(0,.5em,1em,0);background-color:#f1f1f1;transform:rotate(0)}.ip-geo-block-live-timer>div:first-child:before{animation:30s spin-timer linear forwards}.ip-geo-block-live-timer>div:last-child{transform:rotate(180deg)}.ip-geo-block-live-timer>div:last-child:before{transform:rotate(.00001deg);animation:30s spin-timer linear 30s forwards}@keyframes spin-timer{0%{transform:rotate(0)}100%{transform:rotate(180deg)}}:placeholder-shown{color:#888}::-webkit-input-placeholder{color:#888}:-moz-placeholder{color:#888;opacity:1}::-moz-placeholder{color:#888;opacity:1}:-ms-input-placeholder{color:#888}
3
* Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
* This software is released under the MIT License.
5
*/
6
+ dfn{cursor:help;border-bottom:1px dotted #888}.ip-geo-block-icon,svg a,table.dataTable>tbody>tr{cursor:pointer}fieldset,legend{padding:0;margin:0;border:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}fieldset{min-width:0}legend{display:block;line-height:inherit;width:100%}.panel-body,label{display:inline-block}label{max-width:100%}.panel{border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#f5f5f5}#ip-geo-block-back-to-top a,#ip-geo-block-toggle-sections,.ip-geo-block-help-link a{box-shadow:none}.panel-heading{float:left!important;background:#fff}.panel-default>.panel-heading{border-color:inherit}.panel-body{width:100%;padding:0 1em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.panel-body:after,.panel-body:before{content:" ";display:table}.panel-body:after{clear:both}.ip-geo-block-navi-link{text-align:left}.ip-geo-block-help-link{float:right;font-size:90%;font-weight:400}fieldset label{vertical-align:text-middle}fieldset input[type=checkbox]{margin:1px 2px 0}fieldset.ip-geo-block-field{margin:1em 0}fieldset.ip-geo-block-field h2,fieldset.ip-geo-block-field h3{padding:0;margin:0;font-size:14px!important}fieldset.ip-geo-block-field h4{margin:.75em 0 .5em}fieldset.ip-geo-block-field legend.panel-heading{padding:10px}fieldset.ip-geo-block-field .ip-geo-block-dropdown,fieldset.ip-geo-block-field .ip-geo-block-dropup{cursor:pointer;position:relative;padding-left:1em}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before,fieldset.ip-geo-block-field .ip-geo-block-dropup:before{content:'';height:0;width:0;border:.4em solid transparent;position:absolute}fieldset.ip-geo-block-field .ip-geo-block-dropup:before{border-left:.4em solid #555;left:2px;top:18%}fieldset.ip-geo-block-field .ip-geo-block-dropdown:before{border-top:.4em solid #555;left:-2px;top:38%}fieldset.ip-geo-block-field .form-table .ip-geo-block-dropdown,fieldset.ip-geo-block-field .form-table .ip-geo-block-dropup{margin-top:.75em}fieldset.ip-geo-block-field ul.ip-geo-block-dropup:before{top:.25em}fieldset.ip-geo-block-field ul.ip-geo-block-dropdown:before{top:.5em}fieldset.ip-geo-block-field table.form-table{margin:0 0 .5em;width:100%}textarea.regular-text{width:25em}fieldset.ip-geo-block-field input.regular-text,fieldset.ip-geo-block-field textarea.regular-text{font-size:95%}input[id*=ip_geo_block_settings_rewrite_]+label{margin-left:.25em}input[id*=ip_geo_block_settings_providers]+label{min-width:7em}.ip-geo-block-settings-folding{margin:.5em 0}.ip-geo-block-settings-folding ul{margin-bottom:0}.ip-geo-block-settings-folding li{margin:.5em 0}.folding-disable{pointer-events:none;opacity:.5}.folding-inactive{opacity:.5;font-style:oblique!important}.ip-geo-block-float li{display:inline-block;width:18em;margin-top:0}.ip-geo-block-checked{list-style-type:disc}.ip-geo-block-ip-addr{display:inline-block;padding-top:5px}.ip-geo-block-hide{display:none}.ip-geo-block-sup{margin-left:.2em;display:inline-block}.ip-geo-block-note{margin-top:1em;list-style:disc inside}.ip-geo-block-note li{text-indent:-1em;padding-left:1em}.ip-geo-block-border{border-top:inherit}.ip-geo-block-notice{color:#dd3d36}.ip-geo-block-title{width:100px;display:inline-block}.ip-geo-block-result{color:#2786C2;display:inline-block}#ip-geo-block-live-loading,.ip-geo-block-loading{background-size:16px 16px;background-position:center center;background-repeat:no-repeat;height:16px;width:16px;margin-left:1em;margin-top:.2em;display:inline-block;vertical-align:top}.ip-geo-block-loading{background-image:url(data:image/gif;base64,R0lGODlhEAAQAPIGAAAAAMLCwkJCQpKSkmJiYoKCgv///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCgAGACwAAAAAEAAQAAADM2i63P4wyklrC0IEKgAQnAdOmGYFBLExwboQWcG2rlHEwTDQLUsUOd2mBxkUCgNKa+dIAAAh+QQJCgAGACwAAAIACgAOAAADLWgWIqHQCABEVLPe1R4MBOFFRFNsRUNsYDFewTC8iixvQ1EMyxjEvyBLODQkAAAh+QQJCgAGACwAAAAACgAOAAADLWi6IRJrCQCECoU0ag1xxeBARuEQ0UUU5DUM7fK+qTEUYR0EcM3Ev51uB7wAEwAh+QQJCgAGACwAAAAADgAKAAADLWi6URQrLiJEkSaM0eqrkLFtAVEEAgAIylAUQ5SuSqCFNZjhWG3zmB8wOJQkAAAh+QQJCgAGACwCAAAADgAKAAADK2hqMRMrLuekCnCU8gqBDCZ2glBcYkSUxIJJgQdaUVDOtAAAAr3oPN/llgAAIfkECQoABgAsBgAAAAoADgAAAytoEdauiz0Yx5BQFTvN2EMXWNgUFETZFIJQdERLiGgZtKohAIDQ7T0RrpEAACH5BAkKAAYALAYAAgAKAA4AAAMqaKoR+609Fie1K4zhZiibNRSg1XAQUXQPIQgE835voQgAIARqh+ummSUBACH5BAUKAAYALAIABgAOAAoAAAMsaLpsES2+F9mEddEgBFbBMGACAAiMOCrlGRBFWBQD2L0dYYjfUuQZEKynSAAAOw==)}#ip-geo-block-map{height:400px;margin:1em auto}.gm-style-iw{width:18em;height:auto!important;height:100%;min-height:100%:}.gm-style-iw ul{margin:.1em}.gm-style-iw li{margin:.2em}svg a:hover>text{fill:#0096dd}svg a>text{fill:#0073aa;text-decoration:underline}table.ip-geo-block-statistics-table{float:right}table.ip-geo-block-statistics-table td,table.ip-geo-block-statistics-table th{width:12em;margin:0;padding:.2em;text-align:right;line-height:1.5em;word-wrap:break-word}table.ip-geo-block-statistics-table tr:nth-child(even){background-color:#eee}table.ip-geo-block-table{margin:1em 0;white-space:normal;word-wrap:break-word;word-break:break-all}table.ip-geo-block-table td:first-child{min-width:4.3em}@media screen and (max-width:782px){#ip-geo-block-whois .panel-body{padding:0 .5em}}#ip-geo-block-scan-code{vertical-align:middle}#ip-geo-block-code-list{display:none;margin-bottom:0}#ip-geo-block-chart-countries{height:200px}#ip-geo-block-chart-daily{height:240px}#ip_geo_block_settings_validation_mimetype+label{padding-top:.25em}#ip_geo_block_settings_validation_mimetype+label+ul{margin-top:.7em}#ip_geo_block_settings_create_user{margin-bottom:.5em}#ip-geo-block-wp-info textarea{margin-top:.5em;overflow:auto;width:100%;word-wrap:normal;word-break:normal;white-space:pre}#ip-geo-block-preferred{color:#fff;background:#00838f!important;border-color:#00707a!important;text-shadow:none}#ip-geo-block-preferred:hover{background-color:#00919e!important;border-color:#00525a!important}.ip-geo-block-icon,.ip-geo-block-list-exceptions a.ip-geo-block-icon{background-color:transparent;box-shadow:none;text-decoration:none;outline:0}#ip-geo-block-back-to-top{margin:0;text-align:right}#ip-geo-block-live-update,#ip-geo-block-open-new{margin-left:1em}.ip-geo-block-menu-link{font-size:13px!important}dfn~.ip-geo-block-icon{margin-left:.6em}.ip-geo-block-icon{position:relative}.ip-geo-block-icon:active{top:1px}.ip-geo-block-icon span{height:16px;width:16px;margin:0;border:none;display:inline-block;vertical-align:middle;background-size:16px 16px;background-position:center center;background-repeat:no-repeat}.ip-geo-block-icon-cidr span{vertical-align:text-top}.ip-geo-block-icon-cycle span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAh1BMVEUAda2otLp+rsSHprWHr8IBd7EpfKRGhaNajqeUqrRymKuKoq5yo7prlKgAcqoVe6w8gqQmgq5Tj6wIdqsVdKIshrEMea1Uhp+Anqw0hawDdq4gfKhljqE7hqoLdKYbgbM4jLQygKUGeK8CdawQd6gVeKcad6NKkrSerrZAj7UAc6sAc6rc3NySrVGQAAAALXRSTlP//////////////////////////////////////////////////////////wCl7wv9AAACOklEQVR4Ae2W15rzKgxF9xTZzhTX9B7S/gN6/9ebYqzzGZsw/S7LV3FZgCSIwD/kQ8FVcBU8xatZUczy8luC/ABNOn0DSHEsvyZ4PgLatNCYR3efFxyhTQ8g+qQgJxgv2JefERzJXATRh4LHOUwAHD4S7OGEztRJaN86hAUxtaNWDUf/bRdDBbQMWVDAO8jn89WUhag1MeyCAh6hHofyrliLgZKggDMYgzF3eVAwFq0uCZq5KY0TezjIHDDzC0qqmkwe2ctGDOQVLMkgu+F3/rGXwb4xIPcJ6P3JgkM8wFjmfcFAWfeKQywaAz33BJVuHsUcAt09gVbuLDThAJkdR687ggLmf4gDJLIGV7BydtB8yn3u+fbtuj/LS7G9wZAd1AKK+yxJ1x+aBmibTtgCcEHGHsh0wdbOgNLek4L7lI5BigY8nWuZUQ3qGEXes9JzOKGJztPaGtLslu3lIXJirdxCWkASHGDTMqg7V1DKPplygDG61YJukLHjEErGSXqCSos6xNSOgzP3BDmsQBcchNwkoV8oiNnPA78zIefUgCdJeGIfE7LmFWXsFTCFdzTJ/RlfEMRiSGnFXXbkC7AIeqcKDu4ynseozeouKJiSEYBDwkJyIC1nRUjgblkNWp/e/1vXc2gjoAoLksYgjrrFMi0oDgjEEIDij1scBXMJSH6DAj6RNl7o8MkuLak8Co15/Pk+MRmT0xilQJV/sdWNKg2kTaeroudvNNsDjmejYjSL+e6v2/2r4Cp4BXNajr0H7hRfAAAAAElFTkSuQmCC)}.ip-geo-block-icon-lock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3Ny3y9Zzq8dRmb7M1dlXnsIFdK0AcawAcqwphrYAcKvZ29wAb6oJd680jrqlw9MBcqxmo8MUfbJLl75eoMI7kbzX2ttqp8VSmL1YnL8NeK+Tu89DlL1ImMEOebBNmL4OkqMoAAAAAXRSTlMAQObYZgAAAPlJREFUeAG9kAWyhTAQBIPOsCzufv9TPnf4Ll0CSbpmxXwNy3Yc23rz2fV8kPA99433AIQIiGDTCD0lojiOQPXCDSFJIbF16CMWItkQMkF+inZzSLYhFKLl+a9UKTZaqJTZJYtarZuo40chrv9CqJTN+behVi+Cm7RdDgRld6AMgLxrE/dxBz0BEjwBEmD/uIsWPAOAF9A+CE56ufSryr8oqfOYcBbQJ8YkES7COkFOYzTypqCDOTDo2wljaEw4vp1APYyWKd8WMBozylvCpcvmXeHQ5fCegHia4s1FgZcIVeVFeFx1M4MvYG4eBHdYWufC+addBtf8E3vdjBNhWnVQqAAAAABJRU5ErkJggg==)}.ip-geo-block-icon-unlock span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NyzydRzq8dRmb7I09hYnsEFdK0AcawAcqzP1toqhrYAcKvZ29wAb6oMeK8zjbqrxtQBcazBz9Zko8MVfbLF0thMmL07kbtpp8WjwtJSmL1YnL+Tu89DlL1JmMEPebBFV++UAAAAAXRSTlMAQObYZgAAAONJREFUeAG9kAWChDAMAIMmJaTFXf7/ynXflvMbnE5j8DU8Pwh8D1yEUYxEGEchWFEJEjEflESBhTQSQm2MRpIotQhZTmgKgMIg5ZlFKBmrGg7UFXJpEQKW8qIKN7YeikJdBJI2BTtXwfyx0L3XoPphvBEliNU49OoxqEa6g4cTST/OYshvi3hV8+FxSNfluG3jqxG8C6h7gF6jU+AODnTsFGSCA5O4I8wpQDq7I5CUAKWQW+AZYOYtoQPoGDeECWDaioBmWQxeBduoWURso+5WpBdw7R4ENTVDcGE435tJwT+xB+vMEnZRNB0YAAAAAElFTkSuQmCC)}.ip-geo-block-icon-find span{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAYFBMVEXc3NzS19rD0NWHtMpGk7kYfbAGda0Req+WtcTT1temwM4AcasAcqwAc6wAcKydvMt1pr8Ab6pqpcLX2doggrKoxdNYm7yzw8u/y9HO1tkKdq4th7Td3t6DrcLL0taxyNPGe/YhAAAAAXRSTlMAQObYZgAAARVJREFUeAGtkkeiwyAMRP2xDfxoRjElvd3/lOkNUlZ5u0GPruan/Bnz96Xadr21rvP/7+ujXsAjom78rj4ApCoERIipqfGB1H7wPmYhw1DXjZI6nOel1oJhVAmdUP0tTEDkVC4AYvqIbaDOCqFV6vwRF0tIeYoo6J/X7ICuPAJl9ZynwiIfB5DXxZlRChulbh8xZci0EHZK3TziJFDL504rEOZ+iR5cVj82DoS7XtSshLJpKqaB0Dg3ZjcsQWKaKiF1gVQlITwh/bw2pgKeEeURhE29yKSzUFF03p1V7Wqj2Y7GfrY9X/NirJsPxKsxfBLSSs5GmH8yjAWPSNd8Yoez4f4/G1nIsksqFtGK1i9e39o0P+EAqaoRLlQ+r94AAAAASUVORK5CYII=)}.ip-geo-block-icon-alert span,span.ip-geo-block-icon-alert{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAkFBMVEXc3Nzc2trWl5DHRDTFOyvOgXfc1tXCLBrEMiHEMyLNcmfaxMLDMSDDLx7bu7jRiYHDLhzDMB/LX1PaxsTDLh3YtrHMY1bWmpPJVknSjYXUkYnZuLTMZVnENCPWlI3QhXzENiXXrqrDLRzXsa3Oal7Pe3Hc2NjVn5nNbmPayMbbwb7ay8rUj4fc09Lbw8Db0dDBbRUDAAAAAXRSTlMAQObYZgAAAPVJREFUeAG9ktXWwyAQBonC12brFvff5f2frr4nBredK2DnTFS8Gst2XM8XZmypIGeWcT4PFABaGIXlClfWG1NiC4Ubu705oKRcY32wTAHl2MdTYEqEK8hIiHgHSnSJeaogMyEWO4BijZCvwII2MS9UJ2BXTh+hQidoEttboBOwq3WBnkCNpQlA2iyAhol2hRu71n97p4fw0Z9/ugoPHCfFA+o/iLfCkyBglRJdICBas7uuey+R56fF14wNanj+/QjwY3aX23cBFn6EiHmHNT/ICYxystv/wJy4UHWGlN2cuPB72tFqAq3dP/Hk3zs0E5LZVryGC/hqGNnUa0SVAAAAAElFTkSuQmCC);vertical-align:bottom}table.form-table th .ip-geo-block-cycle span{vertical-align:text-bottom}.ip-geo-block-list{margin-top:0;margin-bottom:.7em}@media screen and (min-width:782px){ul.ip-geo-block-list .code{width:15em}}.ip-geo-block-list-exceptions label{display:inline-block}.ip-geo-block-list-exceptions dfn{border:none}.dataTables_wrapper.no-footer .dataTables_scrollBody,table.dataTable.no-footer,table.dataTable>thead>tr>td,table.dataTable>thead>tr>th{border-bottom:1px solid #ddd}.ip-geo-block-list-exceptions span.dashicons{font-size:14px}.ip-geo-block-list-exceptions a.ip-geo-block-icon{margin-left:.3em}.form-table td p.ip-geo-block-desc,.form-table td p.ip-geo-block-find-desc{color:#666;font-size:13px!important;margin:4px 0 .5em .5em}.ip-geo-block-find-desc{display:none}.ip-geo-block-admin-post{color:#c43322;margin-left:.25em}.ip-geo-block-warn{color:#c43322;font-weight:700}input#ip_geo_block_settings_behavior_time,input#ip_geo_block_settings_behavior_view{width:3.5em}.ip-geo-block-top-list{display:inline-table;list-style-position:outside;margin:0 2em .5em 1.75em}.ip-geo-block-top-list h4{margin:1em 0}.ip-geo-block-top-list li code{background:0 0}.ip-geo-block-network{margin-bottom:1em}.ip-geo-block-container{margin:0 auto;padding:0 1em;position:relative;width:100%}.ip-geo-block-row{display:flex;flex-direction:column;align-items:flex-start;align-items:stretch;padding:0;width:100%}.ip-geo-block-row .ip-geo-block-column{display:block;flex:1 1 auto;align-self:flex-start;margin-left:0;max-width:100%;width:100%}.ip-geo-block-row .ip-geo-block-column.column-20{flex:0 0 20%;max-width:20%}.ip-geo-block-row .ip-geo-block-column.column-25{flex:0 0 25%;max-width:25%}.ip-geo-block-row .ip-geo-block-column.column-33{flex:0 0 33.3333%;max-width:33.3333%}.ip-geo-block-row .ip-geo-block-column.column-50{flex:0 0 50%;max-width:50%}@media (min-width:40rem){.ip-geo-block-row{flex-direction:row;margin-left:-2em;width:calc(100% + 2em)}.ip-geo-block-row .ip-geo-block-column{margin-bottom:inherit;padding:0 1em}}table.dataTable{clear:none!important}table.dataTable td,table.dataTable th{text-align:right}table.dataTable td:nth-child(n+2),table.dataTable th:nth-child(n+2){padding-left:0!important}table.dataTable th{white-space:nowrap}table.dataTable>thead>tr{line-height:1.8em}table.dataTable thead td,table.dataTable thead th{padding:10px 16px}#ip-geo-block-statistics-cache td:nth-child(3),#ip-geo-block-validation-logs td:nth-child(4){min-width:1.6em}table.dataTable.nowrap td,table.dataTable>tbody>tr>td span{white-space:normal!important;word-wrap:break-word!important;word-break:break-all!important}table.dataTable>tbody>tr>td span{display:inline-block}.ip-geo-block-settings-folding input[type=checkbox]{margin-right:.5em}table.dataTable input[type=checkbox]{max-height:16px;max-width:16px;margin:0}table.dataTable>tbody>tr>td:first-child,table.dataTable>thead>tr>th:first-child{padding:8px 4px 8px 1.4em;text-align:left}table.collapsed>tbody>tr>td.dataTables_empty:first-child::before,table.dataTable>tbody>tr>td.dataTables_empty{border:none;text-align:center}table.dataTable thead>tr>th:first-child.sorting_asc{background-image:none!important}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.display tbody tr:hover>.sorting_1{background-color:inherit!important}table.dataTable.collapsed>tbody>tr>td:first-child{padding:8px 4px 8px 8px!important}table.collapsed>tbody>tr.parent>td:first-child::before,table.collapsed>tbody>tr>td:first-child::before{content:'';height:0;width:0;display:inline-block;border-radius:0;border:5px solid transparent;box-shadow:none;position:relative;background-color:transparent}table.collapsed>tbody>tr>td:first-child::before{border-left:5px solid #555;top:1px;left:-2px}table.collapsed>tbody>tr.parent>td:first-child::before{border-top:5px solid #555;top:4px;left:-4px}table.collapsed>tbody>tr.child>td:first-child::before{border:none}table.collapsed>tbody>tr.child>td.child>ul li{border:none;padding:0;margin:0;line-height:1.8em}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data,table.collapsed>tbody>tr.child>td.child>ul li span.dtr-title{font-size:13px!important;display:block;white-space:normal;word-wrap:break-word;word-break:break-all}table.collapsed>tbody>tr.child>td.child>ul li span.dtr-data{margin-left:1.25em;margin-right:.3em}.dataTables_wrapper .dataTables_paginate{float:none;text-align:center;margin-bottom:1em}.dataTables_wrapper .dataTables_paginate a.paginate_button,.dataTables_wrapper .dataTables_paginate a.paginate_button.current,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate a.paginate_button:active,.dataTables_wrapper .dataTables_paginate a.paginate_button:hover,.dataTables_wrapper .dataTables_paginate span.ellipsis{min-width:2em;background:inherit;border-color:#ddd;border-radius:0;border-image:none;border-style:solid;border-width:1px 1px 1px 0;box-shadow:none;margin:.5em 0 0;padding:.25em 0;display:inline-block;text-decoration:none}#ip-geo-block-1 #ip-geo-block-section-2 .panel-body,#ip-geo-block-4 #ip-geo-block-section-0 .panel-body,mark{padding:0}.dataTables_wrapper .dataTables_paginate:active>a.paginate_button:first-child,.dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:first-child,.dataTables_wrapper .dataTables_paginate>a.paginate_button:first-child{border-left-width:1px;border-bottom-left-radius:4px;border-top-left-radius:4px}.dataTables_wrapper .dataTables_paginate:active>a.paginate_button:last-child,.dataTables_wrapper .dataTables_paginate:hover>a.paginate_button:last-child,.dataTables_wrapper .dataTables_paginate>a.paginate_button:last-child{border-bottom-right-radius:4px;border-top-right-radius:4px}.dataTables_wrapper .dataTables_paginate a.paginate_button{color:#0073aa!important}.dataTables_wrapper .dataTables_paginate a.paginate_button:hover{color:#0096dd!important;background-color:#fff}.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate span.ellipsis{cursor:default;color:#999!important;background-color:transparent}.dataTables_wrapper .dataTables_paginate a.paginate_button.current,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:active,.dataTables_wrapper .dataTables_paginate a.paginate_button.current:hover{cursor:default;color:#444!important;background-color:#fff!important}#ip-geo-block-1 #ip-geo-block-section-2 table.form-table,#ip-geo-block-4 #ip-geo-block-section-0 table.form-table{margin-left:1em;max-width:95%}#ip-geo-block-live-log,#ip-geo-block-select-duration,#ip-geo-block-select-layout,#ip-geo-block-select-target{margin:0}#ip-geo-block-select-duration li,#ip-geo-block-select-layout li,#ip-geo-block-select-target li{float:left;margin-right:1.5em}#ip-geo-block-select-duration li label,#ip-geo-block-select-target li label{cursor:pointer}#ip_geo_block_settings_search_filter{width:16em;padding-top:3px}table.dataTable.display tbody tr.ip-geo-block-passed{background-color:#edf6ff!important}table.dataTable.display tbody tr.ip-geo-block-blocked{background-color:#ffefef!important}.ip-geo-block-new-passed{animation:ip-geo-block-flash-passed 1s ease-out 0s 1 normal both running}.ip-geo-block-new-blocked{animation:ip-geo-block-flash-blocked 1s ease-out 0s 1 normal both running}@keyframes ip-geo-block-flash-passed{0%{background-color:gold}100%{background-color:#edf6ff}}@keyframes ip-geo-block-flash-blocked{0%{background-color:gold}100%{background-color:#ffefef}}mark{background:gold}#ip-geo-block-live-log li{float:left;margin-right:3em}#ip-geo-block-live-log li:last-child{margin-right:0}#ip-geo-block-live-log li input[type=radio]{visibility:hidden;position:absolute}#ip-geo-block-live-log li input[type=radio]+label{display:inline-block;margin:-2px -2px 0;padding:4px 12px;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);border-bottom-color:#b3b3b3;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}#ip-geo-block-live-log li input[type=radio]:checked+label{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);background-color:#e0e0e0}.ip-geo-block-live-timer{height:1em;width:1em;margin:0;position:relative;top:0;left:0}.ip-geo-block-live-timer:before{content:"";display:block;height:1em;width:1em;background:radial-gradient(#0073aa,#72777c);border-radius:50%;position:absolute;top:0;left:0}.ip-geo-block-live-timer:after{display:none}.ip-geo-block-live-timer>div{position:absolute;width:1em;height:1em;clip:rect(0,1em,1em,.5em)}.ip-geo-block-live-timer>div:before{content:" ";position:absolute;width:1em;height:1em;border-radius:.5em;clip:rect(0,.5em,1em,0);background-color:#f1f1f1;transform:rotate(0)}.ip-geo-block-live-timer>div:first-child:before{animation:30s spin-timer linear forwards}.ip-geo-block-live-timer>div:last-child{transform:rotate(180deg)}.ip-geo-block-live-timer>div:last-child:before{transform:rotate(.00001deg);animation:30s spin-timer linear 30s forwards}@keyframes spin-timer{0%{transform:rotate(0)}100%{transform:rotate(180deg)}}:placeholder-shown{color:#888}::-webkit-input-placeholder{color:#888}:-moz-placeholder{color:#888;opacity:1}::-moz-placeholder{color:#888;opacity:1}:-ms-input-placeholder{color:#888}
admin/includes/class-admin-ajax.php CHANGED
@@ -25,9 +25,7 @@ class IP_Geo_Block_Admin_Ajax {
25
$res = $geo->get_location( $ip, $tmp );
26
else
27
$res = array( 'errorMessage' => 'Unknown service.' );
28
- }
29
-
30
- else {
31
$res = array( 'errorMessage' => 'Invalid IP address.' );
32
}
33
@@ -61,7 +59,7 @@ class IP_Geo_Block_Admin_Ajax {
61
$ip = IP_Geo_Block::get_ip_address();
62
$args = IP_Geo_Block::get_request_headers( $options );
63
$type = IP_Geo_Block_Provider::get_providers( 'type', FALSE, FALSE );
64
- $providers = IP_Geo_Block_Provider::get_valid_providers( $options['providers'], FALSE, FALSE );
65
66
$res['IP address'] = esc_html( $ip );
67
@@ -138,8 +136,11 @@ class IP_Geo_Block_Admin_Ajax {
138
139
foreach ( $rows as $row ) {
140
$row = array_map( 'esc_html', $row );
141
- if ( $options['anonymize'] )
142
- $row[2] = preg_replace( '/\d{1,3}#x2F;', '***', $row[2] );
143
144
$res[] = array(
145
/* 0 Checkbox */ '',
@@ -169,49 +170,68 @@ class IP_Geo_Block_Admin_Ajax {
169
return array( 'data' => self::format_logs( IP_Geo_Block_Logs::restore_logs( $which ) ) ); // DataTables requires `data`
170
}
171
172
/**
173
* Restore and reset live log in SQLite
174
*
175
*/
176
public static function restore_live_log( $hook, $settings ) {
177
if ( ! is_wp_error( $res = IP_Geo_Block_Logs::restore_live_log( $hook, $settings ) ) )
178
return array( 'data' => self::format_logs( $res ) ); // DataTables requires `data`
179
else
180
return array( 'error' => $res->get_error_message() );
181
}
182
183
- public static function reset_live_log() {
184
- require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-file.php';
185
- $fs = IP_Geo_Block_FS::init( 'reset_live_log' );
186
-
187
- if ( FALSE !== ( $files = scandir( $dir = get_temp_dir(), 1 ) ) ) {
188
- foreach ( $files as $file ) {
189
- if ( FALSE !== strpos( $file, IP_Geo_Block::PLUGIN_NAME ) ) {
190
- $fs->delete( $dir . $file );
191
- }
192
- }
193
- }
194
-
195
- return TRUE;
196
- }
197
-
198
/**
199
* Restore cache from MySQL DB
200
*
201
* @param string $which 'comment', 'xmlrpc', 'login', 'admin' or 'public'
202
*/
203
- public static function restore_cache( $which ) {
204
- $options = IP_Geo_Block::get_option();
205
$time = time();
206
$res = array();
207
208
foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
209
- if ( $options['anonymize'] )
210
- $key = preg_replace( '/\d{1,3}#x2F;', '***', $key );
211
212
$res[] = array(
213
/* Checkbox */ '',
214
- /* IP address */ '<span><a href="#!">' . esc_html( $key ) . '</a></span>',
215
/* Country code */ '<span>' . esc_html( $val['code'] ) . '</span>',
216
/* AS number */ '<span>' . esc_html( $val['asn' ] ) . '</span>',
217
/* Host name */ '<span>' . esc_html( $val['host'] ) . '</span>',
@@ -432,6 +452,7 @@ endif; // TEST_RESTORE_NETWORK
432
'[black_list]',
433
'[extra_ips][white_list]',
434
'[extra_ips][black_list]',
435
'[signature]',
436
'[login_fails]',
437
'[response_code]',
@@ -488,24 +509,12 @@ endif; // TEST_RESTORE_NETWORK
488
'[public][behavior]', // 3.0.10
489
'[behavior][time]', // 3.0.10
490
'[behavior][view]', // 3.0.10
491
- '[providers][Geolite2]', // 3.0.8
492
- '[providers][Maxmind]',
493
- '[providers][IP2Location]',
494
- '[providers][freegeoip.net]',
495
- '[providers][ipinfo.io]',
496
- '[providers][IP-Json]',
497
- '[providers][Nekudo]',
498
- '[providers][Xhanch]',
499
- '[providers][GeoIPLookup]', // 2.2.8
500
- '[providers][ip-api.com]',
501
- '[providers][IPInfoDB]',
502
'[save_statistics]',
503
'[validation][reclogs]',
504
'[validation][recdays]', // 2.2.9
505
'[validation][maxlogs]',
506
'[validation][postkey]',
507
'[update][auto]',
508
- '[anonymize]',
509
'[cache_time_gc]', // 3.0.0
510
'[cache_hold]',
511
'[cache_time]',
@@ -523,6 +532,11 @@ endif; // TEST_RESTORE_NETWORK
523
$json = array();
524
$prfx = IP_Geo_Block::OPTION_NAME;
525
526
foreach ( $keys as $key ) {
527
if ( preg_match( "/\[(.+?)\](?:\[(.+?)\](?:\[(.+?)\])?)?/", $key, $m ) ) {
528
switch ( count( $m ) ) {
@@ -784,7 +798,7 @@ endif; // TEST_RESTORE_NETWORK
784
}
785
786
// Blocked self requests
787
- $installed = array_reverse( IP_Geo_Block_Logs::search_logs( IP_Geo_Block::get_ip_address() ) );
788
foreach ( $installed as $val ) {
789
if ( IP_Geo_Block::is_blocked( $val['result'] ) ) {
790
// hide port and nonce
25
$res = $geo->get_location( $ip, $tmp );
26
else
27
$res = array( 'errorMessage' => 'Unknown service.' );
28
+ } else {
29
$res = array( 'errorMessage' => 'Invalid IP address.' );
30
}
31
59
$ip = IP_Geo_Block::get_ip_address();
60
$args = IP_Geo_Block::get_request_headers( $options );
61
$type = IP_Geo_Block_Provider::get_providers( 'type', FALSE, FALSE );
62
+ $providers = IP_Geo_Block_Provider::get_valid_providers( $options, FALSE, FALSE );
63
64
$res['IP address'] = esc_html( $ip );
65
136
137
foreach ( $rows as $row ) {
138
$row = array_map( 'esc_html', $row );
139
+
140
+ if ( $options['anonymize'] ) {
141
+ $row[2] = IP_Geo_Block_Util::anonymize_ip( $row[2] );
142
+ $row[8] = IP_Geo_Block_Util::anonymize_ip( $row[8] );
143
+ }
144
145
$res[] = array(
146
/* 0 Checkbox */ '',
170
return array( 'data' => self::format_logs( IP_Geo_Block_Logs::restore_logs( $which ) ) ); // DataTables requires `data`
171
}
172
173
+ /**
174
+ * Catch and release the authority for live log
175
+ *
176
+ * @return TRUE or WP_Error
177
+ */
178
+ public static function catch_live_log() {
179
+ $user = IP_Geo_Block_Util::get_current_user_id();
180
+ $auth = get_transient( IP_Geo_Block::PLUGIN_NAME . '-live-log' );
181
+
182
+ if ( $auth === FALSE || $user === (int)$auth ) {
183
+ set_transient( IP_Geo_Block::PLUGIN_NAME . '-live-log', $user, IP_Geo_Block_Admin::TIMEOUT_LIVE_UPDATE );
184
+ return TRUE;
185
+ } else {
186
+ $info = get_userdata( $auth );
187
+ return new WP_Error( 'Warn', sprintf( __( 'The user %s (user ID: %d) is in use.', 'ip-geo-block' ), $info->user_login, $auth ) );
188
+ }
189
+ }
190
+
191
+ public static function release_live_log() {
192
+ if ( is_wp_error( $result = self::catch_live_log() ) )
193
+ return $result;
194
+
195
+ delete_transient( IP_Geo_Block::PLUGIN_NAME . '-live-log' );
196
+ return TRUE;
197
+ }
198
+
199
/**
200
* Restore and reset live log in SQLite
201
*
202
*/
203
+ public static function reset_live_log() {
204
+ return IP_Geo_Block_Logs::reset_sqlite_db();
205
+ }
206
+
207
public static function restore_live_log( $hook, $settings ) {
208
+ if ( is_wp_error( $ret = self::catch_live_log() ) )
209
+ return $ret;
210
+
211
if ( ! is_wp_error( $res = IP_Geo_Block_Logs::restore_live_log( $hook, $settings ) ) )
212
return array( 'data' => self::format_logs( $res ) ); // DataTables requires `data`
213
else
214
return array( 'error' => $res->get_error_message() );
215
}
216
217
/**
218
* Restore cache from MySQL DB
219
*
220
* @param string $which 'comment', 'xmlrpc', 'login', 'admin' or 'public'
221
*/
222
+ public static function restore_cache( $which, $anonymize ) {
223
$time = time();
224
$res = array();
225
226
foreach ( IP_Geo_Block_Logs::restore_cache() as $key => $val ) {
227
+ if ( $anonymize ) {
228
+ $key = IP_Geo_Block_Util::anonymize_ip( $key );
229
+ $val['host'] = IP_Geo_Block_Util::anonymize_ip( $val['host'] );
230
+ }
231
232
$res[] = array(
233
/* Checkbox */ '',
234
+ /* IP address */ '<span><a href="#!" data-hash="' . esc_attr( $val['hash'] ). '">' . esc_html( $key ) . '</a></span>',
235
/* Country code */ '<span>' . esc_html( $val['code'] ) . '</span>',
236
/* AS number */ '<span>' . esc_html( $val['asn' ] ) . '</span>',
237
/* Host name */ '<span>' . esc_html( $val['host'] ) . '</span>',
452
'[black_list]',
453
'[extra_ips][white_list]',
454
'[extra_ips][black_list]',
455
+ '[anonymize]',
456
'[signature]',
457
'[login_fails]',
458
'[response_code]',
509
'[public][behavior]', // 3.0.10
510
'[behavior][time]', // 3.0.10
511
'[behavior][view]', // 3.0.10
512
'[save_statistics]',
513
'[validation][reclogs]',
514
'[validation][recdays]', // 2.2.9
515
'[validation][maxlogs]',
516
'[validation][postkey]',
517
'[update][auto]',
518
'[cache_time_gc]', // 3.0.0
519
'[cache_hold]',
520
'[cache_time]',
532
$json = array();
533
$prfx = IP_Geo_Block::OPTION_NAME;
534
535
+ // add providers
536
+ foreach ( array_keys( IP_Geo_Block_Provider::get_providers( 'key' ) ) as $key ) {
537
+ $keys[] = '[providers][' . $key . ']';
538
+ }
539
+
540
foreach ( $keys as $key ) {
541
if ( preg_match( "/\[(.+?)\](?:\[(.+?)\](?:\[(.+?)\])?)?/", $key, $m ) ) {
542
switch ( count( $m ) ) {
798
}
799
800
// Blocked self requests
801
+ $installed = array_reverse( IP_Geo_Block_Logs::search_logs( IP_Geo_Block::get_ip_address(), IP_Geo_Block::get_option() ) );
802
foreach ( $installed as $val ) {
803
if ( IP_Geo_Block::is_blocked( $val['result'] ) ) {
804
// hide port and nonce
admin/includes/tab-accesslog.php CHANGED
@@ -112,6 +112,7 @@ if ( $options['validation']['reclogs'] ):
112
'value' => 0,
113
'list' => array(
114
0 => NULL,
115
'bulk-action-ip-white' => __( 'Add IP address to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
116
'bulk-action-ip-black' => __( 'Add IP address to &#8220;Blacklist&#8221;', 'ip-geo-block' ), ) + ( $options['Maxmind']['use_asn'] <= 0 ? array() : array(
117
'bulk-action-as-white' => __( 'Add AS number to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
@@ -172,7 +173,6 @@ endif; // $options['validation']['reclogs']
172
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 5 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-5' );
173
echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord &#8220;Logs&#8221;%s ] is desabled.', 'ip-geo-block' ), '<a href="' . $url . '"><strong>', '</strong></a>' ), '</p>', "\n";
174
echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
175
- // self::validation_logs();
176
}
177
178
}
112
'value' => 0,
113
'list' => array(
114
0 => NULL,
115
+ 'bulk-action-ip-erase' => __( 'Remove entries by IP address', 'ip-geo-block' ),
116
'bulk-action-ip-white' => __( 'Add IP address to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
117
'bulk-action-ip-black' => __( 'Add IP address to &#8220;Blacklist&#8221;', 'ip-geo-block' ), ) + ( $options['Maxmind']['use_asn'] <= 0 ? array() : array(
118
'bulk-action-as-white' => __( 'Add AS number to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
173
$url = esc_url( add_query_arg( array( 'page' => IP_Geo_Block::PLUGIN_NAME, 'tab' => '0', 'sec' => 5 ), $context->dashboard_url() ) . '#' . IP_Geo_Block::PLUGIN_NAME . '-section-5' );
174
echo '<p style="padding:0 1em">', sprintf( __( '[ %sRecord &#8220;Logs&#8221;%s ] is desabled.', 'ip-geo-block' ), '<a href="' . $url . '"><strong>', '</strong></a>' ), '</p>', "\n";
175
echo '<p style="padding:0 1em">', __( 'Please set the proper condition to record and analyze the validation logs.', 'ip-geo-block' ), '</p>', "\n";
176
}
177
178
}
admin/includes/tab-geolocation.php CHANGED
@@ -55,13 +55,12 @@ class IP_Geo_Block_Admin_Tab {
55
// preset IP address
56
if ( isset( $_GET['s'] ) ) {
57
$list = preg_replace(
58
- array( '!\.\*\*\*!', '!\*\*\*!' ),
59
- array( '.0', '000' ),
60
$_GET['s']
61
); // Anonymize IP address
62
$list = filter_var( $list, FILTER_VALIDATE_IP ) ? $list : '';
63
- }
64
- else {
65
$list = '';
66
}
67
@@ -80,6 +79,22 @@ class IP_Geo_Block_Admin_Tab {
80
)
81
);
82
83
$field = 'get_location';
84
add_settings_field(
85
$option_name.'_'.$field,
55
// preset IP address
56
if ( isset( $_GET['s'] ) ) {
57
$list = preg_replace(
58
+ array( '/\.\*\*\*.*#x2F;', '/\*\*\*.*#x2F;' ),
59
+ array( '.0', '000' ),
60
$_GET['s']
61
); // Anonymize IP address
62
$list = filter_var( $list, FILTER_VALIDATE_IP ) ? $list : '';
63
+ } else {
64
$list = '';
65
}
66
79
)
80
);
81
82
+ // Anonymize IP address
83
+ $field = 'anonymize';
84
+ add_settings_field(
85
+ $option_name.'_'.$field,
86
+ __( '<dfn title="IP address is always encrypted on recording in logs and cache. Moreover, this option makes the IP address anonymous and restricted on sending to the 3rd parties such as geolocation APIs or whois service.">Privacy friendly</dfn>', 'ip-geo-block' ),
87
+ array( $context, 'callback_field' ),
88
+ $option_slug,
89
+ $section,
90
+ array(
91
+ 'type' => 'checkbox',
92
+ 'option' => $option_name,
93
+ 'field' => $field,
94
+ 'value' => ! empty( $options[ $field ] ) ? TRUE : FALSE,
95
+ )
96
+ );
97
+
98
$field = 'get_location';
99
add_settings_field(
100
$option_name.'_'.$field,
admin/includes/tab-settings.php CHANGED
@@ -299,6 +299,7 @@ endif;
299
$list .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the capabilities to be verified. Depending on the particular type of uploader, certain capability may be required. Default is &#8220;upload_files&#8221; for Administrator, Editor and Author. This verification will be skipped if empty.">Capabilities to be verified</dfn>', 'ip-geo-block' ) . '&nbsp;<span class="ip-geo-block-desc">' . __( '(&thinsp;See &#8220;<a rel="noreferrer" href="https://codex.wordpress.org/Roles_and_Capabilities" title="Roles and Capabilities &laquo; WordPress Codex">Roles and Capabilities</a>&#8221;&thinsp;)', 'ip-geo-block' ) . '</span>' . "\n";
300
$list .= '<li class="ip-geo-block-hide"><ul><li><input type="text" id="ip_geo_block_settings_mimetype_capability" name="ip_geo_block_settings[mimetype][capability]" class="regular-text code" placeholder="upload_files" value="' . esc_attr( implode( ',', $options['mimetype']['capability'] ) ) . '" />' . $comma[0] . '</li></ul></li></ul>';
301
302
$field = 'validation';
303
$key = 'mimetype';
304
add_settings_field(
@@ -391,7 +392,7 @@ endif;
391
$field = 'login_fails';
392
add_settings_field(
393
$option_name.'_'.$field,
394
- __( '<dfn title="This is applied to &#8220;XML-RPC&#8221; and &#8220;Login form&#8221;. Lockout period is defined as expiration time at &#8220;Cache settings&#8221;.">Max number of failed login attempts per IP address</dfn>', 'ip-geo-block' ),
395
array( $context, 'callback_field' ),
396
$option_slug,
397
$section,
@@ -757,7 +758,7 @@ endif;
757
);
758
759
/*----------------------------------------*
760
- * Front-end settings
761
*----------------------------------------*/
762
add_settings_section(
763
$section = $plugin_slug . '-public',
@@ -1084,104 +1085,20 @@ endif;
1084
);
1085
1086
/*----------------------------------------*
1087
- * Geolocation service settings
1088
*----------------------------------------*/
1089
add_settings_section(
1090
- $section = $plugin_slug . '-provider',
1091
- __( 'Geolocation API settings', 'ip-geo-block' ),
1092
- array( __CLASS__, 'note_services' ),
1093
$option_slug
1094
);
1095
1096
- // API selection and key settings
1097
- $field = 'providers';
1098
- add_settings_field(
1099
- $option_name.'_'.$field,
1100
- __( '<dfn title="Cache and local database are scanned at the top priority.">API selection and key settings</dfn>', 'ip-geo-block' ),
1101
- array( $context, 'callback_field' ),
1102
- $option_slug,
1103
- $section,
1104
- array(
1105
- 'type' => 'check-provider',
1106
- 'option' => $option_name,
1107
- 'field' => $field,
1108
- 'value' => $options[ $field ],
1109
- 'providers' => IP_Geo_Block_Provider::get_providers( 'key' ),
1110
- 'titles' => IP_Geo_Block_Provider::get_providers( 'type' ),
1111
- )
1112
- );
1113
-
1114
- if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1115
- // Timeout for network API
1116
- $field = 'timeout';
1117
add_settings_field(
1118
$option_name.'_'.$field,
1119
- __( 'Timeout for network API [sec]', 'ip-geo-block' ),
1120
- array( $context, 'callback_field' ),
1121
- $option_slug,
1122
- $section,
1123
- array(
1124
- 'type' => 'text',
1125
- 'option' => $option_name,
1126
- 'field' => $field,
1127
- 'value' => $options[ $field ],
1128
- )
1129
- );
1130
- endif;
1131
-
1132
- /*----------------------------------------*
1133
- * Local database settings
1134
- *----------------------------------------*/
1135
- // Local DBs for each API
1136
- $providers = IP_Geo_Block_Provider::get_addons( $options['providers'] );
1137
- if ( empty( $providers ) ) {
1138
- $context->add_admin_notice( 'error', sprintf(
1139
- __( 'Can not find geolocation API libraries in <code>%s</code>. It seems to have failed downloading <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API/archive/master.zip" title="Download the contents of tokkonopapa/WordPress-IP-Geo-API as a zip file">ZIP file</a> from <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API" title="tokkonopapa/WordPress-IP-Geo-API - GitHub">WordPress-IP-Geo-API</a>. Please install <code>ip-geo-api</code> with write permission according to <a rel="noreferrer" href="http://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How can I fix permission troubles? | IP Geo Block">this instruction</a>.', 'ip-geo-block' ),
1140
- apply_filters( 'ip-geo-block-api-dir', basename( WP_CONTENT_DIR ) )
1141
- ) );
1142
- }
1143
-
1144
- add_settings_section(
1145
- $section = $plugin_slug . '-database',
1146
- array( __( 'Local database settings', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/geolocation-api-library.html" title="Geolocation API library | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>'),
1147
- array( __CLASS__, 'note_database' ),
1148
- $option_slug
1149
- );
1150
-
1151
- foreach ( $providers as $provider ) {
1152
- if ( $geo = IP_Geo_Block_API::get_instance( $provider, NULL ) ) {
1153
- $geo->add_settings_field(
1154
- $provider,
1155
- $section,
1156
- $option_slug,
1157
- $option_name,
1158
- $options,
1159
- array( $context, 'callback_field' ),
1160
- __( 'database', 'ip-geo-block' ),
1161
- __( 'Last update: %s', 'ip-geo-block' )
1162
- );
1163
- }
1164
- }
1165
-
1166
- // Get the next schedule of cron
1167
- if ( ! ( $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) ) ) ) {
1168
- if ( is_multisite() ) {
1169
- global $wpdb;
1170
- $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
1171
- switch_to_blog( $blog_ids[0] ); // main blog
1172
- $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) );
1173
- restore_current_blog();
1174
- } else {
1175
- $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) );
1176
- }
1177
- }
1178
- $tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1179
-
1180
- // Auto updating (once a month)
1181
- $field = 'update';
1182
- add_settings_field(
1183
- $option_name.'_'.$field.'_auto',
1184
- __( 'Auto updating (once a month)', 'ip-geo-block' ),
1185
array( $context, 'callback_field' ),
1186
$option_slug,
1187
$section,
@@ -1189,45 +1106,15 @@ endif;
1189
'type' => 'checkbox',
1190
'option' => $option_name,
1191
'field' => $field,
1192
- 'sub-field' => 'auto',
1193
- 'value' => $options[ $field ]['auto'],
1194
- 'disabled' => empty( $providers ),
1195
- 'after' => $options[ $field ]['auto'] ? '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>' : '',
1196
- )
1197
- );
1198
-
1199
- // Download database
1200
- add_settings_field(
1201
- $option_name.'_'.$field.'_download',
1202
- __( 'Download database', 'ip-geo-block' ),
1203
- array( $context, 'callback_field' ),
1204
- $option_slug,
1205
- $section,
1206
- array(
1207
- 'type' => 'button',
1208
- 'option' => $option_name,
1209
- 'field' => $field,
1210
- 'value' => __( 'Download now', 'ip-geo-block' ),
1211
- 'disabled' => empty( $providers ),
1212
- 'after' => '<div id="ip-geo-block-download"></div>',
1213
)
1214
);
1215
1216
- /*----------------------------------------*
1217
- * Statistics and Logs settings
1218
- *----------------------------------------*/
1219
- add_settings_section(
1220
- $section = $plugin_slug . '-recording',
1221
- __( 'Statistics and Logs settings', 'ip-geo-block' ),
1222
- array( __CLASS__, 'note_record' ),
1223
- $option_slug
1224
- );
1225
-
1226
// Record "Statistics"
1227
$field = 'save_statistics';
1228
add_settings_field(
1229
$option_name.'_'.$field,
1230
- __( 'Record &#8220;Statistics&#8221;', 'ip-geo-block' ),
1231
array( $context, 'callback_field' ),
1232
$option_slug,
1233
$section,
@@ -1258,11 +1145,11 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1258
);
1259
endif;
1260
1261
- // Record validation logs
1262
$field = 'validation';
1263
add_settings_field(
1264
$option_name.'_'.$field.'_reclogs',
1265
- __( 'Record &#8220;Logs&#8221;', 'ip-geo-block' ),
1266
array( $context, 'callback_field' ),
1267
$option_slug,
1268
$section,
@@ -1302,7 +1189,7 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1302
);
1303
endif;
1304
1305
- // $_POST keys to be recorded with their values in logs
1306
add_settings_field(
1307
$option_name.'_'.$field.'_postkey',
1308
__( '<dfn title="e.g. action, comment, log, pwd, FILES">$_POST keys to be recorded with their values in &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ),
@@ -1319,22 +1206,6 @@ endif;
1319
)
1320
);
1321
1322
- // Anonymize IP address
1323
- $field = 'anonymize';
1324
- add_settings_field(
1325
- $option_name.'_'.$field,
1326
- __( '<dfn title="e.g. 123.456.789.***">Anonymize IP address</dfn>', 'ip-geo-block' ),
1327
- array( $context, 'callback_field' ),
1328
- $option_slug,
1329
- $section,
1330
- array(
1331
- 'type' => 'checkbox',
1332
- 'option' => $option_name,
1333
- 'field' => $field,
1334
- 'value' => ! empty( $options[ $field ] ) ? TRUE : FALSE,
1335
- )
1336
- );
1337
-
1338
if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1339
// Live update
1340
$field = 'live_update';
@@ -1381,21 +1252,27 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1381
);
1382
endif;
1383
1384
- /*----------------------------------------*
1385
- * Cache settings
1386
- *----------------------------------------*/
1387
- add_settings_section(
1388
- $section = $plugin_slug . '-cache',
1389
- __( 'IP address cache settings', 'ip-geo-block' ),
1390
- NULL,
1391
- $option_slug
1392
);
1393
1394
- // Expiration time [sec]
1395
$field = 'cache_time';
1396
add_settings_field(
1397
$option_name.'_'.$field,
1398
- sprintf( __( '<dfn title="If user authentication fails consecutively %d times, subsequent login will also be prohibited for this and garbage collection period.">Expiration time [sec]</dfn>', 'ip-geo-block' ), (int)$options['login_fails'] ),
1399
array( $context, 'callback_field' ),
1400
$option_slug,
1401
$section,
@@ -1411,11 +1288,11 @@ endif;
1411
$tmp = wp_next_scheduled( IP_Geo_Block::CACHE_NAME );
1412
$tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1413
1414
- // Garbage collection period [sec]
1415
$field = 'cache_time_gc';
1416
add_settings_field(
1417
$option_name.'_'.$field,
1418
- __( 'Garbage collection period [sec]', 'ip-geo-block' ),
1419
array( $context, 'callback_field' ),
1420
$option_slug,
1421
$section,
@@ -1428,12 +1305,53 @@ endif;
1428
)
1429
);
1430
1431
if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1432
- // Number of entries
1433
- $field = 'cache_hold';
1434
add_settings_field(
1435
$option_name.'_'.$field,
1436
- __( 'Number of entries to be displayed in cache', 'ip-geo-block' ),
1437
array( $context, 'callback_field' ),
1438
$option_slug,
1439
$section,
@@ -1446,6 +1364,88 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1446
);
1447
endif;
1448
1449
/*----------------------------------------*
1450
* Submission settings
1451
*----------------------------------------*/
@@ -1492,7 +1492,7 @@ endif;
1492
NULL,
1493
$option_slug
1494
);
1495
- if (0):
1496
// @see https://vedovini.net/2015/10/using-the-wordpress-settings-api-with-network-admin-pages/
1497
if ( is_main_site() && is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) {
1498
add_action( 'network_admin_edit_' . IP_Geo_Block::PLUGIN_NAME, array( $context, 'validate_network_settings' ) );
@@ -1657,8 +1657,8 @@ endif;
1657
public static function note_services() {
1658
echo
1659
'<ul class="ip-geo-block-note">', "\n",
1660
- '<li>', __( 'While Maxmind and IP2Location will fetch the local database, others will pass an IP address to the APIs via HTTP.', 'ip-geo-block' ), '</li>', "\n",
1661
- '<li>', __( 'Please select the appropriate APIs to fit the privacy law in your country.', 'ip-geo-block' ), '</li>', "\n",
1662
'</ul>', "\n";
1663
}
1664
299
$list .= '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the capabilities to be verified. Depending on the particular type of uploader, certain capability may be required. Default is &#8220;upload_files&#8221; for Administrator, Editor and Author. This verification will be skipped if empty.">Capabilities to be verified</dfn>', 'ip-geo-block' ) . '&nbsp;<span class="ip-geo-block-desc">' . __( '(&thinsp;See &#8220;<a rel="noreferrer" href="https://codex.wordpress.org/Roles_and_Capabilities" title="Roles and Capabilities &laquo; WordPress Codex">Roles and Capabilities</a>&#8221;&thinsp;)', 'ip-geo-block' ) . '</span>' . "\n";
300
$list .= '<li class="ip-geo-block-hide"><ul><li><input type="text" id="ip_geo_block_settings_mimetype_capability" name="ip_geo_block_settings[mimetype][capability]" class="regular-text code" placeholder="upload_files" value="' . esc_attr( implode( ',', $options['mimetype']['capability'] ) ) . '" />' . $comma[0] . '</li></ul></li></ul>';
301
302
+ // Prevent malicious file uploading
303
$field = 'validation';
304
$key = 'mimetype';
305
add_settings_field(
392
$field = 'login_fails';
393
add_settings_field(
394
$option_name.'_'.$field,
395
+ __( '<dfn title="This is applied to &#8220;XML-RPC&#8221; and &#8220;Login form&#8221;. Lockout period is defined as expiration time at &#8220;Privacy and record settings&#8221;.">Max number of failed login attempts per IP address</dfn>', 'ip-geo-block' ),
396
array( $context, 'callback_field' ),
397
$option_slug,
398
$section,
758
);
759
760
/*----------------------------------------*
761
+ * Front-end target settings
762
*----------------------------------------*/
763
add_settings_section(
764
$section = $plugin_slug . '-public',
1085
);
1086
1087
/*----------------------------------------*
1088
+ * Privacy and record settings
1089
*----------------------------------------*/
1090
add_settings_section(
1091
+ $section = $plugin_slug . '-recording',
1092
+ __( 'Privacy and record settings', 'ip-geo-block' ),
1093
+ array( __CLASS__, 'note_record' ),
1094
$option_slug
1095
);
1096
1097
+ // Privacy friendly
1098
+ $field = 'anonymize';
1099
add_settings_field(
1100
$option_name.'_'.$field,
1101
+ __( '<dfn title="IP address is always encrypted on recording in logs and cache. Moreover, this option makes the IP address anonymous and restricted on sending to the 3rd parties such as geolocation APIs or whois service.">Privacy friendly</dfn>', 'ip-geo-block' ),
1102
array( $context, 'callback_field' ),
1103
$option_slug,
1104
$section,
1106
'type' => 'checkbox',
1107
'option' => $option_name,
1108
'field' => $field,
1109
+ 'value' => ! empty( $options[ $field ] ),
1110
)
1111
);
1112
1113
// Record "Statistics"
1114
$field = 'save_statistics';
1115
add_settings_field(
1116
$option_name.'_'.$field,
1117
+ __( '<dfn title="This option enables to record the number blocked countries and the number of blocked requests per day.">Record &#8220;Statistics&#8221;</dfn>', 'ip-geo-block' ),
1118
array( $context, 'callback_field' ),
1119
$option_slug,
1120
$section,
1145
);
1146
endif;
1147
1148
+ // Record "Logs"
1149
$field = 'validation';
1150
add_settings_field(
1151
$option_name.'_'.$field.'_reclogs',
1152
+ __( '<dfn title="This option enables to record the validation logs including IP address.">Record &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ),
1153
array( $context, 'callback_field' ),
1154
$option_slug,
1155
$section,
1189
);
1190
endif;
1191
1192
+ // $_POST keys to be recorded with their values in "Logs"
1193
add_settings_field(
1194
$option_name.'_'.$field.'_postkey',
1195
__( '<dfn title="e.g. action, comment, log, pwd, FILES">$_POST keys to be recorded with their values in &#8220;Logs&#8221;</dfn>', 'ip-geo-block' ),
1206
)
1207
);
1208
1209
if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1210
// Live update
1211
$field = 'live_update';
1252
);
1253
endif;
1254
1255
+ // Record "IP address cache"
1256
+ $field = 'cache_hold';
1257
+ add_settings_field(
1258
+ $option_name.'_'.$field,
1259
+ __( '<dfn title="This option enables to record the IP address , country code and login fail counter into the cache on database to minimize the impact on site speed.">Record &#8220;IP address cache&#8221;</dfn>', 'ip-geo-block' ),
1260
+ array( $context, 'callback_field' ),
1261
+ $option_slug,
1262
+ $section,
1263
+ array(
1264
+ 'type' => 'checkbox',
1265
+ 'option' => $option_name,
1266
+ 'field' => $field,
1267
+ 'value' => $options[ $field ],
1268
+ )
1269
);
1270
1271
+ // Expiration time [sec] for IP address cache
1272
$field = 'cache_time';
1273
add_settings_field(
1274
$option_name.'_'.$field,
1275
+ sprintf( __( '<dfn title="If user authentication fails consecutively %d times, subsequent login will also be prohibited for this and garbage collection period.">Expiration time [sec] for &#8220;IP address cache&#8221;</dfn>', 'ip-geo-block' ), (int)$options['login_fails'] ),
1276
array( $context, 'callback_field' ),
1277
$option_slug,
1278
$section,
1288
$tmp = wp_next_scheduled( IP_Geo_Block::CACHE_NAME );
1289
$tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1290
1291
+ // Garbage collection period [sec] for IP address cache
1292
$field = 'cache_time_gc';
1293
add_settings_field(
1294
$option_name.'_'.$field,
1295
+ __( '<dfn title="This option enables to schedule the WP-Cron event to remove the expired entries of cache.">Garbage collection period [sec] for &#8220;IP address cache&#8221;</dfn>', 'ip-geo-block' ),
1296
array( $context, 'callback_field' ),
1297
$option_slug,
1298
$section,
1305
)
1306
);
1307
1308
+ /*----------------------------------------*
1309
+ * Geolocation API settings
1310
+ *----------------------------------------*/
1311
+ add_settings_section(
1312
+ $section = $plugin_slug . '-provider',
1313
+ __( 'Geolocation API settings', 'ip-geo-block' ),
1314
+ array( __CLASS__, 'note_services' ),
1315
+ $option_slug
1316
+ );
1317
+
1318
+ // Local DBs and APIs
1319
+ $provider = IP_Geo_Block_Provider::get_providers( 'key' ); // all available providers
1320
+ $providers = IP_Geo_Block_Provider::get_addons( $options['providers'] ); // only local
1321
+
1322
+ // Disable 3rd parties API in case of 'anonymize'
1323
+ if ( $options['anonymize'] ) {
1324
+ foreach ( array_keys( $provider ) as $key ) {
1325
+ if ( ! in_array( $key, $providers, TRUE ) )
1326
+ $provider[ $key ] = is_string( $provider[ $key ] ) ? '-1' : -1;
1327
+ }
1328
+ }
1329
+
1330
+ // API selection and key settings
1331
+ $field = 'providers';
1332
+ add_settings_field(
1333
+ $option_name.'_'.$field,
1334
+ __( '<dfn title="IP address cache and local database are scanned at the top priority.">API selection and key settings</dfn>', 'ip-geo-block' ),
1335
+ array( $context, 'callback_field' ),
1336
+ $option_slug,
1337
+ $section,
1338
+ array(
1339
+ 'type' => 'check-provider',
1340
+ 'option' => $option_name,
1341
+ 'field' => $field,
1342
+ 'value' => $options[ $field ],
1343
+ 'local' => $providers,
1344
+ 'providers' => $provider,
1345
+ 'titles' => IP_Geo_Block_Provider::get_providers( 'type' ),
1346
+ )
1347
+ );
1348
+
1349
if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1350
+ // Timeout for network API
1351
+ $field = 'timeout';
1352
add_settings_field(
1353
$option_name.'_'.$field,
1354
+ __( 'Timeout for network API [sec]', 'ip-geo-block' ),
1355
array( $context, 'callback_field' ),
1356
$option_slug,
1357
$section,
1364
);
1365
endif;
1366
1367
+ /*----------------------------------------*
1368
+ * Local database settings
1369
+ *----------------------------------------*/
1370
+ if ( empty( $providers ) ) {
1371
+ $context->add_admin_notice( 'error', sprintf(
1372
+ __( 'Can not find geolocation API libraries in <code>%s</code>. It seems to have failed downloading <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API/archive/master.zip" title="Download the contents of tokkonopapa/WordPress-IP-Geo-API as a zip file">ZIP file</a> from <a rel="noreferrer" href="https://github.com/tokkonopapa/WordPress-IP-Geo-API" title="tokkonopapa/WordPress-IP-Geo-API - GitHub">WordPress-IP-Geo-API</a>. Please install <code>ip-geo-api</code> with write permission according to <a rel="noreferrer" href="http://www.ipgeoblock.com/codex/how-to-fix-permission-troubles.html" title="How can I fix permission troubles? | IP Geo Block">this instruction</a>.', 'ip-geo-block' ),
1373
+ apply_filters( 'ip-geo-block-api-dir', basename( WP_CONTENT_DIR ) )
1374
+ ) );
1375
+ }
1376
+
1377
+ add_settings_section(
1378
+ $section = $plugin_slug . '-database',
1379
+ array( __( 'Local database settings', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/geolocation-api-library.html" title="Geolocation API library | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>'),
1380
+ array( __CLASS__, 'note_database' ),
1381
+ $option_slug
1382
+ );
1383
+
1384
+ foreach ( $providers as $provider ) {
1385
+ if ( $geo = IP_Geo_Block_API::get_instance( $provider, NULL ) ) {
1386
+ $geo->add_settings_field(
1387
+ $provider,
1388
+ $section,
1389
+ $option_slug,
1390
+ $option_name,
1391
+ $options,
1392
+ array( $context, 'callback_field' ),
1393
+ __( 'database', 'ip-geo-block' ),
1394
+ __( 'Last update: %s', 'ip-geo-block' )
1395
+ );
1396
+ }
1397
+ }
1398
+
1399
+ // Get the next schedule of cron
1400
+ if ( ! ( $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) ) ) ) {
1401
+ if ( is_multisite() ) {
1402
+ global $wpdb;
1403
+ $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
1404
+ switch_to_blog( $blog_ids[0] ); // main blog
1405
+ $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) );
1406
+ restore_current_blog();
1407
+ } else {
1408
+ $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) );
1409
+ }
1410
+ }
1411
+ $tmp = $tmp ? IP_Geo_Block_Util::localdate( $tmp ) : '<span class="ip-geo-block-warn">' . __( 'Task could not be found in WP-Cron. Please try to deactivate this plugin once and activate again.', 'ip-geo-block' ). '</span>';
1412
+
1413
+ // Auto updating (once a month)
1414
+ $field = 'update';
1415
+ add_settings_field(
1416
+ $option_name.'_'.$field.'_auto',
1417
+ __( 'Auto updating (once a month)', 'ip-geo-block' ),
1418
+ array( $context, 'callback_field' ),
1419
+ $option_slug,
1420
+ $section,
1421
+ array(
1422
+ 'type' => 'checkbox',
1423
+ 'option' => $option_name,
1424
+ 'field' => $field,
1425
+ 'sub-field' => 'auto',
1426
+ 'value' => $options[ $field ]['auto'],
1427
+ 'disabled' => empty( $providers ),
1428
+ 'after' => $options[ $field ]['auto'] ? '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>' : '',
1429
+ )
1430
+ );
1431
+
1432
+ // Download database
1433
+ add_settings_field(
1434
+ $option_name.'_'.$field.'_download',
1435
+ __( 'Download database', 'ip-geo-block' ),
1436
+ array( $context, 'callback_field' ),
1437
+ $option_slug,
1438
+ $section,
1439
+ array(
1440
+ 'type' => 'button',
1441
+ 'option' => $option_name,
1442
+ 'field' => $field,
1443
+ 'value' => __( 'Download now', 'ip-geo-block' ),
1444
+ 'disabled' => empty( $providers ),
1445
+ 'after' => '<div id="ip-geo-block-download"></div>',
1446
+ )
1447
+ );
1448
+
1449
/*----------------------------------------*
1450
* Submission settings
1451
*----------------------------------------*/
1492
NULL,
1493
$option_slug
1494
);
1495
+ if ( IP_GEO_BLOCK_NETWORK ):
1496
// @see https://vedovini.net/2015/10/using-the-wordpress-settings-api-with-network-admin-pages/
1497
if ( is_main_site() && is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) {
1498
add_action( 'network_admin_edit_' . IP_Geo_Block::PLUGIN_NAME, array( $context, 'validate_network_settings' ) );
1657
public static function note_services() {
1658
echo
1659
'<ul class="ip-geo-block-note">', "\n",
1660
+ '<li>', __( 'While Geolite2&thinsp;/&thinsp;Maxmind and IP2Location will fetch the local databases, others will pass an IP address to the 3rd parties\' API via HTTP.', 'ip-geo-block' ), '</li>', "\n",
1661
+ '<li>', __( 'Please select the appropriate APIs to fit the privacy law&thinsp;/&thinsp;regulation in your country&thinsp;/&thinsp;region.', 'ip-geo-block' ), '</li>', "\n",
1662
'</ul>', "\n";
1663
}
1664
admin/includes/tab-statistics.php CHANGED
@@ -250,7 +250,7 @@ endif;
250
'value' => 0,
251
'list' => array(
252
0 => NULL,
253
- 'bulk-action-remove' => __( 'Remove from cache', 'ip-geo-block' ),
254
'bulk-action-ip-white' => __( 'Add IP address to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
255
'bulk-action-ip-black' => __( 'Add IP address to &#8220;Blacklist&#8221;', 'ip-geo-block' ), ) + ( $options['Maxmind']['use_asn'] <= 0 ? array() : array(
256
'bulk-action-as-white' => __( 'Add AS number to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
250
'value' => 0,
251
'list' => array(
252
0 => NULL,
253
+ 'bulk-action-remove' => __( 'Remove entries by IP address', 'ip-geo-block' ),
254
'bulk-action-ip-white' => __( 'Add IP address to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
255
'bulk-action-ip-black' => __( 'Add IP address to &#8220;Blacklist&#8221;', 'ip-geo-block' ), ) + ( $options['Maxmind']['use_asn'] <= 0 ? array() : array(
256
'bulk-action-as-white' => __( 'Add AS number to &#8220;Whitelist&#8221;', 'ip-geo-block' ),
admin/js/admin.js CHANGED
@@ -311,7 +311,8 @@
311
312
// reset all checkboxes
313
if (clear) {
314
- $('input[type="checkbox"]').prop('checked', false).change();
315
}
316
317
// deserialize to the form
@@ -332,8 +333,12 @@
332
// Admin ajax/post
333
show_folding_ajax($(ID('@', 'validation_ajax_1')));
334
335
- // Additional edge case
336
if (clear) {
337
clear = ID('%', 'settings[providers][IPInfoDB]');
338
$(ID('@', 'providers_IPInfoDB')).prop('checked', json[clear] ? true : false);
339
}
@@ -804,14 +809,15 @@
804
805
// draw callback
806
drawCallback: function (settings) {
807
- var elm = $(ID('#', control.tableID)).find('td.dataTables_empty');
808
809
// avoid recursive call for ajax source
810
// 1: thead, 2: empty tbody, 3: after loading data
811
- if (3 > settings.iDraw) {
812
elm.html(ip_geo_block.i18n[0]);
813
}
814
- else if (3 === settings.iDraw) {
815
// 'No data available in table'
816
elm.html(ip_geo_block.i18n[1]);
817
@@ -868,10 +874,11 @@
868
869
// Bulk action
870
$(ID('#', 'bulk-action')).off('click').on('click', function (/*event*/) {
871
- var cmd = $(this).prev().val(), // value of selected option
872
- rexp = /(<([^>]+)>)/ig, // regular expression to strip tag
873
- data = { IP: [], AS: [] }, // IP address and AS number
874
- cell, cells = $('table.dataTable').find('td>input:checked');
875
876
if (!cmd) {
877
return false;
@@ -882,8 +889,18 @@
882
883
cells.each(function (/*index*/) {
884
cell = table.cell(this.parentNode).data();
885
- data.IP.push(cell[control.columnIP].replace(rexp, ''));
886
- data.AS.push(cell[control.columnAS].replace(rexp, ''));
887
});
888
889
if (data.IP.length) {
@@ -1318,8 +1335,12 @@
1318
});
1319
1320
/*--------------------------------
1321
- * Statistics and Logs settings
1322
*--------------------------------*/
1323
$(ID('@', 'save_statistics')).on('change', function (/*event*/) {
1324
$(ID('@', 'validation_recdays')).prop('disabled', !$(this).prop('checked'));
1325
return false;
@@ -1327,7 +1348,13 @@
1327
1328
$(ID('@', 'validation_reclogs')).on('change', function (/*event*/) {
1329
var $this = $(this);
1330
- $this.parent().parent().nextAll().find('input').prop('disabled', 0 === Number($this.prop('selectedIndex')));
1331
}).trigger('change');
1332
1333
/*---------------------------
@@ -1825,6 +1852,12 @@
1825
ip = $.trim($(ID('@', 'ip_address')).val());
1826
1827
if (ip) {
1828
whois.hide().empty();
1829
1830
// Get whois data
@@ -1963,6 +1996,7 @@
1963
$('ul.wp-submenu>li.wp-first-item').removeClass('current').next().addClass('current');
1964
break;
1965
}
1966
}); // document.ready()
1967
1968
}(jQuery, window, document));
311
312
// reset all checkboxes
313
if (clear) {
314
+ $('input[type="checkbox"]').prop('checked', false).change();
315
+ $('input[name*=providers]').prop('disabled', false).change();
316
}
317
318
// deserialize to the form
333
// Admin ajax/post
334
show_folding_ajax($(ID('@', 'validation_ajax_1')));
335
336
+ // Additional edge case (it should be optimized except IPInfoDB)
337
if (clear) {
338
+ /*$('input[name*=providers]').each(function(i, elm) {
339
+ elm = $(elm);
340
+ elm.prop('checked', json[elm.prop('name')] ? false : true);
341
+ });*/
342
clear = ID('%', 'settings[providers][IPInfoDB]');
343
$(ID('@', 'providers_IPInfoDB')).prop('checked', json[clear] ? true : false);
344
}
809
810
// draw callback
811
drawCallback: function (settings) {
812
+ var elm = $(ID('#', control.tableID)).find('td.dataTables_empty'),
813
+ n = 'restore-logs' === control.ajaxCMD ? 3 : 2; // 2:restore-cache
814
815
// avoid recursive call for ajax source
816
// 1: thead, 2: empty tbody, 3: after loading data
817
+ if (n > settings.iDraw) {
818
elm.html(ip_geo_block.i18n[0]);
819
}
820
+ else if (n === settings.iDraw) {
821
// 'No data available in table'
822
elm.html(ip_geo_block.i18n[1]);
823
874
875
// Bulk action
876
$(ID('#', 'bulk-action')).off('click').on('click', function (/*event*/) {
877
+ var cmd = $(this).prev().val(), // value of selected option
878
+ texp = /(<([^>]+)>)/ig, // regular expression to strip tag
879
+ hexp = /data-hash=[\W]([\w]+)[\W]/i, // regular expression to extract hash
880
+ data = { IP: [], AS: [] }, // IP address and AS number
881
+ hash, cell, cells = $('table.dataTable').find('td>input:checked');
882
883
if (!cmd) {
884
return false;
889
890
cells.each(function (/*index*/) {
891
cell = table.cell(this.parentNode).data();
892
+
893
+ // hash for anonymized IP address
894
+ // ex:<span><a href="#!" data-hash="abcdef0123456789">123.456.789.***</a></span>
895
+ if ('bulk-action-remove' === cmd || 'bulk-action-ip-erase' === cmd) {
896
+ hash = cell[control.columnIP].match(hexp);
897
+ hash = hash ? ',' + hash[1] : '';
898
+ } else {
899
+ hash = '';
900
+ }
901
+
902
+ data.IP.push(cell[control.columnIP].replace(texp, '') + hash);
903
+ data.AS.push(cell[control.columnAS].replace(texp, ''));
904
});
905
906
if (data.IP.length) {
1335
});
1336
1337
/*--------------------------------
1338
+ * Privacy and record settings
1339
*--------------------------------*/
1340
+ $(ID('@', 'anonymize')).on('change', function (/*event*/) {
1341
+ $('input[class*="remote"]').prop('disabled', $(this).prop('checked'));
1342
+ }).trigger('change');
1343
+
1344
$(ID('@', 'save_statistics')).on('change', function (/*event*/) {
1345
$(ID('@', 'validation_recdays')).prop('disabled', !$(this).prop('checked'));
1346
return false;
1348
1349
$(ID('@', 'validation_reclogs')).on('change', function (/*event*/) {
1350
var $this = $(this);
1351
+ $this.parent().parent().nextAll().find('input[id*="validation"]').prop('disabled', 0 === Number($this.prop('selectedIndex')));
1352
+ }).trigger('change');
1353
+
1354
+ $(ID('@', 'cache_hold')).on('change', function (/*event*/) {
1355
+ var checked = $(this).prop('checked');
1356
+ $('input[id*="cache_time"]' ).prop('disabled', !checked);
1357
+ $('select[id*="login_fails"]').prop('disabled', !checked);
1358
}).trigger('change');
1359
1360
/*---------------------------
1852
ip = $.trim($(ID('@', 'ip_address')).val());
1853
1854
if (ip) {
1855
+ // Anonymize IP address
1856
+ if ($(ID('@', 'anonymize' )).prop('checked')) {
1857
+ ip = ip.replace(/([\.\:])\w{1,4}#x2F;, '$1' + '0');
1858
+ $(ID('@', 'ip_address')).val(ip);
1859
+ }
1860
+
1861
whois.hide().empty();
1862
1863
// Get whois data
1996
$('ul.wp-submenu>li.wp-first-item').removeClass('current').next().addClass('current');
1997
break;
1998
}
1999
+
2000
}); // document.ready()
2001
2002
}(jQuery, window, document));
admin/js/admin.min.js CHANGED
@@ -3,4 +3,4 @@
3
Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
This software is released under the MIT License.
5
*/
6
- (function(a,f,t){function b(a,b){var c={".":".ip-geo-block-","#":"#ip-geo-block-","@":"#ip_geo_block_settings_",$:"ip-geo-block-","%":"ip_geo_block_","!":"ip_geo_block_settings_"};return"undefined"!==typeof b?c[a]+b:c.$+a}function L(a){return a.toString().replace(/[&<>"']/g,function(a){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[a]}).replace(/&amp;(#\d{2,4}|\w{4,7});/g,"&$1;")}function l(a){return a?L(a.toString().replace(/(<([^>]+)>)/ig,"")):""}function D(b,e){var c=a(f).width();c!==E&&(E=c,"undefined"===typeof p[b]&&(p[b]={id:!1,callback:e}),a(f).off("resize").on("resize",function(){!1!==p[b].id&&f.clearTimeout(p[b].id);p[b].time=f.setTimeout(p[b].callback,200);return!1}))}function B(c,e){e?a(b("#",c)).addClass(b("loading")):a(b("#",c)).removeClass(b("loading"))}function y(a,b){f.confirm(l(a))&&b()}function C(a,b,g){f.alert(l(b||d.msg[12].replace("%s",g)+" ("+a+")"))}function J(a,b){-1!==f.location.href.indexOf(a)&&(f.location=l(a)+(b?"&"+l(b):"")+"&ip-geo-block-auth-nonce="+F.nonce)}function q(b,e,g,k){b&&B(b,!0);e.action=d.action;e.nonce=d.nonce;a.post(d.url,e).done(function(a){g&&g(a)}).fail(function(a){R||C(a.status,a.responseText,e.action)}).always(function(){b&&("object"===typeof k?a.when.apply(a,k).then(function(){B(b,!1)}):B(b,!1))})}function M(a,b){q(a,{cmd:"clear-"+a,which:b},function(a){J(a.page,a.tab)})}function S(a){q(a,{cmd:a},function(a){J(a.page,a.tab)})}function v(a){a.stopImmediatePropagation();return!1}function G(a,e){e?a.removeClass("folding-disable"):(a.children(b(".","hide")).hide(),a.addClass("folding-disable"),a.removeClass(b("dropdown")).addClass(b("dropup")))}function N(c,e,g){var k=0===c.prop("type").indexOf("checkbox")&&c.is(":checked")||0===c.prop("type").indexOf("select")&&"0"!==c.val();c.siblings('input[name^="'+b("%","settings")+'"]:checkbox').prop("disabled",!k);a.isArray(e)?a.each(e,function(c,e){a(e).nextAll(b(".","settings-folding")).each(function(b,e){G(a(e),k&&g[c])})}):e.nextAll(b(".","settings-folding")).each(function(b,c){G(a(c),k&&g)})}function T(c){var e=b("@","validation_ajax_");G(c.closest("ul").next(),a(e+"1").is(":checked")||a(e+"2").is(":checked"))}function I(a){return String(a).replace(/[a-z]/gi,function(a){return String.fromCharCode(a.charCodeAt(0)+("n">a.toLowerCase()?13:-13))})}function da(a,b){var c=new f.FileReader;c.onload=function(a){b&&b(a.target.result)};c.onerror=function(a){C("Error",a.target.error.code)};c.readAsText(a)}function U(c){var e=c.is(":checked"),g=a(b("@","public_target_rule")),k=a(b("@","public_behavior")),d=c.closest("tr").nextAll("tr");d.find('[name^="'+b("%","settings")+'"]').prop("disabled",!e);d.find(b(".","desc")).css("opacity",e?1:.5);N(c,[g,k],["1"===g.val()?!0:!1,k.val()]);e&&k.change()}function O(c,e){c&&("string"===typeof c&&(c=JSON.parse(c)),e&&a('input[type="checkbox"]').prop("checked",!1).change(),a(b("#","import")).closest("form").deserialize(c),a(b("@","exception_admin")+","+b("@","validation_mimetype")).change(),a('select[name*="'+b("%","settings")+'"]').change(),a(b("@","validation_login")).change(),U(a(b("@","validation_public"))),T(a(b("@","validation_ajax_1"))),e&&(e=b("%","settings[providers][IPInfoDB]"),a(b("@","providers_IPInfoDB")).prop("checked",c[e]?!0:!1)))}function ea(a,b){var c=Math.ceil(a.length/b),e=[],d;for(d=0;d<c;++d){var m=d*b;e.push(a.slice(m,m+b))}return e}function r(c){"object"===typeof f.google&&(1===c?a(b("#","chart-countries")).length&&(h.drawPie(b("chart-countries")),h.drawLine(b("chart-daily"),"date")):5===c&&a(b(".","network")).each(function(b,c){h.drawStacked(a(c).attr("id"))}))}function V(a){if("object"===typeof f.google){var b=["corechart"];5===a&&b.push("bar");f.google.load("visualization","1",{packages:b,callback:function(){r(a)}});D("draw-chart."+a,function(){r(a)})}}function fa(a){var b,c="undefined"!==typeof wpCookies&&wpCookies.getHash("ip-geo-block")||[];for(b in c)c.hasOwnProperty(b)&&(c[b]=c[b].replace(/[^ox\d]/g,"").split(""));"undefined"===typeof c[a]&&(c[a]=[]);return c}function z(b){var c,g,d=[];a.each(b,function(a,b){d[a]="";if("undefined"!==typeof b&&(g=b.length))for(d[a]=b[0]||"o",c=1;c<g;++c)d[a]+=b[c]||"o"});"undefined"!==typeof wpCookies&&wpCookies.setHash("ip-geo-block",d,new Date(Date.now()+2592E6),F.home+F.admin)}function ha(c){var e=fa(c);a("form").on("click","h2,h3 a",function(){f.open(this.href,null);return!1}).on("click","h2,h3",function(){var d=a(this),k=d.closest("fieldset").data("section"),f=d.parent().nextAll(".panel-body").toggle();d.toggleClass(b("dropup")).toggleClass(b("dropdown"));(d=d.hasClass(b("dropdown")))?f.addClass(b("border")).trigger(b("show-body")):f.removeClass(b("border"));e[c][k]=d?"o":"x";z(e);r(c);return!1});a(b("#","toggle-sections")).on("click",function(){var d,k=a(b(".","field")).find("h2,h3"),f=[b("dropdown"),b("dropup")],m=k.filter("."+f[0]).length;k.each(function(g){d=a(this);d.removeClass(f.join(" ")).addClass(m?f[1]:f[0]);d=d.parent().nextAll(".panel-body").toggle(m?!1:!0);m?d.removeClass(b("border")):d.addClass(b("border")).trigger("show-body");e[c][g]=m?"x":"o"});z(e);r(c);return!1});return e}function W(c){a("body").append('<div style="display:none"><form method="POST" id="'+b("export-form")+'" action="'+d.url.replace("ajax.php","post.php")+'"><input type="hidden" name="action" value="'+d.action+'" /><input type="hidden" name="nonce" value="'+d.nonce+'" /><input type="hidden" name="cmd" value="'+c+'" /><input type="hidden" name="data" value="" id="'+b("export-data")+'"/><input type="submit" value="submit" /></form><input type="file" name="settings" id="'+b("file-dialog")+'" /></div>')}function X(a,b,d,f){a=a.cloneNode(!1);a.setAttribute("title",l(d));b=b.cloneNode(!1);b.setAttribute("class","dashicons dashicons-"+f);a.appendChild(b);return a}function Y(c,e,g){a.extend(!0,a.fn.dataTable.defaults,g,{dom:"tp",serverSide:!1,autoWidth:!1,processing:!0,deferRender:!0,deferLoading:10,info:!1,lengthChange:!1,language:{emptyTable:d.i18n[1],loadingRecords:d.i18n[0],processing:d.i18n[0],zeroRecords:d.i18n[2],paginate:{first:"&laquo;",last:"&raquo;",next:"&rsaquo;",previous:"&lsaquo;"}},responsive:{details:{type:"column",target:"td:nth-child(n+2)"}},columnDefs:[{width:"1.25em",targets:0},{orderable:!1,targets:0},{searchable:!1,targets:0},{targets:[0],data:null,defaultContent:'<input type="checkbox">'}],pagingType:"full_numbers",pageLength:10,scroller:!0,scrollY:1E4,scrollCollapse:!0,drawCallback:function(c){var f=a(b("#",e.tableID)).find("td.dataTables_empty");3>c.iDraw?f.html(d.i18n[0]):3===c.iDraw&&(f.html(d.i18n[1]),f=a(b("@","search_filter")),f.val()&&f.trigger("keyup"))}});var k=a(b("#",e.tableID)).DataTable({ajax:{url:d.url,type:"POST",data:{cmd:e.ajaxCMD,action:d.action,nonce:d.nonce}},mark:!0}),h=function(){k.columns.adjust().responsive.recalc().draw(!1)};D("draw-table."+c,h);a(b("#",e.sectionID)).find(".panel-body").off(b("show-body")).on(b("show-body"),function(){h();return!1}).off("change").on("change",'th>input[type="checkbox"]',function(){var c=a(this).prop("checked");a(b("#",e.tableID)).find('td>input[type="checkbox"]').prop("checked",c);return!1});a(b("#","select-target")).off("change").on("change",function(){var c=a(this).find('input[name="'+b("target")+'"]:checked').val();k.columns(e.targetColumn).search("all"!==c?c:"").draw();return!1}).trigger("change");a(b("#","bulk-action")).off("click").on("click",function(){var f=a(this).prev().val(),g=/(<([^>]+)>)/ig,h={IP:[],AS:[]},l,w=a("table.dataTable").find("td>input:checked");if(!f)return!1;if(!w.length)return C(null,d.msg[11]),!1;w.each(function(){l=k.cell(this.parentNode).data();h.IP.push(l[e.columnIP].replace(g,""));h.AS.push(l[e.columnAS].replace(g,""))});h.IP.length&&q("loading",{cmd:f,which:h},function(d){"undefined"!==typeof d.page?J(d.page,"tab="+c):d&&(k.ajax.reload(),a(b("#",e.tableID)).find('th input[type="checkbox"]').prop("checked",!1))});return!1});a(b("@","search_filter")).off("keyup").on("keyup",function(){k.search(this.value,!1,!0,!/[A-Z]/.test(this.value)).draw();return!1});a(b("#","reset-filter")).off("click").on("click",function(){a(b("@","search_filter")).val("");k.search("").draw();return!1});a(b("@","clear_all")).off("click").on("click",function(){y(d.msg[1===c?4:5],function(){M(1===c?"cache":"logs",null)});return!1});a("table.dataTable tbody").on("click","a",function(){var b=f.location.search.slice(1).split("&"),e=b.length,d={},g;for(g=0;g<e;++g){var k=b[g].split("=");d[k[0]]=k[1]}d.tab=1===c?4:2;d.s=a(this).text().replace(/[^\w\.:\*]/,"");k=[];for(g in d)d.hasOwnProperty(g)&&k.push(g+"="+d[g]);f.open(f.location.pathname+"?"+k.join("&"),"_blank");return!1});return k}var R=!1,p=[],E=a(f).width(),d=IP_GEO_BLOCK,F=IP_GEO_BLOCK_AUTH;a.fn.deserialize=function(b){return this.each(function(){var c,d=this,f={};for(c in b)if(b.hasOwnProperty(c))try{var h=decodeURIComponent(c);var l=decodeURIComponent(b[c]);f.hasOwnProperty(h)||(f[h]=[]);f[h].push(l)}catch(H){}a.each(f,function(b,e){c=a('[name="'+b+'"]:input',d).val(e);"hidden"!==c.attr("type")&&c.before('<span style="color:red">*</span>')})})};var h={dataPie:[],viewPie:[],drawPie:function(b){if("undefined"===typeof h.dataPie[b]){var c=h.dataPie[b]=new f.google.visualization.DataTable;c.addColumn("string","Country");c.addColumn("number","Requests");c=a.parseJSON(a("#"+b).attr("data-"+b));h.dataPie[b].addRows(c)}"undefined"===typeof h.viewPie[b]&&(h.viewPie[b]=new f.google.visualization.PieChart(t.getElementById(b)));"undefined"!==typeof h.dataPie[b]&&"undefined"!==typeof h.viewPie[b]&&0<a("#"+b).width()&&h.viewPie[b].draw(h.dataPie[b],{backgroundColor:{fill:"transparent"},chartArea:{left:0,top:"5%",width:"100%",height:"90%"},sliceVisibilityThreshold:.015})},dataLine:[],viewLine:[],drawLine:function(b,d){if("undefined"===typeof h.dataLine[b]){var c=h.dataLine[b]=new f.google.visualization.DataTable;c.addColumn(d,"Date");c.addColumn("number","comment");c.addColumn("number","xmlrpc");c.addColumn("number","login");c.addColumn("number","admin");c.addColumn("number","public");var e=a.parseJSON(a("#"+b).attr("data-"+b));var l=e.length;for(c=0;c<l;++c)e[c][0]=new Date(1E3*e[c][0]);h.dataLine[b].addRows(e)}"undefined"===typeof h.viewLine[b]&&(h.viewLine[b]=new f.google.visualization.LineChart(t.getElementById(b)));"undefined"!==typeof h.dataLine[b]&&"undefined"!==typeof h.viewLine[b]&&0<(c=a("#"+b).width())&&h.viewLine[b].draw(h.dataLine[b],{legend:{position:"bottom"},backgroundColor:{fill:"transparent"},hAxis:{format:"MM/dd"+("datetime"===d?" HH:mm":"")},vAxis:{textPosition:320<c?"out":"in"},chartArea:{left:320<c?"10%":0,top:"5%",width:"100%",height:"75%"}})},dataStacked:[],viewStacked:[],drawStacked:function(c){var d,g,k=a("#"+c);"undefined"===typeof h.dataStacked[c]&&(g=a.parseJSON(k.attr("data-"+c)))&&(g.unshift(["site","comment","xmlrpc","login","admin","poblic",{role:"link"}]),h.dataStacked[c]=f.google.visualization.arrayToDataTable(g));"undefined"===typeof h.viewStacked[c]&&(h.viewStacked[c]=new f.google.visualization.BarChart(t.getElementById(c)),f.google.visualization.events.addListener(h.viewStacked[c],"animationfinish",function(){var d,e,f,g=[],l=h.dataStacked[c],m=l.getNumberOfRows(),q=a(b("#","open-new")).prop("checked");for(d=0;d<m;d++)g.push({label:l.getValue(d,0),link:l.getValue(d,6)});m="http://www.w3.org/1999/xlink";k.find("text").each(function(a,b){f=b.parentNode;var c;if(c="g"===f.tagName.toLowerCase()){a:{c=b.textContent;var d,h=g.length;c=c.replace("\u2026","");for(d=0;d<h;++d)if(g.hasOwnProperty(d)&&0===g[d].label.indexOf(c)){c=d;break a}c=-1}c=-1!==(a=c)}c&&(e=t.createElementNS("http://www.w3.org/2000/svg","a"),e.setAttributeNS(m,"xlink:href",g[a].link),e.setAttributeNS(m,"title",g[a].label),e.setAttribute("target",q?"_blank":"_self"),e.setAttribute("class","site"),e.appendChild(f.removeChild(b)),f.appendChild(e),g.splice(a,1))})}));if(0<(d=k.width())&&"undefined"!==typeof h.dataStacked[c]&&"undefined"!==typeof h.viewStacked[c]){var l=b("range");var m=a.parseJSON(a("."+l).attr("data-"+l));g=h.dataStacked[c];l=40*g.getNumberOfRows();h.viewStacked[c].draw(g,{width:d,height:l+80,allowHtml:!0,isStacked:!0,legend:{position:"top"},chartArea:{top:50,left:90,width:"100%",height:l},hAxis:{minValue:0,maxValue:m[1]},backgroundColor:{fill:"transparent"},animation:{startup:!0,duration:200,easing:"out"}})}},ajaxStacked:function(c,d,f,l){c=Math.max(0,Math.min(4,c));d=5*Math.max(1,Math.min(5,d));q(null,{cmd:"restore-network",which:c,offset:d*f*l,length:d},function(c){var e,f,g,l,k;c=ea(c,d);a(b(".","network")).each(function(b,m){if("undefined"!==typeof c[b]){l=a(m).attr("id");k=h.dataStacked[l];g=Math.min(d,c[b].length);for(e=0;e<g;++e)for(f=1;5>=f;f++)k.setValue(e,f,c[b][e][f]);h.drawStacked(l)}})})}};a(function(){var c=Number(d.tab)||0,e=ha(c);a(b(".","inhibit")).on("submit",function(){return!1});a(f).on("beforeunload",function(){R=!0});switch(c){case 0:var g=b("%","settings");a('[id^="'+b("scan-")+'"]').on("click",function(){var c=a(this),d=c.attr("id"),e=c.parent();q(d.replace(/^.*(?:scan)/,"scanning"),{cmd:"scan-code",which:d.replace(b("scan-"),"")},function(a){e.children("ul").length||e.append('<ul id="'+b("code-list")+'"></ul>');e=e.children("ul").empty();for(c in a)if(a.hasOwnProperty(c)){var c=l(c);if("string"===typeof a[c])var d=l(a[c]);else d=l(a[c].code),c='<abbr title="'+l(a[c].type)+'">'+c+"</abbr>";e.append("<li>"+c+' : <span class="'+b("notice")+'">'+d+"</span></li>")}e.show("slow")});return!1});a(b("@","matching_rule")).on("change",function(){var c=this.value;a(b("@","white_list")).closest("tr").toggle("0"===c);a(b("@","black_list")).closest("tr").toggle("1"===c);return!1}).change();a(b(".","icon-cidr")).on("click",function(){var c=a(b("#","admin-styles-css")).get(0).href,d=f.open("about:blank","","width=560,height=170");c=c.slice(0,c.lastIndexOf("css/"));d.document.write('<!DOCTYPE html><html lang=en><meta charset=utf-8><title>CIDR calculator for IPv4 / IPv6</title><link href="'+c+'css/cidr.min.css?v=.1" rel=stylesheet><div class="row container"><div class=row id=i><fieldset class="col span_11"><legend>Range <input id=a type=button value=Clear tabindex=1></legend><textarea id=c name=range placeholder="192.168.0.0 - 192.168.255.255" rows=5 wrap=off tabindex=2></textarea></fieldset><ul class="col span_2" id=h><li class=row><input id=e type=button value=&rarr; class="col span_24" tabindex=3><li class=row><input id=f type=button value=&larr; class="col span_24" tabindex=6></ul><fieldset class="col span_11"><legend>CIDR <input id=b type=button value=Clear tabindex=4></legend><textarea id=d name=cidr placeholder=192.168.0.0/16 rows=5 wrap=off tabindex=5></textarea></fieldset></div><div class=row id=j><span class=col id=g>\u00a0</span></div></div><script src="'+c+'js/cidr.min.js?v=.1">\x3c/script>');d.document.close();return!1});a(b("@","validation_mimetype")).on("change",function(c){var d=a(this),n=parseInt(d.val(),10);d.nextAll(b(".","settings-folding")).each(function(b,c){G(a(c),n===b+1||n&&2===b)});return v(c)}).change();a('select[name*="response_code"]').on("change",function(c){var d=a(this),n=parseInt(d.val()/100,10),e=d.closest("tr").nextAll("tr");if(0<=d.attr("name").indexOf("public")&&-1===parseInt(a(b("@","public_matching_rule")).val(),10))return e.each(function(b){1>=b&&a(this).hide()}),v(c);3>=n?e.each(function(b){0===b?a(this).show():1===b&&a(this).hide()}):e.each(function(b){0===b?a(this).hide():1===b&&a(this).show()});return v(c)}).change();a(b("#","decode")).on("click",function(){var c=a(b("@","signature")),d=c.val();-1===d.search(/,/)?c.val(I(f.atob(d))):c.val(f.btoa(I(d)));return!1});a(b("@","validation_login")).on("change",function(b){var c=a(this);N(c,c,g,!0);return v(b)}).change();q(null,{cmd:"get-actions"},function(c){var e,n=a(b("#","list-admin")),f=t.createElement("li"),g=t.createElement("input"),h=t.createElement("label"),k=t.createElement("dfn"),m=t.createElement("span");for(x in c)if(c.hasOwnProperty(x)){var x=l(x);if(!n.find("#"+(e=b("!","exception_admin_"+x))).size()){var p=g.cloneNode(!1);p.setAttribute("id",e);p.setAttribute("value",x);p.setAttribute("type","checkbox");var r=f.cloneNode(!1);r.appendChild(p);p=h.cloneNode(!1);p.setAttribute("for",e);p.appendChild(t.createTextNode(x));r.appendChild(p);1&c[x]&&r.appendChild(X(k,m,d.msg[6],"lock"));2&c[x]&&r.appendChild(X(k,m,d.msg[7],"unlock"));n.append(r)}}a(b(".","icon-unlock")).on("click",function(){a(b("#","list-admin")+">li").filter(function(){return!a(this).find(".dashicons-unlock").length}).toggle();return!1});a(b("@","exception_admin")).on("change",function(c){var d=a.grep(a(this).val().split(","),function(a){return""!==a.replace(/^\s+|\s+#x2F;g,"")});a(b("#","list-admin")).find("input").each(function(){var b=a(this),c=b.val();b.prop("checked",-1!==a.inArray(c,d))});return v(c)}).change();a(b("#","list-admin")).on("click","input",function(){var c=a(this);var d=a(b("@","exception_admin")),e=c.val(),n=a.grep(d.val().split(","),function(a){return""!==a.replace(/^\s+|\s+#x2F;g,"")});c=a.inArray(e,n);-1===c?n.push(e):n.splice(c,1);d.val(n.join(",")).change()});a(b(".","icon-find")).on("click",function(){var c=a(this),e=[],n=0,f,ca,g,h,k=l(d.msg[9]),u=l(c.data("target"));a(b("#","find-"+u)).empty();c.next().children(b(".","find-desc")).show();c=a(b("#","list-"+u));c.children("li").each(function(b,c){e.push(a(c).find("input").val())});q("find-"+u,{cmd:"find-"+u},function(Q){for(var m in Q)Q.hasOwnProperty(m)&&(++n,f=l(Q[m]),m=l(m),ca=a.inArray(m,e),g=b("!","exception_"+u+"_"+m),h="admin"===u?f+"="+m:"/"+f+"/"+m+"/",h='<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="'+F.sites[0]+F.admin+"options-general.php?page=ip-geo-block&tab=4&s="+encodeURIComponent(h)+'" title="'+k.replace("%s",h)+'" target="_blank"><span></span></a>',0>ca?(e.push(m),c.prepend('<li><input id="'+g+'" value="'+m+'" type="checkbox" '+("admin"===u?"/>":"name=ip_geo_block_settings[exception]["+u+"]["+m+"] />")+'<label for="'+g+'">'+m+"</lable>"+h+"</li>")):(g=c.find("#"+g).parent(),g.find("a").length||g.append(h)));a(b("@","exception_"+u)).trigger("change");a(b("#","find-"+u)).append(' <span class="ip-geo-block-warn">'+l(d.msg[8].replace("%d",n))+"</span>")});return!1})});a('input[id^="'+b("!","validation_ajax_")+'"]').on("change",function(){T(a(this))}).change();a(b("@","validation_public")).on("change",function(b){U(a(this));return v(b)}).change();a(b("@","public_matching_rule")).on("change",function(c){var d=this.value;a(b("@","public_white_list")).closest("tr").toggle("0"===d);a(b("@","public_black_list")).closest("tr").toggle("1"===d);a(b("@","public_response_code")).change().closest("tr").toggle("-1"!==d);return v(c)}).change();a(b("@","public_behavior")).on("change",function(b){var c=a(this);G(c.siblings("ul"),c.prop("checked"));return v(b)}).change();a(b("@","update")).on("click",function(){q("download",{cmd:"download"},function(c){var d;for(d in c)if(c.hasOwnProperty(d)){var e=c[d];for(n in e)if(e.hasOwnProperty(n)){var n=l(n);e[n].filename&&a(b("@",d+"_"+n+"_path")).val(l(e[n].filename));e[n].message&&a(b("#",d+"-"+n)).text(l(e[n].message))}}});return!1});a(b("@","save_statistics")).on("change",function(){a(b("@","validation_recdays")).prop("disabled",!a(this).prop("checked"));return!1}).trigger("change");a(b("@","validation_reclogs")).on("change",function(){var b=a(this);b.parent().parent().nextAll().find("input").prop("disabled",0===Number(b.prop("selectedIndex")))}).trigger("change");a(b("@","comment_pos")).on("change",function(){var b=a(this);b.nextAll('input[type="text"]').prop("disabled",0===Number(b.prop("selectedIndex")))}).trigger("change");W("validate");a(b("#","export")).on("click",function(){if("undefined"===typeof JSON)return C(null,l(d.msg[10])),!1;var c=g,e={};a.each(a(this).closest("form").serializeArray(),function(a,b){-1!==b.name.indexOf(c)&&(e[b.name]=b.value)});e[c+="[signature]"]=f.btoa(I(e[c]));a(b("#","export-data")).val(JSON.stringify(e));a(b("#","export-form")).submit();return!1});a(b("#","file-dialog")).on("change",function(a){if("undefined"===typeof f.FileReader)return C(null,l(d.msg[10])),!1;var b;(a=a.target.files[0])&&da(a,function(a){a=JSON.parse(a);b=g+"[signature]";"undefined"!==typeof a[b]&&(a[b]=f.btoa(I(a[b])));q("export-import",{cmd:"validate",data:JSON.stringify(a)},function(a){O(a,!0)})});return!1});a(b("#","import")).on("click",function(){a(b("#","file-dialog")).click();return!1});a(b("#","default")).on("click",function(){y(d.msg[0],function(){q("pre-defined",{cmd:"import-default"},function(a){O(a,!0)})});return!1});a(b("#","preferred")).on("click",function(){y(d.msg[0],function(){q("pre-defined",{cmd:"import-preferred"},function(a){O(a,!1)})});return!1});a(b("@","reset_live")).on("click",function(){q("reset-live",{cmd:"reset-live"});return!1});a(b("@","create_table")).on("click",function(){y(d.msg[1],function(){S("create-table")});return!1});a(b("@","delete_table")).on("click",function(){y(d.msg[2],function(){S("delete-table")});return!1});a(b("#","show-info")).on("click",function(){a(b("#","wp-info")).empty();q("wp-info",{cmd:"show-info"},function(c){var d,e=[];for(d in c)c.hasOwnProperty(d)&&e.push("- "+d+" "+c[d]);a(b("#","wp-info")).html('<textarea class="regular-text code" rows="'+e.length+'">'+e.join("\n")+"</textarea>").find("textarea").select();return!1})});a('select[name^="'+g+'"]').on("change",function(){var c=a(this),d,e=b(".","desc");c.next(e).empty();(d=c.children("option:selected").data("desc"))&&c.next(e).html(a.parseHTML(d));N(c,c,g,!0);return!1}).change();a(b(".","icon-cycle")).on("click",function(){var c=a(this).nextAll("li"),d=c.find(b("@","exception_admin"));c=c.find("input:checkbox").filter(":visible");var e=c.filter(":checked").length;c.prop("checked",!e);if(d.length)if(e)d.val("");else{var f=[];c.each(function(b,c){f.push(a(c).val())});d.val(f.join(","))}a(this).blur();return!1});a(b(".","settings-folding>dfn")).on("click",function(){var c=b("drop"),d=a(this).parent();d.children(b(".","hide")).toggle();d.toggleClass(c+"up").toggleClass(c+"down");d.hasClass(c+"up")&&d.children("div").hide();return!1});a("#submit").on("click",function(){var c=a(b("@","signature")),d=c.val();-1!==d.indexOf(",")&&c.val(f.btoa(I(d)));return!0});break;case 1:V(c);var k=0;a(b("#","sort-slug")).on("click",function(){var b=a(this).closest("ol"),c=b.children("li");(k=!k)?c.sort(function(b,c){return a(b).text()>a(c).text()}):c.sort(function(b,c){return parseInt(a(b).text().replace(/^.*\((\d+)\)#x2F;,"$1"),10)<=parseInt(a(c).text().replace(/^.*\((\d+)\)#x2F;,"$1"),10)});b.children("li").remove();c.appendTo(b)});a(b("@","clear_statistics")).on("click",function(){y(d.msg[3],function(){M("statistics",null)});return!1});a(b("@","clear_logs")).on("click",function(){y(d.msg[5],function(){M("logs",null)});return!1});Y(c,{tableID:"statistics-cache",ajaxCMD:"restore-cache",sectionID:"section-2",targetColumn:4,columnIP:1,columnAS:3},{columns:[{title:'<input type="checkbox">'},{title:d.i18n[3]},{title:d.i18n[4]},{title:d.i18n[5]},{title:d.i18n[6]},{title:d.i18n[7]},{title:d.i18n[8]},{title:d.i18n[9]}],columnDefs:[{responsivePriority:0,targets:0},{responsivePriority:1,targets:1},{responsivePriority:2,targets:2},{responsivePriority:6,targets:3},{responsivePriority:7,targets:4},{responsivePriority:3,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{className:"all",targets:[0,1,2,5]}]});break;case 4:var p={tableID:"validation-logs",sectionID:"section-0",targetColumn:6,columnIP:3,columnAS:5},m={columns:[{title:'<input type="checkbox">'},{title:""},{title:d.i18n[10]},{title:d.i18n[3]},{title:d.i18n[4]},{title:d.i18n[5]},{title:d.i18n[7]},{title:d.i18n[11]},{title:d.i18n[12]},{title:d.i18n[13]},{title:d.i18n[14]},{title:d.i18n[15]}],columnDefs:[{responsivePriority:11,targets:0},{responsivePriority:0,targets:1},{responsivePriority:1,targets:2},{responsivePriority:2,targets:3},{responsivePriority:3,targets:4},{responsivePriority:6,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{responsivePriority:7,targets:8},{responsivePriority:8,targets:9},{responsivePriority:9,targets:10},{responsivePriority:10,targets:11},{visible:!1,targets:1},{className:"all",targets:[0,2,3,4]},{className:"none",targets:[8,9,10,11]}]},H=null,r=null,B=a(b("#","live-loading")),w=null,P=function(){H&&(f.clearTimeout(H),H=null);r&&(B.removeClass(b("live-timer")),f.clearTimeout(r),r=null)},D=function(){P();q("live-loading",{cmd:"live-start"},function(a){if(a.error)C(null,a.error);else if(a.data.length){var b,c=a.data.length;for(b=0;b<c;b++)w.row.add(a.data[b]);w.draw(!1)}H=f.setTimeout(D,1E3*d.interval)})},E=function(a,b){P();q(null,{cmd:a||"live-stop",callback:b})},L=function(){E("live-pause",function(){B.addClass(b("live-timer"));r=f.setTimeout(function(){P();a(b("#","live-log-stop")).prop("checked",!0)},1E3*d.timeout)})},A=b(""),Z=function(b,c,d){-1===c[7].indexOf("pass")?a(b).addClass(A+d+"blocked"):a(b).addClass(A+d+"passed")},aa=a(b("#","live-log")),ba=a(b("#","live-update"));a(b("#","validation-logs")).on("animationend",function(){a(this).find('tr[class*="'+A+'new"]').each(function(){var b=a(this);-1!==b.prop("class").indexOf("passed")?b.addClass(A+"passed").removeClass(A+"new-passed"):b.addClass(A+"blocked").removeClass(A+"new-blocked")});return!1});aa.on("change",function(){switch(a('input[name="'+b("live-log")+'"]:checked').val()){case "start":D();break;case "pause":L();break;case "stop":E()}});ba.on("change",function(){var d=aa.closest("tr"),f=ba.prop("checked");e[c][1]=f?"o":"x";z(e);w&&w.clear().destroy();f?(d.show().next().next().next().nextAll().hide(),p.ajaxCMD="live-stop",m.order=[1,"desc"],m.createdRow=function(b,a){Z(b,a,"new-")}):(d.hide().next().next().next().nextAll().show(),p.ajaxCMD="restore-logs",m.order=[0,""],m.createdRow=function(b,a){Z(b,a,"")});a(b("#","live-log-stop")).trigger("click");w=Y(c,p,m);return!1}).trigger("change");W("export-logs");a(b("#","export-logs")).on("click",function(){a(b("#","export-form")).submit();return!1});break;case 2:a(f).on(b("gmap-error"),function(){q(null,{cmd:"gmap-error"},function(b){J(b.page,b.tab)})});var K=a(b("#","map"));"object"===typeof f.google?K.each(function(){a(this).GmapRS()}):K.each(function(){a(this).empty().html('<iframe src="'+d.altgmap+'?output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')});a('select[id^="'+b("!","service")+'"]').on("change",function(){e[c][3]=a(this).prop("selectedIndex");z(e)}).change();a(b("@","get_location")).on("click",function(){var c=a(b("#","whois")),d=a.trim(a(b("@","ip_address")).val());if(d){c.hide().empty();var e=a.whois(d,function(d){var e,f="";for(e=0;e<d.length;++e)f+="<tr><td>"+d[e].name+"</td><td>"+d[e].value+"</td></tr>";c.html('<fieldset id="'+b("section-1")+'" class="'+b("field")+' panel panel-default" data-section="1"><legend class="panel-heading"><h3 id="'+b("whois-title")+'" class="'+b("dropdown")+'">Whois</h3></legend><div class="panel-body '+b("border")+'"><table class="'+b("table")+'">'+f+"</table></div></fieldset>").fadeIn("slow");a(b("#","whois-title")).on("click",function(){var c=a(this);c.parent().nextAll().toggle();c.toggleClass(b("dropup")).toggleClass(b("dropdown"));return!1})});q("loading",{cmd:"search",ip:d,which:a(b("@","service")).val()},function(a){var c="",e=l(a.latitude||"0"),g=l(a.longitude||"0"),h=a.latitude||a.longitude?8:2;for(k in a)if(a.hasOwnProperty(k)){var k=l(k);c+='<li><span class="'+b("title")+'">'+k+' : </span><span class="'+b("result")+'">'+l(a[k])+"</span></li>"}"object"===typeof f.google?K.GmapRS("addMarker",{latitude:e,longitude:g,title:d,content:"<ul>"+c+"</ul>",show:!0,zoom:h}):K.css({height:"600px",backgroundColor:"transparent"}).empty().html('<ul style="margin-top:0; margin-left:1em;"><li><span class="'+b("title")+'">IP address : </span><span class="'+b("result")+'">'+l(d)+"</span></li>"+c+'</ul><iframe src="//maps.google.com/maps?q='+e+","+g+"&z="+h+'&output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')},[e])}return!1});a(b("@","ip_address")).on("keypress",function(c){if(c.which&&13===c.which||c.keyCode&&13===c.keyCode)return a(b("@","get_location")).click(),!1});a(b("@","ip_address")).val()&&a(b("@","get_location")).click();break;case 5:V(c),a("input[name="+b("duration")+"]:radio").on("click",function(){var b=a('div[class*="paginate"]').find('a[class*="current"]').text();e[c][2]=a(this).val()||0;e[c][3]=e[c][3]||2;e[c][4]=e[c][4]||1;z(e);h.ajaxStacked(e[c][2],e[c][3],e[c][4],b-1)}),a(b("#","open-new")).on("change",function(){var d=a(this).prop("checked");e[c][1]=d?"o":"x";z(e);a(b("#","section-0 svg")).find("a").each(function(){this.setAttribute("target",d?"_blank":"_self")})}),a(b("#","apply-layout")).on("click",function(){var d=a(b("#","select-layout"));e[c][3]=d.find('select[name="rows"] option:selected').val();e[c][4]=d.find('select[name="cols"] option:selected').val();z(e)}),a("ul.wp-submenu>li.wp-first-item").removeClass("current").next().addClass("current")}})})(jQuery,window,document);
3
Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
This software is released under the MIT License.
5
*/
6
+ (function(a,f,t){function b(a,b){var c={".":".ip-geo-block-","#":"#ip-geo-block-","@":"#ip_geo_block_settings_",$:"ip-geo-block-","%":"ip_geo_block_","!":"ip_geo_block_settings_"};return"undefined"!==typeof b?c[a]+b:c.$+a}function da(a){return a.toString().replace(/[&<>"']/g,function(a){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[a]}).replace(/&amp;(#\d{2,4}|\w{4,7});/g,"&$1;")}function k(a){return a?da(a.toString().replace(/(<([^>]+)>)/ig,"")):""}function E(b,e){var c=a(f).width();c!==J&&(J=c,"undefined"===typeof p[b]&&(p[b]={id:!1,callback:e}),a(f).off("resize").on("resize",function(){!1!==p[b].id&&f.clearTimeout(p[b].id);p[b].time=f.setTimeout(p[b].callback,200);return!1}))}function C(c,e){e?a(b("#",c)).addClass(b("loading")):a(b("#",c)).removeClass(b("loading"))}function z(a,b){f.confirm(k(a))&&b()}function D(a,b,g){f.alert(k(b||d.msg[12].replace("%s",g)+" ("+a+")"))}function K(a,b){-1!==f.location.href.indexOf(a)&&(f.location=k(a)+(b?"&"+k(b):"")+"&ip-geo-block-auth-nonce="+F.nonce)}function q(b,e,g,l){b&&C(b,!0);e.action=d.action;e.nonce=d.nonce;a.post(d.url,e).done(function(a){g&&g(a)}).fail(function(a){R||D(a.status,a.responseText,e.action)}).always(function(){b&&("object"===typeof l?a.when.apply(a,l).then(function(){C(b,!1)}):C(b,!1))})}function M(a,b){q(a,{cmd:"clear-"+a,which:b},function(a){K(a.page,a.tab)})}function S(a){q(a,{cmd:a},function(a){K(a.page,a.tab)})}function x(a){a.stopImmediatePropagation();return!1}function G(a,e){e?a.removeClass("folding-disable"):(a.children(b(".","hide")).hide(),a.addClass("folding-disable"),a.removeClass(b("dropdown")).addClass(b("dropup")))}function N(c,e,g){var l=0===c.prop("type").indexOf("checkbox")&&c.is(":checked")||0===c.prop("type").indexOf("select")&&"0"!==c.val();c.siblings('input[name^="'+b("%","settings")+'"]:checkbox').prop("disabled",!l);a.isArray(e)?a.each(e,function(c,e){a(e).nextAll(b(".","settings-folding")).each(function(b,e){G(a(e),l&&g[c])})}):e.nextAll(b(".","settings-folding")).each(function(b,c){G(a(c),l&&g)})}function T(c){var e=b("@","validation_ajax_");G(c.closest("ul").next(),a(e+"1").is(":checked")||a(e+"2").is(":checked"))}function H(a){return String(a).replace(/[a-z]/gi,function(a){return String.fromCharCode(a.charCodeAt(0)+("n">a.toLowerCase()?13:-13))})}function ea(a,b){var c=new f.FileReader;c.onload=function(a){b&&b(a.target.result)};c.onerror=function(a){D("Error",a.target.error.code)};c.readAsText(a)}function U(c){var e=c.is(":checked"),g=a(b("@","public_target_rule")),l=a(b("@","public_behavior")),d=c.closest("tr").nextAll("tr");d.find('[name^="'+b("%","settings")+'"]').prop("disabled",!e);d.find(b(".","desc")).css("opacity",e?1:.5);N(c,[g,l],["1"===g.val()?!0:!1,l.val()]);e&&l.change()}function O(c,e){c&&("string"===typeof c&&(c=JSON.parse(c)),e&&(a('input[type="checkbox"]').prop("checked",!1).change(),a("input[name*=providers]").prop("disabled",!1).change()),a(b("#","import")).closest("form").deserialize(c),a(b("@","exception_admin")+","+b("@","validation_mimetype")).change(),a('select[name*="'+b("%","settings")+'"]').change(),a(b("@","validation_login")).change(),U(a(b("@","validation_public"))),T(a(b("@","validation_ajax_1"))),e&&(e=b("%","settings[providers][IPInfoDB]"),a(b("@","providers_IPInfoDB")).prop("checked",c[e]?!0:!1)))}function fa(a,b){var c=Math.ceil(a.length/b),e=[],d;for(d=0;d<c;++d){var m=d*b;e.push(a.slice(m,m+b))}return e}function v(c){"object"===typeof f.google&&(1===c?a(b("#","chart-countries")).length&&(h.drawPie(b("chart-countries")),h.drawLine(b("chart-daily"),"date")):5===c&&a(b(".","network")).each(function(b,c){h.drawStacked(a(c).attr("id"))}))}function V(a){if("object"===typeof f.google){var b=["corechart"];5===a&&b.push("bar");f.google.load("visualization","1",{packages:b,callback:function(){v(a)}});E("draw-chart."+a,function(){v(a)})}}function ha(a){var b,c="undefined"!==typeof wpCookies&&wpCookies.getHash("ip-geo-block")||[];for(b in c)c.hasOwnProperty(b)&&(c[b]=c[b].replace(/[^ox\d]/g,"").split(""));"undefined"===typeof c[a]&&(c[a]=[]);return c}function A(b){var c,g,d=[];a.each(b,function(a,b){d[a]="";if("undefined"!==typeof b&&(g=b.length))for(d[a]=b[0]||"o",c=1;c<g;++c)d[a]+=b[c]||"o"});"undefined"!==typeof wpCookies&&wpCookies.setHash("ip-geo-block",d,new Date(Date.now()+2592E6),F.home+F.admin)}function ia(c){var e=ha(c);a("form").on("click","h2,h3 a",function(){f.open(this.href,null);return!1}).on("click","h2,h3",function(){var d=a(this),l=d.closest("fieldset").data("section"),f=d.parent().nextAll(".panel-body").toggle();d.toggleClass(b("dropup")).toggleClass(b("dropdown"));(d=d.hasClass(b("dropdown")))?f.addClass(b("border")).trigger(b("show-body")):f.removeClass(b("border"));e[c][l]=d?"o":"x";A(e);v(c);return!1});a(b("#","toggle-sections")).on("click",function(){var d,l=a(b(".","field")).find("h2,h3"),f=[b("dropdown"),b("dropup")],m=l.filter("."+f[0]).length;l.each(function(g){d=a(this);d.removeClass(f.join(" ")).addClass(m?f[1]:f[0]);d=d.parent().nextAll(".panel-body").toggle(m?!1:!0);m?d.removeClass(b("border")):d.addClass(b("border")).trigger("show-body");e[c][g]=m?"x":"o"});A(e);v(c);return!1});return e}function W(c){a("body").append('<div style="display:none"><form method="POST" id="'+b("export-form")+'" action="'+d.url.replace("ajax.php","post.php")+'"><input type="hidden" name="action" value="'+d.action+'" /><input type="hidden" name="nonce" value="'+d.nonce+'" /><input type="hidden" name="cmd" value="'+c+'" /><input type="hidden" name="data" value="" id="'+b("export-data")+'"/><input type="submit" value="submit" /></form><input type="file" name="settings" id="'+b("file-dialog")+'" /></div>')}function X(a,b,d,f){a=a.cloneNode(!1);a.setAttribute("title",k(d));b=b.cloneNode(!1);b.setAttribute("class","dashicons dashicons-"+f);a.appendChild(b);return a}function Y(c,e,g){a.extend(!0,a.fn.dataTable.defaults,g,{dom:"tp",serverSide:!1,autoWidth:!1,processing:!0,deferRender:!0,deferLoading:10,info:!1,lengthChange:!1,language:{emptyTable:d.i18n[1],loadingRecords:d.i18n[0],processing:d.i18n[0],zeroRecords:d.i18n[2],paginate:{first:"&laquo;",last:"&raquo;",next:"&rsaquo;",previous:"&lsaquo;"}},responsive:{details:{type:"column",target:"td:nth-child(n+2)"}},columnDefs:[{width:"1.25em",targets:0},{orderable:!1,targets:0},{searchable:!1,targets:0},{targets:[0],data:null,defaultContent:'<input type="checkbox">'}],pagingType:"full_numbers",pageLength:10,scroller:!0,scrollY:1E4,scrollCollapse:!0,drawCallback:function(c){var f=a(b("#",e.tableID)).find("td.dataTables_empty"),g="restore-logs"===e.ajaxCMD?3:2;g>c.iDraw?f.html(d.i18n[0]):g===c.iDraw&&(f.html(d.i18n[1]),f=a(b("@","search_filter")),f.val()&&f.trigger("keyup"))}});var l=a(b("#",e.tableID)).DataTable({ajax:{url:d.url,type:"POST",data:{cmd:e.ajaxCMD,action:d.action,nonce:d.nonce}},mark:!0}),h=function(){l.columns.adjust().responsive.recalc().draw(!1)};E("draw-table."+c,h);a(b("#",e.sectionID)).find(".panel-body").off(b("show-body")).on(b("show-body"),function(){h();return!1}).off("change").on("change",'th>input[type="checkbox"]',function(){var c=a(this).prop("checked");a(b("#",e.tableID)).find('td>input[type="checkbox"]').prop("checked",c);return!1});a(b("#","select-target")).off("change").on("change",function(){var c=a(this).find('input[name="'+b("target")+'"]:checked').val();l.columns(e.targetColumn).search("all"!==c?c:"").draw();return!1}).trigger("change");a(b("#","bulk-action")).off("click").on("click",function(){var f=a(this).prev().val(),g=/(<([^>]+)>)/ig,h=/data-hash=[\W]([\w]+)[\W]/i,k={IP:[],AS:[]},r,w,I=a("table.dataTable").find("td>input:checked");if(!f)return!1;if(!I.length)return D(null,d.msg[11]),!1;I.each(function(){w=l.cell(this.parentNode).data();r="bulk-action-remove"===f||"bulk-action-ip-erase"===f?(r=w[e.columnIP].match(h))?","+r[1]:"":"";k.IP.push(w[e.columnIP].replace(g,"")+r);k.AS.push(w[e.columnAS].replace(g,""))});k.IP.length&&q("loading",{cmd:f,which:k},function(d){"undefined"!==typeof d.page?K(d.page,"tab="+c):d&&(l.ajax.reload(),a(b("#",e.tableID)).find('th input[type="checkbox"]').prop("checked",!1))});return!1});a(b("@","search_filter")).off("keyup").on("keyup",function(){l.search(this.value,!1,!0,!/[A-Z]/.test(this.value)).draw();return!1});a(b("#","reset-filter")).off("click").on("click",function(){a(b("@","search_filter")).val("");l.search("").draw();return!1});a(b("@","clear_all")).off("click").on("click",function(){z(d.msg[1===c?4:5],function(){M(1===c?"cache":"logs",null)});return!1});a("table.dataTable tbody").on("click","a",function(){var b=f.location.search.slice(1).split("&"),e=b.length,d={},g;for(g=0;g<e;++g){var l=b[g].split("=");d[l[0]]=l[1]}d.tab=1===c?4:2;d.s=a(this).text().replace(/[^\w\.:\*]/,"");l=[];for(g in d)d.hasOwnProperty(g)&&l.push(g+"="+d[g]);f.open(f.location.pathname+"?"+l.join("&"),"_blank");return!1});return l}var R=!1,p=[],J=a(f).width(),d=IP_GEO_BLOCK,F=IP_GEO_BLOCK_AUTH;a.fn.deserialize=function(b){return this.each(function(){var c,d=this,f={};for(c in b)if(b.hasOwnProperty(c))try{var h=decodeURIComponent(c);var k=decodeURIComponent(b[c]);f.hasOwnProperty(h)||(f[h]=[]);f[h].push(k)}catch(ja){}a.each(f,function(b,e){c=a('[name="'+b+'"]:input',d).val(e);"hidden"!==c.attr("type")&&c.before('<span style="color:red">*</span>')})})};var h={dataPie:[],viewPie:[],drawPie:function(b){if("undefined"===typeof h.dataPie[b]){var c=h.dataPie[b]=new f.google.visualization.DataTable;c.addColumn("string","Country");c.addColumn("number","Requests");c=a.parseJSON(a("#"+b).attr("data-"+b));h.dataPie[b].addRows(c)}"undefined"===typeof h.viewPie[b]&&(h.viewPie[b]=new f.google.visualization.PieChart(t.getElementById(b)));"undefined"!==typeof h.dataPie[b]&&"undefined"!==typeof h.viewPie[b]&&0<a("#"+b).width()&&h.viewPie[b].draw(h.dataPie[b],{backgroundColor:{fill:"transparent"},chartArea:{left:0,top:"5%",width:"100%",height:"90%"},sliceVisibilityThreshold:.015})},dataLine:[],viewLine:[],drawLine:function(b,d){if("undefined"===typeof h.dataLine[b]){var c=h.dataLine[b]=new f.google.visualization.DataTable;c.addColumn(d,"Date");c.addColumn("number","comment");c.addColumn("number","xmlrpc");c.addColumn("number","login");c.addColumn("number","admin");c.addColumn("number","public");var e=a.parseJSON(a("#"+b).attr("data-"+b));var k=e.length;for(c=0;c<k;++c)e[c][0]=new Date(1E3*e[c][0]);h.dataLine[b].addRows(e)}"undefined"===typeof h.viewLine[b]&&(h.viewLine[b]=new f.google.visualization.LineChart(t.getElementById(b)));"undefined"!==typeof h.dataLine[b]&&"undefined"!==typeof h.viewLine[b]&&0<(c=a("#"+b).width())&&h.viewLine[b].draw(h.dataLine[b],{legend:{position:"bottom"},backgroundColor:{fill:"transparent"},hAxis:{format:"MM/dd"+("datetime"===d?" HH:mm":"")},vAxis:{textPosition:320<c?"out":"in"},chartArea:{left:320<c?"10%":0,top:"5%",width:"100%",height:"75%"}})},dataStacked:[],viewStacked:[],drawStacked:function(c){var d,g,l=a("#"+c);"undefined"===typeof h.dataStacked[c]&&(g=a.parseJSON(l.attr("data-"+c)))&&(g.unshift(["site","comment","xmlrpc","login","admin","poblic",{role:"link"}]),h.dataStacked[c]=f.google.visualization.arrayToDataTable(g));"undefined"===typeof h.viewStacked[c]&&(h.viewStacked[c]=new f.google.visualization.BarChart(t.getElementById(c)),f.google.visualization.events.addListener(h.viewStacked[c],"animationfinish",function(){var d,e,f,g=[],k=h.dataStacked[c],m=k.getNumberOfRows(),q=a(b("#","open-new")).prop("checked");for(d=0;d<m;d++)g.push({label:k.getValue(d,0),link:k.getValue(d,6)});m="http://www.w3.org/1999/xlink";l.find("text").each(function(a,b){f=b.parentNode;var c;if(c="g"===f.tagName.toLowerCase()){a:{c=b.textContent;var d,k=g.length;c=c.replace("\u2026","");for(d=0;d<k;++d)if(g.hasOwnProperty(d)&&0===g[d].label.indexOf(c)){c=d;break a}c=-1}c=-1!==(a=c)}c&&(e=t.createElementNS("http://www.w3.org/2000/svg","a"),e.setAttributeNS(m,"xlink:href",g[a].link),e.setAttributeNS(m,"title",g[a].label),e.setAttribute("target",q?"_blank":"_self"),e.setAttribute("class","site"),e.appendChild(f.removeChild(b)),f.appendChild(e),g.splice(a,1))})}));if(0<(d=l.width())&&"undefined"!==typeof h.dataStacked[c]&&"undefined"!==typeof h.viewStacked[c]){var k=b("range");var m=a.parseJSON(a("."+k).attr("data-"+k));g=h.dataStacked[c];k=40*g.getNumberOfRows();h.viewStacked[c].draw(g,{width:d,height:k+80,allowHtml:!0,isStacked:!0,legend:{position:"top"},chartArea:{top:50,left:90,width:"100%",height:k},hAxis:{minValue:0,maxValue:m[1]},backgroundColor:{fill:"transparent"},animation:{startup:!0,duration:200,easing:"out"}})}},ajaxStacked:function(c,d,f,k){c=Math.max(0,Math.min(4,c));d=5*Math.max(1,Math.min(5,d));q(null,{cmd:"restore-network",which:c,offset:d*f*k,length:d},function(c){var e,f,g,k,l;c=fa(c,d);a(b(".","network")).each(function(b,m){if("undefined"!==typeof c[b]){k=a(m).attr("id");l=h.dataStacked[k];g=Math.min(d,c[b].length);for(e=0;e<g;++e)for(f=1;5>=f;f++)l.setValue(e,f,c[b][e][f]);h.drawStacked(k)}})})}};a(function(){var c=Number(d.tab)||0,e=ia(c);a(b(".","inhibit")).on("submit",function(){return!1});a(f).on("beforeunload",function(){R=!0});switch(c){case 0:var g=b("%","settings");a('[id^="'+b("scan-")+'"]').on("click",function(){var c=a(this),d=c.attr("id"),e=c.parent();q(d.replace(/^.*(?:scan)/,"scanning"),{cmd:"scan-code",which:d.replace(b("scan-"),"")},function(a){e.children("ul").length||e.append('<ul id="'+b("code-list")+'"></ul>');e=e.children("ul").empty();for(c in a)if(a.hasOwnProperty(c)){var c=k(c);if("string"===typeof a[c])var d=k(a[c]);else d=k(a[c].code),c='<abbr title="'+k(a[c].type)+'">'+c+"</abbr>";e.append("<li>"+c+' : <span class="'+b("notice")+'">'+d+"</span></li>")}e.show("slow")});return!1});a(b("@","matching_rule")).on("change",function(){var c=this.value;a(b("@","white_list")).closest("tr").toggle("0"===c);a(b("@","black_list")).closest("tr").toggle("1"===c);return!1}).change();a(b(".","icon-cidr")).on("click",function(){var c=a(b("#","admin-styles-css")).get(0).href,d=f.open("about:blank","","width=560,height=170");c=c.slice(0,c.lastIndexOf("css/"));d.document.write('<!DOCTYPE html><html lang=en><meta charset=utf-8><title>CIDR calculator for IPv4 / IPv6</title><link href="'+c+'css/cidr.min.css?v=.1" rel=stylesheet><div class="row container"><div class=row id=i><fieldset class="col span_11"><legend>Range <input id=a type=button value=Clear tabindex=1></legend><textarea id=c name=range placeholder="192.168.0.0 - 192.168.255.255" rows=5 wrap=off tabindex=2></textarea></fieldset><ul class="col span_2" id=h><li class=row><input id=e type=button value=&rarr; class="col span_24" tabindex=3><li class=row><input id=f type=button value=&larr; class="col span_24" tabindex=6></ul><fieldset class="col span_11"><legend>CIDR <input id=b type=button value=Clear tabindex=4></legend><textarea id=d name=cidr placeholder=192.168.0.0/16 rows=5 wrap=off tabindex=5></textarea></fieldset></div><div class=row id=j><span class=col id=g>\u00a0</span></div></div><script src="'+c+'js/cidr.min.js?v=.1">\x3c/script>');d.document.close();return!1});a(b("@","validation_mimetype")).on("change",function(c){var d=a(this),n=parseInt(d.val(),10);d.nextAll(b(".","settings-folding")).each(function(b,c){G(a(c),n===b+1||n&&2===b)});return x(c)}).change();a('select[name*="response_code"]').on("change",function(c){var d=a(this),n=parseInt(d.val()/100,10),e=d.closest("tr").nextAll("tr");if(0<=d.attr("name").indexOf("public")&&-1===parseInt(a(b("@","public_matching_rule")).val(),10))return e.each(function(b){1>=b&&a(this).hide()}),x(c);3>=n?e.each(function(b){0===b?a(this).show():1===b&&a(this).hide()}):e.each(function(b){0===b?a(this).hide():1===b&&a(this).show()});return x(c)}).change();a(b("#","decode")).on("click",function(){var c=a(b("@","signature")),d=c.val();-1===d.search(/,/)?c.val(H(f.atob(d))):c.val(f.btoa(H(d)));return!1});a(b("@","validation_login")).on("change",function(b){var c=a(this);N(c,c,g,!0);return x(b)}).change();q(null,{cmd:"get-actions"},function(c){var e,n=a(b("#","list-admin")),f=t.createElement("li"),g=t.createElement("input"),h=t.createElement("label"),l=t.createElement("dfn"),m=t.createElement("span");for(y in c)if(c.hasOwnProperty(y)){var y=k(y);if(!n.find("#"+(e=b("!","exception_admin_"+y))).size()){var p=g.cloneNode(!1);p.setAttribute("id",e);p.setAttribute("value",y);p.setAttribute("type","checkbox");var r=f.cloneNode(!1);r.appendChild(p);p=h.cloneNode(!1);p.setAttribute("for",e);p.appendChild(t.createTextNode(y));r.appendChild(p);1&c[y]&&r.appendChild(X(l,m,d.msg[6],"lock"));2&c[y]&&r.appendChild(X(l,m,d.msg[7],"unlock"));n.append(r)}}a(b(".","icon-unlock")).on("click",function(){a(b("#","list-admin")+">li").filter(function(){return!a(this).find(".dashicons-unlock").length}).toggle();return!1});a(b("@","exception_admin")).on("change",function(c){var d=a.grep(a(this).val().split(","),function(a){return""!==a.replace(/^\s+|\s+#x2F;g,"")});a(b("#","list-admin")).find("input").each(function(){var b=a(this),c=b.val();b.prop("checked",-1!==a.inArray(c,d))});return x(c)}).change();a(b("#","list-admin")).on("click","input",function(){var c=a(this);var d=a(b("@","exception_admin")),e=c.val(),n=a.grep(d.val().split(","),function(a){return""!==a.replace(/^\s+|\s+#x2F;g,"")});c=a.inArray(e,n);-1===c?n.push(e):n.splice(c,1);d.val(n.join(",")).change()});a(b(".","icon-find")).on("click",function(){var c=a(this),e=[],n=0,f,ca,g,h,l=k(d.msg[9]),u=k(c.data("target"));a(b("#","find-"+u)).empty();c.next().children(b(".","find-desc")).show();c=a(b("#","list-"+u));c.children("li").each(function(b,c){e.push(a(c).find("input").val())});q("find-"+u,{cmd:"find-"+u},function(Q){for(var m in Q)Q.hasOwnProperty(m)&&(++n,f=k(Q[m]),m=k(m),ca=a.inArray(m,e),g=b("!","exception_"+u+"_"+m),h="admin"===u?f+"="+m:"/"+f+"/"+m+"/",h='<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="'+F.sites[0]+F.admin+"options-general.php?page=ip-geo-block&tab=4&s="+encodeURIComponent(h)+'" title="'+l.replace("%s",h)+'" target="_blank"><span></span></a>',0>ca?(e.push(m),c.prepend('<li><input id="'+g+'" value="'+m+'" type="checkbox" '+("admin"===u?"/>":"name=ip_geo_block_settings[exception]["+u+"]["+m+"] />")+'<label for="'+g+'">'+m+"</lable>"+h+"</li>")):(g=c.find("#"+g).parent(),g.find("a").length||g.append(h)));a(b("@","exception_"+u)).trigger("change");a(b("#","find-"+u)).append(' <span class="ip-geo-block-warn">'+k(d.msg[8].replace("%d",n))+"</span>")});return!1})});a('input[id^="'+b("!","validation_ajax_")+'"]').on("change",function(){T(a(this))}).change();a(b("@","validation_public")).on("change",function(b){U(a(this));return x(b)}).change();a(b("@","public_matching_rule")).on("change",function(c){var d=this.value;a(b("@","public_white_list")).closest("tr").toggle("0"===d);a(b("@","public_black_list")).closest("tr").toggle("1"===d);a(b("@","public_response_code")).change().closest("tr").toggle("-1"!==d);return x(c)}).change();a(b("@","public_behavior")).on("change",function(b){var c=a(this);G(c.siblings("ul"),c.prop("checked"));return x(b)}).change();a(b("@","update")).on("click",function(){q("download",{cmd:"download"},function(c){var d;for(d in c)if(c.hasOwnProperty(d)){var e=c[d];for(n in e)if(e.hasOwnProperty(n)){var n=k(n);e[n].filename&&a(b("@",d+"_"+n+"_path")).val(k(e[n].filename));e[n].message&&a(b("#",d+"-"+n)).text(k(e[n].message))}}});return!1});a(b("@","anonymize")).on("change",function(){a('input[class*="remote"]').prop("disabled",a(this).prop("checked"))}).trigger("change");a(b("@","save_statistics")).on("change",function(){a(b("@","validation_recdays")).prop("disabled",!a(this).prop("checked"));return!1}).trigger("change");a(b("@","validation_reclogs")).on("change",function(){var b=a(this);b.parent().parent().nextAll().find('input[id*="validation"]').prop("disabled",0===Number(b.prop("selectedIndex")))}).trigger("change");a(b("@","cache_hold")).on("change",function(){var b=a(this).prop("checked");a('input[id*="cache_time"]').prop("disabled",!b);a('select[id*="login_fails"]').prop("disabled",!b)}).trigger("change");a(b("@","comment_pos")).on("change",function(){var b=a(this);b.nextAll('input[type="text"]').prop("disabled",0===Number(b.prop("selectedIndex")))}).trigger("change");W("validate");a(b("#","export")).on("click",function(){if("undefined"===typeof JSON)return D(null,k(d.msg[10])),!1;var c=g,e={};a.each(a(this).closest("form").serializeArray(),function(a,b){-1!==b.name.indexOf(c)&&(e[b.name]=b.value)});e[c+="[signature]"]=f.btoa(H(e[c]));a(b("#","export-data")).val(JSON.stringify(e));a(b("#","export-form")).submit();return!1});a(b("#","file-dialog")).on("change",function(a){if("undefined"===typeof f.FileReader)return D(null,k(d.msg[10])),!1;var b;(a=a.target.files[0])&&ea(a,function(a){a=JSON.parse(a);b=g+"[signature]";"undefined"!==typeof a[b]&&(a[b]=f.btoa(H(a[b])));q("export-import",{cmd:"validate",data:JSON.stringify(a)},function(a){O(a,!0)})});return!1});a(b("#","import")).on("click",function(){a(b("#","file-dialog")).click();return!1});a(b("#","default")).on("click",function(){z(d.msg[0],function(){q("pre-defined",{cmd:"import-default"},function(a){O(a,!0)})});return!1});a(b("#","preferred")).on("click",function(){z(d.msg[0],function(){q("pre-defined",{cmd:"import-preferred"},function(a){O(a,!1)})});return!1});a(b("@","reset_live")).on("click",function(){q("reset-live",{cmd:"reset-live"});return!1});a(b("@","create_table")).on("click",function(){z(d.msg[1],function(){S("create-table")});return!1});a(b("@","delete_table")).on("click",function(){z(d.msg[2],function(){S("delete-table")});return!1});a(b("#","show-info")).on("click",function(){a(b("#","wp-info")).empty();q("wp-info",{cmd:"show-info"},function(c){var d,e=[];for(d in c)c.hasOwnProperty(d)&&e.push("- "+d+" "+c[d]);a(b("#","wp-info")).html('<textarea class="regular-text code" rows="'+e.length+'">'+e.join("\n")+"</textarea>").find("textarea").select();return!1})});a('select[name^="'+g+'"]').on("change",function(){var c=a(this),d,e=b(".","desc");c.next(e).empty();(d=c.children("option:selected").data("desc"))&&c.next(e).html(a.parseHTML(d));N(c,c,g,!0);return!1}).change();a(b(".","icon-cycle")).on("click",function(){var c=a(this).nextAll("li"),d=c.find(b("@","exception_admin"));c=c.find("input:checkbox").filter(":visible");var e=c.filter(":checked").length;c.prop("checked",!e);if(d.length)if(e)d.val("");else{var f=[];c.each(function(b,c){f.push(a(c).val())});d.val(f.join(","))}a(this).blur();return!1});a(b(".","settings-folding>dfn")).on("click",function(){var c=b("drop"),d=a(this).parent();d.children(b(".","hide")).toggle();d.toggleClass(c+"up").toggleClass(c+"down");d.hasClass(c+"up")&&d.children("div").hide();return!1});a("#submit").on("click",function(){var c=a(b("@","signature")),d=c.val();-1!==d.indexOf(",")&&c.val(f.btoa(H(d)));return!0});break;case 1:V(c);var l=0;a(b("#","sort-slug")).on("click",function(){var b=a(this).closest("ol"),c=b.children("li");(l=!l)?c.sort(function(b,c){return a(b).text()>a(c).text()}):c.sort(function(b,c){return parseInt(a(b).text().replace(/^.*\((\d+)\)#x2F;,"$1"),10)<=parseInt(a(c).text().replace(/^.*\((\d+)\)#x2F;,"$1"),10)});b.children("li").remove();c.appendTo(b)});a(b("@","clear_statistics")).on("click",function(){z(d.msg[3],function(){M("statistics",null)});return!1});a(b("@","clear_logs")).on("click",function(){z(d.msg[5],function(){M("logs",null)});return!1});Y(c,{tableID:"statistics-cache",ajaxCMD:"restore-cache",sectionID:"section-2",targetColumn:4,columnIP:1,columnAS:3},{columns:[{title:'<input type="checkbox">'},{title:d.i18n[3]},{title:d.i18n[4]},{title:d.i18n[5]},{title:d.i18n[6]},{title:d.i18n[7]},{title:d.i18n[8]},{title:d.i18n[9]}],columnDefs:[{responsivePriority:0,targets:0},{responsivePriority:1,targets:1},{responsivePriority:2,targets:2},{responsivePriority:6,targets:3},{responsivePriority:7,targets:4},{responsivePriority:3,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{className:"all",targets:[0,1,2,5]}]});break;case 4:var w={tableID:"validation-logs",sectionID:"section-0",targetColumn:6,columnIP:3,columnAS:5},m={columns:[{title:'<input type="checkbox">'},{title:""},{title:d.i18n[10]},{title:d.i18n[3]},{title:d.i18n[4]},{title:d.i18n[5]},{title:d.i18n[7]},{title:d.i18n[11]},{title:d.i18n[12]},{title:d.i18n[13]},{title:d.i18n[14]},{title:d.i18n[15]}],columnDefs:[{responsivePriority:11,targets:0},{responsivePriority:0,targets:1},{responsivePriority:1,targets:2},{responsivePriority:2,targets:3},{responsivePriority:3,targets:4},{responsivePriority:6,targets:5},{responsivePriority:4,targets:6},{responsivePriority:5,targets:7},{responsivePriority:7,targets:8},{responsivePriority:8,targets:9},{responsivePriority:9,targets:10},{responsivePriority:10,targets:11},{visible:!1,targets:1},{className:"all",targets:[0,2,3,4]},{className:"none",targets:[8,9,10,11]}]},p=null,v=null,C=a(b("#","live-loading")),r=null,P=function(){p&&(f.clearTimeout(p),p=null);v&&(C.removeClass(b("live-timer")),f.clearTimeout(v),v=null)},I=function(){P();q("live-loading",{cmd:"live-start"},function(a){if(a.error)D(null,a.error);else if(a.data.length){var b,c=a.data.length;for(b=0;b<c;b++)r.row.add(a.data[b]);r.draw(!1)}p=f.setTimeout(I,1E3*d.interval)})},E=function(a,b){P();q(null,{cmd:a||"live-stop",callback:b})},J=function(){E("live-pause",function(){C.addClass(b("live-timer"));v=f.setTimeout(function(){P();a(b("#","live-log-stop")).prop("checked",!0)},1E3*d.timeout)})},B=b(""),Z=function(b,c,d){-1===c[7].indexOf("pass")?a(b).addClass(B+d+"blocked"):a(b).addClass(B+d+"passed")},aa=a(b("#","live-log")),ba=a(b("#","live-update"));a(b("#","validation-logs")).on("animationend",function(){a(this).find('tr[class*="'+B+'new"]').each(function(){var b=a(this);-1!==b.prop("class").indexOf("passed")?b.addClass(B+"passed").removeClass(B+"new-passed"):b.addClass(B+"blocked").removeClass(B+"new-blocked")});return!1});aa.on("change",function(){switch(a('input[name="'+b("live-log")+'"]:checked').val()){case "start":I();break;case "pause":J();break;case "stop":E()}});ba.on("change",function(){var d=aa.closest("tr"),f=ba.prop("checked");e[c][1]=f?"o":"x";A(e);r&&r.clear().destroy();f?(d.show().next().next().next().nextAll().hide(),w.ajaxCMD="live-stop",m.order=[1,"desc"],m.createdRow=function(a,b){Z(a,b,"new-")}):(d.hide().next().next().next().nextAll().show(),w.ajaxCMD="restore-logs",m.order=[0,""],m.createdRow=function(a,b){Z(a,b,"")});a(b("#","live-log-stop")).trigger("click");r=Y(c,w,m);return!1}).trigger("change");W("export-logs");a(b("#","export-logs")).on("click",function(){a(b("#","export-form")).submit();return!1});break;case 2:a(f).on(b("gmap-error"),function(){q(null,{cmd:"gmap-error"},function(a){K(a.page,a.tab)})});var L=a(b("#","map"));"object"===typeof f.google?L.each(function(){a(this).GmapRS()}):L.each(function(){a(this).empty().html('<iframe src="'+d.altgmap+'?output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')});a('select[id^="'+b("!","service")+'"]').on("change",function(){e[c][3]=a(this).prop("selectedIndex");A(e)}).change();a(b("@","get_location")).on("click",function(){var c=a(b("#","whois")),d=a.trim(a(b("@","ip_address")).val());if(d){a(b("@","anonymize")).prop("checked")&&(d=d.replace(/([\.:])\w{1,4}#x2F;,"$10"),a(b("@","ip_address")).val(d));c.hide().empty();var e=a.whois(d,function(d){var e,f="";for(e=0;e<d.length;++e)f+="<tr><td>"+d[e].name+"</td><td>"+d[e].value+"</td></tr>";c.html('<fieldset id="'+b("section-1")+'" class="'+b("field")+' panel panel-default" data-section="1"><legend class="panel-heading"><h3 id="'+b("whois-title")+'" class="'+b("dropdown")+'">Whois</h3></legend><div class="panel-body '+b("border")+'"><table class="'+b("table")+'">'+f+"</table></div></fieldset>").fadeIn("slow");a(b("#","whois-title")).on("click",function(){var c=a(this);c.parent().nextAll().toggle();c.toggleClass(b("dropup")).toggleClass(b("dropdown"));return!1})});q("loading",{cmd:"search",ip:d,which:a(b("@","service")).val()},function(a){var c="",e=k(a.latitude||"0"),g=k(a.longitude||"0"),h=a.latitude||a.longitude?8:2;for(l in a)if(a.hasOwnProperty(l)){var l=k(l);c+='<li><span class="'+b("title")+'">'+l+' : </span><span class="'+b("result")+'">'+k(a[l])+"</span></li>"}"object"===typeof f.google?L.GmapRS("addMarker",{latitude:e,longitude:g,title:d,content:"<ul>"+c+"</ul>",show:!0,zoom:h}):L.css({height:"600px",backgroundColor:"transparent"}).empty().html('<ul style="margin-top:0; margin-left:1em;"><li><span class="'+b("title")+'">IP address : </span><span class="'+b("result")+'">'+k(d)+"</span></li>"+c+'</ul><iframe src="//maps.google.com/maps?q='+e+","+g+"&z="+h+'&output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')},[e])}return!1});a(b("@","ip_address")).on("keypress",function(c){if(c.which&&13===c.which||c.keyCode&&13===c.keyCode)return a(b("@","get_location")).click(),!1});a(b("@","ip_address")).val()&&a(b("@","get_location")).click();break;case 5:V(c),a("input[name="+b("duration")+"]:radio").on("click",function(){var b=a('div[class*="paginate"]').find('a[class*="current"]').text();e[c][2]=a(this).val()||0;e[c][3]=e[c][3]||2;e[c][4]=e[c][4]||1;A(e);h.ajaxStacked(e[c][2],e[c][3],e[c][4],b-1)}),a(b("#","open-new")).on("change",function(){var d=a(this).prop("checked");e[c][1]=d?"o":"x";A(e);a(b("#","section-0 svg")).find("a").each(function(){this.setAttribute("target",d?"_blank":"_self")})}),a(b("#","apply-layout")).on("click",function(){var d=a(b("#","select-layout"));e[c][3]=d.find('select[name="rows"] option:selected').val();e[c][4]=d.find('select[name="cols"] option:selected').val();A(e)}),a("ul.wp-submenu>li.wp-first-item").removeClass("current").next().addClass("current")}})})(jQuery,window,document);
admin/js/authenticate.js CHANGED
@@ -228,7 +228,11 @@
228
// Note: in case of url in the admin area of different site, it returns 0
229
function is_admin(url) {
230
// parse uri and get real path
231
- url = url || window.location.pathname; // in case of empty `action` on the form tag
232
var uri = parse_uri(url.toLowerCase());
233
234
// possibly scheme is `javascript` and path is `void(0);`
228
// Note: in case of url in the admin area of different site, it returns 0
229
function is_admin(url) {
230
// parse uri and get real path
231
+ try {
232
+ url = url || window.location.pathname || ''; // in case of empty `action` on the form tag
233
+ } catch (e) {
234
+ url = '';
235
+ }
236
var uri = parse_uri(url.toLowerCase());
237
238
// possibly scheme is `javascript` and path is `void(0);`
admin/js/authenticate.min.js CHANGED
@@ -3,4 +3,4 @@
3
Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
This software is released under the MIT License.
5
*/
6
- (function(g,h,k){function y(a){var b=k.createElement("div");b.appendChild(k.createTextNode(a));a=b.innerHTML.replace(/["']/g,function(a){return{'"':"&quot;","'":"&#39;"}[a]});b="";return a}function q(a){a=a?a.toString():"";a=a.match(/^(?:([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return{scheme:a[1]||"",relative:a[2]||"",authority:a[3]||"",path:a[4]||"",query:a[5]||"",fragment:a[6]||""}}function m(a,b){"object"!==typeof a&&(a=q(a||h.location.href));for(var e=a.query?a.query.split("&"):[],d=e.length;0<d--;)if(0===e[d].indexOf(l.name)){e.splice(d,1);break}e.push(l.name+"="+encodeURIComponent(b));a.query=e.join("&");return(a.scheme?a.scheme+":":"")+(a.relative+a.path)+(a.query?"?"+a.query:"")+(a.fragment?"#"+a.fragment:"")}function u(a){return(!a.scheme||/^https?#x2F;.test(a.scheme))&&(a.path||a.query)}function n(a){a=a||h.location.pathname;var b=q(a.toLowerCase());if(u(b)){b=z(a);if(b.origin!==h.location.origin)return-1;if((a=A.exec(b.pathname))&&(0<=a[0].indexOf(f.admin+"admin-")||0<=a[0].indexOf(f.admin)||0<=a[0].indexOf(f.plugins)||0<=a[0].indexOf(f.themes)))return 1}return 0}function v(a){return-1!==(a.attr("rel")||"").indexOf("nofollow")}function r(a,b,e){var d=b.split(/\s+/);a.each(function(a){for(a=0;a<d.length;++a){var b=g.trim(d[a]).match(/[^\.]+/i)[0],c=g(this),f=b;b=e;c=g._data(c[0]).events[f];f=b?c.splice(c.delegateCount-1,1)[0]:c.pop();c.splice(b?0:c.delegateCount||0,0,f)}})}function p(){if(!l.init){l.init=!0;g("img").each(function(){var a=g(this).attr("src");1===n(a)&&g(this).attr("src",m(a,f.nonce))});if("undefined"!==typeof h._wpRevisionsSettings){var a,b=h._wpRevisionsSettings.revisionData,e=b.length;for(a=0;a<e;++a)-1===b[a].restoreUrl.indexOf(l.name)&&(h._wpRevisionsSettings.revisionData[a].restoreUrl=m(b[a].restoreUrl,f.nonce))}g("#toplevel_page_ip-geo-block li.wp-first-item").each(function(){var a=g(this);a.css("display","IP Geo Block"===a.children("a").text()?"none":"block")})}}var f=IP_GEO_BLOCK_AUTH,l={init:!1,name:"ip-geo-block-auth-nonce"},A=new RegExp("^(?:"+(f.home||"")+f.admin+"|"+(f.home||"")+f.plugins+"|"+(f.home||"")+f.themes+")(?:.*.php|.*/)?quot;),w=function(a){for(var b=a.length;0<b--;)if(-1!==a[b].indexOf("request%5Bbrowse%5D=ip-geo-block-auth")){a[b]="request%5Bbrowse%5D=featured";break}return a},x={"upload.php":function(a){for(var b=a.length;0<b--;)if(-1!==a[b].indexOf("query%5Bip-geo-block-auth-nonce%5D=")){delete a[b];break}return a},"theme-install.php":w,"network/theme-install.php":w},z=function(){var a=null;try{new URL("/","http://example.com/")}catch(b){try{a=(new DOMParser).parseFromString("<html><head></head><body></body></html>","text/html")}catch(e){a=k.implementation.createHTMLDocument("")}}return function(b,e){var d=k;b="undefined"!==typeof b?b:h.location.href;if(null===a){"undefined"===typeof e&&(e=h.location.href);try{var c=new URL(b,e)}catch(B){c=new URL(b,h.location.href)}}else{if("undefined"!==typeof e){for(d=a;d.head.firstChild;)d.head.removeChild(d.head.firstChild);c=d.createElement("base");c.setAttribute("href",e);d.head.appendChild(c)}d=d.createElement("a");d.setAttribute("href",b);d.setAttribute("href",d.href);c={protocol:d.protocol,host:d.host,hostname:d.hostname,port:d.port,pathname:d.pathname,search:d.search,hash:d.hash,href:d.href,username:"",password:"",origin:d.origin||null};"http:"===c.protocol&&"80"===c.port?(c.port="",c.host=c.host.replace(/:80#x2F;,"")):"https:"===c.protocol&&"443"===c.port&&(c.port="",c.host=c.host.replace(/:443#x2F;,""));if("http:"===c.protocol||"https:"===c.protocol)c.pathname&&"/"!==c.pathname.charAt(0)&&(c.pathname="/"+c.pathname),c.origin||(c.origin=c.protocol+"//"+c.hostname+(c.port?":"+c.port:""))}if(c.username||c.password)throw new URIError(c.username+":"+c.password);return c}}();g.ajaxPrefilter(function(a){if(1===n(a.url)&&!a.url.match(/async-upload\.php#x2F;))if("undefined"!==typeof h.FormData&&a.data instanceof FormData)a.data.append(l.name,f.nonce);else{var b=q(a.url);if("undefined"===typeof a.data||b.query)a.url=m(b,f.nonce);else{b=a.data?a.data.split("&"):[];var e=h.location.pathname;e=e.replace(f.home+f.admin,"");(e=x.hasOwnProperty(e)?x[e]:null)&&(b=e(b));b.push(l.name+"="+encodeURIComponent(f.nonce));a.data=b.join("&")}}});"undefined"===typeof g.fn.onFirst&&(g.fn.onFirst=function(a,b){var e,d=g(this),c="string"===typeof b;g.fn.on.apply(d,arguments);if("object"===typeof a)for(e in a)a.hasOwnProperty(e)&&r(d,e,c);else"string"===typeof a&&r(d,a,c);return d});g(h).on("error",function(){p()});g(function(){p()});(function(){var a=g(k);a.onFirst("click contextmenu","a",function(a){var b=0,d=g(this),c=d.attr("href")||"",k=q(c);u(k)&&(b=n(c));if("click"===a.type)if(1===b)d.attr("href",/\/#x2F;.test(k.path)?c:m(c,v(d)?"nofollow":f.nonce));else if(-1===b&&(1===n(h.location.pathname)||0<=h.location.search.indexOf(l.name))){if(!(b="_self"===d.attr("target")))a:{b=c;var t,r=f.sites.length;for(t=0;t<r;++t){var p=b.indexOf(f.sites[t]+"/");if(0<=p&&6>=p){b=!0;break a}}b=!1}if(b)d.attr("href",/\/#x2F;.test(k.path)?c:m(c,v(d)?"nofollow":f.nonce));else if(!this.hasAttribute("onClick"))return c.split(";",2).shift(),c=y(decodeURIComponent(this.href)),b=h.open(),b.document.write('<!DOCTYPE html><html><head><meta name="referrer" content="never" /><meta name="referrer" content="no-referrer" /><meta http-equiv="refresh" content="0; url='+c+'" />'+(g("body").hasClass("webview")?'<script>window.location.replace("'+c+'")\x3c/script>':"")+"</head></html>"),b.document.close(),a.stopImmediatePropagation(),!1}});a.onFirst("submit","form",function(){var a=g(this),e=a.attr("action");1===n(e)&&("post"===(a.attr("method")||"").toLowerCase()?a.attr("action",m(e,f.nonce)):a.append('<input type="hidden" name="'+l.name+'" value="'+f.nonce+'">'))})})()})(jQuery,window,document);
3
Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
4
This software is released under the MIT License.
5
*/
6
+ !function(e,t,n){"use strict";function r(e){return e=e.replace(y.home+y.admin,""),C.hasOwnProperty(e)?C[e]:null}function o(e){var t=n.createElement("div");return t.appendChild(n.createTextNode(e)),e=t.innerHTML.replace(/["']/g,function(e){return{'"':"&quot;","'":"&#39;"}[e]}),t="",e}function a(e){e=e?e.toString():"";var t=e.match(/^(?:([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return{scheme:t[1]||"",relative:t[2]||"",authority:t[3]||"",path:t[4]||"",query:t[5]||"",fragment:t[6]||""}}function i(e){return(e.scheme?e.scheme+":":"")+(e.relative+e.path)+(e.query?"?"+e.query:"")+(e.fragment?"#"+e.fragment:"")}function c(e,n){"object"!=typeof e&&(e=a(e||t.location.href));for(var r=e.query?e.query.split("&"):[],o=r.length;o-- >0;)if(0===r[o].indexOf(w.name)){r.splice(o,1);break}return r.push(w.name+"="+encodeURIComponent(n)),e.query=r.join("&"),i(e)}function h(e){return(!e.scheme||/^https?#x2F;.test(e.scheme))&&(e.path||e.query)}function s(e){try{e=e||t.location.pathname||""}catch(n){e=""}var r=a(e.toLowerCase());if(h(r)){if(r=k(e),r.origin!==t.location.origin)return-1;if(e=b.exec(r.pathname),e&&(0<=e[0].indexOf(y.admin+"admin-")||0<=e[0].indexOf(y.admin)||0<=e[0].indexOf(y.plugins)||0<=e[0].indexOf(y.themes)))return 1}return 0}function f(){return 1===s(t.location.pathname)||t.location.search.indexOf(w.name)>=0}function p(e){var t,n,r=y.sites.length;for(t=0;r>t;++t)if(n=e.indexOf(y.sites[t]+"/"),n>=0&&6>=n)return!0;return!1}function l(e){return/\/#x2F;.test(e.path)}function u(e){return-1!==(e.attr("rel")||"").indexOf("nofollow")}function m(t,n,r){var o=e._data(t[0]).events,a=o[n],i=r?a.splice(a.delegateCount-1,1)[0]:a.pop();a.splice(r?0:a.delegateCount||0,0,i)}function d(t,n,r){var o=n.split(/\s+/);t.each(function(t){for(t=0;t<o.length;++t){var n=e.trim(o[t]).match(/[^\.]+/i)[0];m(e(this),n,r)}})}function g(){var r=e(n);r.onFirst("click contextmenu","a",function(n){var r=0,i=e(this),m=i.attr("href")||"",d=a(m);if(h(d)&&(r=s(m)),"click"===n.type)if(1===r)i.attr("href",l(d)?m:c(m,u(i)?"nofollow":y.nonce));else if(-1===r&&f())if("_self"===i.attr("target")||p(m))i.attr("href",l(d)?m:c(m,u(i)?"nofollow":y.nonce));else if(!this.hasAttribute("onClick"))return m=m.split(";",2).shift(),m=o(decodeURIComponent(this.href)),r=t.open(),r.document.write('<!DOCTYPE html><html><head><meta name="referrer" content="never" /><meta name="referrer" content="no-referrer" /><meta http-equiv="refresh" content="0; url='+m+'" />'+(e("body").hasClass("webview")?'<script>window.location.replace("'+m+'")</script>':"")+"</head></html>"),r.document.close(),n.stopImmediatePropagation(),!1}),r.onFirst("submit","form",function(){var t=e(this),n=t.attr("action");1===s(n)&&("post"===(t.attr("method")||"").toLowerCase()?t.attr("action",c(n,y.nonce)):t.append('<input type="hidden" name="'+w.name+'" value="'+y.nonce+'">'))})}function v(){if(!w.init){if(w.init=!0,e("img").each(function(){var t=e(this).attr("src");1===s(t)&&e(this).attr("src",c(t,y.nonce))}),"undefined"!=typeof t._wpRevisionsSettings){var n,r=t._wpRevisionsSettings.revisionData,o=r.length;for(n=0;o>n;++n)-1===r[n].restoreUrl.indexOf(w.name)&&(t._wpRevisionsSettings.revisionData[n].restoreUrl=c(r[n].restoreUrl,y.nonce))}e("#toplevel_page_ip-geo-block li.wp-first-item").each(function(){var t=e(this);t.css("display","IP Geo Block"===t.children("a").text()?"none":"block")})}}var y=IP_GEO_BLOCK_AUTH,w={init:!1,name:"ip-geo-block-auth-nonce"},b=new RegExp("^(?:"+(y.home||"")+y.admin+"|"+(y.home||"")+y.plugins+"|"+(y.home||"")+y.themes+")(?:.*.php|.*/)?quot;),x=function(e){for(var t=e.length;t-- >0;)if(-1!==e[t].indexOf("request%5Bbrowse%5D=ip-geo-block-auth")){e[t]="request%5Bbrowse%5D=featured";break}return e},O=function(e){for(var t=e.length;t-- >0;)if(-1!==e[t].indexOf("query%5Bip-geo-block-auth-nonce%5D=")){delete e[t];break}return e},C={"upload.php":O,"theme-install.php":x,"network/theme-install.php":x},k=function(){var e=null;try{new URL("/","http://example.com/")}catch(r){try{e=(new DOMParser).parseFromString("<html><head></head><body></body></html>","text/html")}catch(o){e=n.implementation.createHTMLDocument("")}}return function(r,o){var a,i,c,h=n;if(r="undefined"!=typeof r?r:t.location.href,null===e){"undefined"==typeof o&&(o=t.location.href);try{c=new URL(r,o)}catch(s){c=new URL(r,t.location.href)}}else{if("undefined"!=typeof o){for(h=e;h.head.firstChild;)h.head.removeChild(h.head.firstChild);a=h.createElement("base"),a.setAttribute("href",o),h.head.appendChild(a)}i=h.createElement("a"),i.setAttribute("href",r),i.setAttribute("href",i.href),c={protocol:i.protocol,host:i.host,hostname:i.hostname,port:i.port,pathname:i.pathname,search:i.search,hash:i.hash,href:i.href,username:"",password:"",origin:i.origin||null},"http:"===c.protocol&&"80"===c.port?(c.port="",c.host=c.host.replace(/:80#x2F;,"")):"https:"===c.protocol&&"443"===c.port&&(c.port="",c.host=c.host.replace(/:443#x2F;,"")),"http:"!==c.protocol&&"https:"!==c.protocol||(c.pathname&&"/"!==c.pathname.charAt(0)&&(c.pathname="/"+c.pathname),c.origin||(c.origin=c.protocol+"//"+c.hostname+(c.port?":"+c.port:"")))}if(c.username||c.password)throw new URIError(c.username+":"+c.password);return c}}();e.ajaxPrefilter(function(e){if(1===s(e.url)&&!e.url.match(/async-upload\.php#x2F;))if("undefined"!=typeof t.FormData&&e.data instanceof FormData)e.data.append(w.name,y.nonce);else{var n,o,i=a(e.url);"undefined"==typeof e.data||i.query?e.url=c(i,y.nonce):(n=e.data?e.data.split("&"):[],o=r(t.location.pathname),o&&(n=o(n)),n.push(w.name+"="+encodeURIComponent(y.nonce)),e.data=n.join("&"))}}),"undefined"==typeof e.fn.onFirst&&(e.fn.onFirst=function(t,n){var r,o=e(this),a="string"==typeof n;if(e.fn.on.apply(o,arguments),"object"==typeof t)for(r in t)t.hasOwnProperty(r)&&d(o,r,a);else"string"==typeof t&&d(o,t,a);return o}),e(t).on("error",function(){v()}),e(function(){v()}),g()}(jQuery,window,document);
classes/class-ip-geo-block-apis.php CHANGED
@@ -134,8 +134,7 @@ abstract class IP_Geo_Block_API {
134
$res = array();
135
foreach ( $template['transform'] as $key => $val ) {
136
if ( ! empty( $val ) && ! empty( $data[ $val ] ) )
137
- $res[ $key ] = is_string( $data[ $val ] ) ?
138
- esc_html( $data[ $val ] ) : $data[ $val ];
139
}
140
141
// if country code is '-' or 'UNDEFINED' then error.
@@ -199,21 +198,49 @@ abstract class IP_Geo_Block_API {
199
}
200
201
/**
202
- * Class for freegeoip.net
203
*
204
- * URL : http://freegeoip.net/
205
- * Term of use :
206
- * Licence fee : free (donationware)
207
- * Rate limit : 10,000 queries per hour
208
- * Sample URL : http://freegeoip.net/json/124.83.187.140
209
- * Sample URL : http://freegeoip.net/xml/yahoo.co.jp
210
* Input type : IP address (IPv4, IPv6) / domain name
211
- * Output type : json, jsonp, xml, csv
212
*/
213
- class IP_Geo_Block_API_freegeoipnet extends IP_Geo_Block_API {
214
protected $template = array(
215
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
216
- 'url' => 'http://freegeoip.net/%API_FORMAT%/%API_IP%',
217
'api' => array(
218
'%API_FORMAT%' => 'json',
219
),
@@ -231,19 +258,19 @@ class IP_Geo_Block_API_freegeoipnet extends IP_Geo_Block_API {
231
/**
232
* Class for ipinfo.io
233
*
234
- * URL : http://ipinfo.io/
235
- * Term of use : http://ipinfo.io/developers#terms
236
* Licence fee : free
237
* Rate limit :
238
- * Sample URL : http://ipinfo.io/124.83.187.140/json
239
- * Sample URL : http://ipinfo.io/124.83.187.140/country
240
* Input type : IP address (IPv4)
241
* Output type : json
242
*/
243
class IP_Geo_Block_API_ipinfoio extends IP_Geo_Block_API {
244
protected $template = array(
245
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
246
- 'url' => 'http://ipinfo.io/%API_IP%/%API_FORMAT%%API_OPTION%',
247
'api' => array(
248
'%API_FORMAT%' => 'json',
249
'%API_OPTION%' => '',
@@ -289,7 +316,7 @@ class IP_Geo_Block_API_ipinfoio extends IP_Geo_Block_API {
289
class IP_Geo_Block_API_Nekudo extends IP_Geo_Block_API {
290
protected $template = array(
291
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
292
- 'url' => 'http://geoip.nekudo.com/api/%API_IP%',
293
'api' => array(),
294
'transform' => array(
295
'countryCode' => 'country',
@@ -314,36 +341,6 @@ class IP_Geo_Block_API_Nekudo extends IP_Geo_Block_API {
314
}
315
}
316
317
- /**
318
- * Class for Xhanch
319
- *
320
- * URL : http://xhanch.com/xhanch-api-ip-get-detail/
321
- * Term of use :
322
- * Licence fee : free (donationware)
323
- * Rate limit :
324
- * Sample URL : http://api.xhanch.com/ip-get-detail.php?ip=124.83.187.140
325
- * Sample URL : http://api.xhanch.com/ip-get-detail.php?ip=124.83.187.140&m=json
326
- * Input type : IP address (IPv4)
327
- * Output type : xml, json
328
- */
329
- class IP_Geo_Block_API_Xhanch extends IP_Geo_Block_API {
330
- protected $template = array(
331
- 'type' => IP_GEO_BLOCK_API_TYPE_IPV4,
332
- 'url' => 'http://api.xhanch.com/ip-get-detail.php?ip=%API_IP%&m=%API_FORMAT%',
333
- 'api' => array(
334
- '%API_FORMAT%' => 'json',
335
- ),
336
- 'transform' => array(
337
- 'countryCode' => 'country_code',
338
- 'countryName' => 'country_name',
339
- 'regionName' => 'region',
340
- 'cityName' => 'city',
341
- 'latitude' => 'latitude',
342
- 'longitude' => 'longitude',
343
- )
344
- );
345
- }
346
-
347
/**
348
* Class for GeoIPLookup.net
349
*
@@ -405,8 +402,8 @@ class IP_Geo_Block_API_ipapicom extends IP_Geo_Block_API {
405
/**
406
* Class for IPInfoDB
407
*
408
- * URL : http://ipinfodb.com/
409
- * Term of use : http://ipinfodb.com/ipinfodb_agreement.pdf
410
* Licence fee : free (need to regist to get API key)
411
* Rate limit : 2 queries/second for registered user
412
* Sample URL : http://api.ipinfodb.com/v3/ip-city/?key=...&format=xml&ip=124.83.187.140
@@ -477,8 +474,7 @@ class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
477
$last = $time;
478
}
479
480
- // update elements
481
- IP_Geo_Block_Logs::update_cache( $cache = array(
482
'time' => $time,
483
'ip' => $ip,
484
'hook' => $hook,
@@ -489,8 +485,10 @@ class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
489
'call' => $settings['save_statistics'] ? $call : 0,
490
'last' => $last,
491
'view' => $view,
492
- 'host' => isset( $validate['host'] ) ? $validate['host'] : NULL,
493
- ) );
494
495
return self::$memcache[ $ip ] = $cache;
496
}
@@ -500,10 +498,6 @@ class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
500
self::$memcache = array();
501
}
502
503
- public static function get_cache_all() {
504
- return IP_Geo_Block_Logs::restore_cache();
505
- }
506
-
507
public static function get_cache( $ip ) {
508
if ( ! empty( self::$memcache[ $ip ] ) )
509
return self::$memcache[ $ip ];
@@ -530,17 +524,16 @@ class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
530
class IP_Geo_Block_Provider {
531
532
protected static $providers = array(
533
-
534
- 'freegeoip.net' => array(
535
'key' => NULL,
536
'type' => 'IPv4, IPv6 / free',
537
- 'link' => '<a rel="noreferrer" href="http://freegeoip.net/" title="freegeoip.net: FREE IP Geolocation Web Service">http://freegeoip.net/</a>&nbsp;(IPv4, IPv6 / free)',
538
),
539
540
'ipinfo.io' => array(
541
'key' => NULL,
542
'type' => 'IPv4, IPv6 / free',
543
- 'link' => '<a rel="noreferrer" href="http://ipinfo.io/" title="ip address information including geolocation, hostname and network details">http://ipinfo.io/</a>&nbsp;(IPv4, IPv6 / free)',
544
),
545
546
'Nekudo' => array(
@@ -549,12 +542,6 @@ class IP_Geo_Block_Provider {
549
'link' => '<a rel="noreferrer" href="http://geoip.nekudo.com/" title="geoip.nekudo.com | Free IP to geolocation API">http://geoip.nekudo.com/</a>&nbsp;(IPv4, IPv6 / free)',
550
),
551
552
- 'Xhanch' => array(
553
- 'key' => NULL,
554
- 'type' => 'IPv4 / free',
555
- 'link' => '<a rel="noreferrer" href="http://xhanch.com/xhanch-api-ip-get-detail/" title="Xhanch API &#8211; IP Get Detail | Xhanch Studio">http://xhanch.com/</a>&nbsp;(IPv4 / free)',
556
- ),
557
-
558
'GeoIPLookup' => array(
559
'key' => NULL,
560
'type' => 'IPv4, IPv6 / free',
@@ -567,10 +554,16 @@ class IP_Geo_Block_Provider {
567
'link' => '<a rel="noreferrer" href="http://ip-api.com/" title="IP-API.com - Free Geolocation API">http://ip-api.com/</a>&nbsp;(IPv4, IPv6 / free for non-commercial use)',
568
),
569
570
'IPInfoDB' => array(
571
'key' => '',
572
'type' => 'IPv4, IPv6 / free for registered user',
573
- 'link' => '<a rel="noreferrer" href="http://ipinfodb.com/" title="IPInfoDB | Free IP Address Geolocation Tools">http://ipinfodb.com/</a>&nbsp;(IPv4, IPv6 / free for registered user)',
574
),
575
);
576
@@ -606,7 +599,7 @@ class IP_Geo_Block_Provider {
606
* Returns the pairs of provider name and API key
607
*
608
*/
609
- public static function get_providers( $key = 'key', $rand = FALSE, $cache = FALSE ) {
610
// add internal DB
611
$list = array();
612
foreach ( self::$internals as $provider => $tmp ) {
@@ -614,14 +607,16 @@ class IP_Geo_Block_Provider {
614
$list[ $provider ] = $tmp[ $key ];
615
}
616
617
- $tmp = array_keys( self::$providers );
618
619
- // randomize
620
- if ( $rand )
621
- shuffle( $tmp );
622
623
- foreach ( $tmp as $name ) {
624
- $list[ $name ] = self::$providers[ $name ][ $key ];
625
}
626
627
return $list;
@@ -631,14 +626,13 @@ class IP_Geo_Block_Provider {
631
* Returns providers name list which are checked in settings
632
*
633
*/
634
- public static function get_valid_providers( $settings, $rand = TRUE, $cache = TRUE ) {
635
$list = array();
636
637
- foreach ( self::get_providers( 'key', $rand, $cache ) as $provider => $key ) {
638
- if ( ! empty( $settings[ $provider ] ) || (
639
- ! isset( $settings[ $provider ] ) && NULL === $key ) ) {
640
- $list[] = $provider;
641
- }
642
}
643
644
return $list;
134
$res = array();
135
foreach ( $template['transform'] as $key => $val ) {
136
if ( ! empty( $val ) && ! empty( $data[ $val ] ) )
137
+ $res[ $key ] = is_string( $data[ $val ] ) ? esc_html( $data[ $val ] ) : $data[ $val ];
138
}
139
140
// if country code is '-' or 'UNDEFINED' then error.
198
}
199
200
/**
201
+ * Class for Ipdata.co
202
*
203
+ * URL : https://ipdata.co/
204
+ * Term of use : https://ipdata.co/terms.html
205
+ * Licence fee : free
206
+ * Rate limit : 1500 requests free daily
207
+ * Sample URL : https://api.ipdata.co/8.8.8.8
208
+ * Input type : IP address (IPv4, IPv6)
209
+ * Output type : json
210
+ */
211
+ class IP_Geo_Block_API_Ipdataco extends IP_Geo_Block_API {
212
+ protected $template = array(
213
+ 'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
214
+ 'url' => 'https://api.ipdata.co/%API_IP%',
215
+ 'api' => array(
216
+ '%API_FORMAT%' => 'json',
217
+ ),
218
+ 'transform' => array(
219
+ 'countryCode' => 'country_code',
220
+ 'countryName' => 'country_name',
221
+ 'regionName' => 'region',
222
+ 'cityName' => 'city',
223
+ 'latitude' => 'latitude',
224
+ 'longitude' => 'longitude',
225
+ )
226
+ );
227
+ }
228
+
229
+ /**
230
+ * Class for ipstack
231
+ *
232
+ * URL : https://ipstack.com/
233
+ * Term of use : https://ipstack.com/terms
234
+ * Licence fee : free for registered user
235
+ * Rate limit : 10,000 queries per month
236
+ * Sample URL : http://api.ipstack.com/186.116.207.169?access_key=YOUR_ACCESS_KEY&output=json&legacy=1
237
* Input type : IP address (IPv4, IPv6) / domain name
238
+ * Output type : json, xml
239
*/
240
+ class IP_Geo_Block_API_ipstack extends IP_Geo_Block_API {
241
protected $template = array(
242
'type' => IP_GEO_BLOCK_API_TYPE_BOTH,
243
+ 'url' => 'http://api.ipstack.com/%API_IP%?access_key=%API_KEY%&output=%API_FORMAT%&legacy=1',
244
'api' => array(
245
'%API_FORMAT%' => 'json',
246