IP Geo Block - Version 3.0.10

Version Description

  • New feature: Add "Block badly-behaved bots and crawlers" in "Front-end target settings" section that validates the frequency of request.
  • Improvement: Add a help link to the document for some sections.
  • Improvement: Add descriptions on "Target actions" at "Login form" in "Back-end target settings" section.
  • Improvement: Add new descriptions "passUA" and "blockUA" for result in Logs to identify the reason when "UA string and qualification" is applied.
  • Improvement: AS Number can be handled in "UA string and qualification".
  • Improvement: Make WP cron job for "Auto updating" reliably in multisite environment.
  • Improvement: Better logout compatibility for redirecting to the previous page after login.
  • Improvement: Validate the prefix of IP address CIDR to prevent unexpected fatal error.
  • Improvement: Prevent opening a new window on clicking "Visit Site" in the admin bar menu for multi site by multi domain type.
  • Bug fix: Fix the issue of failing to retrieve client IP address from Chrome Data Saver.
  • Bug fix: Fix the issue of illegal redirection after "Save Changes" on "Settings" => "General Settings" page.
  • Bug fix: Fix the issue of unexpected blocking against the requests to plugins/themes area when "Force to load WP core" is enabled on windows server.
  • Bug fix: Fix the issue that "Search now" was not available when google map failed to load.
Download this release

Release Info

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

Code changes from version 3.0.9 to 3.0.10

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.4
7
- Stable tag: 3.0.9
8
License: GPLv3
9
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10
@@ -35,6 +35,9 @@ After several days of installation, you'll be supprised to find many malicious o
35
* **Prevent malicious down/uploading:**
36
A malicious request such as exposing `wp-config.php` or uploading malwares via vulnerable plugins/themes can be blocked.
37
38
* **Support of BuddyPress and bbPress:**
39
You can configure this plugin so that a registered user can login as a membership from anywhere, while a request such as a new user registration, lost password, creating a new topic and subscribing comment can be blocked by country. It is suitable for [BuddyPress](https://wordpress.org/plugins/buddypress/ "BuddyPress — WordPress Plugins") and [bbPress](https://wordpress.org/plugins/bbpress/ "WordPress › bbPress « WordPress Plugins") to help reducing spams.
40
@@ -353,8 +356,23 @@ Please refer to "[How can I fix permission troubles?](http://www.ipgeoblock.com/
353
354
== Changelog ==
355
356
= 3.0.9 =
357
- * **New featuer:** Add CIDR calculator for IPv4 / IPv6.
358
* **Improvement:** Avoid blocking by wp-zep when IP address is private or loopback network.
359
* **Improvement:** Chnage the priority of internal action hook for better compatibility with other plugins/themes.
360
* **Maintenance:** Change the priority order of local geolocation databases.
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.4
7
+ Stable tag: 3.0.10
8
License: GPLv3
9
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
10
35
* **Prevent malicious down/uploading:**
36
A malicious request such as exposing `wp-config.php` or uploading malwares via vulnerable plugins/themes can be blocked.
37
38
+ * **Block badly-behaved bots and crawlers:**
39
+ A simple logic may help to reduce the number of rogue bots and crawlers scraping your site.
40
+
41
* **Support of BuddyPress and bbPress:**
42
You can configure this plugin so that a registered user can login as a membership from anywhere, while a request such as a new user registration, lost password, creating a new topic and subscribing comment can be blocked by country. It is suitable for [BuddyPress](https://wordpress.org/plugins/buddypress/ "BuddyPress — WordPress Plugins") and [bbPress](https://wordpress.org/plugins/bbpress/ "WordPress › bbPress « WordPress Plugins") to help reducing spams.
43
356
357
== Changelog ==
358
359
+ = 3.0.10 =
360
+ * **New feature:** Add "Block badly-behaved bots and crawlers" in "Front-end target settings" section that validates the frequency of request.
361
+ * **Improvement:** Add a help link to the document for some sections.
362
+ * **Improvement:** Add descriptions on "Target actions" at "Login form" in "Back-end target settings" section.
363
+ * **Improvement:** Add new descriptions "passUA" and "blockUA" for result in Logs to identify the reason when "UA string and qualification" is applied.
364
+ * **Improvement:** AS Number can be handled in "UA string and qualification".
365
+ * **Improvement:** Make WP cron job for "Auto updating" reliably in multisite environment.
366
+ * **Improvement:** Better logout compatibility for redirecting to the previous page after login.
367
+ * **Improvement:** Validate the prefix of IP address CIDR to prevent unexpected fatal error.
368
+ * **Improvement:** Prevent opening a new window on clicking "Visit Site" in the admin bar menu for multi site by multi domain type.
369
+ * **Bug fix:** Fix the issue of failing to retrieve client IP address from Chrome Data Saver.
370
+ * **Bug fix:** Fix the issue of illegal redirection after "Save Changes" on "Settings" => "General Settings" page.
371
+ * **Bug fix:** Fix the issue of unexpected blocking against the requests to plugins/themes area when "Force to load WP core" is enabled on windows server.
372
+ * **Bug fix:** Fix the issue that "Search now" was not available when google map failed to load.
373
+
374
= 3.0.9 =
375
+ * **New feature:** Add CIDR calculator for IPv4 / IPv6.
376
* **Improvement:** Avoid blocking by wp-zep when IP address is private or loopback network.
377
* **Improvement:** Chnage the priority of internal action hook for better compatibility with other plugins/themes.
378
* **Maintenance:** Change the priority order of local geolocation databases.
admin/class-ip-geo-block-admin.php CHANGED
@@ -55,25 +55,22 @@ class IP_Geo_Block_Admin {
55
*
56
*/
57
public function admin_init() {
58
- require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
59
-
60
// Add the options page and menu item.
61
add_action( 'admin_menu', array( $this, 'setup_admin_page' ) );
62
add_action( 'admin_post_ip_geo_block', array( $this, 'admin_ajax_callback' ) );
63
add_action( 'wp_ajax_ip_geo_block', array( $this, 'admin_ajax_callback' ) );
64
add_filter( 'wp_prepare_revision_for_js', array( $this, 'add_revision_nonce' ), 10, 3 );
65
66
- // If multisite, then enque the authentication script for network admin
67
- if ( is_multisite() ) {
68
- add_action( 'network_admin_menu', array( $this, 'setup_admin_page' ) );
69
70
- // validate capability instead of nonce. @since 2.0.0 && 3.0.0
71
- if ( $this->is_network = is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) )
72
- add_filter( IP_Geo_Block::PLUGIN_NAME . '-bypass-admins', array( $this, 'verify_network_redirect' ), 10, 2 );
73
74
- // when a blog is created or deleted.
75
- add_action( 'wpmu_new_blog', array( $this, 'create_blog' ), 10, 6 ); // @since MU
76
- add_action( 'delete_blog', array( $this, 'delete_blog' ), 10, 2 ); // @since 3.0.0
77
}
78
79
// loads a plugin’s translated strings.
@@ -106,7 +103,7 @@ class IP_Geo_Block_Admin {
106
*
107
*/
108
public function add_redirect_nonce( $location, $status ) {
109
- return IP_Geo_Block_Util::rebuild_nonce( $location, $status );
110
}
111
112
/**
@@ -127,10 +124,15 @@ class IP_Geo_Block_Admin {
127
* Verify admin screen without action instead of validating nonce.
128
*
129
*/
130
- public function verify_network_redirect( $queries, $settings ) {
131
// the request that is intended to show the page without any action follows authentication of core.
132
- if ( 'GET' === $_SERVER['REQUEST_METHOD'] && isset( $_GET['page'] ) && empty( $_GET['action'] ) )
133
$queries[] = $_GET['page'];
134
135
return $queries;
136
}
@@ -140,7 +142,7 @@ class IP_Geo_Block_Admin {
140
*
141
*/
142
public function create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
143
- defined( 'IP_GEO_BLOCK_DEBUG' ) and IP_GEO_BLOCK_DEBUG and assert( 'is_main_site()', 'Not main blog.' );
144
145
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-actv.php';
146
@@ -408,14 +410,13 @@ class IP_Geo_Block_Admin {
408
409
if ( $admin_menu ) {
410
// `settings-updated` would be added just after settings updated.
411
- if ( ! empty( $_REQUEST['settings-updated'] ) && $this->is_network ) {
412
- $this->sync_multisite_option( $settings );
413
- wp_safe_redirect(
414
- esc_url_raw( add_query_arg(
415
- array( 'page' => IP_Geo_Block::PLUGIN_NAME ),
416
- $this->dashboard_url( TRUE )
417
- ) )
418
- );
419
exit;
420
}
421
@@ -437,6 +438,7 @@ class IP_Geo_Block_Admin {
437
'manage_network_options',
438
IP_Geo_Block::PLUGIN_NAME,
439
array( $this, 'display_plugin_admin_page' )
440
);
441
add_submenu_page(
442
IP_Geo_Block::PLUGIN_NAME,
@@ -454,7 +456,6 @@ class IP_Geo_Block_Admin {
454
IP_Geo_Block::PLUGIN_NAME . '&tab=5',
455
array( $this, 'display_plugin_admin_page' )
456
);
457
-
458
wp_enqueue_style( IP_Geo_Block::PLUGIN_NAME . '-admin-icons',
459
plugins_url( ! defined( 'IP_GEO_BLOCK_DEBUG' ) || ! IP_GEO_BLOCK_DEBUG ?
460
'css/admin-icons.min.css' : 'css/admin-icons.css', __FILE__
@@ -628,9 +629,9 @@ class IP_Geo_Block_Admin {
628
// TRUE if open ('o') or FALSE if close ('x')
629
$stat = empty( $cookie[ $tab ][ $index ] ) || 'x' !== $cookie[ $tab ][ $index ] || $index === $target;
630
631
- echo "\n",
632
- '<fieldset id="', IP_Geo_Block::PLUGIN_NAME, '-section-', $index, '" class="', IP_Geo_Block::PLUGIN_NAME, '-field panel panel-default" data-section="', $index, '">', "\n",
633
- '<legend class="panel-heading"><h3 class="', IP_Geo_Block::PLUGIN_NAME, ( $stat ? '-dropdown' : '-dropup' ), '">', $section['title'],
634
'</h3></legend>', "\n", '<div class="panel-body',
635
($stat ? ' ' . IP_Geo_Block::PLUGIN_NAME . '-border"' : '"'),
636
($stat || (4 === $tab && $index) ? '>' : ' style="display:none">'), "\n";
@@ -686,6 +687,8 @@ class IP_Geo_Block_Admin {
686
unset( $tabs[5] ); // Site List
687
}
688
} else {
689
$action = 'edit.php?action=' . IP_Geo_Block::PLUGIN_NAME;
690
691
if ( $settings['network_wide'] ) {
@@ -704,7 +707,7 @@ class IP_Geo_Block_Admin {
704
echo '<a href="?page=', IP_Geo_Block::PLUGIN_NAME, '&amp;tab=', $key, '" class="nav-tab', ($tab === $key ? ' nav-tab-active' : ''), '">', $val, '</a>';
705
} ?>
706
</h2>
707
- <p style="text-align:left">[ <a id="ip-geo-block-toggle-sections" href="#!"><?php _e( 'Toggle all', 'ip-geo-block' ); ?></a> ]
708
<?php if ( 4 === $tab ) { /* Logs tab */ ?>
709
<input id="ip-geo-block-live-update" type="checkbox"<?php checked( isset( $cookie[4][1] ) && 'o' === $cookie[4][1] ); disabled( extension_loaded( 'pdo_sqlite' ), FALSE ); ?> /><label for="ip-geo-block-live-update">
710
<dfn title="<?php _e( 'Independent of &#8220;Statistics and Logs settings&#8221;, you can see all the requests validated by this plugin in almost real time.', 'ip-geo-block' ); ?>"><?php _e( 'Live update', 'ip-geo-block' ); ?></dfn>
@@ -788,7 +791,6 @@ class IP_Geo_Block_Admin {
788
}
789
790
switch ( $args['type'] ) {
791
-
792
case 'check-provider':
793
echo "\n<ul class=\"ip-geo-block-list\">\n";
794
foreach ( $args['providers'] as $key => $val ) {
@@ -819,7 +821,7 @@ class IP_Geo_Block_Admin {
819
<input type="checkbox" id="<?php echo $id, $sub_id, '_', $key; ?>" name="<?php echo $name, $sub_name, '[', $key, ']'; ?>" value="<?php echo $key; ?>"<?php
820
checked( is_array( $args['value'] ) ? ! empty( $args['value'][ $key ] ) : ( $key & $args['value'] ? TRUE : FALSE ) ); ?> />
821
<label for="<?php echo $id, $sub_id, '_', $key; ?>"><?php
822
- if ( isset( $args['desc'][ $key ] ) )
823
echo '<dfn title="', $args['desc'][ $key ], '">', $val, '</dfn>';
824
else
825
echo $val;
@@ -875,8 +877,8 @@ class IP_Geo_Block_Admin {
875
break; // disabled @since 3.0
876
877
case 'textarea': ?>
878
- <textarea class="regular-text code" id="<?php echo $id, $sub_id; ?>" name="<?php echo $name, $sub_name; ?>"<?php
879
- disabled( ! empty( $args['disabled'] ), TRUE );
880
if ( isset( $args['placeholder'] ) ) echo ' placeholder="', esc_html( $args['placeholder'] ), '"'; ?>><?php
881
echo esc_html( $args['value'] ); ?></textarea>
882
<?php
@@ -915,8 +917,7 @@ class IP_Geo_Block_Admin {
915
916
// Integrate posted data into current settings because it can be a part of hole data
917
$input = array_replace_recursive(
918
- $output = $this->preprocess_options( $output, $default ),
919
- $input
920
);
921
922
// restore the 'signature' that might be transformed to avoid self blocking
@@ -1038,9 +1039,7 @@ class IP_Geo_Block_Admin {
1038
foreach ( $input[ $key ][ $sub ] as $k => $v ) {
1039
$output[ $key ][ $sub ] |= $v;
1040
}
1041
- }
1042
-
1043
- else {
1044
$output[ $key ][ $sub ] = ( is_int( $default[ $key ][ $sub ] ) ?
1045
(int)$input[ $key ][ $sub ] :
1046
IP_Geo_Block_Util::kses( trim( $input[ $key ][ $sub ] ), FALSE )
@@ -1085,8 +1084,8 @@ class IP_Geo_Block_Admin {
1085
}
1086
1087
// keep disabled checkboxes not in the form
1088
- foreach ( array( 'target_pages', 'target_posts', 'target_cates', 'target_tags', 'simulate', 'dnslkup' ) as $key ) {
1089
- $output['public'][ $key ] = array();
1090
}
1091
1092
// 3.0.4 AS number, 3.0.6 Auto updating of DB files, 3.0.8 Geolite2
@@ -1177,6 +1176,16 @@ class IP_Geo_Block_Admin {
1177
}
1178
}
1179
1180
return $output;
1181
}
1182
@@ -1244,8 +1253,7 @@ class IP_Geo_Block_Admin {
1244
1245
// additional configuration
1246
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-opts.php';
1247
- $file = IP_Geo_Block_Opts::setup_validation_timing( $options );
1248
- if ( TRUE !== $file ) {
1249
$options['validation']['timing'] = 0;
1250
self::add_admin_notice( 'error', sprintf(
1251
__( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), '<code>' . $file . '</code>'
@@ -1274,14 +1282,14 @@ class IP_Geo_Block_Admin {
1274
// Go through the posted data and save the targetted options.
1275
foreach ( $options as $option ) {
1276
if ( isset( $_POST[ $option ] ) )
1277
- $this->sync_multisite_option( $_POST[ $option ] );
1278
}
1279
1280
// Register a settings error to be displayed to the user
1281
self::add_admin_notice( 'updated', __( 'Settings saved.' ) );
1282
1283
// Redirect in order to back to the settings page.
1284
- wp_redirect( esc_url_raw(
1285
add_query_arg(
1286
array( 'page' => IP_Geo_Block::PLUGIN_NAME ),
1287
$this->dashboard_url( ! empty( $_POST[ $option ]['network_wide'] ) )
@@ -1295,14 +1303,16 @@ class IP_Geo_Block_Admin {
1295
*
1296
* @note: This function triggers `validate_settings()` on register_setting() in wp-include/option.php.
1297
*/
1298
- private function sync_multisite_option( $option ) {
1299
global $wpdb;
1300
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" );
1301
$ret = TRUE;
1302
1303
foreach ( $blog_ids as $id ) {
1304
switch_to_blog( $id );
1305
- $ret &= update_option( IP_Geo_Block::OPTION_NAME, $option );
1306
restore_current_blog();
1307
}
1308
@@ -1442,8 +1452,8 @@ class IP_Geo_Block_Admin {
1442
}
1443
}
1444
1445
- if ( $settings['network_wide'] && is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) )
1446
- $this->sync_multisite_option( $settings );
1447
else
1448
update_option( IP_Geo_Block::OPTION_NAME, $settings );
1449
55
*
56
*/
57
public function admin_init() {
58
// Add the options page and menu item.
59
add_action( 'admin_menu', array( $this, 'setup_admin_page' ) );
60
add_action( 'admin_post_ip_geo_block', array( $this, 'admin_ajax_callback' ) );
61
add_action( 'wp_ajax_ip_geo_block', array( $this, 'admin_ajax_callback' ) );
62
add_filter( 'wp_prepare_revision_for_js', array( $this, 'add_revision_nonce' ), 10, 3 );
63
64
+ if ( IP_Geo_Block_Util::is_user_logged_in() )
65
+ add_filter( IP_Geo_Block::PLUGIN_NAME . '-bypass-admins', array( $this, 'verify_request' ), 10, 2 );
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
73
+ add_action( 'delete_blog', array( $this, 'delete_blog' ), 10, 2 ); // on deleting an old blog @since 3.0.0
74
}
75
76
// loads a plugin’s translated strings.
103
*
104
*/
105
public function add_redirect_nonce( $location, $status ) {
106
+ return IP_Geo_Block_Util::rebuild_nonce( $location, FALSE === strpos( $location, wp_login_url() ) );
107
}
108
109
/**
124
* Verify admin screen without action instead of validating nonce.
125
*
126
*/
127
+ public function verify_request( $queries, $settings ) {
128
// the request that is intended to show the page without any action follows authentication of core.
129
+ if ( 'GET' === $_SERVER['REQUEST_METHOD'] && isset( $_GET['page'] ) ) {
130
+ foreach ( array( 'action', 'task') as $key ) {
131
+ if ( ! empty( $_GET[ $key ] ) )
132
+ return $queries;
133
+ }
134
$queries[] = $_GET['page'];
135
+ }
136
137
return $queries;
138
}
142
*
143
*/
144
public function create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
145
+ defined( 'IP_GEO_BLOCK_DEBUG' ) and IP_GEO_BLOCK_DEBUG and assert( is_main_site(), 'Not main blog.' );
146
147
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-actv.php';
148
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(
417
+ array( 'page' => IP_Geo_Block::PLUGIN_NAME ),
418
+ $this->dashboard_url( TRUE )
419
+ ) ) );
420
exit;
421
}
422
438
'manage_network_options',
439
IP_Geo_Block::PLUGIN_NAME,
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,
456
IP_Geo_Block::PLUGIN_NAME . '&amp;tab=5',
457
array( $this, 'display_plugin_admin_page' )
458
);
459
wp_enqueue_style( IP_Geo_Block::PLUGIN_NAME . '-admin-icons',
460
plugins_url( ! defined( 'IP_GEO_BLOCK_DEBUG' ) || ! IP_GEO_BLOCK_DEBUG ?
461
'css/admin-icons.min.css' : 'css/admin-icons.css', __FILE__
629
// TRUE if open ('o') or FALSE if close ('x')
630
$stat = empty( $cookie[ $tab ][ $index ] ) || 'x' !== $cookie[ $tab ][ $index ] || $index === $target;
631
632
+ echo "\n", '<fieldset id="', IP_Geo_Block::PLUGIN_NAME, '-section-', $index, '" class="', IP_Geo_Block::PLUGIN_NAME, '-field panel panel-default" data-section="', $index, '">', "\n",
633
+ '<legend class="panel-heading"><h3 class="', IP_Geo_Block::PLUGIN_NAME, ( $stat ? '-dropdown' : '-dropup' ), '">',
634
+ is_array( $section['title'] ) ? $section['title'][0] . '<span class="' . IP_Geo_Block::PLUGIN_NAME . '-help-link">[ ' . $section['title'][1] . ' ]</span>' : $section['title'],
635
'</h3></legend>', "\n", '<div class="panel-body',
636
($stat ? ' ' . IP_Geo_Block::PLUGIN_NAME . '-border"' : '"'),
637
($stat || (4 === $tab && $index) ? '>' : ' style="display:none">'), "\n";
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'] ) {
707
echo '<a href="?page=', IP_Geo_Block::PLUGIN_NAME, '&amp;tab=', $key, '" class="nav-tab', ($tab === $key ? ' nav-tab-active' : ''), '">', $val, '</a>';
708
} ?>
709
</h2>
710
+ <p class="ip-geo-block-navi-link">[ <a id="ip-geo-block-toggle-sections" href="#!"><?php _e( 'Toggle all', 'ip-geo-block' ); ?></a> ]
711
<?php if ( 4 === $tab ) { /* Logs tab */ ?>
712
<input id="ip-geo-block-live-update" type="checkbox"<?php checked( isset( $cookie[4][1] ) && 'o' === $cookie[4][1] ); disabled( extension_loaded( 'pdo_sqlite' ), FALSE ); ?> /><label for="ip-geo-block-live-update">
713
<dfn title="<?php _e( 'Independent of &#8220;Statistics and Logs settings&#8221;, you can see all the requests validated by this plugin in almost real time.', 'ip-geo-block' ); ?>"><?php _e( 'Live update', 'ip-geo-block' ); ?></dfn>
791
}
792
793
switch ( $args['type'] ) {
794
case 'check-provider':
795
echo "\n<ul class=\"ip-geo-block-list\">\n";
796
foreach ( $args['providers'] as $key => $val ) {
821
<input type="checkbox" id="<?php echo $id, $sub_id, '_', $key; ?>" name="<?php echo $name, $sub_name, '[', $key, ']'; ?>" value="<?php echo $key; ?>"<?php
822
checked( is_array( $args['value'] ) ? ! empty( $args['value'][ $key ] ) : ( $key & $args['value'] ? TRUE : FALSE ) ); ?> />
823
<label for="<?php echo $id, $sub_id, '_', $key; ?>"><?php
824
+ if ( isset( $args['desc'][ $key ] ) )
825
echo '<dfn title="', $args['desc'][ $key ], '">', $val, '</dfn>';
826
else
827
echo $val;
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'] ), TRUE );
882
if ( isset( $args['placeholder'] ) ) echo ' placeholder="', esc_html( $args['placeholder'] ), '"'; ?>><?php
883
echo esc_html( $args['value'] ); ?></textarea>
884
<?php
917
918
// Integrate posted data into current settings because it can be a part of hole data
919
$input = array_replace_recursive(
920
+ $output = $this->preprocess_options( $output, $default ), $input
921
);
922
923
// restore the 'signature' that might be transformed to avoid self blocking
1039
foreach ( $input[ $key ][ $sub ] as $k => $v ) {
1040
$output[ $key ][ $sub ] |= $v;
1041
}
1042
+ } else {
1043
$output[ $key ][ $sub ] = ( is_int( $default[ $key ][ $sub ] ) ?
1044
(int)$input[ $key ][ $sub ] :
1045
IP_Geo_Block_Util::kses( trim( $input[ $key ][ $sub ] ), FALSE )
1084
}
1085
1086
// keep disabled checkboxes not in the form
1087
+ foreach ( array( 'target_pages', 'target_posts', 'target_cates', 'target_tags', 'simulate', 'dnslkup', 'behavior' ) as $key ) {
1088
+ $output['public'][ $key ] = is_array( $default['public'][ $key ] ) ? array() : FALSE;
1089
}
1090
1091
// 3.0.4 AS number, 3.0.6 Auto updating of DB files, 3.0.8 Geolite2
1176
}
1177
}
1178
1179
+ // cron event
1180
+ $key = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) );
1181
+ if ( $output['update']['auto'] && ! $key ) {
1182
+ require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-cron.php';
1183
+ IP_Geo_Block_Cron::start_update_db( $output, FALSE );
1184
+ } else if ( ! $output['update']['auto'] && $key ){
1185
+ require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-cron.php';
1186
+ IP_Geo_Block_Cron::stop_update_db();
1187
+ }
1188
+
1189
return $output;
1190
}
1191
1253
1254
// additional configuration
1255
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-opts.php';
1256
+ if ( TRUE !== ( $file = IP_Geo_Block_Opts::setup_validation_timing( $options ) ) ) {
1257
$options['validation']['timing'] = 0;
1258
self::add_admin_notice( 'error', sprintf(
1259
__( 'Unable to write <code>%s</code>. Please check the permission.', 'ip-geo-block' ), '<code>' . $file . '</code>'
1282
// Go through the posted data and save the targetted options.
1283
foreach ( $options as $option ) {
1284
if ( isset( $_POST[ $option ] ) )
1285
+ $this->update_multisite_settings( $_POST[ $option ] );
1286
}
1287
1288
// Register a settings error to be displayed to the user
1289
self::add_admin_notice( 'updated', __( 'Settings saved.' ) );
1290
1291
// Redirect in order to back to the settings page.
1292
+ wp_redirect( esc_url_raw(
1293
add_query_arg(
1294
array( 'page' => IP_Geo_Block::PLUGIN_NAME ),
1295
$this->dashboard_url( ! empty( $_POST[ $option ]['network_wide'] ) )
1303
*
1304
* @note: This function triggers `validate_settings()` on register_setting() in wp-include/option.php.
1305
*/
1306
+ private function update_multisite_settings( $settings ) {
1307
global $wpdb;
1308
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" );
1309
$ret = TRUE;
1310
1311
foreach ( $blog_ids as $id ) {
1312
switch_to_blog( $id );
1313
+ $map = IP_Geo_Block::get_option();
1314
+ $settings['api_key']['GoogleMap'] = $map['api_key']['GoogleMap'];
1315
+ $ret &= update_option( IP_Geo_Block::OPTION_NAME, $settings );
1316
restore_current_blog();
1317
}
1318
1452
}
1453
}
1454
1455
+ if ( $this->is_network && $settings['network_wide'] )
1456
+ $this->update_multisite_settings( $settings );
1457
else
1458
update_option( IP_Geo_Block::OPTION_NAME, $settings );
1459
admin/css/admin-icons.css CHANGED
@@ -42,6 +42,7 @@
42
font-family: 'icomoon';
43
content: "\e9c9";
44
font-size: 18px;
45
}
46
/*#toplevel_page_ip-geo-block .dashicons-admin-generic:after {
47
font-family: 'icomoon';
42
font-family: 'icomoon';
43
content: "\e9c9";
44
font-size: 18px;
45
+ margin-left: 2px;
46
}
47
/*#toplevel_page_ip-geo-block .dashicons-admin-generic:after {
48
font-family: 'icomoon';
admin/css/admin-icons.min.css CHANGED
@@ -1,2 +1,2 @@
1
/*! IP Geo Block admin icons */
2
- @font-face{font-family:icomoon;src:url(fonts/icomoon.eot?astkh8);src:url(fonts/icomoon.eot?astkh8#iefix) format('embedded-opentype'),url(fonts/icomoon.ttf?astkh8) format('truetype'),url(fonts/icomoon.woff?astkh8) format('woff'),url(fonts/icomoon.svg?astkh8#icomoon) format('svg');font-weight:400;font-style:normal}[class*=" ip-geo-block-icon-"],[class^=ip-geo-block-icon-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ip-geo-block-icon-play:before{content:"\ea1c"}.ip-geo-block-icon-pause:before{content:"\ea1d"}.ip-geo-block-icon-stop:before{content:"\ea1e"}.ip-geo-block-icon-warn:before{content:"\ea07";color:#c43322}#toplevel_page_ip-geo-block .dashicons-admin-generic:before{font-family:icomoon;content:"\e9c9";font-size:18px}
1
/*! IP Geo Block admin icons */
2
+ @font-face{font-family:icomoon;src:url(fonts/icomoon.eot?astkh8);src:url(fonts/icomoon.eot?astkh8#iefix) format('embedded-opentype'),url(fonts/icomoon.ttf?astkh8) format('truetype'),url(fonts/icomoon.woff?astkh8) format('woff'),url(fonts/icomoon.svg?astkh8#icomoon) format('svg');font-weight:400;font-style:normal}[class*=" ip-geo-block-icon-"],[class^=ip-geo-block-icon-]{font-family:icomoon!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ip-geo-block-icon-play:before{content:"\ea1c"}.ip-geo-block-icon-pause:before{content:"\ea1d"}.ip-geo-block-icon-stop:before{content:"\ea1e"}.ip-geo-block-icon-warn:before{content:"\ea07";color:#c43322}#toplevel_page_ip-geo-block .dashicons-admin-generic:before{font-family:icomoon;content:"\e9c9";font-size:18px;margin-left:2px}
admin/css/admin.css CHANGED
@@ -60,8 +60,29 @@ label {
60
.panel-body:after {
61
clear: both;
62
}
63
64
/* style legend and fieldset */
65
fieldset.ip-geo-block-field {
66
/* padding: 0 10px;*/
67
margin: 1em 0;
@@ -424,11 +445,17 @@ table.form-table th .ip-geo-block-cycle span {
424
color: #c43322;
425
margin-left: 0.25em;
426
}
427
- .ip-geo-block-found {
428
color: #c43322;
429
font-weight: bold;
430
}
431
432
/* Statistics */
433
.ip-geo-block-top-list {
434
display: inline-table;
60
.panel-body:after {
61
clear: both;
62
}
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%;
72
+ font-weight: normal;
73
+ }
74
+ .ip-geo-block-help-link a {
75
+ box-shadow: none;
76
+ }
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;*/
88
margin: 1em 0;
445
color: #c43322;
446
margin-left: 0.25em;
447
}
448
+ .ip-geo-block-warn {
449
color: #c43322;
450
font-weight: bold;
451
}
452
453
+ /* Badly-behaved bots and crawlers */
454
+ input#ip_geo_block_settings_behavior_view,
455
+ input#ip_geo_block_settings_behavior_time {
456
+ width: 3.2em;
457
+ }
458
+
459
/* Statistics */
460
.ip-geo-block-top-list {
461
display: inline-table;
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
- 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}.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}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-back-to-top a,#ip-geo-block-toggle-sections{box-shadow:none}#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-found{color:#c43322;font-weight:700}.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
+ .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.2em}.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}
admin/css/cidr.min.css CHANGED
@@ -1 +1 @@
1
- #g,textarea{border:1px solid #ccc}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:8xp;font-size:14px;line-height:1.4}.container{margin:0;padding:0}.clr:after,.col:after,.container:after,.row:after{content:"";display:table;clear:both}.row{padding-bottom:0}.col{display:block;float:left;width:100%}.span_2{width:8.33333333333%}.span_11{width:45.8333333333%}.span_24,textarea{width:100%}fieldset{border:none;margin:0;padding:.5em}textarea{height:6em;resize:horizontal;font-size:12px;font-family:Consolas,Monaco,monospace}legend input[type=button]{margin-left:.5em;vertical-align:middle}#j,#i{display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;justify-content:center;align-items:center}#j{padding:0 .5em}ul#h{padding:1.5em 0 0;list-style:none}ul#h li{width:100%;margin:.25em 0;display:inline-block}ul#h li input{padding:0}#g{text-align:center;padding:.5em}
1
+ *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:8xp;font-size:14px;line-height:1.4}#g,textarea{border:1px solid #ccc;font-size:12px;font-family:Consolas,Monaco,monospace}.container{margin:0;padding:0}.clr:after,.col:after,.container:after,.row:after{content:"";display:table;clear:both}.row{padding-bottom:0}#g,fieldset{padding:.5rem}.col{display:block;float:left;width:100%}.span_2{width:8.33333333333%}.span_11{width:45.8333333333%}.span_24,textarea{width:100%}fieldset{border:none;margin:0}textarea{height:4.5rem;resize:horizontal}legend input[type=button]{margin-left:.5rem;vertical-align:middle}#j,#i{display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;justify-content:center;align-items:center}#j{padding:0 .5rem}ul#h{padding:1.5rem 0 0;list-style:none}ul#h li{width:100%;margin:.1rem 0;display:inline-block}ul#h li input{padding:0}#g{text-align:center}
admin/includes/class-admin-ajax.php CHANGED
@@ -15,7 +15,7 @@ class IP_Geo_Block_Admin_Ajax {
15
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-lkup.php';
16
17
// check format
18
- if ( filter_var( $ip = $_POST['ip'], FILTER_VALIDATE_IP ) ) {
19
// get option settings and compose request headers
20
$options = IP_Geo_Block::get_option();
21
$tmp = IP_Geo_Block::get_request_headers( $options );
@@ -485,6 +485,9 @@ endif; // TEST_RESTORE_NETWORK
485
'[public][dnslkup]', // 3.0.3
486
'[public][response_code]', // 3.0.3
487
'[public][redirect_uri]', // 3.0.3
488
'[providers][Geolite2]', // 3.0.8
489
'[providers][Maxmind]',
490
'[providers][IP2Location]',
@@ -689,6 +692,7 @@ endif; // TEST_RESTORE_NETWORK
689
$result += array( $matches[1] => $which );
690
}
691
}
692
}
693
694
return $result;
@@ -782,24 +786,26 @@ endif; // TEST_RESTORE_NETWORK
782
// Blocked self requests
783
$installed = array_reverse( IP_Geo_Block_Logs::search_logs( IP_Geo_Block::get_ip_address() ) );
784
foreach ( $installed as $val ) {
785
- // hide port and nonce
786
- $method = preg_replace( '/\[\d+\]/', '', $val['method'] );
787
- $method = preg_replace( '/(' . IP_Geo_Block::PLUGIN_NAME . '-auth-nonce)(?:=|%3D)([\w]+)/', '$1=...', $method );
788
-
789
- // add post data
790
- $query = array();
791
- foreach ( explode( ',', $val['data'] ) as $str ) {
792
- if ( FALSE !== strpos( $str, '=' ) )
793
- $query[] = $str;
794
- }
795
796
- if ( ! empty( $query ) )
797
- $method .= '(' . implode( ',', $query ) . ')';
798
799
- $res += array(
800
- esc_html( IP_Geo_Block_Util::localdate( $val['time'], 'Y-m-d H:i:s' ) ) =>
801
- esc_html( str_pad( $val['result'], 8 ) . $method )
802
- );
803
}
804
805
return $res;
15
require_once IP_GEO_BLOCK_PATH . 'classes/class-ip-geo-block-lkup.php';
16
17
// check format
18
+ if ( filter_var( $ip = trim( $_POST['ip'] ), FILTER_VALIDATE_IP ) ) {
19
// get option settings and compose request headers
20
$options = IP_Geo_Block::get_option();
21
$tmp = IP_Geo_Block::get_request_headers( $options );
485
'[public][dnslkup]', // 3.0.3
486
'[public][response_code]', // 3.0.3
487
'[public][redirect_uri]', // 3.0.3
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]',
692
$result += array( $matches[1] => $which );
693
}
694
}
695
+ break;
696
}
697
698
return $result;
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
791
+ $method = preg_replace( '/\[\d+\]/', '', $val['method'] );
792
+ $method = preg_replace( '/(' . IP_Geo_Block::PLUGIN_NAME . '-auth-nonce)(?:=|%3D)([\w]+)/', '$1=...', $method );
793
+
794
+ // add post data
795
+ $query = array();
796
+ foreach ( explode( ',', $val['data'] ) as $str ) {
797
+ if ( FALSE !== strpos( $str, '=' ) )
798
+ $query[] = $str;
799
+ }
800
801
+ if ( ! empty( $query ) )
802
+ $method .= '(' . implode( ',', $query ) . ')';
803
804
+ $res += array(
805
+ esc_html( IP_Geo_Block_Util::localdate( $val['time'], 'Y-m-d H:i:s' ) ) =>
806
+ esc_html( str_pad( $val['result'], 8 ) . $method )
807
+ );
808
+ }
809
}
810
811
return $res;
admin/includes/tab-accesslog.php CHANGED
@@ -16,7 +16,7 @@ class IP_Geo_Block_Admin_Tab {
16
*----------------------------------------*/
17
add_settings_section(
18
$section = $plugin_slug . '-logs',
19
- __( 'Validation logs', 'ip-geo-block' ),
20
( $options['validation']['reclogs'] ?
21
array( __CLASS__, 'validation_logs' ) :
22
array( __CLASS__, 'warn_accesslog' )
16
*----------------------------------------*/
17
add_settings_section(
18
$section = $plugin_slug . '-logs',
19
+ array( __( 'Validation logs', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/record-settings-and-logs.html" title="Record settings and logs | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>' ),
20
( $options['validation']['reclogs'] ?
21
array( __CLASS__, 'validation_logs' ) :
22
array( __CLASS__, 'warn_accesslog' )
admin/includes/tab-settings.php CHANGED
@@ -59,7 +59,7 @@ class IP_Geo_Block_Admin_Tab {
59
* @param array $args Additional arguments that are passed to the $callback function.
60
*/
61
// Get the country code of client
62
- $key = IP_Geo_Block::get_geolocation( $val = IP_Geo_Block::get_ip_address() );
63
64
$field = 'ip_client';
65
add_settings_field(
@@ -117,7 +117,7 @@ endif;
117
'<span title="' . __( 'Toggle selection', 'ip-geo-block' ) . '"></span>',
118
'<span title="' . __( 'Find blocked requests in &#8220;Logs&#8220;', 'ip-geo-block' ) . '"></span>',
119
__( 'Before adding as &#8220;Exception&#8221;, please click on &#8220;<a class="ip-geo-block-icon ip-geo-block-icon-alert" title="This button is just a sample."><span></span></a>&#8221; button (if exists) attached to the following list to confirm that the blocked request is not malicious.', 'ip-geo-block' ),
120
- __( 'Open CIDR calculator for IPv4 / IPv6', 'ip-geo-block' ),
121
);
122
123
// Matching rule
@@ -204,8 +204,9 @@ endif;
204
add_settings_field(
205
$option_name.'_'.$field.'_'.$key,
206
__( '<dfn title="e.g. &#8220;192.0.64.0/18&#8221; for Jetpack server, &#8220;69.46.36.0/27&#8221; for WordFence server or &#8220;AS32934&#8221; for Facebook.">Whitelist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
207
- ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>'.
208
- ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)',
209
array( $context, 'callback_field' ),
210
$option_slug,
211
$section,
@@ -216,7 +217,7 @@ endif;
216
'sub-field' => $key,
217
'value' => $options[ $field ][ $key ],
218
'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
219
- 'after' => $comma[1] . ' <a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $comma[5] . '"><span class="dashicons dashicons-sos"></span></a>',
220
)
221
);
222
@@ -225,8 +226,9 @@ endif;
225
add_settings_field(
226
$option_name.'_'.$field.'_'.$key,
227
__( '<dfn title="Server level access control is recommended (e.g. .htaccess).">Blacklist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
228
- ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>'.
229
- ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)',
230
array( $context, 'callback_field' ),
231
$option_slug,
232
$section,
@@ -237,7 +239,7 @@ endif;
237
'sub-field' => $key,
238
'value' => $options[ $field ][ $key ],
239
'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
240
- 'after' => $comma[1] . ' <a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $comma[5] . '"><span class="dashicons dashicons-sos"></span></a>',
241
)
242
);
243
@@ -501,11 +503,11 @@ endif;
501
);
502
503
$desc = array(
504
- 'login' => __( 'Log in' ),
505
- 'register' => __( 'Register' ),
506
- 'resetpass' => __( 'Password Reset' ),
507
- 'lostpassword' => __( 'Lost Password' ),
508
- 'postpass' => __( 'Password protected' ),
509
);
510
511
$list = '';
@@ -759,7 +761,7 @@ endif;
759
*----------------------------------------*/
760
add_settings_section(
761
$section = $plugin_slug . '-public',
762
- __( 'Front-end target settings', 'ip-geo-block' ),
763
array( __CLASS__, 'note_public' ),
764
$option_slug
765
);
@@ -983,6 +985,32 @@ endif;
983
)
984
);
985
986
// UA string and qualification
987
$key = 'ua_list';
988
add_settings_field(
@@ -1115,7 +1143,7 @@ endif;
1115
1116
add_settings_section(
1117
$section = $plugin_slug . '-database',
1118
- __( 'Local database settings', 'ip-geo-block' ),
1119
array( __CLASS__, 'note_database' ),
1120
$option_slug
1121
);
@@ -1135,6 +1163,16 @@ endif;
1135
}
1136
}
1137
1138
// Auto updating (once a month)
1139
$field = 'update';
1140
add_settings_field(
@@ -1150,6 +1188,7 @@ endif;
1150
'sub-field' => 'auto',
1151
'value' => $options[ $field ]['auto'],
1152
'disabled' => empty( $providers ),
1153
)
1154
);
1155
@@ -1364,6 +1403,10 @@ endif;
1364
)
1365
);
1366
1367
// Garbage collection period [sec]
1368
$field = 'cache_time_gc';
1369
add_settings_field(
@@ -1377,6 +1420,7 @@ endif;
1377
'option' => $option_name,
1378
'field' => $field,
1379
'value' => $options[ $field ],
1380
)
1381
);
1382
@@ -1544,7 +1588,7 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1544
$field = 'delete_table';
1545
add_settings_field(
1546
$option_name.'_'.$field,
1547
- __( 'Delete DB table for validation logs', 'ip-geo-block' ),
1548
array( $context, 'callback_field' ),
1549
$option_slug,
1550
$section,
@@ -1560,7 +1604,7 @@ if ( defined( 'IP_GEO_BLOCK_DEBUG' ) && IP_GEO_BLOCK_DEBUG ):
1560
$field = 'create_table';
1561
add_settings_field(
1562
$option_name.'_'.$field,
1563
- __( 'Create DB table for validation logs', 'ip-geo-block' ),
1564
array( $context, 'callback_field' ),
1565
$option_slug,
1566
$section,
59
* @param array $args Additional arguments that are passed to the $callback function.
60
*/
61
// Get the country code of client
62
+ $key = IP_Geo_Block::get_geolocation( $val = IP_Geo_Block::get_ip_address( $options ) );
63
64
$field = 'ip_client';
65
add_settings_field(
117
'<span title="' . __( 'Toggle selection', 'ip-geo-block' ) . '"></span>',
118
'<span title="' . __( 'Find blocked requests in &#8220;Logs&#8220;', 'ip-geo-block' ) . '"></span>',
119
__( 'Before adding as &#8220;Exception&#8221;, please click on &#8220;<a class="ip-geo-block-icon ip-geo-block-icon-alert" title="This button is just a sample."><span></span></a>&#8221; button (if exists) attached to the following list to confirm that the blocked request is not malicious.', 'ip-geo-block' ),
120
+ __( 'Open CIDR calculator for IPv4 / IPv6.', 'ip-geo-block' ),
121
);
122
123
// Matching rule
204
add_settings_field(
205
$option_name.'_'.$field.'_'.$key,
206
__( '<dfn title="e.g. &#8220;192.0.64.0/18&#8221; for Jetpack server, &#8220;69.46.36.0/27&#8221; for WordFence server or &#8220;AS32934&#8221; for Facebook.">Whitelist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
207
+ ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>' .
208
+ ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)' .
209
+ '<a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $comma[5] . '"><span class="dashicons dashicons-sos"></span></a>',
210
array( $context, 'callback_field' ),
211
$option_slug,
212
$section,
217
'sub-field' => $key,
218
'value' => $options[ $field ][ $key ],
219
'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
220
+ 'after' => $comma[1],
221
)
222
);
223
226
add_settings_field(
227
$option_name.'_'.$field.'_'.$key,
228
__( '<dfn title="Server level access control is recommended (e.g. .htaccess).">Blacklist of extra IP addresses prior to country code</dfn>', 'ip-geo-block' ) .
229
+ ' (<a rel="noreferrer" href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" title="Classless Inter-Domain Routing - Wikipedia">CIDR</a>' .
230
+ ', <a rel="noreferrer" href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" title="Autonomous system (Internet) - Wikipedia">ASN</a>)' .
231
+ '<a class="ip-geo-block-icon ip-geo-block-icon-cidr" title="' . $comma[5] . '"><span class="dashicons dashicons-sos"></span></a>',
232
array( $context, 'callback_field' ),
233
$option_slug,
234
$section,
239
'sub-field' => $key,
240
'value' => $options[ $field ][ $key ],
241
'placeholder' => '192.168.0.0/16,2001:db8::/96,AS1234',
242
+ 'after' => $comma[1],
243
)
244
);
245
503
);
504
505
$desc = array(
506
+ 'login' => '<dfn title="' . __( 'Action to login as a registered user.', 'ip-geo-block' ) . '">' . __( 'Log in' ) . '</dfn>',
507
+ 'register' => '<dfn title="' . __( 'Action to register new users.', 'ip-geo-block' ) . '">' . __( 'Register' ) . '</dfn>',
508
+ 'resetpass' => '<dfn title="' . __( 'Action to reset a password to create a new one.', 'ip-geo-block' ) . '">' . __( 'Password Reset' ) . '</dfn>',
509
+ 'lostpassword' => '<dfn title="' . __( 'Action to email a password to a registered user.', 'ip-geo-block' ) . '">' . __( 'Lost Password' ) . '</dfn>',
510
+ 'postpass' => '<dfn title="' . __( 'Action to show prompt to enter a password on password protected post and page.', 'ip-geo-block' ) . '">' . __( 'Password protected' ) . '</dfn>',
511
);
512
513
$list = '';
761
*----------------------------------------*/
762
add_settings_section(
763
$section = $plugin_slug . '-public',
764
+ array( __( 'Front-end target settings', 'ip-geo-block' ), '<a href="http://www.ipgeoblock.com/codex/overview.html" title="Overview | IP Geo Block">' . __( 'Help', 'ip-geo-block' ) . '</a>'),
765
array( __CLASS__, 'note_public' ),
766
$option_slug
767
);
985
)
986
);
987
988
+ // Badly-behaved bots and crawlers
989
+ $exception = '<ul class="ip-geo-block-settings-folding ip-geo-block-dropup">' . __( '<dfn title="Specify the frequency of request for certain period of time.">Blocking condition</dfn>', 'ip-geo-block' ) . "\n<li class=\"ip-geo-block-hide\"><ul>\n<li>";
990
+ $exception .= sprintf(
991
+ __( 'More than %1$s page view (PV) in %2$s seconds', 'ip-geo-block' ),
992
+ '<input type="number" id="ip_geo_block_settings_behavior_view" name="ip_geo_block_settings[behavior][view]" class="regular-text code" value="' . (int)$options['behavior']['view'] . '" placeholder="10" min="1" max="99" maxlength="3" />',
993
+ '<input type="number" id="ip_geo_block_settings_behavior_time" name="ip_geo_block_settings[behavior][time]" class="regular-text code" value="' . (int)$options['behavior']['time'] . '" placeholder="12" min="1" max="99" maxlength="3" /> '
994
+ );
995
+ $exception .= "</li>\n</ul></li></ul>\n";
996
+
997
+ $key = 'behavior';
998
+ add_settings_field(
999
+ $option_name.'_'.$field.'_'.$key,
1000
+ __( '<dfn title="It will validate the frequency of request.">Block badly-behaved bots and crawlers</dfn>', 'ip-geo-block' ),
1001
+ array( $context, 'callback_field' ),
1002
+ $option_slug,
1003
+ $section,
1004
+ array(
1005
+ 'type' => 'checkbox',
1006
+ 'option' => $option_name,
1007
+ 'field' => $field,
1008
+ 'sub-field' => $key,
1009
+ 'value' => $options[ $field ][ $key ],
1010
+ 'after' => $exception,
1011
+ )
1012
+ );
1013
+
1014
// UA string and qualification
1015
$key = 'ua_list';
1016
add_settings_field(
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
);
1163
}
1164
}
1165
1166
+ // Get the next schedule of cron
1167
+ if ( ! ( $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) ) ) ) {
1168
+ global $wpdb;
1169
+ $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
1170
+ switch_to_blog( $blog_ids[0] ); // main blog
1171
+ $tmp = wp_next_scheduled( IP_Geo_Block::CRON_NAME, array( FALSE ) );
1172
+ restore_current_blog();
1173
+ }
1174
+ $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>';
1175
+
1176
// Auto updating (once a month)
1177
$field = 'update';
1178
add_settings_field(
1188
'sub-field' => 'auto',
1189
'value' => $options[ $field ]['auto'],
1190
'disabled' => empty( $providers ),
1191
+ 'after' => $options[ $field ]['auto'] ? '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>' : '',
1192
)
1193
);
1194
1403
)
1404
);
1405
1406
+ // Get the next schedule of cron
1407
+ $tmp = wp_next_scheduled( IP_Geo_Block::CACHE_NAME );
1408
+ $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>';
1409
+
1410
// Garbage collection period [sec]
1411
$field = 'cache_time_gc';
1412
add_settings_field(
1420
'option' => $option_name,
1421
'field' => $field,
1422
'value' => $options[ $field ],
1423
+ 'after' => '<p class="ip-geo-block-desc">' . sprintf( __( 'Next schedule: %s', 'ip-geo-block'), $tmp ) . '</p>',
1424
)
1425
);
1426
1588
$field = 'delete_table';
1589
add_settings_field(
1590
$option_name.'_'.$field,
1591
+ __( 'Delete DB tables for this plugin', 'ip-geo-block' ),
1592
array( $context, 'callback_field' ),
1593
$option_slug,
1594
$section,
1604
$field = 'create_table';
1605
add_settings_field(
1606
$option_name.'_'.$field,
1607
+ __( 'Create DB tables for this plugin', 'ip-geo-block' ),
1608
array( $context, 'callback_field' ),
1609
$option_slug,
1610
$section,
admin/js/admin.js CHANGED
@@ -9,7 +9,8 @@
9
'use strict';
10
11
// External variables
12
- var timer_stack = [],
13
window_width = $(window).width(),
14
ip_geo_block = IP_GEO_BLOCK,
15
ip_geo_block_auth = IP_GEO_BLOCK_AUTH;
@@ -38,8 +39,12 @@
38
}).replace(/&amp;(#\d{2,4}|\w{4,7});/g, "&$1;"); // revert html character entity
39
}
40
41
function stripTag(str) {
42
- return escapeHTML(str.toString().replace(/(<([^>]+)>)/ig, ''));
43
}
44
45
function onresize(name, callback) {
@@ -104,7 +109,9 @@
104
})
105
106
.fail(function (jqXHR /*,textStatus, errorThrown*/) {
107
- warning(jqXHR.status, jqXHR.responseText, request.action);
108
})
109
110
.always(function () {
@@ -174,10 +181,18 @@
174
// checkbox
175
$this.siblings('input[name^="' + ID('%', 'settings') + '"]:checkbox').prop('disabled', !stat);
176
177
- // folding list
178
- $elem.nextAll(ID('.', 'settings-folding')).each(function (i, obj) {
179
- fold_elements($(obj), stat && mask);
180
- });
181
}
182
183
// Show / Hide Exceptions
@@ -233,6 +248,7 @@
233
function set_front_end($this) {
234
var checked = $this.is(':checked'),
235
select = $(ID('@', 'public_target_rule')),
236
parent = $this.closest('tr').nextAll('tr');
237
238
// Enable / Disable descendent items
@@ -242,7 +258,12 @@
242
parent.find(ID('.', 'desc')).css('opacity', checked ? 1.0 : 0.5);
243
244
// Show / Hide validation target
245
- show_descendants($this, select, '1' === select.val() ? true : false);
246
}
247
248
/**
@@ -481,7 +502,7 @@
481
}
482
483
if (0 < (w = $id.width()) &&
484
- 'undefined' !== typeof chart.dataStacked[id] &&
485
'undefined' !== typeof chart.viewStacked[id]) {
486
487
i = ID('range');
@@ -650,7 +671,11 @@
650
var cookie = loadCookie(tabNo);
651
652
// Click event handler to show/hide form-table
653
- $('form').on('click', 'h2,h3', function (/*event*/) {
654
toggleSection($(this), tabNo, cookie);
655
return false;
656
});
@@ -940,6 +965,12 @@
940
return false;
941
});
942
943
// Register event handler at specific tab
944
switch (tabNo) {
945
/*----------------------------------------
@@ -1004,10 +1035,10 @@
1004
'<html lang=en>' +
1005
'<meta charset=utf-8>' +
1006
'<title>CIDR calculator for IPv4 / IPv6</title>' +
1007
- '<link href="' + src + 'css/cidr.min.css" rel=stylesheet>' +
1008
'<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> </span></div></div>' +
1009
/* '<div class="container row"><div class="row" id="top"><fieldset class="col span_11"><legend>Range <input type="button" id="r_clear" value="Clear" tabindex="1" /></legend><textarea name="range" id="r_text" rows="5" wrap="off" placeholder="192.168.0.0 - 192.168.255.255" tabindex="2"></textarea></fieldset><ul class="col span_2" id="b_conv"><li class="row"><input class="col span_24" type="button" id="r_conv" value="&rarr;" tabindex="3" /></li><li class="row"><input class="col span_24" type="button" id="c_conv" value="&larr;" tabindex="6" /></li></ul><fieldset class="col span_11"><legend>CIDR <input type="button" id="c_clear" value="Clear" tabindex="4" /></legend><textarea name="cidr" id="c_text" rows="5" wrap="off" placeholder="192.168.0.0/16" tabindex="5"></textarea></fieldset></div><div class="row" id="bottom"><span class="col" id="msg">&nbsp;</span></div></div>' +*/
1010
- '<script src="' + src + 'js/cidr.min.js"></script>'
1011
);
1012
win.document.close();
1013
return false;
@@ -1192,7 +1223,7 @@
1192
1193
// make an anchor tab with search query
1194
s = 'admin' === target ? (key + '=' + val) : ('/' + key + '/' + val + '/');
1195
- s = '<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="' + ip_geo_block_auth.sites[0] + 'options-general.php' + // only main site
1196
'?page=ip-geo-block&tab=4&s=' + encodeURIComponent(s) + '" title="' + title.replace('%s', s) + '" target="_blank"><span></span></a>';
1197
1198
// add a new list when not found in existent key
@@ -1218,7 +1249,7 @@
1218
// update status of checkbox
1219
$(ID('@', 'exception_' + target)).trigger('change');
1220
$(ID('#', 'find-' + target)).append(
1221
- ' ' + '<span class="ip-geo-block-found">' + stripTag(ip_geo_block.msg[8].replace('%d', n)) + '</span>'
1222
);
1223
});
1224
@@ -1249,6 +1280,13 @@
1249
return stopPropergation(event);
1250
}).change();
1251
1252
/*---------------------------
1253
* Local database settings
1254
*---------------------------*/
@@ -1665,10 +1703,10 @@
1665
// animation on update
1666
new_class = ID(''),
1667
add_class = function (row, data, prefix) {
1668
- if (-1 !== data[7 /* result */].indexOf('passed')) {
1669
- $(row).addClass(new_class + prefix + 'passed');
1670
- } else {
1671
$(row).addClass(new_class + prefix + 'blocked');
1672
}
1673
},
1674
@@ -1784,7 +1822,7 @@
1784
// Search Geolocation
1785
$(ID('@', 'get_location')).on('click', function (/*event*/) {
1786
var whois = $(ID('#', 'whois')), obj,
1787
- ip = $(ID('@', 'ip_address')).val();
1788
1789
if (ip) {
1790
whois.hide().empty();
@@ -1871,6 +1909,14 @@
1871
return false;
1872
});
1873
1874
// Preset IP address
1875
if ($(ID('@', 'ip_address')).val()) {
1876
$(ID('@', 'get_location')).click();
9
'use strict';
10
11
// External variables
12
+ var skip_error = false,
13
+ timer_stack = [],
14
window_width = $(window).width(),
15
ip_geo_block = IP_GEO_BLOCK,
16
ip_geo_block_auth = IP_GEO_BLOCK_AUTH;
39
}).replace(/&amp;(#\d{2,4}|\w{4,7});/g, "&$1;"); // revert html character entity
40
}
41
42
+ function is_blocked( result ) {
43
+ return -1 === result.indexOf('pass');
44
+ }
45
+
46
function stripTag(str) {
47
+ return str ? escapeHTML(str.toString().replace(/(<([^>]+)>)/ig, '')) : '';
48
}
49
50
function onresize(name, callback) {
109
})
110
111
.fail(function (jqXHR /*,textStatus, errorThrown*/) {
112
+ if (!skip_error) {
113
+ warning(jqXHR.status, jqXHR.responseText, request.action);
114
+ }
115
})
116
117
.always(function () {
181
// checkbox
182
$this.siblings('input[name^="' + ID('%', 'settings') + '"]:checkbox').prop('disabled', !stat);
183
184
+ // folding the list
185
+ if ($.isArray($elem)) {
186
+ $.each($elem, function (i, elm) {
187
+ $(elm).nextAll(ID('.', 'settings-folding')).each(function (j, obj) {
188
+ fold_elements($(obj), stat && mask[i]);
189
+ });
190
+ });
191
+ } else {
192
+ $elem.nextAll(ID('.', 'settings-folding')).each(function (j, obj) {
193
+ fold_elements($(obj), stat && mask);
194
+ });
195
+ }
196
}
197
198
// Show / Hide Exceptions
248
function set_front_end($this) {
249
var checked = $this.is(':checked'),
250
select = $(ID('@', 'public_target_rule')),
251
+ behave = $(ID('@', 'public_behavior')),
252
parent = $this.closest('tr').nextAll('tr');
253
254
// Enable / Disable descendent items
258
parent.find(ID('.', 'desc')).css('opacity', checked ? 1.0 : 0.5);
259
260
// Show / Hide validation target
261
+ show_descendants($this, [select, behave], ['1' === select.val() ? true : false, behave.val()]);
262
+
263
+ // Render descendant element
264
+ if (checked) {
265
+ behave.change();
266
+ }
267
}
268
269
/**
502
}
503
504
if (0 < (w = $id.width()) &&
505
+ 'undefined' !== typeof chart.dataStacked[id] &&
506
'undefined' !== typeof chart.viewStacked[id]) {
507
508
i = ID('range');
671
var cookie = loadCookie(tabNo);
672
673
// Click event handler to show/hide form-table
674
+ $('form').on('click', 'h2,h3 a', function (/*event*/) {
675
+ window.open(this.href, null);
676
+ return false;
677
+ })
678
+ .on('click', 'h2,h3', function (/*event*/) {
679
toggleSection($(this), tabNo, cookie);
680
return false;
681
});
965
return false;
966
});
967
968
+ // Prevent warning when page transition happens during ajax
969
+ $(window).on('beforeunload', function(/*event*/) {
970
+ skip_error = true;
971
+ return;
972
+ });
973
+
974
// Register event handler at specific tab
975
switch (tabNo) {
976
/*----------------------------------------
1035
'<html lang=en>' +
1036
'<meta charset=utf-8>' +
1037
'<title>CIDR calculator for IPv4 / IPv6</title>' +
1038
+ '<link href="' + src + 'css/cidr.min.css?v=.1" rel=stylesheet>' +
1039
'<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> </span></div></div>' +
1040
/* '<div class="container row"><div class="row" id="top"><fieldset class="col span_11"><legend>Range <input type="button" id="r_clear" value="Clear" tabindex="1" /></legend><textarea name="range" id="r_text" rows="5" wrap="off" placeholder="192.168.0.0 - 192.168.255.255" tabindex="2"></textarea></fieldset><ul class="col span_2" id="b_conv"><li class="row"><input class="col span_24" type="button" id="r_conv" value="&rarr;" tabindex="3" /></li><li class="row"><input class="col span_24" type="button" id="c_conv" value="&larr;" tabindex="6" /></li></ul><fieldset class="col span_11"><legend>CIDR <input type="button" id="c_clear" value="Clear" tabindex="4" /></legend><textarea name="cidr" id="c_text" rows="5" wrap="off" placeholder="192.168.0.0/16" tabindex="5"></textarea></fieldset></div><div class="row" id="bottom"><span class="col" id="msg">&nbsp;</span></div></div>' +*/
1041
+ '<script src="' + src + 'js/cidr.min.js?v=.1"></script>'
1042
);
1043
win.document.close();
1044
return false;
1223
1224
// make an anchor tab with search query
1225
s = 'admin' === target ? (key + '=' + val) : ('/' + key + '/' + val + '/');
1226
+ s = '<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="' + ip_geo_block_auth.sites[0] + ip_geo_block_auth.admin + 'options-general.php' + // only main site
1227
'?page=ip-geo-block&tab=4&s=' + encodeURIComponent(s) + '" title="' + title.replace('%s', s) + '" target="_blank"><span></span></a>';
1228
1229
// add a new list when not found in existent key
1249
// update status of checkbox
1250
$(ID('@', 'exception_' + target)).trigger('change');
1251
$(ID('#', 'find-' + target)).append(
1252
+ ' ' + '<span class="ip-geo-block-warn">' + stripTag(ip_geo_block.msg[8].replace('%d', n)) + '</span>'
1253
);
1254
});
1255
1280
return stopPropergation(event);
1281
}).change();
1282
1283
+ // Badly-behaved bots and crawlers
1284
+ $(ID('@', 'public_behavior')).on('change', function (event) {
1285
+ var $this = $(this);
1286
+ fold_elements($this.siblings('ul'), $this.prop('checked'));
1287
+ return stopPropergation(event);
1288
+ }).change();
1289
+
1290
/*---------------------------
1291
* Local database settings
1292
*---------------------------*/
1703
// animation on update
1704
new_class = ID(''),
1705
add_class = function (row, data, prefix) {
1706
+ if (is_blocked(data[7 /* result */])) {
1707
$(row).addClass(new_class + prefix + 'blocked');
1708
+ } else {
1709
+ $(row).addClass(new_class + prefix + 'passed');
1710
}
1711
},
1712
1822
// Search Geolocation
1823
$(ID('@', 'get_location')).on('click', function (/*event*/) {
1824
var whois = $(ID('#', 'whois')), obj,
1825
+ ip = $.trim($(ID('@', 'ip_address')).val());
1826
1827
if (ip) {
1828
whois.hide().empty();
1909
return false;
1910
});
1911
1912
+ // Enter key in textbox
1913
+ $(ID('@', 'ip_address')).on('keypress', function (event) {
1914
+ if ((event.which && event.which === 13) || (event.keyCode && event.keyCode === 13)) {
1915
+ $(ID('@', 'get_location')).click();
1916
+ return false;
1917
+ }
1918
+ });
1919
+
1920
// Preset IP address
1921
if ($(ID('@', 'ip_address')).val()) {
1922
$(ID('@', 'get_location')).click();
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(b,f,t){function a(b,a){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 a?c[b]+a:c.$+b}function M(b){return b.toString().replace(/[&<>"']/g,function(b){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[b]}).replace(/&amp;(#\d{2,4}|\w{4,7});/g,"&$1;")}function k(b){return M(b.toString().replace(/(<([^>]+)>)/ig,""))}function E(a,e){var c=b(f).width();c!==F&&(F=c,"undefined"===typeof p[a]&&(p[a]={id:!1,callback:e}),b(f).off("resize").on("resize",function(){!1!==p[a].id&&f.clearTimeout(p[a].id);p[a].time=f.setTimeout(p[a].callback,200);return!1}))}function w(c,e){e?b(a("#",c)).addClass(a("loading")):b(a("#",c)).removeClass(a("loading"))}function x(b,a){f.confirm(k(b))&&a()}function D(b,a,g){f.alert(k(a||d.msg[12].replace("%s",g)+" ("+b+")"))}function J(b,a){-1!==f.location.href.indexOf(b)&&(f.location=k(b)+(a?"&"+k(a):"")+"&ip-geo-block-auth-nonce="+K.nonce)}function m(a,e,g,q){a&&w(a,!0);e.action=d.action;e.nonce=d.nonce;b.post(d.url,e).done(function(b){g&&g(b)}).fail(function(b){D(b.status,b.responseText,e.action)}).always(function(){a&&("object"===typeof q?b.when.apply(b,q).then(function(){w(a,!1)}):w(a,!1))})}function N(b,a){m(b,{cmd:"clear-"+b,which:a},function(b){J(b.page,b.tab)})}function R(b){m(b,{cmd:b},function(b){J(b.page,b.tab)})}function y(b){b.stopImmediatePropagation();return!1}function O(b,e){e?b.removeClass("folding-disable"):(b.children(a(".","hide")).hide(),b.addClass("folding-disable"),b.removeClass(a("dropdown")).addClass(a("dropup")))}function P(c,e,g){var q=0===c.prop("type").indexOf("checkbox")&&c.is(":checked")||0===c.prop("type").indexOf("select")&&"0"!==c.val();c.siblings('input[name^="'+a("%","settings")+'"]:checkbox').prop("disabled",!q);e.nextAll(a(".","settings-folding")).each(function(a,c){O(b(c),q&&g)})}function S(c){var e=a("@","validation_ajax_");O(c.closest("ul").next(),b(e+"1").is(":checked")||b(e+"2").is(":checked"))}function G(b){return String(b).replace(/[a-z]/gi,function(b){return String.fromCharCode(b.charCodeAt(0)+("n">b.toLowerCase()?13:-13))})}function ba(b,a){var c=new f.FileReader;c.onload=function(b){a&&a(b.target.result)};c.onerror=function(b){D("Error",b.target.error.code)};c.readAsText(b)}function T(c){var e=c.is(":checked"),g=b(a("@","public_target_rule")),d=c.closest("tr").nextAll("tr");d.find('[name^="'+a("%","settings")+'"]').prop("disabled",!e);d.find(a(".","desc")).css("opacity",e?1:.5);P(c,g,"1"===g.val()?!0:!1)}function Q(c,e){c&&("string"===typeof c&&(c=JSON.parse(c)),e&&b('input[type="checkbox"]').prop("checked",!1).change(),b(a("#","import")).closest("form").deserialize(c),b(a("@","exception_admin")+","+a("@","validation_mimetype")).change(),b('select[name*="'+a("%","settings")+'"]').change(),b(a("@","validation_login")).change(),T(b(a("@","validation_public"))),S(b(a("@","validation_ajax_1"))),e&&(e=a("%","settings[providers][IPInfoDB]"),b(a("@","providers_IPInfoDB")).prop("checked",c[e]?!0:!1)))}function ca(b,a){var c=Math.ceil(b.length/a),e=[],d;for(d=0;d<c;++d){var l=d*a;e.push(b.slice(l,l+a))}return e}function z(c){"object"===typeof f.google&&(1===c?b(a("#","chart-countries")).length&&(h.drawPie(a("chart-countries")),h.drawLine(a("chart-daily"),"date")):5===c&&b(a(".","network")).each(function(a,c){h.drawStacked(b(c).attr("id"))}))}function U(b){if("object"===typeof f.google){var a=["corechart"];5===b&&a.push("bar");f.google.load("visualization","1",{packages:a,callback:function(){z(b)}});E("draw-chart."+b,function(){z(b)})}}function da(b){var a,c="undefined"!==typeof wpCookies&&wpCookies.getHash("ip-geo-block")||[];for(a in c)c.hasOwnProperty(a)&&(c[a]=c[a].replace(/[^ox\d]/g,"").split(""));"undefined"===typeof c[b]&&(c[b]=[]);return c}function A(a){var c,g,d=[];b.each(a,function(b,a){d[b]="";if("undefined"!==typeof a&&(g=a.length))for(d[b]=a[0]||"o",c=1;c<g;++c)d[b]+=a[c]||"o"});"undefined"!==typeof wpCookies&&wpCookies.setHash("ip-geo-block",d,new Date(Date.now()+2592E6),K.home+K.admin)}function ea(c){var e=da(c);b("form").on("click","h2,h3",function(){var d=b(this),q=d.closest("fieldset").data("section"),f=d.parent().nextAll(".panel-body").toggle();d.toggleClass(a("dropup")).toggleClass(a("dropdown"));(d=d.hasClass(a("dropdown")))?f.addClass(a("border")).trigger(a("show-body")):f.removeClass(a("border"));e[c][q]=d?"o":"x";A(e);z(c);return!1});b(a("#","toggle-sections")).on("click",function(){var d,f=b(a(".","field")).find("h2,h3"),h=[a("dropdown"),a("dropup")],l=f.filter("."+h[0]).length;f.each(function(g){d=b(this);d.removeClass(h.join(" ")).addClass(l?h[1]:h[0]);d=d.parent().nextAll(".panel-body").toggle(l?!1:!0);l?d.removeClass(a("border")):d.addClass(a("border")).trigger("show-body");e[c][g]=l?"x":"o"});A(e);z(c);return!1});return e}function V(c){b("body").append('<div style="display:none"><form method="POST" id="'+a("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="'+a("export-data")+'"/><input type="submit" value="submit" /></form><input type="file" name="settings" id="'+a("file-dialog")+'" /></div>')}function W(b,a,d,f){b=b.cloneNode(!1);b.setAttribute("title",k(d));a=a.cloneNode(!1);a.setAttribute("class","dashicons dashicons-"+f);b.appendChild(a);return b}function X(c,e,g){b.extend(!0,b.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 g=b(a("#",e.tableID)).find("td.dataTables_empty");3>c.iDraw?g.html(d.i18n[0]):3===c.iDraw&&(g.html(d.i18n[1]),g=b(a("@","search_filter")),g.val()&&g.trigger("keyup"))}});var h=b(a("#",e.tableID)).DataTable({ajax:{url:d.url,type:"POST",data:{cmd:e.ajaxCMD,action:d.action,nonce:d.nonce}},mark:!0}),k=function(){h.columns.adjust().responsive.recalc().draw(!1)};E("draw-table."+c,k);b(a("#",e.sectionID)).find(".panel-body").off(a("show-body")).on(a("show-body"),function(){k();return!1}).off("change").on("change",'th>input[type="checkbox"]',function(){var c=b(this).prop("checked");b(a("#",e.tableID)).find('td>input[type="checkbox"]').prop("checked",c);return!1});b(a("#","select-target")).off("change").on("change",function(){var c=b(this).find('input[name="'+a("target")+'"]:checked').val();h.columns(e.targetColumn).search("all"!==c?c:"").draw();return!1}).trigger("change");b(a("#","bulk-action")).off("click").on("click",function(){var g=b(this).prev().val(),f=/(<([^>]+)>)/ig,r={IP:[],AS:[]},k,q=b("table.dataTable").find("td>input:checked");if(!g)return!1;if(!q.length)return D(null,d.msg[11]),!1;q.each(function(){k=h.cell(this.parentNode).data();r.IP.push(k[e.columnIP].replace(f,""));r.AS.push(k[e.columnAS].replace(f,""))});r.IP.length&&m("loading",{cmd:g,which:r},function(d){"undefined"!==typeof d.page?J(d.page,"tab="+c):d&&(h.ajax.reload(),b(a("#",e.tableID)).find('th input[type="checkbox"]').prop("checked",!1))});return!1});b(a("@","search_filter")).off("keyup").on("keyup",function(){h.search(this.value,!1,!0,!/[A-Z]/.test(this.value)).draw();return!1});b(a("#","reset-filter")).off("click").on("click",function(){b(a("@","search_filter")).val("");h.search("").draw();return!1});b(a("@","clear_all")).off("click").on("click",function(){x(d.msg[1===c?4:5],function(){N(1===c?"cache":"logs",null)});return!1});b("table.dataTable tbody").on("click","a",function(){var a=f.location.search.slice(1).split("&"),e=a.length,d={},g;for(g=0;g<e;++g){var h=a[g].split("=");d[h[0]]=h[1]}d.tab=1===c?4:2;d.s=b(this).text().replace(/[^\w\.:\*]/,"");h=[];for(g in d)d.hasOwnProperty(g)&&h.push(g+"="+d[g]);f.open(f.location.pathname+"?"+h.join("&"),"_blank");return!1});return h}var p=[],F=b(f).width(),d=IP_GEO_BLOCK,K=IP_GEO_BLOCK_AUTH;b.fn.deserialize=function(a){return this.each(function(){var c,d=this,h={};for(c in a)if(a.hasOwnProperty(c))try{var f=decodeURIComponent(c);var k=decodeURIComponent(a[c]);h.hasOwnProperty(f)||(h[f]=[]);h[f].push(k)}catch(H){}b.each(h,function(a,e){c=b('[name="'+a+'"]:input',d).val(e);"hidden"!==c.attr("type")&&c.before('<span style="color:red">*</span>')})})};var h={dataPie:[],viewPie:[],drawPie:function(a){if("undefined"===typeof h.dataPie[a]){var c=h.dataPie[a]=new f.google.visualization.DataTable;c.addColumn("string","Country");c.addColumn("number","Requests");c=b.parseJSON(b("#"+a).attr("data-"+a));h.dataPie[a].addRows(c)}"undefined"===typeof h.viewPie[a]&&(h.viewPie[a]=new f.google.visualization.PieChart(t.getElementById(a)));"undefined"!==typeof h.dataPie[a]&&"undefined"!==typeof h.viewPie[a]&&0<b("#"+a).width()&&h.viewPie[a].draw(h.dataPie[a],{backgroundColor:{fill:"transparent"},chartArea:{left:0,top:"5%",width:"100%",height:"90%"},sliceVisibilityThreshold:.015})},dataLine:[],viewLine:[],drawLine:function(a,d){if("undefined"===typeof h.dataLine[a]){var c=h.dataLine[a]=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=b.parseJSON(b("#"+a).attr("data-"+a));var k=e.length;for(c=0;c<k;++c)e[c][0]=new Date(1E3*e[c][0]);h.dataLine[a].addRows(e)}"undefined"===typeof h.viewLine[a]&&(h.viewLine[a]=new f.google.visualization.LineChart(t.getElementById(a)));"undefined"!==typeof h.dataLine[a]&&"undefined"!==typeof h.viewLine[a]&&0<(c=b("#"+a).width())&&h.viewLine[a].draw(h.dataLine[a],{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=b("#"+c);"undefined"===typeof h.dataStacked[c]&&(g=b.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=[],m=h.dataStacked[c],l=m.getNumberOfRows(),q=b(a("#","open-new")).prop("checked");for(d=0;d<l;d++)g.push({label:m.getValue(d,0),link:m.getValue(d,6)});l="http://www.w3.org/1999/xlink";k.find("text").each(function(b,a){f=a.parentNode;var c;if(c="g"===f.tagName.toLowerCase()){a:{c=a.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!==(b=c)}c&&(e=t.createElementNS("http://www.w3.org/2000/svg","a"),e.setAttributeNS(l,"xlink:href",g[b].link),e.setAttributeNS(l,"title",g[b].label),e.setAttribute("target",q?"_blank":"_self"),e.setAttribute("class","site"),e.appendChild(f.removeChild(a)),f.appendChild(e),g.splice(b,1))})}));if(0<(d=k.width())&&"undefined"!==typeof h.dataStacked[c]&&"undefined"!==typeof h.viewStacked[c]){var m=a("range");var l=b.parseJSON(b("."+m).attr("data-"+m));g=h.dataStacked[c];m=40*g.getNumberOfRows();h.viewStacked[c].draw(g,{width:d,height:m+80,allowHtml:!0,isStacked:!0,legend:{position:"top"},chartArea:{top:50,left:90,width:"100%",height:m},hAxis:{minValue:0,maxValue:l[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));m(null,{cmd:"restore-network",which:c,offset:d*f*k,length:d},function(c){var e,f,g,k,m;c=ca(c,d);b(a(".","network")).each(function(a,l){if("undefined"!==typeof c[a]){k=b(l).attr("id");m=h.dataStacked[k];g=Math.min(d,c[a].length);for(e=0;e<g;++e)for(f=1;5>=f;f++)m.setValue(e,f,c[a][e][f]);h.drawStacked(k)}})})}};b(function(){var c=Number(d.tab)||0,e=ea(c);b(a(".","inhibit")).on("submit",function(){return!1});switch(c){case 0:var g=a("%","settings");b('[id^="'+a("scan-")+'"]').on("click",function(){var c=b(this),d=c.attr("id"),e=c.parent();m(d.replace(/^.*(?:scan)/,"scanning"),{cmd:"scan-code",which:d.replace(a("scan-"),"")},function(b){e.children("ul").length||e.append('<ul id="'+a("code-list")+'"></ul>');e=e.children("ul").empty();for(c in b)if(b.hasOwnProperty(c)){var c=k(c);if("string"===typeof b[c])var d=k(b[c]);else d=k(b[c].code),c='<abbr title="'+k(b[c].type)+'">'+c+"</abbr>";e.append("<li>"+c+' : <span class="'+a("notice")+'">'+d+"</span></li>")}e.show("slow")});return!1});b(a("@","matching_rule")).on("change",function(){var c=this.value;b(a("@","white_list")).closest("tr").toggle("0"===c);b(a("@","black_list")).closest("tr").toggle("1"===c);return!1}).change();b(a(".","icon-cidr")).on("click",function(){var c=b(a("#","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" 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">\x3c/script>');d.document.close();return!1});b(a("@","validation_mimetype")).on("change",function(c){var d=b(this),n=parseInt(d.val(),10);d.nextAll(a(".","settings-folding")).each(function(a,c){O(b(c),n===a+1||n&&2===a)});return y(c)}).change();b('select[name*="response_code"]').on("change",function(c){var d=b(this),n=parseInt(d.val()/100,10),e=d.closest("tr").nextAll("tr");if(0<=d.attr("name").indexOf("public")&&-1===parseInt(b(a("@","public_matching_rule")).val(),10))return e.each(function(a){1>=a&&b(this).hide()}),y(c);3>=n?e.each(function(a){0===a?b(this).show():1===a&&b(this).hide()}):e.each(function(a){0===a?b(this).hide():1===a&&b(this).show()});return y(c)}).change();b(a("#","decode")).on("click",function(){var c=b(a("@","signature")),d=c.val();-1===d.search(/,/)?c.val(G(f.atob(d))):c.val(f.btoa(G(d)));return!1});b(a("@","validation_login")).on("change",function(a){var c=b(this);P(c,c,g,!0);return y(a)}).change();m(null,{cmd:"get-actions"},function(c){var e,n=b(a("#","list-admin")),f=t.createElement("li"),h=t.createElement("input"),g=t.createElement("label"),l=t.createElement("dfn"),q=t.createElement("span");for(v in c)if(c.hasOwnProperty(v)){var v=k(v);if(!n.find("#"+(e=a("!","exception_admin_"+v))).size()){var p=h.cloneNode(!1);p.setAttribute("id",e);p.setAttribute("value",v);p.setAttribute("type","checkbox");var r=f.cloneNode(!1);r.appendChild(p);p=g.cloneNode(!1);p.setAttribute("for",e);p.appendChild(t.createTextNode(v));r.appendChild(p);1&c[v]&&r.appendChild(W(l,q,d.msg[6],"lock"));2&c[v]&&r.appendChild(W(l,q,d.msg[7],"unlock"));n.append(r)}}b(a(".","icon-unlock")).on("click",function(){b(a("#","list-admin")+">li").filter(function(){return!b(this).find(".dashicons-unlock").length}).toggle();return!1});b(a("@","exception_admin")).on("change",function(c){var d=b.grep(b(this).val().split(","),function(b){return""!==b.replace(/^\s+|\s+#x2F;g,"")});b(a("#","list-admin")).find("input").each(function(){var a=b(this),c=a.val();a.prop("checked",-1!==b.inArray(c,d))});return y(c)}).change();b(a("#","list-admin")).on("click","input",function(){var c=b(this);var d=b(a("@","exception_admin")),e=c.val(),n=b.grep(d.val().split(","),function(b){return""!==b.replace(/^\s+|\s+#x2F;g,"")});c=b.inArray(e,n);-1===c?n.push(e):n.splice(c,1);d.val(n.join(",")).change()});b(a(".","icon-find")).on("click",function(){var c=b(this),e=[],n=0,f,h,C,g,fa=k(d.msg[9]),u=k(c.data("target"));b(a("#","find-"+u)).empty();c.next().children(a(".","find-desc")).show();c=b(a("#","list-"+u));c.children("li").each(function(a,c){e.push(b(c).find("input").val())});m("find-"+u,{cmd:"find-"+u},function(m){for(var l in m)m.hasOwnProperty(l)&&(++n,f=k(m[l]),l=k(l),h=b.inArray(l,e),C=a("!","exception_"+u+"_"+l),g="admin"===u?f+"="+l:"/"+f+"/"+l+"/",g='<a class="ip-geo-block-icon ip-geo-block-icon-alert" href="'+K.sites[0]+"options-general.php?page=ip-geo-block&tab=4&s="+encodeURIComponent(g)+'" title="'+fa.replace("%s",g)+'" target="_blank"><span></span></a>',0>h?(e.push(l),c.prepend('<li><input id="'+C+'" value="'+l+'" type="checkbox" '+("admin"===u?"/>":"name=ip_geo_block_settings[exception]["+u+"]["+l+"] />")+'<label for="'+C+'">'+l+"</lable>"+g+"</li>")):(C=c.find("#"+C).parent(),C.find("a").length||C.append(g)));b(a("@","exception_"+u)).trigger("change");b(a("#","find-"+u)).append(' <span class="ip-geo-block-found">'+k(d.msg[8].replace("%d",n))+"</span>")});return!1})});b('input[id^="'+a("!","validation_ajax_")+'"]').on("change",function(){S(b(this))}).change();b(a("@","validation_public")).on("change",function(a){T(b(this));return y(a)}).change();b(a("@","public_matching_rule")).on("change",function(c){var d=this.value;b(a("@","public_white_list")).closest("tr").toggle("0"===d);b(a("@","public_black_list")).closest("tr").toggle("1"===d);b(a("@","public_response_code")).change().closest("tr").toggle("-1"!==d);return y(c)}).change();b(a("@","update")).on("click",function(){m("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&&b(a("@",d+"_"+n+"_path")).val(k(e[n].filename));e[n].message&&b(a("#",d+"-"+n)).text(k(e[n].message))}}});return!1});b(a("@","save_statistics")).on("change",function(){b(a("@","validation_recdays")).prop("disabled",!b(this).prop("checked"));return!1}).trigger("change");b(a("@","validation_reclogs")).on("change",function(){var a=b(this);a.parent().parent().nextAll().find("input").prop("disabled",0===Number(a.prop("selectedIndex")))}).trigger("change");b(a("@","comment_pos")).on("change",function(){var a=b(this);a.nextAll('input[type="text"]').prop("disabled",0===Number(a.prop("selectedIndex")))}).trigger("change");V("validate");b(a("#","export")).on("click",function(){if("undefined"===typeof JSON)return D(null,k(d.msg[10])),!1;var c=g,e={};b.each(b(this).closest("form").serializeArray(),function(b,a){-1!==a.name.indexOf(c)&&(e[a.name]=a.value)});e[c+="[signature]"]=f.btoa(G(e[c]));b(a("#","export-data")).val(JSON.stringify(e));b(a("#","export-form")).submit();return!1});b(a("#","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])&&ba(a,function(a){a=JSON.parse(a);b=g+"[signature]";"undefined"!==typeof a[b]&&(a[b]=f.btoa(G(a[b])));m("export-import",{cmd:"validate",data:JSON.stringify(a)},function(a){Q(a,!0)})});return!1});b(a("#","import")).on("click",function(){b(a("#","file-dialog")).click();return!1});b(a("#","default")).on("click",function(){x(d.msg[0],function(){m("pre-defined",{cmd:"import-default"},function(a){Q(a,!0)})});return!1});b(a("#","preferred")).on("click",function(){x(d.msg[0],function(){m("pre-defined",{cmd:"import-preferred"},function(a){Q(a,!1)})});return!1});b(a("@","reset_live")).on("click",function(){m("reset-live",{cmd:"reset-live"});return!1});b(a("@","create_table")).on("click",function(){x(d.msg[1],function(){R("create-table")});return!1});b(a("@","delete_table")).on("click",function(){x(d.msg[2],function(){R("delete-table")});return!1});b(a("#","show-info")).on("click",function(){b(a("#","wp-info")).empty();m("wp-info",{cmd:"show-info"},function(c){var d,e=[];for(d in c)c.hasOwnProperty(d)&&e.push("- "+d+" "+c[d]);b(a("#","wp-info")).html('<textarea class="regular-text code" rows="'+e.length+'">'+e.join("\n")+"</textarea>").find("textarea").select();return!1})});b('select[name^="'+g+'"]').on("change",function(){var c=b(this),d,e=a(".","desc");c.next(e).empty();(d=c.children("option:selected").data("desc"))&&c.next(e).html(b.parseHTML(d));P(c,c,g,!0);return!1}).change();b(a(".","icon-cycle")).on("click",function(){var c=b(this).nextAll("li"),d=c.find(a("@","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(a,c){f.push(b(c).val())});d.val(f.join(","))}b(this).blur();return!1});b(a(".","settings-folding>dfn")).on("click",function(){var c=a("drop"),d=b(this).parent();d.children(a(".","hide")).toggle();d.toggleClass(c+"up").toggleClass(c+"down");d.hasClass(c+"up")&&d.children("div").hide();return!1});b("#submit").on("click",function(){var c=b(a("@","signature")),d=c.val();-1!==d.indexOf(",")&&c.val(f.btoa(G(d)));return!0});break;case 1:U(c);var q=0;b(a("#","sort-slug")).on("click",function(){var a=b(this).closest("ol"),c=a.children("li");(q=!q)?c.sort(function(a,c){return b(a).text()>b(c).text()}):c.sort(function(a,c){return parseInt(b(a).text().replace(/^.*\((\d+)\)#x2F;,"$1"),10)<=parseInt(b(c).text().replace(/^.*\((\d+)\)#x2F;,"$1"),10)});a.children("li").remove();c.appendTo(a)});b(a("@","clear_statistics")).on("click",function(){x(d.msg[3],function(){N("statistics",null)});return!1});b(a("@","clear_logs")).on("click",function(){x(d.msg[5],function(){N("logs",null)});return!1});X(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},l={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,z=b(a("#","live-loading")),I=null,w=function(){H&&(f.clearTimeout(H),H=null);r&&(z.removeClass(a("live-timer")),f.clearTimeout(r),r=null)},E=function(){w();m("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++)I.row.add(a.data[b]);I.draw(!1)}H=f.setTimeout(E,1E3*d.interval)})},F=function(a,b){w();m(null,{cmd:a||"live-stop",callback:b})},M=function(){F("live-pause",function(){z.addClass(a("live-timer"));r=f.setTimeout(function(){w();b(a("#","live-log-stop")).prop("checked",!0)},1E3*d.timeout)})},B=a(""),Y=function(a,c,d){-1!==c[7].indexOf("passed")?b(a).addClass(B+d+"passed"):b(a).addClass(B+d+"blocked")},Z=b(a("#","live-log")),aa=b(a("#","live-update"));b(a("#","validation-logs")).on("animationend",function(){b(this).find('tr[class*="'+B+'new"]').each(function(){var a=b(this);-1!==a.prop("class").indexOf("passed")?a.addClass(B+"passed").removeClass(B+"new-passed"):a.addClass(B+"blocked").removeClass(B+"new-blocked")});return!1});Z.on("change",function(){switch(b('input[name="'+a("live-log")+'"]:checked').val()){case "start":E();break;case "pause":M();break;case "stop":F()}});aa.on("change",function(){var d=Z.closest("tr"),f=aa.prop("checked");e[c][1]=f?"o":"x";A(e);I&&I.clear().destroy();f?(d.show().next().next().next().nextAll().hide(),p.ajaxCMD="live-stop",l.order=[1,"desc"],l.createdRow=function(a,b){Y(a,b,"new-")}):(d.hide().next().next().next().nextAll().show(),p.ajaxCMD="restore-logs",l.order=[0,""],l.createdRow=function(a,b){Y(a,b,"")});b(a("#","live-log-stop")).trigger("click");I=X(c,p,l);return!1}).trigger("change");V("export-logs");b(a("#","export-logs")).on("click",function(){b(a("#","export-form")).submit();return!1});break;case 2:b(f).on(a("gmap-error"),function(){m(null,{cmd:"gmap-error"},function(a){J(a.page,a.tab)})});var L=b(a("#","map"));"object"===typeof f.google?L.each(function(){b(this).GmapRS()}):L.each(function(){b(this).empty().html('<iframe src="'+d.altgmap+'?output=embed" frameborder="0" style="width:100%; height:400px; border:0" allowfullscreen></iframe>')});b('select[id^="'+a("!","service")+'"]').on("change",function(){e[c][3]=b(this).prop("selectedIndex");A(e)}).change();b(a("@","get_location")).on("click",function(){var c=b(a("#","whois")),d=b(a("@","ip_address")).val();if(d){c.hide().empty();var e=b.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="'+a("section-1")+'" class="'+a("field")+' panel panel-default" data-section="1"><legend class="panel-heading"><h3 id="'+a("whois-title")+'" class="'+a("dropdown")+'">Whois</h3></legend><div class="panel-body '+a("border")+'"><table class="'+a("table")+'">'+f+"</table></div></fieldset>").fadeIn("slow");b(a("#","whois-title")).on("click",function(){var c=b(this);c.parent().nextAll().toggle();c.toggleClass(a("dropup")).toggleClass(a("dropdown"));return!1})});m("loading",{cmd:"search",ip:d,which:b(a("@","service")).val()},function(b){var c="",e=k(b.latitude||"0"),g=k(b.longitude||"0"),h=b.latitude||b.longitude?8:2;for(l in b)if(b.hasOwnProperty(l)){var l=k(l);c+='<li><span class="'+a("title")+'">'+l+' : </span><span class="'+a("result")+'">'+k(b[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="'+a("title")+'">IP address : </span><span class="'+a("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});b(a("@","ip_address")).val()&&b(a("@","get_location")).click();break;case 5:U(c),b("input[name="+a("duration")+"]:radio").on("click",function(){var a=b('div[class*="paginate"]').find('a[class*="current"]').text();e[c][2]=b(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],a-1)}),b(a("#","open-new")).on("change",function(){var d=b(this).prop("checked");e[c][1]=d?"o":"x";A(e);b(a("#","section-0 svg")).find("a").each(function(){this.setAttribute("target",d?"_blank":"_self")})}),b(a("#","apply-layout")).on("click",function(){var d=b(a("#","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)}),b("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 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);
admin/js/authenticate.js CHANGED
@@ -9,9 +9,7 @@
9
10
var auth = IP_GEO_BLOCK_AUTH, wpzep = {
11
init: false,
12
- auth: 'ip-geo-block-auth-nonce',
13
- nonce: auth.nonce || '',
14
- sites: auth.sites || []
15
},
16
17
// regular expression to find target for is_admin()
@@ -209,13 +207,13 @@
209
210
// remove an old nonce
211
while (i-- > 0) {
212
- if (data[i].indexOf(wpzep.auth) === 0) {
213
data.splice(i, 1);
214
break;
215
}
216
}
217
218
- data.push(wpzep.auth + '=' + encodeURIComponent(nonce));//RFC3986
219
uri.query = data.join('&');
220
221
return compose_uri(uri);
@@ -227,10 +225,11 @@
227
}
228
229
// Check uri where the nonce is needed
230
function is_admin(url) {
231
// parse uri and get real path
232
- var uri = url || window.location.pathname; // in case of empty `action` on the form tag
233
- uri = parse_uri(uri.toLowerCase());
234
235
// possibly scheme is `javascript` and path is `void(0);`
236
if (check_uri(uri)) {
@@ -244,12 +243,12 @@
244
}
245
246
// check if uri includes the target path of zep
247
- uri = regexp.exec(uri.pathname);
248
- if (uri) {
249
- if ((0 <= uri[0].indexOf(auth.admin + 'admin-')) ||
250
- (0 <= uri[0].indexOf(auth.admin )) ||
251
- (0 <= uri[0].indexOf(auth.plugins )) ||
252
- (0 <= uri[0].indexOf(auth.themes ))) {
253
return 1; // internal for admin
254
}
255
}
@@ -259,18 +258,34 @@
259
}
260
261
// Check if current page is admin area and the target of wp-zep
262
- function is_backend_nonce() {
263
- return (is_admin(window.location.pathname) === 1 || window.location.search.indexOf(wpzep.auth) >= 0);
264
}
265
266
- // Redirect if current page is admin area and the target of wp-zep
267
- function redirect(url) {
268
- var i, n = wpzep.sites.length;
269
for (i = 0; i < n; ++i) {
270
- if (url && 0 <= url.indexOf(wpzep.sites[i]) && wpzep.nonce) {
271
- window.location = add_query_nonce(url, wpzep.nonce);
272
}
273
}
274
}
275
/*
276
$.ajaxSetup({
@@ -290,14 +305,14 @@
290
});
291
*/
292
// Embed a nonce before an Ajax request is sent
293
- // $(document).ajaxSend(function (event, jqxhr, settings) {
294
$.ajaxPrefilter(function (settings /*, original, jqxhr*/) {
295
// POST to async-upload.php causes an error in https://wordpress.org/plugins/mammoth-docx-converter/
296
if (is_admin(settings.url) === 1 && !settings.url.match(/async-upload\.php#x2F;)) {
297
// multipart/form-data (XMLHttpRequest Level 2)
298
// IE10+, Firefox 4+, Safari 5+, Android 3+
299
if (typeof window.FormData !== 'undefined' && settings.data instanceof FormData) {
300
- settings.data.append(wpzep.auth, wpzep.nonce);
301
}
302
303
// application/x-www-form-urlencoded
@@ -309,14 +324,14 @@
309
var data, callback, uri = parse_uri(settings.url);
310
311
if (typeof settings.data === 'undefined' || uri.query) {
312
- settings.url = add_query_nonce(uri, wpzep.nonce);
313
} else {
314
data = settings.data ? settings.data.split('&') : [];
315
callback = check_ajax(window.location.pathname);
316
if (callback) {
317
data = callback(data);
318
}
319
- data.push(wpzep.auth + '=' + encodeURIComponent(wpzep.nonce));//RFC3986
320
settings.data = data.join('&');
321
}
322
}
@@ -380,52 +395,60 @@
380
var elem = $(document); // `html` or `body` doesn't work with some browsers
381
382
elem.onFirst('click contextmenu', 'a', function (event) {
383
- // attr() returns 'string' or 'undefined'
384
- var $this = $(this),
385
- href = $this.attr('href'),
386
- rel = $this.attr('rel' ),
387
- admin = check_uri(parse_uri(href)) ? is_admin(href) : 0; // 0: do nothing if href is empty
388
-
389
// if context menu then continue and should be checked in check_nonce()
390
if ('click' !== event.type) {
391
return;
392
}
393
394
- // if admin area (except in comment with nofollow) then add a nonce
395
else if (admin === 1) {
396
- $this.attr('href', add_query_nonce(
397
- href, (!rel || rel.indexOf('nofollow') < 0) ? wpzep.nonce : 'nofollow'
398
- ));
399
}
400
401
// if external then redirect with no referrer not to leak out the nonce
402
- else if (admin === -1 && is_backend_nonce()) {
403
// open within the same window
404
- if ('_self' === $this.attr('target')) {
405
- redirect(href);
406
- return; // just in case redirection fails
407
}
408
409
// open a new window
410
- href = escapeHTML(decodeURIComponent(this.href));
411
- href = href.split(';', 2).shift(); // avoid `url=...;url=javascript:...`
412
-
413
- admin = window.open();
414
- admin.document.write(
415
- '<!DOCTYPE html><html><head>' +
416
- '<meta name="referrer" content="never" />' +
417
- '<meta name="referrer" content="no-referrer" />' +
418
- '<meta http-equiv="refresh" content="0; url=' + href + '" />' +
419
- ($('body').hasClass('webview') ? '<script>window.location.replace("' + href + '")</script>' : '') +
420
- '</head></html>'
421
- );
422
- admin.document.close();
423
-
424
- // stop event propagation
425
- event.stopImmediatePropagation();
426
-
427
- // automatically call event.stopPropagation() and event.preventDefault()
428
- return false;
429
}
430
});
431
@@ -435,7 +458,11 @@
435
436
// if admin area then add the nonce
437
if (is_admin(action) === 1) {
438
- $this.attr('action', add_query_nonce(action, wpzep.nonce));
439
}
440
});
441
}
@@ -447,21 +474,12 @@
447
if (!wpzep.init) {
448
wpzep.init = true;
449
450
- // avoid conflict with "Open external links in a new window"
451
- if (is_backend_nonce()) {
452
- $('a').each(function () {
453
- if (!this.hasAttribute('onClick') && is_admin(this.getAttribute('href')) === -1) {
454
- this.setAttribute('onClick', 'javascript:return false');
455
- }
456
- });
457
- }
458
-
459
$('img').each(function (/*index*/) {
460
var src = $(this).attr('src');
461
462
// if admin area
463
if (is_admin(src) === 1) {
464
- $(this).attr('src', add_query_nonce(src, wpzep.nonce));
465
}
466
});
467
@@ -471,8 +489,8 @@
471
n = data.length;
472
473
for (i = 0; i < n; ++i) {
474
- if (-1 === data[i].restoreUrl.indexOf(wpzep.auth)) {
475
- window._wpRevisionsSettings.revisionData[i].restoreUrl = add_query_nonce(data[i].restoreUrl, wpzep.nonce);
476
}
477
}
478
}
9
10
var auth = IP_GEO_BLOCK_AUTH, wpzep = {
11
init: false,
12
+ name: 'ip-geo-block-auth-nonce'
13
},
14
15
// regular expression to find target for is_admin()
207
208
// remove an old nonce
209
while (i-- > 0) {
210
+ if (data[i].indexOf(wpzep.name) === 0) {
211
data.splice(i, 1);
212
break;
213
}
214
}
215
216
+ data.push(wpzep.name + '=' + encodeURIComponent(nonce));//RFC3986
217
uri.query = data.join('&');
218
219
return compose_uri(uri);
225
}
226
227
// Check uri where the nonce is needed
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);`
235
if (check_uri(uri)) {
243
}
244
245
// check if uri includes the target path of zep
246
+ url = regexp.exec(uri.pathname);
247
+ if (url) {
248
+ if ((0 <= url[0].indexOf(auth.admin + 'admin-')) ||
249
+ (0 <= url[0].indexOf(auth.admin )) ||
250
+ (0 <= url[0].indexOf(auth.plugins )) ||
251
+ (0 <= url[0].indexOf(auth.themes ))) {
252
return 1; // internal for admin
253
}
254
}
258
}
259
260
// Check if current page is admin area and the target of wp-zep
261
+ function is_backend() {
262
+ return (is_admin(window.location.pathname) === 1 || window.location.search.indexOf(wpzep.name) >= 0);
263
}
264
265
+ // Check if url belongs to multisite
266
+ function is_multisite(url) {
267
+ var i, j, n = auth.sites.length;
268
+
269
for (i = 0; i < n; ++i) {
270
+ j = url.indexOf(auth.sites[i] + '/')
271
+ if (0 <= j && j <= 6) { // from `//` to `https://`
272
+ return true;
273
}
274
}
275
+
276
+ return false;
277
+ }
278
+
279
+ // check if the uri does not need a nonce
280
+ function is_neutral(uri) {
281
+ // return !uri.query; // without queries
282
+ // return !uri.query || !$('body').hasClass('wp-core-ui'); // without queries or outside dashboard
283
+ return /\/#x2F;.test(uri.path); // `/wp-admin/`
284
+ }
285
+
286
+ // check if the link has nofollow
287
+ function has_nofollow($elem) {
288
+ return -1 !== ($elem.attr('rel') || '').indexOf('nofollow');
289
}
290
/*
291
$.ajaxSetup({
305
});
306
*/
307
// Embed a nonce before an Ajax request is sent
308
+ // $(document).ajaxSend(function (event, jqxhr, settings) {
309
$.ajaxPrefilter(function (settings /*, original, jqxhr*/) {
310
// POST to async-upload.php causes an error in https://wordpress.org/plugins/mammoth-docx-converter/
311
if (is_admin(settings.url) === 1 && !settings.url.match(/async-upload\.php#x2F;)) {
312
// multipart/form-data (XMLHttpRequest Level 2)
313
// IE10+, Firefox 4+, Safari 5+, Android 3+
314
if (typeof window.FormData !== 'undefined' && settings.data instanceof FormData) {
315
+ settings.data.append(wpzep.name, auth.nonce);
316
}
317
318
// application/x-www-form-urlencoded
324
var data, callback, uri = parse_uri(settings.url);
325
326
if (typeof settings.data === 'undefined' || uri.query) {
327
+ settings.url = add_query_nonce(uri, auth.nonce);
328
} else {
329
data = settings.data ? settings.data.split('&') : [];
330
callback = check_ajax(window.location.pathname);
331
if (callback) {
332
data = callback(data);
333
}
334
+ data.push(wpzep.name + '=' + encodeURIComponent(auth.nonce));//RFC3986
335
settings.data = data.join('&');
336
}
337
}
395
var elem = $(document); // `html` or `body` doesn't work with some browsers
396
397
elem.onFirst('click contextmenu', 'a', function (event) {
398
+ var admin = 0, // default: do nothing if href is empty
399
+ $this = $(this),
400
+ href = $this.attr('href') || '', // returns 'string' or 'undefined'
401
+ uri = parse_uri(href);
402
+
403
+ // check href has right scheme and path
404
+ if (check_uri(uri)) {
405
+ admin = is_admin(href);
406
+ }
407
+ /*
408
+ console.log('href:' + href, uri, 'admin:' + admin, 'is_backend:' + is_backend(), 'is_multisite:' + is_multisite(href));
409
+ //*/
410
// if context menu then continue and should be checked in check_nonce()
411
if ('click' !== event.type) {
412
return;
413
}
414
415
+ // if admin area (except a link with nofollow in the comment thread) then add a nonce
416
else if (admin === 1) {
417
+ $this.attr('href', is_neutral(uri) ? href :
418
+ add_query_nonce( href, has_nofollow($this) ? 'nofollow' : auth.nonce )
419
+ );
420
}
421
422
// if external then redirect with no referrer not to leak out the nonce
423
+ else if (admin === -1 && is_backend()) {
424
// open within the same window
425
+ if ('_self' === $this.attr('target') || is_multisite(href)) {
426
+ $this.attr('href', is_neutral(uri) ? href :
427
+ add_query_nonce( href, has_nofollow($this) ? 'nofollow' : auth.nonce )
428
+ );
429
}
430
431
// open a new window
432
+ else if (!this.hasAttribute('onClick')) {
433
+ // avoid `url=...;url=javascript:...`
434
+ href = href.split(';', 2).shift();
435
+ href = escapeHTML(decodeURIComponent(this.href)); // & => &amp;
436
+
437
+ admin = window.open();
438
+ admin.document.write(
439
+ '<!DOCTYPE html><html><head>' +
440
+ '<meta name="referrer" content="never" />' +
441
+ '<meta name="referrer" content="no-referrer" />' +
442
+ '<meta http-equiv="refresh" content="0; url=' + href + '" />' +
443
+ ($('body').hasClass('webview') ? '<script>window.location.replace("' + href + '")</script>' : '') +
444
+ '</head></html>'
445
+ );
446
+ admin.document.close();
447
+
448
+ // stop event propagation and location transition
449
+ event.stopImmediatePropagation();
450
+ return false; // same as event.stopPropagation() and event.preventDefault()
451
+ }
452
}
453
});
454
458
459
// if admin area then add the nonce
460
if (is_admin(action) === 1) {
461
+ if ('post' === $this.attr('method').toLowerCase()) {
462
+ $this.attr('action', add_query_nonce(action, auth.nonce));
463
+ } else {
464
+ $this.append('<input type="hidden" name="' + wpzep.name + '" value="' + auth.nonce + '">');
465
+ }
466
}
467
});
468
}
474
if (!wpzep.init) {
475
wpzep.init = true;
476
477
$('img').each(function (/*index*/) {
478
var src = $(this).attr('src');
479
480
// if admin area
481
if (is_admin(src) === 1) {
482
+ $(this).attr('src', add_query_nonce(src, auth.nonce));
483
}
484
});
485
489
n = data.length;
490
491
for (i = 0; i < n; ++i) {
492
+ if (-1 === data[i].restoreUrl.indexOf(wpzep.name)) {
493
+ window._wpRevisionsSettings.revisionData[i].restoreUrl = add_query_nonce(data[i].restoreUrl, auth.nonce);
494
}
495
}
496
}
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(h,k,n){function x(a){var b=n.createElement("div");b.appendChild(n.createTextNode(a));a=b.innerHTML.replace(/["']/g,function(a){return{'"':"&quot;","'":"&#39;"}[a]});b="";return a}function p(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 l(a,b){"object"!==typeof a&&(a=p(a||k.location.href));for(var e=a.query?a.query.split("&"):[],d=e.length;0<d--;)if(0===e[d].indexOf(f.auth)){e.splice(d,1);break}e.push(f.auth+"="+encodeURIComponent(b));a.query=e.join("&");return(a.scheme?a.scheme+":":"")+(a.relative+a.path)+(a.query?"?"+a.query:"")+(a.fragment?"#"+a.fragment:"")}function q(a){return(!a.scheme||/^https?#x2F;.test(a.scheme))&&(a.path||a.query)}function m(a){var b=a||k.location.pathname;b=p(b.toLowerCase());if(q(b)){b=y(a);if(b.origin!==k.location.origin)return-1;if((b=z.exec(b.pathname))&&(0<=b[0].indexOf(g.admin+"admin-")||0<=b[0].indexOf(g.admin)||0<=b[0].indexOf(g.plugins)||0<=b[0].indexOf(g.themes)))return 1}return 0}function r(){return 1===m(k.location.pathname)||0<=k.location.search.indexOf(f.auth)}function t(a,b,e){var d=b.split(/\s+/);a.each(function(a){for(a=0;a<d.length;++a){var b=h.trim(d[a]).match(/[^\.]+/i)[0],c=h(this),f=b;b=e;c=h._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 u(){if(!f.init&&(f.init=!0,r()&&h("a").each(function(){this.hasAttribute("onClick")||-1!==m(this.getAttribute("href"))||this.setAttribute("onClick","javascript:return false")}),h("img").each(function(){var a=h(this).attr("src");1===m(a)&&h(this).attr("src",l(a,f.nonce))}),"undefined"!==typeof k._wpRevisionsSettings)){var a,b=k._wpRevisionsSettings.revisionData,e=b.length;for(a=0;a<e;++a)-1===b[a].restoreUrl.indexOf(f.auth)&&(k._wpRevisionsSettings.revisionData[a].restoreUrl=l(b[a].restoreUrl,f.nonce))}}var g=IP_GEO_BLOCK_AUTH,f={init:!1,auth:"ip-geo-block-auth-nonce",nonce:g.nonce||"",sites:g.sites||[]},z=new RegExp("^(?:"+(g.home||"")+g.admin+"|"+(g.home||"")+g.plugins+"|"+(g.home||"")+g.themes+")(?:.*.php|.*/)?quot;),v=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},w={"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":v,"network/theme-install.php":v},y=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=n.implementation.createHTMLDocument("")}}return function(b,e){var d=n;b="undefined"!==typeof b?b:k.location.href;if(null===a){"undefined"===typeof e&&(e=k.location.href);try{var c=new URL(b,e)}catch(A){c=new URL(b,k.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}}();h.ajaxPrefilter(function(a){if(1===m(a.url)&&!a.url.match(/async-upload\.php#x2F;))if("undefined"!==typeof k.FormData&&a.data instanceof FormData)a.data.append(f.auth,f.nonce);else{var b=p(a.url);if("undefined"===typeof a.data||b.query)a.url=l(b,f.nonce);else{b=a.data?a.data.split("&"):[];var e=k.location.pathname;e=e.replace(g.home+g.admin,"");(e=w.hasOwnProperty(e)?w[e]:null)&&(b=e(b));b.push(f.auth+"="+encodeURIComponent(f.nonce));a.data=b.join("&")}}});"undefined"===typeof h.fn.onFirst&&(h.fn.onFirst=function(a,b){var e,d=h(this),c="string"===typeof b;h.fn.on.apply(d,arguments);if("object"===typeof a)for(e in a)a.hasOwnProperty(e)&&t(d,e,c);else"string"===typeof a&&t(d,a,c);return d});h(k).on("error",function(){u(!1)});h(function(){u(!0)});(function(){var a=h(n);a.onFirst("click contextmenu","a",function(a){var b=h(this),d=b.attr("href"),c=b.attr("rel"),g=q(p(d))?m(d):0;if("click"===a.type)if(1===g)b.attr("href",l(d,!c||0>c.indexOf("nofollow")?f.nonce:"nofollow"));else if(-1===g&&r())if("_self"===b.attr("target"))for(a=d,d=f.sites.length,b=0;b<d;++b)a&&0<=a.indexOf(f.sites[b])&&f.nonce&&(k.location=l(a,f.nonce));else return d=x(decodeURIComponent(this.href)),d=d.split(";",2).shift(),g=k.open(),g.document.write('<!DOCTYPE html><html><head><meta name="referrer" content="never" /><meta name="referrer" content="no-referrer" /><meta http-equiv="refresh" content="0; url='+d+'" />'+(h("body").hasClass("webview")?'<script>window.location.replace("'+d+'")\x3c/script>':"")+"</head></html>"),g.document.close(),a.stopImmediatePropagation(),!1});a.onFirst("submit","form",function(){var a=h(this),e=a.attr("action");1===m(e)&&a.attr("action",l(e,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(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))}),"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))}}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(!1)});g(function(){p(!0)});(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);
admin/js/cidr.min.js CHANGED
@@ -8,4 +8,4 @@
8
- jQuery (https://jquery.com/)
9
This software is released under the MIT License.
10
*/
11
- "function"!==typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(u,I){if(null==u)throw Error("Cannot convert undefined or null to object");var m,z,B=Object(u);for(z=1;z<arguments.length;z++){var C=arguments[z];if(null!=C)for(m in C)Object.prototype.hasOwnProperty.call(C,m)&&(B[m]=C[m])}return B},writable:!0,configurable:!0});Array.prototype.forEach||(Array.prototype.forEach=function(u,I){if(null==this)throw Error("this is null or not defined");var m,z,B=Object(this);var C=B.length>>>0;if("[object Function]"!={}.toString.call(u))throw Error(u+" is not a function");I&&(m=I);for(z=0;z<C;){if(z in B){var O=B[z];u.call(m,O,z,B)}z++}});Array.isArray||(Array.isArray=function(u){return"[object Array]"===Object.prototype.toString.call(u)});(function(u,I,m){function z(){function a(c){if(!(this instanceof a))return void 0===c?z():new a(c);if(c instanceof a)this.s=c.s,this.e=c.e,this.c=c.c.slice();else{var b,d;if(0===c&&0>1/c)c="-0";else if(!ha.test(c+=""))throw Error("Invalid number");"-"==c.charAt(0)?(c=c.slice(1),this.s=-1):this.s=1;-1<(b=c.indexOf("."))&&(c=c.replace(".",""));0<(d=c.search(/e/i))?(0>b&&(b=d),b+=+c.slice(d+1),c=c.substring(0,d)):0>b&&(b=c.length);var e=c.length;for(d=0;d<e&&"0"==c.charAt(d);++d);if(d==e)this.c=[this.e=0];else{for(;0<e&&"0"==c.charAt(--e););this.e=b-d-1;this.c=[];for(b=0;d<=e;)this.c[b++]=+c.charAt(d++)}}this.constructor=a}a.prototype=n;a.DP=20;a.RM=1;a.NE=-7;a.PE=21;a.version="5.0.2";return a}function B(a,c,b,d){var e=a.c,f=a.e+c+1;if(f<e.length){if(1===b)d=5<=e[f];else if(2===b)d=5<e[f]||5==e[f]&&(d||0>f||void 0!==e[f+1]||e[f-1]&1);else if(3===b)d=d||void 0!==e[f]||0>f;else if(d=!1,0!==b)throw Error("Invalid rounding mode");if(1>f)e.length=1,d?(a.e=-c,e[0]=1):e[0]=a.e=0;else{e.length=f--;if(d)for(;9<++e[f];)e[f]=0,f--||(++a.e,e.unshift(1));for(f=e.length;!e[--f];)e.pop()}}else if(0>b||3<b||b!==~~b)throw Error("Invalid rounding mode");return a}function C(a,c,b,d){var e=a.constructor,f=!a.c[0];if(void 0!==b){if(b!==~~b||b<(3==c)||1E6<b)throw Error(3==c?"Invalid precision":"Invalid decimal places");a=new e(a);b=d-a.e;a.c.length>++d&&B(a,b,e.RM);for(2==c&&(d=a.e+b+1);a.c.length<d;)a.c.push(0)}var g=a.e;var h=a.c.join("");b=h.length;if(2!=c&&(1==c||3==c&&d<=g||g<=e.NE||g>=e.PE))h=h.charAt(0)+(1<b?"."+h.slice(1):"")+(0>g?"e":"e+")+g;else if(0>g){for(;++g;)h="0"+h;h="0."+h}else if(0<g)if(++g>b)for(g-=b;g--;)h+="0";else g<b&&(h=h.slice(0,g)+"."+h.slice(g));else 1<b&&(h=h.charAt(0)+"."+h.slice(1));return 0>a.s&&(!f||4==c)?"-"+h:h}function O(a){var c=Object.getPrototypeOf,b={},d=b.toString,e=b.hasOwnProperty;b=e.toString;if(!a||"[object Object]"!==d.call(a))return!1;a=c(a);if(!a)return!0;a=e.call(a,"constructor")&&a.constructor;return"function"===typeof a&&b.call(a)===b.call(Object)}function J(){var a,c,b,d=arguments[0]||{},e=1,f=arguments.length,g=!1;"boolean"===typeof d&&(g=d,d=arguments[e]||{},e++);"object"===typeof d||"function"===typeof d&&"number"!==typeof d.nodeType||(d={});e===f&&(d=this,e--);for(;e<f;e++)if(null!=(a=arguments[e]))for(c in a){var h=d[c];var l=a[c];d!==l&&(g&&l&&(O(l)||(b=Array.isArray(l)))?(b?(b=!1,h=h&&Array.isArray(h)?h:[]):h=h&&O(h)?h:{},d[c]=J(g,h,l)):l!==m&&(d[c]=l))}return d}function P(a,c){return x(a).plus(c)}function ba(){var a=/%%|%(?:(\d+)\$)?((?:[-+#0 ]|'[\s\S])*)(\d+)?(?:\.(\d*))?([\s\S])/g,c=arguments,b=0,d=c[b++],e=function(a,c,b,d){b||(b=" ");c=a.length>=c?"":Array(1+c-a.length>>>0).join(b);return d?a+c:c+a},f=function(a,c,b,d,f){var g=d-a.length;0<g&&(a=b||"0"!==f?e(a,d,f,b):[a.slice(0,c.length),e("",g,"0",!0),a.slice(c.length)].join(""));return a},g=function(a,c,b,d,g,h){a=e((a>>>0).toString(c),g||0,"0",!1);return f(a,"",b,d,h)},h=function(a,c,b,d,e){null!==d&&d!==m&&(a=a.slice(0,d));return f(a,"",c,b,e)},l=function(a,d,l,k,r,n){if("%%"===a)return"%";a=" ";var t=!1;var E="";var q;var v=0;for(q=l.length;v<q;v++)switch(l.charAt(v)){case " ":case "0":a=l.charAt(v);break;case "+":E="+";break;case "-":t=!0;break;case "'":v+1<q&&(a=l.charAt(v+1),v++)}k=k?+k:0;if(!isFinite(k))throw Error("Width must be finite");r=r?+r:"d"===n?0:-1<"fFeE".indexOf(n)?6:m;if(d&&0===+d)throw Error("Argument number must be greater than zero");if(d&&+d>=c.length)throw Error("Too few arguments");d=d?c[+d]:c[b++];switch(n){case "%":return"%";case "s":return h(d+"",t,k,r,a);case "c":return h(String.fromCharCode(+d),t,k,r,a);case "b":return g(d,2,t,k,r,a);case "o":return g(d,8,t,k,r,a);case "x":return g(d,16,t,k,r,a);case "X":return g(d,16,t,k,r,a).toUpperCase();case "u":return g(d,10,t,k,r,a);case "i":case "d":return d=+d||0,d=Math.round(d-d%1),E=0>d?"-":E,d=E+e(String(Math.abs(d)),r,"0",!1),t&&"0"===a&&(a=" "),f(d,E,t,k,a);case "e":case "E":case "f":case "F":case "g":case "G":return d=+d,E=0>d?"-":E,l=["toExponential","toFixed","toPrecision"]["efg".indexOf(n.toLowerCase())],n=["toString","toUpperCase"]["eEfFgG".indexOf(n)%2],d=E+Math.abs(d)[l](r),f(d,E,t,k,a)[n]();default:return""}};try{return d.replace(a,l)}catch(E){return!1}}function ca(){var a=arguments,c=a.length,b=0;if(0===c)throw Error("Empty isset");for(;b!==c;){if(a[b]===m||null===a[b])return!1;b++}return!0}function da(a){return("number"===typeof a||"string"===typeof a&&-1===" \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.slice(-1)))&&""!==a&&!isNaN(a)}function w(a,c){return a===c?0:a>c?1:-1}function G(a,c,b){a=(a+"").indexOf(c,b||0);return-1===a?!1:a}function L(a,c,b){a+="";var d=a.length;0>c&&(c+=d);b!==m&&(d=0>b?b+d:b+c);return c>=a.length||0>c||c>d?!1:a.slice(c,d)}function U(a,c){var b,d=0;if(null===a||a===m)return 0;if(a.constructor!==Array&&a.constructor!==Object)return 1;"COUNT_RECURSIVE"===c&&(c=1);1!==c&&(c=0);for(b in a)a.hasOwnProperty(b)&&(d++,1!==c||!a[b]||a[b].constructor!==Array&&a[b].constructor!==Object||(d+=U(a[b],1)));return d}function V(a,c){var b="",d="",e="";1===arguments.length&&(c=a,a="");if("object"===typeof c){if("[object Array]"===Object.prototype.toString.call(c))return c.join(a);for(b in c)d+=e+c[b],e=a;return d}return c}function R(a,c,b){if(2>arguments.length||a===m||c===m)return null;if(""===a||!1===a||null===a)return!1;if("function"===typeof a||"object"===typeof a||"function"===typeof c||"object"===typeof c)return{0:""};!0===a&&(a="1");a+="";var d=(c+"").split(a);if(b===m)return d;0===b&&(b=1);if(0<b)return b>=d.length?d:d.slice(0,b-1).concat([d.slice(b-1).join(a)]);if(-b>=d.length)return[];d.splice(d.length+b);return d}function ea(a,c){null===c&&(c=1);if(null===a||1>c)return!1;a+="";for(var b=[],d=0,e=a.length;d<e;)b.push(a.slice(d,d+=c));return b}function H(a,c,b,d){var e="",f=function(a,c){for(var b="";b.length<c;)b+=a;return b=b.substr(0,c)};a+="";b=b!==m?b:" ";0!==d&&1!==d&&2!==d&&(d=1);0<(e=c-a.length)&&(0===d?a=f(b,e)+a:1===d?a+=f(b,e):2===d&&(e=f(b,Math.ceil(e/2)),a=(e+a+e).substr(0,c)));return a}function ia(a){var c="",b="";if(a.hasOwnProperty("length"))return a.length?a.pop():null;for(c in a)a.hasOwnProperty(c)&&(b=c);return b?(c=a[b],delete a[b],c):null}function ja(a){for(var c=arguments.length,b=arguments,d=null,e=a,f=b[1].length,g=0,h=1,l=0,k=[],n=[];g<f;){for(;h<c;)k[l++]=b[h++][g];l=0;h=1;if(a){if("string"===typeof a)e=u[a];else if("object"===typeof a&&a.length){d="string"===typeof a[0]?u[a[0]]:a[0];if(d===m)throw Error("Object not found: "+a[0]);e="string"===typeof a[1]?d[a[1]]:a[1]}n[g++]=e.apply(d,k)}else n[g++]=k;k=[]}return n}function W(a,c){var b="[object Array]"===Object.prototype.toString.call(a),d=c?{}:[];if(b&&!c)return a.slice(0).reverse();if(c){keys=[];for(e in a)keys.push(e);for(b=keys.length;b--;){var e=keys[b];d[e]=a[e]}}else for(e in a)d.unshift(a[e]);return d}function ka(a){a=(a+"").replace(/[^01]/gi,"");return parseInt(a,2)}function la(a){0>a&&(a=4294967295+a+1);return parseInt(a,10).toString(2)}function X(a){var c,b="";a+="";var d=0;for(c=a.length;d<c;d++){var e=a.charCodeAt(d).toString(16);b+=2>e.length?"0"+e:e}return b}function Y(a){a+="";var c=[],b=0,d;for(d=a.length;b<d;b+=2){var e=parseInt(a.substr(b,1),16);var f=parseInt(a.substr(b+1,1),16);if(isNaN(e)||isNaN(f))return!1;c.push(e<<4|f)}return String.fromCharCode.apply(String,c)}function M(a){for(var c=0,b=1,d="",e,f,g,h,l,k,n,Q,u,r,p,t,x,q,v,w,y;c<a.length;){h=a.charAt(c);l="";for(c++;c<a.length&&null!==a.charAt(c).match(/[\d*]/);)l+=a.charAt(c),c++;""===l&&(l="1");switch(h){case "a":case "A":if(arguments[b]===m)throw Error("pack(): Type "+h+": not enough arguments");e=String(arguments[b]);"*"===l&&(l=e.length);for(f=0;f<l;f++)d=e[f]===m?"a"===h?d+String.fromCharCode(0):d+" ":d+e[f];b++;break;case "h":case "H":if(arguments[b]===m)throw Error("pack(): Type "+h+": not enough arguments");e=arguments[b];"*"===l&&(l=e.length);if(l>e.length)throw Error("pack(): Type "+h+": not enough characters in string");for(f=0;f<l;f+=2)k=e[f],k=f+1>=l||e[f+1]===m?k+"0":k+e[f+1],"h"===h&&(k=k[1]+k[0]),d+=String.fromCharCode(parseInt(k,16));b++;break;case "c":case "C":"*"===l&&(l=arguments.length-b);if(l>arguments.length-b)throw Error("pack(): Type "+h+": too few arguments");for(f=0;f<l;f++)d+=String.fromCharCode(arguments[b]),b++;break;case "s":case "S":case "v":"*"===l&&(l=arguments.length-b);if(l>arguments.length-b)throw Error("pack(): Type "+h+": too few arguments");for(f=0;f<l;f++)d+=String.fromCharCode(arguments[b]&255),d+=String.fromCharCode(arguments[b]>>8&255),b++;break;case "n":"*"===l&&(l=arguments.length-b);if(l>arguments.length-b)throw Error("pack(): Type "+h+": too few arguments");for(f=0;f<l;f++)d+=String.fromCharCode(arguments[b]>>8&255),d+=String.fromCharCode(arguments[b]&255),b++;break;case "i":case "I":case "l":case "L":case "V":"*"===l&&(l=arguments.length-b);if(l>arguments.length-b)throw Error("pack(): Type "+h+": too few arguments");for(f=0;f<l;f++)d+=String.fromCharCode(arguments[b]&255),d+=String.fromCharCode(arguments[b]>>8&255),d+=String.fromCharCode(arguments[b]>>16&255),d+=String.fromCharCode(arguments[b]>>24&255),b++;break;case "N":"*"===l&&(l=arguments.length-b);if(l>arguments.length-b)throw Error("pack(): Type "+h+": too few arguments");for(f=0;f<l;f++)d+=String.fromCharCode(arguments[b]>>24&255),d+=String.fromCharCode(arguments[b]>>16&255),d+=String.fromCharCode(arguments[b]>>8&255),d+=String.fromCharCode(arguments[b]&255),b++;break;case "f":case "d":k=23;n=8;"d"===h&&(k=52,n=11);"*"===l&&(l=arguments.length-b);if(l>arguments.length-b)throw Error("pack(): Type "+h+": too few arguments");for(f=0;f<l;f++){e=arguments[b];h=Math.pow(2,n-1)-1;g=-h+1;Q=h;u=isNaN(q=parseFloat(e))||-Infinity===q||Infinity===q?q:0;r=0;p=2*h+1+k+3;t=Array(p);x=0>(q=0!==u?0:q);q=Math.abs(q);v=Math.floor(q);q-=v;for(e=p;e;)t[--e]=0;for(e=h+2;v&&e;)t[--e]=v%2,v=Math.floor(v/2);for(e=h+1;0<q&&e;--q)t[++e]=(1<=(q*=2))-0;for(e=-1;++e<p&&!t[e];);y=(q=k-1+(e=(r=h+1-e)>=g&&r<=Q?e+1:h+1-(r=g-1)))+1;if(t[y]){if(!(w=t[q]))for(y=q+2;!w&&y<p;w=t[y++]);for(y=q+1;w&&0<=--y;(t[y]=!t[y]-0)&&(w=0));}for(e=0>e-2?-1:e-3;++e<p&&!t[e];);(r=h+1-e)>=g&&r<=Q?++e:r<g&&(e=h+1-(r=g-1));if(v||0!==u)r=Q+1,e=h+2,-Infinity===u?x=1:isNaN(u)&&(t[e]=1);q=Math.abs(r+h);h="";for(y=n+1;--y;)h=q%2+h,q=q>>=1;y=q=0;e=(h=(x?"1":"0")+h+t.slice(e,e+k).join("")).length;for(g=[];e;)q+=(1<<y)*h.charAt(--e),7===y&&(g[g.length]=String.fromCharCode(q),q=0),y=(y+1)%8;g[g.length]=q?String.fromCharCode(q):"";d+=g.join("");b++}break;case "x":if("*"===l)throw Error("pack(): Type x: '*' ignored");for(f=0;f<l;f++)d+=String.fromCharCode(0);break;case "X":if("*"===l)throw Error("pack(): Type X: '*' ignored");for(f=0;f<l;f++){if(0===d.length)throw Error("pack(): Type X: outside of string");d=d.substring(0,d.length-1)}break;case "@":if("*"===l)throw Error("pack(): Type X: '*' ignored");if(l>d.length)for(k=l-d.length,f=0;f<k;f++)d+=String.fromCharCode(0);l<d.length&&(d=d.substring(0,l));break;default:throw Error("pack(): Type "+h+": unknown format code");}}if(b<arguments.length)throw Error("pack(): "+(arguments.length-b)+" arguments unused");return d}function N(a,c){c+="";var b,d=c.length,e=[];if("C*"===a){for(b=0;b<d;b++)e[b+1]=c.charCodeAt(b);return e}if("H*hex"===a){e.hex=[];for(b=0;b<d;b++)e.hex[b+1]=((c.charCodeAt(b++)<<8)+c.charCodeAt(b)).toString(16);return e}}function S(a,c,b){return m===b?a.test(c):c.match(a)}function Z(a,c){var b,d=null,e=/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*#x2F;;"string"===typeof a?"function"===typeof u[a]?b=u[a]:a.match(e)&&(b=(new Function(null,"return "+a))()):"[object Array]"===Object.prototype.toString.call(a)?("string"===typeof a[0]?a[0].match(e)&&(b=eval(a[0]+"['"+a[1]+"']")):b=a[0][a[1]],"string"===typeof a[0]?"function"===typeof u[a[0]]?d=u[a[0]]:a[0].match(e)&&(d=eval(a[0])):"object"===typeof a[0]&&(d=a[0])):"function"===typeof a&&(b=a,d=u);if("function"!==typeof b)throw Error(b+" is not a valid function");return b.apply(d,c)}function aa(a,c,b){var d=/((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/;switch(c){case 275:return b===m?d.test(a):1048576===b?!1!==G(a,"."):!0}return!1}function A(a){a+="";var c=0,b="",d=[];if(4===a.length)return[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)].join(".");if(16===a.length){for(c=0;16>c;c++)d.push(((a.charCodeAt(c++)<<8)+a.charCodeAt(c)).toString(16));return d.join(":").replace(/((^|:)0(?=:|$))+:?/g,function(a){b=a.length>b.length?a:b;return a}).replace(b||" ","::")}return!1}function ma(a){a+="";var c,b;var d=String.fromCharCode;if(c=a.match(/^(?:\d{1,3}(?:\.|$)){4}/))return c=c[0].split("."),c=d(c[0])+d(c[1])+d(c[2])+d(c[3]),4===c.length?c:!1;if(c=a.match(/^((?:[\da-f]{1,4}(?::|)){0,8})(::)?((?:[\da-f]{1,4}(?::|)){0,8})#x2F;)){for(b=1;4>b;b++)if(2!==b&&0!==c[b].length){c[b]=c[b].split(":");for(a=0;a<c[b].length;a++){c[b][a]=parseInt(c[b][a],16);if(isNaN(c[b][a]))return!1;c[b][a]=d(c[b][a]>>8)+d(c[b][a]&255)}c[b]=c[b].join("")}d=c[1].length+c[3].length;if(16===d)return c[1]+c[3];if(16>d&&0<c[2].length)return c[1]+Array(16-d+1).join("\x00")+c[3]}return!1}function na(a){var c;a=a.match(/^([1-9]\d*|0[0-7]*|0x[\da-f]+)(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?#x2F;i);if(!a)return!1;a[0]=0;for(c=1;5>c;c+=1)a[0]+=!!(a[c]||"").length,a[c]=parseInt(a[c])||0;a.push(256,256,256,256);a[4+a[0]]*=Math.pow(256,4-a[0]);return a[1]>=a[5]||a[2]>=a[6]||a[3]>=a[7]||a[4]>=a[8]?!1:a[1]*(1===a[0]||16777216)+a[2]*(2>=a[0]||65536)+a[3]*(3>=a[0]||256)+1*a[4]}function k(a){this.__construct(a)}function F(a,c){this.__construct(a,c)}function D(a,c){this.__construct(a,c)}function T(a,c,b){var d=[].slice.call(arguments).slice(3);a&&a.addEventListener?a.addEventListener(c,function(){b.apply(a,d)},!1):a&&a.attachEvent&&a.attachEvent("on"+c,function(){b.apply(a,d)})}function fa(a){return a.trim().replace(",","\n").split("\n").map(function(a){return a.trim()})}function K(a){for(;p.g.firstChild;)p.g.removeChild(p.g.firstChild);p.g.appendChild(a?I.createTextNode(a+""):oa)}var n={},ha=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?#x2F;i;n.abs=function(){var a=new this.constructor(this);a.s=1;return a};n.cmp=function(a){var c=this.c,b=(a=new this.constructor(a)).c,d=this.s,e=a.s,f=this.e,g=a.e;if(!c[0]||!b[0])return c[0]?d:b[0]?-e:0;if(d!=e)return d;a=0>d;if(f!=g)return f>g^a?1:-1;e=(f=c.length)<(g=b.length)?f:g;for(d=-1;++d<e;)if(c[d]!=b[d])return c[d]>b[d]^a?1:-1;return f==g?0:f>g^a?1:-1};n.div=function(a){var c=this.constructor,b=this.c,d=(a=new c(a)).c,e=this.s==a.s?1:-1,f=c.DP;if(f!==~~f||0>f||1E6<f)throw Error("Invalid decimal places");if(!d[0])throw Error("Division by zero");if(!b[0])return new c(0*e);var g,h,k=d.slice(),n=g=d.length,u=b.length,m=b.slice(0,g),p=m.length,r=a,w=r.c=[],t=0,x=f+(r.e=this.e-a.e)+1;r.s=e;e=0>x?0:x;for(k.unshift(0);p++<g;)m.push(0);do{for(h=0;10>h;h++){if(g!=(p=m.length))var q=g>p?1:-1;else{var v=-1;for(q=0;++v<g;)if(d[v]!=m[v]){q=d[v]>m[v]?1:-1;break}}if(0>q){for(a=p==g?d:k;p;){if(m[--p]<a[p]){for(v=p;v&&!m[--v];)m[v]=9;--m[v];m[p]+=10}m[p]-=a[p]}for(;!m[0];)m.shift()}else break}w[t++]=q?h:++h;m[0]&&q?m[p]=b[n]||0:m=[b[n]]}while((n++<u||void 0!==m[0])&&e--);w[0]||1==t||(w.shift(),r.e--);t>x&&B(r,f,c.RM,void 0!==m[0]);return r};n.eq=function(a){return!this.cmp(a)};n.gt=function(a){return 0<this.cmp(a)};n.gte=function(a){return-1<this.cmp(a)};n.lt=function(a){return 0>this.cmp(a)};n.lte=function(a){return 1>this.cmp(a)};n.minus=n.sub=function(a){var c=this.constructor;var b=this.s,d=(a=new c(a)).s;if(b!=d)return a.s=-d,this.plus(a);var e=this.c.slice();var f=this.e;var g=a.c,h=a.e;if(!e[0]||!g[0])return g[0]?(a.s=-d,a):new c(e[0]?this:0);if(b=f-h){c=b;0>b?(b=-b,f=e):(h=f,f=g);f.reverse();for(d=b;d--;)f.push(0);f.reverse()}else for(f=((c=e.length<g.length)?e:g).length,b=d=0;d<f;d++)if(e[d]!=g[d]){c=e[d]<g[d];break}c&&(f=e,e=g,g=f,a.s=-a.s);if(0<(d=(f=g.length)-(c=e.length)))for(;d--;)e[c++]=0;for(d=c;f>b;){if(e[--f]<g[f]){for(c=f;c&&!e[--c];)e[c]=9;--e[c];e[f]+=10}e[f]-=g[f]}for(;0===e[--d];)e.pop();for(;0===e[0];)e.shift(),--h;e[0]||(a.s=1,e=[h=0]);a.c=e;a.e=h;return a};n.mod=function(a){var c=this,b=c.constructor,d=c.s,e=(a=new b(a)).s;if(!a.c[0])throw Error("Division by zero");c.s=a.s=1;var f=1==a.cmp(c);c.s=d;a.s=e;if(f)return new b(c);d=b.DP;e=b.RM;b.DP=b.RM=0;c=c.div(a);b.DP=d;b.RM=e;return this.minus(c.times(a))};n.plus=n.add=function(a){var c=this.constructor;var b=this.s,d=(a=new c(a)).s;if(b!=d)return a.s=-d,this.minus(a);d=this.e;var e=this.c,f=a.e,g=a.c;if(!e[0]||!g[0])return g[0]?a:new c(e[0]?this:0*b);e=e.slice();if(b=d-f){0<b?(f=d,c=g):(b=-b,c=e);for(c.reverse();b--;)c.push(0);c.reverse()}0>e.length-g.length&&(c=g,g=e,e=c);b=g.length;for(d=0;b;e[b]%=10)d=(e[--b]=e[b]+g[b]+d)/10|0;d&&(e.unshift(d),++f);for(b=e.length;0===e[--b];)e.pop();a.c=e;a.e=f;return a};n.pow=function(a){var c=this,b=new c.constructor(1),d=b,e=0>a;for(e&&(a=-a);;){a&1&&(d=d.times(c));a>>=1;if(!a)break;c=c.times(c)}return e?b.div(d):d};n.round=function(a,c){var b=this.constructor;if(void 0===a)a=0;else if(a!==~~a||0>a||1E6<a)throw Error("Invalid decimal places");return B(new b(this),a,void 0===c?b.RM:c)};n.sqrt=function(){var a=this.constructor;var c=this.s;var b=this.e,d=new a(.5);if(!this.c[0])return new a(this);if(0>c)throw Error("No square root");c=Math.sqrt(this.toString());0===c||c===1/0?(c=this.c.join(""),c.length+b&1||(c+="0"),c=new a(Math.sqrt(c).toString()),c.e=((b+1)/2|0)-(0>b||b&1)):c=new a(c.toString());b=c.e+(a.DP+=4);do{var e=c;c=d.times(e.plus(this.div(e)))}while(e.c.slice(0,b).join("")!==c.c.slice(0,b).join(""));return B(c,a.DP-=4,a.RM)};n.times=n.mul=function(a){var c=this.constructor;var b=this.c,d=(a=new c(a)).c,e=b.length,f=d.length,g=this.e,h=a.e;a.s=this.s==a.s?1:-1;if(!b[0]||!d[0])return new c(0*a.s);a.e=g+h;e<f&&(c=b,b=d,d=c,h=e,e=f,f=h);for(c=Array(h=e+f);h--;)c[h]=0;for(g=f;g--;){f=0;for(h=e+g;h>g;)f=c[h]+d[g]*b[h-g-1]+f,c[h--]=f%10,f=f/10|0;c[h]=(c[h]+f)%10}f?++a.e:c.shift();for(g=c.length;!c[--g];)c.pop();a.c=c;return a};n.toExponential=function(a){return C(this,1,a,a)};n.toFixed=function(a){return C(this,2,a,this.e+a)};n.toPrecision=function(a){return C(this,3,a,a-1)};n.toString=function(){return C(this)};n.valueOf=n.toJSON=function(){return C(this,4)};var x=z();x["default"]=x.Big=x;u.Big=x;k.prototype={IP_V4:"IPv4",IP_V6:"IPv6",IP_V4_MAX_PREFIX_LENGTH:32,IP_V6_MAX_PREFIX_LENGTH:128,IP_V4_OCTETS:4,IP_V6_OCTETS:16,$in_addr:null,__construct:function(a){if(!aa(a,275))throw Error("Invalid IP address format: `"+a+"`");this.$in_addr=ma(a)},toString:function(){return A(this.$in_addr)},parse:function(a){return 0===G(a,"0x")?(a=L(a,2),this.parseHex(a)):0===G(a,"0b")?(a=L(a,2),this.parseBin(a)):da(a)?this.parseLong(a):new k(a)},parseBin:function(a){if(!S(/^([0-1]{32}|[0-1]{128})#x2F;,a))throw Error("Invalid binary IP address format `"+a+"`");var c="";ja(ka,ea(a,8)).forEach(function(a){c+=M("C*",a)});return new k(A(c))},parseHex:function(a){if(!S(/^([0-9a-fA-F]{8}|[0-9a-fA-F]{32})#x2F;,a))throw Error("Invalid hexadecimal IP address format `"+a+"`");return new k(A(M("H*",a)))},parseLong:function(a,c){if(c===this.IP_V4){var b=a;b=isFinite(b)?[b>>>24,b>>>16&255,b>>>8&255,b&255].join("."):!1;b=new this(b)}else{var d=[];for(b=0;b<this.IP_V6_OCTETS;b++)d.push(x(a).mod(256)),a=x(a).div(256);d=W(d);d[0]="C*";b=new k(A(Z(M,d)))}return b},parseInAddr:function(a){return new k(A(a))},getVersion:function(){return aa(A(this.$in_addr),275,1048576)?this.IP_V4:aa(A(this.$in_addr),275,2097152)?this.IP_V6:!1},getMaxPrefixLength:function(){return this.getVersion()===this.IP_V4?this.IP_V4_MAX_PREFIX_LENGTH:this.IP_V6_MAX_PREFIX_LENGTH},getOctetsCount:function(){return this.getVersion()===this.IP_V4?this.IP_V4_OCTETS:this.IP_V6_OCTETS},getReversePointer:function(){if(this.getVersion()===this.IP_V4){var a=W(R(".",this.toString()));a=V(".",a)+".in-addr.arpa"}else a=N("H*hex",this.$in_addr),a=W(ea(a.hex)),a=V(".",a)+".ip6.arpa";return a},inAddr:function(){return this.$in_addr},toBin:function(){var a=[];N("C*",this.$in_addr).forEach(function(c){a.push(H(la(c),8,"0",0))});return V(a)},toHex:function(){return X(this.$in_addr)},toLong:function(){var a=0;if(this.getVersion()===this.IP_V4)a=ba("%u",na(A(this.$in_addr)));else{var c=this.IP_V6_OCTETS-1;var b=N("C*",this.$in_addr);b.forEach(function(b){var d=a;var f=c--;f=x(256).pow(f);b=x(b).times(f);a=P(d,b,1)})}return a},next:function(a){a=a||1;if(0>a)throw Error("Number must be greater than 0");var c,b,d=N("C*",this.$in_addr);for(c=0;c<a;c++)for(b=U(d);0<=b;--b)if(255>d[b]){d[b]++;break}else d[b]=0;d[0]="C*";return new k(A(Z(M,d)))},prev:function(a){a=a||1;if(0>a)throw Error("Number must be greater than 0");var c,b,d=N("C*",this.$in_addr);for(c=0;c<a;c++)for(b=U(d);0<=b;--b)if(0==d[b])d[b]=255;else{d[b]--;break}d[0]="C*";return new k(A(Z(M,d)))}};F.prototype={$ip:null,$netmask:null,$position:0,__construct:function(a,c){this.setIP(a);this.setNetmask(c)},toString:function(){return this.getCIDR()},parse:function(a){if(G(a,"/")){var c=R("/",a,2);a=c[0];c=c[1];a=k.prototype.parse(a);c=this.prefix2netmask(parseInt(c,10),a.getVersion())}else G(a," ")?(c=R(" ",a,2),a=c[0],c=c[1],a=k.prototype.parse(a),c=k.prototype.parse(c)):(a=k.prototype.parse(a),c=this.prefix2netmask(a.getMaxPrefixLength(),a.getVersion()));return new F(a,c)},prefix2netmask:function(a,c){a:{var b=[k.prototype.IP_V4,k.prototype.IP_V6];var d="";for(d in b)if(b.hasOwnProperty(d)&&b[d]==c){b=!0;break a}b=!1}if(!b)throw Error("Wrong IP version");b=c===k.prototype.IP_V4?k.prototype.IP_V4_MAX_PREFIX_LENGTH:k.prototype.IP_V6_MAX_PREFIX_LENGTH;if(!(da(a)&&0<=a&&a<=b))throw Error("Invalid prefix length");b=H(H("",parseInt(a,10),"1"),b,"0");return k.prototype.parseBin(b)},netmask2prefix:function(a){a=a.toBin();var c="0";c=c?(c+"").replace(/([[\]().?/*{}+$^:])/g,"\\$1"):" \\s\u00a0";return((a+"").replace(new RegExp("["+c+"]+quot;,"g"),"")+"").length},setIP:function(a){if(ca(this.$netmask)&&this.$netmask.getVersion()!==a.getVersion())throw Error("IP version is not same as Netmask version");this.$ip=a},setNetmask:function(a){if(!S(/^1*0*#x2F;,a.toBin()))throw Error("Invalid Netmask address format");if(ca(this.$ip)&&a.getVersion()!==this.$ip.getVersion())throw Error("Netmask version is not same as IP version");this.$netmask=a},setPrefixLength:function(a){this.setNetmask(this.prefix2netmask(parseInt(a,10),this.$ip.getVersion()))},getIP:function(){return this.$ip},getNetmask:function(){return this.$netmask},getNetwork:function(){var a=this.getIP().inAddr()+"",c=this.getNetmask().inAddr()+"",b,d=a.length,e=[];for(b=0;b<d;b++)e.push(H((a.charCodeAt(b)&c.charCodeAt(b)).toString(16),2,"0",0));return new k(A(Y(e.join(""))))},getPrefixLength:function(){return this.netmask2prefix(this.getNetmask())},getCIDR:function(){return ba("%s/%s",this.getNetwork(),this.getPrefixLength())},getWildcard:function(){return new k(A(~this.getNetmask().inAddr()))},getBroadcast:function(){var a=this.getNetwork().inAddr()+"",c=this.getNetmask().inAddr()+"",b,d=a.length,e=[];for(b=0;b<d;b++)e.push(H((a.charCodeAt(b)|~c.charCodeAt(b)&255).toString(16),2,"0",0));return new k(A(Y(e.join(""))))},getFirstIP:function(){return this.getNetwork()},getLastIP:function(){return this.getBroadcast()},getBlockSize:function(){var a=this.$ip.getMaxPrefixLength(),c=this.getPrefixLength();return this.$ip.getVersion()===k.prototype.IP_V6?(a=a-c+"",x("2").pow(a)):Math.pow(2,a-c)},getHosts:function(){var a=this.getNetwork(),c=this.getBroadcast();this.$ip.getVersion()===k.prototype.IP_V4&&2<this.getBlockSize()&&(a=k.prototype.parseBin(L(a.toBin(),0,a.getMaxPrefixLength()-1)+"1"),c=k.prototype.parseBin(L(c.toBin(),0,c.getMaxPrefixLength()-1)+"0"));return new D(a,c)},exclude:function(a){a=this.parse(a);if(0<w(a.getFirstIP().inAddr(),this.getLastIP().inAddr())||0>w(a.getLastIP().inAddr(),this.getFirstIP().inAddr()))throw Error("Exclude subnet not within target network");var c=[],b=this.getPrefixLength()+1;var d=J(!0,{},this);d.setPrefixLength(b);var e=J(!0,{},d);for(e.setIP(d.getLastIP().next());b<=a.getPrefixLength();){var f=new D(d.getFirstIP(),d.getLastIP());if(f.contains(a)){f=d;var g=e}else f=e,g=d;c.push(J(!0,{},g));if(++b>this.getNetwork().getMaxPrefixLength())break;f.setPrefixLength(b);g.setPrefixLength(b);g.setIP(f.getLastIP().next())}return F.prototype.sort(c)},moveTo:function(a){var c=this.$ip.getMaxPrefixLength();if(a<=this.getPrefixLength()||a>c)throw Error("Invalid prefix length");c=this.prefix2netmask(a,this.$ip.getVersion());var b=[];var d=J(!0,{},this);for(d.setPrefixLength(a);d.$ip.inAddr()<this.getLastIP().inAddr();)b.push(d),d=new F(d.getLastIP().next(),c);return b},sort:function(a){return a.sort(function(a,b){a=k.prototype.parse((a+"").split("/").shift()).toHex();b=k.prototype.parse((b+"").split("/").shift()).toHex();return w(a,b)})},current:function(){return this.getFirstIP().next(this.$position)},key:function(){return this.$position},next:function(){++this.$position},rewind:function(){this.$position=0},valid:function(){return 0>=w(this.getFirstIP().next(this.$position).inAddr(),this.getLastIP().inAddr())},count:function(){return parseInt(this.getBlockSize())}};D.prototype={$firstIP:null,$lastIP:null,$position:0,__construct:function(a,c){this.setFirstIP(a);this.setLastIP(c)},parse:function(a){if(G(a,"/")||G(a," ")){a=F.prototype.parse(a);var c=a.getFirstIP();a=a.getLastIP()}else G(a,"*")?(c=k.prototype.parse(a.replace("*","0")),a=k.prototype.parse(a.replace("*","255"))):G(a,"-")?(a=R("-",a,2),c=k.prototype.parse(a[0]),a=k.prototype.parse(a[1])):(c=k.prototype.parse(a),a=J(!0,{},c));return new D(c,a)},contains:function(a){if(a instanceof k)a=0<=w(a.inAddr(),this.$firstIP.inAddr())&&0>=w(a.inAddr(),this.$lastIP.inAddr());else if(a instanceof D||a instanceof F)a=0<=w(a.getFirstIP().inAddr(),this.$firstIP.inAddr())&&0>=w(a.getLastIP().inAddr(),this.$lastIP.inAddr());else throw Error("Invalid type");return a},setFirstIP:function(a){if(this.$lastIP&&0<w(a.inAddr(),this.$lastIP.inAddr()))throw Error("First IP is grater than second");this.$firstIP=a},setLastIP:function(a){if(this.$firstIP&&0>w(a.inAddr(),this.$firstIP.inAddr()))throw Error("Last IP is less than first");this.$lastIP=a},getFirstIP:function(){return this.$firstIP},getLastIP:function(){return this.$lastIP},getNetworks:function(){var a=this.getSpanNetwork(),c=[];if(a.getFirstIP().inAddr()===this.$firstIP.inAddr()&&a.getLastIP().inAddr()===this.$lastIP.inAddr())c.push(a);else{if(a.getFirstIP().inAddr()!==this.$firstIP.inAddr()){var b=a.exclude(this.$firstIP.prev());var d=this.$firstIP.inAddr();b.forEach(function(a){0<=w(a.getFirstIP().inAddr(),d)&&c.push(a)})}a.getLastIP().inAddr()!==this.$lastIP.inAddr()&&(c.length?(b=ia(c),b=b.exclude(this.$lastIP.next())):b=a.exclude(this.$lastIP.next()),d=this.$lastIP.inAddr(),b.forEach(function(a){a.getLastIP().inAddr()<=d&&c.push(a)}))}return F.prototype.sort(c)},getSpanNetwork:function(){var a=this.getFirstIP().inAddr()+"",c=this.getLastIP().inAddr()+"",b,d=a.length,e=[];for(b=0;b<d;b++)e.push(H((a.charCodeAt(b)^c.charCodeAt(b)).toString(16),2,"0",0));c=k.prototype.parseInAddr(Y(e.join("")));a=(S(/^(0*)/,c.toBin(),!0)[1]+"").length;c=k.prototype.parseBin(H(L(this.getFirstIP().toBin(),0,a),c.getMaxPrefixLength(),"0"));return new F(c,F.prototype.prefix2netmask(a,c.getVersion()))},sort:function(a){return a.sort(function(a,b){var c=w(a.getFirstIP().inAddr(),b.getFirstIP().inAddr());return c?c:w(a.getLastIP().inAddr(),b.getLastIP().inAddr())})},merge:function(a){a=D.prototype.sort(a);for(var c=0;c<a.length-1;)0<=w(a[c].getLastIP().next().inAddr(),a[c+1].getFirstIP().inAddr())?(a[c].setLastIP(a[c+1].getLastIP()),a.splice(c+1,1)):++c;return a},current:function(){return this.$firstIP.next(this.$position)},key:function(){return this.$position},next:function(){++this.$position},rewind:function(){this.$position=0},valid:function(){return 0>=w(X(this.$firstIP.next(this.$position).inAddr()),X(this.$lastIP.inAddr()))},count:function(){var a=this.$lastIP.toLong();var c=this.$firstIP.toLong();a=x(a).minus(c);return P(a,1)}};u.IP=k;u.Network=F;u.Range=D;var p={};"abcdefg".split("").map(function(a){p[a]=I.getElementById(a)});var oa=p.g?p.g.firstChild.cloneNode(!1):null;T(p.a,"click",function(a){a.value="";K()},p.c);T(p.b,"click",function(a){a.value="";K()},p.d);T(p.e,"click",function(a,c){var b=fa(a.value);try{var d,e=[];var f=0;for(d=b.length;f<d;++f)b[f]&&(b[f]=b[f].split("-").map(function(a){return a.trim()}),1===b[f].length&&b[f].push(b[f][0]),2===b[f].length&&(b[f][1]=b[f][1]||b[f][0],b[f][0]=b[f][0]||b[f][1],b[f][0]&&b[f][1]&&e.push(new D(new k(b[f][0]),new k(b[f][1])))));e=D.prototype.merge(e);var g=x(0);c.value="";f=0;for(d=e.length;f<d;++f)g=P(g,e[f].count(),1),e[f].getNetworks().forEach(function(a){c.value+=a+"\n"});K(g.gt(x(0))?g:null)}catch(h){K(h.message)}},p.c,p.d);T(p.f,"click",function(a,c){var b=fa(a.value);try{var d,e=[];var f=0;for(d=b.length;f<d;++f)b[f]&&e.push(D.prototype.parse(b[f]));e=D.prototype.merge(e);var g=x(0);c.value="";f=0;for(d=e.length;f<d;++f)g=P(g,e[f].count(),1),c.value+=e[f].getFirstIP()+" - "+e[f].getLastIP()+"\n";K(g.gt(x(0))?g:null)}catch(h){K(h.message)}},p.d,p.c)})(window,document);
8
- jQuery (https://jquery.com/)
9
This software is released under the MIT License.
10
*/
11
+ (function(B,S,y){function aa(){function a(c){if(!(this instanceof a))return void 0===c?aa():new a(c);if(c instanceof a)this.s=c.s,this.e=c.e,this.c=c.c.slice();else{var b,e;if(0===c&&0>1/c)c="-0";else if(!ia.test(c+=""))throw Error("Invalid number");"-"==c.charAt(0)?(c=c.slice(1),this.s=-1):this.s=1;-1<(b=c.indexOf("."))&&(c=c.replace(".",""));0<(e=c.search(/e/i))?(0>b&&(b=e),b+=+c.slice(e+1),c=c.substring(0,e)):0>b&&(b=c.length);var f=c.length;for(e=0;e<f&&"0"==c.charAt(e);++e);if(e===f)this.c=[this.e=0];else{for(;0<f&&"0"==c.charAt(--f););this.e=b-e-1;this.c=[];for(b=0;e<=f;)this.c[b++]=+c.charAt(e++)}}this.constructor=a}a.prototype=n;a.DP=20;a.RM=1;a.NE=-7;a.PE=21;a.version="5.0.2";return a}function N(a,c,b,e){var f=a.c,g=a.e+c+1;if(g<f.length){if(1===b)e=5<=f[g];else if(2===b)e=5<f[g]||5==f[g]&&(e||0>g||void 0!==f[g+1]||f[g-1]&1);else if(3===b)e=e||void 0!==f[g]||0>g;else if(e=!1,0!==b)throw Error("Invalid rounding mode");if(1>g)f.length=1,e?(a.e=-c,f[0]=1):f[0]=a.e=0;else{f.length=g--;if(e)for(;9<++f[g];)f[g]=0,g--||(++a.e,f.unshift(1));for(g=f.length;!f[--g];)f.pop()}}else if(0>b||3<b||b!==~~b)throw Error("Invalid rounding mode");return a}function J(a,c,b,e){var f=a.constructor,g=!a.c[0];if(void 0!==b){if(b!==~~b||b<(3===c)||1E6<b)throw Error(3===c?"Invalid precision":"Invalid decimal places");a=new f(a);b=e-a.e;a.c.length>++e&&N(a,b,f.RM);for(2===c&&(e=a.e+b+1);a.c.length<e;)a.c.push(0)}var h=a.e;var k=a.c.join("");b=k.length;if(2!==c&&(1===c||3===c&&e<=h||h<=f.NE||h>=f.PE))k=k.charAt(0)+(1<b?"."+k.slice(1):"")+(0>h?"e":"e+")+h;else if(0>h){for(;++h;)k="0"+k;k="0."+k}else if(0<h)if(++h>b)for(h-=b;h--;)k+="0";else h<b&&(k=k.slice(0,h)+"."+k.slice(h));else 1<b&&(k=k.charAt(0)+"."+k.slice(1));return 0>a.s&&(!g||4===c)?"-"+k:k}function ba(a){var c=Object.getPrototypeOf,b={},e=b.toString,f=b.hasOwnProperty;b=f.toString;if(!a||"[object Object]"!==e.call(a))return!1;a=c(a);if(!a)return!0;a=f.call(a,"constructor")&&a.constructor;return"function"===typeof a&&b.call(a)===b.call(Object)}function H(){var a,c,b,e=arguments[0]||{},f=1,g=arguments.length,h=!1;"boolean"===typeof e&&(h=e,e=arguments[f]||{},f++);"object"===typeof e||"function"===typeof e&&"number"!==typeof e.nodeType||(e={});f===g&&(e=this,f--);for(;f<g;f++)if(null!=(a=arguments[f]))for(c in a){var k=e[c];var m=a[c];e!==m&&(h&&m&&(ba(m)||(b=Array.isArray(m)))?(b?(b=!1,k=k&&Array.isArray(k)?k:[]):k=k&&ba(k)?k:{},e[c]=H(h,k,m)):m!==y&&(e[c]=m))}return e}function O(a,c){return p(a).plus(c)}function ca(){var a=/%%|%(?:(\d+)\$)?((?:[-+#0 ]|'[\s\S])*)(\d+)?(?:\.(\d*))?([\s\S])/g,c=arguments,b=0,e=c[b++],f=function(a,b,c,e){c||(c=" ");b=a.length>=b?"":Array(1+b-a.length>>>0).join(c);return e?a+b:b+a},g=function(a,b,c,e,g){var h=e-a.length;0<h&&(a=c||"0"!==g?f(a,e,g,c):[a.slice(0,b.length),f("",h,"0",!0),a.slice(b.length)].join(""));return a},h=function(a,b,c,e,h,k){a=f((a>>>0).toString(b),h||0,"0",!1);return g(a,"",c,e,k)},k=function(a,b,c,e,f){null!==e&&e!==y&&(a=a.slice(0,e));return g(a,"",b,c,f)},m=function(a,e,m,l,n,t){if("%%"===a)return"%";a=" ";var D=!1;var p="";var u;var F=0;for(u=m.length;F<u;F++)switch(m.charAt(F)){case " ":case "0":a=m.charAt(F);break;case "+":p="+";break;case "-":D=!0;break;case "'":F+1<u&&(a=m.charAt(F+1),F++)}l=l?+l:0;if(!isFinite(l))throw Error("Width must be finite");n=n?+n:"d"===t?0:-1<"fFeE".indexOf(t)?6:y;if(e&&0===+e)throw Error("Argument number must be greater than zero");if(e&&+e>=c.length)throw Error("Too few arguments");e=e?c[+e]:c[b++];switch(t){case "%":return"%";case "s":return k(e+"",D,l,n,a);case "c":return k(String.fromCharCode(+e),D,l,n,a);case "b":return h(e,2,D,l,n,a);case "o":return h(e,8,D,l,n,a);case "x":return h(e,16,D,l,n,a);case "X":return h(e,16,D,l,n,a).toUpperCase();case "u":return h(e,10,D,l,n,a);case "i":case "d":return e=+e||0,e=Math.round(e-e%1),p=0>e?"-":p,e=p+f(String(Math.abs(e)),n,"0",!1),D&&"0"===a&&(a=" "),g(e,p,D,l,a);case "e":case "E":case "f":case "F":case "g":case "G":return e=+e,p=0>e?"-":p,m=["toExponential","toFixed","toPrecision"]["efg".indexOf(t.toLowerCase())],t=["toString","toUpperCase"]["eEfFgG".indexOf(t)%2],e=p+Math.abs(e)[m](n),g(e,p,D,l,a)[t]();default:return""}};try{return e.replace(a,m)}catch(D){return!1}}function da(){var a=arguments,c=a.length,b=0;if(0===c)throw Error("Empty isset");for(;b!==c;){if(a[b]===y||null===a[b])return!1;b++}return!0}function ea(a){return("number"===typeof a||"string"===typeof a&&-1===" \n\r\t\f\x0B\u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000".indexOf(a.slice(-1)))&&""!==a&&!isNaN(a)}function v(a,c){return a===c?0:a>c?1:-1}function E(a,c,b){a=(a+"").indexOf(c,b||0);return-1===a?!1:a}function K(a,c,b){a+="";var e=a.length;0>c&&(c+=e);b!==y&&(e=0>b?b+e:b+c);return c>=a.length||0>c||c>e?!1:a.slice(c,e)}function T(a,c){var b,e=0;if(null===a||a===y)return 0;if(a.constructor!==Array&&a.constructor!==Object)return 1;"COUNT_RECURSIVE"===c&&(c=1);1!==c&&(c=0);for(b in a)a.hasOwnProperty(b)&&(e++,1!==c||!a[b]||a[b].constructor!==Array&&a[b].constructor!==Object||(e+=T(a[b],1)));return e}function U(a,c){var b="",e="",f="";1===arguments.length&&(c=a,a="");if("object"===typeof c){if("[object Array]"===Object.prototype.toString.call(c))return c.join(a);for(b in c)e+=f+c[b],f=a;return e}return c}function P(a,c,b){if(2>arguments.length||a===y||c===y)return null;if(""===a||!1===a||null===a)return!1;if("function"===typeof a||"object"===typeof a||"function"===typeof c||"object"===typeof c)return{0:""};!0===a&&(a="1");a+="";var e=(c+"").split(a);if(b===y)return e;0===b&&(b=1);if(0<b)return b>=e.length?e:e.slice(0,b-1).concat([e.slice(b-1).join(a)]);if(-b>=e.length)return[];e.splice(e.length+b);return e}function fa(a,c){null===c&&(c=1);if(null===a||1>c)return!1;a+="";for(var b=[],e=0,f=a.length;e<f;)b.push(a.slice(e,e+=c));return b}function G(a,c,b,e){var f="",g=function(a,b){for(var c="";c.length<b;)c+=a;return c=c.substr(0,b)};a+="";b=b!==y?b:" ";0!==e&&1!==e&&2!==e&&(e=1);0<(f=c-a.length)&&(0===e?a=g(b,f)+a:1===e?a+=g(b,f):2===e&&(f=g(b,Math.ceil(f/2)),a=(f+a+f).substr(0,c)));return a}function ja(a){var c="",b="";if(a.hasOwnProperty("length"))return a.length?a.pop():null;for(c in a)a.hasOwnProperty(c)&&(b=c);return b?(c=a[b],delete a[b],c):null}function ka(a){for(var c=arguments.length,b=arguments,e=null,f=a,g=b[1].length,h=0,k=1,m=0,l=[],n=[];h<g;){for(;k<c;)l[m++]=b[k++][h];m=0;k=1;if(a){if("string"===typeof a)f=B[a];else if("object"===typeof a&&a.length){e="string"===typeof a[0]?B[a[0]]:a[0];if(e===y)throw Error("Object not found: "+a[0]);f="string"===typeof a[1]?e[a[1]]:a[1]}n[h++]=f.apply(e,l)}else n[h++]=l;l=[]}return n}function V(a,c){var b="[object Array]"===Object.prototype.toString.call(a),e=c?{}:[];if(b&&!c)return a.slice(0).reverse();if(c){var f=[];for(g in a)f.push(g);for(b=f.length;b--;){var g=f[b];e[g]=a[g]}}else for(g in a)e.unshift(a[g]);return e}function la(a){a=(a+"").replace(/[^01]/gi,"");return parseInt(a,2)}function ma(a){0>a&&(a=4294967295+a+1);return parseInt(a,10).toString(2)}function W(a){var c,b="";a+="";var e=0;for(c=a.length;e<c;e++){var f=a.charCodeAt(e).toString(16);b+=2>f.length?"0"+f:f}return b}function X(a){a+="";var c=[],b=0,e;for(e=a.length;b<e;b+=2){var f=parseInt(a.substr(b,1),16);var g=parseInt(a.substr(b+1,1),16);if(isNaN(f)||isNaN(g))return!1;c.push(f<<4|g)}return String.fromCharCode.apply(String,c)}function L(a){for(var c=0,b=1,e="",f,g,h,k,m,l,n,p,t,v,w,C,B,u,x,A,z;c<a.length;){k=a.charAt(c);m="";for(c++;c<a.length&&null!==a.charAt(c).match(/[\d*]/);)m+=a.charAt(c),c++;""===m&&(m="1");switch(k){case "a":case "A":if(arguments[b]===y)throw Error("pack(): Type "+k+": not enough arguments");f=String(arguments[b]);"*"===m&&(m=f.length);for(g=0;g<m;g++)e=f[g]===y?"a"===k?e+String.fromCharCode(0):e+" ":e+f[g];b++;break;case "h":case "H":if(arguments[b]===y)throw Error("pack(): Type "+k+": not enough arguments");f=arguments[b];"*"===m&&(m=f.length);if(m>f.length)throw Error("pack(): Type "+k+": not enough characters in string");for(g=0;g<m;g+=2)l=f[g],l=g+1>=m||f[g+1]===y?l+"0":l+f[g+1],"h"===k&&(l=l[1]+l[0]),e+=String.fromCharCode(parseInt(l,16));b++;break;case "c":case "C":"*"===m&&(m=arguments.length-b);if(m>arguments.length-b)throw Error("pack(): Type "+k+": too few arguments");for(g=0;g<m;g++)e+=String.fromCharCode(arguments[b]),b++;break;case "s":case "S":case "v":"*"===m&&(m=arguments.length-b);if(m>arguments.length-b)throw Error("pack(): Type "+k+": too few arguments");for(g=0;g<m;g++)e+=String.fromCharCode(arguments[b]&255),e+=String.fromCharCode(arguments[b]>>8&255),b++;break;case "n":"*"===m&&(m=arguments.length-b);if(m>arguments.length-b)throw Error("pack(): Type "+k+": too few arguments");for(g=0;g<m;g++)e+=String.fromCharCode(arguments[b]>>8&255),e+=String.fromCharCode(arguments[b]&255),b++;break;case "i":case "I":case "l":case "L":case "V":"*"===m&&(m=arguments.length-b);if(m>arguments.length-b)throw Error("pack(): Type "+k+": too few arguments");for(g=0;g<m;g++)e+=String.fromCharCode(arguments[b]&255),e+=String.fromCharCode(arguments[b]>>8&255),e+=String.fromCharCode(arguments[b]>>16&255),e+=String.fromCharCode(arguments[b]>>24&255),b++;break;case "N":"*"===m&&(m=arguments.length-b);if(m>arguments.length-b)throw Error("pack(): Type "+k+": too few arguments");for(g=0;g<m;g++)e+=String.fromCharCode(arguments[b]>>24&255),e+=String.fromCharCode(arguments[b]>>16&255),e+=String.fromCharCode(arguments[b]>>8&255),e+=String.fromCharCode(arguments[b]&255),b++;break;case "f":case "d":l=23;n=8;"d"===k&&(l=52,n=11);"*"===m&&(m=arguments.length-b);if(m>arguments.length-b)throw Error("pack(): Type "+k+": too few arguments");for(g=0;g<m;g++){f=arguments[b];k=Math.pow(2,n-1)-1;h=-k+1;p=k;t=isNaN(u=parseFloat(f))||-Infinity===u||Infinity===u?u:0;v=0;w=2*k+1+l+3;C=Array(w);B=0>(u=0!==t?0:u);u=Math.abs(u);x=Math.floor(u);u-=x;for(f=w;f;)C[--f]=0;for(f=k+2;x&&f;)C[--f]=x%2,x=Math.floor(x/2);for(f=k+1;0<u&&f;--u)C[++f]=(1<=(u*=2))-0;for(f=-1;++f<w&&!C[f];);z=(u=l-1+(f=(v=k+1-f)>=h&&v<=p?f+1:k+1-(v=h-1)))+1;if(C[z]){if(!(A=C[u]))for(z=u+2;!A&&z<w;A=C[z++]);for(z=u+1;A&&0<=--z;(C[z]=!C[z]-0)&&(A=0));}for(f=0>f-2?-1:f-3;++f<w&&!C[f];);(v=k+1-f)>=h&&v<=p?++f:v<h&&(f=k+1-(v=h-1));if(x||0!==t)v=p+1,f=k+2,-Infinity===t?B=1:isNaN(t)&&(C[f]=1);u=Math.abs(v+k);k="";for(z=n+1;--z;)k=u%2+k,u=u>>=1;z=u=0;f=(k=(B?"1":"0")+k+C.slice(f,f+l).join("")).length;for(h=[];f;)u+=(1<<z)*k.charAt(--f),7===z&&(h[h.length]=String.fromCharCode(u),u=0),z=(z+1)%8;h[h.length]=u?String.fromCharCode(u):"";e+=h.join("");b++}break;case "x":if("*"===m)throw Error("pack(): Type x: '*' ignored");for(g=0;g<m;g++)e+=String.fromCharCode(0);break;case "X":if("*"===m)throw Error("pack(): Type X: '*' ignored");for(g=0;g<m;g++){if(0===e.length)throw Error("pack(): Type X: outside of string");e=e.substring(0,e.length-1)}break;case "@":if("*"===m)throw Error("pack(): Type X: '*' ignored");if(m>e.length)for(l=m-e.length,g=0;g<l;g++)e+=String.fromCharCode(0);m<e.length&&(e=e.substring(0,m));break;default:throw Error("pack(): Type "+k+": unknown format code");}}if(b<arguments.length)throw Error("pack(): "+(arguments.length-b)+" arguments unused");return e}function M(a,c){c+="";var b,e=c.length,f=[];if("C*"===a){for(b=0;b<e;b++)f[b+1]=c.charCodeAt(b);return f}if("H*hex"===a){f.hex=[];for(b=0;b<e;b++)f.hex[b+1]=((c.charCodeAt(b++)<<8)+c.charCodeAt(b)).toString(16);return f}}function Q(a,c,b){return y===b?a.test(c):c.match(a)}function Y(a,c){var b,e=null,f=/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*#x2F;;"string"===typeof a?"function"===typeof B[a]?b=B[a]:a.match(f)&&(b=(new Function(null,"return "+a))()):"[object Array]"===Object.prototype.toString.call(a)?("string"===typeof a[0]?a[0].match(f)&&(b=eval(a[0]+"['"+a[1]+"']")):b=a[0][a[1]],"string"===typeof a[0]?"function"===typeof B[a[0]]?e=B[a[0]]:a[0].match(f)&&(e=eval(a[0])):"object"===typeof a[0]&&(e=a[0])):"function"===typeof a&&(b=a,e=B);if("function"!==typeof b)throw Error(b+" is not a valid function");return b.apply(e,c)}function Z(a,c,b){var e=/((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/;switch(c){case 275:return b===y?e.test(a):1048576===b?!1!==E(a,"."):!0}return!1}function w(a){a+="";var c=0,b="",e=[];if(4===a.length)return[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)].join(".");if(16===a.length){for(c=0;16>c;c++)e.push(((a.charCodeAt(c++)<<8)+a.charCodeAt(c)).toString(16));return e.join(":").replace(/((^|:)0(?=:|$))+:?/g,function(a){b=a.length>b.length?a:b;return a}).replace(b||" ","::")}return!1}function na(a){a+="";var c,b;var e=String.fromCharCode;if(c=a.match(/^(?:\d{1,3}(?:\.|$)){4}/))return c=c[0].split("."),c=e(c[0])+e(c[1])+e(c[2])+e(c[3]),4===c.length?c:!1;if(c=a.match(/^((?:[\da-f]{1,4}(?::|)){0,8})(::)?((?:[\da-f]{1,4}(?::|)){0,8})#x2F;)){for(b=1;4>b;b++)if(2!==b&&0!==c[b].length){c[b]=c[b].split(":");for(a=0;a<c[b].length;a++){c[b][a]=parseInt(c[b][a],16);if(isNaN(c[b][a]))return!1;c[b][a]=e(c[b][a]>>8)+e(c[b][a]&255)}c[b]=c[b].join("")}e=c[1].length+c[3].length;if(16===e)return c[1]+c[3];if(16>e&&0<c[2].length)return c[1]+Array(16-e+1).join("\x00")+c[3]}return!1}function oa(a){var c;a=a.match(/^([1-9]\d*|0[0-7]*|0x[\da-f]+)(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?(?:\.([1-9]\d*|0[0-7]*|0x[\da-f]+))?#x2F;i);if(!a)return!1;a[0]=0;for(c=1;5>c;c+=1)a[0]+=!!(a[c]||"").length,a[c]=parseInt(a[c])||0;a.push(256,256,256,256);a[4+a[0]]*=Math.pow(256,4-a[0]);return a[1]>=a[5]||a[2]>=a[6]||a[3]>=a[7]||a[4]>=a[8]?!1:a[1]*(1===a[0]||16777216)+a[2]*(2>=a[0]||65536)+a[3]*(3>=a[0]||256)+1*a[4]}function l(a){this.__construct(a)}function A(a,c){this.__construct(a,c)}function x(a,c){this.__construct(a,c)}function R(a,c,b){var e=[].slice.call(arguments).slice(3);a&&a.addEventListener?a.addEventListener(c,function(){b.apply(a,e)},!1):a&&a.attachEvent&&a.attachEvent("on"+c,function(){b.apply(a,e)})}function ha(a){return a.trim().replace(",","\n").split("\n").map(function(a){return a.trim()})}function I(a){for(;t.g.firstChild;)t.g.removeChild(t.g.firstChild);t.g.appendChild(a?S.createTextNode(a+""):pa)}"function"!==typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(a,c){if(null==a)throw Error("Cannot convert undefined or null to object");var b,e,f=Object(a);for(e=1;e<arguments.length;e++){var g=arguments[e];if(null!=g)for(b in g)Object.prototype.hasOwnProperty.call(g,b)&&(f[b]=g[b])}return f},writable:!0,configurable:!0});Array.prototype.forEach||(Array.prototype.forEach=function(a,c){if(null==this)throw Error("this is null or not defined");var b,e,f=Object(this);var g=f.length>>>0;if("[object Function]"!=={}.toString.call(a))throw Error(a+" is not a function");c&&(b=c);for(e=0;e<g;){if(e in f){var h=f[e];a.call(b,h,e,f)}e++}});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});var n={},ia=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?#x2F;i;n.abs=function(){var a=new this.constructor(this);a.s=1;return a};n.cmp=function(a){var c=this.c,b=(a=new this.constructor(a)).c,e=this.s,f=a.s,g=this.e,h=a.e;if(!c[0]||!b[0])return c[0]?e:b[0]?-f:0;if(e!==f)return e;a=0>e;if(g!==h)return g>h^a?1:-1;f=(g=c.length)<(h=b.length)?g:h;for(e=-1;++e<f;)if(c[e]!==b[e])return c[e]>b[e]^a?1:-1;return g===h?0:g>h^a?1:-1};n.div=function(a){var c=this.constructor,b=this.c,e=(a=new c(a)).c,f=this.s==a.s?1:-1,g=c.DP;if(g!==~~g||0>g||1E6<g)throw Error("Invalid decimal places");if(!e[0])throw Error("Division by zero");if(!b[0])return new c(0*f);var h,k=e.slice(),l=e.length,n=e.length;al=b.length;r=b.slice(0,n);rl=r.length;q=a;qc=q.c=[];qi=0;d=g+(q.e=this.e-a.e)+1;q.s=f;f=0>d?0:d;for(k.unshift(0);rl++<n;)r.push(0);do{for(h=0;10>h;h++){if(n!=(rl=r.length))var t=n>rl?1:-1;else{var p=-1;for(t=0;++p<n;)if(e[p]!=r[p]){t=e[p]>r[p]?1:-1;break}}if(0>t){for(a=rl==n?e:k;rl;){if(r[--rl]<a[rl]){for(p=rl;p&&!r[--p];)r[p]=9;--r[p];r[rl]+=10}r[rl]-=a[rl]}for(;!r[0];)r.shift()}else break}qc[qi++]=t?h:++h;r[0]&&t?r[rl]=b[l]||0:r=[b[l]]}while((l++<al||void 0!==r[0])&&f--);qc[0]||1==qi||(qc.shift(),q.e--);qi>d&&N(q,g,c.RM,void 0!==r[0]);return q};n.eq=function(a){return!this.cmp(a)};n.gt=function(a){return 0<this.cmp(a)};n.gte=function(a){return-1<this.cmp(a)};n.lt=function(a){return 0>this.cmp(a)};n.lte=function(a){return 1>this.cmp(a)};n.minus=n.sub=function(a){var c=this.constructor;var b=this.s,e=(a=new c(a)).s;if(b!==e)return a.s=-e,this.plus(a);var f=this.c.slice();var g=this.e;var h=a.c,k=a.e;if(!f[0]||!h[0])return h[0]?(a.s=-e,a):new c(f[0]?this:0);if(b=g-k){c=b;0>b?(b=-b,g=f):(k=g,g=h);g.reverse();for(e=b;e--;)g.push(0);g.reverse()}else for(g=((c=f.length<h.length)?f:h).length,b=e=0;e<g;e++)if(f[e]!=h[e]){c=f[e]<h[e];break}c&&(g=f,f=h,h=g,a.s=-a.s);if(0<(e=(g=h.length)-(c=f.length)))for(;e--;)f[c++]=0;for(e=c;g>b;){if(f[--g]<h[g]){for(c=g;c&&!f[--c];)f[c]=9;--f[c];f[g]+=10}f[g]-=h[g]}for(;0===f[--e];)f.pop();for(;0===f[0];)f.shift(),--k;f[0]||(a.s=1,f=[k=0]);a.c=f;a.e=k;return a};n.mod=function(a){var c=this,b=c.constructor,e=c.s,f=(a=new b(a)).s;if(!a.c[0])throw Error("Division by zero");c.s=a.s=1;var g=1===a.cmp(c);c.s=e;a.s=f;if(g)return new b(c);e=b.DP;f=b.RM;b.DP=b.RM=0;c=c.div(a);b.DP=e;b.RM=f;return this.minus(c.times(a))};n.plus=n.add=function(a){var c=this.constructor;var b=this.s,e=(a=new c(a)).s;if(b!==e)return a.s=-e,this.minus(a);e=this.e;var f=this.c,g=a.e,h=a.c;if(!f[0]||!h[0])return h[0]?a:new c(f[0]?this:0*b);f=f.slice();if(b=e-g){0<b?(g=e,c=h):(b=-b,c=f);for(c.reverse();b--;)c.push(0);c.reverse()}0>f.length-h.length&&(c=h,h=f,f=c);b=h.length;for(e=0;b;f[b]%=10)e=(f[--b]=f[b]+h[b]+e)/10|0;e&&(f.unshift(e),++g);for(b=f.length;0===f[--b];)f.pop();a.c=f;a.e=g;return a};n.pow=function(a){var c=this,b=new c.constructor(1),e=b,f=0>a;for(f&&(a=-a);;){a&1&&(e=e.times(c));a>>=1;if(!a)break;c=c.times(c)}return f?b.div(e):e};n.round=function(a,c){var b=this.constructor;if(void 0===a)a=0;else if(a!==~~a||0>a||1E6<a)throw Error("Invalid decimal places");return N(new b(this),a,void 0===c?b.RM:c)};n.sqrt=function(){var a=this.constructor;var c=this.s;var b=this.e,e=new a(.5);if(!this.c[0])return new a(this);if(0>c)throw Error("No square root");c=Math.sqrt(this.toString());0===c||c===1/0?(c=this.c.join(""),c.length+b&1||(c+="0"),c=new a(Math.sqrt(c).toString()),c.e=((b+1)/2|0)-(0>b||b&1)):c=new a(c.toString());b=c.e+(a.DP+=4);do{var f=c;c=e.times(f.plus(this.div(f)))}while(f.c.slice(0,b).join("")!==c.c.slice(0,b).join(""));return N(c,a.DP-=4,a.RM)};n.times=n.mul=function(a){var c=this.constructor;var b=this.c,e=(a=new c(a)).c,f=b.length,g=e.length,h=this.e,k=a.e;a.s=this.s===a.s?1:-1;if(!b[0]||!e[0])return new c(0*a.s);a.e=h+k;f<g&&(c=b,b=e,e=c,k=f,f=g,g=k);for(c=Array(k=f+g);k--;)c[k]=0;for(h=g;h--;){g=0;for(k=f+h;k>h;)g=c[k]+e[h]*b[k-h-1]+g,c[k--]=g%10,g=g/10|0;c[k]=(c[k]+g)%10}g?++a.e:c.shift();for(h=c.length;!c[--h];)c.pop();a.c=c;return a};n.toExponential=function(a){return J(this,1,a,a)};n.toFixed=function(a){return J(this,2,a,this.e+a)};n.toPrecision=function(a){return J(this,3,a,a-1)};n.toString=function(){return J(this)};n.valueOf=n.toJSON=function(){return J(this,4)};var p=aa();p["default"]=p.Big=p;B.Big=p;l.prototype={IP_V4:"IPv4",IP_V6:"IPv6",IP_V4_MAX_PREFIX_LENGTH:32,IP_V6_MAX_PREFIX_LENGTH:128,IP_V4_OCTETS:4,IP_V6_OCTETS:16,$in_addr:null,__construct:function(a){if(!Z(a,275))throw Error("Invalid IP address format: "+a);this.$in_addr=na(a)},toString:function(){return w(this.$in_addr)},parse:function(a){return 0===E(a,"0x")?(a=K(a,2),this.parseHex(a)):0===E(a,"0b")?(a=K(a,2),this.parseBin(a)):ea(a)?this.parseLong(a):new l(a)},parseBin:function(a){if(!Q(/^([0-1]{32}|[0-1]{128})#x2F;,a))throw Error("Invalid binary IP address format: "+a);var c="";ka(la,fa(a,8)).forEach(function(a){c+=L("C*",a)});return new l(w(c))},parseHex:function(a){if(!Q(/^([0-9a-fA-F]{8}|[0-9a-fA-F]{32})#x2F;,a))throw Error("Invalid hexadecimal IP address format: "+a);return new l(w(L("H*",a)))},parseLong:function(a,c){if(c===this.IP_V4){var b=a;b=isFinite(b)?[b>>>24,b>>>16&255,b>>>8&255,b&255].join("."):!1;b=new this(b)}else{var e=[];for(b=0;b<this.IP_V6_OCTETS;b++)e.push(p(a).mod(256)),a=p(a).div(256);e=V(e);e[0]="C*";b=new l(w(Y(L,e)))}return b},parseInAddr:function(a){return new l(w(a))},getVersion:function(){return Z(w(this.$in_addr),275,1048576)?this.IP_V4:Z(w(this.$in_addr),275,2097152)?this.IP_V6:!1},getMaxPrefixLength:function(){return this.getVersion()===this.IP_V4?this.IP_V4_MAX_PREFIX_LENGTH:this.IP_V6_MAX_PREFIX_LENGTH},getOctetsCount:function(){return this.getVersion()===this.IP_V4?this.IP_V4_OCTETS:this.IP_V6_OCTETS},getReversePointer:function(){if(this.getVersion()===this.IP_V4){var a=V(P(".",this.toString()));a=U(".",a)+".in-addr.arpa"}else a=M("H*hex",this.$in_addr),a=V(fa(a.hex)),a=U(".",a)+".ip6.arpa";return a},inAddr:function(){return this.$in_addr},toBin:function(){var a=[];M("C*",this.$in_addr).forEach(function(c){a.push(G(ma(c),8,"0",0))});return U(a)},toHex:function(){return W(this.$in_addr)},toLong:function(){var a=0;if(this.getVersion()===this.IP_V4)a=ca("%u",oa(w(this.$in_addr)));else{var c=this.IP_V6_OCTETS-1;var b=M("C*",this.$in_addr);b.forEach(function(b){var e=a;var g=c--;g=p(256).pow(g);b=p(b).times(g);a=O(e,b,1)})}return a},next:function(a){a=a||1;if(0>a)throw Error("Number must be greater than 0");var c,b,e=M("C*",this.$in_addr);for(c=0;c<a;c++)for(b=T(e);0<=b;--b)if(255>e[b]){e[b]++;break}else e[b]=0;e[0]="C*";return new l(w(Y(L,e)))},prev:function(a){a=a||1;if(0>a)throw Error("Number must be greater than 0");var c,b,e=M("C*",this.$in_addr);for(c=0;c<a;c++)for(b=T(e);0<=b;--b)if(0==e[b])e[b]=255;else{e[b]--;break}e[0]="C*";return new l(w(Y(L,e)))}};A.prototype={$ip:null,$netmask:null,$position:0,__construct:function(a,c){this.setIP(a);this.setNetmask(c)},toString:function(){return this.getCIDR()},parse:function(a){if(E(a,"/")){var c=P("/",a,2);a=c[0];c=c[1];a=l.prototype.parse(a);c=this.prefix2netmask(parseInt(c,10),a.getVersion())}else E(a," ")?(c=P(" ",a,2),a=c[0],c=c[1],a=l.prototype.parse(a),c=l.prototype.parse(c)):(a=l.prototype.parse(a),c=this.prefix2netmask(a.getMaxPrefixLength(),a.getVersion()));return new A(a,c)},prefix2netmask:function(a,c){a:{var b=[l.prototype.IP_V4,l.prototype.IP_V6];var e="";for(e in b)if(b.hasOwnProperty(e)&&b[e]==c){b=!0;break a}b=!1}if(!b)throw Error("Wrong IP version");b=c===l.prototype.IP_V4?l.prototype.IP_V4_MAX_PREFIX_LENGTH:l.prototype.IP_V6_MAX_PREFIX_LENGTH;if(!(ea(a)&&0<=a&&a<=b))throw Error("Invalid prefix length");b=G(G("",parseInt(a,10),"1"),b,"0");return l.prototype.parseBin(b)},netmask2prefix:function(a){a=a.toBin();var c="0";c=c?(c+"").replace(/([[\]().?/*{}+$^:])/g,"\\$1"):" \\s\u00a0";return((a+"").replace(new RegExp("["+c+"]+quot;,"g"),"")+"").length},setIP:function(a){if(da(this.$netmask)&&this.$netmask.getVersion()!==a.getVersion())throw Error("IP version is not same as Netmask version");this.$ip=a},setNetmask:function(a){if(!Q(/^1*0*#x2F;,a.toBin()))throw Error("Invalid Netmask address format");if(da(this.$ip)&&a.getVersion()!==this.$ip.getVersion())throw Error("Netmask version is not same as IP version");this.$netmask=a},setPrefixLength:function(a){this.setNetmask(this.prefix2netmask(parseInt(a,10),this.$ip.getVersion()))},getIP:function(){return this.$ip},getNetmask:function(){return this.$netmask},getNetwork:function(){var a=this.getIP().inAddr()+"",c=this.getNetmask().inAddr()+"",b,e=a.length,f=[];for(b=0;b<e;b++)f.push(G((a.charCodeAt(b)&c.charCodeAt(b)).toString(16),2,"0",0));return new l(w(X(f.join(""))))},getPrefixLength:function(){return this.netmask2prefix(this.getNetmask())},getCIDR:function(){return ca("%s/%s",this.getNetwork(),this.getPrefixLength())},getWildcard:function(){return new l(w(~this.getNetmask().inAddr()))},getBroadcast:function(){var a=this.getNetwork().inAddr()+"",c=this.getNetmask().inAddr()+"",b,e=a.length,f=[];for(b=0;b<e;b++)f.push(G((a.charCodeAt(b)|~c.charCodeAt(b)&255).toString(16),2,"0",0));return new l(w(X(f.join(""))))},getFirstIP:function(){return this.getNetwork()},getLastIP:function(){return this.getBroadcast()},getBlockSize:function(){var a=this.$ip.getMaxPrefixLength(),c=this.getPrefixLength();return this.$ip.getVersion()===l.prototype.IP_V6?(a=a-c+"",p("2").pow(a)):Math.pow(2,a-c)},getHosts:function(){var a=this.getNetwork(),c=this.getBroadcast();this.$ip.getVersion()===l.prototype.IP_V4&&2<this.getBlockSize()&&(a=l.prototype.parseBin(K(a.toBin(),0,a.getMaxPrefixLength()-1)+"1"),c=l.prototype.parseBin(K(c.toBin(),0,c.getMaxPrefixLength()-1)+"0"));return new x(a,c)},exclude:function(a){a=this.parse(a);if(0<v(a.getFirstIP().inAddr(),this.getLastIP().inAddr())||0>v(a.getLastIP().inAddr(),this.getFirstIP().inAddr()))throw Error("Exclude subnet not within target network");var c=[],b=this.getPrefixLength()+1;var e=H(!0,{},this);e.setPrefixLength(b);var f=H(!0,{},e);for(f.setIP(e.getLastIP().next());b<=a.getPrefixLength();){var g=new x(e.getFirstIP(),e.getLastIP());if(g.contains(a)){g=e;var h=f}else g=f,h=e;c.push(H(!0,{},h));if(++b>this.getNetwork().getMaxPrefixLength())break;g.setPrefixLength(b);h.setPrefixLength(b);h.setIP(g.getLastIP().next())}return A.prototype.sort(c)},moveTo:function(a){var c=this.$ip.getMaxPrefixLength();if(a<=this.getPrefixLength()||a>c)throw Error("Invalid prefix length");c=this.prefix2netmask(a,this.$ip.getVersion());var b=[];var e=H(!0,{},this);for(e.setPrefixLength(a);e.$ip.inAddr()<this.getLastIP().inAddr();)b.push(e),e=new A(e.getLastIP().next(),c);return b},sort:function(a){return a.sort(function(a,b){a=l.prototype.parse((a+"").split("/").shift()).toHex();b=l.prototype.parse((b+"").split("/").shift()).toHex();return v(a,b)})},current:function(){return this.getFirstIP().next(this.$position)},key:function(){return this.$position},next:function(){++this.$position},rewind:function(){this.$position=0},valid:function(){return 0>=v(this.getFirstIP().next(this.$position).inAddr(),this.getLastIP().inAddr())},count:function(){return parseInt(this.getBlockSize())}};x.prototype={$firstIP:null,$lastIP:null,$position:0,__construct:function(a,c){this.setFirstIP(a);this.setLastIP(c)},parse:function(a){if(E(a,"/")||E(a," ")){a=A.prototype.parse(a);var c=a.getFirstIP();a=a.getLastIP()}else E(a,"*")?(c=l.prototype.parse(a.replace("*","0")),a=l.prototype.parse(a.replace("*","255"))):E(a,"-")?(a=P("-",a,2),c=l.prototype.parse(a[0]),a=l.prototype.parse(a[1])):(c=l.prototype.parse(a),a=H(!0,{},c));return new x(c,a)},contains:function(a){if(a instanceof l)a=0<=v(a.inAddr(),this.$firstIP.inAddr())&&0>=v(a.inAddr(),this.$lastIP.inAddr());else if(a instanceof x||a instanceof A)a=0<=v(a.getFirstIP().inAddr(),this.$firstIP.inAddr())&&0>=v(a.getLastIP().inAddr(),this.$lastIP.inAddr());else throw Error("Invalid type");return a},setFirstIP:function(a){if(this.$lastIP&&0<v(a.inAddr(),this.$lastIP.inAddr()))throw Error("First IP is grater than second");this.$firstIP=a},setLastIP:function(a){if(this.$firstIP&&0>v(a.inAddr(),this.$firstIP.inAddr()))throw Error("Last IP is less than first");this.$lastIP=a},getFirstIP:function(){return this.$firstIP},getLastIP:function(){return this.$lastIP},getNetworks:function(){var a=this.getSpanNetwork(),c=[];if(a.getFirstIP().inAddr()===this.$firstIP.inAddr()&&a.getLastIP().inAddr()===this.$lastIP.inAddr())c.push(a);else{if(a.getFirstIP().inAddr()!==this.$firstIP.inAddr()){var b=a.exclude(this.$firstIP.prev());var e=this.$firstIP.inAddr();b.forEach(function(a){0<=v(a.getFirstIP().inAddr(),e)&&c.push(a)})}a.getLastIP().inAddr()!==this.$lastIP.inAddr()&&(c.length?(b=ja(c),b=b.exclude(this.$lastIP.next())):b=a.exclude(this.$lastIP.next()),e=this.$lastIP.inAddr(),b.forEach(function(a){a.getLastIP().inAddr()<=e&&c.push(a)}))}return A.prototype.sort(c)},getSpanNetwork:function(){var a=this.getFirstIP().inAddr()+"",c=this.getLastIP().inAddr()+"",b,e=a.length,f=[];for(b=0;b<e;b++)f.push(G((a.charCodeAt(b)^c.charCodeAt(b)).toString(16),2,"0",0));c=l.prototype.parseInAddr(X(f.join("")));a=(Q(/^(0*)/,c.toBin(),!0)[1]+"").length;c=l.prototype.parseBin(G(K(this.getFirstIP().toBin(),0,a),c.getMaxPrefixLength(),"0"));return new A(c,A.prototype.prefix2netmask(a,c.getVersion()))},sort:function(a){return a.sort(function(a,b){var c=v(a.getFirstIP().inAddr(),b.getFirstIP().inAddr());return c?c:v(a.getLastIP().inAddr(),b.getLastIP().inAddr())})},merge:function(a){a=x.prototype.sort(a);for(var c=0;c<a.length-1;)0<=v(a[c].getLastIP().next().inAddr(),a[c+1].getFirstIP().inAddr())?(a[c].setLastIP(a[c+1].getLastIP()),a.splice(c+1,1)):++c;return a},current:function(){return this.$firstIP.next(this.$position)},key:function(){return this.$position},next:function(){++this.$position},rewind:function(){this.$position=0},valid:function(){return 0>=v(W(this.$firstIP.next(this.$position).inAddr()),W(this.$lastIP.inAddr()))},count:function(){var a=this.$lastIP.toLong();var c=this.$firstIP.toLong();a=p(a).minus(c);return O(a,1)}};B.IP=l;B.Network=A;B.Range=x;var t={};"abcdefg".split("").map(function(a){t[a]=S.getElementById(a)});var pa=t.g?t.g.firstChild.cloneNode(!1):null;R(t.a,"click",function(a){a.value="";I()},t.c);R(t.b,"click",function(a){a.value="";I()},t.d);R(t.e,"click",function(a,c){var b=ha(a.value);console.log(b);if(b[0])try{var e,f=[];var g=0;for(e=b.length;g<e;++g)b[g]&&(b[g]=b[g].split("-").map(function(a){return a.trim()}),1===b[g].length&&b[g].push(b[g][0]),2===b[g].length&&(b[g][1]=b[g][1]||b[g][0],b[g][0]=b[g][0]||b[g][1],b[g][0]&&b[g][1]&&f.push(new x(new l(b[g][0]),new l(b[g][1])))));f=x.prototype.merge(f);var h=p(0);c.value="";g=0;for(e=f.length;g<e;++g)h=O(h,f[g].count(),1),f[g].getNetworks().forEach(function(a){c.value+=a+"\n"});I(h.gt(p(0))?h:null)}catch(k){I(k.message)}},t.c,t.d);R(t.f,"click",function(a,c){var b=ha(a.value);console.log(b);if(b[0])try{var e,f=[];var g=0;for(e=b.length;g<e;++g)b[g]&&f.push(x.prototype.parse(b[g]));f=x.prototype.merge(f);var h=p(0);c.value="";g=0;for(e=f.length;g<e;++g)h=O(h,f[g].count(),1),c.value+=f[g].getFirstIP()+" - "+f[g].getLastIP()+"\n";I(h.gt(p(0))?h:null)}catch(k){I(k.message)}},t.d,t.c);S.getElementById("c").focus()})(window,document);
admin/js/gmap.js CHANGED
@@ -14,6 +14,9 @@ function gm_authFailure() {
14
(function ($) {
15
'use strict';
16
$(function ($) {
17
var e = "GmapRS",
18
d = "plugin_" + e,
19
b = {
14
(function ($) {
15
'use strict';
16
$(function ($) {
17
+ if ('undefined' === typeof google) {
18
+ return;
19
+ }
20
var e = "GmapRS",
21
d = "plugin_" + e,
22
b = {
admin/js/gmap.min.js CHANGED
@@ -5,4 +5,4 @@
5
Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
6
This software is released under the MIT License.
7
*/
8
- function gm_authFailure(){jQuery(window).trigger("ip-geo-block-gmap-error")}(function(f){f(function(d){var f={zoom:2,latitude:0,longitude:0},e=google.maps,g=function(a){this.o=d.extend({},f);this.q=[]};g.prototype={init:function(a){d.extend(this.o,a);this.c=new e.LatLng(this.o.latitude,this.o.longitude);this.m=new e.Map(this.e.get(0),{zoom:this.o.zoom,center:this.c,mapTypeId:e.MapTypeId.ROADMAP})},destroy:function(){this.deleteMarkers();this.e.data("plugin_GmapRS",null)},setCenter:function(){if(2<=arguments.length){var a=new e.LatLng(this.o.latitude=arguments[0],this.o.longitude=arguments[1]);delete this.c;this.c=a}this.m.setCenter(this.c);return this.e},setZoom:function(a){this.m.setZoom(a||this.o.zoom);return this.e},showMarker:function(a,c){var b=this.q[a];b&&b.w&&(!1===c?b.w.close():b.w.open(this.m,b.m))},addMarker:function(a){var c,b,d;c=new e.LatLng(a.latitude||this.o.latitude,a.longitude||this.o.longitude);b=new e.Marker({position:c,map:this.m,title:a.title||""});a.content&&(d=new e.InfoWindow({content:a.content}),e.event.addListener(b,"click",function(){d.open(b.getMap(),b)}));this.q.push({p:c,w:d,m:b});this.m.setCenter(c);this.m.setZoom(a.zoom);a.show&&this.showMarker(this.q.length-1);return this.e},deleteMarkers:function(){var a,c;for(a in this.q)this.q.hasOwnProperty(a)&&(c=this.q[a],c.m.setMap(null));this.q.length=0;return this.e}};d.fn.GmapRS=function(a){var c,b;this.data("plugin_GmapRS")instanceof g||this.data("plugin_GmapRS",new g(this));b=this.data("plugin_GmapRS");b.e=this;if("undefined"===typeof a||"object"===typeof a)"function"===typeof b.init&&b.init(a);else{if("string"===typeof a&&"function"===typeof b[a])return c=Array.prototype.slice.call(arguments,1),b[a].apply(b,c);d.error("Method "+a+" does not exist.GmapRS")}}})})(jQuery);
5
Copyright (c) 2013-2018 tokkonopapa (tokkonopapa@yahoo.com)
6
This software is released under the MIT License.
7
*/
8
+ function gm_authFailure(){jQuery(window).trigger("ip-geo-block-gmap-error")}(function(f){f(function(e){if("undefined"!==typeof google){var f={zoom:2,latitude:0,longitude:0},d=google.maps,g=function(a){this.o=e.extend({},f);this.q=[]};g.prototype={init:function(a){e.extend(this.o,a);this.c=new d.LatLng(this.o.latitude,this.o.longitude);this.m=new d.Map(this.e.get(0),{zoom:this.o.zoom,center:this.c,mapTypeId:d.MapTypeId.ROADMAP})},destroy:function(){this.deleteMarkers();this.e.data("plugin_GmapRS",null)},setCenter:function(){if(2<=arguments.length){var a=new d.LatLng(this.o.latitude=arguments[0],this.o.longitude=arguments[1]);delete this.c;this.c=a}this.m.setCenter(this.c);return this.e},setZoom:function(a){this.m.setZoom(a||this.o.zoom);return this.e},showMarker:function(a,b){var c=this.q[a];c&&c.w&&(!1===b?c.w.close():c.w.open(this.m,c.m))},addMarker:function(a){var b=new d.LatLng(a.latitude||this.o.latitude,a.longitude||this.o.longitude);var c=new d.Marker({position:b,map:this.m,title:a.title||""});if(a.content){var e=new d.InfoWindow({content:a.content});d.event.addListener(c,"click",function(){e.open(c.getMap(),c)})}this.q.push({p:b,w:e,m:c});this.m.setCenter(b);this.m.setZoom(a.zoom);a.show&&this.showMarker(this.q.length-1);return this.e},deleteMarkers:function(){var a;for(a in this.q)if(this.q.hasOwnProperty(a)){var b=this.q[a];b.m.setMap(null)}this.q.length=0;return this.e}};e.fn.GmapRS=function(a){this.data("plugin_GmapRS")instanceof g||this.data("plugin_GmapRS",new g(this));var b=this.data("plugin_GmapRS");b.e=this;if("undefined"===typeof a||"object"===typeof a)"function"===typeof b.init&&b.init(a);else{if("string"===typeof a&&"function"===typeof b[a]){var c=Array.prototype.slice.call(arguments,1);return b[a].apply(b,c)}e.error("Method "+a+" does not exist.GmapRS")}}}})})(jQuery);
admin/js/whois.js CHANGED
@@ -70,7 +70,7 @@
70
else if (value.name && value.value) {
71
/*if (value.link) {
72
var src = value.link.href.match(/\w+-grs/);
73
- value.value = '<a href="' +
74
app.replace('%SRC%', src[0])
75
.replace('%KEY%', encodeURI(value['value']))
76
.replace('%TYPE%', value['referenced-type']) +
70
else if (value.name && value.value) {
71
/*if (value.link) {
72
var src = value.link.href.match(/\w+-grs/);
73
+ value.value = '<a href="' +
74
app.replace('%SRC%', src[0])
75
.replace('%KEY%', encodeURI(value['value']))
76
.replace('%TYPE%', value['referenced-type']) +
classes/class-ip-geo-block-actv.php CHANGED
@@ -18,72 +18,71 @@ require_once IP_GEO_BLOCK_PATH . 'admin/includes/class-admin-rewrite.php';
18
19
class IP_Geo_Block_Activate {
20
21
- // initialize main blog
22
- private static function init_main_blog() {
23
- if ( current_user_can( 'manage_options' ) ) {
24
- $settings = IP_Geo_Block::get_option();
25
-
26
- // kick off a cron job to download database immediately
27
- IP_Geo_Block_Cron::start_update_db( $settings );
28
- IP_Geo_Block_Cron::start_cache_gc( $settings );
29
-
30
- // activate rewrite rules
31
- IP_Geo_Block_Admin_Rewrite::activate_rewrite_all( $settings['rewrite'] );
32
33
- // activate mu-plugins if needed
34
- IP_Geo_Block_Opts::setup_validation_timing( $settings );
35
- }
36
}
37
38
- // initialize logs then upgrade and return new options
39
public static function activate_blog() {
40
IP_Geo_Block_Logs::create_tables();
41
IP_Geo_Block_Logs::delete_cache_entry();
42
- IP_Geo_Block_Opts::upgrade();
43
}
44
45
/**
46
* Register options into database table when the plugin is activated.
47
* @link https://wordpress.stackexchange.com/questions/181141/how-to-run-an-activation-function-when-plugin-is-network-activated-on-multisite
48
*/
49
public static function activate( $network_wide = FALSE ) {
50
- defined( 'IP_GEO_BLOCK_DEBUG' ) and IP_GEO_BLOCK_DEBUG and assert( 'is_main_site()', 'Not main blog.' );
51
-
52
- // Update main blog first.
53
- self::activate_blog();
54
55
- if ( $network_wide ) {
56
// Get option of main blog.
57
- $option = IP_Geo_Block::get_option();
58
-
59
- global $wpdb;
60
- $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
61
62
- // Skip the main blog.
63
- array_shift( $blog_ids );
64
65
- foreach ( $blog_ids as $id ) {
66
- switch_to_blog( $id );
67
68
- if ( $option['network_wide'] ) {
69
- // individual data
70
- $opt = IP_Geo_Block::get_option();
71
- $option['api_key']['GoogleMap'] = $opt['api_key']['GoogleMap'];
72
73
- update_option( IP_Geo_Block::OPTION_NAME, $option );
74
- }
75
76
- else {
77
self::activate_blog();
78
- }
79
80
- restore_current_blog();
81
}
82
- }
83
84
- // only after 'init' action hook for is_user_logged_in().
85
- if ( did_action( 'init' ) && is_user_logged_in() )
86
- self::init_main_blog(); // should be called with high priority
87
}
88
89
/**
@@ -91,18 +90,31 @@ class IP_Geo_Block_Activate {
91
*
92
*/
93
public static function deactivate( $network_wide = FALSE ) {
94
- // cancel schedule
95
- IP_Geo_Block_Cron::stop_update_db();
96
- IP_Geo_Block_Cron::stop_cache_gc();
97
98
- // deactivate rewrite rules
99
- IP_Geo_Block_Admin_Rewrite::deactivate_rewrite_all();
100
101
- // deactivate mu-plugins
102
- IP_Geo_Block_Opts::setup_validation_timing();
103
104
- // remove self ip address from cache
105
- IP_Geo_Block_Logs::delete_cache_entry();
106
}
107
108
}
18
19
class IP_Geo_Block_Activate {
20
21
+ // Activate and deactivate main blog
22
+ private static function activate_main_blog( $settings ) {
23
+ IP_Geo_Block_Cron::start_update_db( $settings );
24
+ IP_Geo_Block_Opts::setup_validation_timing( $settings );
25
+ IP_Geo_Block_Admin_Rewrite::activate_rewrite_all( $settings['rewrite'] );
26
+ }
27
28
+ private static function deactivate_main_blog() {
29
+ IP_Geo_Block_Cron::stop_update_db();
30
+ IP_Geo_Block_Opts::setup_validation_timing();
31
+ IP_Geo_Block_Admin_Rewrite::deactivate_rewrite_all();
32
}
33
34
+ // Activate and deactivate each blog
35
public static function activate_blog() {
36
+ IP_Geo_Block_Opts::upgrade();
37
IP_Geo_Block_Logs::create_tables();
38
IP_Geo_Block_Logs::delete_cache_entry();
39
+ IP_Geo_Block_Cron::start_cache_gc();
40
+ }
41
+
42
+ private static function deactivate_blog() {
43
+ IP_Geo_Block_Cron::stop_cache_gc();
44
+ IP_Geo_Block_Logs::delete_cache_entry();
45
}
46
47
/**
48
* Register options into database table when the plugin is activated.
49
+ *
50
* @link https://wordpress.stackexchange.com/questions/181141/how-to-run-an-activation-function-when-plugin-is-network-activated-on-multisite
51
*/
52
public static function activate( $network_wide = FALSE ) {
53
+ if ( did_action( 'init' ) && current_user_can( 'manage_options' ) ) {
54
+ // Update main blog first.
55
+ self::activate_blog();
56
57
// Get option of main blog.
58
+ $settings = IP_Geo_Block::get_option();
59
60
+ if ( is_multisite() && $network_wide ) {
61
+ global $wpdb;
62
+ $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
63
64
+ // Skip the main blog.
65
+ array_shift( $blog_ids );
66
67
+ foreach ( $blog_ids as $id ) {
68
+ switch_to_blog( $id );
69
70
+ if ( $settings['network_wide'] ) {
71
+ // Copy settings of main site to individual site
72
+ $map = IP_Geo_Block::get_option();
73
+ $settings['api_key']['GoogleMap'] = $map['api_key']['GoogleMap'];
74
+ update_option( IP_Geo_Block::OPTION_NAME, $settings );
75
+ }
76
77
+ // Initialize inidivisual site
78
self::activate_blog();
79
80
+ restore_current_blog();
81
+ }
82
}
83
84
+ self::activate_main_blog( $settings );
85
+ }
86
}
87
88
/**
90
*
91
*/
92
public static function deactivate( $network_wide = FALSE ) {
93
+ add_action( 'shutdown', array( __CLASS__, 'deactivate_plugin' ) );
94
+ }
95
96
+ public static function deactivate_plugin() {
97
+ self::deactivate_blog();
98
99
+ if ( is_multisite() && is_main_site() ) {
100
+ global $wpdb;
101
+ $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs` ORDER BY `blog_id` ASC" );
102
103
+ // Skip the main blog.
104
+ array_shift( $blog_ids );
105
+
106
+ foreach ( $blog_ids as $id ) {
107
+ switch_to_blog( $id );
108
+
109
+ // Skip when this plugin is still active
110
+ if ( ! is_plugin_active( IP_GEO_BLOCK_BASE ) )
111
+ self::deactivate_blog();
112
+
113
+ restore_current_blog();
114
+ }
115
+ }
116
+
117
+ self::deactivate_main_blog();
118
}
119
120
}
classes/class-ip-geo-block-apis.php CHANGED
@@ -134,7 +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
@@ -318,9 +318,9 @@ class IP_Geo_Block_API_Nekudo extends IP_Geo_Block_API {
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)
@@ -450,31 +450,45 @@ class IP_Geo_Block_API_IPInfoDB extends IP_Geo_Block_API {
450
* Output type : array
451
*/
452
class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
453
-
454
// memory cache
455
protected static $memcache = array();
456
457
public static function update_cache( $hook, $validate, $settings ) {
458
$cache = self::get_cache( $ip = $validate['ip'] );
459
460
if ( $cache ) {
461
$fail = $cache['fail'] + ( 'failed' === $validate['result'] ? 1 : 0 );
462
$call = $cache['call'] + ( 'failed' !== $validate['result'] ? 1 : 0 );
463
} else { // if new cache then reset these values
464
$fail = 0;
465
$call = 1;
466
}
467
468
// update elements
469
IP_Geo_Block_Logs::update_cache( $cache = array(
470
- 'time' => $_SERVER['REQUEST_TIME'],
471
'ip' => $ip,
472
- 'asn' => $validate['asn' ], // @since 3.0.4
473
'hook' => $hook,
474
'code' => $validate['code'],
475
'auth' => $validate['auth'], // get_current_user_id() > 0
476
'fail' => $validate['auth'] ? 0 : $fail,
477
'call' => $settings['save_statistics'] ? $call : 0,
478
'host' => isset( $validate['host'] ) ? $validate['host'] : NULL,
479
) );
480
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
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)
450
* Output type : array
451
*/
452
class IP_Geo_Block_API_Cache extends IP_Geo_Block_API {
453
// memory cache
454
protected static $memcache = array();
455
456
public static function update_cache( $hook, $validate, $settings ) {
457
+ $time = $_SERVER['REQUEST_TIME'];
458
$cache = self::get_cache( $ip = $validate['ip'] );
459
460
if ( $cache ) {
461
$fail = $cache['fail'] + ( 'failed' === $validate['result'] ? 1 : 0 );
462
$call = $cache['call'] + ( 'failed' !== $validate['result'] ? 1 : 0 );
463
+ $last = $cache['last'];
464
+ $view = $cache['view'];
465
} else { // if new cache then reset these values
466
$fail = 0;
467
$call = 1;
468
+ $last = $time;
469
+ $view = 1;
470
+ }
471
+
472
+ if ( $cache && 'public' === $hook ) {
473
+ if ( $time - $last > $settings['behavior']['time'] )
474
+ $view = 1;
475
+ else
476
+ ++$view;
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,
485
+ 'asn' => $validate['asn' ], // @since 3.0.4
486
'code' => $validate['code'],
487
'auth' => $validate['auth'], // get_current_user_id() > 0
488
'fail' => $validate['auth'] ? 0 : $fail,
489
'call' => $settings['save_statistics'] ? $call : 0,
490
+ 'last' => $last,
491
+ 'view' => $view,
492
'host' => isset( $validate['host'] ) ? $validate['host'] : NULL,
493
) );
494
classes/class-ip-geo-block-cron.php CHANGED
@@ -8,6 +8,7 @@
8
* @link http://www.ipgeoblock.com/
9
* @copyright 2013-2018 tokkonopapa
10
*/
11
12
class IP_Geo_Block_Cron {
13
@@ -18,7 +19,7 @@ class IP_Geo_Block_Cron {
18
private static function schedule_cron_job( &$update, $db, $immediate = FALSE ) {
19
wp_clear_scheduled_hook( IP_Geo_Block::CRON_NAME, array( $immediate ) );
20
21
- if ( $update['auto'] ) {
22
$now = time();
23
$next = $now + ( $immediate ? 0 : DAY_IN_SECONDS );
24
@@ -59,12 +60,12 @@ class IP_Geo_Block_Cron {
59
* B. Multiple time for each blog when this plugin is individually activated
60
*/
61
public static function exec_update_db( $immediate = FALSE ) {
62
- $settings = IP_Geo_Block::get_option();
63
- $args = IP_Geo_Block::get_request_headers( $settings );
64
-
65
// extract ip address from transient API to confirm the request source
66
add_filter( IP_Geo_Block::PLUGIN_NAME . '-ip-addr', array( __CLASS__, 'extract_ip' ) );
67
68
// download database files (higher priority order)
69
foreach ( $providers = IP_Geo_Block_Provider::get_addons( $settings['providers'] ) as $provider ) {
70
if ( $geo = IP_Geo_Block_API::get_instance( $provider, $settings ) ) {
@@ -82,13 +83,13 @@ class IP_Geo_Block_Cron {
82
83
// update matching rule immediately
84
if ( $immediate && 'done' !== get_transient( IP_Geo_Block::CRON_NAME ) ) {
85
- $validate = IP_Geo_Block::get_geolocation( NULL, array( $provider ) );
86
$validate = IP_Geo_Block::validate_country( 'cron', $validate, $settings );
87
88
if ( 'ZZ' === $validate['code'] )
89
continue;
90
91
- // matching rule should be reset when blocking happens
92
if ( 'passed' !== $validate['result'] )
93
$settings['matching_rule'] = -1;
94
@@ -96,16 +97,16 @@ class IP_Geo_Block_Cron {
96
if ( -1 === (int)$settings['matching_rule'] ) {
97
$settings['matching_rule'] = 0; // white list
98
99
if ( FALSE === strpos( $settings['white_list'], $validate['code'] ) )
100
$settings['white_list'] .= ( $settings['white_list'] ? ',' : '' ) . $validate['code'];
101
-
102
- // update option settings
103
- self::update_settings( $settings, array( 'matching_rule', 'white_list' ) );
104
}
105
106
// finished to update matching rule
107
- if ( -1 !== (int)$settings['matching_rule'] )
108
- set_transient( IP_Geo_Block::CRON_NAME, 'done', 5 * MINUTE_IN_SECONDS );
109
}
110
}
111
}
@@ -118,9 +119,7 @@ class IP_Geo_Block_Cron {
118
*
119
*/
120
private static function update_settings( $src, $keys = array() ) {
121
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
122
-
123
- // for multisite (@since 3.0.0 in wp-admin/includes/plugin.php)
124
if ( is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) {
125
global $wpdb;
126
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" );
@@ -158,15 +157,15 @@ class IP_Geo_Block_Cron {
158
* Kick off a cron job to download database immediately in background on activation.
159
*
160
*/
161
- public static function start_update_db( $settings, $force = FALSE ) {
162
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
163
-
164
- // the status is still inactive when this plugin is activated on dashboard.
165
- if ( ! ( is_plugin_active ( IP_GEO_BLOCK_BASE ) || // @since 2.5.0
166
- is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) || $force ) { // @since 3.0.0
167
- set_transient( IP_Geo_Block::CRON_NAME, IP_Geo_Block::get_ip_address(), MINUTE_IN_SECONDS );
168
- self::schedule_cron_job( $settings['update'], NULL, TRUE );
169
- }
170
}
171
172
public static function stop_update_db() {
@@ -178,29 +177,14 @@ class IP_Geo_Block_Cron {
178
*
179
*/
180
public static function exec_cache_gc( $settings ) {
181
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
182
-
183
- if ( is_plugin_active_for_network( IP_GEO_BLOCK_BASE ) ) {
184
- global $wpdb;
185
- $blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM `$wpdb->blogs`" );
186
-
187
- foreach ( $blog_ids as $id ) {
188
- switch_to_blog( $id );
189
- IP_Geo_Block_Logs::delete_cache_expired( $settings['cache_time'] );
190
- restore_current_blog();
191
- }
192
- }
193
-
194
- // for single site
195
- else {
196
- IP_Geo_Block_Logs::delete_cache_expired( $settings['cache_time'] );
197
- }
198
-
199
self::stop_cache_gc();
200
self::start_cache_gc( $settings );
201
}
202
203
- public static function start_cache_gc( $settings ) {
204
if ( ! wp_next_scheduled( IP_Geo_Block::CACHE_NAME ) )
205
wp_schedule_single_event( time() + $settings['cache_time_gc'], IP_Geo_Block::CACHE_NAME );
206
}
8
* @link http://www.ipgeoblock.com/
9
* @copyright 2013-2018 tokkonopapa
10
*/
11
+ require_once ABSPATH . 'wp-admin/includes/plugin.php'; // is_plugin_active_for_network() @since 3.0.0
12
13
class IP_Geo_Block_Cron {
14
19
private static function schedule_cron_job( &$update, $db, $immediate = FALSE ) {
20
wp_clear_scheduled_hook( IP_Geo_Block::CRON_NAME, array( $immediate ) );
21
22
+ if ( $update['auto'] || $immediate ) {
23
$now = time();
24
$next = $now + ( $immediate ? 0 : DAY_IN_SECONDS );
25