Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.169

Version Description

Dec 28 2021 =

Improved compatibility with Varnish cache, visible_fields cookies fixed and some minor issues fixed.

  • New. Options. Set cookie option "Auto" mode added.
  • New. State. New property data[cookies_type] added.
  • Fix. State. Set cookie option set on "Auto" by default.
  • Fix. Activation. Select ajax handler during the plugin activation.
  • Fix. API. Async logic added.
  • Fix. State. Varnish cache detection fixed.
  • Fix. API. Method calling service_update_local_settings is async now.
  • Fix. Visible fields. Prevent generating more than 10 visible fields cookies.
  • Fix: Disabling the cache when activating the plugin
  • Fix: Setting the parameter of ipMaskLongToNumber to an integer
  • Fix: fixed error in js script
Download this release

Release Info

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

Code changes from version 5.168.1 to 5.169

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.168.1
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -169,13 +169,16 @@ if ( $apbct->plugin_version === '1.0.0' ) {
169
  // Do update actions if version is changed
170
  apbct_update_actions();
171
 
 
 
 
172
  add_action('init', function () {
173
  global $apbct;
174
  // Self cron
175
  $ct_cron = new Cron();
176
  $tasks_to_run = $ct_cron->checkTasks(); // Check for current tasks. Drop tasks inner counters.
177
  if (
178
- $tasks_to_run && // There is tasks to run
179
  ! RemoteCalls::check() && // Do not do CRON in remote call action
180
  (
181
  ! defined('DOING_CRON') ||
@@ -686,12 +689,12 @@ function apbct_sfw__check()
686
  'api_key' => $apbct->api_key,
687
  'apbct' => $apbct,
688
  'cookie_domain' => parse_url(get_option('home'), PHP_URL_HOST),
689
- 'data__set_cookies' => $apbct->settings['data__set_cookies'],
690
  )
691
  )
692
  );
693
 
694
- if ( $apbct->settings['sfw__anti_crawler'] && $apbct->stats['sfw']['entries'] > 50 && $apbct->settings['data__set_cookies'] != 0 ) {
695
  $firewall->loadFwModule(
696
  new \Cleantalk\ApbctWP\Firewall\AntiCrawler(
697
  APBCT_TBL_FIREWALL_LOG,
@@ -728,12 +731,14 @@ function apbct_sfw__check()
728
  function apbct_plugin_redirect()
729
  {
730
  global $apbct;
 
731
  if ( get_option('ct_plugin_do_activation_redirect', false) && ! isset($_GET['activate-multi']) ) {
732
  delete_option('ct_plugin_do_activation_redirect');
733
  ct_account_status_check(null, false);
734
  apbct_sfw_update__init(3); // Updating SFW
735
  wp_redirect($apbct->settings_link);
736
  }
 
737
  }
738
 
739
  /**
@@ -2205,7 +2210,7 @@ function apbct_cookie()
2205
  global $apbct;
2206
 
2207
  if (
2208
- empty($apbct->settings['data__set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
2209
  ! empty($apbct->flags__cookies_setuped) || // Cookies already set
2210
  ! empty($apbct->headers_sent) // Headers sent
2211
  ) {
@@ -2268,7 +2273,7 @@ function apbct_cookie()
2268
 
2269
  // Cookies test
2270
  $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
2271
- if ( $apbct->settings['data__set_cookies'] == 1 ) {
2272
  Cookie::set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, null, true);
2273
  }
2274
 
@@ -2287,7 +2292,7 @@ function apbct_cookies_test()
2287
  {
2288
  global $apbct;
2289
 
2290
- if ( $apbct->settings['data__set_cookies'] == 2 ) {
2291
  return 1;
2292
  }
2293
 
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.169
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
169
  // Do update actions if version is changed
170
  apbct_update_actions();
171
 
172
+ /**
173
+ * @psalm-suppress TypeDoesNotContainType
174
+ */
175
  add_action('init', function () {
176
  global $apbct;
177
  // Self cron
178
  $ct_cron = new Cron();
179
  $tasks_to_run = $ct_cron->checkTasks(); // Check for current tasks. Drop tasks inner counters.
180
  if (
181
+ $tasks_to_run && // There are tasks to run
182
  ! RemoteCalls::check() && // Do not do CRON in remote call action
183
  (
184
  ! defined('DOING_CRON') ||
689
  'api_key' => $apbct->api_key,
690
  'apbct' => $apbct,
691
  'cookie_domain' => parse_url(get_option('home'), PHP_URL_HOST),
692
+ 'data__cookies_type' => $apbct->data['cookies_type'],
693
  )
694
  )
695
  );
696
 
697
+ if ( $apbct->settings['sfw__anti_crawler'] && $apbct->stats['sfw']['entries'] > 50 && $apbct->data['cookies_type'] !== 'none' ) {
698
  $firewall->loadFwModule(
699
  new \Cleantalk\ApbctWP\Firewall\AntiCrawler(
700
  APBCT_TBL_FIREWALL_LOG,
731
  function apbct_plugin_redirect()
732
  {
733
  global $apbct;
734
+ wp_suspend_cache_addition(true);
735
  if ( get_option('ct_plugin_do_activation_redirect', false) && ! isset($_GET['activate-multi']) ) {
736
  delete_option('ct_plugin_do_activation_redirect');
737
  ct_account_status_check(null, false);
738
  apbct_sfw_update__init(3); // Updating SFW
739
  wp_redirect($apbct->settings_link);
740
  }
741
+ wp_suspend_cache_addition(false);
742
  }
743
 
744
  /**
2210
  global $apbct;
2211
 
2212
  if (
2213
+ $apbct->data['cookies_type'] === 'none' || // Do not set cookies if option is disabled (for Varnish cache).
2214
  ! empty($apbct->flags__cookies_setuped) || // Cookies already set
2215
  ! empty($apbct->headers_sent) // Headers sent
2216
  ) {
2273
 
2274
  // Cookies test
2275
  $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
2276
+ if ( $apbct->data['cookies_type'] === 'native' ) {
2277
  Cookie::set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, null, true);
2278
  }
2279
 
2292
  {
2293
  global $apbct;
2294
 
2295
+ if ( $apbct->data['cookies_type'] === 'alternative' ) {
2296
  return 1;
2297
  }
2298
 
inc/cleantalk-common.php CHANGED
@@ -491,6 +491,7 @@ function apbct_get_sender_info()
491
  // PHP cookies
492
  'cookies_enabled' => $cookie_is_ok,
493
  'data__set_cookies' => $apbct->settings['data__set_cookies'],
 
494
  'REFFERRER_PREVIOUS' => Cookie::get('apbct_prev_referer') && $cookie_is_ok ? Cookie::get(
495
  'apbct_prev_referer'
496
  ) : null,
491
  // PHP cookies
492
  'cookies_enabled' => $cookie_is_ok,
493
  'data__set_cookies' => $apbct->settings['data__set_cookies'],
494
+ 'data__cookies_type' => $apbct->data['cookies_type'],
495
  'REFFERRER_PREVIOUS' => Cookie::get('apbct_prev_referer') && $cookie_is_ok ? Cookie::get(
496
  'apbct_prev_referer'
497
  ) : null,
inc/cleantalk-public.php CHANGED
@@ -574,7 +574,7 @@ function ct_add_hidden_fields(
574
  $field_id_hash = md5((string)rand(0, 1000));
575
 
576
  // Using only cookies
577
- if ( $cookie_check && $apbct->settings['data__set_cookies'] ) {
578
  $html =
579
  "<script type=\"text/javascript\" "
580
  . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '')
@@ -855,9 +855,9 @@ function apbct_js_test($field_name = 'ct_checkjs', $data = null, $is_cookie = fa
855
 
856
  if (
857
  ($data && isset($data[$field_name])) ||
858
- ($is_cookie && $apbct->settings['data__set_cookies'] == 2 && Cookie::get($field_name))
859
  ) {
860
- $js_key = $is_cookie && $apbct->settings['data__set_cookies'] == 2
861
  ? Cookie::get($field_name)
862
  : trim($data[$field_name]);
863
 
@@ -1264,7 +1264,7 @@ function apbct_enqueue_and_localize_public_scripts()
1264
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
1265
  '_rest_url' => esc_url(apbct_get_rest_url()),
1266
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
1267
- 'data__set_cookies' => $apbct->settings['data__set_cookies'],
1268
  'data__ajax_type' => $apbct->data['ajax_type'],
1269
  ));
1270
 
@@ -1274,7 +1274,7 @@ function apbct_enqueue_and_localize_public_scripts()
1274
  ($apbct->settings['data__pixel'] === '3' && apbct_is_cache_plugins_exists()),
1275
  'pixel__url' => $apbct->pixel_url,
1276
  'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'],
1277
- 'data__set_cookies' => $apbct->settings['data__set_cookies'],
1278
  ));
1279
  }
1280
 
574
  $field_id_hash = md5((string)rand(0, 1000));
575
 
576
  // Using only cookies
577
+ if ( $cookie_check && $apbct->data['cookies_type'] !== 'none' ) {
578
  $html =
579
  "<script type=\"text/javascript\" "
580
  . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '')
855
 
856
  if (
857
  ($data && isset($data[$field_name])) ||
858
+ ($is_cookie && $apbct->data['cookies_type'] === 'alternative' && Cookie::get($field_name))
859
  ) {
860
+ $js_key = $is_cookie && $apbct->data['cookies_type'] === 'alternative'
861
  ? Cookie::get($field_name)
862
  : trim($data[$field_name]);
863
 
1264
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
1265
  '_rest_url' => esc_url(apbct_get_rest_url()),
1266
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
1267
+ 'data__cookies_type' => $apbct->data['cookies_type'],
1268
  'data__ajax_type' => $apbct->data['ajax_type'],
1269
  ));
1270
 
1274
  ($apbct->settings['data__pixel'] === '3' && apbct_is_cache_plugins_exists()),
1275
  'pixel__url' => $apbct->pixel_url,
1276
  'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'],
1277
+ 'data__cookies_type' => $apbct->data['cookies_type'],
1278
  ));
1279
  }
1280
 
inc/cleantalk-settings.php CHANGED
@@ -450,7 +450,6 @@ function apbct_settings__set_fileds()
450
  'input_type' => 'radio',
451
  'options' => array(
452
  array('val' => 1, 'label' => __('On', 'cleantalk-spam-protect'), 'childrens_enable' => 0,),
453
- array('val' => 0, 'label' => __('Off', 'cleantalk-spam-protect'), 'childrens_enable' => 0,),
454
  array(
455
  'val' => 2,
456
  'label' => __(
@@ -459,11 +458,13 @@ function apbct_settings__set_fileds()
459
  ),
460
  'childrens_enable' => 1,
461
  ),
 
 
462
  ),
463
  'childrens' => array('data__ajax_type')
464
  ),
465
  'data__ajax_type' => array(
466
- 'display' => $apbct->settings['data__set_cookies'] == 2,
467
  'callback' => 'apbct_settings__check_alt_cookies_types'
468
  ),
469
  'data__ssl_on' => array(
@@ -2167,7 +2168,7 @@ function apbct_settings__validate($settings)
2167
  $apbct->data['ajax_type'] = $available_ajax_type;
2168
 
2169
  if (
2170
- (isset($settings['data__set_cookies']) && $settings['data__set_cookies'] == 2) ||
2171
  (isset($settings['data__use_ajax']) && $settings['data__use_ajax'] == 1)
2172
  ) {
2173
  if ( $available_ajax_type === false ) {
@@ -2208,7 +2209,7 @@ function apbct_settings__validate($settings)
2208
  }
2209
 
2210
  // Alt sessions table clearing
2211
- if ( $settings['data__set_cookies'] != 2 ) {
2212
  \Cleantalk\ApbctWP\Variables\AltSessions::wipe();
2213
  }
2214
 
450
  'input_type' => 'radio',
451
  'options' => array(
452
  array('val' => 1, 'label' => __('On', 'cleantalk-spam-protect'), 'childrens_enable' => 0,),
 
453
  array(
454
  'val' => 2,
455
  'label' => __(
458
  ),
459
  'childrens_enable' => 1,
460
  ),
461
+ array('val' => 3, 'label' => __('Auto', 'cleantalk-spam-protect'), 'childrens_enable' => 0,),
462
+ array('val' => 0, 'label' => __('Off', 'cleantalk-spam-protect'), 'childrens_enable' => 0,),
463
  ),
464
  'childrens' => array('data__ajax_type')
465
  ),
466
  'data__ajax_type' => array(
467
+ 'display' => $apbct->data['cookies_type'] === 'alternative',
468
  'callback' => 'apbct_settings__check_alt_cookies_types'
469
  ),
470
  'data__ssl_on' => array(
2168
  $apbct->data['ajax_type'] = $available_ajax_type;
2169
 
2170
  if (
2171
+ $apbct->data['cookies_type'] === 'alternative' ||
2172
  (isset($settings['data__use_ajax']) && $settings['data__use_ajax'] == 1)
2173
  ) {
2174
  if ( $available_ajax_type === false ) {
2209
  }
2210
 
2211
  // Alt sessions table clearing
2212
+ if ( $apbct->data['cookies_type'] !== 'alternative' ) {
2213
  \Cleantalk\ApbctWP\Variables\AltSessions::wipe();
2214
  }
2215
 
js/apbct-public--functions.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ctSetCookie(t,o,n){var e;("string"==typeof t&&"string"==typeof o||"number"==typeof o)&&(e="ct_pointer_data"===t,t=[[t,o,n]]),0==+ctPublicFunctions.data__set_cookies||(1==+ctPublicFunctions.data__set_cookies?t.forEach(function(t,o,n){var e=void 0!==t[2]?"expires="+e+"; ":"",c="https:"===location.protocol?"; secure":"";document.cookie=t[0]+"="+encodeURIComponent(t[1])+"; "+e+"path=/; samesite=lax"+c}):2!=+ctPublicFunctions.data__set_cookies||e||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{apbct_ajax:1,notJson:1}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function ctDeleteCookie(t){var o;0==+ctPublicFunctions.data__set_cookies||(1==+ctPublicFunctions.data__set_cookies?(o="https:"===location.protocol?"; secure":"",document.cookie=t+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+o):ctPublicFunctions.data__set_cookies)}function apbct_public_sendAJAX(o,n,e){var c=n.callback||null,a=n.callback_context||null,s=n.callback_params||null,t=n.async||!0,l=n.notJson||null,i=n.timeout||15e3,e=e||null,u=n.button||null,r=n.spinner||null,_=n.progressbar||null,p=n.silent||null,b=n.no_nonce||null,d=n.apbct_ajax||null;"string"==typeof o?o=(o=!b?o+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce:o)+"&no_cache="+Math.random():(b||(o._ajax_nonce=ctPublicFunctions._ajax_nonce),o.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),r&&jQuery(r).css("display","inline"),jQuery.ajax({type:"POST",url:d?ctPublicFunctions._apbct_ajax_url:ctPublicFunctions._ajax_url,data:o,async:t,success:function(t){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),(t=!l?JSON.parse(t):t).error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):c&&(s?c.apply(a,s.concat(t,o,n,e)):c(t,o,n,e))},error:function(t,o,n){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:i})}function apbct_public_sendREST(o,n){var e=n.callback||null,t=n.data||[],c=n.method||"POST";jQuery.ajax({type:c,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+o,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):e&&e(t,o,n,null)},error:function(t,o,n){n&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}
2
  //# sourceMappingURL=apbct-public--functions.min.js.map
1
+ function ctSetCookie(t,o,n){var e;("string"==typeof t&&"string"==typeof o||"number"==typeof o)&&(e="ct_pointer_data"===t,t=[[t,o,n]]),"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?t.forEach(function(t,o,n){var e=void 0!==t[2]?"expires="+e+"; ":"",a="https:"===location.protocol?"; secure":"";document.cookie=t[0]+"="+encodeURIComponent(t[1])+"; "+e+"path=/; samesite=lax"+a}):"alternative"!==ctPublicFunctions.data__cookies_type||e||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{apbct_ajax:1,notJson:1}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function ctDeleteCookie(t){var o;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(o="https:"===location.protocol?"; secure":"",document.cookie=t+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+o):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(o,n,e){var a=n.callback||null,c=n.callback_context||null,s=n.callback_params||null,t=n.async||!0,l=n.notJson||null,i=n.timeout||15e3,e=e||null,u=n.button||null,r=n.spinner||null,_=n.progressbar||null,p=n.silent||null,b=n.no_nonce||null,d=n.apbct_ajax||null;"string"==typeof o?(b||(o=o+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce),o=o+"&no_cache="+Math.random()):(b||(o._ajax_nonce=ctPublicFunctions._ajax_nonce),o.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),r&&jQuery(r).css("display","inline"),jQuery.ajax({type:"POST",url:d?ctPublicFunctions._apbct_ajax_url:ctPublicFunctions._ajax_url,data:o,async:t,success:function(t){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),l||(t=JSON.parse(t)),t.error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):a&&(s?a.apply(c,s.concat(t,o,n,e)):a(t,o,n,e))},error:function(t,o,n){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:i})}function apbct_public_sendREST(o,n){var e=n.callback||null,t=n.data||[],a=n.method||"POST";jQuery.ajax({type:a,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+o,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):e&&e(t,o,n,null)},error:function(t,o,n){n&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}
2
  //# sourceMappingURL=apbct-public--functions.min.js.map
js/apbct-public--functions.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( +ctPublicFunctions.data__set_cookies === 0 ){\n return;\n\n // Using traditional cookies\n }else if( +ctPublicFunctions.data__set_cookies === 1 ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( +ctPublicFunctions.data__set_cookies === 2 && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n }else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n apbct_ajax: 1,\n notJson: 1,\n }\n );\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( +ctPublicFunctions.data__set_cookies === 0 ){\n return;\n\n // Using traditional cookies\n }else if( +ctPublicFunctions.data__set_cookies === 1 ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( +ctPublicFunctions.data__set_cookies === 2 ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n var apbct_ajax = params.apbct_ajax || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: apbct_ajax ? ctPublicFunctions._apbct_ajax_url : ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__set_cookies","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_ajax","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_apbct_ajax_url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,IAAxCE,kBAAkBC,oBAI4B,IAAxCD,kBAAkBC,kBACzBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,EAAK,IAAM,KAAOL,EAAU,uBAAyBQ,IAI/D,IAAxCN,kBAAkBC,mBAA6BF,IAGZ,SAAtCC,kBAAkBY,gBAClBC,sBACI,eACA,CACIC,OAAQ,OACRC,KAAM,CAAEnB,QAASA,KAKmB,gBAAtCI,kBAAkBY,gBACxBI,sBACI,CACIC,OAAQ,gCACRrB,QAASA,GAEb,CACIsB,WAAY,EACZC,QAAS,IAG4B,eAAtCnB,kBAAkBY,iBACzBI,sBACI,CACIC,OAAQ,gCACRrB,QAASA,GAEb,CACIuB,QAAS,MAO7B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R,EAAOI,OAAS,YAE9C7B,IACKE,EACAF,EAASkC,MAAOjC,EAAkBC,EAAgBiC,OAAQV,EAAQlC,EAAMO,EAAQC,IAEhFC,EAASyB,EAAQlC,EAAMO,EAAQC,KAI/C8B,MAAO,SAASO,EAAOC,EAAYC,GAC5BjC,IAAUA,EAAOqB,gBAAgB,YAAarB,EAAOU,MAAMC,OAAS,WACpEV,GAASW,OAAOX,GAASY,IAAI,UAAW,QACvCoB,IAAiB9B,IACjBwB,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,wCAA0CK,EAAc,yGAG5ElC,QAASA,IAIjB,SAASf,sBAAuBkD,EAAOzC,GAEnC,IAAIE,EAAWF,EAAOE,UAAY,KAC9BT,EAAWO,EAAOP,MAAQ,GAC1BD,EAAWQ,EAAOR,QAAU,OAEhC2B,OAAOE,KAAK,CACRC,KAAM9B,EACN+B,IAAK7C,kBAAkBgE,UAAY,yBAA2BD,EAC9DhD,KAAMA,EACNkD,WAAa,SAAWC,GACpBA,EAAIC,iBAAkB,aAAcnE,kBAAkBoE,cAE1DpB,QAAS,SAASC,GACXA,EAAOI,MACNG,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C7B,GAECA,EAASyB,EAAQc,EAAOzC,EADd,OAKtB+B,MAAO,SAASO,EAAOC,EAAYC,GAC3BA,IACAN,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc"}
1
+ {"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n }else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n apbct_ajax: 1,\n notJson: 1,\n }\n );\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n var apbct_ajax = params.apbct_ajax || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: apbct_ajax ? ctPublicFunctions._apbct_ajax_url : ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__cookies_type","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_ajax","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_apbct_ajax_url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,SAAzCE,kBAAkBC,qBAI6B,WAAzCD,kBAAkBC,mBACxBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,EAAK,IAAM,KAAOL,EAAU,uBAAyBQ,IAI/D,gBAAz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IAAI,iDAAmDK,EAAc"}
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_collect_visible_fields(e){var t=[],n="",o=0,c="",a=0,i=[];for(var l in e.elements)isNaN(+l)||(t[l]=e.elements[l]);return(t=t.filter(function(e){return-1===i.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(i.push(e.getAttribute("name")),!1))})).forEach(function(e,t,i){"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&"ct_checkjs"!==e.getAttribute("name")&&("none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")||e.classList.contains("wp-editor-area")?(n+=" "+e.getAttribute("name"),o++):(c+=" "+e.getAttribute("name"),a++))}),c=c.trim(),{visible_fields:n=n.trim(),visible_fields_count:o,invisible_fields:c,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(e,t){var i="object"==typeof e&&null!==e?e:{};if(1==+ctPublic.data__set_cookies)for(var n in i){ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(i[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_visible_fields_already_collected(e,t){if(0<e.length&&0<t.elements.length){var i=t.method,n=(t.action,t.elements.length),o=[];for(var c in t.elements)isNaN(+c)||(o[c]=t.elements[c]);for(var a=0;a<e.length;a++){if(e[a].method!==i)return!1;if(e[a].action,e[a].fields_count!==n)return!1;var l=e[a].fields_names;for(var s in l){if(0<o.filter(function(e,t,i){var n=e.name,o=e.type;if(l[s].fieldName===n&&l[s].fieldType===o)return!0}).length)return!0}}return!1}return!1}function apbct_get_form_details(e){if(0<e.elements.length){var t={},n=e.elements;for(i=0;i<n.length;i++){var o=n[i].name,c=n[i].type;t[i]={fieldName:o,fieldType:c}}return{method:e.method,action:e.action,fields_count:e.elements.length,fields_names:t}}return!1}function apbct_js_keys__set_input_value(e,t,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var o=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<o.length;c++)o[c].value=e.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,t=(new Date).getTime(),i=!0,n=[],c=0,a={},e=!1,l=!1;function s(e,t,i){"function"==typeof window.addEventListener?e.addEventListener(t,i):e.attachEvent(t,i)}function r(e,t,i){"function"==typeof window.removeEventListener?e.removeEventListener(t,i):e.detachEvent(t,i)}var d=function(){var e=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",e),r(window,"mousedown",d),r(window,"keydown",d)},u=setInterval(function(){i=!0},150),_=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(e){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),i=!1,50<=++c&&(r(window,"mousemove",m),clearInterval(u),clearInterval(_)))};function f(e){var t=e.target.value;!t||t in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(a[t]={result:e.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:t},{apbct_ajax:1,callback:function(e){e.result&&(a[t]={result:e.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:t},{callback:function(e){e.result&&(a[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}s(window,"mousemove",m),s(window,"mousedown",d),s(window,"keydown",d),s(window,"scroll",function(){e||(ctSetCookie("ct_has_scrolled","true"),e=!0)}),s(window,"DOMContentLoaded",function(){var 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(1!=+ctPublic.data__set_cookies)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var i=0;i<t.length;i++){var n=t[i].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(e.push(["apbct_pixel_url",ctPublic.pixel__url]),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+ctPublic.pixel__url+'">'))),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(f)),ctSetCookie(e),setTimeout(function(){for(var e={},t=[],i=0;i<document.forms.length;i++){var n=document.forms[i];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.name.classList&&n.name.classList.contains("tinkoffPayRow")||n.name.classList&&n.name.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.indexOf("calculatedfields")||(apbct_visible_fields_already_collected(t,n)||(e[i]=apbct_collect_visible_fields(n),t.push(apbct_get_form_details(n))),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=i,n.onsubmit=function(e){var t;1!=+ctPublic.data__set_cookies&&void 0!==e.target.ctFormIndex&&((t={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t,e.target.ctFormIndex)),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,i){var n;!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(n=JSON.parse(t.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(e){var t=[],n="",o=0,c="",a=0,i=[];for(var l in e.elements)isNaN(+l)||(t[l]=e.elements[l]);return(t=t.filter(function(e){return-1===i.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(i.push(e.getAttribute("name")),!1))})).forEach(function(e,t,i){"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&"ct_checkjs"!==e.getAttribute("name")&&("none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")||e.classList.contains("wp-editor-area")?(n+=" "+e.getAttribute("name"),o++):(c+=" "+e.getAttribute("name"),a++))}),c=c.trim(),{visible_fields:n=n.trim(),visible_fields_count:o,invisible_fields:c,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(e,t){var i="object"==typeof e&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in i){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(i[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_visible_fields_already_collected(e,t){if(0<e.length&&0<t.elements.length){var i=t.method,n=(t.action,t.elements.length),o=[];for(var c in t.elements)isNaN(+c)||(o[c]=t.elements[c]);for(var a=0;a<e.length;a++){if(e[a].method!==i)return!1;if(e[a].action,e[a].fields_count!==n)return!1;var l=e[a].fields_names;for(var s in l){if(0<o.filter(function(e,t,i){var n=e.name,o=e.type;if(l[s].fieldName===n&&l[s].fieldType===o)return!0}).length)return!0}}return!1}return!1}function apbct_get_form_details(e){if(0<e.elements.length){var t={},n=e.elements;for(i=0;i<n.length;i++){var o=n[i].name,c=n[i].type;t[i]={fieldName:o,fieldType:c}}return{method:e.method,action:e.action,fields_count:e.elements.length,fields_names:t}}return!1}function apbct_js_keys__set_input_value(e,t,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var o=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<o.length;c++)o[c].value=e.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,t=(new Date).getTime(),i=!0,n=[],c=0,a={},e=!1,l=!1;function s(e,t,i){"function"==typeof window.addEventListener?e.addEventListener(t,i):e.attachEvent(t,i)}function r(e,t,i){"function"==typeof window.removeEventListener?e.removeEventListener(t,i):e.detachEvent(t,i)}var d=function(){var e=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",e),r(window,"mousedown",d),r(window,"keydown",d)},u=setInterval(function(){i=!0},150),_=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(e){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),i=!1,50<=++c&&(r(window,"mousemove",m),clearInterval(u),clearInterval(_)))};function f(e){var t=e.target.value;!t||t in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(a[t]={result:e.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:t},{apbct_ajax:1,callback:function(e){e.result&&(a[t]={result:e.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:t},{callback:function(e){e.result&&(a[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}s(window,"mousemove",m),s(window,"mousedown",d),s(window,"keydown",d),s(window,"scroll",function(){e||(ctSetCookie("ct_has_scrolled","true"),e=!0)}),s(window,"DOMContentLoaded",function(){var 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 t=document.cookie.split(";");if(0!==t.length)for(var i=0;i<t.length;i++){var n=t[i].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(e.push(["apbct_pixel_url",ctPublic.pixel__url]),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+ctPublic.pixel__url+'">'))),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(f)),ctSetCookie(e),setTimeout(function(){for(var e={},t=[],i=0;i<document.forms.length;i++){var n=document.forms[i];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.name.classList&&n.name.classList.contains("tinkoffPayRow")||n.name.classList&&n.name.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||(apbct_visible_fields_already_collected(t,n)||(e[i]=apbct_collect_visible_fields(n),t.push(apbct_get_form_details(n))),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=i,n.onsubmit=function(e){var t;"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&((t={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t,e.target.ctFormIndex)),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,i){var n;!t.responseText||-1===t.responseText.indexOf('"apbct')||void 0!==(n=JSON.parse(t.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
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 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__set_cookies !== 1 ) {\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\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + ctPublic.pixel__url + '\">' );\n\t\t\t\t}\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\tvar visible_fields_collection = {};\n\t\t\tvar processedForms = [];\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.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.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.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.indexOf('calculatedfields') !== -1) // CalculatedFieldsForm\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif( ! apbct_visible_fields_already_collected( processedForms, form ) ) {\n\t\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\t\t\t\t\tprocessedForms.push( apbct_get_form_details( form ) );\n\t\t\t\t}\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__set_cookies !== 1 && 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\tapbct_visible_fields_set_cookie( visible_fields_collection );\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__set_cookies === 1 ) {\n\t\tfor ( var i in collection ) {\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_visible_fields_already_collected( formsProcessed, form ) {\n\n\tif ( formsProcessed.length > 0 && form.elements.length > 0 ) {\n\n\t\tvar formMethod = form.method;\n\t\tvar formAction = form.action;\n\t\tvar formFieldsCount = form.elements.length;\n\t\tvar formInputs = [];\n\n\t\t// Getting only input elements from HTMLFormControlsCollection and putting these into the simple array.\n\t\tfor( var key in form.elements ){\n\t\t\tif( ! isNaN( +key ) ) {\n\t\t\t\tformInputs[key] = form.elements[key];\n\t\t\t}\n\t\t}\n\n\t\tfor ( var i = 0; i < formsProcessed.length; i++ ) {\n\t\t\t// The form with the same METHOD has not processed.\n\t\t\tif ( formsProcessed[i].method !== formMethod ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// The form with the same ACTION has not processed.\n\t\t\tif ( formsProcessed[i].action !== formAction ) {\n\t\t\t\t// @ToDo actions often are different in the similar forms\n\t\t\t\t//return false;\n\t\t\t}\n\t\t\t// The form with the same FIELDS COUNT has not processed.\n\t\t\tif ( formsProcessed[i].fields_count !== formFieldsCount ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Compare every form fields by their TYPE and NAME\n\t\t\tvar fieldsNames = formsProcessed[i].fields_names;\n\t\t\tfor ( var field in fieldsNames ) {\n\t\t\t\tvar res = formInputs.filter(function(item, index, array){\n\t\t\t\t\tvar fieldName = item.name;\n\t\t\t\t\tvar fieldType = item.type;\n\t\t\t\t\tif( fieldsNames[field].fieldName === fieldName && fieldsNames[field].fieldType === fieldType ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif( res.length > 0 ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\treturn false;\n}\n\nfunction apbct_get_form_details( form ) {\n\n\tif( form.elements.length > 0 ) {\n\n\t\tvar fieldsNames = {};\n\n\t\t// Collecting fields and their names\n\t\tvar inputs = form.elements;\n\t\tfor (i = 0; i < inputs.length; i++) {\n\t\t\tvar fieldName = inputs[i].name;\n\t\t\tvar fieldType = inputs[i].type;\n\t\t\tfieldsNames[i] = {\n\t\t\t\tfieldName : fieldName,\n\t\t\t\tfieldType : fieldType,\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t'method' : form.method,\n\t\t\t'action' : form.action,\n\t\t\t'fields_count' : form.elements.length,\n\t\t\t'fields_names' : fieldsNames,\n\t\t};\n\t}\n\n\treturn false;\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__set_cookies","ctSetCookie","undefined","JSON","stringify","apbct_visible_fields_already_collected","formsProcessed","length","formMethod","method","formFieldsCount","action","formInputs","fields_count","fieldsNames","fields_names","field","item","index","array","fieldName","name","fieldType","type","apbct_get_form_details","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","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","email","timestamp","now","apbct_public_sendAJAX","apbct_ajax","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","pixel__url","pixel__enabled","getElementById","jQuery","append","data__email_check_before_post","blur","setTimeout","processedForms","forms","parentElement","toString","id","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":"AAoPA,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,eAHDtB,EAAiBA,EAAeqB,OAI/BE,qBAAuBtB,EACvBuB,iBAAmBtB,EACnBuB,uBAAyBtB,GAK3B,SAASuB,gCAAiCC,EAA2BC,GAEpE,IAAIC,EAAkD,iBAA9BF,GAAwE,OAA9BA,EAAsCA,EAA4B,GAEpI,GAAqC,IAA/BG,SAASC,kBACd,IAAM,IAAIjB,KAAKe,EAAa,CAE3BG,YAAY,8BADsBC,IAAZL,EAAwBA,EAAUd,G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C,UAAUC,SAAS,kBACpDtB,EAAKsD,KAAKjC,WAAarB,EAAKsD,KAAKjC,UAAUC,SAAS,cACpDtB,EAAK+I,IAAkB,6BAAZ/I,EAAK+I,IAChB/I,EAAK+I,KAA+C,IAAzC/I,EAAK+I,GAAGnI,QAAQ,sBAIvB0B,uCAAwCqG,EAAgB3I,KAC7D6B,EAA0Bb,GAAKjB,6BAA8BC,GAC7D2I,EAAe7H,KAAM2C,uBAAwBzD,KAG9CA,EAAKgJ,cAAgBhJ,EAAKiJ,SAE1BjJ,EAAKkJ,YAAclI,EACnBhB,EAAKiJ,SAAW,SAAUrD,GAEzB,IAEKpE,EAFiC,IAA/BQ,SAASC,wBAA+D,IAA7B2D,EAAMsB,OAAOgC,eAE1D1H,EAAiB,IACN,GAAKzB,6BAA6BoJ,MACjDvH,gCAAiCJ,EAAgBoE,EAAMsB,OAAOgC,cAI3DtD,EAAMsB,OAAO8B,yBAAyBI,UACzCV,WAAW,WACV9C,EAAMsB,OAAO8B,cAAcK,KAAKzD,EAAMsB,OAAQtB,IAC5C,OAKNhE,gCAAiCC,IAE/B,OA9OL,GAobqB,oBAAXyG,QAGTA,OAAOvE,UAAUuF,aAAa,SAAU1D,EAAO2D,EAAKC,GACnD,IACKC,GADDF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAa9I,QAAQ,gBAElB,KAD1B6I,EAAWrH,KAAKuH,MAAMJ,EAAIG,eACVE,QACnBH,EAAWA,EAASG,OACPC,UACZ9F,SAAS+F,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAAST,EAASU,YAK9BC,eAAeC,OAASZ,EAASU,QACjCC,eAAeE,OAEa,IAAxBb,EAASc,aACZzE,OAAO0E"}
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 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\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + ctPublic.pixel__url + '\">' );\n\t\t\t\t}\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\tvar visible_fields_collection = {};\n\t\t\tvar processedForms = [];\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.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.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.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)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tif( ! apbct_visible_fields_already_collected( processedForms, form ) ) {\n\t\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\t\t\t\t\tprocessedForms.push( apbct_get_form_details( form ) );\n\t\t\t\t}\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\tapbct_visible_fields_set_cookie( visible_fields_collection );\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_visible_fields_already_collected( formsProcessed, form ) {\n\n\tif ( formsProcessed.length > 0 && form.elements.length > 0 ) {\n\n\t\tvar formMethod = form.method;\n\t\tvar formAction = form.action;\n\t\tvar formFieldsCount = form.elements.length;\n\t\tvar formInputs = [];\n\n\t\t// Getting only input elements from HTMLFormControlsCollection and putting these into the simple array.\n\t\tfor( var key in form.elements ){\n\t\t\tif( ! isNaN( +key ) ) {\n\t\t\t\tformInputs[key] = form.elements[key];\n\t\t\t}\n\t\t}\n\n\t\tfor ( var i = 0; i < formsProcessed.length; i++ ) {\n\t\t\t// The form with the same METHOD has not processed.\n\t\t\tif ( formsProcessed[i].method !== formMethod ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// The form with the same ACTION has not processed.\n\t\t\tif ( formsProcessed[i].action !== formAction ) {\n\t\t\t\t// @ToDo actions often are different in the similar forms\n\t\t\t\t//return false;\n\t\t\t}\n\t\t\t// The form with the same FIELDS COUNT has not processed.\n\t\t\tif ( formsProcessed[i].fields_count !== formFieldsCount ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Compare every form fields by their TYPE and NAME\n\t\t\tvar fieldsNames = formsProcessed[i].fields_names;\n\t\t\tfor ( var field in fieldsNames ) {\n\t\t\t\tvar res = formInputs.filter(function(item, index, array){\n\t\t\t\t\tvar fieldName = item.name;\n\t\t\t\t\tvar fieldType = item.type;\n\t\t\t\t\tif( fieldsNames[field].fieldName === fieldName && fieldsNames[field].fieldType === fieldType ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif( res.length > 0 ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\treturn false;\n}\n\nfunction apbct_get_form_details( form ) {\n\n\tif( form.elements.length > 0 ) {\n\n\t\tvar fieldsNames = {};\n\n\t\t// Collecting fields and their names\n\t\tvar inputs = form.elements;\n\t\tfor (i = 0; i < inputs.length; i++) {\n\t\t\tvar fieldName = inputs[i].name;\n\t\t\tvar fieldType = inputs[i].type;\n\t\t\tfieldsNames[i] = {\n\t\t\t\tfieldName : fieldName,\n\t\t\t\tfieldType : fieldType,\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\t'method' : form.method,\n\t\t\t'action' : form.action,\n\t\t\t'fields_count' : form.elements.length,\n\t\t\t'fields_names' : fieldsNames,\n\t\t};\n\t}\n\n\treturn false;\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_visible_fields_already_collected","formsProcessed","length","formMethod","method","formFieldsCount","action","formInputs","fields_count","fieldsNames","fields_names","field","item","index","array","fieldName","name","fieldType","type","apbct_get_form_details","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","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","email","timestamp","now","apbct_public_sendAJAX","apbct_ajax","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","pixel__url","pixel__enabled","getElementById","jQuery","append","data__email_check_before_post","blur","setTimeout","processedForms","forms","parentElement","toString","id","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":"AAoPA,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,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AAIG,eACVE,QACnBH,EAAWA,EAASG,OACPC,UACZ9F,SAAS+F,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAAST,EAASU,YAK9BC,eAAeC,OAASZ,EAASU,QACjCC,eAAeE,OAEa,IAAxBb,EAASc,aACZzE,OAAO0E"}
lib/Cleantalk/ApbctWP/Activator.php CHANGED
@@ -11,6 +11,10 @@ class Activator
11
  {
12
  global $wpdb, $apbct;
13
 
 
 
 
 
14
  $db_tables_creator = new DbTablesCreator();
15
 
16
  if ( is_null($concrete_blog_id) ) {
11
  {
12
  global $wpdb, $apbct;
13
 
14
+ // Ajax type
15
+ $apbct->data['ajax_type'] = apbct_settings__get_ajax_type();
16
+ $apbct->save('data');
17
+
18
  $db_tables_creator = new DbTablesCreator();
19
 
20
  if ( is_null($concrete_blog_id) ) {
lib/Cleantalk/ApbctWP/Ajax.php CHANGED
@@ -76,13 +76,13 @@ class Ajax
76
  break;
77
  case 'apbct_alt_session__save__AJAX':
78
  // Using alternative sessions with ajax
79
- if ( $apbct->settings['data__set_cookies'] == 2 && $apbct->data['ajax_type'] === 'custom_ajax' ) {
80
  apbct_alt_session__save__AJAX();
81
  }
82
  break;
83
  case 'apbct_alt_session__get__AJAX':
84
  // Using alternative sessions with ajax
85
- if ( $apbct->settings['data__set_cookies'] == 2 && $apbct->data['ajax_type'] === 'custom_ajax' ) {
86
  apbct_alt_session__get__AJAX();
87
  }
88
  break;
76
  break;
77
  case 'apbct_alt_session__save__AJAX':
78
  // Using alternative sessions with ajax
79
+ if ( $apbct->data['cookies_type'] === 'alternative' && $apbct->data['ajax_type'] === 'custom_ajax' ) {
80
  apbct_alt_session__save__AJAX();
81
  }
82
  break;
83
  case 'apbct_alt_session__get__AJAX':
84
  // Using alternative sessions with ajax
85
+ if ( $apbct->data['cookies_type'] === 'alternative' && $apbct->data['ajax_type'] === 'custom_ajax' ) {
86
  apbct_alt_session__get__AJAX();
87
  }
88
  break;
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php CHANGED
@@ -350,7 +350,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
350
  {
351
  global $apbct;
352
 
353
- if ( $apbct->settings['data__set_cookies'] == 0 && ! is_admin() ) {
354
  return;
355
  }
356
 
@@ -492,7 +492,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
492
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
493
  '_rest_url' => esc_url(get_rest_url()),
494
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
495
- 'data__set_cookies' => $apbct->settings['data__set_cookies'],
496
  'data__ajax_type' => $apbct->data['ajax_type'],
497
  'sfw__random_get' => $apbct->settings['sfw__random_get'] === '1' ||
498
  ($apbct->settings['sfw__random_get'] === '-1' && apbct_is_cache_plugins_exists())
350
  {
351
  global $apbct;
352
 
353
+ if ( $apbct->data['cookies_type'] === 'none' && ! is_admin() ) {
354
  return;
355
  }
356
 
492
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
493
  '_rest_url' => esc_url(get_rest_url()),
494
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
495
+ 'data__cookies_type' => $apbct->data['cookies_type'],
496
  'data__ajax_type' => $apbct->data['ajax_type'],
497
  'sfw__random_get' => $apbct->settings['sfw__random_get'] === '1' ||
498
  ($apbct->settings['sfw__random_get'] === '-1' && apbct_is_cache_plugins_exists())
lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php CHANGED
@@ -261,7 +261,7 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule
261
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
262
  '_rest_url' => esc_url(get_rest_url()),
263
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
264
- 'data__set_cookies' => $apbct->settings['data__set_cookies'],
265
  'data__ajax_type' => $apbct->data['ajax_type'],
266
  'sfw__random_get' => $apbct->settings['sfw__random_get'] === '1' ||
267
  ($apbct->settings['sfw__random_get'] === '-1' && apbct_is_cache_plugins_exists())
261
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
262
  '_rest_url' => esc_url(get_rest_url()),
263
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
264
+ 'data__cookies_type' => $apbct->data['cookies_type'],
265
  'data__ajax_type' => $apbct->data['ajax_type'],
266
  'sfw__random_get' => $apbct->settings['sfw__random_get'] === '1' ||
267
  ($apbct->settings['sfw__random_get'] === '-1' && apbct_is_cache_plugins_exists())
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -20,7 +20,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
20
  private $sfw_counter = false;
21
  private $api_key = false;
22
  private $apbct = array();
23
- private $data__set_cookies = false;
24
  private $cookie_domain = false;
25
 
26
  public $module_name = 'SFW';
@@ -156,7 +156,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
156
  'ip' => $current_ip,
157
  'network' => Helper::ipLong2ip($db_result['network'])
158
  . '/'
159
- . Helper::ipMaskLongToNumber($db_result['mask']),
160
  'is_personal' => $db_result['source'],
161
  );
162
 
@@ -247,7 +247,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
247
 
248
  public function actionsForPassed($result)
249
  {
250
- if ($this->data__set_cookies == 1 && ! headers_sent()) {
251
  $status = $result['status'] === 'PASS_SFW__BY_WHITELIST' ? '1' : '0';
252
  $cookie_val = md5($result['ip'] . $this->api_key) . $status;
253
  Cookie::setNativeCookie(
@@ -409,7 +409,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
409
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
410
  '_rest_url' => esc_url(get_rest_url()),
411
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
412
- 'data__set_cookies' => $apbct->settings['data__set_cookies'],
413
  'data__ajax_type' => $apbct->data['ajax_type'],
414
  'sfw__random_get' => $apbct->settings['sfw__random_get'] === '1' ||
415
  ($apbct->settings['sfw__random_get'] === '-1' && apbct_is_cache_plugins_exists())
20
  private $sfw_counter = false;
21
  private $api_key = false;
22
  private $apbct = array();
23
+ private $data__cookies_type = false;
24
  private $cookie_domain = false;
25
 
26
  public $module_name = 'SFW';
156
  'ip' => $current_ip,
157
  'network' => Helper::ipLong2ip($db_result['network'])
158
  . '/'
159
+ . Helper::ipMaskLongToNumber((int)$db_result['mask']),
160
  'is_personal' => $db_result['source'],
161
  );
162
 
247
 
248
  public function actionsForPassed($result)
249
  {
250
+ if ($this->data__cookies_type === 'native' && ! headers_sent()) {
251
  $status = $result['status'] === 'PASS_SFW__BY_WHITELIST' ? '1' : '0';
252
  $cookie_val = md5($result['ip'] . $this->api_key) . $status;
253
  Cookie::setNativeCookie(
409
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
410
  '_rest_url' => esc_url(get_rest_url()),
411
  '_apbct_ajax_url' => APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php',
412
+ 'data__cookies_type' => $apbct->data['cookies_type'],
413
  'data__ajax_type' => $apbct->data['ajax_type'],
414
  'sfw__random_get' => $apbct->settings['sfw__random_get'] === '1' ||
415
  ($apbct->settings['sfw__random_get'] === '-1' && apbct_is_cache_plugins_exists())
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -87,8 +87,8 @@ class State extends \Cleantalk\Common\State
87
  'data__use_static_js_key' => -1,
88
  'data__general_postdata_test' => 0,
89
  //CAPD
90
- 'data__set_cookies' => 1,
91
- // Alternative cookies handler type: REST API - 0 / custom AJAX - 1 / WP AJAX - 2
92
  'data__ssl_on' => 0,
93
  // Secure connection to servers
94
  'data__pixel' => '3',
@@ -142,6 +142,7 @@ class State extends \Cleantalk\Common\State
142
  'current_settings_template_id' => null, // Loaded settings template id
143
  'current_settings_template_name' => null, // Loaded settings template name
144
  'ajax_type' => false, // Ajax type
 
145
 
146
  // Antispam
147
  'spam_store_days' => 15, // Days before delete comments from folder Spam
@@ -392,10 +393,6 @@ class State extends \Cleantalk\Common\State
392
 
393
  // Setting default options
394
  if ($this->option_prefix . '_' . $option_name === 'cleantalk_settings') {
395
- if ( ! $option) {
396
- //Set alt cookies if sg optimizer is installed
397
- $this->def_settings['data__set_cookies'] = defined('SiteGround_Optimizer\VERSION') ? 2 : 1;
398
- }
399
  $option = is_array($option) ? array_merge($this->def_settings, $option) : $this->def_settings;
400
  }
401
 
@@ -439,6 +436,17 @@ class State extends \Cleantalk\Common\State
439
  $this->dashboard_link = 'https://cleantalk.org/my/' . ($this->user_token ? '?user_token=' . $this->user_token : '');
440
  $this->notice_show = $this->data['notice_trial'] || $this->data['notice_renew'] || $this->data['notice_incompatibility'] || $this->isHaveErrors();
441
 
 
 
 
 
 
 
 
 
 
 
 
442
  // Network with Mutual key
443
  if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) {
444
  // Get stats from main blog
@@ -760,4 +768,12 @@ class State extends \Cleantalk\Common\State
760
  {
761
  unset($this->storage[$name]);
762
  }
 
 
 
 
 
 
 
 
763
  }
87
  'data__use_static_js_key' => -1,
88
  'data__general_postdata_test' => 0,
89
  //CAPD
90
+ 'data__set_cookies' => 3,
91
+ // Cookies type: 0 - Off / 1 - Native cookies / 2 - Alt cookies / 3 - Auto
92
  'data__ssl_on' => 0,
93
  // Secure connection to servers
94
  'data__pixel' => '3',
142
  'current_settings_template_id' => null, // Loaded settings template id
143
  'current_settings_template_name' => null, // Loaded settings template name
144
  'ajax_type' => false, // Ajax type
145
+ 'cookies_type' => 'native', // Native / Alternative / None
146
 
147
  // Antispam
148
  'spam_store_days' => 15, // Days before delete comments from folder Spam
393
 
394
  // Setting default options
395
  if ($this->option_prefix . '_' . $option_name === 'cleantalk_settings') {
 
 
 
 
396
  $option = is_array($option) ? array_merge($this->def_settings, $option) : $this->def_settings;
397
  }
398
 
436
  $this->dashboard_link = 'https://cleantalk.org/my/' . ($this->user_token ? '?user_token=' . $this->user_token : '');
437
  $this->notice_show = $this->data['notice_trial'] || $this->data['notice_renew'] || $this->data['notice_incompatibility'] || $this->isHaveErrors();
438
 
439
+ // Set cookies type to the DATA
440
+ if ( $this->settings['data__set_cookies'] ) {
441
+ $this->data['cookies_type'] =
442
+ ( $this->settings['data__set_cookies'] == 3 && $this->isServerCacheDetected() ) ||
443
+ $this->settings['data__set_cookies'] == 2
444
+ ? 'alternative'
445
+ : 'native';
446
+ } else {
447
+ $this->data['cookies_type'] = 'none';
448
+ }
449
+
450
  // Network with Mutual key
451
  if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) {
452
  // Get stats from main blog
768
  {
769
  unset($this->storage[$name]);
770
  }
771
+
772
+ private function isServerCacheDetected()
773
+ {
774
+ $headers = Helper::httpGetHeaders();
775
+ return
776
+ isset($headers['X-Varnish']) || //Set alt cookies if varnish is installed
777
+ defined('SiteGround_Optimizer\VERSION'); //Set alt cookies if sg optimizer is installed
778
+ }
779
  }
lib/Cleantalk/ApbctWP/Variables/Cookie.php CHANGED
@@ -25,7 +25,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
25
  // Get from GLOBAL variable
26
  } else {
27
  // Getting by alternative way if enabled
28
- if ($apbct->settings['data__set_cookies'] == 2) {
29
  $value = AltSessions::get($name);
30
  // The old way
31
  } else {
@@ -80,9 +80,9 @@ class Cookie extends \Cleantalk\Variables\Cookie
80
  ) {
81
  global $apbct;
82
 
83
- if ($apbct->settings['data__set_cookies'] == 0 && ! is_admin()) {
84
  return;
85
- } elseif ($apbct->settings['data__set_cookies'] == 2) {
86
  AltSessions::set($name, $value);
87
  } else {
88
  self::setNativeCookie($name, $value, $expires, $path, $domain, $secure, $httponly, $samesite);
@@ -153,7 +153,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
153
  {
154
  global $apbct;
155
 
156
- if ( $apbct->settings['data__set_cookies'] == 1 ) {
157
  // Get from separated native cookies and convert it to collection
158
  $visible_fields_cookies_array = array_filter($_COOKIE, static function ($key) {
159
  return strpos($key, 'apbct_visible_fields_') !== false;
25
  // Get from GLOBAL variable
26
  } else {
27
  // Getting by alternative way if enabled
28
+ if ($apbct->data['cookies_type'] === 'alternative') {
29
  $value = AltSessions::get($name);
30
  // The old way
31
  } else {
80
  ) {
81
  global $apbct;
82
 
83
+ if ($apbct->data['cookies_type'] === 'none' && ! is_admin()) {
84
  return;
85
+ } elseif ($apbct->data['cookies_type'] === 'alternative') {
86
  AltSessions::set($name, $value);
87
  } else {
88
  self::setNativeCookie($name, $value, $expires, $path, $domain, $secure, $httponly, $samesite);
153
  {
154
  global $apbct;
155
 
156
+ if ( $apbct->data['cookies_type'] === 'native' ) {
157
  // Get from separated native cookies and convert it to collection
158
  $visible_fields_cookies_array = array_filter($_COOKIE, static function ($key) {
159
  return strpos($key, 'apbct_visible_fields_') !== false;
lib/Cleantalk/Common/API.php CHANGED
@@ -865,8 +865,7 @@ class API
865
  public static function methodSendLocalSettings(
866
  $api_key,
867
  $hostname,
868
- $settings,
869
- $do_check = true
870
  ) {
871
  $request = array(
872
  'method_name' => 'service_update_local_settings',
@@ -875,10 +874,7 @@ class API
875
  'settings' => $settings
876
  );
877
 
878
- $result = static::sendRequest($request);
879
- $result = $do_check ? static::checkResponse($result, 'send_local_settings') : $result;
880
-
881
- return $result;
882
  }
883
 
884
  private static function getProductId($product_name)
@@ -946,10 +942,21 @@ class API
946
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
947
  }
948
 
 
 
 
 
 
 
949
  // Make a request
950
  $result = curl_exec($ch);
951
  $errors = curl_error($ch);
952
  curl_close($ch);
 
 
 
 
 
953
  } else {
954
  $errors = 'CURL_NOT_INSTALLED';
955
  }
865
  public static function methodSendLocalSettings(
866
  $api_key,
867
  $hostname,
868
+ $settings
 
869
  ) {
870
  $request = array(
871
  'method_name' => 'service_update_local_settings',
874
  'settings' => $settings
875
  );
876
 
877
+ return static::sendRequest($request, self::URL, 0);
 
 
 
878
  }
879
 
880
  private static function getProductId($product_name)
942
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
943
  }
944
 
945
+ // Make an asynchronous request, don't wait for an answer
946
+ if ( $timeout == 0 ) {
947
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 2000);
948
+ curl_setopt($ch, CURLOPT_TIMEOUT_MS, 2000);
949
+ }
950
+
951
  // Make a request
952
  $result = curl_exec($ch);
953
  $errors = curl_error($ch);
954
  curl_close($ch);
955
+
956
+ // RETURN if async request
957
+ if ( $timeout == 0 ) {
958
+ return array('data' => 'Async request was sent.');
959
+ }
960
  } else {
961
  $errors = 'CURL_NOT_INSTALLED';
962
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 5.168.1
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -595,6 +595,20 @@ If your website has forms that send data to external sources, you can enable opt
595
 
596
  == Changelog ==
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  = 5.168.1 Dec 22 2021 =
599
  #### Direct integrations protection fixed.
600
  * Fix: Prevent logging excluded requests on the direct integrations.
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 5.169
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
595
 
596
  == Changelog ==
597
 
598
+ = 5.169 Dec 28 2021 =
599
+ #### Improved compatibility with Varnish cache, visible_fields cookies fixed and some minor issues fixed.
600
+ * New. Options. Set cookie option "Auto" mode added.
601
+ * New. State. New property data[cookies_type] added.
602
+ * Fix. State. Set cookie option set on "Auto" by default.
603
+ * Fix. Activation. Select ajax handler during the plugin activation.
604
+ * Fix. API. Async logic added.
605
+ * Fix. State. Varnish cache detection fixed.
606
+ * Fix. API. Method calling service_update_local_settings is async now.
607
+ * Fix. Visible fields. Prevent generating more than 10 visible fields cookies.
608
+ * Fix: Disabling the cache when activating the plugin
609
+ * Fix: Setting the parameter of ipMaskLongToNumber to an integer
610
+ * Fix: fixed error in js script
611
+
612
  = 5.168.1 Dec 22 2021 =
613
  #### Direct integrations protection fixed.
614
  * Fix: Prevent logging excluded requests on the direct integrations.