Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.147

Version Description

Oct 08 2020 = * Fix: WPForms. Auto submitting. * Fix: Synchronization timeout increased to 25 seconds. * Fix: Cookiebot compatibility. * Fix: Visible fields logic fixed. * New: Duplicated requests prevention. * Fix: SpamFireWall auto incremental uses primary key. * Fix: Skip woocommerce internal request. * Upd: Url exclusions option updated. * Fix: Checking comments/users - redirecting after deleting all items fixed. * New: Comments scanner - marking as spam action implemented. * Fix: SFW table fixed. * Upd: Comments scanner - moving to trash instead deleting. * Upd: Visible fields collecting functionality updated.

Download this release

Release Info

Developer glomberg
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.147
Comparing to
See all releases

Code changes from version 5.146.1 to 5.147

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.146.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
@@ -67,6 +67,8 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
67
 
68
  $apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
69
 
 
 
70
  $apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
71
  $apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
72
  $apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
@@ -667,10 +669,12 @@ function apbct_activation( $network = false ) {
667
 
668
  // SFW data
669
  $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
670
- `network` int(11) unsigned NOT NULL,
671
- `mask` int(11) unsigned NOT NULL,
672
- `status` TINYINT(1) NOT NULL DEFAULT 0,
673
- INDEX ( `network` , `mask` )
 
 
674
  );';
675
 
676
  // SFW log
@@ -777,9 +781,12 @@ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id
777
 
778
  // SFW data
779
  $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
780
- `network` int(11) unsigned NOT NULL,
781
- `mask` int(11) unsigned NOT NULL,
782
- INDEX ( `network` , `mask` )
 
 
 
783
  );';
784
 
785
  // SFW log
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.147
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
67
 
68
  $apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
69
 
70
+ $apbct->plugin_request_id = md5( microtime() ); // Identify plugin execution
71
+
72
  $apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
73
  $apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
74
  $apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
669
 
670
  // SFW data
671
  $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
672
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
673
+ `network` int(11) unsigned NOT NULL,
674
+ `mask` int(11) unsigned NOT NULL,
675
+ `status` TINYINT(1) NOT NULL DEFAULT 0,
676
+ PRIMARY KEY (`id`),
677
+ INDEX ( `network` , `mask` )
678
  );';
679
 
680
  // SFW log
781
 
782
  // SFW data
783
  $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
784
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
785
+ `network` int(11) unsigned NOT NULL,
786
+ `mask` int(11) unsigned NOT NULL,
787
+ `status` TINYINT(1) NOT NULL DEFAULT 0,
788
+ PRIMARY KEY (`id`),
789
+ INDEX ( `network` , `mask` )
790
  );';
791
 
792
  // SFW log
css/cleantalk-admin-settings-page.min.css CHANGED
@@ -1 +1 @@
1
- .apbct_settings-field_content,.apbct_settings-field_title--radio,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content--radio{width:70%}.apbct_settings-field_title--radio{margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;font-size:25px;line-height:20px;color:rgba(120,200,230,1);margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}
1
+ .apbct_settings-field_content,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content--radio{width:70%}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;text-align:center;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;font-size:25px;line-height:20px;color:rgba(120,200,230,1);margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}
inc/cleantalk-admin.php CHANGED
@@ -14,7 +14,7 @@ add_action( 'admin_head','apbct_admin_set_cookie_for_anti_bot' );
14
 
15
  function apbct_admin_set_cookie_for_anti_bot(){
16
  global $apbct;
17
- echo '<script>document.cookie = "apbct_antibot=' . hash( 'sha256', $apbct->api_key . $apbct->data['salt'] ) . '; path=/; expires=0; samesite=lax";</script>';
18
  }
19
 
20
  function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
@@ -230,7 +230,7 @@ function apbct_admin__register_plugin_links($links, $file){
230
 
231
  if($apbct->white_label){
232
  $links = array_slice($links, 0, 1);
233
- $links[] = "<script>jQuery('.plugin-title strong').each(function(i, item){
234
  if(jQuery(item).html() == 'Anti-Spam by CleanTalk')
235
  jQuery(item).html('{$apbct->plugin_name}');
236
  });</script>";
14
 
15
  function apbct_admin_set_cookie_for_anti_bot(){
16
  global $apbct;
17
+ echo '<script ' . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . '>document.cookie = "apbct_antibot=' . hash( 'sha256', $apbct->api_key . $apbct->data['salt'] ) . '; path=/; expires=0; samesite=lax";</script>';
18
  }
19
 
20
  function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
230
 
231
  if($apbct->white_label){
232
  $links = array_slice($links, 0, 1);
233
+ $links[] = "<script " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">jQuery('.plugin-title strong').each(function(i, item){
234
  if(jQuery(item).html() == 'Anti-Spam by CleanTalk')
235
  jQuery(item).html('{$apbct->plugin_name}');
236
  });</script>";
inc/cleantalk-ajax.php CHANGED
@@ -313,6 +313,8 @@ function ct_ajax_hook($message_obj = false, $additional = false)
313
  'ck_get_subscriber', //ConvertKit checking the subscriber
314
  'metorik_send_cart', //Metorik skip
315
  'ppom_ajax_validation', // PPOM add to cart validation
 
 
316
  );
317
 
318
  // Skip test if
313
  'ck_get_subscriber', //ConvertKit checking the subscriber
314
  'metorik_send_cart', //Metorik skip
315
  'ppom_ajax_validation', // PPOM add to cart validation
316
+ 'wpforms_form_abandonment', // WPForms. Quiting without submitting
317
+ 'post_woo_ml_email_cookie', //Woocommerce system
318
  );
319
 
320
  // Skip test if
inc/cleantalk-common.php CHANGED
@@ -3,6 +3,7 @@
3
  use Cleantalk\Antispam\Cleantalk;
4
  use Cleantalk\Antispam\CleantalkRequest;
5
  use Cleantalk\Antispam\CleantalkResponse;
 
6
 
7
  function apbct_array( $array ){
8
  return new \Cleantalk\Common\Arr( $array );
@@ -91,9 +92,27 @@ function apbct_base_call($params = array(), $reg_flag = false){
91
  do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
92
  return array( 'ct_result' => new CleantalkResponse() );
93
  }
94
-
95
  $cleantalk_executed = true;
96
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  $sender_info = !empty($params['sender_info'])
98
  ? \Cleantalk\ApbctWP\Helper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
99
  : apbct_get_sender_info();
@@ -267,9 +286,15 @@ function apbct_exclusions_check__url() {
267
  global $apbct;
268
 
269
  if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
270
-
271
- $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
272
-
 
 
 
 
 
 
273
  // Fix for AJAX forms
274
  $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
275
  ? apbct_get_server_variable( 'HTTP_REFERER' )
@@ -360,8 +385,12 @@ function apbct_get_sender_info() {
360
  $urls = $apbct->settings['store_urls__sessions']
361
  ? (array)apbct_alt_session__get('apbct_urls')
362
  : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
363
-
 
 
 
364
  return array(
 
365
  'wpms' => is_multisite() ? 'yes' : 'no',
366
  'remote_addr' => \Cleantalk\ApbctWP\Helper::ip__get(array('remote_addr'), false),
367
  'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
@@ -385,8 +414,8 @@ function apbct_get_sender_info() {
385
  'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
386
  'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
387
  'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
388
- 'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
389
- 'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
390
  // Misc
391
  'site_referer' => !empty($site_referer) ? $site_referer : null,
392
  'source_url' => !empty($urls) ? json_encode($urls) : null,
@@ -403,28 +432,48 @@ function apbct_get_sender_info() {
403
  /**
404
  * Process visible fields for specific form to match the fields from request
405
  *
406
- * @param string $visible_fields
407
  *
408
- * @return string
409
  */
410
- function apbct_visibile_fields__process($visible_fields) {
411
- if(strpos($visible_fields, 'wpforms') !== false){
412
- $visible_fields = preg_replace(
413
- array('/\[/', '/\]/'),
414
- '',
415
- str_replace(
416
- '][',
417
- '_',
418
- str_replace(
419
- 'wpforms[fields]',
420
- '',
421
- $visible_fields
422
- )
423
- )
424
- );
425
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
 
427
- return $visible_fields;
428
  }
429
 
430
  /*
@@ -979,7 +1028,7 @@ function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
979
  }
980
 
981
  /**
982
- * Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
983
  * @param api_key
984
  * @return bool
985
  */
@@ -995,18 +1044,20 @@ function apbct_add_async_attribute($tag, $handle, $src) {
995
  global $apbct;
996
 
997
  if(
998
- $apbct->settings['async_js'] &&
999
- (
1000
- $handle === 'ct_public'
1001
- || $handle === 'ct_public_gdpr'
1002
- || $handle === 'ct_debug_js'
1003
- || $handle === 'ct_public_admin_js'
1004
- || $handle === 'ct_internal'
1005
- || $handle === 'ct_external'
1006
- || $handle === 'ct_nocache'
1007
- )
1008
- )
1009
- return str_replace( ' src', ' async="async" src', $tag );
1010
- else
1011
- return $tag;
 
 
1012
  }
3
  use Cleantalk\Antispam\Cleantalk;
4
  use Cleantalk\Antispam\CleantalkRequest;
5
  use Cleantalk\Antispam\CleantalkResponse;
6
+ use Cleantalk\Variables\Cookie;
7
 
8
  function apbct_array( $array ){
9
  return new \Cleantalk\Common\Arr( $array );
92
  do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
93
  return array( 'ct_result' => new CleantalkResponse() );
94
  }
 
95
  $cleantalk_executed = true;
96
+
97
+ // Request id rotation
98
+ $plugin_request_id__lifetime = 2;
99
+ $tmp = array();
100
+ foreach( $apbct->plugin_request_ids as $request_id => $request_time ){
101
+ if( time() - $request_time < $plugin_request_id__lifetime )
102
+ $tmp[ $request_id ] = $request_time;
103
+ }
104
+ $apbct->plugin_request_ids = $tmp;
105
+ $apbct->save('plugin_request_ids');
106
+
107
+ // Skip duplicate requests
108
+ if( key_exists( $apbct->plugin_request_id, $apbct->plugin_request_ids ) ){
109
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST );
110
+ return array( 'ct_result' => new CleantalkResponse() );
111
+ }
112
+
113
+ $apbct->plugin_request_ids = array_merge($apbct->plugin_request_ids, array($apbct->plugin_request_id => time() ) );
114
+ $apbct->save('plugin_request_ids');
115
+
116
  $sender_info = !empty($params['sender_info'])
117
  ? \Cleantalk\ApbctWP\Helper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
118
  : apbct_get_sender_info();
286
  global $apbct;
287
 
288
  if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
289
+
290
+ if( strpos( $apbct->settings['exclusions__urls'], "\r\n" ) !== false ) {
291
+ $exclusions = explode( "\r\n", $apbct->settings['exclusions__urls'] );
292
+ } elseif( strpos( $apbct->settings['exclusions__urls'], "\n" ) !== false ) {
293
+ $exclusions = explode( "\n", $apbct->settings['exclusions__urls'] );
294
+ } else {
295
+ $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
296
+ }
297
+
298
  // Fix for AJAX forms
299
  $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
300
  ? apbct_get_server_variable( 'HTTP_REFERER' )
385
  $urls = $apbct->settings['store_urls__sessions']
386
  ? (array)apbct_alt_session__get('apbct_urls')
387
  : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
388
+
389
+ // Visible fields processing
390
+ $visible_fields = apbct_visibile_fields__process( Cookie::get('apbct_visible_fields') );
391
+
392
  return array(
393
+ 'plugin_request_id' => $apbct->plugin_request_id,
394
  'wpms' => is_multisite() ? 'yes' : 'no',
395
  'remote_addr' => \Cleantalk\ApbctWP\Helper::ip__get(array('remote_addr'), false),
396
  'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
414
  'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
415
  'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
416
  'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
417
+ 'form_visible_inputs' => !empty($visible_fields['visible_fields_count']) ? $visible_fields['visible_fields_count'] : null,
418
+ 'apbct_visible_fields' => !empty($visible_fields['visible_fields']) ? $visible_fields['visible_fields'] : null,
419
  // Misc
420
  'site_referer' => !empty($site_referer) ? $site_referer : null,
421
  'source_url' => !empty($urls) ? json_encode($urls) : null,
432
  /**
433
  * Process visible fields for specific form to match the fields from request
434
  *
435
+ * @param string $visible_fields JSON string
436
  *
437
+ * @return array
438
  */
439
+ function apbct_visibile_fields__process( $visible_fields ) {
440
+
441
+ $fields_collection = json_decode( $visible_fields, true );
442
+
443
+ if( ! empty( $fields_collection ) ) {
444
+ foreach ($fields_collection as $current_fields) {
445
+ if( isset( $current_fields['visible_fields'] ) && isset( $current_fields['visible_fields_count'] ) ) {
446
+
447
+ $fields = explode( ' ', $current_fields['visible_fields'] );
448
+
449
+ // This fields belong this request
450
+ // @ToDo we have to implement a logic to find form fields (fields names, fields count) in serialized/nested/encoded items. not only $_POST.
451
+ if( count( array_intersect( array_keys($_POST), $fields ) ) > 0 ) {
452
+ // WP Forms visible fields formatting
453
+ if(strpos($visible_fields, 'wpforms') !== false){
454
+ $visible_fields = preg_replace(
455
+ array('/\[/', '/\]/'),
456
+ '',
457
+ str_replace(
458
+ '][',
459
+ '_',
460
+ str_replace(
461
+ 'wpforms[fields]',
462
+ '',
463
+ $visible_fields
464
+ )
465
+ )
466
+ );
467
+ }
468
+
469
+ return $current_fields;
470
+
471
+ }
472
+ }
473
+ }
474
+ }
475
 
476
+ return array();
477
  }
478
 
479
  /*
1028
  }
1029
 
1030
  /**
1031
+ * Does ey has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
1032
  * @param api_key
1033
  * @return bool
1034
  */
1044
  global $apbct;
1045
 
1046
  if(
1047
+ $handle === 'ct_public' ||
1048
+ $handle === 'ct_public_gdpr' ||
1049
+ $handle === 'ct_debug_js' ||
1050
+ $handle === 'ct_public_admin_js' ||
1051
+ $handle === 'ct_internal' ||
1052
+ $handle === 'ct_external' ||
1053
+ $handle === 'ct_nocache'
1054
+ ){
1055
+ if( $apbct->settings['async_js'] )
1056
+ $tag = str_replace( ' src', ' async="async" src', $tag );
1057
+
1058
+ if( class_exists('Cookiebot_WP') )
1059
+ $tag = str_replace( ' src', ' data-cookieconsent="ignore" src', $tag );
1060
+ }
1061
+
1062
+ return $tag;
1063
  }
inc/cleantalk-find-spam.php CHANGED
@@ -34,7 +34,8 @@ add_action( 'wp_ajax_ajax_delete_all_users', array( '\Cleantalk\ApbctWP\FindSpa
34
  add_action( 'wp_ajax_ajax_clear_comments', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_clear_comments' ) );
35
  add_action( 'wp_ajax_ajax_check_comments', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_check_comments' ) );
36
  add_action( 'wp_ajax_ajax_info_comments', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_info' ) );
37
- add_action( 'wp_ajax_ajax_delete_all', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_delete_all' ) );
 
38
 
39
  // Debug
40
  add_action( 'wp_ajax_ajax_insert_users', array( '\Cleantalk\ApbctWP\FindSpam\UsersChecker', 'ct_ajax_insert_users' ) );
34
  add_action( 'wp_ajax_ajax_clear_comments', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_clear_comments' ) );
35
  add_action( 'wp_ajax_ajax_check_comments', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_check_comments' ) );
36
  add_action( 'wp_ajax_ajax_info_comments', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_info' ) );
37
+ add_action( 'wp_ajax_ajax_trash_all', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_trash_all' ) );
38
+ add_action( 'wp_ajax_ajax_spam_all', array( '\Cleantalk\ApbctWP\FindSpam\CommentsChecker', 'ct_ajax_spam_all' ) );
39
 
40
  // Debug
41
  add_action( 'wp_ajax_ajax_insert_users', array( '\Cleantalk\ApbctWP\FindSpam\UsersChecker', 'ct_ajax_insert_users' ) );
inc/cleantalk-public.php CHANGED
@@ -70,7 +70,7 @@ function apbct_init() {
70
  print "<html><body><form method='$method' action='$action'>";
71
  ct_print_form($_POST, '');
72
  print "</form></body></html>";
73
- print "<script>
74
  if(document.forms[0].submit !== 'undefined'){
75
  var objects = document.getElementsByName('submit');
76
  if(objects.length > 0)
@@ -934,7 +934,7 @@ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false
934
  // Using only cookies
935
  if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
936
 
937
- $html = "<script type='text/javascript'>
938
  function ctSetCookie___from_backend(c_name, value) {
939
  document.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";
940
  }
@@ -951,7 +951,7 @@ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false
951
  $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
952
  $field_id = $field_name . '_' . $field_id_hash;
953
  $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
954
- <script type='text/javascript'>
955
  window.addEventListener('DOMContentLoaded', function () {
956
  setTimeout(function(){
957
  apbct_public_sendAJAX(
@@ -971,7 +971,7 @@ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false
971
  $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
972
  $field_id = $field_name . '_' . $field_id_hash;
973
  $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
974
- <script type='text/javascript'>
975
  setTimeout(function(){
976
  var ct_input_name = '{$field_id}';
977
  if (document.getElementById(ct_input_name) !== null) {
@@ -2531,7 +2531,8 @@ function apbct_form__ninjaForms__changeResponse( $data ) {
2531
  $nf_field_id = $data['fields_by_key']['email']['id'];
2532
  }else{
2533
  // Find ID of last field (usually SUBMIT)
2534
- $nf_field_id = array_pop(array_keys($data['fields']));
 
2535
  }
2536
 
2537
  // Below is modified NJ logic
@@ -3889,7 +3890,7 @@ function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
3889
  if(isset($attrs['text']))
3890
  $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3891
 
3892
- $out = '<script>'.$out.'</script>';
3893
  return $out;
3894
  }
3895
 
70
  print "<html><body><form method='$method' action='$action'>";
71
  ct_print_form($_POST, '');
72
  print "</form></body></html>";
73
+ print "<script " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
74
  if(document.forms[0].submit !== 'undefined'){
75
  var objects = document.getElementsByName('submit');
76
  if(objects.length > 0)
934
  // Using only cookies
935
  if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
936
 
937
+ $html = "<script type='text/javascript' " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
938
  function ctSetCookie___from_backend(c_name, value) {
939
  document.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";
940
  }
951
  $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
952
  $field_id = $field_name . '_' . $field_id_hash;
953
  $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
954
+ <script type='text/javascript' " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
955
  window.addEventListener('DOMContentLoaded', function () {
956
  setTimeout(function(){
957
  apbct_public_sendAJAX(
971
  $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
972
  $field_id = $field_name . '_' . $field_id_hash;
973
  $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
974
+ <script type='text/javascript' " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
975
  setTimeout(function(){
976
  var ct_input_name = '{$field_id}';
977
  if (document.getElementById(ct_input_name) !== null) {
2531
  $nf_field_id = $data['fields_by_key']['email']['id'];
2532
  }else{
2533
  // Find ID of last field (usually SUBMIT)
2534
+ $fields_keys = array_keys($data['fields']);
2535
+ $nf_field_id = array_pop($fields_keys);
2536
  }
2537
 
2538
  // Below is modified NJ logic
3890
  if(isset($attrs['text']))
3891
  $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3892
 
3893
+ $out = '<script ' . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . '>'.$out.'</script>';
3894
  return $out;
3895
  }
3896
 
inc/cleantalk-settings.php CHANGED
@@ -314,9 +314,9 @@ function apbct_settings__set_fileds( $fields ){
314
  'title' => __('Exclusions', 'cleantalk-spam-protect'),
315
  'fields' => array(
316
  'exclusions__urls' => array(
317
- 'type' => 'text',
318
  'title' => __('URL exclusions', 'cleantalk-spam-protect'),
319
- 'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk-spam-protect'),
320
  ),
321
  'exclusions__urls__use_regexp' => array(
322
  'type' => 'checkbox',
@@ -1324,6 +1324,27 @@ function apbct_settings__field__draw($params = array()){
1324
  .$params['description']
1325
  .'</div>';
1326
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1327
  }
1328
 
1329
  echo '</div>';
@@ -1642,8 +1663,17 @@ function apbct_update_blogs_options ($blog_names = array(), $settings) {
1642
  */
1643
  function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
1644
  $result = array();
 
1645
  if( ! empty( $exclusions ) ){
1646
- $exclusions = explode( ',', $exclusions );
 
 
 
 
 
 
 
 
1647
  foreach ( $exclusions as $exclusion ){
1648
  $sanitized_exclusion = trim( $exclusion, " \t\n\r\0\x0B/\/" );
1649
  if ( ! empty( $sanitized_exclusion ) ) {
@@ -1653,7 +1683,18 @@ function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
1653
  }
1654
  }
1655
  }
1656
- return implode( ',', $result );
 
 
 
 
 
 
 
 
 
 
 
1657
  }
1658
 
1659
  function apbct_settings_show_gdpr_text($print = false){
314
  'title' => __('Exclusions', 'cleantalk-spam-protect'),
315
  'fields' => array(
316
  'exclusions__urls' => array(
317
+ 'type' => 'textarea',
318
  'title' => __('URL exclusions', 'cleantalk-spam-protect'),
319
+ 'description' => __('You could type here URL you want to exclude. Use comma or new lines as separator.', 'cleantalk-spam-protect'),
320
  ),
321
  'exclusions__urls__use_regexp' => array(
322
  'type' => 'checkbox',
1324
  .$params['description']
1325
  .'</div>';
1326
  break;
1327
+
1328
+ // Textarea type
1329
+ case 'textarea':
1330
+
1331
+ echo '<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
1332
+ .$params['title']
1333
+ .'</label></br>';
1334
+ echo '<textarea
1335
+ id="apbct_setting_'.$params['name'].'"
1336
+ name="cleantalk_settings['.$params['name'].']"'
1337
+ ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1338
+ .$disabled
1339
+ .($params['required'] ? ' required="required"' : '')
1340
+ .($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
1341
+ .'>'. $value .'</textarea>'
1342
+ . '&nbsp;';
1343
+ echo '<div class="apbct_settings-field_description">'
1344
+ .$params['description']
1345
+ .'</div>';
1346
+ break;
1347
+
1348
  }
1349
 
1350
  echo '</div>';
1663
  */
1664
  function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
1665
  $result = array();
1666
+ $type = 0;
1667
  if( ! empty( $exclusions ) ){
1668
+ if( strpos( $exclusions, "\r\n" ) !== false ) {
1669
+ $exclusions = explode( "\r\n", $exclusions );
1670
+ $type = 2;
1671
+ } elseif( strpos( $exclusions, "\n" ) !== false ) {
1672
+ $exclusions = explode( "\n", $exclusions );
1673
+ $type = 1;
1674
+ } else {
1675
+ $exclusions = explode( ',', $exclusions );
1676
+ }
1677
  foreach ( $exclusions as $exclusion ){
1678
  $sanitized_exclusion = trim( $exclusion, " \t\n\r\0\x0B/\/" );
1679
  if ( ! empty( $sanitized_exclusion ) ) {
1683
  }
1684
  }
1685
  }
1686
+ switch ( $type ) {
1687
+ case 0 :
1688
+ default :
1689
+ return implode( ',', $result );
1690
+ break;
1691
+ case 1 :
1692
+ return implode( "\n", $result );
1693
+ break;
1694
+ case 2 :
1695
+ return implode( "\r\n", $result );
1696
+ break;
1697
+ }
1698
  }
1699
 
1700
  function apbct_settings_show_gdpr_text($print = false){
inc/cleantalk-updater.php CHANGED
@@ -612,4 +612,21 @@ function apbct_update_to_5_146_1() {
612
 
613
  apbct_activation__create_tables( $sqls, $apbct->db_prefix );
614
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
615
  }
612
 
613
  apbct_activation__create_tables( $sqls, $apbct->db_prefix );
614
 
615
+ }
616
+
617
+ function apbct_update_to_5_146_3() {
618
+ update_option( 'cleantalk_plugin_request_ids', array() );
619
+ }
620
+
621
+ function apbct_update_to_5_146_4() {
622
+
623
+ global $apbct;
624
+
625
+ $sqls[] = 'ALTER TABLE `%scleantalk_sfw`
626
+ ADD COLUMN `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
627
+ ADD PRIMARY KEY (`id`);';
628
+
629
+ apbct_activation__create_tables( $sqls, $apbct->db_prefix );
630
+
631
+
632
  }
inc/cleantalk-widget.php CHANGED
@@ -1,120 +1,120 @@
1
- <?php
2
-
3
- // Hooks on widget loads
4
- add_action( 'widgets_init', 'cleantalk_load_widget' );
5
-
6
- /**
7
- * Register and load the widget
8
- */
9
- function cleantalk_load_widget(){
10
- register_widget( 'cleantalk_widget' );
11
- }
12
-
13
- class cleantalk_widget extends WP_Widget
14
- {
15
- function __construct()
16
- {
17
- parent::__construct(
18
- // Base ID of your widget
19
- 'cleantalk_widget',
20
-
21
- // Widget name will appear in UI
22
- __('CleanTalk Widget', 'cleantalk-spam-protect'),
23
-
24
- // Widget description
25
- array( 'description' => __( 'CleanTalk widget', 'cleantalk-spam-protect'), )
26
- );
27
- }
28
-
29
- // Creating widget front-end
30
- // This is where the action happens
31
- public function widget( $args, $instance )
32
- {
33
- global $apbct;
34
-
35
- $instance['title'] = isset( $instance['title'] ) ? $instance['title'] : __( 'Spam blocked', 'cleantalk-spam-protect');
36
- $title = apply_filters( 'widget_title', $instance['title'] );
37
- echo $args['before_widget'];
38
-
39
- // Showing title
40
- if ( ! empty( $title ) ){ echo $args['before_title'] . $title . $args['after_title']; }
41
-
42
- // Parsing incoming params
43
- $blocked = number_format($apbct->data['spam_count'], 0, ',', ' ');
44
-
45
- $a_style = 'cursor: pointer; display: block; padding: 5px 0 5px; text-align: center; text-decoration: none; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; font-weight: normal; height: 100%; width: 100%; ';
46
- $strong_style = 'display: block; font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap; ';
47
-
48
- if(!isset($instance['style'])){
49
- $instance['style'] = 'cleantalk';
50
- }
51
-
52
- switch($instance['style']){
53
- case 'cleantalk':
54
- $a_style .= 'background: #3090C7; background-image: -moz-linear-gradient(0% 100% 90deg,#2060a7,#3090C7); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#3090C7),to(#2060A7)); border: 1px solid #33eeee; color: #AFCA63;';
55
- $strong_style .= 'color: #FFF;';
56
- break;
57
- case 'light':
58
- $a_style .= 'background: #fafafa; background-image: -moz-linear-gradient(0% 100% 90deg,#ddd,#fff); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#fff),to(#ddd)); border: 1px solid #ddd; color: #000;';
59
- $strong_style .= 'color: #000;';
60
- break;
61
- case 'ex_light':
62
- $a_style .= 'background: #fff; border: 1px solid #ddd; color: #777;';
63
- $strong_style .= 'color: #555;';
64
- break;
65
- case 'dark':
66
- $a_style .= 'background: #333; background-image: -moz-linear-gradient(0% 100% 90deg,#555,#000); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#000),to(#555)); border: 1px solid #999; color: #fff;';
67
- $strong_style .= 'color: #FFF;';
68
- break;
69
- }
70
-
71
- // This is where you run the code and display the output
72
- echo '<div style="width:auto;">'
73
- .'<a href="https://cleantalk.org'.(!empty($instance['refid']) ? '?pid='.$instance['refid'] : '').'" target="_blank" title="'.__('CleanTalk\'s main page', 'cleantalk-spam-protect').'" style="'.$a_style.'">'
74
- .'<strong style="'.$strong_style.'"><b>'.$blocked.'</b> '.__('spam', 'cleantalk-spam-protect').'</strong> '.__('blocked by', 'cleantalk-spam-protect').' <strong>CleanTalk</strong>'
75
- .'</a>'
76
- .'</div>';
77
-
78
- echo $args['after_widget'];
79
- }
80
-
81
- // Widget Backend
82
- public function form( $instance )
83
- {
84
- // Widget admin form
85
-
86
- $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : $title = __( 'Spam blocked', 'cleantalk-spam-protect');
87
- $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : $style = 'ct_style';
88
- $refid = isset( $instance[ 'refid' ] ) ? $instance[ 'refid' ] : $refid = '';
89
- // Title field
90
- echo '<p>'
91
- .'<label for="' . $this->get_field_id( 'title' ) . '">' . __( 'Title:', 'cleantalk-spam-protect') . '</label>'
92
- .'<input class="widefat" id="'.$this->get_field_id( 'title' ).'" name="'.$this->get_field_name( 'title' ).'" type="text" value="'.esc_attr( $title ).'" />'
93
- .'</p>';
94
- // Style
95
- echo '<p>'
96
- .'<label for="' . $this->get_field_id( 'style' ) . '">' . __( 'Style:', 'cleantalk-spam-protect') . '</label>'
97
- .'<select id="'.$this->get_field_id( 'style' ).'" class="widefat" name="'.$this->get_field_name( 'style' ).'">'
98
- .'<option '.($style == 'cleantalk' ? 'selected' : '').' value="cleantalk">'.__('CleanTalk\'s Style', 'cleantalk-spam-protect').'</option>'
99
- .'<option '.($style == 'light' ? 'selected' : '').' value="light">'.__('Light', 'cleantalk-spam-protect').'</option>'
100
- .'<option '.($style == 'ex_light' ? 'selected' : '').' value="ex_light">'.__('Extremely Light', 'cleantalk-spam-protect').'</option>'
101
- .'<option '.($style == 'dark' ? 'selected' : '').' value="dark">'.__('Dark', 'cleantalk-spam-protect').'</option>'
102
- .'</select>'
103
- .'</p>';
104
- // Ref ID
105
- echo '<p>'
106
- .'<label for="' . $this->get_field_id( 'refid' ) . '">' . __( 'Referal link ID:', 'cleantalk-spam-protect') . '</label>'
107
- .'<input class="widefat" id="'.$this->get_field_id( 'refid' ).'" name="'.$this->get_field_name( 'refid' ).'" type="text" value="'.$refid.'" />'
108
- .'</p>';
109
- }
110
-
111
- // Updating widget replacing old instances with new
112
- public function update( $new_instance, $old_instance )
113
- {
114
- $instance = array();
115
- $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
116
- $instance['style'] = ( ! empty( $new_instance['style'] ) ) ? strip_tags( $new_instance['style'] ) : '';
117
- $instance['refid'] = ( ! empty( $new_instance['refid'] ) ) ? strip_tags( $new_instance['refid'] ) : '';
118
- return $instance;
119
- }
120
  }
1
+ <?php
2
+
3
+ // Hooks on widget loads
4
+ add_action( 'widgets_init', 'cleantalk_load_widget' );
5
+
6
+ /**
7
+ * Register and load the widget
8
+ */
9
+ function cleantalk_load_widget(){
10
+ register_widget( 'cleantalk_widget' );
11
+ }
12
+
13
+ class cleantalk_widget extends WP_Widget
14
+ {
15
+ function __construct()
16
+ {
17
+ parent::__construct(
18
+ // Base ID of your widget
19
+ 'cleantalk_widget',
20
+
21
+ // Widget name will appear in UI
22
+ __('CleanTalk Widget', 'cleantalk-spam-protect'),
23
+
24
+ // Widget description
25
+ array( 'description' => __( 'CleanTalk widget', 'cleantalk-spam-protect'), )
26
+ );
27
+ }
28
+
29
+ // Creating widget front-end
30
+ // This is where the action happens
31
+ public function widget( $args, $instance )
32
+ {
33
+ global $apbct;
34
+
35
+ $instance['title'] = isset( $instance['title'] ) ? $instance['title'] : __( 'Spam blocked', 'cleantalk-spam-protect');
36
+ $title = apply_filters( 'widget_title', $instance['title'] );
37
+ echo $args['before_widget'];
38
+
39
+ // Showing title
40
+ if ( ! empty( $title ) ){ echo $args['before_title'] . $title . $args['after_title']; }
41
+
42
+ // Parsing incoming params
43
+ $blocked = number_format($apbct->data['spam_count'], 0, ',', ' ');
44
+
45
+ $a_style = 'cursor: pointer; display: block; padding: 5px 0 5px; text-align: center; text-decoration: none; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; font-weight: normal; height: 100%; width: 100%; ';
46
+ $strong_style = 'display: block; font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap; ';
47
+
48
+ if(!isset($instance['style'])){
49
+ $instance['style'] = 'cleantalk';
50
+ }
51
+
52
+ switch($instance['style']){
53
+ case 'cleantalk':
54
+ $a_style .= 'background: #3090C7; background-image: -moz-linear-gradient(0% 100% 90deg,#2060a7,#3090C7); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#3090C7),to(#2060A7)); border: 1px solid #33eeee; color: #AFCA63;';
55
+ $strong_style .= 'color: #FFF;';
56
+ break;
57
+ case 'light':
58
+ $a_style .= 'background: #fafafa; background-image: -moz-linear-gradient(0% 100% 90deg,#ddd,#fff); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#fff),to(#ddd)); border: 1px solid #ddd; color: #000;';
59
+ $strong_style .= 'color: #000;';
60
+ break;
61
+ case 'ex_light':
62
+ $a_style .= 'background: #fff; border: 1px solid #ddd; color: #777;';
63
+ $strong_style .= 'color: #555;';
64
+ break;
65
+ case 'dark':
66
+ $a_style .= 'background: #333; background-image: -moz-linear-gradient(0% 100% 90deg,#555,#000); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#000),to(#555)); border: 1px solid #999; color: #fff;';
67
+ $strong_style .= 'color: #FFF;';
68
+ break;
69
+ }
70
+
71
+ // This is where you run the code and display the output
72
+ echo '<div style="width:auto;">'
73
+ .'<a href="https://cleantalk.org'.(!empty($instance['refid']) ? '?pid='.$instance['refid'] : '').'" target="_blank" title="'.__('CleanTalk\'s main page', 'cleantalk-spam-protect').'" style="'.$a_style.'">'
74
+ .'<strong style="'.$strong_style.'"><b>'.$blocked.'</b> '.__('spam', 'cleantalk-spam-protect').'</strong> '.__('blocked by', 'cleantalk-spam-protect').' <strong>CleanTalk</strong>'
75
+ .'</a>'
76
+ .'</div>';
77
+
78
+ echo $args['after_widget'];
79
+ }
80
+
81
+ // Widget Backend
82
+ public function form( $instance )
83
+ {
84
+ // Widget admin form
85
+
86
+ $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : $title = __( 'Spam blocked', 'cleantalk-spam-protect');
87
+ $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : $style = 'ct_style';
88
+ $refid = isset( $instance[ 'refid' ] ) ? $instance[ 'refid' ] : $refid = '';
89
+ // Title field
90
+ echo '<p>'
91
+ .'<label for="' . $this->get_field_id( 'title' ) . '">' . __( 'Title:', 'cleantalk-spam-protect') . '</label>'
92
+ .'<input class="widefat" id="'.$this->get_field_id( 'title' ).'" name="'.$this->get_field_name( 'title' ).'" type="text" value="'.esc_attr( $title ).'" />'
93
+ .'</p>';
94
+ // Style
95
+ echo '<p>'
96
+ .'<label for="' . $this->get_field_id( 'style' ) . '">' . __( 'Style:', 'cleantalk-spam-protect') . '</label>'
97
+ .'<select id="'.$this->get_field_id( 'style' ).'" class="widefat" name="'.$this->get_field_name( 'style' ).'">'
98
+ .'<option '.($style == 'cleantalk' ? 'selected' : '').' value="cleantalk">'.__('CleanTalk\'s Style', 'cleantalk-spam-protect').'</option>'
99
+ .'<option '.($style == 'light' ? 'selected' : '').' value="light">'.__('Light', 'cleantalk-spam-protect').'</option>'
100
+ .'<option '.($style == 'ex_light' ? 'selected' : '').' value="ex_light">'.__('Extremely Light', 'cleantalk-spam-protect').'</option>'
101
+ .'<option '.($style == 'dark' ? 'selected' : '').' value="dark">'.__('Dark', 'cleantalk-spam-protect').'</option>'
102
+ .'</select>'
103
+ .'</p>';
104
+ // Ref ID
105
+ echo '<p>'
106
+ .'<label for="' . $this->get_field_id( 'refid' ) . '">' . __( 'Referal link ID:', 'cleantalk-spam-protect') . '</label>'
107
+ .'<input class="widefat" id="'.$this->get_field_id( 'refid' ).'" name="'.$this->get_field_name( 'refid' ).'" type="text" value="'.$refid.'" />'
108
+ .'</p>';
109
+ }
110
+
111
+ // Updating widget replacing old instances with new
112
+ public function update( $new_instance, $old_instance )
113
+ {
114
+ $instance = array();
115
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
116
+ $instance['style'] = ( ! empty( $new_instance['style'] ) ) ? strip_tags( $new_instance['style'] ) : '';
117
+ $instance['refid'] = ( ! empty( $new_instance['refid'] ) ) ? strip_tags( $new_instance['refid'] ) : '';
118
+ return $instance;
119
+ }
120
  }
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ctSetCookie(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/; samesite=lax"}function apbct_collect_visible_fields_and_set_cookie(e){var t=[],o="",n=0,i=[];for(var a in e.elements)isNaN(+a)||(t[a]=e.elements[a]);(t=t.filter(function(e){return"none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&""!==e.value&&null!==e.getAttribute("name")&&-1===i.indexOf(e.getAttribute("name"))&&(n++,-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(i.push(e.getAttribute("name")),!1))})).forEach(function(e,t,n){o+=" "+e.getAttribute("name")}),ctSetCookie("apbct_visible_fields",o=o.trim()),ctSetCookie("apbct_visible_fields_count",n)}function apbct_js_keys__set_input_value(e,t,n,o){var i;null!==document.getElementById(n.input_name)&&(i=document.getElementById(n.input_name).value,document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key))}function apbct_public_sendAJAX(t,n,o){var i=n.callback||null,a=n.callback_context||null,c=n.callback_params||null,e=n.async||!0,l=n.notJson||null,s=n.timeout||15e3,o=o||null,r=n.button||null,u=n.spinner||null,p=n.progressbar||null,d=n.silent||null,m=n.no_nonce||null;"string"==typeof t?(m||(t=t+"&_ajax_nonce="+ctPublic._ajax_nonce),t=t+"&no_cache="+Math.random()):(m||(t._ajax_nonce=ctPublic._ajax_nonce),t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),l||(e=JSON.parse(e)),e.error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):i&&(c?i.apply(a,c.concat(e,t,n,o)):i(e,t,n,o))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),n&&!d&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"),alert("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:s})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function c(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookie("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookie("ct_fkp_timestamp","0"),ctSetCookie("ct_pointer_data","0"),ctSetCookie("ct_timezone","0"),setTimeout(function(){ctSetCookie("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var l=function(){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),c(window,"mousedown",l),c(window,"keydown",l)},s=setInterval(function(){n=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(c(window,"mousemove",u),clearInterval(s),clearInterval(r)))};a(window,"mousemove",u),a(window,"mousedown",l),a(window,"keydown",l),a(window,"DOMContentLoaded",function(){ctSetCookie("apbct_visible_fields",0),ctSetCookie("apbct_visible_fields_count",0),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t=document.forms[e];t.classList.contains("slp_search_form")||t.parentElement.classList.contains("mec-booking")||-1!==t.action.toString().indexOf("activehosted.com")||t.id&&"caspioform"==t.id||(t.onsubmit_prev=t.onsubmit,t.onsubmit=function(e){apbct_collect_visible_fields_and_set_cookie(this),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,n){var o;!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&(alert(o.comment),1==+o.stop_script&&window.stop())});
2
- //# sourceMappingURL=apbct-public.min.js.map
1
+ function ctSetCookie(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/; samesite=lax"}function apbct_collect_visible_fields(e){var t=[],o="",n=0,i=[];for(var a in e.elements)isNaN(+a)||(t[a]=e.elements[a]);return(t=t.filter(function(e){return"none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&-1===i.indexOf(e.getAttribute("name"))&&(n++,-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(i.push(e.getAttribute("name")),!1))})).forEach(function(e,t,n){o+=" "+e.getAttribute("name")}),{visible_fields:o=o.trim(),visible_fields_count:n}}function apbct_visible_fields_set_cookie(e){var t="object"==typeof e&&null!==e?e:{};ctSetCookie("apbct_visible_fields",JSON.stringify(t))}function apbct_js_keys__set_input_value(e,t,n,o){var i;null!==document.getElementById(n.input_name)&&(i=document.getElementById(n.input_name).value,document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key))}function apbct_public_sendAJAX(t,n,o){var i=n.callback||null,a=n.callback_context||null,c=n.callback_params||null,e=n.async||!0,l=n.notJson||null,s=n.timeout||15e3,o=o||null,r=n.button||null,u=n.spinner||null,p=n.progressbar||null,d=n.silent||null,m=n.no_nonce||null;"string"==typeof t?(m||(t=t+"&_ajax_nonce="+ctPublic._ajax_nonce),t=t+"&no_cache="+Math.random()):(m||(t._ajax_nonce=ctPublic._ajax_nonce),t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),l||(e=JSON.parse(e)),e.error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):i&&(c?i.apply(a,c.concat(e,t,n,o)):i(e,t,n,o))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),n&&!d&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"),alert("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:s})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function c(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookie("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookie("ct_fkp_timestamp","0"),ctSetCookie("ct_pointer_data","0"),ctSetCookie("ct_timezone","0"),setTimeout(function(){ctSetCookie("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var l=function(){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),c(window,"mousedown",l),c(window,"keydown",l)},s=setInterval(function(){n=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(c(window,"mousemove",u),clearInterval(s),clearInterval(r)))};a(window,"mousemove",u),a(window,"mousedown",l),a(window,"keydown",l),a(window,"DOMContentLoaded",function(){ctSetCookie("apbct_visible_fields",0),setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var n=document.forms[t];n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"==n.id||(e[t]=apbct_collect_visible_fields(n),n.onsubmit_prev=n.onsubmit,n.onsubmit=function(e){visible_fields[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(visible_fields),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,n){var o;!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(o=JSON.parse(t.responseText)).apbct&&(o=o.apbct).blocked&&(alert(o.comment),1==+o.stop_script&&window.stop())});
2
+ //# sourceMappingURL=apbct-public.min.js.map
js/apbct-public.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\r\n\r\n\tvar ct_date = new Date(),\r\n\t\tctTimeMs = new Date().getTime(),\r\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\t\tctMouseData = [],\r\n\t\tctMouseDataCounter = 0;\r\n\r\n\tfunction apbct_attach_event_handler(elem, event, callback){\r\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\t\telse elem.attachEvent(event, callback);\r\n\t}\r\n\r\n\tfunction apbct_remove_event_handler(elem, event, callback){\r\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\t\telse elem.detachEvent(event, callback);\r\n\t}\r\n\r\n\tctSetCookie(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\n\tctSetCookie(\"ct_fkp_timestamp\", \"0\");\r\n\tctSetCookie(\"ct_pointer_data\", \"0\");\r\n\tctSetCookie(\"ct_timezone\", \"0\");\r\n\r\n\tsetTimeout(function(){\r\n\t\tctSetCookie(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n\t},1000);\r\n\r\n\t//Writing first key press timestamp\r\n\tvar ctFunctionFirstKey = function output(event){\r\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\t\tctKeyStopStopListening();\r\n\t};\r\n\r\n\t//Reading interval\r\n\tvar ctMouseReadInterval = setInterval(function(){\r\n\t\tctMouseEventTimerFlag = true;\r\n\t}, 150);\r\n\r\n\t//Writting interval\r\n\tvar ctMouseWriteDataInterval = setInterval(function(){\r\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n\t}, 1200);\r\n\r\n\t//Logging mouse position each 150 ms\r\n\tvar ctFunctionMouseMove = function output(event){\r\n\t\tif(ctMouseEventTimerFlag === true){\r\n\r\n\t\t\tctMouseData.push([\r\n\t\t\t\tMath.round(event.clientY),\r\n\t\t\t\tMath.round(event.clientX),\r\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t\t]);\r\n\r\n\t\t\tctMouseDataCounter++;\r\n\t\t\tctMouseEventTimerFlag = false;\r\n\t\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\t\tctMouseStopData();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//Stop mouse observing function\r\n\tfunction ctMouseStopData(){\r\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\t\tclearInterval(ctMouseReadInterval);\r\n\t\tclearInterval(ctMouseWriteDataInterval);\r\n\t}\r\n\r\n\t//Stop key listening function\r\n\tfunction ctKeyStopStopListening(){\r\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\t}\r\n\r\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n\t// Ready function\r\n\tfunction apbct_ready(){\r\n\r\n\t\tctSetCookie(\"apbct_visible_fields\", 0);\r\n\t\tctSetCookie(\"apbct_visible_fields_count\", 0);\r\n\r\n\t\tsetTimeout(function(){\r\n\r\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\t\t//Exclusion for forms\r\n\t\t\t\tif (\r\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\r\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\r\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\r\n\t\t\t\t\t(form.id && form.id == 'caspioform') //Caspio Form\r\n\t\t\t\t)\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\t\tform.onsubmit = function (event) {\r\n\r\n\t\t\t\t\tapbct_collect_visible_fields_and_set_cookie(this);\r\n\r\n\t\t\t\t\t// Call previous submit action\r\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n}());\r\n\r\nfunction ctSetCookie(c_name, value) {\r\n\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";\r\n}\r\n\r\nfunction apbct_collect_visible_fields_and_set_cookie(form ) {\r\n\r\n\t// Get only fields\r\n\tvar inputs = [],\r\n\t\tinputs_visible = '',\r\n\t\tinputs_visible_count = 0,\r\n\t\tinputs_with_duplicate_names = [];\r\n\r\n\tfor(var key in form.elements){\r\n\t\tif(!isNaN(+key))\r\n\t\t\tinputs[key] = form.elements[key];\r\n\t}\r\n\r\n\t// Filter fields\r\n\tinputs = inputs.filter(function(elem){\r\n\r\n\t\t// Filter fields\r\n\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\telem.value === \"\" || // empty value\r\n\t\t\telem.getAttribute('name') === null ||\r\n\t\t\tinputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added\r\n\t\t){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// Visible fields count\r\n\t\tinputs_visible_count++;\r\n\r\n\t\t// Filter inputs with same names for type == radio\r\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\r\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t});\r\n\r\n\t// Visible fields\r\n\tinputs.forEach(function(elem, i, elements){\r\n\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\r\n\t});\r\n\tinputs_visible = inputs_visible.trim();\r\n\r\n\tctSetCookie(\"apbct_visible_fields\", inputs_visible);\r\n\tctSetCookie(\"apbct_visible_fields_count\", inputs_visible_count);\r\n\r\n}\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\nfunction apbct_public_sendAJAX(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar callback_context = params.callback_context || null;\r\n\tvar callback_params = params.callback_params || null;\r\n\tvar async = params.async || true;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\tvar button = params.button || null;\r\n\tvar spinner = params.spinner || null;\r\n\tvar progressbar = params.progressbar || null;\r\n\tvar silent = params.silent || null;\r\n\tvar no_nonce = params.no_nonce || null;\r\n\r\n\tif(typeof (data) === 'string') {\r\n\t\tif( ! no_nonce )\r\n\t\t\tdata = data + '&_ajax_nonce=' + ctPublic._ajax_nonce;\r\n\t\tdata = data + '&no_cache=' + Math.random()\r\n\t} else {\r\n\t\tif( ! no_nonce )\r\n\t\t\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\t\tdata.no_cache = Math.random();\r\n\t}\r\n\t// Button and spinner\r\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\r\n\tif(spinner) jQuery(spinner).css('display', 'inline');\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tasync: async,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\r\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\r\n\t\t\t}else{\r\n\t\t\t\tif(callback) {\r\n\t\t\t\t\tif (callback_params)\r\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tif( errorThrown && ! silent ) {\r\n\t\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\t\tconsole.log(jqXHR);\r\n\t\t\t\tconsole.log(textStatus);\r\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\r\n\t\t\t\talert('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\r\n\t\t\t}\r\n\t\t},\r\n\t\ttimeout: timeout,\r\n\t});\r\n}\r\nif(typeof jQuery !== 'undefined') {\r\n\r\n\t// Capturing responses and output block message for unknown AJAX forms\r\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\r\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\r\n\t\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\t\tif (typeof response.apbct !== 'undefined') {\r\n\t\t\t\tresponse = response.apbct;\r\n\t\t\t\tif (response.blocked) {\r\n\t\t\t\t\talert(response.comment);\r\n\t\t\t\t\tif(+response.stop_script == 1)\r\n\t\t\t\t\t\twindow.stop();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}"],"names":["ctSetCookie","c_name","value","document","cookie","encodeURIComponent","apbct_collect_visible_fields_and_set_cookie","form","inputs","inputs_visible","inputs_visible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","getComputedStyle","display","visibility","opacity","getAttribute","indexOf","push","forEach","i","trim","apbct_js_keys__set_input_value","result","data","params","obj","ct_input_value","getElementById","input_name","replace","js_key","apbct_public_sendAJAX","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","silent","no_nonce","ctPublic","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","apbct_attach_event_handler","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","floor","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","stringify","ctFunctionMouseMove","round","clientY","clientX","clearInterval","forms","length","classList","contains","parentElement","action","toString","id","onsubmit_prev","onsubmit","this","target","Function","call","ajaxComplete","xhr","settings","response","responseText","apbct","blocked","comment","stop_script","stop"],"mappings":"AAsHA,SAASA,YAAYC,EAAQC,GAC5BC,SAASC,OAASH,EAAS,IAAMI,mBAAmBH,GAAS,yBAG9D,SAASI,4CAA4CC,GAGpD,IAAIC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAA8B,GAE/B,IAAI,IAAIC,KAAOL,EAAKM,SACfC,OAAOF,KACVJ,EAAOI,GAAOL,EAAKM,SAASD,KAI9BJ,EAASA,EAAOO,OAAO,SAASC,GAG/B,MAA0C,SAAtCC,iBAAiBD,GAAME,SACY,WAAtCD,iBAAiBD,GAAMG,YACe,MAAtCF,iBAAiBD,GAAMI,SACe,WAAtCJ,EAAKK,aAAa,SACoB,WAAtCL,EAAKK,aAAa,SACoB,KAAtCL,EAAKd,OACiC,OAAtCc,EAAKK,aAAa,UACoD,IAAtEV,EAA4BW,QAASN,EAAKK,aAAa,WAMxDX,KAGK,IAAM,CAAC,QAAS,YAAYY,QAASN,EAAKK,aAAa,WAC3DV,EAA4BY,KAAMP,EAAKK,aAAa,UAC7C,OAOFG,QAAQ,SAASR,EAAMS,EAAGZ,GAChCJ,GAAkB,IAAMO,EAAKK,aAAa,UAI3CrB,YAAY,uBAFZS,EAAiBA,EAAeiB,QAGhC1B,YAAY,6BAA8BU,GAI3C,SAASiB,+BAA+BC,EAAQC,EAAMC,EAAQC,GAC7D,IACKC,EAD8C,OAA/C7B,SAAS8B,eAAeH,EAAOI,cAC9BF,EAAiB7B,SAAS8B,eAAeH,EAAOI,YAAYhC,MAChEC,SAAS8B,eAAeH,EAAOI,YAAYhC,MAAQC,SAAS8B,eAAeH,EAAOI,YAAYhC,MAAMiC,QAAQH,EAAgBJ,EAAOQ,SAGrI,SAASC,sBAAsBR,EAAMC,EAAQC,GAG5C,IAAIO,EAAcR,EAAOQ,UAAe,KACpCC,EAAmBT,EAAOS,kBAAoB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EAA2BE,OAAQ,UAAWQ,GAqC9CV,EAA2BE,OAAQ,mBAlCnC,WAECvF,YAAY,uBAAwB,GACpCA,YAAY,6BAA8B,GAE1CoE,WAAW,WAEV,IAAI,IAAI3C,EAAI,EAAGA,EAAItB,SAASsG,MAAMC,OAAQjF,IAAI,CAC7C,IAAIlB,EAAOJ,SAASsG,MAAMhF,GAIzBlB,EAAKoG,UAAUC,SAAS,oBACxBrG,EAAKsG,cAAcF,UAAUC,SAAS,iBACkB,IAAxDrG,EAAKuG,OAAOC,WAAWzF,QAAQ,qBAC9Bf,EAAKyG,IAAiB,cAAXzG,EAAKyG,KAIlBzG,EAAK0G,cAAgB1G,EAAK2G,SAC1B3G,EAAK2G,SAAW,SAAU5B,GAEzBhF,4CAA4C6G,MAGxC7B,EAAM8B,OAAOH,yBAAyBI,UACzCjD,WAAW,WACVkB,EAAM8B,OAAOH,cAAcK,KAAKhC,EAAM8B,OAAQ9B,IAC5C,SAIJ,OAhHL,GAoPqB,oBAAX7B,QAGTA,OAAOtD,UAAUoH,aAAa,SAAUjC,EAAOkC,EAAKC,GACnD,IACKC,GADDF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAarG,QAAQ,gBAElB,KAD1BoG,EAAWzD,KAAKC,MAAMsD,EAAIG,eACVC,QACnBF,EAAWA,EAASE,OACPC,UACZvD,MAAMoD,EAASI,SACa,IAAxBJ,EAASK,aACZxC,OAAOyC"}
1
+ {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\r\n\r\n\tvar ct_date = new Date(),\r\n\t\tctTimeMs = new Date().getTime(),\r\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\r\n\t\tctMouseData = [],\r\n\t\tctMouseDataCounter = 0;\r\n\r\n\tfunction apbct_attach_event_handler(elem, event, callback){\r\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\r\n\t\telse elem.attachEvent(event, callback);\r\n\t}\r\n\r\n\tfunction apbct_remove_event_handler(elem, event, callback){\r\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\r\n\t\telse elem.detachEvent(event, callback);\r\n\t}\r\n\r\n\tctSetCookie(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\r\n\tctSetCookie(\"ct_fkp_timestamp\", \"0\");\r\n\tctSetCookie(\"ct_pointer_data\", \"0\");\r\n\tctSetCookie(\"ct_timezone\", \"0\");\r\n\r\n\tsetTimeout(function(){\r\n\t\tctSetCookie(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\r\n\t},1000);\r\n\r\n\t//Writing first key press timestamp\r\n\tvar ctFunctionFirstKey = function output(event){\r\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\r\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\r\n\t\tctKeyStopStopListening();\r\n\t};\r\n\r\n\t//Reading interval\r\n\tvar ctMouseReadInterval = setInterval(function(){\r\n\t\tctMouseEventTimerFlag = true;\r\n\t}, 150);\r\n\r\n\t//Writting interval\r\n\tvar ctMouseWriteDataInterval = setInterval(function(){\r\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\r\n\t}, 1200);\r\n\r\n\t//Logging mouse position each 150 ms\r\n\tvar ctFunctionMouseMove = function output(event){\r\n\t\tif(ctMouseEventTimerFlag === true){\r\n\r\n\t\t\tctMouseData.push([\r\n\t\t\t\tMath.round(event.clientY),\r\n\t\t\t\tMath.round(event.clientX),\r\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\r\n\t\t\t]);\r\n\r\n\t\t\tctMouseDataCounter++;\r\n\t\t\tctMouseEventTimerFlag = false;\r\n\t\t\tif(ctMouseDataCounter >= 50){\r\n\t\t\t\tctMouseStopData();\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t//Stop mouse observing function\r\n\tfunction ctMouseStopData(){\r\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\t\tclearInterval(ctMouseReadInterval);\r\n\t\tclearInterval(ctMouseWriteDataInterval);\r\n\t}\r\n\r\n\t//Stop key listening function\r\n\tfunction ctKeyStopStopListening(){\r\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\t}\r\n\r\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\r\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\r\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\r\n\r\n\t// Ready function\r\n\tfunction apbct_ready(){\r\n\r\n\t\tctSetCookie(\"apbct_visible_fields\", 0);\r\n\r\n\t\tsetTimeout(function(){\r\n\r\n\t\t\tvar visible_fields_collection = {};\r\n\r\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\r\n\t\t\t\tvar form = document.forms[i];\r\n\r\n\t\t\t\t//Exclusion for forms\r\n\t\t\t\tif (\r\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\r\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\r\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\r\n\t\t\t\t\t(form.id && form.id == 'caspioform') //Caspio Form\r\n\t\t\t\t)\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\r\n\r\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\r\n\t\t\t\tform.onsubmit = function (event) {\r\n\r\n\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\r\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields );\r\n\r\n\t\t\t\t\t// Call previous submit action\r\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\r\n\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\r\n\r\n\t\t}, 1000);\r\n\t}\r\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\r\n\r\n}());\r\n\r\nfunction ctSetCookie(c_name, value) {\r\n\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";\r\n}\r\n\r\nfunction apbct_collect_visible_fields( form ) {\r\n\r\n\t// Get only fields\r\n\tvar inputs = [],\r\n\t\tinputs_visible = '',\r\n\t\tinputs_visible_count = 0,\r\n\t\tinputs_with_duplicate_names = [];\r\n\r\n\tfor(var key in form.elements){\r\n\t\tif(!isNaN(+key))\r\n\t\t\tinputs[key] = form.elements[key];\r\n\t}\r\n\r\n\t// Filter fields\r\n\tinputs = inputs.filter(function(elem){\r\n\r\n\t\t// Filter fields\r\n\t\tif( getComputedStyle(elem).display === \"none\" || // hidden\r\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\r\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\r\n\t\t\telem.getAttribute(\"type\") === \"hidden\" || // type == hidden\r\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\r\n\t\t\t//elem.value === \"\" || // empty value\r\n\t\t\telem.getAttribute('name') === null ||\r\n\t\t\tinputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added\r\n\t\t){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// Visible fields count\r\n\t\tinputs_visible_count++;\r\n\r\n\t\t// Filter inputs with same names for type == radio\r\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\r\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t});\r\n\r\n\t// Visible fields\r\n\tinputs.forEach(function(elem, i, elements){\r\n\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\r\n\t});\r\n\tinputs_visible = inputs_visible.trim();\r\n\r\n\treturn {\r\n\t\tvisible_fields : inputs_visible,\r\n\t\tvisible_fields_count : inputs_visible_count,\r\n\t}\r\n\r\n}\r\n\r\nfunction apbct_visible_fields_set_cookie( visible_fields_collection ) {\r\n\r\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\r\n\r\n\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\r\n\r\n}\r\n\r\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\r\n\tif (document.getElementById(params.input_name) !== null) {\r\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\r\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\r\n\t}\r\n}\r\nfunction apbct_public_sendAJAX(data, params, obj){\r\n\r\n\t// Default params\r\n\tvar callback = params.callback || null;\r\n\tvar callback_context = params.callback_context || null;\r\n\tvar callback_params = params.callback_params || null;\r\n\tvar async = params.async || true;\r\n\tvar notJson = params.notJson || null;\r\n\tvar timeout = params.timeout || 15000;\r\n\tvar obj = obj || null;\r\n\tvar button = params.button || null;\r\n\tvar spinner = params.spinner || null;\r\n\tvar progressbar = params.progressbar || null;\r\n\tvar silent = params.silent || null;\r\n\tvar no_nonce = params.no_nonce || null;\r\n\r\n\tif(typeof (data) === 'string') {\r\n\t\tif( ! no_nonce )\r\n\t\t\tdata = data + '&_ajax_nonce=' + ctPublic._ajax_nonce;\r\n\t\tdata = data + '&no_cache=' + Math.random()\r\n\t} else {\r\n\t\tif( ! no_nonce )\r\n\t\t\tdata._ajax_nonce = ctPublic._ajax_nonce;\r\n\t\tdata.no_cache = Math.random();\r\n\t}\r\n\t// Button and spinner\r\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\r\n\tif(spinner) jQuery(spinner).css('display', 'inline');\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ctPublic._ajax_url,\r\n\t\tdata: data,\r\n\t\tasync: async,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tif(!notJson) result = JSON.parse(result);\r\n\t\t\tif(result.error){\r\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\r\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\r\n\t\t\t}else{\r\n\t\t\t\tif(callback) {\r\n\t\t\t\t\tif (callback_params)\r\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tcallback(result, data, params, obj);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown){\r\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\r\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\r\n\t\t\tif( errorThrown && ! silent ) {\r\n\t\t\t\tconsole.log('APBCT_AJAX_ERROR');\r\n\t\t\t\tconsole.log(jqXHR);\r\n\t\t\t\tconsole.log(textStatus);\r\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\r\n\t\t\t\talert('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\r\n\t\t\t}\r\n\t\t},\r\n\t\ttimeout: timeout,\r\n\t});\r\n}\r\nif(typeof jQuery !== 'undefined') {\r\n\r\n\t// Capturing responses and output block message for unknown AJAX forms\r\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\r\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\r\n\t\t\tvar response = JSON.parse(xhr.responseText);\r\n\t\t\tif (typeof response.apbct !== 'undefined') {\r\n\t\t\t\tresponse = response.apbct;\r\n\t\t\t\tif (response.blocked) {\r\n\t\t\t\t\talert(response.comment);\r\n\t\t\t\t\tif(+response.stop_script == 1)\r\n\t\t\t\t\t\twindow.stop();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}"],"names":["ctSetCookie","c_name","value","document","cookie","encodeURIComponent","apbct_collect_visible_fields","form","inputs","inputs_visible","inputs_visible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","getComputedStyle","display","visibility","opacity","getAttribute","indexOf","push","forEach","i","visible_fields","trim","visible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","collection","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","ct_input_value","getElementById","input_name","replace","js_key","apbct_public_sendAJAX","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","silent","no_nonce","ctPublic","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","removeAttribute","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","apbct_attach_event_handler","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","floor","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","forms","length","classList","contains","parentElement","action","toString","id","onsubmit_prev","onsubmit","this","target","Function","call","ajaxComplete","xhr","settings","response","responseText","apbct","blocked","comment","stop_script","stop"],"mappings":"AA6HA,SAASA,YAAYC,EAAQC,GAC5BC,SAASC,OAASH,EAAS,IAAMI,mBAAmBH,GAAS,yBAG9D,SAASI,6BA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WAIV,IAFA,IAAI5C,EAA4B,GAExBL,EAAI,EAAGA,EAAItB,SAAS2G,MAAMC,OAAQtF,IAAI,CAC7C,IAAIlB,EAAOJ,SAAS2G,MAAMrF,GAIzBlB,EAAKyG,UAAUC,SAAS,oBACxB1G,EAAK2G,cAAcF,UAAUC,SAAS,iBACkB,IAAxD1G,EAAK4G,OAAOC,WAAW9F,QAAQ,qBAC9Bf,EAAK8G,IAAiB,cAAX9G,EAAK8G,KAIlBvF,EAA0BL,GAAKnB,6BAA8BC,GAE7DA,EAAK+G,cAAgB/G,EAAKgH,SAC1BhH,EAAKgH,SAAW,SAAU3B,GAEzBlE,eAAe,GAAKpB,6BAA6BkH,MACjD3F,gCAAiCH,gBAG7BkE,EAAM6B,OAAOH,yBAAyBI,UACzChD,WAAW,WACVkB,EAAM6B,OAAOH,cAAcK,KAAK/B,EAAM6B,OAAQ7B,IAC5C,OAKN/D,gCAAiCC,IAE/B,OAvHL,GAqQqB,oBAAXkC,QAGTA,OAAO7D,UAAUyH,aAAa,SAAUhC,EAAOiC,EAAKC,GACnD,IACKC,GADDF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAa1G,QAAQ,gBAElB,KAD1ByG,EAAW/F,KAAKwC,MAAMqD,EAAIG,eACVC,QACnBF,EAAWA,EAASE,OACPC,UACZtD,MAAMmD,EAASI,SACa,IAAxBJ,EAASK,aACZvC,OAAOwC"}
js/cleantalk-admin-settings-page.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_banner_check(){var a=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(e,t,n,c){e.close_renew_banner&&(jQuery("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(a))}})},9e5)}function apbct_get_elems(e){for(var t,n=0,c=(e=e.split(",")).length;n<c;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_get_elems__native(e){"string"==typeof e&&(e=e.split(","));var a=[];return e.forEach(function(e,t,n){var c=document.getElementById(e);if(null===c){if(null!==(c=document.getElementsByClassName(e))&&0!==c.length)for(key in c)0<=+key&&a.push(c[key])}else a.push(c[key])}),a}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e,a){a=isNaN(a)?null:a,apbct_get_elems__native(e).forEach(function(e,t,n){console.log(e.getAttribute("id"));var c;null===a&&(a=null===e.getAttribute("disabled")?0:1),1===a?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled"),null===e.getAttribute("apbct_children")||null!==(c=apbctSettingsDependencies_getState(e)&&a)&&apbctSettingsDependencies(e.getAttribute("apbct_children"),c)})}function apbctSettingsDependencies_getState(e){var t;switch(e.getAttribute("type")){case"checkbox":t=+e.checked;break;case"radio":t=+(1==+e.getAttribute("value"));break;default:t=null}return t}function apbct_settings__showDescription(e,t){var a=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",a))};a(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,c){c.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",a)}},n)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(e,t,n,c){jQuery(".apbct_success").show(300),setTimeout(function(){jQuery(".apbct_success").hide(300)},2e3),e.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").length)&&apbct_banner_check()});
2
- //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
1
+ function apbct_banner_check(){var a=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(e,t,n,c){e.close_renew_banner&&(jQuery("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(a))}})},9e5)}function apbct_get_elems(e){for(var t,n=0,c=(e=e.split(",")).length;n<c;n++)t=jQuery("#"+e[n]),e[n]=0===t.length?jQuery("."+e[n]):t;return e}function apbct_get_elems__native(e){"string"==typeof e&&(e=e.split(","));var a=[];return e.forEach(function(e,t,n){var c=document.getElementById(e);if(null===c){if(null!==(c=document.getElementsByClassName(e))&&0!==c.length)for(key in c)0<=+key&&a.push(c[key])}else a.push(c[key])}),a}function apbct_show_hide_elem(e){for(var t=0,n=(e=apbct_get_elems(e)).length;t<n;t++)e[t].each(function(e,t){var n=(t=jQuery(t)).next("label")||t.prev("label")||null;t.is(":visible")?(t.hide(),n&&n.hide()):(t.show(),n&&n.show())})}function apbctSettingsDependencies(e,a){a=isNaN(a)?null:a,apbct_get_elems__native(e).forEach(function(e,t,n){console.log(e.getAttribute("id"));if(null===a&&(a=null===e.getAttribute("disabled")?0:1),1===a?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled"),null!==e.getAttribute("apbct_children")){var c=apbctSettingsDependencies_getState(e)&&a;null!==c&&apbctSettingsDependencies(e.getAttribute("apbct_children"),c)}})}function apbctSettingsDependencies_getState(e){var t;switch(e.getAttribute("type")){case"checkbox":t=+e.checked;break;case"radio":t=+(1==+e.getAttribute("value"));break;default:t=null}return t}function apbct_settings__showDescription(e,t){var a=function(e){void 0!==e&&(0!=jQuery(e.target).parent(".apbct_long_desc").length&&!jQuery(e.target).hasClass("apbct_long_desc__cancel")||jQuery(e.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",a))};a(),e.after("<div id='apbct_long_desc__"+t+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+t);n.append("<i class='icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:e.position().top-5,left:e.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get_description",setting_id:t},{spinner:n.children("img"),callback:function(e,t,n,c){c.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",a)}},n)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var e=new Date;jQuery("#ct_admin_timezone").val(e.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(e,t,n,c){jQuery(".apbct_success").show(300),setTimeout(function(){jQuery(".apbct_success").hide(300)},2e3),e.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").length)&&apbct_banner_check()});
2
+ //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
js/cleantalk-admin-settings-page.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\r\n\r\n\t// Crunch for Right to Left direction languages\r\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\r\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\r\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\r\n\t\t}\r\n\t}\r\n\r\n\t// Show/Hide access key\r\n jQuery('#apbct_showApiKey').on('click', function(){\r\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\r\n jQuery('.apbct_setting---apikey+div').show();\r\n jQuery(this).fadeOut(300);\r\n });\r\n\r\n\tvar d = new Date();\r\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\r\n\t\r\n\t// GDPR modal window\r\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\r\n\t\tjQuery('#gdpr_dialog').dialog({\r\n\t\t\tmodal:true, \r\n\t\t\tshow: true,\r\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\r\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\r\n\t\t\theight: 'auto',\r\n\t\t\ttitle: 'GDPR compliance',\r\n\t\t\tdraggable: false,\r\n\t\t\tresizable: false,\r\n\t\t\tcloseText: \"Close\",\r\n\t\t});\r\n\t});\r\n\r\n\t// Sync button\r\n\tjQuery('#apbct_button__sync').on('click', function(){\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_sync'},\r\n\t\t\t{\r\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\r\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tjQuery('.apbct_success').show(300);\r\n\t\t\t\t\tsetTimeout(function(){jQuery('.apbct_success').hide(300);}, 2000)\r\n\t\t\t\t\tif(result.reload)\r\n\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\tif( ctSettingsPage.key_changed )\r\n\t\tjQuery('#apbct_button__sync').click();\r\n\r\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\r\n\t\tself = jQuery(this);\r\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\r\n\t});\r\n\r\n\tif (jQuery('#apbct_renew_notice').length || jQuery('#apbct_trial_notice').length) \r\n\t\tapbct_banner_check();\r\n\t\r\n});\r\n\r\n/**\r\n * Checking current account status for renew notice\r\n */\r\nfunction apbct_banner_check() {\r\n\tvar bannerChecker = setInterval( function() {\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\r\n\t\t\t{\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif (result.close_renew_banner) {\r\n\t\t\t\t\t\tif (jQuery('#apbct_renew_notice').length)\r\n\t\t\t\t\t\t\tjQuery('#apbct_renew_notice').hide('slow');\r\n\t\t\t\t\t\tif (jQuery('#apbct_trial_notice').length)\r\n\t\t\t\t\t\t\tjQuery('#apbct_trial_notice').hide('slow');\r\n\t\t\t\t\t\tclearInterval(bannerChecker);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}, 900000);\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector passed in string separated by ,\r\n *\r\n * @param elems\r\n * @returns {*}\r\n */\r\nfunction apbct_get_elems(elems){\r\n elems = elems.split(',');\r\n for( var i=0, len = elems.length, tmp; i < len; i++){\r\n tmp = jQuery('#'+elems[i]);\r\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\r\n }\r\n return elems;\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\r\n *\r\n * @param elems string|array\r\n * @returns array\r\n */\r\nfunction apbct_get_elems__native(elems){\r\n\r\n\t// Make array from a string\r\n\tif(typeof elems === 'string')\r\n\t\telems = elems.split(',');\r\n\r\n\tvar out = [];\r\n\r\n\telems.forEach(function(elem, i, arr) {\r\n\r\n\t\t// try to get elements with such IDs\r\n\t\tvar tmp = document.getElementById(elem);\r\n\t\tif (tmp !== null){\r\n\t\t\tout.push( tmp[key] );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// try to get elements with such class name\r\n\t\t// write each elem from collection to new element of output array\r\n\t\ttmp = document.getElementsByClassName(elem);\r\n\t\tif (tmp !== null && tmp.length !==0 ){\r\n\t\t\tfor(key in tmp){\r\n\t\t\t\tif( +key >= 0 ){\r\n\t\t\t\t\tout.push( tmp[key] );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\treturn out;\r\n}\r\n\r\nfunction apbct_show_hide_elem(elems){\r\n\telems = apbct_get_elems(elems);\r\n for( var i=0, len = elems.length; i < len; i++){\r\n elems[i].each(function (i, elem) {\r\n elem = jQuery(elem);\r\n var label = elem.next('label') || elem.prev('label') || null;\r\n if (elem.is(\":visible\")) {\r\n elem.hide();\r\n if (label) label.hide();\r\n } else {\r\n elem.show();\r\n if (label) label.show();\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\r\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\r\n *\r\n * @param ids string|array Selectors\r\n * @param enable\r\n */\r\nfunction apbctSettingsDependencies(ids, enable){\r\n\r\n\r\n\tenable = ! isNaN(enable) ? enable : null;\r\n\r\n\t// Get elements\r\n\tvar elems = apbct_get_elems__native( ids );\r\n\r\n\telems.forEach(function(elem, i, arr){\r\n\r\n\t\tconsole.log( elem.getAttribute('id') );\r\n\r\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\r\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\r\n\r\n\t\t// Set defined state\r\n\t\tif(enable === null) // Set\r\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\r\n\r\n\t\tenable === 1 ? do_enable() : do_disable();\r\n\r\n\t\tif( elem.getAttribute('apbct_children') !== null){\r\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\r\n\t\t\tif( state !== null ) {\r\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t});\r\n}\r\n\r\nfunction apbctSettingsDependencies_getState( elem ){\r\n\r\n\tvar state;\r\n\r\n\tswitch ( elem.getAttribute( 'type' ) ){\r\n\t\tcase 'checkbox':\r\n\t\t\tstate = +elem.checked;\r\n\t\t\tbreak;\r\n\t\tcase 'radio':\r\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tstate = null;\r\n\t}\r\n\r\n\treturn state;\r\n}\r\n\r\nfunction apbct_settings__showDescription(label, setting_id){\r\n\r\n\tvar remove_desc_func = function(e){\r\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\r\n\t\t\tjQuery('.apbct_long_desc').remove();\r\n\t\t\tjQuery(document).off('click', remove_desc_func);\r\n\t\t}\r\n\t};\r\n\r\n\tremove_desc_func();\r\n\r\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\r\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\r\n\tobj.append(\"<i class='icon-spin1 animate-spin'></i>\")\r\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t.css({\r\n\t\t\ttop: label.position().top - 5,\r\n\t\t\tleft: label.position().left + 25\r\n\t\t});\r\n\r\n\r\n\tapbct_admin_sendAJAX(\r\n\t\t{action: 'apbct_settings__get_description', setting_id: setting_id},\r\n\t\t{\r\n\t\t\tspinner: obj.children('img'),\r\n\t\t\tcallback: function(result, data, params, obj){\r\n\r\n\t\t\t\tobj.empty()\r\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel icon-cancel'></i>\")\r\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\r\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\r\n\r\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\r\n\t\t\t}\r\n\t\t},\r\n\t\tobj\r\n\t);\r\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","console","log","getAttribute","state","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","ready","getComputedStyle","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","button","setTimeout","reload","location","ctSettingsPage","key_changed","click","self"],"mappings":"AAmEA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QAChCF,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QACpCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,M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C,MAAM,EACN0B,SAAU,CAAEoB,GAAI,SAAUC,GAAI,SAAUC,GAAIC,QAC5CC,OAAS5E,OAAO,WAAW4E,QAAU,IAAM,GAC3CC,OAAQ,OACRpB,MAAO,kBACPqB,WAAW,EACXC,WAAW,EACXC,UAAW,YAKbhF,OAAO,uBAAuB2D,GAAG,QAAS,WACzCnE,qBACC,CAACC,OAAQ,cACT,CACCwF,OAAQlE,SAASC,eAAe,sBAChCsC,QAAStD,OAAO,+CAChBN,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACxCE,OAAO,kBAAkB0B,KAAK,KAC9BwD,WAAW,WAAWlF,OAAO,kBAAkBE,KAAK,MAAQ,KACzDP,EAAOwF,QACTpE,SAASqE,SAASD,cAMnBE,eAAeC,aAClBtF,OAAO,uBAAuBuF,QAE/BvF,OAAOe,UAAU4C,GAAG,QAAS,0CAA2C,WACvE6B,KAAOxF,OAAOiE,MACd1B,gCAAgCiD,KAAMA,KAAKxB,KAAK,eAG7ChE,OAAO,uBAAuBC,QAAUD,OAAO,uBAAuBC,SACzEZ"}
1
+ {"version":3,"sources":["cleantalk-admin-settings-page.js"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","console","log","getAttribute","removeAttribute","setAttribute","state","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","ready","getComputedStyle","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","timeout","button","setTimeout","reload","location","ctSettingsPage","key_changed","click","self"],"mappings":"AAoEA,SAASA,qBACR,IAAI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in-settings-page.min.js","sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('.apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('.apbct_success').hide(300);}, 2000)\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#apbct_renew_notice').length || jQuery('#apbct_trial_notice').length) \n\t\tapbct_banner_check();\n\t\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#apbct_renew_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_renew_notice').hide('slow');\n\t\t\t\t\t\tif (jQuery('#apbct_trial_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_trial_notice').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tconsole.log( elem.getAttribute('id') );\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class='icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}"]}
js/cleantalk-comments-checkspam.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ct_working=!(String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),_=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+_;return e}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctCommentsCheck.ct_prev_accurate,ct_prev_from=ctCommentsCheck.ct_prev_from,ct_prev_till=ctCommentsCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctCommentsCheck.ct_ajax_nonce,ct_comments_total=0,ct_comments_checked=0,ct_comments_spam=0,ct_comments_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_comments(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c={action:"ajax_clear_comments",security:ct_ajax_nonce,from:e,till:t};jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_info(),ct_send_comments()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_comments(),ct_show_info()}function ct_send_comments(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_comments",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_comments():(t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||!0===ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_comments_checked+=e.checked,ct_comments_spam+=e.spam,ct_comments_bad+=e.bad,ct_unchecked=ct_comments_total-ct_comments_checked-ct_comments_bad,c=(c=String(ctCommentsCheck.ct_status_string)).printf(ct_comments_checked,ct_comments_spam,ct_comments_bad),0<parseInt(ct_comments_spam)&&(c+=ctCommentsCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),+ct_comments_total<ct_comments_checked+ct_comments_bad&&(document.cookie="ct_comments_start_check=1; path=/; samesite=lax",document.cookie="ct_comments_safe_check=1; path=/; samesite=lax",location.href="edit-comments.php?page=ct_check_spam"),ct_send_comments()))},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_send_comments(),3e3)},timeout:25e3})}}function ct_show_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();var e;jQuery("#ct_cooling_notice").hide(),ct_comments_total||(e={action:"ajax_info_comments",security:ct_ajax_nonce},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_comments_total=e.total,ct_comments_spam=e.spam,ct_comments_checked=e.checked,ct_comments_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_show_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_delete_all(_){var e={action:"ajax_delete_all",security:ct_ajax_nonce};jQuery("."+_.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_delete_all(_)):(jQuery("."+_.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam_total")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_delete_all(_),3e3)},timeout:25e3})}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_spam_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).removeProp("disabled")):(document.cookie="ct_spam_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).removeProp("checked"))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var a=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),_=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);a.not(this).datepicker("option",t,_),document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_info(),ct_send_comments()):ct_clear_comments())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_spam_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),"1"===ctCommentsCheck.start&&(document.cookie="ct_comments_start_check=0; expires="+new Date(0).toUTCString()+"; path=/; samesite=lax",jQuery("#ct_check_spam_button").click()),jQuery(".ct_delete_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_deletion_all)&&void ct_delete_all(e)})});
2
  //# sourceMappingURL=cleantalk-comments-checkspam.min.js.map
1
+ var ct_working=!(String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctCommentsCheck.ct_prev_accurate,ct_prev_from=ctCommentsCheck.ct_prev_from,ct_prev_till=ctCommentsCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctCommentsCheck.ct_ajax_nonce,ct_comments_total=0,ct_comments_checked=0,ct_comments_spam=0,ct_comments_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_comments(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c={action:"ajax_clear_comments",security:ct_ajax_nonce,from:e,till:t};jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_info(),ct_send_comments()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_comments(),ct_show_info()}function ct_send_comments(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_comments",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_comments():(t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||!0===ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_comments_checked+=e.checked,ct_comments_spam+=e.spam,ct_comments_bad+=e.bad,ct_unchecked=ct_comments_total-ct_comments_checked-ct_comments_bad,c=(c=String(ctCommentsCheck.ct_status_string)).printf(ct_comments_checked,ct_comments_spam,ct_comments_bad),0<parseInt(ct_comments_spam)&&(c+=ctCommentsCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),+ct_comments_total<ct_comments_checked+ct_comments_bad&&(document.cookie="ct_comments_start_check=1; path=/; samesite=lax",document.cookie="ct_comments_safe_check=1; path=/; samesite=lax",location.href="edit-comments.php?page=ct_check_spam"),ct_send_comments()))},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_send_comments(),3e3)},timeout:25e3})}}function ct_show_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();var e;jQuery("#ct_cooling_notice").hide(),ct_comments_total||(e={action:"ajax_info_comments",security:ct_ajax_nonce},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_comments_total=e.total,ct_comments_spam=e.spam,ct_comments_checked=e.checked,ct_comments_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_show_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_trash_all(a){var e={action:"ajax_trash_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_trash_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_trash_all(a),3e3)},timeout:25e3})}function ct_spam_all(a){var e={action:"ajax_spam_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_spam_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_spam_all(a),3e3)},timeout:25e3})}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_spam_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).removeProp("disabled")):(document.cookie="ct_spam_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).removeProp("checked"))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_info(),ct_send_comments()):ct_clear_comments())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_spam_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),"1"===ctCommentsCheck.start&&(document.cookie="ct_comments_start_check=0; expires="+new Date(0).toUTCString()+"; path=/; samesite=lax",jQuery("#ct_check_spam_button").click()),jQuery(".ct_trash_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_trash_all)&&void ct_trash_all(e)}),jQuery(".ct_spam_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_spam_all)&&void ct_spam_all(e)})});
2
  //# sourceMappingURL=cleantalk-comments-checkspam.min.js.map
js/cleantalk-comments-checkspam.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-comments-checkspam.min.js","sources":["cleantalk-comments-checkspam.js"],"sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\r\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\r\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\r\n\tct_comments_total = 0,\r\n\tct_comments_checked = 0,\r\n\tct_comments_spam = 0,\r\n\tct_comments_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to==0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_comments(){\r\n\r\n\tvar from = 0, till = 0;\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\r\n\t\tfrom = jQuery('#ct_date_range_from').val();\r\n\t\ttill = jQuery('#ct_date_range_till').val();\r\n\t}\r\n\tvar data = {\r\n\t\t'action' : 'ajax_clear_comments',\r\n\t\t'security' : ct_ajax_nonce,\r\n\t\t'from' : from,\r\n\t\t'till' : till\r\n\t};\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_info();\r\n\t\t\tct_send_comments();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_comments();\r\n\tct_show_info();\r\n}\r\n\r\nfunction ct_send_comments(){\r\n\t\r\n\tif(ct_cooling_down_flag === true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_check_comments',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'new_check': ct_new_check,\r\n\t\t'unchecked': ct_unchecked\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_comments();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_comments_checked += msg.checked;\r\n\t\t\t\t\tct_comments_spam += msg.spam;\r\n\t\t\t\t\tct_comments_bad += msg.bad;\r\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\r\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_checked, ct_comments_spam, ct_comments_bad);\r\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\t// If DB woks not properly\r\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\r\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/; samesite=lax';\r\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_safe_check=1; path=/; samesite=lax';\r\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tct_send_comments();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_send_comments(), 3000); \r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_info(){\r\n\t\r\n\tif(ct_working){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag == true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\r\n\t\t\tjQuery('#ct_cooling_notice').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tif(!ct_comments_total){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_comments',\r\n\t\t\t\t'security': ct_ajax_nonce\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(ct_date_from && ct_date_till){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_comments_total = msg.total;\r\n\t\t\t\t\tct_comments_spam = msg.spam;\r\n\t\t\t\t\tct_comments_checked = msg.checked;\r\n\t\t\t\t\tct_comments_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\nfunction ct_delete_all( e ) {\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\r\n\tjQuery('.' + e.target.id).addClass('disabled');\r\n\tjQuery('.spinner').css('visibility', 'visible');\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function( msg ){\r\n\t\t\tif( msg > 0 ){\r\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\r\n\t\t\t\tct_delete_all( e );\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam_total';\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_delete_all( e ), 3000);\r\n\t\t},\r\n\t\ttimeout: 25000\r\n\t});\r\n\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\r\n\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\tif( this.checked ) {\r\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=1; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('checked', true).removeProp('disabled');\r\n\t\t} else {\r\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=0; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('disabled', true).removeProp('checked');\r\n\t\t}\r\n\t});\r\n\r\n jQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'M d yy',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\t\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\r\n\tfunction ct_start_check(continue_check){\r\n\r\n continue_check = continue_check || null;\r\n\r\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\t\t\t\r\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\r\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\t\t\t\t\t\t\r\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\r\n\t\t\t\talert('Please, specify a date range.');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\t\tct_accurate_check = true;\r\n\t\t}\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_working_message').show();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_pause').show();\r\n\r\n\t\tct_working=true;\r\n\t\t\r\n\t\tif(continue_check){\r\n\t\t\tct_show_info();\r\n\t\t\tct_send_comments();\r\n\t\t}else\r\n\t\t\tct_clear_comments();\r\n\t\t\r\n\t}\r\n\t\r\n\t// Check comments\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_spam_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\r\n\t});\r\n\r\n\r\n\tif(ctCommentsCheck.start === '1'){\r\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/; samesite=lax';\r\n\t\tjQuery('#ct_check_spam_button').click();\t\r\n\t}\r\n\r\n\t// Delete all spam comments\r\n\tjQuery(\".ct_delete_all\").click(function( e ){\r\n\r\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_deletion_all))\r\n\t\t\treturn false;\r\n\r\n\t\tct_delete_all( e );\r\n\r\n\t});\r\n\r\n});"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","from","till","is","val","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","location","href","end","document","cookie","hide","checked","spam","bad","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_delete_all","e","target","addClass","css","removeClass","ready","on","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","alert","click","ct_check","accurate","JSON","stringify","start","Date","toUTCString","ct_confirm_deletion_all"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,gBAAgBD,iBACnCE,aAAeD,gBAAgBC,aAC/BC,aAAeF,gBAAgBE,aAE5BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,gBAAgBM,cACnCC,kBAAoB,EACpBC,oBAAsB,EACtBC,iBAAmB,EACnBC,gBAAkB,EAClBC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,KAGnBC,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,GAAIE,KAItBpB,kBAAiB,EAInB,SAASuB,oBAER,I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e,KAIhBhF,OAAO,aAAa6D,GAAG,QAAS,WAC/BhF,UAAW,EACX,IAAIuG,EAAW,CACdC,SAAYzG,kBACZuB,KAAYR,aACZS,KAAYR,cAEboC,SAASC,OAAS,wBAA0BqD,KAAKC,UAAUH,GAAY,2BAI3C,MAA1BrG,gBAAgByG,QAClBxD,SAASC,OAAS,sCAAwC,IAAIwD,KAAK,GAAGC,cAAgB,yBACtF1F,OAAO,yBAAyBmF,SAIjCnF,OAAO,kBAAkBmF,MAAM,SAAU5B,GAExC,QAAK5B,QAAQ5C,gBAAgB4G,+BAG7BrC,cAAeC"}
1
+ {"version":3,"file":"cleantalk-comments-checkspam.min.js","sources":["cleantalk-comments-checkspam.js"],"sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\r\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\r\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\r\n\tct_comments_total = 0,\r\n\tct_comments_checked = 0,\r\n\tct_comments_spam = 0,\r\n\tct_comments_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to==0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_comments(){\r\n\r\n\tvar from = 0, till = 0;\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\r\n\t\tfrom = jQuery('#ct_date_range_from').val();\r\n\t\ttill = jQuery('#ct_date_range_till').val();\r\n\t}\r\n\tvar data = {\r\n\t\t'action' : 'ajax_clear_comments',\r\n\t\t'security' : ct_ajax_nonce,\r\n\t\t'from' : from,\r\n\t\t'till' : till\r\n\t};\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_info();\r\n\t\t\tct_send_comments();\r\n\t\t}\r\n\t});\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_comments();\r\n\tct_show_info();\r\n}\r\n\r\nfunction ct_send_comments(){\r\n\t\r\n\tif(ct_cooling_down_flag === true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ajax_check_comments',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'new_check': ct_new_check,\r\n\t\t'unchecked': ct_unchecked\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_comments();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_comments_checked += msg.checked;\r\n\t\t\t\t\tct_comments_spam += msg.spam;\r\n\t\t\t\t\tct_comments_bad += msg.bad;\r\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\r\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_checked, ct_comments_spam, ct_comments_bad);\r\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\t// If DB woks not properly\r\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\r\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/; samesite=lax';\r\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_safe_check=1; path=/; samesite=lax';\r\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tct_send_comments();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_send_comments(), 3000); \r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_info(){\r\n\t\r\n\tif(ct_working){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag == true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\r\n\t\t\tjQuery('#ct_cooling_notice').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tif(!ct_comments_total){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_comments',\r\n\t\t\t\t'security': ct_ajax_nonce\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif(ct_date_from && ct_date_till){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_comments_total = msg.total;\r\n\t\t\t\t\tct_comments_spam = msg.spam;\r\n\t\t\t\t\tct_comments_checked = msg.checked;\r\n\t\t\t\t\tct_comments_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\nfunction ct_trash_all( e ) {\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_trash_all',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\r\n\tjQuery('.' + e.target.id).addClass('disabled');\r\n\tjQuery('.spinner').css('visibility', 'visible');\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function( msg ){\r\n\t\t\tif( msg > 0 ){\r\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\r\n\t\t\t\tct_trash_all( e );\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_trash_all( e ), 3000);\r\n\t\t},\r\n\t\ttimeout: 25000\r\n\t});\r\n\r\n}\r\n\r\nfunction ct_spam_all( e ) {\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_spam_all',\r\n\t\t'security': ct_ajax_nonce\r\n\t};\r\n\r\n\tjQuery('.' + e.target.id).addClass('disabled');\r\n\tjQuery('.spinner').css('visibility', 'visible');\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function( msg ){\r\n\t\t\tif( msg > 0 ){\r\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\r\n\t\t\t\tct_spam_all( e );\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\r\n\t\t\tsetTimeout(ct_spam_all( e ), 3000);\r\n\t\t},\r\n\t\ttimeout: 25000\r\n\t});\r\n\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\r\n\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\tif( this.checked ) {\r\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=1; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('checked', true).removeProp('disabled');\r\n\t\t} else {\r\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=0; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('disabled', true).removeProp('checked');\r\n\t\t}\r\n\t});\r\n\r\n jQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'M d yy',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\t\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\r\n\tfunction ct_start_check(continue_check){\r\n\r\n continue_check = continue_check || null;\r\n\r\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\t\t\t\r\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\r\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\t\t\t\t\t\t\r\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\r\n\t\t\t\talert('Please, specify a date range.');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\t\tct_accurate_check = true;\r\n\t\t}\r\n\t\t\r\n\t\tjQuery('.ct_to_hide').hide();\r\n\t\tjQuery('#ct_working_message').show();\r\n\t\tjQuery('#ct_preloader').show();\r\n\t\tjQuery('#ct_pause').show();\r\n\r\n\t\tct_working=true;\r\n\t\t\r\n\t\tif(continue_check){\r\n\t\t\tct_show_info();\r\n\t\t\tct_send_comments();\r\n\t\t}else\r\n\t\t\tct_clear_comments();\r\n\t\t\r\n\t}\r\n\t\r\n\t// Check comments\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_spam_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\r\n\t});\r\n\r\n\r\n\tif(ctCommentsCheck.start === '1'){\r\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/; samesite=lax';\r\n\t\tjQuery('#ct_check_spam_button').click();\t\r\n\t}\r\n\r\n\t// Delete all spam comments\r\n\tjQuery(\".ct_trash_all\").click(function( e ){\r\n\r\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_trash_all))\r\n\t\t\treturn false;\r\n\r\n\t\tct_trash_all( e );\r\n\r\n\t});\r\n\r\n\t// Mark as spam all spam comments\r\n\tjQuery(\".ct_spam_all\").click(function( e ){\r\n\r\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_spam_all))\r\n\t\t\treturn false;\r\n\r\n\t\tct_spam_all( e );\r\n\r\n\t});\r\n\r\n});"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","from","till","is","val","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","location","href","end","document","cookie","hide","checked","spam","bad","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","total","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_trash_all","e","target","addClass","css","removeClass","ct_spam_all","ready","on","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","alert","click","ct_check","accurate","JSON","stringify","start","Date","toUTCString","ct_confirm_trash_all","ct_confirm_spam_all"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,IAKVS,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,gBAAgBD,iBACnCE,aAAeD,gBAAgBC,aAC/BC,aAAeF,gBAAgBE,aAE5BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,gBAAgBM,cACnCC,kBAAoB,EACpBC,oBAAsB,EACtBC,iBAAmB,EACnBC,gBAAkB,EAClBC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,KAGnBC,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,GAAIE,KAItBpB,kBAAiB,EAInB,SAASuB,oBAER,IAAIC,EAAO,EAAGC,EAAO,EAClBJ,OAAO,wBAAwBK,GAAG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,OAAS,sBAAuBjC,OAAO,uBAAuBM,MAAO,4BAKjF,SAAS2E,EAAeC,GAEjBA,EAAiBA,GAAkB,KAEtClF,OAAO,wBAAwBK,GAAG,cAEpCV,aAAeK,OAAO,uBAAuBM,MAC7CV,aAAeI,OAAO,uBAAuBM,MAExB,IAAhBX,cAAsC,IAAhBC,cAC1BuF,MAAM,kCAKLnF,OAAO,sBAAsBK,GAAG,cAClCzB,mBAAoB,GAGrBoB,OAAO,eAAekC,OACtBlC,OAAO,uBAAuB4C,OAC9B5C,OAAO,iBAAiB4C,OACxB5C,OAAO,aAAa4C,OAEpBhF,YAAW,EAERsH,GACFlE,eACAC,oBAEAf,qBAKFF,OAAO,yBAAyBoF,MAAM,WAErCH,IADAjD,SAASC,OAAS,mDAGnBjC,OAAO,4BAA4BoF,MAAM,WACxCH,GAAe,KAIhBjF,OAAO,aAAa8D,GAAG,QAAS,WAC/BjF,UAAW,EACX,IAAIwG,EAAW,CACdC,SAAY1G,kBACZuB,KAAYR,aACZS,KAAYR,cAEboC,SAASC,OAAS,wBAA0BsD,KAAKC,UAAUH,GAAY,2BAI3C,MAA1BtG,gBAAgB0G,QAClBzD,SAASC,OAAS,sCAAwC,IAAIyD,KAAK,GAAGC,cAAgB,yBACtF3F,OAAO,yBAAyBoF,SAIjCpF,OAAO,iBAAiBoF,MAAM,SAAU7B,GAEvC,QAAK5B,QAAQ5C,gBAAgB6G,4BAG7BtC,aAAcC,KAKfvD,OAAO,gBAAgBoF,MAAM,SAAU7B,GAEtC,QAAK5B,QAAQ5C,gBAAgB8G,2BAG7BjC,YAAaL"}
js/cleantalk-users-checkspam.min.js CHANGED
@@ -1,2 +1,2 @@
1
- String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"none"===(r=r||["apbct_","ct_"])&&(r=null),"string"==typeof r&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c={action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random()};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(ct_users_bad)+parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,c=(c=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0<parseInt(ct_users_spam)&&(c+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),ct_send_users()))},error:function(e,t,c){20<a&&(a-=20,document.cookie="ct_check_users__amount="+a+"; path=/; samesite=lax"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){if(ct_working){if(!0===ct_cooling_down_flag)return void jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)").show();var e;jQuery("#ct_cooling_notice").hide(),ct_users_total||(e={action:"ajax_info_users",security:ct_ajax_nonce,no_cache:Math.random()},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_start_check(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}function ct_delete_all_users(a){var t={action:"ajax_delete_all_users",security:ct_ajax_nonce,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users(a,t)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="users.php?page=ct_check_users_total")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(a),3e3)},timeout:25e3})}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_users_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).removeProp("disabled")):(document.cookie="ct_users_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).removeProp("checked"))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function t(t){t=t||null;var e={action:"ajax_insert_users",security:ct_ajax_nonce,no_cache:Math.random()};t&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert("Deleted "+e+" users"):alert("Inserted "+e+" users")}})}jQuery("#ct_check_spam_button").click(function(){ct_start_check(!(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){ct_start_check(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id,no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}});e={action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve",no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery(".ct_get_csv_file").click(function(a){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;0===parseInt(e)?alert(ctUsersCheck.ct_bad_csv):(t=URL.createObjectURL(new Blob([e])),(c=document.createElement("a")).href=t,c.download=ctUsersCheck.ct_csv_filename+".csv",document.body.appendChild(c),c.click()),jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden")}})}),jQuery(".ct_insert_users").click(function(e){t()}),jQuery(".ct_insert_users__delete").click(function(e){t(!0)}),jQuery(".ct_delete_all_users").click(function(e){return!!confirm(ctUsersCheck.ct_confirm_deletion_all)&&void ct_delete_all_users(e)})});
2
  //# sourceMappingURL=cleantalk-users-checkspam.min.js.map
1
+ String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"none"===(r=r||["apbct_","ct_"])&&(r=null),"string"==typeof r&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c={action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random()};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(ct_users_bad)+parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,c=(c=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0<parseInt(ct_users_spam)&&(c+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),ct_send_users()))},error:function(e,t,c){20<a&&(a-=20,document.cookie="ct_check_users__amount="+a+"; path=/; samesite=lax"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){if(ct_working){if(!0===ct_cooling_down_flag)return void jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)").show();var e;jQuery("#ct_cooling_notice").hide(),ct_users_total||(e={action:"ajax_info_users",security:ct_ajax_nonce,no_cache:Math.random()},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_start_check(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}function ct_delete_all_users(a){var t={action:"ajax_delete_all_users",security:ct_ajax_nonce,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users(a,t)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="users.php?page=ct_check_users")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(a),3e3)},timeout:25e3})}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_users_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).removeProp("disabled")):(document.cookie="ct_users_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).removeProp("checked"))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function t(t){t=t||null;var e={action:"ajax_insert_users",security:ct_ajax_nonce,no_cache:Math.random()};t&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert("Deleted "+e+" users"):alert("Inserted "+e+" users")}})}jQuery("#ct_check_spam_button").click(function(){ct_start_check(!(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){ct_start_check(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id,no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}});e={action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve",no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery(".ct_get_csv_file").click(function(a){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;0===parseInt(e)?alert(ctUsersCheck.ct_bad_csv):(t=URL.createObjectURL(new Blob([e])),(c=document.createElement("a")).href=t,c.download=ctUsersCheck.ct_csv_filename+".csv",document.body.appendChild(c),c.click()),jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden")}})}),jQuery(".ct_insert_users").click(function(e){t()}),jQuery(".ct_insert_users__delete").click(function(e){t(!0)}),jQuery(".ct_delete_all_users").click(function(e){return!!confirm(ctUsersCheck.ct_confirm_deletion_all)&&void ct_delete_all_users(e)})});
2
  //# sourceMappingURL=cleantalk-users-checkspam.min.js.map
js/cleantalk-users-checkspam.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Set deafult amount to check by request.\r\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\r\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\r\n\tct_prev_till = ctUsersCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\r\n\tct_users_total = 0,\r\n\tct_users_checked = 0,\r\n\tct_users_spam = 0,\r\n\tct_users_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\n/* Function: Reuturns cookie with prefix */\r\nfunction apbct_cookie__get(names, prefixes){\r\n\tvar cookie = {};\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes === 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\treturn cookie;\r\n}\r\n\r\nfunction apbct_get_cookie( name ){\r\n\tvar cookie = apbct_cookie__get( name, name );\r\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\r\n\t\treturn cookie[name];\r\n\t}else\r\n\t\treturn null;\r\n}\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to === 0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_users(){\r\n\r\n\tvar from = 0, till = 0;\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\r\n\t\tfrom = jQuery('#ct_date_range_from').val();\r\n\t\ttill = jQuery('#ct_date_range_till').val();\r\n\t}\r\n\tvar data = {\r\n\t\t'action' : 'ajax_clear_users',\r\n\t\t'security' : ct_ajax_nonce,\r\n\t\t'from' : from,\r\n\t\t'till' : till,\r\n\t\t'no_cache': Math.random()\r\n\t};\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}\r\n\t});\r\n\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_users();\r\n\tct_show_users_info();\r\n}\r\n\r\nfunction ct_send_users(){\r\n\t\r\n\tif(ct_cooling_down_flag === true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\r\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\r\n\r\n\tvar data = {\r\n\t\taction: 'ajax_check_users',\r\n\t\tsecurity: ct_ajax_nonce,\r\n\t\tnew_check: ct_new_check,\r\n\t\tunchecked: ct_unchecked,\r\n\t\tamount: check_amount,\r\n\t\t'no_cache': Math.random()\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\r\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\r\n\t\t\t\t\tct_users_bad = parseInt( ct_users_bad ) + parseInt( msg.bad );\r\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\r\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\r\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tif(check_amount > 20){\r\n\t\t\t\tcheck_amount -= 20;\r\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\r\n\t\t\t}\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\r\n\t\t\tsetTimeout(ct_send_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_users_info(){\r\n\t\r\n\tif( ct_working ){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag === true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tif( ! ct_users_total ){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_users',\r\n\t\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t\t'no_cache': Math.random()\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif( ct_date_from && ct_date_till ){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_users_spam = msg.spam;\r\n\t\t\t\t\tct_users_checked = msg.checked;\r\n\t\t\t\t\tct_users_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\r\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\n// Main function of checking\r\nfunction ct_start_check( continue_check ){\r\n\r\n\tcontinue_check = continue_check || null;\r\n\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\r\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\r\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\r\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\r\n\t\t\talert('Please, specify a date range.');\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\tct_accurate_check = true;\r\n\t}\r\n\r\n\tjQuery('.ct_to_hide').hide();\r\n\tjQuery('#ct_working_message').show();\r\n\tjQuery('#ct_preloader').show();\r\n\tjQuery('#ct_pause').show();\r\n\r\n\tct_working = true;\r\n\r\n\tif( continue_check ){\r\n\t\tct_show_users_info();\r\n\t\tct_send_users();\r\n\t} else {\r\n\t\tct_clear_users();\r\n\t}\r\n\r\n}\r\n\r\nfunction ct_delete_all_users( e ){\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'no_cache': Math.random()\r\n\t};\r\n\r\n\tjQuery('.' + e.target.id).addClass('disabled');\r\n\tjQuery('.spinner').css('visibility', 'visible');\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function( msg ){\r\n\t\t\tif( msg > 0 ){\r\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\r\n\t\t\t\tct_delete_all_users( e, data );\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t\tlocation.href='users.php?page=ct_check_users_total';\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\r\n\t\t},\r\n\t\ttimeout: 25000\r\n\t});\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\r\n\t// Setting dependences\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\r\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\tif( this.checked ) {\r\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('checked', true).removeProp('disabled');\r\n\t\t} else {\r\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('disabled', true).removeProp('checked');\r\n\t\t}\r\n\t});\r\n\r\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'M d yy',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\r\n\t// Check users\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\t\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\r\n\t});\r\n\t\t\r\n\t//Approve button\r\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\r\n\t\tct_id = jQuery(this).attr(\"data-id\");\r\n\t\t\r\n\t\t// Approving\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_approve_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'id': ct_id,\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\r\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t});\r\n\t\t\r\n\t\t// Positive feedback\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'user_id': ct_id,\r\n\t\t\t'status': 'approve',\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\t// Success\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t\t\r\n\t});\r\n\t\r\n\t// Request to Download CSV file.\r\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_get_csv_file',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\t\tjQuery('.' + e.target.id).addClass('disabled');\r\n\t\tjQuery('.spinner').css('visibility', 'visible');\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif( parseInt(msg) === 0 ) {\r\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\r\n\r\n\t\t\t\t\tvar dummy = document.createElement('a');\r\n\t\t\t\t\tdummy.href = url;\r\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\r\n\r\n\t\t\t\t\tdocument.body.appendChild(dummy);\r\n\t\t\t\t\tdummy.click();\r\n\t\t\t\t}\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\t// Delete inserted users\r\n\tjQuery(\".ct_insert_users\").click(function( e ){\r\n\t\tct_insert_users();\r\n\t});\r\n\r\n\t// Insert users\r\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\r\n\t\tct_insert_users( true );\r\n\t});\r\n\r\n\t// Delete all spam users\r\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\r\n\r\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\r\n\t\t\treturn false;\r\n\r\n\t\tct_delete_all_users( e );\r\n\r\n\t});\r\n\r\n\tfunction ct_insert_users(delete_accounts){\r\n\r\n\t\tdelete_accounts = delete_accounts || null;\r\n\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_insert_users',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\r\n\t\tif(delete_accounts)\r\n\t\t\tdata['delete'] = true;\r\n\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(delete_accounts)\r\n\t\t\t\t\talert('Deleted ' + msg + ' users');\r\n\t\t\t\telse\r\n\t\t\t\t\talert('Inserted ' + msg + ' users');\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n});"],"names":["String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","is","val","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","check_amount","new_check","unchecked","amount","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","location","href","end","hide","checked","spam","bad","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_delete_all_users","e","target","addClass","css","removeClass","ready","on","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","click","ct_check","accurate","JSON","stringify","ct_id","attr","fadeOut","remove","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","createElement","download","body","appendChild","ct_confirm_deletion_all"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,GAOX,IAAIS,aAHJC,SAASC,OAAS,oDAIjBC,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB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KC,UAElBZ,OAAO,IAAM4D,EAAEC,OAAO9D,IAAI+D,SAAS,YACnC9D,OAAO,YAAY+D,IAAI,aAAc,WACrC/D,OAAOa,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLT,KAAMA,EACNU,QAAS,SAASC,GACjB,IAGKH,EAEAqF,EALiB,IAAlBtE,SAASZ,GACZwC,MAAMzF,aAAaoI,aAEftF,EAAMuF,IAAIC,gBAAgB,IAAIC,KAAK,CAACtF,MAEpCkF,EAAQ3I,SAASgJ,cAAc,MAC7BtE,KAAOpB,EACbqF,EAAMM,SAAWzI,aAAakI,gBAAkB,OAEhD1I,SAASkJ,KAAKC,YAAYR,GAC1BA,EAAMb,SAEPvF,OAAO,IAAM4D,EAAEC,OAAO9D,IAAIiE,YAAY,YACtChE,OAAO,YAAY+D,IAAI,aAAc,eAMxC/D,OAAO,oBAAoBuF,MAAM,SAAU3B,GAC1CyB,MAIDrF,OAAO,4BAA4BuF,MAAM,SAAU3B,GAClDyB,GAAiB,KAIlBrF,OAAO,wBAAwBuF,MAAM,SAAU3B,GAE9C,QAAO5B,QAAS/D,aAAa4I,+BAG7BlD,oBAAqBC"}
1
+ {"version":3,"file":"cleantalk-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\r\nString.prototype.printf = function(){\r\n var formatted = this;\r\n for( var arg in arguments ) {\r\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\r\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\r\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\r\n }\r\n return formatted;\r\n};\r\n\r\n// Set deafult amount to check by request.\r\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\r\n\r\n// Flags\r\nvar ct_working = false,\r\n\tct_new_check = true,\r\n\tct_cooling_down_flag = false,\r\n\tct_close_animate = true,\r\n\tct_accurate_check = false,\r\n\tct_pause = false,\r\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\r\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\r\n\tct_prev_till = ctUsersCheck.ct_prev_till;\r\n// Settings\r\nvar ct_cool_down_time = 90000,\r\n\tct_requests_counter = 0,\r\n\tct_max_requests = 60;\r\n// Variables\r\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\r\n\tct_users_total = 0,\r\n\tct_users_checked = 0,\r\n\tct_users_spam = 0,\r\n\tct_users_bad = 0,\r\n\tct_unchecked = 'unset',\r\n\tct_date_from = 0,\r\n\tct_date_till = 0;\r\n\r\n/* Function: Reuturns cookie with prefix */\r\nfunction apbct_cookie__get(names, prefixes){\r\n\tvar cookie = {};\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes === 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\treturn cookie;\r\n}\r\n\r\nfunction apbct_get_cookie( name ){\r\n\tvar cookie = apbct_cookie__get( name, name );\r\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\r\n\t\treturn cookie[name];\r\n\t}else\r\n\t\treturn null;\r\n}\r\n\r\nfunction animate_comment(to,id){\r\n\tif(ct_close_animate){\r\n\t\tif(to === 0.3){\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(1,id)\r\n\t\t\t});\r\n\t\t}else{\r\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\r\n\t\t\t\tanimate_comment(0.3,id)\r\n\t\t\t});\r\n\t\t}\r\n\t}else{\r\n\t\tct_close_animate=true;\r\n\t}\r\n}\r\n\r\nfunction ct_clear_users(){\r\n\r\n\tvar from = 0, till = 0;\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\r\n\t\tfrom = jQuery('#ct_date_range_from').val();\r\n\t\ttill = jQuery('#ct_date_range_till').val();\r\n\t}\r\n\tvar data = {\r\n\t\t'action' : 'ajax_clear_users',\r\n\t\t'security' : ct_ajax_nonce,\r\n\t\t'from' : from,\r\n\t\t'till' : till,\r\n\t\t'no_cache': Math.random()\r\n\t};\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_show_users_info();\r\n\t\t\tct_send_users();\r\n\t\t}\r\n\t});\r\n\r\n}\r\n\r\n//Continues the check after cooldown time\r\n//Called by ct_send_users();\r\nfunction ct_cooling_down_toggle(){\r\n\tct_cooling_down_flag = false;\r\n\tct_send_users();\r\n\tct_show_users_info();\r\n}\r\n\r\nfunction ct_send_users(){\r\n\t\r\n\tif(ct_cooling_down_flag === true)\r\n\t\treturn;\r\n\t\r\n\tif(ct_requests_counter >= ct_max_requests){\r\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\r\n\t\tct_requests_counter = 0;\r\n\t\tct_cooling_down_flag = true;\r\n\t\treturn;\r\n\t}else{\r\n\t\tct_requests_counter++;\r\n\t}\r\n\r\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\r\n\r\n\tvar data = {\r\n\t\taction: 'ajax_check_users',\r\n\t\tsecurity: ct_ajax_nonce,\r\n\t\tnew_check: ct_new_check,\r\n\t\tunchecked: ct_unchecked,\r\n\t\tamount: check_amount,\r\n\t\t'no_cache': Math.random()\r\n\t};\r\n\t\r\n\tif(ct_accurate_check)\r\n\t\tdata['accurate_check'] = true;\r\n\t\r\n\tif(ct_date_from && ct_date_till){\r\n\t\tdata['from'] = ct_date_from;\r\n\t\tdata['till'] = ct_date_till;\r\n\t}\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\t\r\n\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\r\n\t\t\tif(parseInt(msg.error)){\r\n\t\t\t\tct_working=false;\r\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t}else{\r\n\t\t\t\tct_new_check = false;\r\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\r\n\t\t\t\t\tif(parseInt(msg.end) == 1)\r\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\r\n\t\t\t\t\tct_working=false;\r\n\t\t\t\t\tjQuery('#ct_working_message').hide();\r\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\r\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\r\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\r\n\t\t\t\t\tlocation.href = new_href;\r\n\t\t\t\t}else if(parseInt(msg.end) == 0){\r\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\r\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\r\n\t\t\t\t\tct_users_bad = parseInt( ct_users_bad ) + parseInt( msg.bad );\r\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\r\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\r\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\r\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\r\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\r\n\t\t\t\t\tjQuery('#ct_error_message').hide();\r\n\t\t\t\t\tct_send_users();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tif(check_amount > 20){\r\n\t\t\t\tcheck_amount -= 20;\r\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\r\n\t\t\t}\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\r\n\t\t\tsetTimeout(ct_send_users(), 3000);\r\n },\r\n timeout: 25000\r\n\t});\r\n}\r\nfunction ct_show_users_info(){\r\n\t\r\n\tif( ct_working ){\r\n\t\t\r\n\t\tif(ct_cooling_down_flag === true){\r\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\r\n\t\t\treturn;\t\t\t\r\n\t\t}else{\r\n\t\t\tjQuery('#ct_cooling_notice').hide();\r\n\t\t}\r\n\t\t\r\n\t\tif( ! ct_users_total ){\r\n\t\t\t\r\n\t\t\tvar data = {\r\n\t\t\t\t'action': 'ajax_info_users',\r\n\t\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t\t'no_cache': Math.random()\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\tif( ct_date_from && ct_date_till ){\r\n\t\t\t\tdata['from'] = ct_date_from;\r\n\t\t\t\tdata['till'] = ct_date_till;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tjQuery.ajax({\r\n\t\t\t\ttype: \"POST\",\r\n\t\t\t\turl: ajaxurl,\r\n\t\t\t\tdata: data,\r\n\t\t\t\tsuccess: function(msg){\r\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\r\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\r\n\t\t\t\t\tct_users_spam = msg.spam;\r\n\t\t\t\t\tct_users_checked = msg.checked;\r\n\t\t\t\t\tct_users_bad = msg.bad;\r\n\t\t\t\t},\r\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\r\n\t\t\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\r\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 15000\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n}\r\n// Function to toggle dependences\r\nfunction ct_toggle_depended(obj, secondary){\r\n\r\n secondary = secondary || null;\r\n\r\n\tvar depended = jQuery(obj.data('depended')),\r\n\t\tstate = obj.data('state');\r\n\t\t\r\n\tif(!state && !secondary){\r\n\t\tobj.data('state', true);\r\n\t\tdepended.removeProp('disabled');\r\n\t}else{\r\n\t\tobj.data('state', false);\r\n\t\tdepended.prop('disabled', true);\r\n\t\tdepended.removeProp('checked');\r\n\t\tif(depended.data('depended'))\r\n\t\t\tct_toggle_depended(depended, true);\r\n\t}\r\n}\r\n\r\n// Main function of checking\r\nfunction ct_start_check( continue_check ){\r\n\r\n\tcontinue_check = continue_check || null;\r\n\r\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\r\n\r\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\r\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\r\n\r\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\r\n\t\t\talert('Please, specify a date range.');\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tif(jQuery('#ct_accurate_check').is(':checked')){\r\n\t\tct_accurate_check = true;\r\n\t}\r\n\r\n\tjQuery('.ct_to_hide').hide();\r\n\tjQuery('#ct_working_message').show();\r\n\tjQuery('#ct_preloader').show();\r\n\tjQuery('#ct_pause').show();\r\n\r\n\tct_working = true;\r\n\r\n\tif( continue_check ){\r\n\t\tct_show_users_info();\r\n\t\tct_send_users();\r\n\t} else {\r\n\t\tct_clear_users();\r\n\t}\r\n\r\n}\r\n\r\nfunction ct_delete_all_users( e ){\r\n\r\n\tvar data = {\r\n\t\t'action': 'ajax_delete_all_users',\r\n\t\t'security': ct_ajax_nonce,\r\n\t\t'no_cache': Math.random()\r\n\t};\r\n\r\n\tjQuery('.' + e.target.id).addClass('disabled');\r\n\tjQuery('.spinner').css('visibility', 'visible');\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function( msg ){\r\n\t\t\tif( msg > 0 ){\r\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\r\n\t\t\t\tct_delete_all_users( e, data );\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\r\n\t\t\t}\r\n\t\t},\r\n\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tjQuery('#ct_error_message').show();\r\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\r\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\r\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\r\n\t\t},\r\n\t\ttimeout: 25000\r\n\t});\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\r\n\t// Setting dependences\r\n\t\r\n\t// Prev check parameters\r\n\tif(ct_prev_accurate){\r\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\r\n\t}\r\n\tif(ct_prev_from){\r\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\r\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\r\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\r\n\t}\r\n\t\r\n\t// Toggle dependences\r\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\r\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\tif( this.checked ) {\r\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('checked', true).removeProp('disabled');\r\n\t\t} else {\r\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\r\n\t\t\tjQuery('.ct_date').prop('disabled', true).removeProp('checked');\r\n\t\t}\r\n\t});\r\n\r\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\r\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\r\n\t\t{\r\n\t\t\tdateFormat: 'M d yy',\r\n\t\t\tmaxDate:\"+0D\",\r\n\t\t\tchangeMonth:true,\r\n\t\t\tchangeYear:true,\r\n\t\t\tshowAnim: 'slideDown',\r\n\t\t\tonSelect: function(selectedDate){\r\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\r\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\r\n\t\t\t\tdate = jQuery.datepicker.parseDate(\r\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\r\n\t\t\t\t\tselectedDate, instance.settings);\r\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\r\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\r\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n\t\r\n\t// Check users\r\n\tjQuery(\"#ct_check_spam_button\").click(function(){\r\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\r\n\t\tct_start_check(false);\r\n\t});\r\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\r\n\t\tct_start_check(true);\r\n\t});\r\n\t\r\n\t// Pause the check\r\n\tjQuery('#ct_pause').on('click', function(){\r\n\t\tct_pause = true;\r\n\t\tvar ct_check = {\r\n\t\t\t'accurate': ct_accurate_check,\r\n\t\t\t'from' : ct_date_from,\r\n\t\t\t'till' : ct_date_till\r\n\t\t};\r\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\r\n\t});\r\n\t\t\r\n\t//Approve button\r\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\r\n\t\tct_id = jQuery(this).attr(\"data-id\");\r\n\t\t\r\n\t\t// Approving\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_approve_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'id': ct_id,\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\r\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t});\r\n\t\t\r\n\t\t// Positive feedback\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_user',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'user_id': ct_id,\r\n\t\t\t'status': 'approve',\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\t// Success\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t}\r\n\t\t\t\tif(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\t\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t\t\r\n\t});\r\n\t\r\n\t// Request to Download CSV file.\r\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_ct_get_csv_file',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\t\tjQuery('.' + e.target.id).addClass('disabled');\r\n\t\tjQuery('.spinner').css('visibility', 'visible');\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif( parseInt(msg) === 0 ) {\r\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\r\n\r\n\t\t\t\t\tvar dummy = document.createElement('a');\r\n\t\t\t\t\tdummy.href = url;\r\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\r\n\r\n\t\t\t\t\tdocument.body.appendChild(dummy);\r\n\t\t\t\t\tdummy.click();\r\n\t\t\t\t}\r\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\r\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\r\n\t// Delete inserted users\r\n\tjQuery(\".ct_insert_users\").click(function( e ){\r\n\t\tct_insert_users();\r\n\t});\r\n\r\n\t// Insert users\r\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\r\n\t\tct_insert_users( true );\r\n\t});\r\n\r\n\t// Delete all spam users\r\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\r\n\r\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\r\n\t\t\treturn false;\r\n\r\n\t\tct_delete_all_users( e );\r\n\r\n\t});\r\n\r\n\tfunction ct_insert_users(delete_accounts){\r\n\r\n\t\tdelete_accounts = delete_accounts || null;\r\n\r\n\t\tvar data = {\r\n\t\t\t'action': 'ajax_insert_users',\r\n\t\t\t'security': ct_ajax_nonce,\r\n\t\t\t'no_cache': Math.random()\r\n\t\t};\r\n\r\n\t\tif(delete_accounts)\r\n\t\t\tdata['delete'] = true;\r\n\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tif(delete_accounts)\r\n\t\t\t\t\talert('Deleted ' + msg + ' users');\r\n\t\t\t\telse\r\n\t\t\t\t\talert('Inserted ' + msg + ' users');\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n});"],"names":["String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","is","val","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","check_amount","new_check","unchecked","amount","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","location","href","end","hide","checked","spam","bad","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_delete_all_users","e","target","addClass","css","removeClass","ready","on","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","click","ct_check","accurate","JSON","stringify","ct_id","attr","fadeOut","remove","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","createElement","download","body","appendChild","ct_confirm_deletion_all"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,GAOX,IAAIS,aAHJC,SAASC,OAAS,oDAIjBC,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,aAAaD,iBAChCE,aAAmBD,aAAaC,aAChCC,aAAmBF,aAAaE,aAE7BC,kBAAoB,IACvBC,oBAAsB,EACtBC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QACLT,KAAMA,EACNU,QAAS,SAASC,GACjB,IAGKH,EAEAqF,EALiB,IAAlBtE,SAASZ,GACZwC,MAAMzF,aAAaoI,aAEftF,EAAMuF,IAAIC,gBAAgB,IAAIC,KAAK,CAACtF,MAEpCkF,EAAQ3I,SAASgJ,cAAc,MAC7BtE,KAAOpB,EACbqF,EAAMM,SAAWzI,aAAakI,gBAAkB,OAEhD1I,SAASkJ,KAAKC,YAAYR,GAC1BA,EAAMb,SAEPvF,OAAO,IAAM4D,EAAEC,OAAO9D,IAAIiE,YAAY,YACtChE,OAAO,YAAY+D,IAAI,aAAc,eAMxC/D,OAAO,oBAAoBuF,MAAM,SAAU3B,GAC1CyB,MAIDrF,OAAO,4BAA4BuF,MAAM,SAAU3B,GAClDyB,GAAiB,KAIlBrF,OAAO,wBAAwBuF,MAAM,SAAU3B,GAE9C,QAAO5B,QAAS/D,aAAa4I,+BAG7BlD,oBAAqBC"}
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -24,7 +24,8 @@ class CommentsChecker extends Checker
24
  'ct_prev_from' => !empty($prev_check['from']) ? $prev_check['from'] : false,
25
  'ct_prev_till' => !empty($prev_check['till']) ? $prev_check['till'] : false,
26
  'ct_timeout_confirm' => __('Failed from timeout. Going to check comments again.', 'cleantalk-spam-protect'),
27
- 'ct_confirm_deletion_all' => __('Delete all spam comments?', 'cleantalk-spam-protect'),
 
28
  'ct_comments_added_after' => __('comments', 'cleantalk-spam-protect'),
29
  'ct_status_string' => __('Checked %s, found %s spam comments and %s bad comments (without IP or email).', 'cleantalk-spam-protect'),
30
  'ct_status_string_warning' => '<p>'.__('Please do backup of WordPress database before delete any accounts!', 'cleantalk-spam-protect').'</p>',
@@ -461,7 +462,7 @@ class CommentsChecker extends Checker
461
 
462
  }
463
 
464
- public static function ct_ajax_delete_all(){
465
 
466
  check_ajax_referer( 'ct_secret_nonce', 'security' );
467
 
@@ -490,7 +491,43 @@ class CommentsChecker extends Checker
490
  $cnt_all = get_comments($args_spam);
491
 
492
  for( $i=0; $i < sizeof( $c_spam ); $i++ ){
493
- wp_delete_comment( $c_spam[$i]->comment_ID, false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
  usleep(10000);
495
  }
496
  print $cnt_all;
24
  'ct_prev_from' => !empty($prev_check['from']) ? $prev_check['from'] : false,
25
  'ct_prev_till' => !empty($prev_check['till']) ? $prev_check['till'] : false,
26
  'ct_timeout_confirm' => __('Failed from timeout. Going to check comments again.', 'cleantalk-spam-protect'),
27
+ 'ct_confirm_trash_all' => __('Trash all spam comments from the list?', 'cleantalk-spam-protect'),
28
+ 'ct_confirm_spam_all' => __('Mark as spam all comments from the list?', 'cleantalk-spam-protect'),
29
  'ct_comments_added_after' => __('comments', 'cleantalk-spam-protect'),
30
  'ct_status_string' => __('Checked %s, found %s spam comments and %s bad comments (without IP or email).', 'cleantalk-spam-protect'),
31
  'ct_status_string_warning' => '<p>'.__('Please do backup of WordPress database before delete any accounts!', 'cleantalk-spam-protect').'</p>',
462
 
463
  }
464
 
465
+ public static function ct_ajax_trash_all(){
466
 
467
  check_ajax_referer( 'ct_secret_nonce', 'security' );
468
 
491
  $cnt_all = get_comments($args_spam);
492
 
493
  for( $i=0; $i < sizeof( $c_spam ); $i++ ){
494
+ wp_trash_comment( $c_spam[$i]->comment_ID );
495
+ usleep(10000);
496
+ }
497
+ print $cnt_all;
498
+ die();
499
+ }
500
+
501
+ public static function ct_ajax_spam_all(){
502
+
503
+ check_ajax_referer( 'ct_secret_nonce', 'security' );
504
+
505
+ $args_spam = array(
506
+ 'number'=>100,
507
+ 'meta_query' => array(
508
+ array(
509
+ 'key' => 'ct_marked_as_spam',
510
+ 'value' => '1',
511
+ 'compare' => 'NUMERIC'
512
+ )
513
+ )
514
+ );
515
+ $c_spam = get_comments( $args_spam );
516
+
517
+ $args_spam = array(
518
+ 'count'=>true,
519
+ 'meta_query' => array(
520
+ Array(
521
+ 'key' => 'ct_marked_as_spam',
522
+ 'value' => '1',
523
+ 'compare' => 'NUMERIC'
524
+ )
525
+ )
526
+ );
527
+ $cnt_all = get_comments($args_spam);
528
+
529
+ for( $i=0; $i < sizeof( $c_spam ); $i++ ){
530
+ wp_spam_comment( $c_spam[$i]->comment_ID );
531
  usleep(10000);
532
  }
533
  print $cnt_all;
lib/Cleantalk/ApbctWP/FindSpam/ListTable/Comments.php CHANGED
@@ -100,7 +100,8 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
100
 
101
  $actions = array(
102
  'approve' => sprintf( '<span class="approve"><a href="?page=%s&action=%s&spam=%s">Approve</a></span>', $_REQUEST['page'],'approve', $id ),
103
- 'delete' => sprintf( '<a href="?page=%s&action=%s&spam=%s">Delete</a>', $_REQUEST['page'],'delete', $id ),
 
104
  );
105
 
106
  return sprintf( '%1$s %2$s', $column_content, $this->row_actions( $actions ) );
@@ -144,7 +145,8 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
144
 
145
  function get_bulk_actions() {
146
  $actions = array(
147
- 'delete' => 'Delete'
 
148
  );
149
  return $actions;
150
  }
@@ -158,8 +160,12 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
158
  if( ! wp_verify_nonce( $_POST['_wpnonce'], 'bulk-' . $this->_args['plural'] ) )
159
  wp_die('nonce error');
160
 
161
- if( 'delete' == $action ) {
162
- $this->removeSpam( $_POST['spamids'] );
 
 
 
 
163
  }
164
 
165
  }
@@ -175,10 +181,17 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
175
 
176
  }
177
 
178
- if( $_GET['action'] == 'delete' ) {
 
 
 
 
 
 
 
179
 
180
  $id = filter_input( INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT );
181
- $this->removeSpam( array( $id ) );
182
 
183
  }
184
 
@@ -208,13 +221,27 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
208
 
209
  }
210
 
211
- function removeSpam( $ids ) {
212
 
213
- $ids_string = implode( ', ', $ids );
214
- global $wpdb;
 
 
 
 
 
215
 
216
- $wpdb->query("DELETE FROM {$wpdb->comments} WHERE
217
- comment_ID IN ($ids_string)");
 
 
 
 
 
 
 
 
 
218
 
219
  }
220
 
100
 
101
  $actions = array(
102
  'approve' => sprintf( '<span class="approve"><a href="?page=%s&action=%s&spam=%s">Approve</a></span>', $_REQUEST['page'],'approve', $id ),
103
+ 'spam' => sprintf( '<span class="spam"><a href="?page=%s&action=%s&spam=%s">Spam</a></span>', $_REQUEST['page'],'spam', $id ),
104
+ 'trash' => sprintf( '<a href="?page=%s&action=%s&spam=%s">Trash</a>', $_REQUEST['page'],'trash', $id ),
105
  );
106
 
107
  return sprintf( '%1$s %2$s', $column_content, $this->row_actions( $actions ) );
145
 
146
  function get_bulk_actions() {
147
  $actions = array(
148
+ 'spam' => esc_html__( 'Mark as spam', 'cleantalk-spam-protect' ),
149
+ 'trash' => esc_html__( 'Move to trash', 'cleantalk-spam-protect' ),
150
  );
151
  return $actions;
152
  }
160
  if( ! wp_verify_nonce( $_POST['_wpnonce'], 'bulk-' . $this->_args['plural'] ) )
161
  wp_die('nonce error');
162
 
163
+ if( 'trash' == $action ) {
164
+ $this->moveToTrash( $_POST['spamids'] );
165
+ }
166
+
167
+ if( 'spam' == $action ) {
168
+ $this->moveToSpam( $_POST['spamids'] );
169
  }
170
 
171
  }
181
 
182
  }
183
 
184
+ if( $_GET['action'] == 'trash' ) {
185
+
186
+ $id = filter_input( INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT );
187
+ $this->moveToTrash( array( $id ) );
188
+
189
+ }
190
+
191
+ if( $_GET['action'] == 'spam' ) {
192
 
193
  $id = filter_input( INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT );
194
+ $this->moveToSpam( array( $id ) );
195
 
196
  }
197
 
221
 
222
  }
223
 
224
+ function moveToTrash( $ids ) {
225
 
226
+ if( ! empty( $ids ) ) {
227
+ foreach ( $ids as $id) {
228
+ delete_comment_meta( $id, 'ct_marked_as_spam' );
229
+ $comment = get_comment( $id );
230
+ wp_trash_comment( $comment );
231
+ }
232
+ }
233
 
234
+ }
235
+
236
+ function moveToSpam( $ids ) {
237
+
238
+ if( ! empty( $ids ) ) {
239
+ foreach ( $ids as $id) {
240
+ delete_comment_meta( $id, 'ct_marked_as_spam' );
241
+ $comment = get_comment( $id );
242
+ wp_spam_comment( $comment );
243
+ }
244
+ }
245
 
246
  }
247
 
lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php CHANGED
@@ -42,10 +42,12 @@ class CommentsScan extends Comments
42
 
43
  function extra_tablenav( $which ) {
44
  if( ! $this->has_items() ) return;
45
- $button_id = ($which) ? "ct_delete_all_$which" : "ct_delete_all";
 
46
  ?>
47
  <div class="alignleft actions bulkactions">
48
- <button type="button" id="<?php echo $button_id; ?>" class="button action ct_delete_all"><?php esc_html_e('Delete all comments from the list', 'cleantalk-spam-protect'); ?></button>
 
49
  <span class="spinner"></span>
50
  </div>
51
  <?php
42
 
43
  function extra_tablenav( $which ) {
44
  if( ! $this->has_items() ) return;
45
+ $button_id_spam = ($which) ? "ct_spam_all_$which" : "ct_spam_all";
46
+ $button_id_trash = ($which) ? "ct_trash_all_$which" : "ct_trash_all";
47
  ?>
48
  <div class="alignleft actions bulkactions">
49
+ <button type="button" id="<?php echo $button_id_spam; ?>" class="button action ct_spam_all"><?php esc_html_e('Mark as spam all comments from the list', 'cleantalk-spam-protect'); ?></button>
50
+ <button type="button" id="<?php echo $button_id_trash; ?>" class="button action ct_trash_all"><?php esc_html_e('Move to trash all comments from the list', 'cleantalk-spam-protect'); ?></button>
51
  <span class="spinner"></span>
52
  </div>
53
  <?php
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -484,7 +484,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
484
 
485
  for( $count_result = 0; current($lines) !== false; ) {
486
 
487
- $query = "INSERT INTO ".$db__table__data." VALUES ";
488
 
489
  for( $i = 0, $values = array(); APBCT_WRITE_LIMIT !== $i && current( $lines ) !== false; $i ++, $count_result ++, next( $lines ) ){
490
 
@@ -543,5 +543,6 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
543
  return array( 'error' => 'COULD_NOT_CLEAR_SFW_TABLE' ); // throw an error
544
  }
545
  }
 
546
  }
547
  }
484
 
485
  for( $count_result = 0; current($lines) !== false; ) {
486
 
487
+ $query = "INSERT INTO ".$db__table__data." (network, mask, status) VALUES ";
488
 
489
  for( $i = 0, $values = array(); APBCT_WRITE_LIMIT !== $i && current( $lines ) !== false; $i ++, $count_result ++, next( $lines ) ){
490
 
543
  return array( 'error' => 'COULD_NOT_CLEAR_SFW_TABLE' ); // throw an error
544
  }
545
  }
546
+ $db->execute( "ALTER TABLE {$db__table__data} AUTO_INCREMENT = 1;" ); // Drop AUTO INCREMENT
547
  }
548
  }
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -1,574 +1,577 @@
1
- <?php
2
-
3
- namespace Cleantalk\ApbctWP;
4
-
5
- use ArrayObject;
6
-
7
- /**
8
- * CleanTalk Antispam State class
9
- *
10
- * @package Antiospam Plugin by CleanTalk
11
- * @subpackage State
12
- * @Version 2.0
13
- * @author Cleantalk team (welcome@cleantalk.org)
14
- * @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
15
- * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
16
- */
17
-
18
- /**
19
- * COMMON
20
- *
21
- * @property string api_key
22
- *
23
- * STAND ALONE
24
- *
25
- * @property ArrayObject settings
26
- * @property ArrayObject data
27
- *
28
- * @property mixed moderate_ip
29
- * @property mixed|string plugin_version
30
- * @property mixed|string db_prefix
31
- * @property string settings_link
32
- * @property int key_is_ok
33
- * @property string logo__small__colored
34
- * @property string logo__small
35
- * @property string logo
36
- * @property string plugin_name
37
- * @property string base_name
38
- * @property array|mixed errors
39
- *
40
- * NETWORK
41
- * @property ArrayObject network_data
42
- * @property ArrayObject network_settings
43
- * @property mixed allow_custom_key
44
- * @property bool white_label
45
- * @property mixed moderate
46
- *
47
- * MISC
48
- *
49
- */
50
- class State
51
- {
52
- public $user = null;
53
- public $option_prefix = 'cleantalk';
54
- public $storage = array();
55
- public $integrations = array();
56
- public $def_settings = array(
57
-
58
- 'spam_firewall' => 1,
59
- 'sfw__anti_flood' => 0,
60
- 'sfw__anti_flood__view_limit' => 10,
61
- 'sfw__anti_crawler' => 0,
62
- 'apikey' => '',
63
- 'autoPubRevelantMess' => 0,
64
-
65
- /* Forms for protection */
66
- 'registrations_test' => 1,
67
- 'comments_test' => 1,
68
- 'contact_forms_test' => 1,
69
- 'general_contact_forms_test' => 1, // Antispam test for unsupported and untested contact forms
70
- 'wc_checkout_test' => 1, // WooCommerce checkout default test
71
- 'wc_register_from_order' => 1, // Woocommerce registration during checkout
72
- 'search_test' => 1, // Test deafult Wordpress form
73
- 'check_external' => 0,
74
- 'check_external__capture_buffer' => 0,
75
- 'check_internal' => 0,
76
-
77
- /* Comments and messages */
78
- 'disable_comments__all' => 0,
79
- 'disable_comments__posts' => 0,
80
- 'disable_comments__pages' => 0,
81
- 'disable_comments__media' => 0,
82
- 'bp_private_messages' => 1, //buddyPress private messages test => ON
83
- 'check_comments_number' => 1,
84
- 'remove_old_spam' => 0,
85
- 'remove_comments_links' => 0, // Removes links from approved comments
86
- 'show_check_links' => 1, // Shows check link to Cleantalk's DB.
87
- 'manage_comments_on_public_page' => 0, // Allows to control comments on public page.
88
-
89
- // Data processing
90
- 'protect_logged_in' => 1, // Do anit-spam tests to for logged in users.
91
- 'use_ajax' => 1,
92
- 'use_static_js_key' => -1,
93
- 'general_postdata_test' => 0, //CAPD
94
- 'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
95
- 'set_cookies__sessions'=> 0, // Use alt sessions for cookies.
96
- 'ssl_on' => 0, // Secure connection to servers
97
- 'use_buitin_http_api' => 1, // Using Wordpress HTTP built in API
98
-
99
- // Exclusions
100
- 'exclusions__urls' => '',
101
- 'exclusions__urls__use_regexp' => 0,
102
- 'exclusions__fields' => '',
103
- 'exclusions__fields__use_regexp' => 0,
104
- 'exclusions__roles' => array('Administrator'),
105
-
106
- // Administrator Panel
107
- 'show_adminbar' => 1, // Show the admin bar.
108
- 'all_time_counter' => 0,
109
- 'daily_counter' => 0,
110
- 'sfw_counter' => 0,
111
-
112
- //Others
113
- 'user_token' => '',
114
- 'collect_details' => 0, // Collect details about browser of the visitor.
115
- 'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
116
- 'async_js' => 0,
117
- 'debug_ajax' => 0,
118
-
119
- // GDPR
120
- 'gdpr_enabled' => 0,
121
- 'gdpr_text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
122
-
123
- // Msic
124
- 'store_urls' => 1,
125
- 'store_urls__sessions' => 1,
126
- 'comment_notify' => 1,
127
- 'comment_notify__roles' => array( 'administrator' ),
128
- 'complete_deactivation' => 0,
129
- 'dashboard_widget__show' => 1,
130
- );
131
-
132
- public $def_data = array(
133
-
134
- // Plugin data
135
- 'plugin_version' => APBCT_VERSION,
136
- 'js_keys' => array(), // Keys to do JavaScript antispam test
137
- 'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
138
- 'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
139
- 'last_remote_call' => 0, //Timestam of last remote call
140
-
141
- // Antispam
142
- 'spam_store_days' => 15, // Days before delete comments from folder Spam
143
- 'relevance_test' => 0, // Test comment for relevance
144
- 'notice_api_errors' => 0, // Send API error notices to WP admin
145
-
146
- // Account data
147
- 'service_id' => 0,
148
- 'moderate' => 0,
149
- 'moderate_ip' => 0,
150
- 'ip_license' => 0,
151
- 'spam_count' => 0,
152
- 'auto_update' => 0,
153
- 'user_token' => '', // User token for auto login into spam statistics
154
- 'license_trial' => 0,
155
-
156
- // Notices
157
- 'notice_show' => 0,
158
- 'notice_trial' => 0,
159
- 'notice_renew' => 0,
160
- 'notice_review' => 0,
161
- 'notice_auto_update' => 0,
162
-
163
- // Brief data
164
- 'brief_data' => array(
165
- 'spam_stat' => array(),
166
- 'top5_spam_ip' => array(),
167
- ),
168
-
169
- 'array_accepted' => array(),
170
- 'array_blocked' => array(),
171
- 'current_hour' => '',
172
- 'sfw_counter' => array(
173
- 'all' => 0,
174
- 'blocked' => 0,
175
- ),
176
- 'all_time_counter' => array(
177
- 'accepted' => 0,
178
- 'blocked' => 0,
179
- ),
180
- 'user_counter' => array(
181
- 'accepted' => 0,
182
- 'blocked' => 0,
183
- // 'since' => date('d M'),
184
- ),
185
- 'connection_reports' => array(
186
- 'success' => 0,
187
- 'negative' => 0,
188
- 'negative_report' => array(),
189
- // 'since' => date('d M'),
190
- ),
191
-
192
- // A-B tests
193
- 'ab_test' => array(
194
- 'sfw_enabled' => false,
195
- ),
196
-
197
- // Misc
198
- 'feedback_request' => '',
199
- 'key_is_ok' => 0,
200
- 'salt' => '',
201
- );
202
-
203
- public $def_network_settings = array(
204
-
205
- // Key
206
- 'apikey' => '',
207
- 'allow_custom_key' => 1,
208
- 'allow_custom_settings' => 1,
209
-
210
- // White label settings
211
- 'white_label' => 0,
212
- 'white_label__hoster_key' => '',
213
- 'white_label__plugin_name' => 'Anti-Spam by CleanTalk',
214
- 'use_settings_template' => 0,
215
- 'use_settings_template_apply_for_new' => 0,
216
- 'use_settings_template_apply_for_current' => 0,
217
- 'use_settings_template_apply_for_current_list_sites' => '',
218
- );
219
-
220
- public $def_network_data = array(
221
- 'key_is_ok' => 0,
222
- 'moderate' => 0,
223
- 'valid' => 0,
224
- 'user_token' => '',
225
- 'service_id' => 0,
226
- 'auto_update' => 0,
227
- );
228
-
229
- public $def_remote_calls = array(
230
- 'close_renew_banner' => array(
231
- 'last_call' => 0,
232
- ),
233
- 'sfw_update' => array(
234
- 'last_call' => 0,
235
- ),
236
- 'sfw_send_logs' => array(
237
- 'last_call' => 0,
238
- ),
239
- 'update_plugin' => array(
240
- 'last_call' => 0,
241
- ),
242
- 'install_plugin' => array(
243
- 'last_call' => 0,
244
- ),
245
- 'activate_plugin' => array(
246
- 'last_call' => 0,
247
- ),
248
- 'insert_auth_key' => array(
249
- 'last_call' => 0,
250
- ),
251
- 'deactivate_plugin' => array(
252
- 'last_call' => 0,
253
- ),
254
- 'uninstall_plugin' => array(
255
- 'last_call' => 0,
256
- ),
257
- 'update_settings' => array(
258
- 'last_call' => 0,
259
- ),
260
- );
261
-
262
- public $def_stats = array(
263
- 'sfw' => array(
264
- 'last_send_time' => 0,
265
- 'last_send_amount' => 0,
266
- 'last_update_time' => 0,
267
- 'entries' => 0,
268
- ),
269
- 'last_sfw_block' => array(
270
- 'time' => 0,
271
- 'ip' => '',
272
- ),
273
- 'last_request' => array(
274
- 'time' => 0,
275
- 'server' => '',
276
- ),
277
- 'requests' => array(
278
- '0' => array(
279
- 'amount' => 1,
280
- 'average_time' => 0,
281
- ),
282
- )
283
- );
284
-
285
- /**
286
- * @param string $option_prefix Database settings prefix
287
- * @param array $options Array of strings. Types of settings you want to get.
288
- */
289
- public function __construct($option_prefix, $options = array('settings'))
290
- {
291
- $this->option_prefix = $option_prefix;
292
-
293
- // Network settings
294
- $option = get_site_option($this->option_prefix.'_network_settings');
295
- $option = is_array($option) ? array_merge($this->def_network_settings, $option) : $this->def_network_settings;
296
- $this->network_settings = new ArrayObject($option);
297
-
298
- // Network data
299
- $option = get_site_option($this->option_prefix.'_network_data');
300
- $option = is_array($option) ? array_merge($this->def_network_data, $option) : $this->def_network_data;
301
- $this->network_data = new ArrayObject($option);
302
-
303
- foreach($options as $option_name){
304
-
305
- $option = get_option($this->option_prefix.'_'.$option_name);
306
-
307
- // Setting default options
308
- if($this->option_prefix.'_'.$option_name === 'cleantalk_settings'){
309
- $option = is_array($option) ? array_merge($this->def_settings, $option) : $this->def_settings;
310
- }
311
-
312
- // Setting default data
313
- if($this->option_prefix.'_'.$option_name === 'cleantalk_data'){
314
- $option = is_array($option) ? array_merge($this->def_data, $option) : $this->def_data;
315
- // Generate salt
316
- $option['salt'] = empty($option['salt'])
317
- ? str_pad(rand(0, getrandmax()), 6, '0').str_pad(rand(0, getrandmax()), 6, '0')
318
- : $option['salt'];
319
- }
320
-
321
- // Setting default errors
322
- if($this->option_prefix.'_'.$option_name === 'cleantalk_errors'){
323
- $option = $option ? $option : array();
324
- }
325
-
326
- // Default remote calls
327
- if($this->option_prefix.'_'.$option_name === 'cleantalk_remote_calls'){
328
- $option = is_array($option) ? array_merge($this->def_remote_calls, $option) : $this->def_remote_calls;
329
- }
330
-
331
- // Default statistics
332
- if($this->option_prefix.'_'.$option_name === 'cleantalk_stats'){
333
- $option = is_array($option) ? array_merge($this->def_stats, $option) : $this->def_stats;
334
- }
335
-
336
- $this->$option_name = is_array($option) ? new ArrayObject($option) : $option;
337
- }
338
- }
339
-
340
- /**
341
- * Get specified option from database
342
- *
343
- * @param string $option_name
344
- */
345
- private function getOption($option_name)
346
- {
347
- $option = get_option('cleantalk_'.$option_name, null);
348
- $this->$option_name = gettype($option) === 'array'
349
- ? new ArrayObject($option)
350
- : $option;
351
- }
352
-
353
- /**
354
- * Save option to database
355
- *
356
- * @param string $option_name
357
- * @param bool $use_prefix
358
- * @param bool $autoload Use autoload flag?
359
- */
360
- public function save($option_name, $use_prefix = true, $autoload = true)
361
- {
362
- $option_name_to_save = $use_prefix ? $this->option_prefix . '_' . $option_name : $option_name;
363
- $arr = array();
364
- foreach($this->$option_name as $key => $value){
365
- $arr[$key] = $value;
366
- }
367
- update_option($option_name_to_save, $arr, $autoload);
368
- }
369
-
370
- /**
371
- * Save PREFIX_setting to DB.
372
- */
373
- public function saveSettings()
374
- {
375
- update_option($this->option_prefix.'_settings', (array)$this->settings);
376
- }
377
-
378
- /**
379
- * Save PREFIX_data to DB.
380
- */
381
- public function saveData()
382
- {
383
- update_option($this->option_prefix.'_data', (array)$this->data);
384
- }
385
-
386
- /**
387
- * Save PREFIX_error to DB.
388
- */
389
- public function saveErrors()
390
- {
391
- update_option($this->option_prefix.'_errors', (array)$this->errors);
392
- }
393
-
394
- /**
395
- * Save PREFIX_network_data to DB.
396
- */
397
- public function saveNetworkData()
398
- {
399
- update_site_option($this->option_prefix.'_network_data', $this->network_data);
400
- }
401
-
402
- /**
403
- * Save PREFIX_network_data to DB.
404
- */
405
- public function saveNetworkSettings()
406
- {
407
- update_site_option($this->option_prefix.'_network_settings', $this->network_settings);
408
- }
409
-
410
- /**
411
- * Unset and delete option from DB.
412
- *
413
- * @param string $option_name
414
- * @param bool $use_prefix
415
- */
416
- public function deleteOption($option_name, $use_prefix = false)
417
- {
418
- if($this->__isset($option_name)){
419
- $this->__unset($option_name);
420
- delete_option( ($use_prefix ? $this->option_prefix.'_' : '') . $option_name);
421
- }
422
- }
423
-
424
- /**
425
- * Prepares an adds an error to the plugin's data
426
- *
427
- * @param string $type Error type/subtype
428
- * @param string|array $error Error
429
- * @param string $major_type Error major type
430
- * @param bool $set_time Do we need to set time of this error
431
- *
432
- * @returns null
433
- */
434
- public function error_add($type, $error, $major_type = null, $set_time = true)
435
- {
436
- $error = is_array($error)
437
- ? $error['error']
438
- : $error;
439
-
440
- // Exceptions
441
- if( ($type == 'send_logs' && $error == 'NO_LOGS_TO_SEND') ||
442
- ($type == 'send_firewall_logs' && $error == 'NO_LOGS_TO_SEND') ||
443
- $error == 'LOG_FILE_NOT_EXISTS'
444
- )
445
- return;
446
-
447
- $error = array(
448
- 'error' => $error,
449
- 'error_time' => $set_time ? current_time('timestamp') : null,
450
- );
451
-
452
- if(!empty($major_type)){
453
- $this->errors[$major_type][$type] = $error;
454
- }else{
455
- $this->errors[$type] = $error;
456
- }
457
-
458
- $this->saveErrors();
459
- }
460
-
461
- /**
462
- * Deletes an error from the plugin's data
463
- *
464
- * @param array|string $type Error type to delete
465
- * @param bool $save_flag Do we need to save data after error was deleted
466
- * @param string $major_type Error major type to delete
467
- *
468
- * @returns null
469
- */
470
- public function error_delete($type, $save_flag = false, $major_type = null)
471
- {
472
- /** @noinspection DuplicatedCode */
473
- if(is_string($type))
474
- $type = explode(' ', $type);
475
-
476
- foreach($type as $val){
477
- if($major_type){
478
- if(isset($this->errors[$major_type][$val]))
479
- unset($this->errors[$major_type][$val]);
480
- }else{
481
- if(isset($this->errors[$val]))
482
- unset($this->errors[$val]);
483
- }
484
- }
485
-
486
- // Save if flag is set and there are changes
487
- if($save_flag)
488
- $this->saveErrors();
489
- }
490
-
491
- /**
492
- * Deletes all errors from the plugin's data
493
- *
494
- * @param bool $save_flag Do we need to save data after all errors was deleted
495
- *
496
- * @returns null
497
- */
498
- public function error_delete_all($save_flag = false)
499
- {
500
- $this->errors = array();
501
- if($save_flag)
502
- $this->saveErrors();
503
- }
504
-
505
- /**
506
- * Magic.
507
- * Add new variables to storage[NEW_VARIABLE]
508
- * And duplicates it in storage['data'][NEW_VARIABLE]
509
- *
510
- * @param string $name
511
- * @param mixed $value
512
- */
513
- public function __set($name, $value)
514
- {
515
- $this->storage[$name] = $value;
516
- if(isset($this->storage['data'][$name])){
517
- $this->storage['data'][$name] = $value;
518
- }
519
- }
520
-
521
- /**
522
- * Magic.
523
- * Search and get param from: storage, data, api_key, database
524
- *
525
- * @param $name
526
- *
527
- * @return mixed
528
- */
529
- public function __get($name)
530
- {
531
- // First check in storage
532
- if (isset($this->storage[$name])){
533
- return $this->storage[$name];
534
-
535
- // Then in data
536
- }elseif(isset($this->storage['data'][$name])){
537
- $this->$name = $this->storage['data'][$name];
538
- return $this->storage['data'][$name];
539
-
540
- // Otherwise try to get it from db settings table
541
- // it will be arrayObject || scalar || null
542
- }else{
543
- $this->getOption($name);
544
- return $this->storage[$name];
545
- }
546
-
547
- }
548
-
549
- public function __isset($name)
550
- {
551
- return isset($this->storage[$name]);
552
- }
553
-
554
- public function __unset($name)
555
- {
556
- unset($this->storage[$name]);
557
- }
558
-
559
- public function server(){
560
- return \Cleantalk\Variables\Server::getInstance();
561
- }
562
- public function cookie(){
563
- return \Cleantalk\Variables\Cookie::getInstance();
564
- }
565
- public function request(){
566
- return \Cleantalk\Variables\Request::getInstance();
567
- }
568
- public function post(){
569
- return \Cleantalk\Variables\Post::getInstance();
570
- }
571
- public function get(){
572
- return \Cleantalk\Variables\Get::getInstance();
573
- }
574
- }
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ use ArrayObject;
6
+
7
+ /**
8
+ * CleanTalk Antispam State class
9
+ *
10
+ * @package Antiospam Plugin by CleanTalk
11
+ * @subpackage State
12
+ * @Version 2.0
13
+ * @author Cleantalk team (welcome@cleantalk.org)
14
+ * @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
15
+ * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
16
+ */
17
+
18
+ /**
19
+ * COMMON
20
+ *
21
+ * @property string api_key
22
+ *
23
+ * STAND ALONE
24
+ *
25
+ * @property ArrayObject settings
26
+ * @property ArrayObject data
27
+ * @property ArrayObject plugin_request_ids
28
+ *
29
+ * @property mixed moderate_ip
30
+ * @property mixed|string plugin_version
31
+ * @property mixed|string db_prefix
32
+ * @property string settings_link
33
+ * @property int key_is_ok
34
+ * @property string logo__small__colored
35
+ * @property string logo__small
36
+ * @property string logo
37
+ * @property string plugin_name
38
+ * @property string base_name
39
+ * @property string plugin_request_id
40
+ * @property array|mixed errors
41
+ *
42
+ * NETWORK
43
+ * @property ArrayObject network_data
44
+ * @property ArrayObject network_settings
45
+ * @property mixed allow_custom_key
46
+ * @property bool white_label
47
+ * @property mixed moderate
48
+ *
49
+ * MISC
50
+ *
51
+ */
52
+ class State
53
+ {
54
+ public $user = null;
55
+ public $option_prefix = 'cleantalk';
56
+ public $storage = array();
57
+ public $integrations = array();
58
+ public $def_settings = array(
59
+
60
+ 'spam_firewall' => 1,
61
+ 'sfw__anti_flood' => 0,
62
+ 'sfw__anti_flood__view_limit' => 10,
63
+ 'sfw__anti_crawler' => 0,
64
+ 'apikey' => '',
65
+ 'autoPubRevelantMess' => 0,
66
+
67
+ /* Forms for protection */
68
+ 'registrations_test' => 1,
69
+ 'comments_test' => 1,
70
+ 'contact_forms_test' => 1,
71
+ 'general_contact_forms_test' => 1, // Antispam test for unsupported and untested contact forms
72
+ 'wc_checkout_test' => 1, // WooCommerce checkout default test
73
+ 'wc_register_from_order' => 1, // Woocommerce registration during checkout
74
+ 'search_test' => 1, // Test deafult Wordpress form
75
+ 'check_external' => 0,
76
+ 'check_external__capture_buffer' => 0,
77
+ 'check_internal' => 0,
78
+
79
+ /* Comments and messages */
80
+ 'disable_comments__all' => 0,
81
+ 'disable_comments__posts' => 0,
82
+ 'disable_comments__pages' => 0,
83
+ 'disable_comments__media' => 0,
84
+ 'bp_private_messages' => 1, //buddyPress private messages test => ON
85
+ 'check_comments_number' => 1,
86
+ 'remove_old_spam' => 0,
87
+ 'remove_comments_links' => 0, // Removes links from approved comments
88
+ 'show_check_links' => 1, // Shows check link to Cleantalk's DB.
89
+ 'manage_comments_on_public_page' => 0, // Allows to control comments on public page.
90
+
91
+ // Data processing
92
+ 'protect_logged_in' => 1, // Do anit-spam tests to for logged in users.
93
+ 'use_ajax' => 1,
94
+ 'use_static_js_key' => -1,
95
+ 'general_postdata_test' => 0, //CAPD
96
+ 'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
97
+ 'set_cookies__sessions'=> 0, // Use alt sessions for cookies.
98
+ 'ssl_on' => 0, // Secure connection to servers
99
+ 'use_buitin_http_api' => 1, // Using Wordpress HTTP built in API
100
+
101
+ // Exclusions
102
+ 'exclusions__urls' => '',
103
+ 'exclusions__urls__use_regexp' => 0,
104
+ 'exclusions__fields' => '',
105
+ 'exclusions__fields__use_regexp' => 0,
106
+ 'exclusions__roles' => array('Administrator'),
107
+
108
+ // Administrator Panel
109
+ 'show_adminbar' => 1, // Show the admin bar.
110
+ 'all_time_counter' => 0,
111
+ 'daily_counter' => 0,
112
+ 'sfw_counter' => 0,
113
+
114
+ //Others
115
+ 'user_token' => '',
116
+ 'collect_details' => 0, // Collect details about browser of the visitor.
117
+ 'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
118
+ 'async_js' => 0,
119
+ 'debug_ajax' => 0,
120
+
121
+ // GDPR
122
+ 'gdpr_enabled' => 0,
123
+ 'gdpr_text' => 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
124
+
125
+ // Msic
126
+ 'store_urls' => 1,
127
+ 'store_urls__sessions' => 1,
128
+ 'comment_notify' => 1,
129
+ 'comment_notify__roles' => array( 'administrator' ),
130
+ 'complete_deactivation' => 0,
131
+ 'dashboard_widget__show' => 1,
132
+ );
133
+
134
+ public $def_data = array(
135
+
136
+ // Plugin data
137
+ 'plugin_version' => APBCT_VERSION,
138
+ 'js_keys' => array(), // Keys to do JavaScript antispam test
139
+ 'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
140
+ 'js_key_lifetime' => 86400, // JavaScript key life time in seconds - 1 day now
141
+ 'last_remote_call' => 0, //Timestam of last remote call
142
+
143
+ // Antispam
144
+ 'spam_store_days' => 15, // Days before delete comments from folder Spam
145
+ 'relevance_test' => 0, // Test comment for relevance
146
+ 'notice_api_errors' => 0, // Send API error notices to WP admin
147
+
148
+ // Account data
149
+ 'service_id' => 0,
150
+ 'moderate' => 0,
151
+ 'moderate_ip' => 0,
152
+ 'ip_license' => 0,
153
+ 'spam_count' => 0,
154
+ 'auto_update' => 0,
155
+ 'user_token' => '', // User token for auto login into spam statistics
156
+ 'license_trial' => 0,
157
+
158
+ // Notices
159
+ 'notice_show' => 0,
160
+ 'notice_trial' => 0,
161
+ 'notice_renew' => 0,
162
+ 'notice_review' => 0,
163
+ 'notice_auto_update' => 0,
164
+
165
+ // Brief data
166
+ 'brief_data' => array(
167
+ 'spam_stat' => array(),
168
+ 'top5_spam_ip' => array(),
169
+ ),
170
+
171
+ 'array_accepted' => array(),
172
+ 'array_blocked' => array(),
173
+ 'current_hour' => '',
174
+ 'sfw_counter' => array(
175
+ 'all' => 0,
176
+ 'blocked' => 0,
177
+ ),
178
+ 'all_time_counter' => array(
179
+ 'accepted' => 0,
180
+ 'blocked' => 0,
181
+ ),
182
+ 'user_counter' => array(
183
+ 'accepted' => 0,
184
+ 'blocked' => 0,
185
+ // 'since' => date('d M'),
186
+ ),
187
+ 'connection_reports' => array(
188
+ 'success' => 0,
189
+ 'negative' => 0,
190
+ 'negative_report' => array(),
191
+ // 'since' => date('d M'),
192
+ ),
193
+
194
+ // A-B tests
195
+ 'ab_test' => array(
196
+ 'sfw_enabled' => false,
197
+ ),
198
+
199
+ // Misc
200
+ 'feedback_request' => '',
201
+ 'key_is_ok' => 0,
202
+ 'salt' => '',
203
+ );
204
+
205
+ public $def_network_settings = array(
206
+
207
+ // Key
208
+ 'apikey' => '',
209
+ 'allow_custom_key' => 1,
210
+ 'allow_custom_settings' => 1,
211
+
212
+ // White label settings
213
+ 'white_label' => 0,
214
+ 'white_label__hoster_key' => '',
215
+ 'white_label__plugin_name' => 'Anti-Spam by CleanTalk',
216
+ 'use_settings_template' => 0,
217
+ 'use_settings_template_apply_for_new' => 0,
218
+ 'use_settings_template_apply_for_current' => 0,
219
+ 'use_settings_template_apply_for_current_list_sites' => '',
220
+ );
221
+
222
+ public $def_network_data = array(
223
+ 'key_is_ok' => 0,
224
+ 'moderate' => 0,
225
+ 'valid' => 0,
226
+ 'user_token' => '',
227
+ 'service_id' => 0,
228
+ 'auto_update' => 0,
229
+ );
230
+
231
+ public $def_remote_calls = array(
232
+ 'close_renew_banner' => array(
233
+ 'last_call' => 0,
234
+ ),
235
+ 'sfw_update' => array(
236
+ 'last_call' => 0,
237
+ ),
238
+ 'sfw_send_logs' => array(
239
+ 'last_call' => 0,
240
+ ),
241
+ 'update_plugin' => array(
242
+ 'last_call' => 0,
243
+ ),
244
+ 'install_plugin' => array(
245
+ 'last_call' => 0,
246
+ ),
247
+ 'activate_plugin' => array(
248
+ 'last_call' => 0,
249
+ ),
250
+ 'insert_auth_key' => array(
251
+ 'last_call' => 0,
252
+ ),
253
+ 'deactivate_plugin' => array(
254
+ 'last_call' => 0,
255
+ ),
256
+ 'uninstall_plugin' => array(
257
+ 'last_call' => 0,
258
+ ),
259
+ 'update_settings' => array(
260
+ 'last_call' => 0,
261
+ ),
262
+ );
263
+
264
+ public $def_stats = array(
265
+ 'sfw' => array(
266
+ 'last_send_time' => 0,
267
+ 'last_send_amount' => 0,
268
+ 'last_update_time' => 0,
269
+ 'entries' => 0,
270
+ ),
271
+ 'last_sfw_block' => array(
272
+ 'time' => 0,
273
+ 'ip' => '',
274
+ ),
275
+ 'last_request' => array(
276
+ 'time' => 0,
277
+ 'server' => '',
278
+ ),
279
+ 'requests' => array(
280
+ '0' => array(
281
+ 'amount' => 1,
282
+ 'average_time' => 0,
283
+ ),
284
+ )
285
+ );
286
+
287
+ /**
288
+ * @param string $option_prefix Database settings prefix
289
+ * @param array $options Array of strings. Types of settings you want to get.
290
+ */
291
+ public function __construct($option_prefix, $options = array('settings'))
292
+ {
293
+ $this->option_prefix = $option_prefix;
294
+
295
+ // Network settings
296
+ $option = get_site_option($this->option_prefix.'_network_settings');
297
+ $option = is_array($option) ? array_merge($this->def_network_settings, $option) : $this->def_network_settings;
298
+ $this->network_settings = new ArrayObject($option);
299
+
300
+ // Network data
301
+ $option = get_site_option($this->option_prefix.'_network_data');
302
+ $option = is_array($option) ? array_merge($this->def_network_data, $option) : $this->def_network_data;
303
+ $this->network_data = new ArrayObject($option);
304
+
305
+ foreach($options as $option_name){
306
+
307
+ $option = get_option($this->option_prefix.'_'.$option_name);
308
+
309
+ // Setting default options
310
+ if($this->option_prefix.'_'.$option_name === 'cleantalk_settings'){
311
+ $option = is_array($option) ? array_merge($this->def_settings, $option) : $this->def_settings;
312
+ }
313
+
314
+ // Setting default data
315
+ if($this->option_prefix.'_'.$option_name === 'cleantalk_data'){
316
+ $option = is_array($option) ? array_merge($this->def_data, $option) : $this->def_data;
317
+ // Generate salt
318
+ $option['salt'] = empty($option['salt'])
319
+ ? str_pad(rand(0, getrandmax()), 6, '0').str_pad(rand(0, getrandmax()), 6, '0')
320
+ : $option['salt'];
321
+ }
322
+
323
+ // Setting default errors
324
+ if($this->option_prefix.'_'.$option_name === 'cleantalk_errors'){
325
+ $option = $option ? $option : array();
326
+ }
327
+
328
+ // Default remote calls
329
+ if($this->option_prefix.'_'.$option_name === 'cleantalk_remote_calls'){
330
+ $option = is_array($option) ? array_merge($this->def_remote_calls, $option) : $this->def_remote_calls;
331
+ }
332
+
333
+ // Default statistics
334
+ if($this->option_prefix.'_'.$option_name === 'cleantalk_stats'){
335
+ $option = is_array($option) ? array_merge($this->def_stats, $option) : $this->def_stats;
336
+ }
337
+
338
+ $this->$option_name = is_array($option) ? new ArrayObject($option) : $option;
339
+ }
340
+ }
341
+
342
+ /**
343
+ * Get specified option from database
344
+ *
345
+ * @param string $option_name
346
+ */
347
+ private function getOption($option_name)
348
+ {
349
+ $option = get_option('cleantalk_'.$option_name, null);
350
+
351
+ $this->$option_name = gettype($option) === 'array'
352
+ ? new ArrayObject($option)
353
+ : $option;
354
+ }
355
+
356
+ /**
357
+ * Save option to database
358
+ *
359
+ * @param string $option_name
360
+ * @param bool $use_prefix
361
+ * @param bool $autoload Use autoload flag?
362
+ */
363
+ public function save($option_name, $use_prefix = true, $autoload = true)
364
+ {
365
+ $option_name_to_save = $use_prefix ? $this->option_prefix . '_' . $option_name : $option_name;
366
+ $arr = array();
367
+ foreach($this->$option_name as $key => $value){
368
+ $arr[$key] = $value;
369
+ }
370
+ update_option($option_name_to_save, $arr, $autoload);
371
+ }
372
+
373
+ /**
374
+ * Save PREFIX_setting to DB.
375
+ */
376
+ public function saveSettings()
377
+ {
378
+ update_option($this->option_prefix.'_settings', (array)$this->settings);
379
+ }
380
+
381
+ /**
382
+ * Save PREFIX_data to DB.
383
+ */
384
+ public function saveData()
385
+ {
386
+ update_option($this->option_prefix.'_data', (array)$this->data);
387
+ }
388
+
389
+ /**
390
+ * Save PREFIX_error to DB.
391
+ */
392
+ public function saveErrors()
393
+ {
394
+ update_option($this->option_prefix.'_errors', (array)$this->errors);
395
+ }
396
+
397
+ /**
398
+ * Save PREFIX_network_data to DB.
399
+ */
400
+ public function saveNetworkData()
401
+ {
402
+ update_site_option($this->option_prefix.'_network_data', $this->network_data);
403
+ }
404
+
405
+ /**
406
+ * Save PREFIX_network_data to DB.
407
+ */
408
+ public function saveNetworkSettings()
409
+ {
410
+ update_site_option($this->option_prefix.'_network_settings', $this->network_settings);
411
+ }
412
+
413
+ /**
414
+ * Unset and delete option from DB.
415
+ *
416
+ * @param string $option_name
417
+ * @param bool $use_prefix
418
+ */
419
+ public function deleteOption($option_name, $use_prefix = false)
420
+ {
421
+ if($this->__isset($option_name)){
422
+ $this->__unset($option_name);
423
+ delete_option( ($use_prefix ? $this->option_prefix.'_' : '') . $option_name);
424
+ }
425
+ }
426
+
427
+ /**
428
+ * Prepares an adds an error to the plugin's data
429
+ *
430
+ * @param string $type Error type/subtype
431
+ * @param string|array $error Error
432
+ * @param string $major_type Error major type
433
+ * @param bool $set_time Do we need to set time of this error
434
+ *
435
+ * @returns null
436
+ */
437
+ public function error_add($type, $error, $major_type = null, $set_time = true)
438
+ {
439
+ $error = is_array($error)
440
+ ? $error['error']
441
+ : $error;
442
+
443
+ // Exceptions
444
+ if( ($type == 'send_logs' && $error == 'NO_LOGS_TO_SEND') ||
445
+ ($type == 'send_firewall_logs' && $error == 'NO_LOGS_TO_SEND') ||
446
+ $error == 'LOG_FILE_NOT_EXISTS'
447
+ )
448
+ return;
449
+
450
+ $error = array(
451
+ 'error' => $error,
452
+ 'error_time' => $set_time ? current_time('timestamp') : null,
453
+ );
454
+
455
+ if(!empty($major_type)){
456
+ $this->errors[$major_type][$type] = $error;
457
+ }else{
458
+ $this->errors[$type] = $error;
459
+ }
460
+
461
+ $this->saveErrors();
462
+ }
463
+
464
+ /**
465
+ * Deletes an error from the plugin's data
466
+ *
467
+ * @param array|string $type Error type to delete
468
+ * @param bool $save_flag Do we need to save data after error was deleted
469
+ * @param string $major_type Error major type to delete
470
+ *
471
+ * @returns null
472
+ */
473
+ public function error_delete($type, $save_flag = false, $major_type = null)
474
+ {
475
+ /** @noinspection DuplicatedCode */
476
+ if(is_string($type))
477
+ $type = explode(' ', $type);
478
+
479
+ foreach($type as $val){
480
+ if($major_type){
481
+ if(isset($this->errors[$major_type][$val]))
482
+ unset($this->errors[$major_type][$val]);
483
+ }else{
484
+ if(isset($this->errors[$val]))
485
+ unset($this->errors[$val]);
486
+ }
487
+ }
488
+
489
+ // Save if flag is set and there are changes
490
+ if($save_flag)
491
+ $this->saveErrors();
492
+ }
493
+
494
+ /**
495
+ * Deletes all errors from the plugin's data
496
+ *
497
+ * @param bool $save_flag Do we need to save data after all errors was deleted
498
+ *
499
+ * @returns null
500
+ */
501
+ public function error_delete_all($save_flag = false)
502
+ {
503
+ $this->errors = array();
504
+ if($save_flag)
505
+ $this->saveErrors();
506
+ }
507
+
508
+ /**
509
+ * Magic.
510
+ * Add new variables to storage[NEW_VARIABLE]
511
+ * And duplicates it in storage['data'][NEW_VARIABLE]
512
+ *
513
+ * @param string $name
514
+ * @param mixed $value
515
+ */
516
+ public function __set($name, $value)
517
+ {
518
+ $this->storage[$name] = $value;
519
+ if(isset($this->storage['data'][$name])){
520
+ $this->storage['data'][$name] = $value;
521
+ }
522
+ }
523
+
524
+ /**
525
+ * Magic.
526
+ * Search and get param from: storage, data, api_key, database
527
+ *
528
+ * @param $name
529
+ *
530
+ * @return mixed
531
+ */
532
+ public function __get($name)
533
+ {
534
+ // First check in storage
535
+ if (isset($this->storage[$name])){
536
+ return $this->storage[$name];
537
+
538
+ // Then in data
539
+ }elseif(isset($this->storage['data'][$name])){
540
+ $this->$name = $this->storage['data'][$name];
541
+ return $this->storage['data'][$name];
542
+
543
+ // Otherwise try to get it from db settings table
544
+ // it will be arrayObject || scalar || null
545
+ }else{
546
+ $this->getOption($name);
547
+ return $this->storage[$name];
548
+ }
549
+
550
+ }
551
+
552
+ public function __isset($name)
553
+ {
554
+ return isset($this->storage[$name]);
555
+ }
556
+
557
+ public function __unset($name)
558
+ {
559
+ unset($this->storage[$name]);
560
+ }
561
+
562
+ public function server(){
563
+ return \Cleantalk\Variables\Server::getInstance();
564
+ }
565
+ public function cookie(){
566
+ return \Cleantalk\Variables\Cookie::getInstance();
567
+ }
568
+ public function request(){
569
+ return \Cleantalk\Variables\Request::getInstance();
570
+ }
571
+ public function post(){
572
+ return \Cleantalk\Variables\Post::getInstance();
573
+ }
574
+ public function get(){
575
+ return \Cleantalk\Variables\Get::getInstance();
576
+ }
577
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Spam protection, AntiSpam, FireWall by CleanTalk ===
2
  Contributors: safronik
3
- Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.5
6
  Requires PHP: 5.4
7
- Stable tag: 5.146.1
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -194,6 +194,7 @@ our own CleanTalk Cloud Service. Anti Spam by CleanTalk offers a free trial, you
194
 
195
  = Additional features =
196
  * Daily and weekly detailed anti-spam reports: traffic VS spam.
 
197
  * AntiSpam apps for most popular CMS on cleantalk.org.
198
 
199
  = How to protect sites from spam bots without CAPTCHA? =
@@ -316,6 +317,11 @@ In WordPress multisite version you can switch the plugin to use Global Access ke
316
  **Make it before you activated the plugin. If the plugin already activated, deactivate it and add the code and active it again.**
317
  Now, all subsites will have this access key.
318
 
 
 
 
 
 
319
  == Frequently Asked Questions ==
320
 
321
  = Why are they spamming me? =
@@ -574,6 +580,21 @@ If your website has forms that send data to external sources, you can enable opt
574
 
575
  == Changelog ==
576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  = 5.146.1 Sep 23 2020 =
578
  * Fix: URL exclusions setting.
579
  * Fix: Login scripts output fixed.
1
  === Spam protection, AntiSpam, FireWall by CleanTalk ===
2
  Contributors: safronik
3
+ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.5
6
  Requires PHP: 5.4
7
+ Stable tag: 5.147
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
194
 
195
  = Additional features =
196
  * Daily and weekly detailed anti-spam reports: traffic VS spam.
197
+ * Apps for iPhone, Android to control anti-spam service, comments, signups, contacts, traffic and spam stats for the last 7 days.
198
  * AntiSpam apps for most popular CMS on cleantalk.org.
199
 
200
  = How to protect sites from spam bots without CAPTCHA? =
317
  **Make it before you activated the plugin. If the plugin already activated, deactivate it and add the code and active it again.**
318
  Now, all subsites will have this access key.
319
 
320
+ = Manage and control spam protection =
321
+
322
+ Go to <a href="https://cleantalk.org/my" target="_blank">Dashboard</a> at the cleantalk.org or use <a href="https://play.google.com/store/apps/details?id=org.cleantalk.app">Android</a>, <a href="https://itunes.apple.com/us/app/cleantalk/id825479913?mt=8">iPhone</a> anti-spam app to manage and control spam protection.
323
+
324
+
325
  == Frequently Asked Questions ==
326
 
327
  = Why are they spamming me? =
580
 
581
  == Changelog ==
582
 
583
+ = 5.147 Oct 08 2020 =
584
+ * Fix: WPForms. Auto submitting.
585
+ * Fix: Synchronization timeout increased to 25 seconds.
586
+ * Fix: Cookiebot compatibility.
587
+ * Fix: Visible fields logic fixed.
588
+ * New: Duplicated requests prevention.
589
+ * Fix: SpamFireWall auto incremental uses primary key.
590
+ * Fix: Skip woocommerce internal request.
591
+ * Upd: Url exclusions option updated.
592
+ * Fix: Checking comments/users - redirecting after deleting all items fixed.
593
+ * New: Comments scanner - marking as spam action implemented.
594
+ * Fix: SFW table fixed.
595
+ * Upd: Comments scanner - moving to trash instead deleting.
596
+ * Upd: Visible fields collecting functionality updated.
597
+
598
  = 5.146.1 Sep 23 2020 =
599
  * Fix: URL exclusions setting.
600
  * Fix: Login scripts output fixed.