Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.173

Version Description

Mar 03 2022 =

Honeypot field implemented for improving antispam protection, new integrations added, performance improved and minor issues fixed.

  • New. Honeypot field for the registration form.
  • New. Integration. Added Visual Form Builder Integration without Ajax.
  • New. Integration. GiveWP integration implemented.
  • Upd. Code. Helper::ipGet() improved.
  • Upd. Settings. Honeypot setting modified.
  • Fix: Formidable Integration Refactoring.
  • Fix. Integration. Fusion Avada Form Builder output fixed.
  • Fix. Settings. Honeypot setting descriptions fixed.
  • Fix: Skipped WP Booking System Premius service requests
  • Fix. Exclusion. Checkout For WC - service requests skip.
  • Fix. Comments checker. Found comments displaying optimized.
  • Fix: visible fields was excluded form custom form.
Download this release

Release Info

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

Code changes from version 5.172 to 5.173

cleantalk.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Anti-Spam by CleanTalk
5
  Plugin URI: https://cleantalk.org
6
  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.
7
- Version: 5.172
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -27,6 +27,7 @@ use Cleantalk\ApbctWP\Helper;
27
  use Cleantalk\ApbctWP\RemoteCalls;
28
  use Cleantalk\ApbctWP\RestController;
29
  use Cleantalk\ApbctWP\State;
 
30
  use Cleantalk\ApbctWP\UpdatePlugin\DbTablesCreator;
31
  use Cleantalk\ApbctWP\Variables\Cookie;
32
  use Cleantalk\Common\DNS;
@@ -301,11 +302,6 @@ $apbct_active_integrations = array(
301
  'setting' => 'forms__contact_forms_test',
302
  'ajax' => true
303
  ),
304
- 'HappyForm' => array(
305
- 'hook' => 'happyforms_validate_submission',
306
- 'setting' => 'forms__contact_forms_test',
307
- 'ajax' => false
308
- ),
309
  'EaelLoginRegister' => array(
310
  'hook' => array(
311
  'eael/login-register/before-register',
@@ -325,6 +321,16 @@ $apbct_active_integrations = array(
325
  'setting' => 'forms__registrations_test',
326
  'ajax' => false
327
  ),
 
 
 
 
 
 
 
 
 
 
328
  );
329
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
330
 
@@ -376,6 +382,9 @@ add_filter('wppb_output_field_errors_filter', 'apbct_form_profile_builder__check
376
  // WP Foro register system integration
377
  add_filter('wpforo_create_profile', 'wpforo_create_profile__check_register', 1, 1);
378
 
 
 
 
379
  // WPForms
380
  // Adding fields
381
  add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
@@ -2682,6 +2691,11 @@ function apbct_update_actions()
2682
 
2683
  // Update logic
2684
  if ( $apbct->plugin_version !== APBCT_VERSION ) {
 
 
 
 
 
2685
  // Main blog
2686
  if ( is_main_site() ) {
2687
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-updater.php');
4
  Plugin Name: Anti-Spam by CleanTalk
5
  Plugin URI: https://cleantalk.org
6
  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.
7
+ Version: 5.173
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
27
  use Cleantalk\ApbctWP\RemoteCalls;
28
  use Cleantalk\ApbctWP\RestController;
29
  use Cleantalk\ApbctWP\State;
30
+ use Cleantalk\ApbctWP\Transaction;
31
  use Cleantalk\ApbctWP\UpdatePlugin\DbTablesCreator;
32
  use Cleantalk\ApbctWP\Variables\Cookie;
33
  use Cleantalk\Common\DNS;
302
  'setting' => 'forms__contact_forms_test',
303
  'ajax' => true
304
  ),
 
 
 
 
 
305
  'EaelLoginRegister' => array(
306
  'hook' => array(
307
  'eael/login-register/before-register',
321
  'setting' => 'forms__registrations_test',
322
  'ajax' => false
323
  ),
324
+ 'GiveWP' => array(
325
+ 'hook' => 'give_checkout_error_checks',
326
+ 'setting' => 'forms__contact_forms_test',
327
+ 'ajax' => false
328
+ ),
329
+ 'VisualFormBuilder' => array(
330
+ 'hook' => 'vfb_isBot',
331
+ 'setting' => 'forms__contact_forms_test',
332
+ 'ajax' => false
333
+ ),
334
  );
335
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
336
 
382
  // WP Foro register system integration
383
  add_filter('wpforo_create_profile', 'wpforo_create_profile__check_register', 1, 1);
384
 
385
+ // HappyForms integration
386
+ add_filter('happyforms_validate_submission', 'apbct_form_happyforms_test_spam', 1, 3);
387
+
388
  // WPForms
389
  // Adding fields
390
  add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
2691
 
2692
  // Update logic
2693
  if ( $apbct->plugin_version !== APBCT_VERSION ) {
2694
+ // Perform a transaction and exit transaction ID isn't match
2695
+ if ( ! Transaction::get('updater')->perform() ) {
2696
+ return;
2697
+ }
2698
+
2699
  // Main blog
2700
  if ( is_main_site() ) {
2701
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-updater.php');
inc/cleantalk-ajax.php CHANGED
@@ -351,8 +351,6 @@ function ct_ajax_hook($message_obj = null)
351
  // WooCommerce cartflow
352
  'rcp_process_register_form',
353
  // WordPress Membership Plugin – Restrict Content
354
- 'give_process_donation',
355
- // GiveWP
356
  'apus_ajax_login',
357
  // ???? plugin authorization
358
  'bookly_save_customer',
@@ -930,6 +928,17 @@ function ct_ajax_hook($message_obj = null)
930
  );
931
  }
932
 
 
 
 
 
 
 
 
 
 
 
 
933
  // Regular block output
934
  die(
935
  json_encode(
351
  // WooCommerce cartflow
352
  'rcp_process_register_form',
353
  // WordPress Membership Plugin – Restrict Content
 
 
354
  'apus_ajax_login',
355
  // ???? plugin authorization
356
  'bookly_save_customer',
928
  );
929
  }
930
 
931
+ if ( Post::hasString('action', 'fusion_form_submit_form_to_') ) {
932
+ die(
933
+ json_encode(
934
+ array(
935
+ 'status' => 'error',
936
+ 'info' => $ct_result->comment
937
+ )
938
+ )
939
+ );
940
+ }
941
+
942
  // Regular block output
943
  die(
944
  json_encode(
inc/cleantalk-common.php CHANGED
@@ -206,6 +206,18 @@ function apbct_base_call($params = array(), $reg_flag = false)
206
  if ( isset($params['honeypot_field']) ) {
207
  $default_params['honeypot_field'] = $params['honeypot_field'];
208
  }
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  // Send $_SERVER if couldn't find IP
211
  if ( empty($default_params['sender_ip']) ) {
@@ -1191,7 +1203,7 @@ function apbct__styles_if_website_hidden()
1191
  echo $styles;
1192
  }
1193
 
1194
- if ( $apbct->settings['forms__wc_honeypot'] ) {
1195
  $styles = "
1196
  <style>
1197
  .wc_apbct_email_id {
@@ -1211,7 +1223,7 @@ function apbct__wc_add_honeypot_field($fields)
1211
  {
1212
  global $apbct;
1213
 
1214
- if ( $apbct->settings['forms__wc_honeypot'] ) {
1215
  $fields['billing']['wc_apbct_email_id'] = array(
1216
  'id' => 'wc_apbct_email_id',
1217
  'type' => 'text',
206
  if ( isset($params['honeypot_field']) ) {
207
  $default_params['honeypot_field'] = $params['honeypot_field'];
208
  }
209
+ /**
210
+ * Add honeypot_field to $base_call_data is forms__wc_honeypot on
211
+ */
212
+ if ( $apbct->settings['data__honeypot_field'] ) {
213
+ $honeypot_field = 1;
214
+
215
+ if ( Post::get('wc_apbct_email_id') || Post::get('apbct__email_id__wp_register') ) {
216
+ $honeypot_field = 0;
217
+ }
218
+
219
+ $params['honeypot_field'] = $honeypot_field;
220
+ }
221
 
222
  // Send $_SERVER if couldn't find IP
223
  if ( empty($default_params['sender_ip']) ) {
1203
  echo $styles;
1204
  }
1205
 
1206
+ if ( $apbct->settings['data__honeypot_field'] ) {
1207
  $styles = "
1208
  <style>
1209
  .wc_apbct_email_id {
1223
  {
1224
  global $apbct;
1225
 
1226
+ if ( $apbct->settings['data__honeypot_field'] ) {
1227
  $fields['billing']['wc_apbct_email_id'] = array(
1228
  'id' => 'wc_apbct_email_id',
1229
  'type' => 'text',
inc/cleantalk-pluggable.php CHANGED
@@ -796,6 +796,21 @@ function apbct_is_skip_request($ajax = false)
796
  ) {
797
  return 'AdRotate service actions';
798
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
799
  } else {
800
  /*****************************************/
801
  /* Here is non-ajax requests skipping */
@@ -891,6 +906,15 @@ function apbct_is_skip_request($ajax = false)
891
  ) {
892
  return 'WSForms skip';
893
  }
 
 
 
 
 
 
 
 
 
894
  }
895
 
896
  return false;
796
  ) {
797
  return 'AdRotate service actions';
798
  }
799
+ // WP Booking System Premium
800
+ if (
801
+ (apbct_is_plugin_active('wp-booking-system-premium/index.php') &&
802
+ Post::get('action') === 'wpbs_calculate_pricing') ||
803
+ Post::get('action') === 'wpbs_validate_date_selection'
804
+ ) {
805
+ return 'WP Booking System Premium';
806
+ }
807
+ // GiveWP - having the direct integration
808
+ if (
809
+ (apbct_is_plugin_active('give/give.php') &&
810
+ Post::get('action') === 'give_process_donation')
811
+ ) {
812
+ return 'GiveWP';
813
+ }
814
  } else {
815
  /*****************************************/
816
  /* Here is non-ajax requests skipping */
906
  ) {
907
  return 'WSForms skip';
908
  }
909
+ // Checkout For WC - service requests skip
910
+ if (
911
+ apbct_is_plugin_active('checkout-for-woocommerce/checkout-for-woocommerce.php') &&
912
+ ( ( apbct_is_in_uri('wc-ajax=update_checkout') && wp_verify_nonce(Post::get('security'), 'update-order-review') ) ||
913
+ apbct_is_in_uri('wc-ajax=account_exists') ||
914
+ apbct_is_in_uri('wc-ajax=complete_order') )
915
+ ) {
916
+ return 'Checkout For WC skip';
917
+ }
918
  }
919
 
920
  return false;
inc/cleantalk-public-integrations.php CHANGED
@@ -484,19 +484,6 @@ function ct_woocommerce_checkout_check()
484
  'sender_info' => array('sender_url' => null)
485
  );
486
 
487
- /**
488
- * Add honeypot_field to $base_call_data is forms__wc_honeypot on
489
- */
490
- if ( $apbct->settings['forms__wc_honeypot'] ) {
491
- $honeypot_field = 1;
492
-
493
- if ( Post::get('wc_apbct_email_id') ) {
494
- $honeypot_field = 0;
495
- }
496
-
497
- $base_call_data['honeypot_field'] = $honeypot_field;
498
- }
499
-
500
  //Making a call
501
  $base_call_result = apbct_base_call($base_call_data);
502
 
@@ -778,14 +765,27 @@ function apbct_form__formidable__testSpam($errors, $_form)
778
 
779
  if ( $ct_result->allow == 0 ) {
780
  if (apbct_is_ajax()) {
 
 
 
 
 
 
 
 
 
 
781
  $result = array (
782
  'errors' =>
783
- array (),
 
 
784
  'content' => '',
785
  'pass' => false,
786
  'error_message' => '<div class="frm_error_style" role="status"><p>' . $ct_result->comment . '</p></div>',
787
  );
788
- print json_encode($result);
 
789
  die();
790
  }
791
 
@@ -1207,6 +1207,7 @@ function ct_register_form()
1207
  }
1208
 
1209
  ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
 
1210
 
1211
  return null;
1212
  }
@@ -3266,3 +3267,56 @@ add_filter('wsf_submit_field_validate', function ($error_validation_action_field
3266
 
3267
  return $error_validation_action_field;
3268
  }, 10, 6);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  'sender_info' => array('sender_url' => null)
485
  );
486
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  //Making a call
488
  $base_call_result = apbct_base_call($base_call_data);
489
 
765
 
766
  if ( $ct_result->allow == 0 ) {
767
  if (apbct_is_ajax()) {
768
+ // search for a suitable field
769
+ $key_field = '113';
770
+
771
+ foreach ($_form['item_meta'] as $key => $value) {
772
+ if ($value) {
773
+ $key_field = $key;
774
+ break;
775
+ }
776
+ }
777
+
778
  $result = array (
779
  'errors' =>
780
+ array (
781
+ $key_field => $ct_result->comment
782
+ ),
783
  'content' => '',
784
  'pass' => false,
785
  'error_message' => '<div class="frm_error_style" role="status"><p>' . $ct_result->comment . '</p></div>',
786
  );
787
+
788
+ echo json_encode($result, JSON_FORCE_OBJECT);
789
  die();
790
  }
791
 
1207
  }
1208
 
1209
  ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1210
+ echo ct_add_honeypot_field('wp_register');
1211
 
1212
  return null;
1213
  }
3267
 
3268
  return $error_validation_action_field;
3269
  }, 10, 6);
3270
+
3271
+ /**
3272
+ * Happyforms integration
3273
+ *
3274
+ * @param $is_valid
3275
+ * @param $request
3276
+ * @param $form
3277
+ *
3278
+ * @return mixed
3279
+ * @psalm-suppress UnusedVariable
3280
+ */
3281
+ function apbct_form_happyforms_test_spam($is_valid, $request, $_form)
3282
+ {
3283
+ global $cleantalk_executed;
3284
+
3285
+ if ( ! $cleantalk_executed && $is_valid ) {
3286
+ /**
3287
+ * Filter for request
3288
+ */
3289
+ $input_array = apply_filters('apbct__filter_post', $request);
3290
+
3291
+ $data = ct_get_fields_any($input_array);
3292
+
3293
+ $base_call_result = apbct_base_call(
3294
+ array(
3295
+ 'message' => ! empty($data['message']) ? json_encode($data['message']) : '',
3296
+ 'sender_email' => ! empty($data['email']) ? $data['email'] : '',
3297
+ 'sender_nickname' => ! empty($data['nickname']) ? $data['nickname'] : '',
3298
+ 'post_info' => array(
3299
+ 'comment_type' => 'happyforms_contact_form'
3300
+ ),
3301
+ )
3302
+ );
3303
+
3304
+ $ct_result = $base_call_result['ct_result'];
3305
+
3306
+ $cleantalk_executed = true;
3307
+
3308
+ if ( $ct_result->allow == 0 ) {
3309
+ wp_send_json_error(array(
3310
+ 'html' => '<div class="happyforms-form happyforms-styles">
3311
+ <h3 class="happyforms-form__title">Sample Form</h3>
3312
+ <form action="" method="post" novalidate="true">
3313
+ <div class="happyforms-flex"><div class="happyforms-message-notices">
3314
+ <div class="happyforms-message-notice error">
3315
+ <h2>' . $ct_result->comment . '</h2></div></div>
3316
+ </form></div>'
3317
+ ));
3318
+ }
3319
+ }
3320
+
3321
+ return $is_valid;
3322
+ }
inc/cleantalk-public.php CHANGED
@@ -621,6 +621,26 @@ function ct_add_hidden_fields(
621
  }
622
  }
623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  /**
625
  * Changes whether notify admin/athor or not.
626
  *
621
  }
622
  }
623
 
624
+ function ct_add_honeypot_field($form_type)
625
+ {
626
+ $style = '
627
+ <style>
628
+ #apbct__email_id__' . $form_type . ' {
629
+ display: none !important;
630
+ }
631
+ </style>';
632
+ return $style . "\n" . '<input
633
+ id="apbct__email_id__' . $form_type . '"
634
+ class="apbct__email_id__' . $form_type . '"
635
+ autocomplete="off"
636
+ name="apbct__email_id__' . $form_type . '"
637
+ type="text"
638
+ value=""
639
+ size="30"
640
+ maxlength="200"
641
+ />';
642
+ }
643
+
644
  /**
645
  * Changes whether notify admin/athor or not.
646
  *
inc/cleantalk-settings.php CHANGED
@@ -269,22 +269,7 @@ function apbct_settings__set_fileds()
269
  array('val' => 1, 'label' => __('On')),
270
  array('val' => 0, 'label' => __('Off')),
271
  ),
272
- ),
273
- 'forms__wc_honeypot' => array(
274
- 'title' => __(
275
- 'Add a honeypot field',
276
- 'cleantalk-spam-protect'
277
- ),
278
- 'description' => __(
279
- 'This option adds a honeypot to the order form to improve spam protection. Enable this option if you have passed spam on the order form.',
280
- 'cleantalk-spam-protect'
281
- ),
282
- 'class' => 'apbct_settings-field_wrapper--sub',
283
- 'options' => array(
284
- array('val' => 1, 'label' => __('On')),
285
- array('val' => 0, 'label' => __('Off')),
286
- ),
287
- ),
288
  ),
289
  ),
290
 
@@ -517,6 +502,21 @@ function apbct_settings__set_fileds()
517
  'title' => __('Check email before POST request', 'cleantalk-spam-protect'),
518
  'description' => __('Check email address before sending form data', 'cleantalk-spam-protect'),
519
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  ),
521
  ),
522
 
@@ -2631,6 +2631,10 @@ function apbct_settings__get__long_description()
2631
  '<a href="https://blog.cleantalk.org/introducing-cleantalk-pixel{utm_mark}" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
2632
  )
2633
  ),
 
 
 
 
2634
  );
2635
 
2636
  if ( ! empty($setting_id) ) {
269
  array('val' => 1, 'label' => __('On')),
270
  array('val' => 0, 'label' => __('Off')),
271
  ),
272
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  ),
274
  ),
275
 
502
  'title' => __('Check email before POST request', 'cleantalk-spam-protect'),
503
  'description' => __('Check email address before sending form data', 'cleantalk-spam-protect'),
504
  ),
505
+ 'data__honeypot_field' => array(
506
+ 'title' => __(
507
+ 'Add a honeypot field',
508
+ 'cleantalk-spam-protect'
509
+ ),
510
+ 'description' => __(
511
+ 'This option adds a honeypot field to the forms.',
512
+ 'cleantalk-spam-protect'
513
+ ),
514
+ 'options' => array(
515
+ array('val' => 1, 'label' => __('On')),
516
+ array('val' => 0, 'label' => __('Off')),
517
+ ),
518
+ 'long_description' => true,
519
+ ),
520
  ),
521
  ),
522
 
2631
  '<a href="https://blog.cleantalk.org/introducing-cleantalk-pixel{utm_mark}" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
2632
  )
2633
  ),
2634
+ 'data__honeypot_field' => array(
2635
+ 'title' => __('Honeypot field', 'cleantalk-spam-protect'),
2636
+ 'desc' => __('The option helps to block bots on the WC order form and default registration form. Enable this option if you have passed spam on these forms.', 'cleantalk-spam-protect')
2637
+ ),
2638
  );
2639
 
2640
  if ( ! empty($setting_id) ) {
inc/cleantalk-updater.php CHANGED
@@ -20,13 +20,6 @@ function apbct_run_update_actions($current_version, $new_version)
20
  global $apbct;
21
  $need_start_update_sfw = false;
22
 
23
- // Excludes the repeated call of the plugin update if the process is already running.
24
- if ( isset($apbct->stats['plugin']['plugin_is_being_updated']) &&
25
- (int)$apbct->stats['plugin']['plugin_is_being_updated'] === 1
26
- ) {
27
- return false;
28
- }
29
-
30
  $apbct->stats['plugin']['plugin_is_being_updated'] = 1;
31
  $apbct->save('stats');
32
 
@@ -94,9 +87,6 @@ function apbct_run_update_actions($current_version, $new_version)
94
  }
95
  }
96
 
97
- $apbct->stats['plugin']['plugin_is_being_updated'] = 0;
98
- $apbct->save('stats');
99
-
100
  // Start SFW update
101
  if ($need_start_update_sfw) {
102
  apbct_sfw_update__init();
@@ -1108,3 +1098,16 @@ function apbct_update_to_5_167_1()
1108
  $apbct->settings['exclusions__log_excluded_requests'] = '0';
1109
  $apbct->saveSettings();
1110
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  global $apbct;
21
  $need_start_update_sfw = false;
22
 
 
 
 
 
 
 
 
23
  $apbct->stats['plugin']['plugin_is_being_updated'] = 1;
24
  $apbct->save('stats');
25
 
87
  }
88
  }
89
 
 
 
 
90
  // Start SFW update
91
  if ($need_start_update_sfw) {
92
  apbct_sfw_update__init();
1098
  $apbct->settings['exclusions__log_excluded_requests'] = '0';
1099
  $apbct->saveSettings();
1100
  }
1101
+
1102
+ /**
1103
+ * 5.172.1
1104
+ */
1105
+ function apbct_update_to_5_172_1()
1106
+ {
1107
+ global $apbct;
1108
+
1109
+ if ( isset($apbct->settings['forms__wc_honeypot']) ) {
1110
+ $apbct->settings['data__honeypot_field'] = $apbct->settings['forms__wc_honeypot'];
1111
+ $apbct->saveSettings();
1112
+ }
1113
+ }
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_collect_visible_fields(t){var e=[],n="",c=0,o="",a=0,i=[];for(var l in t.elements)isNaN(+l)||(e[l]=t.elements[l]);return(e=e.filter(function(t){return-1===i.indexOf(t.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(t.getAttribute("type"))||(i.push(t.getAttribute("name")),!1))})).forEach(function(t,e,i){"submit"!==t.getAttribute("type")&&null!==t.getAttribute("name")&&"ct_checkjs"!==t.getAttribute("name")&&("none"!==getComputedStyle(t).display&&"hidden"!==getComputedStyle(t).visibility&&"0"!==getComputedStyle(t).opacity&&"hidden"!==t.getAttribute("type")||t.classList.contains("wp-editor-area")?(n+=" "+t.getAttribute("name"),c++):(o+=" "+t.getAttribute("name"),a++))}),o=o.trim(),{visible_fields:n=n.trim(),visible_fields_count:c,invisible_fields:o,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(t,e){var i="object"==typeof t&&null!==t?t:{};if("native"===ctPublic.data__cookies_type)for(var n in i){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==e?e:n),JSON.stringify(i[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_js_keys__set_input_value(t,e,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var c=document.querySelectorAll("[name^=ct_checkjs]"),o=0;o<c.length;o++)c[o].value=t.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}!function(){var o=new Date,e=(new Date).getTime(),i=!0,n=[],c=0,a={},t=!1,l=!1;function s(t,e,i){"function"==typeof window.addEventListener?t.addEventListener(e,i):t.attachEvent(e,i)}function _(t,e,i){"function"==typeof window.removeEventListener?t.removeEventListener(e,i):t.detachEvent(e,i)}var u=function(){var t=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",t),_(window,"mousedown",u),_(window,"keydown",u)},d=setInterval(function(){i=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(t){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(t.clientY),Math.round(t.clientX),Math.round((new Date).getTime()-e)]),i=!1,50<=++c&&(_(window,"mousemove",m),clearInterval(d),clearInterval(r)))};function p(t){var e=t.target.value;!e||e in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:e},callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{apbct_ajax:1,callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}function b(t){ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+t+'">'))}s(window,"mousemove",m),s(window,"mousedown",u),s(window,"keydown",u),s(window,"scroll",function(){t||(ctSetCookie("ct_has_scrolled","true"),t=!0)}),s(window,"DOMContentLoaded",function(){var t,e=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",o.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["ct_has_scrolled","false"],["ct_mouse_moved","false"]];if("native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var i=document.cookie.split(";");if(0!==i.length)for(var n=0;n<i.length;n++){var c=i[n].trim().split("=")[0];0===c.indexOf("apbct_visible_fields_")&&ctDeleteCookie(c)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(t){t&&b(t)}}):(t="custom_ajax"===ctPublicFunctions.data__ajax_type?1:0,apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{apbct_ajax:t,notJson:!0,callback:function(t){t&&b(t)}})):e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(p)),ctSetCookie(e),setTimeout(function(){for(var t=0;t<document.forms.length;t++){var e,i,n=document.forms[t];"get"===n.method.toString().toLowerCase()||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||((e=document.createElement("input")).setAttribute("type","hidden"),e.setAttribute("id","apbct_visible_fields_"+t),e.setAttribute("name","apbct_visible_fields"),(i={})[0]=apbct_collect_visible_fields(n),e.value=JSON.stringify(i),n.append(e),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=t,n.onsubmit=function(t){var e;"native"!==ctPublic.data__cookies_type&&void 0!==t.target.ctFormIndex&&((e={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(e,t.target.ctFormIndex)),t.target.onsubmit_prev instanceof Function&&setTimeout(function(){t.target.onsubmit_prev.call(t.target,t)},500)})}},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(t,e,i){var n;!e.responseText||-1===e.responseText.indexOf('"apbct')||void 0!==(n=JSON.parse(e.responseText)).apbct&&(n=n.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n.comment}})),cleantalkModal.loaded=n.comment,cleantalkModal.open(),1==+n.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
1
+ function apbct_collect_visible_fields(t){var e,i=[],n="",c=0,o="",a=0,l=[];for(e in t.elements)isNaN(+e)||(i[e]=t.elements[e]);return(i=i.filter(function(t){return-1===l.indexOf(t.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(t.getAttribute("type"))||(l.push(t.getAttribute("name")),!1))})).forEach(function(t,e,i){"submit"!==t.getAttribute("type")&&null!==t.getAttribute("name")&&"ct_checkjs"!==t.getAttribute("name")&&("none"!==getComputedStyle(t).display&&"hidden"!==getComputedStyle(t).visibility&&"0"!==getComputedStyle(t).opacity&&"hidden"!==t.getAttribute("type")||t.classList.contains("wp-editor-area")?(n+=" "+t.getAttribute("name"),c++):(o+=" "+t.getAttribute("name"),a++))}),o=o.trim(),{visible_fields:n=n.trim(),visible_fields_count:c,invisible_fields:o,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(t,e){var i="object"==typeof t&&null!==t?t:{};if("native"===ctPublic.data__cookies_type)for(var n in i){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==e?e:n),JSON.stringify(i[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_js_keys__set_input_value(t,e,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var c=document.querySelectorAll("[name^=ct_checkjs]"),o=0;o<c.length;o++)c[o].value=t.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}!function(){var o=new Date,e=(new Date).getTime(),i=!0,n=[],c=0,a={},t=!1,l=!1;function s(t,e,i){"function"==typeof window.addEventListener?t.addEventListener(e,i):t.attachEvent(e,i)}function _(t,e,i){"function"==typeof window.removeEventListener?t.removeEventListener(e,i):t.detachEvent(e,i)}var u=function(t){var e=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",e),_(window,"mousedown",u),_(window,"keydown",u)},d=setInterval(function(){i=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(t){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(t.clientY),Math.round(t.clientX),Math.round((new Date).getTime()-e)]),i=!1,50<=++c&&(_(window,"mousemove",m),clearInterval(d),clearInterval(r)))};function p(t){var e=t.target.value;!e||e in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:e},callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{apbct_ajax:1,callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}function b(t){ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+t+'">'))}s(window,"mousemove",m),s(window,"mousedown",u),s(window,"keydown",u),s(window,"scroll",function(){t||(ctSetCookie("ct_has_scrolled","true"),t=!0)}),s(window,"DOMContentLoaded",function(){var t,e=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",o.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["ct_has_scrolled","false"],["ct_mouse_moved","false"]];if("native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var i=document.cookie.split(";");if(0!==i.length)for(var n=0;n<i.length;n++){var c=i[n].trim().split("=")[0];0===c.indexOf("apbct_visible_fields_")&&ctDeleteCookie(c)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(t){t&&b(t)}}):(t="custom_ajax"===ctPublicFunctions.data__ajax_type?1:0,apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{apbct_ajax:t,notJson:!0,callback:function(t){t&&b(t)}})):e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(p)),ctSetCookie(e),setTimeout(function(){for(var t=0;t<document.forms.length;t++){var e,i,n=document.forms[t];"get"===n.method.toString().toLowerCase()||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||((e=document.createElement("input")).setAttribute("type","hidden"),e.setAttribute("id","apbct_visible_fields_"+t),e.setAttribute("name","apbct_visible_fields"),(i={})[0]=apbct_collect_visible_fields(n),e.value=JSON.stringify(i),n.append(e),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=t,n.onsubmit=function(t){var e;"native"!==ctPublic.data__cookies_type&&void 0!==t.target.ctFormIndex&&((e={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(e,t.target.ctFormIndex)),t.target.onsubmit_prev instanceof Function&&setTimeout(function(){t.target.onsubmit_prev.call(t.target,t)},500)})}},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(t,e,i){!e.responseText||-1===e.responseText.indexOf('"apbct')||void 0!==(e=JSON.parse(e.responseText)).apbct&&(e=e.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:e.comment}})),cleantalkModal.loaded=e.comment,cleantalkModal.open(),1==+e.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() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Using AJAX request and handler\n\t\t\t}else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tapbct_ajax: 1,\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetPixelImg(pixelUrl) {\n\t\tctSetCookie('apbct_pixel_url', pixelUrl);\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + pixelUrl + '\">' );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctGetPixelUrl() {\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'apbct_get_pixel_url',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t// Using AJAX request and handler\n\t\t}else{\n\t\t\tvar ajaxType = ctPublicFunctions.data__ajax_type === 'custom_ajax' ? 1 : 0;\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tapbct_ajax: ajaxType,\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t];\n\n\t\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tctGetPixelUrl();\n\t\t\t} else {\n\t\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) // WP Time Slots Booking Form\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\t\tvar visibleFieldsToInput = {};\n\t\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\t\tform.append( hiddenInput );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( ctPublic.data__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["apbct_collect_visible_fields","form","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__cookies_type","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","floor","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","target","ctPublicFunctions","data__ajax_type","apbct_public_sendREST","method","email","timestamp","now","apbct_public_sendAJAX","action","apbct_ajax","ctSetPixelImg","pixelUrl","pixel__enabled","getElementById","jQuery","append","ajaxType","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","notJson","pixel__url","data__email_check_before_post","blur","setTimeout","forms","hiddenInput","visibleFieldsToInput","toString","toLowerCase","parentElement","id","name","createElement","setAttribute","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","ajaxComplete","xhr","settings","response","responseText","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAiSA,SAASA,6BAA8BC,GAGtC,IAAIC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAAmB,GACnBC,EAAyB,EACzBC,EAA8B,GAE/B,IAAI,IAAIC,KAAOP,EAAKQ,SACfC,OAAOF,KACVN,EAAOM,GAAOP,EAAKQ,SAASD,IAsD9B,OAlDAN,EAASA,EAAOS,OAAO,SAASC,GAG/B,OAA0E,IAAtEL,EAA4BM,QAASD,EAAKE,aAAa,YAItD,IAAM,CAAC,QAAS,YAAYD,QAASD,EAAKE,aAAa,WAC3DP,EAA4BQ,KAAMH,EAAKE,aAAa,UAC7C,OAMFE,QAAQ,SAASJ,EAAMK,EAAGR,GAGO,WAAtCG,EAAKE,aAAa,SACoB,OAAtCF,EAAKE,aAAa,SACoB,eAAtCF,EAAKE,aAAa,UAMoB,SAAtCI,iBAAiBN,GAAMO,SACe,WAAtCD,iBAAiBN,GAAMQ,YACe,MAAtCF,iBAAiBN,GAAMS,SACe,WAAtCT,EAAKE,aAAa,SAEdF,EAAKU,UAAUC,SAAS,mBAU5BpB,GAAkB,IAAMS,EAAKE,aAAa,QAC1CV,MAPCC,GAAoB,IAAMO,EAAKE,aAAa,QAC5CR,QAWHD,EAAmBA,EAAiBmB,OAG7B,CACNC,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,GAEb/H,EAAKwI,cAAgBxI,EAAKyI,SAE1BzI,EAAK0I,YAAc1H,EACnBhB,EAAKyI,SAAW,SAAUhE,GAEzB,IAEKjD,EAFgC,WAAhCQ,SAASC,yBAAuE,IAA7BwC,EAAMsB,OAAO2C,eAEhElH,EAAiB,IACN,GAAKzB,6BAA6B4I,MACjD/G,gCAAiCJ,EAAgBiD,EAAMsB,OAAO2C,cAI3DjE,EAAMsB,OAAOyC,yBAAyBI,UACzCf,WAAW,WACVpD,EAAMsB,OAAOyC,cAAcK,KAAKpE,EAAMsB,OAAQtB,IAC5C,SAKJ,OA3RL,GAoZqB,oBAAXqC,QAGTA,OAAOnE,UAAUmG,aAAa,SAAUrE,EAAOsE,EAAKC,GACnD,IACKC,GADDF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAatI,QAAQ,gBAElB,KAD1BqI,EAAW7G,KAAK+G,MAAMJ,EAAIG,eACVE,QACnBH,EAAWA,EAASG,OACPC,UACZ1G,SAAS2G,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAAST,EAASU,YAK9BC,eAAeC,OAASZ,EAASU,QACjCC,eAAeE,OAEa,IAAxBb,EAASc,aACZpF,OAAOqF"}
1
+ {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Using AJAX request and handler\n\t\t\t}else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tapbct_ajax: 1,\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetPixelImg(pixelUrl) {\n\t\tctSetCookie('apbct_pixel_url', pixelUrl);\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + pixelUrl + '\">' );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctGetPixelUrl() {\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'apbct_get_pixel_url',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t// Using AJAX request and handler\n\t\t}else{\n\t\t\tvar ajaxType = ctPublicFunctions.data__ajax_type === 'custom_ajax' ? 1 : 0;\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tapbct_ajax: ajaxType,\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t];\n\n\t\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tctGetPixelUrl();\n\t\t\t} else {\n\t\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' // Custom form\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\t\tvar visibleFieldsToInput = {};\n\t\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\t\tform.append( hiddenInput );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( ctPublic.data__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__cookies_type","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","floor","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","target","ctPublicFunctions","data__ajax_type","apbct_public_sendREST","method","email","timestamp","now","apbct_public_sendAJAX","action","apbct_ajax","ctSetPixelImg","pixelUrl","pixel__enabled","getElementById","jQuery","append","ajaxType","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","notJson","pixel__url","data__email_check_before_post","blur","setTimeout","forms","hiddenInput","visibleFieldsToInput","toString","toLowerCase","parentElement","id","name","createElement","setAttribute","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","ajaxComplete","xhr","settings","responseText","response","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAkSA,SAASA,6BAA8BC,GAGtC,IAOQC,EAPJC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAAmB,GACnBC,EAAyB,EACzBC,EAA8B,GAE/B,IAAQN,KAAOD,EAAKQ,SACfC,OAAOR,KACVC,EAAOD,GAAOD,EAAKQ,SAASP,IAsD9B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IC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAASR,EAASS,YAK9BC,eAAeC,OAASX,EAASS,QACjCC,eAAeE,OAEa,IAAxBZ,EAASa,aACZpF,OAAOqF"}
lib/Cleantalk/Antispam/Integrations/GiveWP.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ use Cleantalk\Variables\Post;
6
+
7
+ class GiveWP extends IntegrationBase
8
+ {
9
+ public function getDataForChecking($argument)
10
+ {
11
+ if ( Post::get('action') === 'give_process_donation' ) {
12
+ /**
13
+ * Filter for POST
14
+ */
15
+ $input_array = apply_filters('apbct__filter_post', $_POST);
16
+
17
+ return ct_get_fields_any($input_array);
18
+ }
19
+
20
+ return null;
21
+ }
22
+
23
+ /**
24
+ * @param $message
25
+ *
26
+ * @return void
27
+ */
28
+ public function doBlock($message)
29
+ {
30
+ if ( function_exists('give_set_error') ) {
31
+ give_set_error('spam_donation', $message);
32
+ }
33
+ add_action('give_ajax_donation_errors', function () use ($message) {
34
+ return 'Error: ' . $message;
35
+ });
36
+ }
37
+ }
lib/Cleantalk/Antispam/Integrations/VisualFormBuilder.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ class VisualFormBuilder extends IntegrationBase
6
+ {
7
+ public function getDataForChecking($argument)
8
+ {
9
+ /**
10
+ * Filter for POST
11
+ */
12
+ $input_array = apply_filters('apbct__filter_post', $_POST);
13
+
14
+ return ct_get_fields_any($input_array);
15
+ }
16
+
17
+ public function doBlock($message)
18
+ {
19
+ wp_die($message);
20
+ }
21
+ }
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -290,7 +290,8 @@ class CommentsChecker extends Checker
290
  $cnt_checked = $apbct->data['count_checked_comments'];
291
 
292
  // Spam comments
293
- $params_spam = array(
 
294
  'meta_query' => array(
295
  'relation' => 'AND',
296
  array(
@@ -300,8 +301,7 @@ class CommentsChecker extends Checker
300
  )
301
  ),
302
  );
303
- $spam_comments = new \WP_Comment_Query($params_spam);
304
- $cnt_spam = count($spam_comments->get_comments());
305
 
306
  // Bad comments (without IP and Email)
307
  $cnt_bad = $apbct->data['count_bad_comments'];
@@ -392,21 +392,21 @@ class CommentsChecker extends Checker
392
 
393
  $cnt_checked = $apbct->data['count_checked_comments'];
394
 
395
- // Spam users
396
- $params_spam = array(
 
397
  'meta_query' => array(
398
  'relation' => 'AND',
399
  array(
400
  'key' => 'ct_marked_as_spam',
401
  'compare' => '=',
402
  'value' => 1
403
- ),
404
  ),
405
  );
406
- $spam_comments = new \WP_Comment_Query($params_spam);
407
- $cnt_spam = count($spam_comments->get_comments());
408
 
409
- $cnt_bad = $apbct->data['count_bad_comments'];
410
 
411
  return array(
412
  'spam' => $cnt_spam,
290
  $cnt_checked = $apbct->data['count_checked_comments'];
291
 
292
  // Spam comments
293
+ $params_spam = array(
294
+ 'count' => true,
295
  'meta_query' => array(
296
  'relation' => 'AND',
297
  array(
301
  )
302
  ),
303
  );
304
+ $cnt_spam = get_comments($params_spam);
 
305
 
306
  // Bad comments (without IP and Email)
307
  $cnt_bad = $apbct->data['count_bad_comments'];
392
 
393
  $cnt_checked = $apbct->data['count_checked_comments'];
394
 
395
+ // Spam comments
396
+ $params_spam = array(
397
+ 'count' => true,
398
  'meta_query' => array(
399
  'relation' => 'AND',
400
  array(
401
  'key' => 'ct_marked_as_spam',
402
  'compare' => '=',
403
  'value' => 1
404
+ )
405
  ),
406
  );
407
+ $cnt_spam = get_comments($params_spam);
 
408
 
409
+ $cnt_bad = $apbct->data['count_bad_comments'];
410
 
411
  return array(
412
  'spam' => $cnt_spam,
lib/Cleantalk/ApbctWP/FindSpam/ListTable/Comments.php CHANGED
@@ -34,7 +34,7 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
34
  'cb' => '<input type="checkbox" />',
35
  'ct_author' => esc_html__('Author', 'cleantalk-spam-protect'),
36
  'ct_comment' => esc_html__('Comment', 'cleantalk-spam-protect'),
37
- 'ct_response_to' => esc_html__(' In Response To', 'cleantalk-spam-protect'),
38
  );
39
  }
40
 
@@ -294,16 +294,20 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
294
  }
295
 
296
  /**
297
- * @return \WP_Comment_Query
298
- * @psalm-suppress PossiblyUnusedMethod
299
  */
300
  public function getTotal()
301
  {
302
- return new \WP_Comment_Query();
 
 
 
 
303
  }
304
 
305
  /**
306
- * @return \WP_Comment_Query
307
  * @psalm-suppress PossiblyUnusedMethod
308
  */
309
  public function getChecked()
@@ -316,9 +320,11 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
316
  *
317
  * @return \WP_Comment_Query
318
  */
319
- public function getSpamNow()
320
  {
321
  $params_spam = array(
 
 
322
  'meta_key' => 'ct_marked_as_spam',
323
  );
324
 
34
  'cb' => '<input type="checkbox" />',
35
  'ct_author' => esc_html__('Author', 'cleantalk-spam-protect'),
36
  'ct_comment' => esc_html__('Comment', 'cleantalk-spam-protect'),
37
+ 'ct_response_to' => esc_html__('In Response To', 'cleantalk-spam-protect'),
38
  );
39
  }
40
 
294
  }
295
 
296
  /**
297
+ * @return int
298
+ * @psalm-suppress PossiblyUnusedMethod, InvalidReturnStatement, InvalidReturnType
299
  */
300
  public function getTotal()
301
  {
302
+ $params_total = array(
303
+ 'count' => true,
304
+ );
305
+
306
+ return get_comments($params_total);
307
  }
308
 
309
  /**
310
+ * @return int
311
  * @psalm-suppress PossiblyUnusedMethod
312
  */
313
  public function getChecked()
320
  *
321
  * @return \WP_Comment_Query
322
  */
323
+ public function getSpamNow($per_page, $current_page)
324
  {
325
  $params_spam = array(
326
+ 'number' => $per_page,
327
+ 'offset' => ( $current_page - 1 ) * $per_page,
328
  'meta_key' => 'ct_marked_as_spam',
329
  );
330
 
lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php CHANGED
@@ -15,22 +15,16 @@ class CommentsScan extends Comments
15
  $per_page = 10;
16
  }
17
 
18
- $scanned_comments = $this->getSpamNow();
 
 
19
 
20
  $this->set_pagination_args(array(
21
- 'total_items' => count($scanned_comments->get_comments()),
22
  'per_page' => $per_page,
23
  ));
24
 
25
- $current_page = (int)$this->get_pagenum();
26
-
27
- $scanned_comments_to_show = array_slice(
28
- $scanned_comments->get_comments(),
29
- (($current_page - 1) * $per_page),
30
- $per_page
31
- );
32
-
33
- foreach ( $scanned_comments_to_show as $comment ) {
34
  $this->items[] = array(
35
  'ct_id' => $comment->comment_ID,
36
  'ct_author' => $comment->comment_author,
15
  $per_page = 10;
16
  }
17
 
18
+ $current_page = $this->get_pagenum();
19
+
20
+ $scanned_comments = $this->getSpamNow($per_page, $current_page);
21
 
22
  $this->set_pagination_args(array(
23
+ 'total_items' => $this->getTotal(),
24
  'per_page' => $per_page,
25
  ));
26
 
27
+ foreach ( $scanned_comments->get_comments() as $comment ) {
 
 
 
 
 
 
 
 
28
  $this->items[] = array(
29
  'ct_id' => $comment->comment_ID,
30
  'ct_author' => $comment->comment_author,
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -52,8 +52,6 @@ class State extends \Cleantalk\Common\State
52
  'forms__wc_register_from_order' => 1,
53
  // Woocommerce registration during checkout
54
  'forms__wc_add_to_cart' => 0,
55
- // Woocommerce honeypot
56
- 'forms__wc_honeypot' => 1,
57
  // Woocommerce add to cart
58
  'forms__search_test' => 1,
59
  // Test default Wordpress form
@@ -93,6 +91,7 @@ class State extends \Cleantalk\Common\State
93
  // Secure connection to servers
94
  'data__pixel' => '3',
95
  'data__email_check_before_post' => 1,
 
96
 
97
  // Exclusions
98
  // Send to the cloud some excepted requests
52
  'forms__wc_register_from_order' => 1,
53
  // Woocommerce registration during checkout
54
  'forms__wc_add_to_cart' => 0,
 
 
55
  // Woocommerce add to cart
56
  'forms__search_test' => 1,
57
  // Test default Wordpress form
91
  // Secure connection to servers
92
  'data__pixel' => '3',
93
  'data__email_check_before_post' => 1,
94
+ 'data__honeypot_field' => 0,
95
 
96
  // Exclusions
97
  // Send to the cloud some excepted requests
lib/Cleantalk/ApbctWP/Transaction.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ class Transaction extends \Cleantalk\Common\Transaction
6
+ {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ protected function setOption($option_name, $value)
11
+ {
12
+ return update_option($option_name, $value, false);
13
+ }
14
+
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ protected function getOption($option_name, $default)
19
+ {
20
+ return get_option($option_name, $default);
21
+ }
22
+ }
lib/Cleantalk/Common/Helper.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace Cleantalk\Common;
4
 
 
5
  use Cleantalk\Variables\Server;
6
 
7
  /**
@@ -18,6 +19,8 @@ use Cleantalk\Variables\Server;
18
  */
19
  class Helper
20
  {
 
 
21
  /**
22
  * Default user agent for HTTP requests
23
  */
@@ -66,6 +69,20 @@ class Helper
66
  'netserv3.cleantalk.org' => '188.40.14.173',
67
  );
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
71
  *
@@ -79,6 +96,12 @@ class Helper
79
  */
80
  public static function ipGet($ip_type_to_get = 'real', $v4_only = true, $headers = array())
81
  {
 
 
 
 
 
 
82
  $out = null;
83
 
84
  switch ($ip_type_to_get) {
@@ -305,16 +328,20 @@ class Helper
305
  $out = self::ipGet('real', $v4_only, $headers);
306
  }
307
 
308
- // Final validating IP
309
  $ip_version = self::ipValidate($out);
310
 
311
- if (! $ip_version) {
312
- return null;
313
- } elseif ($ip_version === 'v6' && $v4_only) {
314
- return null;
315
- } else {
316
- return $out;
317
  }
 
 
 
 
 
318
  }
319
 
320
  /**
@@ -1130,7 +1157,11 @@ class Helper
1130
  */
1131
  public static function httpGetHeaders()
1132
  {
1133
- $headers = array();
 
 
 
 
1134
  foreach ($_SERVER as $key => $val) {
1135
  if (0 === stripos($key, 'http_')) {
1136
  $server_key = preg_replace('/^http_/i', '', $key);
@@ -1154,6 +1185,9 @@ class Helper
1154
  }
1155
  }
1156
 
 
 
 
1157
  return $headers;
1158
  }
1159
 
2
 
3
  namespace Cleantalk\Common;
4
 
5
+ use Cleantalk\Templates\Singleton;
6
  use Cleantalk\Variables\Server;
7
 
8
  /**
19
  */
20
  class Helper
21
  {
22
+ use Singleton;
23
+
24
  /**
25
  * Default user agent for HTTP requests
26
  */
69
  'netserv3.cleantalk.org' => '188.40.14.173',
70
  );
71
 
72
+ /**
73
+ * @var array Stored IPs
74
+ * [
75
+ * [ type ] => IP,
76
+ * [ type ] => IP,
77
+ * ]
78
+ */
79
+ private $ips_stored = array();
80
+
81
+ /**
82
+ * @var array Stored HTTP headers
83
+ */
84
+ private $headers = array();
85
+
86
  /**
87
  * Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
88
  *
96
  */
97
  public static function ipGet($ip_type_to_get = 'real', $v4_only = true, $headers = array())
98
  {
99
+ // If return the IP of the current type if it already has been detected
100
+ $ips_stored = self::getInstance()->ips_stored;
101
+ if ( ! empty($ips_stored[ $ip_type_to_get ]) ) {
102
+ return $ips_stored[ $ip_type_to_get ];
103
+ }
104
+
105
  $out = null;
106
 
107
  switch ($ip_type_to_get) {
328
  $out = self::ipGet('real', $v4_only, $headers);
329
  }
330
 
 
331
  $ip_version = self::ipValidate($out);
332
 
333
+ if ( ! $ip_version ) {
334
+ $out = null;
335
+ }
336
+
337
+ if ( $ip_version === 'v6' && $v4_only ) {
338
+ $out = null;
339
  }
340
+
341
+ // Store the IP of the current type to skip the work next time
342
+ self::getInstance()->ips_stored[ $ip_type_to_get ] = $out;
343
+
344
+ return $out;
345
  }
346
 
347
  /**
1157
  */
1158
  public static function httpGetHeaders()
1159
  {
1160
+ // If headers already return them
1161
+ $headers = self::getInstance()->headers;
1162
+ if ( ! empty($headers) ) {
1163
+ return $headers;
1164
+ }
1165
  foreach ($_SERVER as $key => $val) {
1166
  if (0 === stripos($key, 'http_')) {
1167
  $server_key = preg_replace('/^http_/i', '', $key);
1185
  }
1186
  }
1187
 
1188
+ // Store headers to skip the work next time
1189
+ self::getInstance()->headers = $headers;
1190
+
1191
  return $headers;
1192
  }
1193
 
lib/Cleantalk/Common/Transaction.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Common;
4
+
5
+ use Cleantalk\Templates\Multiton;
6
+
7
+ abstract class Transaction
8
+ {
9
+ use Multiton;
10
+
11
+ /**
12
+ * Time needed to perform an action
13
+ *
14
+ * @var int
15
+ */
16
+ private $action_time = 5;
17
+
18
+ /**
19
+ * Transaction ID option name
20
+ *
21
+ * @var string
22
+ */
23
+ private $tid_option_name;
24
+
25
+ /**
26
+ * @var string Option name with a start time of a transaction
27
+ */
28
+ private $start_time_option_name;
29
+
30
+ /**
31
+ * Alternative constructor
32
+ *
33
+ * @param $params array
34
+ *
35
+ * @return void
36
+ */
37
+ protected function init($params)
38
+ {
39
+ $params = array_merge(array(
40
+ 'action_time' => $this->action_time,
41
+ 'name' => 'common',
42
+ ), $params);
43
+
44
+ $this->action_time = $params['action_time'];
45
+ $this->tid_option_name = 'cleantalk_transaction__' . $params['name'] . '_id';
46
+ $this->start_time_option_name = 'cleantalk_transaction__' . $params['name'] . '_start_time';
47
+ }
48
+
49
+ /**
50
+ * Wrapper for self::getInstance()
51
+ *
52
+ * @param string $instance_name Name of the instance
53
+ * @param int $action_time_s
54
+ *
55
+ * @return Transaction
56
+ */
57
+ public static function get($instance_name, $action_time_s = 5)
58
+ {
59
+ return static::getInstance($instance_name, array('name' => $instance_name, 'action_time' => $action_time_s));
60
+ }
61
+
62
+ /**
63
+ * Performs transaction. Set transaction timer.
64
+ *
65
+ * @return int|false|null
66
+ * <p>- Integer transaction ID on success.</p>
67
+ * <p>- false for duplicated request.</p>
68
+ * <p>- null on error.</p>
69
+ */
70
+ public function perform()
71
+ {
72
+ if ( $this->isTransactionInProcess() === true ) {
73
+ return false;
74
+ }
75
+
76
+ $time_ms = microtime(true);
77
+ if ( ! $this->setTransactionTimer() ) {
78
+ return null;
79
+ }
80
+ $halt_time = microtime(true) - $time_ms;
81
+
82
+ $tid = mt_rand(0, mt_getrandmax());
83
+ $this->saveTID($tid);
84
+ usleep((int)$halt_time + 1000);
85
+
86
+ return $tid === $this->getTID()
87
+ ? $tid
88
+ : false;
89
+ }
90
+
91
+ /**
92
+ * Save the transaction ID
93
+ *
94
+ * @param int $tid
95
+ *
96
+ * @return void
97
+ */
98
+ private function saveTID($tid)
99
+ {
100
+ $this->setOption($this->tid_option_name, $tid);
101
+ }
102
+
103
+ /**
104
+ * Get the transaction ID
105
+ *
106
+ * @return int|false
107
+ */
108
+ public function getTID()
109
+ {
110
+ return $this->getOption($this->tid_option_name, false);
111
+ }
112
+
113
+ /**
114
+ * Shows if the transaction progress
115
+ *
116
+ * @return bool
117
+ */
118
+ private function isTransactionInProcess()
119
+ {
120
+ return time() - $this->getOption($this->start_time_option_name, 0) < $this->action_time;
121
+ }
122
+
123
+ /**
124
+ * Set the time when transaction started
125
+ *
126
+ * @return bool
127
+ */
128
+ private function setTransactionTimer()
129
+ {
130
+ return $this->setOption($this->start_time_option_name, time());
131
+ }
132
+
133
+ /**
134
+ * Set transaction data to the DB
135
+ *
136
+ * @param $option_name
137
+ * @param $value
138
+ *
139
+ * @return bool
140
+ */
141
+ abstract protected function setOption($option_name, $value);
142
+
143
+ /**
144
+ * Get transaction data from the DB
145
+ *
146
+ * @param $option_name
147
+ * @param $default
148
+ *
149
+ * @return int|false
150
+ */
151
+ abstract protected function getOption($option_name, $default);
152
+ }
lib/Cleantalk/Templates/Multiton.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Templates;
4
+
5
+ trait Multiton
6
+ {
7
+ use Singleton;
8
+
9
+ protected static $instances = array();
10
+
11
+ /**
12
+ * Constructor
13
+ *
14
+ * @param string $instance The wished instance
15
+ * @param null|array $params Additional parameters to pass in the init() method to initialize the instance
16
+ *
17
+ * @return $this
18
+ */
19
+ public static function getInstance($instance, $params = array())
20
+ {
21
+ if ( ! isset(static::$instances[$instance]) ) {
22
+ static::$instances[$instance] = new static();
23
+ static::$instances[$instance]->init($params);
24
+ }
25
+
26
+ return static::$instances[$instance];
27
+ }
28
+ }
lib/Cleantalk/Templates/Singleton.php CHANGED
@@ -5,7 +5,7 @@ namespace Cleantalk\Templates;
5
  if (! trait_exists('Cleantalk\Templates\Singleton')) {
6
  trait Singleton
7
  {
8
- public static $instance;
9
 
10
  public function __construct()
11
  {
@@ -23,13 +23,12 @@ if (! trait_exists('Cleantalk\Templates\Singleton')) {
23
  * Constructor
24
  * @return $this
25
  */
26
- public static function getInstance()
27
  {
28
- if (! isset(static::$instance)) {
29
  static::$instance = new static();
30
- static::$instance->init();
31
  }
32
-
33
  return static::$instance;
34
  }
35
 
5
  if (! trait_exists('Cleantalk\Templates\Singleton')) {
6
  trait Singleton
7
  {
8
+ protected static $instance;
9
 
10
  public function __construct()
11
  {
23
  * Constructor
24
  * @return $this
25
  */
26
+ public static function getInstance($params = array())
27
  {
28
+ if ( ! isset(static::$instance) ) {
29
  static::$instance = new static();
30
+ static::$instance->init($params);
31
  }
 
32
  return static::$instance;
33
  }
34
 
lib/Cleantalk/Variables/Cookie.php CHANGED
@@ -12,21 +12,7 @@ namespace Cleantalk\Variables;
12
  */
13
  class Cookie extends ServerVariables
14
  {
15
- public static $instance;
16
-
17
- /**
18
- * Constructor
19
- * @return $this
20
- */
21
- public static function getInstance()
22
- {
23
- if (! isset(static::$instance)) {
24
- static::$instance = new static();
25
- static::$instance->init();
26
- }
27
-
28
- return static::$instance;
29
- }
30
 
31
  /**
32
  * Gets given $_COOKIE variable and save it to memory
12
  */
13
  class Cookie extends ServerVariables
14
  {
15
+ protected static $instance;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  /**
18
  * Gets given $_COOKIE variable and save it to memory
lib/Cleantalk/Variables/Get.php CHANGED
@@ -12,21 +12,7 @@ namespace Cleantalk\Variables;
12
  */
13
  class Get extends ServerVariables
14
  {
15
- public static $instance;
16
-
17
- /**
18
- * Constructor
19
- * @return $this
20
- */
21
- public static function getInstance()
22
- {
23
- if (! isset(static::$instance)) {
24
- static::$instance = new static();
25
- static::$instance->init();
26
- }
27
-
28
- return static::$instance;
29
- }
30
 
31
  /**
32
  * Gets given $_GET variable and save it to memory
12
  */
13
  class Get extends ServerVariables
14
  {
15
+ protected static $instance;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  /**
18
  * Gets given $_GET variable and save it to memory
lib/Cleantalk/Variables/Post.php CHANGED
@@ -12,21 +12,7 @@ namespace Cleantalk\Variables;
12
  */
13
  class Post extends ServerVariables
14
  {
15
- public static $instance;
16
-
17
- /**
18
- * Constructor
19
- * @return $this
20
- */
21
- public static function getInstance()
22
- {
23
- if (! isset(static::$instance)) {
24
- static::$instance = new static();
25
- static::$instance->init();
26
- }
27
-
28
- return static::$instance;
29
- }
30
 
31
  /**
32
  * Gets given $_POST variable and save it to memory
12
  */
13
  class Post extends ServerVariables
14
  {
15
+ protected static $instance;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  /**
18
  * Gets given $_POST variable and save it to memory
lib/Cleantalk/Variables/Request.php CHANGED
@@ -12,21 +12,7 @@ namespace Cleantalk\Variables;
12
  */
13
  class Request extends ServerVariables
14
  {
15
- public static $instance;
16
-
17
- /**
18
- * Constructor
19
- * @return $this
20
- */
21
- public static function getInstance()
22
- {
23
- if (! isset(static::$instance)) {
24
- static::$instance = new static();
25
- static::$instance->init();
26
- }
27
-
28
- return static::$instance;
29
- }
30
 
31
  /**
32
  * Gets given $_REQUEST variable and save it to memory
12
  */
13
  class Request extends ServerVariables
14
  {
15
+ protected static $instance;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  /**
18
  * Gets given $_REQUEST variable and save it to memory
lib/Cleantalk/Variables/Server.php CHANGED
@@ -12,7 +12,7 @@ namespace Cleantalk\Variables;
12
  */
13
  class Server extends ServerVariables
14
  {
15
- public static $instance;
16
 
17
  /**
18
  * Gets given $_SERVER variable and save it to memory
12
  */
13
  class Server extends ServerVariables
14
  {
15
+ protected static $instance;
16
 
17
  /**
18
  * Gets given $_SERVER variable and save it to memory
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.9
6
  Requires PHP: 5.6
7
- Stable tag: 5.172
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -36,6 +36,9 @@ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bo
36
  20. Spam FireWall: Anti-Crawler
37
  21. Hide «Website» field for comments
38
 
 
 
 
39
  = Public reviews =
40
  > CleanTalk - Cloud-Based Anti-Spam Service to Keep Your Site Bot-Free.
41
  > <a href="https://newswatchtv.com/2018/07/18/cleantalk-newswatch-review/" target="_blank">NewsWatch Review</a>.
@@ -49,9 +52,6 @@ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bo
49
  > The key selling point of CleanTalk for me is not simply its effectiveness. It's the fact that CleanTalk works in the background. It does not make users jump through hoops in order to submit a comment or complete a form.
50
  > <a href="https://www.kevinmuldoon.com/cleantalk-anti-spam-service/">www.kevinmuldoon.com</a>
51
 
52
- = Free trial then $8 per year =
53
- CleanTalk is a free anti spam plugin which work with the premium Cloud AntiSpam service cleantalk.org. This plugin as a service https://en.wikipedia.org/wiki/Software_as_a_service.
54
-
55
  = AntiSpam protection for comments =
56
  Native spam protection for WordPress, JetPack comments and any other comment plugins. The plugin moves spam comments to SPAM folder or you can set the option to ban spam comments silently. You can also enable the option in the plugin settings to auto-delete comments from SPAM folder.
57
 
@@ -73,6 +73,7 @@ Plugin extends spam protection for Formidable Form Builder. It filters spam subm
73
 
74
  = Contact Form 7 spam filter =
75
  Plugin extends spam protection for Contact Form 7 (CF7). It can be used with any other third-party spam filters.
 
76
 
77
  = Ninja forms contact form spam filter =
78
 
@@ -594,6 +595,21 @@ If your website has forms that send data to external sources, you can enable opt
594
 
595
  == Changelog ==
596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  = 5.172 Feb 17 2022 =
598
  #### Updating system modified, settings long descriptions added and minor issues fixed.
599
  * Fix: Fixed Fusion Builder Avada Form integration
1
  === Spam protection, AntiSpam, FireWall by CleanTalk ===
2
+ Contributors: glomberg, safronik
3
  Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.9
6
  Requires PHP: 5.6
7
+ Stable tag: 5.173
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
36
  20. Spam FireWall: Anti-Crawler
37
  21. Hide «Website» field for comments
38
 
39
+ = Free trial then $8 per year =
40
+ CleanTalk is an anti-spam plugin which works with the premium Cloud Anti-Spam service cleantalk.org. This plugin as a service <a href="https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#6-software-as-a-service-is-permitted">https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#6-software-as-a-service-is-permitted</a>
41
+
42
  = Public reviews =
43
  > CleanTalk - Cloud-Based Anti-Spam Service to Keep Your Site Bot-Free.
44
  > <a href="https://newswatchtv.com/2018/07/18/cleantalk-newswatch-review/" target="_blank">NewsWatch Review</a>.
52
  > The key selling point of CleanTalk for me is not simply its effectiveness. It's the fact that CleanTalk works in the background. It does not make users jump through hoops in order to submit a comment or complete a form.
53
  > <a href="https://www.kevinmuldoon.com/cleantalk-anti-spam-service/">www.kevinmuldoon.com</a>
54
 
 
 
 
55
  = AntiSpam protection for comments =
56
  Native spam protection for WordPress, JetPack comments and any other comment plugins. The plugin moves spam comments to SPAM folder or you can set the option to ban spam comments silently. You can also enable the option in the plugin settings to auto-delete comments from SPAM folder.
57
 
73
 
74
  = Contact Form 7 spam filter =
75
  Plugin extends spam protection for Contact Form 7 (CF7). It can be used with any other third-party spam filters.
76
+ <a href="https://blog.cleantalk.org/how-to-protect-your-contactform7-contact-form-using-cleantalk-anti-spam-plugin/">How to protect your Contact Form 7 using CleanTalk Anti-Spam plugin</a>
77
 
78
  = Ninja forms contact form spam filter =
79
 
595
 
596
  == Changelog ==
597
 
598
+ = 5.173 Mar 03 2022 =
599
+ #### Honeypot field implemented for improving antispam protection, new integrations added, performance improved and minor issues fixed.
600
+ * New. Honeypot field for the registration form.
601
+ * New. Integration. Added Visual Form Builder Integration without Ajax.
602
+ * New. Integration. GiveWP integration implemented.
603
+ * Upd. Code. Helper::ipGet() improved.
604
+ * Upd. Settings. Honeypot setting modified.
605
+ * Fix: Formidable Integration Refactoring.
606
+ * Fix. Integration. Fusion Avada Form Builder output fixed.
607
+ * Fix. Settings. Honeypot setting descriptions fixed.
608
+ * Fix: Skipped WP Booking System Premius service requests
609
+ * Fix. Exclusion. Checkout For WC - service requests skip.
610
+ * Fix. Comments checker. Found comments displaying optimized.
611
+ * Fix: visible fields was excluded form custom form.
612
+
613
  = 5.172 Feb 17 2022 =
614
  #### Updating system modified, settings long descriptions added and minor issues fixed.
615
  * Fix: Fixed Fusion Builder Avada Form integration