Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.180

Version Description

Jun 30 2022 =

Getting api key from the CleanTalk Dashboard implemented, SFW updating improved, code quality improved and some minor issues fixed.

  • New. API key length extended to 30 symbols.
  • New. Remote call. RC post_api_key implemented.
  • New: Option 'cleantalk_debug' now outputs in 'debug' remote call.
  • Upd. SFW. Direct update during fallback.
  • Fix. Honeypot fields for search. Search forms with GET method now handles correct.
  • Fix. Ajax. Prevent JS errors on ajax general contact forms.
  • Fix. apbct_need_to_process_unknown_post_request() Add Divi themes exclusion to proceed them to contact_form_validate().
  • Fix. General contact form catching fixed.
  • Fix. cleantalk-pluggable.php. Skip service requests of enable-jquery-migrate-helper
  • Added notice_review banner
  • Fix. cleantalk_external.js. Exclude mewtwo flight forms.
  • Fix. Code. Compressing JS gulp task updated.
  • Fix. Request.php. Extend CURL timeout and low-speed detection limit.
  • Fix. Cleantalk.php. Exclude timestamp refreshing via template_rediret hook for alternative cookies mode.
  • Fix. External forms JS error fixed.
  • Fix. cleantalk-public-integrations.php-> apbct_form_search__add_fields(). Force to run pregmatch search if DOM content is broken.
  • Fix. Honeypot. Styles moved to the separated file.
Download this release

Release Info

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

Code changes from version 5.179.1 to 5.180

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.179.1
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -242,14 +242,11 @@ add_action('init', function () {
242
  }
243
  }
244
  }
245
- });
246
-
247
- if ( $apbct->settings && $apbct->key_is_ok ) {
248
  // Remote calls
249
  if ( RemoteCalls::check() ) {
250
  RemoteCalls::perform();
251
  }
252
- }
253
 
254
  //Delete cookie for admin trial notice
255
  add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
@@ -260,8 +257,10 @@ if ( ! is_admin() && ! apbct_is_ajax() && ! defined('DOING_CRON')
260
  && empty(Get::get('ct_checkjs_search_default')) // Search form fix
261
  && empty(Post::get('action')) //bbPress
262
  ) {
263
- add_action('template_redirect', 'apbct_cookie', 2);
264
- add_action('template_redirect', 'apbct_store__urls', 2);
 
 
265
  if ( empty($_POST) && empty($_GET) ) {
266
  apbct_cookie();
267
  apbct_store__urls();
@@ -641,6 +640,8 @@ if ( is_admin() || is_network_admin() ) {
641
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
642
 
643
  add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
 
 
644
 
645
  // Init action.
646
  add_action('plugins_loaded', 'apbct_init', 1);
@@ -1052,12 +1053,19 @@ function apbct_sfw_update__worker($checker_work = false)
1052
  }
1053
 
1054
  if ( isset($result['error']) && $result['status'] === 'FINISHED' ) {
1055
- $apbct->errorAdd('sfw_update', $result['error']);
1056
- $apbct->saveErrors();
1057
-
1058
  apbct_sfw_update__fallback();
1059
 
1060
- return $result['error'];
 
 
 
 
 
 
 
 
 
 
1061
  }
1062
 
1063
  if ( $queue->isQueueFinished() ) {
@@ -2020,7 +2028,7 @@ function apbct_rc__insert_auth_key($key, $plugin)
2020
  if ( is_plugin_active($plugin) ) {
2021
  $key = trim($key);
2022
 
2023
- if ( $key && preg_match('/^[a-z\d]{3,15}$/', $key) ) {
2024
  $result = API::methodNoticePaidTill(
2025
  $key,
2026
  preg_replace('/http[s]?:\/\//', '', get_option('home'), 1), // Site URL
@@ -2512,18 +2520,18 @@ function apbct_log($message = 'empty', $func = null, $params = array())
2512
  }
2513
 
2514
  if ( $message ) {
2515
- $debug[date("H:i:s") . (int)microtime() . "_ACTION_" . current_filter() . "_FUNCTION_" . $function] = $message;
2516
  }
2517
  if ( $cron ) {
2518
- $debug[date("H:i:s") . (int)microtime() . "_ACTION_" . current_filter(
2519
  ) . "_FUNCTION_" . $function . '_cron'] = $apbct->cron;
2520
  }
2521
  if ( $data ) {
2522
- $debug[date("H:i:s") . (int)microtime() . "_ACTION_" . current_filter(
2523
  ) . "_FUNCTION_" . $function . '_data'] = $apbct->data;
2524
  }
2525
  if ( $settings ) {
2526
- $debug[date("H:i:s") . (int)microtime() . "_ACTION_" . current_filter(
2527
  ) . "_FUNCTION_" . $function . '_settings'] = $apbct->settings;
2528
  }
2529
 
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.180
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
242
  }
243
  }
244
  }
 
 
 
245
  // Remote calls
246
  if ( RemoteCalls::check() ) {
247
  RemoteCalls::perform();
248
  }
249
+ });
250
 
251
  //Delete cookie for admin trial notice
252
  add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
257
  && empty(Get::get('ct_checkjs_search_default')) // Search form fix
258
  && empty(Post::get('action')) //bbPress
259
  ) {
260
+ if ( $apbct->data['cookies_type'] !== 'alternative' ) {
261
+ add_action('template_redirect', 'apbct_cookie', 2);
262
+ add_action('template_redirect', 'apbct_store__urls', 2);
263
+ }
264
  if ( empty($_POST) && empty($_GET) ) {
265
  apbct_cookie();
266
  apbct_store__urls();
640
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
641
 
642
  add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
643
+ add_action('wp_enqueue_scripts', 'ct_enqueue_styles_public');
644
+ add_action('login_enqueue_scripts', 'ct_enqueue_styles_public');
645
 
646
  // Init action.
647
  add_action('plugins_loaded', 'apbct_init', 1);
1053
  }
1054
 
1055
  if ( isset($result['error']) && $result['status'] === 'FINISHED' ) {
 
 
 
1056
  apbct_sfw_update__fallback();
1057
 
1058
+ $direct_upd_res = apbct_sfw_direct_update();
1059
+
1060
+ if ( $direct_upd_res['error'] ) {
1061
+ $apbct->errorAdd('queue', $result['error'], 'sfw_update');
1062
+ $apbct->errorAdd('direct', $direct_upd_res['error'], 'sfw_update');
1063
+ $apbct->saveErrors();
1064
+
1065
+ return $direct_upd_res['error'];
1066
+ }
1067
+
1068
+ return true;
1069
  }
1070
 
1071
  if ( $queue->isQueueFinished() ) {
2028
  if ( is_plugin_active($plugin) ) {
2029
  $key = trim($key);
2030
 
2031
+ if ( $key && preg_match('/^[a-z\d]{3,30}$/', $key) ) {
2032
  $result = API::methodNoticePaidTill(
2033
  $key,
2034
  preg_replace('/http[s]?:\/\//', '', get_option('home'), 1), // Site URL
2520
  }
2521
 
2522
  if ( $message ) {
2523
+ $debug[date("Y-m-d H:i:s") . microtime(true) . "_ACTION_" . current_filter() . "_FUNCTION_" . $function] = $message;
2524
  }
2525
  if ( $cron ) {
2526
+ $debug[date("Y-m-d H:i:s") . microtime(true) . "_ACTION_" . current_filter(
2527
  ) . "_FUNCTION_" . $function . '_cron'] = $apbct->cron;
2528
  }
2529
  if ( $data ) {
2530
+ $debug[date("Y-m-d H:i:s") . microtime(true) . "_ACTION_" . current_filter(
2531
  ) . "_FUNCTION_" . $function . '_data'] = $apbct->data;
2532
  }
2533
  if ( $settings ) {
2534
+ $debug[date("Y-m-d H:i:s") . microtime(true) . "_ACTION_" . current_filter(
2535
  ) . "_FUNCTION_" . $function . '_settings'] = $apbct->settings;
2536
  }
2537
 
css/cleantalk-admin-settings-page.min.css CHANGED
@@ -1 +1 @@
1
- .apbct_settings-field_content,.apbct_settings-field_title--radio,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%}.apbct_settings-field_title--radio{margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#cleantalk-modal-content,.ct_rate_block{text-align:center}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a,i.animate-spin{color:rgba(120,200,230,1)}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;font-size:25px;line-height:20px;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}#cleantalk-modal-content>*{display:block;width:100%}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:20px}#apbct_settings__after_advanced_settings{margin-bottom:20px}#apbct_settings__button_section{position:fixed;z-index:9999;width:100%;padding-bottom:40px}
1
+ .apbct_settings-field_content,.apbct_settings-field_title--radio,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%}.apbct_settings-field_title--radio{margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#cleantalk-modal-content,.ct_rate_block{text-align:center}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a,i.animate-spin{color:rgba(120,200,230,1)}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;font-size:25px;line-height:20px;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}#cleantalk-modal-content>*{display:block;width:100%}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:20px}#apbct_settings__after_advanced_settings{margin-bottom:20px}#apbct_settings__button_section{position:fixed;z-index:9999;width:100%;padding-bottom:40px}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}
css/cleantalk-admin.min.css CHANGED
@@ -1 +1 @@
1
- :disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#apbct_gdpr_open_modal:hover{cursor:pointer}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div{cursor:not-allowed!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}
1
+ .cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}
css/clentalak-public.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #honeypot-field-url,.wc_apbct_email_id,input[class*=apbct__email_id]{display:none!important}.comment-form-cookies-consent{width:100%;overflow:hidden}@media (min-width:768px){#respond .comment-form-email{margin-right:0!important}#respond .comment-form-author,#respond .comment-form-email{width:47.058%!important}}
inc/cleantalk-admin.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
 
4
  use Cleantalk\Variables\Get;
5
  use Cleantalk\Variables\Post;
6
  use Cleantalk\Variables\Server;
@@ -58,7 +59,7 @@ function apbct_add_buttons_to_comments_and_users($_unused_argument)
58
 
59
  echo '
60
  <a href="' . $button_url__check . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
61
- <img src="' . $apbct->logo__small__colored . '" alt="CleanTalk Anti-Spam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
62
  ' . sprintf(__('Find spam %s', 'cleantalk-spam-protect'), $button_description) . '
63
  </a>
64
  ';
@@ -94,7 +95,7 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
94
  echo "<div id='ct_widget_wrapper'>";
95
  ?>
96
  <div class='ct_widget_top_links'>
97
- <img src="<?php echo APBCT_IMG_ASSETS_PATH . '/preloader.gif'; ?>" class='ct_preloader'>
98
  <?php
99
  echo sprintf(
100
  __("%sRefresh%s", 'cleantalk-spam-protect'),
@@ -203,7 +204,7 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
203
  if ( isset($current_user) && in_array('administrator', $current_user->roles) ) {
204
  if ( $apbct->spam_count && $apbct->spam_count > 0 ) {
205
  echo '<div class="ct_widget_wprapper_total_blocked">'
206
- . '<img src="' . $apbct->logo__small__colored . '" class="ct_widget_small_logo"/>'
207
  . '<span title="' . sprintf(
208
  __(
209
  'This is the count from the %s\'s cloud and could be different to admin bar counters',
@@ -440,9 +441,9 @@ function apbct_admin__enqueue_scripts($hook)
440
  '_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
441
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
442
  'plugin_name' => $apbct->plugin_name,
443
- 'logo' => '<img src="' . $apbct->logo . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
444
- 'logo_small' => '<img src="' . $apbct->logo__small . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
445
- 'logo_small_colored' => '<img src="' . $apbct->logo__small__colored . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
446
  ));
447
 
448
  // DASHBOARD page JavaScript and CSS
@@ -520,7 +521,7 @@ function apbct_admin__enqueue_scripts($hook)
520
 
521
  wp_enqueue_script(
522
  'cleantalk-modal',
523
- APBCT_JS_ASSETS_PATH . '/cleantalk-modal.min.js',
524
  array(),
525
  APBCT_VERSION
526
  );
@@ -747,7 +748,7 @@ function apbct_admin__admin_bar__prepare_counters()
747
  function apbct_admin__admin_bar__add_parent_icon($icon)
748
  {
749
  return $icon
750
- . '<img class="cleantalk_admin_bar__apbct_icon" src="' . APBCT_URL_PATH . '/inc/images/logo.png" alt="">&nbsp;';
751
  }
752
 
753
  function apbct_admin__admin_bar__add_counter($after)
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
4
+ use Cleantalk\ApbctWP\Escape;
5
  use Cleantalk\Variables\Get;
6
  use Cleantalk\Variables\Post;
7
  use Cleantalk\Variables\Server;
59
 
60
  echo '
61
  <a href="' . $button_url__check . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
62
+ <img src="' . Escape::escUrl($apbct->logo__small__colored) . '" alt="CleanTalk Anti-Spam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
63
  ' . sprintf(__('Find spam %s', 'cleantalk-spam-protect'), $button_description) . '
64
  </a>
65
  ';
95
  echo "<div id='ct_widget_wrapper'>";
96
  ?>
97
  <div class='ct_widget_top_links'>
98
+ <img src="<?php echo Escape::escUrl(APBCT_IMG_ASSETS_PATH . '/preloader.gif'); ?>" class='ct_preloader'>
99
  <?php
100
  echo sprintf(
101
  __("%sRefresh%s", 'cleantalk-spam-protect'),
204
  if ( isset($current_user) && in_array('administrator', $current_user->roles) ) {
205
  if ( $apbct->spam_count && $apbct->spam_count > 0 ) {
206
  echo '<div class="ct_widget_wprapper_total_blocked">'
207
+ . '<img src="' . Escape::escUrl($apbct->logo__small__colored) . '" class="ct_widget_small_logo"/>'
208
  . '<span title="' . sprintf(
209
  __(
210
  'This is the count from the %s\'s cloud and could be different to admin bar counters',
441
  '_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
442
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
443
  'plugin_name' => $apbct->plugin_name,
444
+ 'logo' => '<img src="' . Escape::escUrl($apbct->logo) . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
445
+ 'logo_small' => '<img src="' . Escape::escUrl($apbct->logo__small) . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
446
+ 'logo_small_colored' => '<img src="' . Escape::escUrl($apbct->logo__small__colored) . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
447
  ));
448
 
449
  // DASHBOARD page JavaScript and CSS
521
 
522
  wp_enqueue_script(
523
  'cleantalk-modal',
524
+ APBCT_JS_ASSETS_PATH . '/apbct-public--3--cleantalk-modal.min.js',
525
  array(),
526
  APBCT_VERSION
527
  );
748
  function apbct_admin__admin_bar__add_parent_icon($icon)
749
  {
750
  return $icon
751
+ . '<img class="cleantalk_admin_bar__apbct_icon" src="' . Escape::escUrl(APBCT_URL_PATH . '/inc/images/logo.png') . '" alt="">&nbsp;';
752
  }
753
 
754
  function apbct_admin__admin_bar__add_counter($after)
inc/cleantalk-ajax.php CHANGED
@@ -4,6 +4,7 @@
4
  * AJAX functions
5
  */
6
 
 
7
  use Cleantalk\Variables\Get;
8
  use Cleantalk\Variables\Post;
9
 
@@ -153,10 +154,10 @@ function ct_validate_email_ajaxlogin($email = null)
153
  $is_good = ! ( ! filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email));
154
 
155
  if ( class_exists('AjaxLogin') && Post::get('action') === 'validate_email' ) {
156
- $checkjs = apbct_js_test('ct_checkjs', $_POST);
157
  $sender_info['post_checkjs_passed'] = $checkjs;
158
  if ( $checkjs === null ) {
159
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
160
  $sender_info['cookie_checkjs_passed'] = $checkjs;
161
  }
162
 
@@ -207,10 +208,10 @@ function ct_validate_email_ajaxlogin($email = null)
207
  function ct_user_register_ajaxlogin($user_id)
208
  {
209
  if ( class_exists('AjaxLogin') && Post::get('action') === 'register_submit' ) {
210
- $checkjs = apbct_js_test('ct_checkjs', $_POST);
211
  $sender_info['post_checkjs_passed'] = $checkjs;
212
  if ( $checkjs === null ) {
213
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
214
  $sender_info['cookie_checkjs_passed'] = $checkjs;
215
  }
216
 
@@ -448,7 +449,7 @@ function ct_ajax_hook($message_obj = null)
448
  $post_info['comment_type'] = 'feedback_ajax_external_form';
449
  }
450
 
451
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
452
 
453
  //QAEngine Theme answers
454
  if ( ! empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ) {
4
  * AJAX functions
5
  */
6
 
7
+ use Cleantalk\ApbctWP\Variables\Cookie;
8
  use Cleantalk\Variables\Get;
9
  use Cleantalk\Variables\Post;
10
 
154
  $is_good = ! ( ! filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email));
155
 
156
  if ( class_exists('AjaxLogin') && Post::get('action') === 'validate_email' ) {
157
+ $checkjs = apbct_js_test(Post::get('ct_checkjs'));
158
  $sender_info['post_checkjs_passed'] = $checkjs;
159
  if ( $checkjs === null ) {
160
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
161
  $sender_info['cookie_checkjs_passed'] = $checkjs;
162
  }
163
 
208
  function ct_user_register_ajaxlogin($user_id)
209
  {
210
  if ( class_exists('AjaxLogin') && Post::get('action') === 'register_submit' ) {
211
+ $checkjs = apbct_js_test(Post::get('ct_checkjs'));
212
  $sender_info['post_checkjs_passed'] = $checkjs;
213
  if ( $checkjs === null ) {
214
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
215
  $sender_info['cookie_checkjs_passed'] = $checkjs;
216
  }
217
 
449
  $post_info['comment_type'] = 'feedback_ajax_external_form';
450
  }
451
 
452
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
453
 
454
  //QAEngine Theme answers
455
  if ( ! empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ) {
inc/cleantalk-common.php CHANGED
@@ -171,7 +171,7 @@ function apbct_base_call($params = array(), $reg_flag = false)
171
 
172
  // Misc
173
  'auth_key' => $apbct->api_key,
174
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ? 1 : apbct_js_test('ct_checkjs', $_POST),
175
 
176
  'agent' => APBCT_AGENT,
177
  'sender_info' => $sender_info,
@@ -208,34 +208,16 @@ function apbct_base_call($params = array(), $reg_flag = false)
208
  $default_params['honeypot_field'] = $params['honeypot_field'];
209
  }
210
  /**
211
- * Add honeypot_field to $base_call_data is forms__wc_honeypot on
212
  */
213
  if ( $apbct->settings['data__honeypot_field'] && ! isset($params['honeypot_field']) ) {
214
- $honeypot_field = 1;
215
- // collect probable sources
216
- $honeypot_potential_values = array(
217
- 'wc_apbct_email_id' => Post::get('wc_apbct_email_id'),
218
- 'apbct__email_id__wp_register' => Post::get('apbct__email_id__wp_register'),
219
- 'apbct__email_id__wp_contact_form_7' => Post::get('apbct__email_id__wp_contact_form_7'),
220
- 'apbct__email_id__wp_wpforms' => Post::get('apbct__email_id__wp_wpforms'),
221
- 'apbct__email_id__search_form' => Post::get('apbct__email_id__search_form')
222
- );
223
 
224
- if ( !empty(Get::get('apbct_submit_id__search_form')) ) {
225
- $honeypot_potential_values['apbct__email_id__search_form'] = Get::get('apbct__email_id__search_form');
 
 
226
  }
227
-
228
- // if source is filled then pass them to params as additional fields
229
- foreach ($honeypot_potential_values as $source_name => $source_value) {
230
- if ( $source_value ) {
231
- $honeypot_field = 0;
232
- $params['sender_info']['honeypot_field_value'] = $source_value;
233
- $params['sender_info']['honeypot_field_source'] = $source_name;
234
- break;
235
- }
236
- }
237
-
238
- $params['honeypot_field'] = $honeypot_field;
239
  }
240
 
241
  // Send $_SERVER if couldn't find IP
@@ -1075,7 +1057,7 @@ function ct_change_plugin_resonse($ct_result = null, $checkjs = null)
1075
  }
1076
 
1077
  /**
1078
- * Does ey has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
1079
  *
1080
  * @param string api_key
1081
  *
@@ -1086,7 +1068,7 @@ function apbct_api_key__is_correct($api_key = null)
1086
  global $apbct;
1087
  $api_key = $api_key !== null ? $api_key : $apbct->api_key;
1088
 
1089
- return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
1090
  }
1091
 
1092
  function apbct__is_hosting_license()
@@ -1186,49 +1168,6 @@ function apbct__change_type_website_field($fields)
1186
  return $fields;
1187
  }
1188
 
1189
- /**
1190
- * Add styles if website field hidden
1191
- */
1192
- add_action('wp_print_styles', 'apbct__styles_if_website_hidden');
1193
- function apbct__styles_if_website_hidden()
1194
- {
1195
- global $apbct;
1196
-
1197
- if ( $apbct->settings['comments__hide_website_field'] ) {
1198
- $styles = "
1199
- <style>
1200
- #honeypot-field-url {
1201
- display: none !important;
1202
- }
1203
- .comment-form-cookies-consent {
1204
- width:100%;
1205
- overflow: hidden;
1206
- }
1207
- @media (min-width: 768px) {
1208
- #respond .comment-form-email {
1209
- margin-right: 0 !important;
1210
- }
1211
- #respond .comment-form-author, #respond .comment-form-email {
1212
- width: 47.058% !important;
1213
- }
1214
- }
1215
- </style>";
1216
-
1217
- echo $styles;
1218
- }
1219
-
1220
- if ( $apbct->settings['data__honeypot_field'] ) {
1221
- $styles = "
1222
- <style>
1223
- .wc_apbct_email_id {
1224
- display: none !important;
1225
- }
1226
- </style>";
1227
-
1228
- echo $styles;
1229
- }
1230
- }
1231
-
1232
  /**
1233
  * Woocommerce honeypot
1234
  */
@@ -1252,3 +1191,127 @@ function apbct__wc_add_honeypot_field($fields)
1252
 
1253
  return $fields;
1254
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
172
  // Misc
173
  'auth_key' => $apbct->api_key,
174
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true) ? 1 : apbct_js_test(Post::get('ct_checkjs')),
175
 
176
  'agent' => APBCT_AGENT,
177
  'sender_info' => $sender_info,
208
  $default_params['honeypot_field'] = $params['honeypot_field'];
209
  }
210
  /**
211
+ * Add honeypot_field to $base_call_data if forms__wc_honeypot on
212
  */
213
  if ( $apbct->settings['data__honeypot_field'] && ! isset($params['honeypot_field']) ) {
214
+ $honeypot_filled_fields = apbct_get_honeypot_filled_fields();
 
 
 
 
 
 
 
 
215
 
216
+ if ( ! empty($honeypot_filled_fields) ) {
217
+ $params['sender_info']['honeypot_field_value'] = $honeypot_filled_fields['field_value'];
218
+ $params['sender_info']['honeypot_field_source'] = $honeypot_filled_fields['field_source'];
219
+ $params['honeypot_field'] = 0;
220
  }
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
 
223
  // Send $_SERVER if couldn't find IP
1057
  }
1058
 
1059
  /**
1060
+ * Does ey has correct symbols? Checks against regexp ^[a-z\d]{3,30}$
1061
  *
1062
  * @param string api_key
1063
  *
1068
  global $apbct;
1069
  $api_key = $api_key !== null ? $api_key : $apbct->api_key;
1070
 
1071
+ return $api_key && preg_match('/^[a-z\d]{3,30}$/', $api_key) ? true : false;
1072
  }
1073
 
1074
  function apbct__is_hosting_license()
1168
  return $fields;
1169
  }
1170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1171
  /**
1172
  * Woocommerce honeypot
1173
  */
1191
 
1192
  return $fields;
1193
  }
1194
+
1195
+ /**
1196
+ * The function determines whether it is necessary
1197
+ * to conduct a general check of the post request
1198
+ *
1199
+ * @return boolean
1200
+ */
1201
+ function apbct_need_to_process_unknown_post_request()
1202
+ {
1203
+ global $apbct;
1204
+
1205
+ /** Exclude Ajax requests */
1206
+ if ( apbct_is_ajax() ) {
1207
+ return false;
1208
+ }
1209
+
1210
+ /** Bitrix24 contact form */
1211
+ if ( $apbct->settings['forms__general_contact_forms_test'] == 1 &&
1212
+ ! empty(Post::get('your-phone')) &&
1213
+ ! empty(Post::get('your-email')) &&
1214
+ ! empty(Post::get('your-message'))
1215
+ ) {
1216
+ return true;
1217
+ }
1218
+
1219
+ /** VFB_Pro integration */
1220
+ if (
1221
+ ! empty($_POST) &&
1222
+ $apbct->settings['forms__contact_forms_test'] == 1 &&
1223
+ empty(Post::get('ct_checkjs_cf7')) &&
1224
+ apbct_is_plugin_active('vfb-pro/vfb-pro.php') &&
1225
+ ! empty(Post::get('_vfb-form-id'))
1226
+ ) {
1227
+ return true;
1228
+ }
1229
+
1230
+ /** Integration with custom forms */
1231
+ if (
1232
+ ! empty($_POST) &&
1233
+ apbct_custom_forms_trappings()
1234
+ ) {
1235
+ return true;
1236
+ }
1237
+
1238
+ if (
1239
+ $apbct->settings['forms__general_contact_forms_test'] == 1 &&
1240
+ empty(Post::get('ct_checkjs_cf7')) &&
1241
+ ! apbct_is_direct_trackback()
1242
+ ) {
1243
+ return true;
1244
+ }
1245
+
1246
+ if ( apbct_is_user_enable() ) {
1247
+ if (
1248
+ $apbct->settings['forms__general_contact_forms_test'] == 1 &&
1249
+ ! Post::get('comment_post_ID') &&
1250
+ ! Get::get('for') &&
1251
+ ! apbct_is_direct_trackback()
1252
+ ) {
1253
+ return true;
1254
+ }
1255
+ }
1256
+
1257
+ return false;
1258
+ }
1259
+
1260
+ /**
1261
+ * Handles gained POST and GET data to find filled honeypot fields.
1262
+ * @return array array [honeypot_field_value, honeypot_field_source] or empty array
1263
+ */
1264
+ function apbct_get_honeypot_filled_fields()
1265
+ {
1266
+ /**
1267
+ * POST forms
1268
+ */
1269
+ if ( ! empty($_POST) ) {
1270
+ //get field suffix for POST forms
1271
+ $apbct_event_id = Post::get('apbct_event_id');
1272
+
1273
+ // collect probable sources
1274
+ $honeypot_potential_values = array(
1275
+ 'wc_apbct_email_id' => Post::get('wc_apbct_email_id_' . $apbct_event_id),
1276
+ 'apbct__email_id__wp_register' => Post::get('apbct__email_id__wp_register_' . $apbct_event_id),
1277
+ 'apbct__email_id__wp_contact_form_7' => Post::get('apbct__email_id__wp_contact_form_7_' . $apbct_event_id),
1278
+ 'apbct__email_id__wp_wpforms' => Post::get('apbct__email_id__wp_wpforms_' . $apbct_event_id),
1279
+ 'apbct__email_id__search_form' => Post::get('apbct__email_id__search_form_' . $apbct_event_id)
1280
+ );
1281
+ } elseif ( ! empty($_GET) ) {
1282
+ /**
1283
+ * GET forms
1284
+ */
1285
+ //get field suffix for GET search forms
1286
+ $apbct_event_id = false;
1287
+ foreach ( $_GET as $key => $value ) {
1288
+ if ( strpos($key, 'apbct_submit_id__search_form_') !== false ) {
1289
+ $apbct_event_id = str_replace('apbct_submit_id__search_form_', '', $key);
1290
+ }
1291
+ }
1292
+
1293
+ // collect probable sources
1294
+ if ( $apbct_event_id ) {
1295
+ $honeypot_potential_values['apbct__email_id__search_form'] = Get::get('apbct__email_id__search_form_' . $apbct_event_id);
1296
+ }
1297
+ } else {
1298
+ $honeypot_potential_values = false;
1299
+ }
1300
+
1301
+ /**
1302
+ * Handle potential values
1303
+ */
1304
+ $result = array();
1305
+ // if source is filled then pass them to params as additional fields
1306
+ if ( !empty($honeypot_potential_values) ) {
1307
+ foreach ( $honeypot_potential_values as $source_name => $source_value ) {
1308
+ if ( $source_value ) {
1309
+ $result['field_value'] = $source_value;
1310
+ $result['field_source'] = $source_name;
1311
+ break;
1312
+ }
1313
+ }
1314
+ }
1315
+
1316
+ return $result;
1317
+ }
inc/cleantalk-pluggable.php CHANGED
@@ -936,6 +936,14 @@ function apbct_is_skip_request($ajax = false)
936
  ) {
937
  return 'APBCT service actions';
938
  }
 
 
 
 
 
 
 
 
939
  }
940
 
941
  // Event Manager - there is the direct integration
936
  ) {
937
  return 'APBCT service actions';
938
  }
939
+
940
+ // JQueryMigrate plugin
941
+ if (
942
+ apbct_is_plugin_active('enable-jquery-migrate-helper/enable-jquery-migrate-helper.php') &&
943
+ Post::get('action') === 'jquery-migrate-log-notice'
944
+ ) {
945
+ return 'JQueryMigrate plugin service actions';
946
+ }
947
  }
948
 
949
  // Event Manager - there is the direct integration
inc/cleantalk-public-integrations.php CHANGED
@@ -98,7 +98,7 @@ function ct_validate_ccf_submission($value, $_field_id, $_required)
98
  $post_info['comment_type'] = 'feedback_custom_contact_forms';
99
  $post_info['post_url'] = apbct_get_server_variable('HTTP_REFERER');
100
 
101
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
102
 
103
  //Making a call
104
  $base_call_result = apbct_base_call(
@@ -151,7 +151,7 @@ function ct_woocommerce_wishlist_check($args)
151
  $post_info['comment_type'] = 'feedback';
152
  $post_info['post_url'] = apbct_get_server_variable('HTTP_REFERER');
153
 
154
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
155
 
156
  //Making a call
157
  $base_call_result = apbct_base_call(
@@ -236,7 +236,7 @@ function apbct_integration__buddyPres__activityWall($is_spam, $activity_obj = nu
236
  'post_url' => apbct_get_server_variable('HTTP_REFERER'),
237
  'comment_type' => 'buddypress_activitywall',
238
  ),
239
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
240
  'sender_info' => array('sender_url' => null),
241
  )
242
  );
@@ -348,7 +348,7 @@ function apbct_integration__buddyPres__private_msg_check($bp_message_obj)
348
  'comment_type' => 'buddypress_comment',
349
  'post_url' => apbct_get_server_variable('HTTP_REFERER'),
350
  ),
351
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST),
352
  'sender_info' => array('sender_url' => null),
353
  'exception_action' => $exception_action === true ? 1 : null
354
  )
@@ -485,7 +485,7 @@ function ct_woocommerce_checkout_check($_data, $errors)
485
  'sender_email' => $sender_email,
486
  'sender_nickname' => $sender_nickname,
487
  'post_info' => $post_info,
488
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
489
  'sender_info' => array('sender_url' => null)
490
  );
491
 
@@ -553,7 +553,7 @@ function apbct_wc__add_to_cart_unlogged_user(
553
  array(
554
  'message' => $message,
555
  'post_info' => $post_info,
556
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
557
  'sender_info' => array('sender_url' => null),
558
  )
559
  );
@@ -614,7 +614,7 @@ function apbct_form__piratesForm__testSpam()
614
  'sender_email' => $sender_email,
615
  'sender_nickname' => $sender_nickname,
616
  'post_info' => $post_info,
617
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
618
  'sender_info' => array('sender_url' => null),
619
  )
620
  );
@@ -764,7 +764,7 @@ function apbct_form__formidable__testSpam($errors, $_form)
764
  // Combine it with non-scalar values
765
  $message = array_merge($tmp_message, $tmp_message2);
766
 
767
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
768
 
769
  $base_call_result = apbct_base_call(
770
  array(
@@ -869,7 +869,7 @@ function ct_bbp_new_pre_content($comment)
869
  return $comment;
870
  }
871
 
872
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
873
 
874
  $post_info['comment_type'] = 'bbpress_comment';
875
  $post_info['post_url'] = bbp_get_topic_permalink();
@@ -1057,7 +1057,7 @@ function ct_preprocess_comment($comment)
1057
  // Comment type
1058
  $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1059
 
1060
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
1061
 
1062
  $example = null;
1063
  if ( $apbct->data['relevance_test'] ) {
@@ -1380,7 +1380,7 @@ function ct_test_message($nickname, $email, $_ip, $text)
1380
  'sender_email' => $email,
1381
  'sender_nickname' => $nickname,
1382
  'post_info' => array('comment_type' => 'feedback_plugin_check'),
1383
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true),
1384
  )
1385
  );
1386
 
@@ -1400,11 +1400,11 @@ function ct_test_registration($nickname, $email, $ip = null)
1400
  {
1401
  global $ct_checkjs_register_form;
1402
 
1403
- if ( apbct_js_test($ct_checkjs_register_form, $_POST) ) {
1404
- $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
1405
  $sender_info['post_checkjs_passed'] = $checkjs;
1406
  } else {
1407
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
1408
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1409
  }
1410
 
@@ -1498,13 +1498,13 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1498
  }
1499
 
1500
  if ( current_filter() === 'woocommerce_registration_errors' ) {
1501
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
1502
  $checkjs_post = null;
1503
  $checkjs_cookie = $checkjs;
1504
  } else {
1505
  // This hack can be helpful when plugin uses with untested themes&signups plugins.
1506
- $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
1507
- $checkjs_cookie = apbct_js_test('ct_checkjs', $_COOKIE, true);
1508
  $checkjs = $checkjs_cookie ?: $checkjs_post;
1509
  }
1510
 
@@ -1677,12 +1677,12 @@ function apbct_registration__UltimateMembers__check($args)
1677
  return $args;
1678
  }
1679
 
1680
- $checkjs = apbct_js_test('ct_checkjs_register_form', $args);
1681
  $sender_info['post_checkjs_passed'] = $checkjs;
1682
 
1683
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1684
  if ( $checkjs == 0 ) {
1685
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
1686
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1687
  }
1688
 
@@ -1836,7 +1836,7 @@ function ct_contact_form_is_spam($form)
1836
  'sender_nickname' => $sender_nickname,
1837
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1838
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1839
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test($ct_checkjs_jpcf, $_POST),
1840
 
1841
  )
1842
  );
@@ -1875,7 +1875,7 @@ function ct_contact_form_is_spam_jetpack($_is_spam, $form)
1875
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1876
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1877
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1878
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test($ct_checkjs_jpcf, $_POST),
1879
  )
1880
  );
1881
  $ct_result = $base_call_result['ct_result'];
@@ -1959,7 +1959,7 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null)
1959
  return $spam;
1960
  }
1961
 
1962
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test($ct_checkjs_cf7, $_POST);
1963
  /**
1964
  * Filter for POST
1965
  */
@@ -2088,7 +2088,7 @@ function apbct_form__ninjaForms__testSpam()
2088
  return;
2089
  }
2090
 
2091
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2092
 
2093
  /**
2094
  * Filter for POST
@@ -2429,7 +2429,7 @@ function apbct_form__WPForms__testSpam()
2429
  return;
2430
  }
2431
 
2432
- $checkjs = apbct_js_test('ct_checkjs_wpforms', $_POST);
2433
 
2434
  $email = $apbct->form_data['email'] ?: null;
2435
 
@@ -2553,7 +2553,7 @@ function ct_quform_post_validate($result, $form)
2553
  // @ToDo If we have several emails at the form - will be used only the first detected!
2554
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2555
 
2556
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
2557
  $base_call_result = apbct_base_call(
2558
  array(
2559
  'message' => $form->getValues(),
@@ -2634,7 +2634,7 @@ function ct_si_contact_form_validate($form_errors = array(), $_form_id_num = 0)
2634
  'sender_email' => $sender_email,
2635
  'sender_nickname' => $sender_nickname,
2636
  'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2637
- 'js_on' => apbct_js_test('ct_checkjs', $_POST),
2638
  )
2639
  );
2640
 
@@ -2880,7 +2880,7 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
2880
  $message['subject'] = $subject;
2881
  }
2882
 
2883
- $checkjs = apbct_js_test('ct_checkjs', $_POST) ?: apbct_js_test('ct_checkjs', $_COOKIE, true);
2884
 
2885
  $base_call_result = apbct_base_call(
2886
  array(
@@ -3414,12 +3414,51 @@ function apbct_form_happyforms_test_spam($is_valid, $request, $_form)
3414
  return $is_valid;
3415
  }
3416
 
 
 
 
 
 
 
 
 
 
3417
  function apbct_form_search__add_fields($form_html)
3418
  {
3419
  global $apbct;
3420
- if ( is_string($form_html) && $apbct->settings['forms__search_test'] == 1 ) {
3421
- return str_replace('</form>', ct_add_honeypot_field('search_form') . '</form>', $form_html);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3422
  }
 
3423
  return $form_html;
3424
  }
3425
 
98
  $post_info['comment_type'] = 'feedback_custom_contact_forms';
99
  $post_info['post_url'] = apbct_get_server_variable('HTTP_REFERER');
100
 
101
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
102
 
103
  //Making a call
104
  $base_call_result = apbct_base_call(
151
  $post_info['comment_type'] = 'feedback';
152
  $post_info['post_url'] = apbct_get_server_variable('HTTP_REFERER');
153
 
154
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
155
 
156
  //Making a call
157
  $base_call_result = apbct_base_call(
236
  'post_url' => apbct_get_server_variable('HTTP_REFERER'),
237
  'comment_type' => 'buddypress_activitywall',
238
  ),
239
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true),
240
  'sender_info' => array('sender_url' => null),
241
  )
242
  );
348
  'comment_type' => 'buddypress_comment',
349
  'post_url' => apbct_get_server_variable('HTTP_REFERER'),
350
  ),
351
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs')),
352
  'sender_info' => array('sender_url' => null),
353
  'exception_action' => $exception_action === true ? 1 : null
354
  )
485
  'sender_email' => $sender_email,
486
  'sender_nickname' => $sender_nickname,
487
  'post_info' => $post_info,
488
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true),
489
  'sender_info' => array('sender_url' => null)
490
  );
491
 
553
  array(
554
  'message' => $message,
555
  'post_info' => $post_info,
556
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true),
557
  'sender_info' => array('sender_url' => null),
558
  )
559
  );
614
  'sender_email' => $sender_email,
615
  'sender_nickname' => $sender_nickname,
616
  'post_info' => $post_info,
617
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true),
618
  'sender_info' => array('sender_url' => null),
619
  )
620
  );
764
  // Combine it with non-scalar values
765
  $message = array_merge($tmp_message, $tmp_message2);
766
 
767
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
768
 
769
  $base_call_result = apbct_base_call(
770
  array(
869
  return $comment;
870
  }
871
 
872
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
873
 
874
  $post_info['comment_type'] = 'bbpress_comment';
875
  $post_info['post_url'] = bbp_get_topic_permalink();
1057
  // Comment type
1058
  $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1059
 
1060
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
1061
 
1062
  $example = null;
1063
  if ( $apbct->data['relevance_test'] ) {
1380
  'sender_email' => $email,
1381
  'sender_nickname' => $nickname,
1382
  'post_info' => array('comment_type' => 'feedback_plugin_check'),
1383
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true),
1384
  )
1385
  );
1386
 
1400
  {
1401
  global $ct_checkjs_register_form;
1402
 
1403
+ if ( apbct_js_test(Post::get($ct_checkjs_register_form)) ) {
1404
+ $checkjs = apbct_js_test(Post::get($ct_checkjs_register_form));
1405
  $sender_info['post_checkjs_passed'] = $checkjs;
1406
  } else {
1407
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
1408
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1409
  }
1410
 
1498
  }
1499
 
1500
  if ( current_filter() === 'woocommerce_registration_errors' ) {
1501
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
1502
  $checkjs_post = null;
1503
  $checkjs_cookie = $checkjs;
1504
  } else {
1505
  // This hack can be helpful when plugin uses with untested themes&signups plugins.
1506
+ $checkjs_post = apbct_js_test(Post::get($ct_checkjs_register_form));
1507
+ $checkjs_cookie = apbct_js_test(Cookie::get('ct_checkjs'), true);
1508
  $checkjs = $checkjs_cookie ?: $checkjs_post;
1509
  }
1510
 
1677
  return $args;
1678
  }
1679
 
1680
+ $checkjs = apbct_js_test('ct_checkjs_register_form', (bool)$args);
1681
  $sender_info['post_checkjs_passed'] = $checkjs;
1682
 
1683
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1684
  if ( $checkjs == 0 ) {
1685
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
1686
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1687
  }
1688
 
1836
  'sender_nickname' => $sender_nickname,
1837
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1838
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1839
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get($ct_checkjs_jpcf)),
1840
 
1841
  )
1842
  );
1875
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1876
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1877
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1878
+ 'js_on' => apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get($ct_checkjs_jpcf)),
1879
  )
1880
  );
1881
  $ct_result = $base_call_result['ct_result'];
1959
  return $spam;
1960
  }
1961
 
1962
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get($ct_checkjs_cf7));
1963
  /**
1964
  * Filter for POST
1965
  */
2088
  return;
2089
  }
2090
 
2091
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
2092
 
2093
  /**
2094
  * Filter for POST
2429
  return;
2430
  }
2431
 
2432
+ $checkjs = apbct_js_test(Post::get('ct_checkjs_wpforms'));
2433
 
2434
  $email = $apbct->form_data['email'] ?: null;
2435
 
2553
  // @ToDo If we have several emails at the form - will be used only the first detected!
2554
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2555
 
2556
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true);
2557
  $base_call_result = apbct_base_call(
2558
  array(
2559
  'message' => $form->getValues(),
2634
  'sender_email' => $sender_email,
2635
  'sender_nickname' => $sender_nickname,
2636
  'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2637
+ 'js_on' => apbct_js_test(Post::get('ct_checkjs')),
2638
  )
2639
  );
2640
 
2880
  $message['subject'] = $subject;
2881
  }
2882
 
2883
+ $checkjs = apbct_js_test(Post::get('ct_checkjs')) ?: apbct_js_test(Cookie::get('ct_checkjs'), true);
2884
 
2885
  $base_call_result = apbct_base_call(
2886
  array(
3414
  return $is_valid;
3415
  }
3416
 
3417
+ /**
3418
+ * Prepare data to add honeypot to the WordPress default search form.
3419
+ * Fires ct_add_honeypot_field() on hook get_search_form when:
3420
+ * - method of the form is post
3421
+ * - spam test of search form is enabled
3422
+ *
3423
+ * @param string $form_html
3424
+ * @return string
3425
+ */
3426
  function apbct_form_search__add_fields($form_html)
3427
  {
3428
  global $apbct;
3429
+ if ( !empty($form_html) && is_string($form_html) && $apbct->settings['forms__search_test'] == 1 ) {
3430
+
3431
+ /**
3432
+ * extract method of the form
3433
+ */
3434
+ if ( class_exists('DOMDocument') ) {
3435
+ $dom = new DOMDocument();
3436
+ if ( @$dom->loadHTML($form_html) ) {
3437
+ $search_form_dom = $dom->getElementById('searchform');
3438
+ if ( !empty($search_form_dom) ) {
3439
+ $method = empty($search_form_dom->getAttribute('method'))
3440
+ //default method is get for any form if no method specified
3441
+ ? 'get'
3442
+ : $search_form_dom->getAttribute('method');
3443
+ }
3444
+ }
3445
+ unset($dom);
3446
+ }
3447
+
3448
+ if ( empty($method) ) {
3449
+ preg_match('/form.*method="(.*?)"/', $form_html, $matches);
3450
+ $method = empty($matches[1])
3451
+ ? 'get'
3452
+ : trim($matches[1]);
3453
+ }
3454
+
3455
+ /**
3456
+ * add honeypot html
3457
+ */
3458
+ $form_method = strtolower($method);
3459
+ return str_replace('</form>', ct_add_honeypot_field('search_form', $form_method) . '</form>', $form_html);
3460
  }
3461
+
3462
  return $form_html;
3463
  }
3464
 
inc/cleantalk-public-validate.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  use Cleantalk\Variables\Server;
4
 
5
  /**
@@ -221,7 +222,7 @@ function ct_contact_form_validate()
221
  unset($_POST['TellAFriend_Link']);
222
  }
223
 
224
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
225
 
226
  $base_call_result = apbct_base_call(
227
  array(
@@ -262,7 +263,17 @@ function ct_contact_form_validate()
262
  $ajax_call = true;
263
  }
264
  if ( $ajax_call ) {
265
- echo $ct_result->comment;
 
 
 
 
 
 
 
 
 
 
266
  } else {
267
  global $ct_comment;
268
  $ct_comment = $ct_result->comment;
@@ -272,15 +283,17 @@ function ct_contact_form_validate()
272
  print json_encode($result);
273
  die();
274
  } elseif ( isset($_POST['TellAFriend_email']) ) {
275
- echo $ct_result->comment;
276
- die();
277
- } elseif ( isset($_POST['gform_submit']) ) { // Gravity forms submission
278
- $response = sprintf(
279
- "<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
280
- gform_confirmation_message'>%s</div></div></body></html>",
281
- $ct_result->comment
 
 
 
282
  );
283
- echo $response;
284
  die();
285
  } elseif ( isset($_POST['action']) && $_POST['action'] == 'ct_check_internal' ) {
286
  return $ct_result->comment;
@@ -307,11 +320,42 @@ function ct_contact_form_validate()
307
  die();
308
  // Divi Theme Contact Form. Using $contact_form
309
  } elseif ( ! empty($contact_form) && $contact_form == 'contact_form_divi_theme' ) {
310
- echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  die();
312
  // Enfold Theme Contact Form. Using $contact_form
313
  } elseif ( ! empty($contact_form) && $contact_form == 'contact_form_enfold_theme' ) {
314
- echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Anti-Spam by CleanTalk: " . $ct_result->comment . "</h3><a href='.'><-Back</a></div></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  die();
316
  } else {
317
  ct_die(null, null);
@@ -446,7 +490,17 @@ function ct_contact_form_validate_postdata()
446
  ct_die(null, null);
447
  }
448
  } else {
449
- echo $ct_result->comment;
 
 
 
 
 
 
 
 
 
 
450
  }
451
  exit;
452
  }
1
  <?php
2
 
3
+ use Cleantalk\ApbctWP\Variables\Cookie;
4
  use Cleantalk\Variables\Server;
5
 
6
  /**
222
  unset($_POST['TellAFriend_Link']);
223
  }
224
 
225
+ $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
226
 
227
  $base_call_result = apbct_base_call(
228
  array(
263
  $ajax_call = true;
264
  }
265
  if ( $ajax_call ) {
266
+ echo wp_kses(
267
+ $ct_result->comment,
268
+ array(
269
+ 'a' => array(
270
+ 'href' => true,
271
+ 'title' => true,
272
+ ),
273
+ 'br' => array(),
274
+ 'p' => array()
275
+ )
276
+ );
277
  } else {
278
  global $ct_comment;
279
  $ct_comment = $ct_result->comment;
283
  print json_encode($result);
284
  die();
285
  } elseif ( isset($_POST['TellAFriend_email']) ) {
286
+ echo wp_kses(
287
+ $ct_result->comment,
288
+ array(
289
+ 'a' => array(
290
+ 'href' => true,
291
+ 'title' => true,
292
+ ),
293
+ 'br' => array(),
294
+ 'p' => array()
295
+ )
296
  );
 
297
  die();
298
  } elseif ( isset($_POST['action']) && $_POST['action'] == 'ct_check_internal' ) {
299
  return $ct_result->comment;
320
  die();
321
  // Divi Theme Contact Form. Using $contact_form
322
  } elseif ( ! empty($contact_form) && $contact_form == 'contact_form_divi_theme' ) {
323
+ echo wp_kses(
324
+ "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>",
325
+ array(
326
+ 'a' => array(
327
+ 'href' => true,
328
+ 'title' => true,
329
+ ),
330
+ 'br' => array(),
331
+ 'p' => array(),
332
+ 'div' => array(
333
+ 'id' => true,
334
+ ),
335
+ 'h1' => array(),
336
+ )
337
+ );
338
  die();
339
  // Enfold Theme Contact Form. Using $contact_form
340
  } elseif ( ! empty($contact_form) && $contact_form == 'contact_form_enfold_theme' ) {
341
+ $echo_string = "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Anti-Spam by CleanTalk: " . $ct_result->comment . "</h3><a href='.'><-Back</a></div></div>";
342
+ echo wp_kses(
343
+ $echo_string,
344
+ array(
345
+ 'a' => array(
346
+ 'href' => true,
347
+ 'title' => true,
348
+ ),
349
+ 'br' => array(),
350
+ 'p' => array(),
351
+ 'div' => array(
352
+ 'id' => true,
353
+ 'class' => true,
354
+ 'style' => true
355
+ ),
356
+ 'h3' => array(),
357
+ )
358
+ );
359
  die();
360
  } else {
361
  ct_die(null, null);
490
  ct_die(null, null);
491
  }
492
  } else {
493
+ echo wp_kses(
494
+ $ct_result->comment,
495
+ array(
496
+ 'a' => array(
497
+ 'href' => true,
498
+ 'title' => true,
499
+ ),
500
+ 'br' => array(),
501
+ 'p' => array()
502
+ )
503
+ );
504
  }
505
  exit;
506
  }
inc/cleantalk-public.php CHANGED
@@ -32,7 +32,17 @@ function apbct_init()
32
  echo 'true';
33
  die();
34
  } else {
35
- echo $ct_result;
 
 
 
 
 
 
 
 
 
 
36
  die();
37
  }
38
  }
@@ -406,8 +416,7 @@ function apbct_buffer__output()
406
  $output = apbct_buffer_modify_by_dom();
407
  }
408
 
409
- echo $output;
410
- die();
411
  }
412
 
413
  function apbct_buffer_modify_by_string()
@@ -526,7 +535,7 @@ function apbct_hook__wp_footer()
526
  $apbct->settings['data__pixel'] === '1' ||
527
  ($apbct->settings['data__pixel'] === '3' && ! apbct_is_cache_plugins_exists())
528
  ) {
529
- echo '<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none;" src="' . $apbct->pixel_url . '">';
530
  }
531
 
532
  if ( $apbct->settings['data__use_ajax'] ) {
@@ -655,7 +664,13 @@ function ct_add_hidden_fields(
655
  }
656
  }
657
 
658
- function ct_add_honeypot_field($form_type)
 
 
 
 
 
 
659
  {
660
  global $apbct;
661
 
@@ -663,24 +678,46 @@ function ct_add_honeypot_field($form_type)
663
  if ( ! $apbct->settings['data__honeypot_field'] ) {
664
  return '';
665
  }
 
 
666
 
667
- // Honeypot option is ON
668
- $style = '
669
- <style>
670
- #apbct__email_id__' . $form_type . ' {
671
- display: none !important;
672
- }
673
- </style>';
674
- return $style . "\n" . '<input
675
- id="apbct__email_id__' . $form_type . '"
676
  class="apbct__email_id__' . $form_type . '"
677
  autocomplete="off"
678
- name="apbct__email_id__' . $form_type . '"
679
  type="text"
680
  value=""
681
  size="30"
682
  maxlength="200"
683
  />';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  }
685
 
686
  /**
@@ -894,25 +931,24 @@ function ct_die_extended($comment_body)
894
  /**
895
  * Validates JavaScript anti-spam test
896
  *
897
- * @param string $field_name filed to serach in data
898
- * @param array|null $data Data to search in
899
  * @param bool $is_cookie
900
  *
901
  * @return int|null
902
  */
903
- function apbct_js_test($field_name = 'ct_checkjs', $data = null, $is_cookie = false)
904
  {
905
  global $apbct;
906
 
907
  $out = null;
908
 
909
  if (
910
- ($data && isset($data[$field_name])) ||
911
- ($is_cookie && $apbct->data['cookies_type'] === 'alternative' && Cookie::get($field_name))
912
  ) {
913
  $js_key = $is_cookie && $apbct->data['cookies_type'] === 'alternative'
914
- ? Cookie::get($field_name)
915
- : trim($data[$field_name]);
916
 
917
  // Check static key
918
  if (
@@ -1192,46 +1228,17 @@ function ct_enqueue_scripts_public($_hook)
1192
 
1193
  // GDPR script
1194
  if ( $apbct->settings['gdpr__enabled'] ) {
1195
- wp_enqueue_script(
1196
- 'ct_public_gdpr',
1197
- APBCT_URL_PATH . '/js/apbct-public--gdpr.min.js',
1198
- array('jquery', 'ct_public'),
1199
- APBCT_VERSION,
1200
- false /*in header*/
1201
- );
1202
-
1203
- wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
1204
  'gdpr_forms' => array(),
1205
- 'gdpr_text' => $apbct->settings['gdpr__text'] ?: __(
1206
- 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
1207
- 'cleantalk-spam-protect'
1208
- ),
 
1209
  ));
1210
  }
1211
  }
1212
 
1213
- // External forms check
1214
- if ( $apbct->settings['forms__check_external'] ) {
1215
- wp_enqueue_script(
1216
- 'ct_external',
1217
- APBCT_JS_ASSETS_PATH . '/cleantalk_external.min.js',
1218
- array('jquery'),
1219
- APBCT_VERSION,
1220
- false /*in header*/
1221
- );
1222
- }
1223
-
1224
- // Internal forms check
1225
- if ( $apbct->settings['forms__check_internal'] ) {
1226
- wp_enqueue_script(
1227
- 'ct_internal',
1228
- APBCT_JS_ASSETS_PATH . '/cleantalk_internal.min.js',
1229
- array('jquery'),
1230
- APBCT_VERSION,
1231
- false /*in header*/
1232
- );
1233
- }
1234
-
1235
  // Show controls for commentaries
1236
  if ( in_array("administrator", $current_user->roles) ) {
1237
  if ( $apbct->settings['comments__manage_comments_on_public_page'] ) {
@@ -1287,6 +1294,34 @@ function ct_enqueue_scripts_public($_hook)
1287
  }
1288
  }
1289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1290
  function apbct_enqueue_and_localize_public_scripts()
1291
  {
1292
  global $apbct;
@@ -1294,35 +1329,23 @@ function apbct_enqueue_and_localize_public_scripts()
1294
  // Different JS params
1295
  wp_enqueue_script(
1296
  'ct_public_functions',
1297
- APBCT_URL_PATH . '/js/apbct-public--functions.min.js',
1298
  array('jquery'),
1299
  APBCT_VERSION
1300
  );
1301
- wp_enqueue_script(
1302
- 'ct_public',
1303
- APBCT_URL_PATH . '/js/apbct-public.min.js',
1304
- array('jquery', 'ct_public_functions'),
1305
- APBCT_VERSION
1306
- );
1307
- wp_enqueue_script(
1308
- 'cleantalk-modal',
1309
- APBCT_JS_ASSETS_PATH . '/cleantalk-modal.min.js',
1310
- array(),
1311
- APBCT_VERSION
1312
- );
1313
 
1314
  wp_localize_script('ct_public_functions', 'ctPublicFunctions', array(
1315
  '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
1316
  '_rest_nonce' => wp_create_nonce('wp_rest'),
1317
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
1318
- '_rest_url' => esc_url(apbct_get_rest_url()),
1319
  'data__cookies_type' => $apbct->data['cookies_type'],
1320
  'data__ajax_type' => $apbct->data['ajax_type'],
1321
  'text__wait_for_decoding' => esc_html__('Wait for decoding...', 'cleantalk-spam-protect'),
1322
  'cookiePrefix' => apbct__get_cookie_prefix(),
1323
  ));
1324
 
1325
- wp_localize_script('ct_public', 'ctPublic', array(
1326
  'pixel__setting' => $apbct->settings['data__pixel'],
1327
  'pixel__enabled' => $apbct->settings['data__pixel'] === '2' ||
1328
  ($apbct->settings['data__pixel'] === '3' && apbct_is_cache_plugins_exists()),
@@ -1369,14 +1392,14 @@ function ct_comments_output($curr_comment, $_param2, $wp_list_comments_args)
1369
 
1370
  echo "<p class='ct_comment_logo_title'>
1371
  " . __('by', 'cleantalk-spam-protect')
1372
- . " <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='" . APBCT_IMG_ASSETS_PATH . "/logo_color.png'></a>"
1373
  . " <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
1374
  . "</p></div>";
1375
  // Outputs email if exists
1376
  if ( $email ) {
1377
  echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
1378
  . "$email"
1379
- . "&nbsp;<img src='" . APBCT_IMG_ASSETS_PATH . "/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
1380
  . "</a>";
1381
  } else {
1382
  echo __('No email', 'cleantalk-spam-protect');
@@ -1387,7 +1410,7 @@ function ct_comments_output($curr_comment, $_param2, $wp_list_comments_args)
1387
  if ( $ip ) {
1388
  echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
1389
  . "$ip"
1390
- . "&nbsp;<img src='" . APBCT_IMG_ASSETS_PATH . "/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
1391
  . "</a>";
1392
  } else {
1393
  echo __('No IP', 'cleantalk-spam-protect');
32
  echo 'true';
33
  die();
34
  } else {
35
+ echo wp_kses(
36
+ $ct_result,
37
+ array(
38
+ 'a' => array(
39
+ 'href' => true,
40
+ 'title' => true,
41
+ ),
42
+ 'br' => array(),
43
+ 'p' => array()
44
+ )
45
+ );
46
  die();
47
  }
48
  }
416
  $output = apbct_buffer_modify_by_dom();
417
  }
418
 
419
+ die($output);
 
420
  }
421
 
422
  function apbct_buffer_modify_by_string()
535
  $apbct->settings['data__pixel'] === '1' ||
536
  ($apbct->settings['data__pixel'] === '3' && ! apbct_is_cache_plugins_exists())
537
  ) {
538
+ echo '<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none;" src="' . Escape::escUrl($apbct->pixel_url) . '">';
539
  }
540
 
541
  if ( $apbct->settings['data__use_ajax'] ) {
664
  }
665
  }
666
 
667
+ /**
668
+ * Returns HTML of a honeypot hidden field to the form. If $form_method is GET, adds a hidden submit button.
669
+ * @param $form_type
670
+ * @param string $form_method
671
+ * @return string
672
+ */
673
+ function ct_add_honeypot_field($form_type, $form_method = 'post')
674
  {
675
  global $apbct;
676
 
678
  if ( ! $apbct->settings['data__honeypot_field'] ) {
679
  return '';
680
  }
681
+ //Generate random suffix to prevent ids duplicate
682
+ $random = mt_rand(0, 100000);
683
 
684
+ // Generate the hidden field
685
+ $honeypot = '<input
686
+ id="apbct__email_id__' . $form_type . '_' . $random . '"
 
 
 
 
 
 
687
  class="apbct__email_id__' . $form_type . '"
688
  autocomplete="off"
689
+ name="apbct__email_id__' . $form_type . '_' . $random . '"
690
  type="text"
691
  value=""
692
  size="30"
693
  maxlength="200"
694
  />';
695
+
696
+ if ( $form_method === 'post' ) {
697
+ //add hidden field to set random suffix for the field
698
+ $honeypot .= '<input
699
+ id="apbct_event_id"
700
+ name="apbct_event_id"
701
+ type="hidden"
702
+ value="' . $random . '"
703
+ />';
704
+ }
705
+
706
+ //add a submit button if method is get to prevent keyboard send misfunction
707
+ if ( $form_method === 'get' ) {
708
+ $honeypot .= '<input
709
+ id="apbct_submit_id__' . $form_type . '_' . $random . '"
710
+ class="apbct__email_id__' . $form_type . '"
711
+ name="apbct_submit_id__' . $form_type . '_' . $random . '"
712
+ type="submit"
713
+ apbct_event_id="' . $random . '"
714
+ size="30"
715
+ maxlength="200"
716
+ value=""
717
+ />';
718
+ }
719
+
720
+ return $honeypot;
721
  }
722
 
723
  /**
931
  /**
932
  * Validates JavaScript anti-spam test
933
  *
934
+ * @param string $check_js_value String to checking
 
935
  * @param bool $is_cookie
936
  *
937
  * @return int|null
938
  */
939
+ function apbct_js_test($check_js_value = '', $is_cookie = false)
940
  {
941
  global $apbct;
942
 
943
  $out = null;
944
 
945
  if (
946
+ ( ! empty($check_js_value) ) ||
947
+ ( $is_cookie && $apbct->data['cookies_type'] === 'alternative' && Cookie::get('ct_checkjs') )
948
  ) {
949
  $js_key = $is_cookie && $apbct->data['cookies_type'] === 'alternative'
950
+ ? Cookie::get('ct_checkjs')
951
+ : trim($check_js_value);
952
 
953
  // Check static key
954
  if (
1228
 
1229
  // GDPR script
1230
  if ( $apbct->settings['gdpr__enabled'] ) {
1231
+ wp_localize_script('ct_public_functions', 'ctPublicGDPR', array(
 
 
 
 
 
 
 
 
1232
  'gdpr_forms' => array(),
1233
+ 'gdpr_text' => $apbct->settings['gdpr__text']
1234
+ ?: __(
1235
+ 'By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.',
1236
+ 'cleantalk-spam-protect'
1237
+ ),
1238
  ));
1239
  }
1240
  }
1241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1242
  // Show controls for commentaries
1243
  if ( in_array("administrator", $current_user->roles) ) {
1244
  if ( $apbct->settings['comments__manage_comments_on_public_page'] ) {
1294
  }
1295
  }
1296
 
1297
+ function ct_enqueue_styles_public()
1298
+ {
1299
+ global $apbct;
1300
+
1301
+ if ( apbct_exclusions_check__url() ) {
1302
+ return;
1303
+ }
1304
+
1305
+ if (
1306
+ $apbct->settings['forms__registrations_test'] ||
1307
+ $apbct->settings['forms__comments_test'] ||
1308
+ $apbct->settings['forms__contact_forms_test'] ||
1309
+ $apbct->settings['forms__general_contact_forms_test'] ||
1310
+ $apbct->settings['forms__wc_checkout_test'] ||
1311
+ $apbct->settings['forms__check_external'] ||
1312
+ $apbct->settings['forms__check_internal'] ||
1313
+ $apbct->settings['comments__bp_private_messages'] ||
1314
+ $apbct->settings['data__general_postdata_test']
1315
+ ) {
1316
+ wp_enqueue_style(
1317
+ 'ct_public_css',
1318
+ APBCT_CSS_ASSETS_PATH . '/clentalak-public.min.css',
1319
+ array(),
1320
+ APBCT_VERSION
1321
+ );
1322
+ }
1323
+ }
1324
+
1325
  function apbct_enqueue_and_localize_public_scripts()
1326
  {
1327
  global $apbct;
1329
  // Different JS params
1330
  wp_enqueue_script(
1331
  'ct_public_functions',
1332
+ APBCT_URL_PATH . '/js/apbct-public-bundle.min.js',
1333
  array('jquery'),
1334
  APBCT_VERSION
1335
  );
 
 
 
 
 
 
 
 
 
 
 
 
1336
 
1337
  wp_localize_script('ct_public_functions', 'ctPublicFunctions', array(
1338
  '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
1339
  '_rest_nonce' => wp_create_nonce('wp_rest'),
1340
  '_ajax_url' => admin_url('admin-ajax.php', 'relative'),
1341
+ '_rest_url' => Escape::escUrl(apbct_get_rest_url()),
1342
  'data__cookies_type' => $apbct->data['cookies_type'],
1343
  'data__ajax_type' => $apbct->data['ajax_type'],
1344
  'text__wait_for_decoding' => esc_html__('Wait for decoding...', 'cleantalk-spam-protect'),
1345
  'cookiePrefix' => apbct__get_cookie_prefix(),
1346
  ));
1347
 
1348
+ wp_localize_script('ct_public_functions', 'ctPublic', array(
1349
  'pixel__setting' => $apbct->settings['data__pixel'],
1350
  'pixel__enabled' => $apbct->settings['data__pixel'] === '2' ||
1351
  ($apbct->settings['data__pixel'] === '3' && apbct_is_cache_plugins_exists()),
1392
 
1393
  echo "<p class='ct_comment_logo_title'>
1394
  " . __('by', 'cleantalk-spam-protect')
1395
+ . " <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='" . Escape::escUrl(APBCT_IMG_ASSETS_PATH . "/logo_color.png") . "'></a>"
1396
  . " <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
1397
  . "</p></div>";
1398
  // Outputs email if exists
1399
  if ( $email ) {
1400
  echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
1401
  . "$email"
1402
+ . "&nbsp;<img src='" . Escape::escUrl(APBCT_IMG_ASSETS_PATH . "/new_window.gif") . "' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
1403
  . "</a>";
1404
  } else {
1405
  echo __('No email', 'cleantalk-spam-protect');
1410
  if ( $ip ) {
1411
  echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
1412
  . "$ip"
1413
+ . "&nbsp;<img src='" . Escape::escUrl(APBCT_IMG_ASSETS_PATH . "/new_window.gif") . "' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
1414
  . "</a>";
1415
  } else {
1416
  echo __('No IP', 'cleantalk-spam-protect');
inc/cleantalk-settings.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  use Cleantalk\ApbctWP\Validate;
4
  use Cleantalk\Variables\Post;
5
  use Cleantalk\ApbctWP\Cron;
@@ -1120,8 +1121,8 @@ function apbct_settings__display()
1120
  echo '<button type="button" class="cleantalk_link cleantalk_link-auto" id="apbct_button__sync" title="Synchronizing account status, SpamFireWall database, all kind of journals.">'
1121
  . '<i class="apbct-icon-upload-cloud"></i>&nbsp;&nbsp;'
1122
  . __('Synchronize with Cloud', 'cleantalk-spam-protect')
1123
- . '<img style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
1124
- . '<img style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
1125
  . '</button>';
1126
  echo '&nbsp;&nbsp;';
1127
  }
@@ -1454,24 +1455,24 @@ function apbct_settings__field__state()
1454
 
1455
  print '<h2>' . __('Protection is active', 'cleantalk-spam-protect') . '</h2>';
1456
 
1457
- echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__registrations_test'] == 1 ? $img : $img_no) . '"/>' . __(
1458
  'Registration forms',
1459
  'cleantalk-spam-protect'
1460
  );
1461
- echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__comments_test'] == 1 ? $img : $img_no) . '"/>' . __(
1462
  'Comments forms',
1463
  'cleantalk-spam-protect'
1464
  );
1465
- echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__contact_forms_test'] == 1 ? $img : $img_no) . '"/>' . __(
1466
  'Contact forms',
1467
  'cleantalk-spam-protect'
1468
  );
1469
- echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__general_contact_forms_test'] == 1 ? $img : $img_no) . '"/>' . __(
1470
  'Custom contact forms',
1471
  'cleantalk-spam-protect'
1472
  );
1473
  if ( ! $apbct->white_label || is_main_site() ) {
1474
- echo '<img class="apbct_status_icon" src="' . ($apbct->data['moderate'] == 1 ? $img : $img_no) . '"/>'
1475
  . '<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">' . __(
1476
  'Validate email for existence',
1477
  'cleantalk-spam-protect'
@@ -1479,7 +1480,7 @@ function apbct_settings__field__state()
1479
  }
1480
  // Autoupdate status
1481
  if ( $apbct->notice_auto_update && ( ! $apbct->white_label || is_main_site()) ) {
1482
- echo '<img class="apbct_status_icon" src="' . ($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)) . '"/>' . __(
1483
  'Auto update',
1484
  'cleantalk-spam-protect'
1485
  )
@@ -1488,7 +1489,7 @@ function apbct_settings__field__state()
1488
 
1489
  // WooCommerce
1490
  if ( class_exists('WooCommerce') ) {
1491
- echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__wc_checkout_test'] == 1 ? $img : $img_no) . '"/>' . __(
1492
  'WooCommerce checkout form',
1493
  'cleantalk-spam-protect'
1494
  );
@@ -1566,8 +1567,8 @@ function apbct_settings__field__apikey()
1566
  if ( ! $apbct->ip_license ) {
1567
  echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" id="apbct_button__get_key_auto" name="submit" type="button" value="get_key_auto">'
1568
  . __('Get Access Key Automatically', 'cleantalk-spam-protect')
1569
- . '<img style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
1570
- . '<img style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
1571
  . '</button>';
1572
  echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
1573
  echo '<br />';
@@ -2390,6 +2391,10 @@ function apbct_settings__sync($direct_call = false)
2390
 
2391
  $apbct->saveData();
2392
 
 
 
 
 
2393
  die(json_encode($out));
2394
  }
2395
 
1
  <?php
2
 
3
+ use Cleantalk\ApbctWP\Escape;
4
  use Cleantalk\ApbctWP\Validate;
5
  use Cleantalk\Variables\Post;
6
  use Cleantalk\ApbctWP\Cron;
1121
  echo '<button type="button" class="cleantalk_link cleantalk_link-auto" id="apbct_button__sync" title="Synchronizing account status, SpamFireWall database, all kind of journals.">'
1122
  . '<i class="apbct-icon-upload-cloud"></i>&nbsp;&nbsp;'
1123
  . __('Synchronize with Cloud', 'cleantalk-spam-protect')
1124
+ . '<img style="margin-left: 10px;" class="apbct_preloader_button" src="' . Escape::escUrl(APBCT_URL_PATH . '/inc/images/preloader2.gif') . '" />'
1125
+ . '<img style="margin-left: 10px;" class="apbct_success --hide" src="' . Escape::escUrl(APBCT_URL_PATH . '/inc/images/yes.png') . '" />'
1126
  . '</button>';
1127
  echo '&nbsp;&nbsp;';
1128
  }
1455
 
1456
  print '<h2>' . __('Protection is active', 'cleantalk-spam-protect') . '</h2>';
1457
 
1458
+ echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__registrations_test'] == 1 ? Escape::escUrl($img) : Escape::escUrl($img_no)) . '"/>' . __(
1459
  'Registration forms',
1460
  'cleantalk-spam-protect'
1461
  );
1462
+ echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__comments_test'] == 1 ? Escape::escUrl($img) : Escape::escUrl($img_no)) . '"/>' . __(
1463
  'Comments forms',
1464
  'cleantalk-spam-protect'
1465
  );
1466
+ echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__contact_forms_test'] == 1 ? Escape::escUrl($img) : Escape::escUrl($img_no)) . '"/>' . __(
1467
  'Contact forms',
1468
  'cleantalk-spam-protect'
1469
  );
1470
+ echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__general_contact_forms_test'] == 1 ? Escape::escUrl($img) : Escape::escUrl($img_no)) . '"/>' . __(
1471
  'Custom contact forms',
1472
  'cleantalk-spam-protect'
1473
  );
1474
  if ( ! $apbct->white_label || is_main_site() ) {
1475
+ echo '<img class="apbct_status_icon" src="' . ($apbct->data['moderate'] == 1 ? Escape::escUrl($img) : Escape::escUrl($img_no)) . '"/>'
1476
  . '<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">' . __(
1477
  'Validate email for existence',
1478
  'cleantalk-spam-protect'
1480
  }
1481
  // Autoupdate status
1482
  if ( $apbct->notice_auto_update && ( ! $apbct->white_label || is_main_site()) ) {
1483
+ echo '<img class="apbct_status_icon" src="' . ($apbct->auto_update == 1 ? Escape::escUrl($img) : ($apbct->auto_update == -1 ? Escape::escUrl($img_no) : Escape::escUrl($img_no_gray))) . '"/>' . __(
1484
  'Auto update',
1485
  'cleantalk-spam-protect'
1486
  )
1489
 
1490
  // WooCommerce
1491
  if ( class_exists('WooCommerce') ) {
1492
+ echo '<img class="apbct_status_icon" src="' . ($apbct->settings['forms__wc_checkout_test'] == 1 ? Escape::escUrl($img) : Escape::escUrl($img_no)) . '"/>' . __(
1493
  'WooCommerce checkout form',
1494
  'cleantalk-spam-protect'
1495
  );
1567
  if ( ! $apbct->ip_license ) {
1568
  echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" id="apbct_button__get_key_auto" name="submit" type="button" value="get_key_auto">'
1569
  . __('Get Access Key Automatically', 'cleantalk-spam-protect')
1570
+ . '<img style="margin-left: 10px;" class="apbct_preloader_button" src="' . Escape::escUrl(APBCT_URL_PATH . '/inc/images/preloader2.gif') . '" />'
1571
+ . '<img style="margin-left: 10px;" class="apbct_success --hide" src="' . Escape::escUrl(APBCT_URL_PATH . '/inc/images/yes.png') . '" />'
1572
  . '</button>';
1573
  echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
1574
  echo '<br />';
2391
 
2392
  $apbct->saveData();
2393
 
2394
+ if ( $direct_call ) {
2395
+ return $out;
2396
+ }
2397
+
2398
  die(json_encode($out));
2399
  }
2400
 
inc/cleantalk-updater.php CHANGED
@@ -1138,3 +1138,11 @@ function apbct_update_to_5_177_3()
1138
  $apbct->saveData();
1139
  }
1140
  }
 
 
 
 
 
 
 
 
1138
  $apbct->saveData();
1139
  }
1140
  }
1141
+
1142
+ function apbct_update_to_5_179_2()
1143
+ {
1144
+ global $apbct;
1145
+
1146
+ $apbct->remote_calls['post_api_key'] = array('last_call' => 0);
1147
+ $apbct->save('remote_calls');
1148
+ }
js/apbct-public--3--cleantalk-modal.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,n,a){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},n={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},a={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},o={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},l={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},d={styles:{overflow:"hidden"},toString:e},i=document.createElement("style"),d=(i.setAttribute("id","cleantalk-modal-styles"),i.innerHTML="body.cleantalk-modal-opened{"+d+"}",i.innerHTML+="#cleantalk-modal-overlay{"+t+"}",i.innerHTML+="#cleantalk-modal-close{"+a+"}",i.innerHTML+="#cleantalk-modal-close:before{"+o+"}",i.innerHTML+="#cleantalk-modal-close:after{"+l+"}",document.body.append(i),document.createElement("div")),t=(d.setAttribute("id","cleantalk-modal-overlay"),document.body.append(d),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),a=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",n),d.append(t),document.createElement("div")),o=(a.setAttribute("id","cleantalk-modal-close"),t.append(a),document.createElement("div"));this.loaded?o.innerHTML=this.loaded:(o.innerHTML="Loading...",this.load("get_options_template")),o.setAttribute("id","cleantalk-modal-content"),t.append(o),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
+ //# sourceMappingURL=apbct-public--3--cleantalk-modal.min.js.map
js/apbct-public--3--cleantalk-modal.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"file":"apbct-public--3--cleantalk-modal.min.js","sources":["apbct-public--3--cleantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n \"box-sizing\" : \"content-box\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});"],"names":["cleantalkModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","apbct_admin_sendAJAX","apbct_public_sendAJAX","notJson","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","border","border-radius","box-shadow","closeCss","cursor","right","box-sizing","closeCssBefore","content","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","createElement","overlay","setAttribute","innerHTML","body","append","inner","classList","add","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"AACAA,eAAiB,CAGbC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EAGTC,KAAM,SAAUC,GACNC,KAAKN,SACPM,KAAKL,SAAU,EACfM,SAAW,SAAUC,EAAQC,EAAMC,EAAQC,GACvCZ,eAAeE,SAAU,EACzBF,eAAeC,OAASQ,EACxBI,SAASC,cACL,IAAIC,YAAa,8BAA+B,CAC5CC,SAAS,OAIe,mBAAzBC,qBACPA,qBAEAC,uBAFsB,CAAEZ,OAAWA,GAAU,CAAEE,SAAYA,SAAUW,SAAW,MAQ5FC,KAAM,WAEc,SAAZC,IACA,IAAIC,EAAS,GACb,IAAMC,OAAOhB,KAAKiB,OACdF,GAAUC,IAAM,IAAMhB,KAAKiB,OAAOD,KAAO,IAE7C,OAAOD,EALX,IAOIG,EAAa,CACbD,OAAQ,CACJE,UAAW,OACXC,SAAY,QACZC,IAAO,IACPC,KAAQ,IACRC,MAAS,OACTC,OAAU,OACVC,WAAc,kBACdC,QAAW,OACXC,kBAAoB,SACpBC,cAAgB,UAEpBC,SAAUf,GAEVgB,EAAW,CACXb,OAAQ,CACJG,SAAa,WACbW,QAAY,OACZN,WAAe,OACfO,OAAW,6BACXC,gBAAkB,MAClBC,aAAe,uCAEnBL,SAAUf,GAEVqB,EAAW,CACXlB,OAAQ,CACJG,SAAa,WACbK,WAAe,OACfF,MAAU,OACVC,OAAW,OACXQ,OAAW,6BACXC,gBAAkB,OAClBG,OAAW,UACXf,IAAQ,OACRgB,MAAU,OACVC,aAAe,eAEnBT,SAAUf,GAEVyB,EAAiB,CACjBtB,OAAQ,CACJuB,QAAY,KACZd,QAAY,QACZN,SAAa,WACbK,WAAe,OACfQ,gBAAkB,MAClBV,MAAU,MACVC,OAAW,OACXH,IAAQ,MACRC,KAAS,MACTmB,UAAc,iBAElBZ,SAAUf,GAEV4B,EAAgB,CAChBzB,OAAQ,CACJuB,QAA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0B,4BAAhBD,EAAEC,OAAOC,IAAoD,0BAAhBF,EAAEC,OAAOC,KAClEpE,eAAe8D,UAGvBjD,SAASoD,iBAAiB,8BAA+B,SAAUC,GAC3DlE,eAAeG,QAAUH,eAAeC,SACxCY,SAASmD,eAAgB,2BAA4BR,UAAYxD,eAAeC"}
js/apbct-public-bundle.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function ctSetCookie(e,t,o){var n;("string"==typeof e&&"string"==typeof t||"number"==typeof t)&&(n="ct_pointer_data"===e,e=[[e,t,o]]),"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?e.forEach(function(e,t,o){var n=void 0!==e[2]?"expires="+n+"; ":"",a="https:"===location.protocol?"; secure":"";document.cookie=ctPublicFunctions.cookiePrefix+e[0]+"="+encodeURIComponent(e[1])+"; "+n+"path=/; samesite=lax"+a}):"alternative"!==ctPublicFunctions.data__cookies_type||n||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:e}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:e},{notJson:1})))}function ctDeleteCookie(e){var t;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(t="https:"===location.protocol?"; secure":"",document.cookie=e+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+t):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(t,o,n){var a=o.callback||null,c=o.callback_context||null,i=o.callback_params||null,e=o.async||!0,l=o.notJson||null,r=o.timeout||15e3,n=n||null,s=o.button||null,d=o.spinner||null,u=o.progressbar||null,p=o.silent||null,m=o.no_nonce||null;"string"==typeof t?t=(t=m?t:t+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce)+"&no_cache="+Math.random():(m||(t._ajax_nonce=ctPublicFunctions._ajax_nonce),t.no_cache=Math.random()),s&&(s.setAttribute("disabled","disabled"),s.style.cursor="not-allowed"),d&&jQuery(d).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublicFunctions._ajax_url,data:t,async:e,success:function(e){s&&(s.removeAttribute("disabled"),s.style.cursor="pointer"),d&&jQuery(d).css("display","none"),(e=l?e:JSON.parse(e)).error?(setTimeout(function(){u&&u.fadeOut("slow")},1e3),console.log("Error happens: "+(e.error||"Unkown"))):a&&(i?a.apply(c,i.concat(e,t,o,n)):a(e,t,o,n))},error:function(e,t,o){s&&(s.removeAttribute("disabled"),s.style.cursor="pointer"),d&&jQuery(d).css("display","none"),o&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+o+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:r})}function apbct_public_sendREST(t,o){var n=o.callback||null,e=o.data||[],a=o.method||"POST";jQuery.ajax({type:a,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+t,data:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(e){e.error?console.log("Error happens: "+(e.error||"Unknown")):n&&n(e,t,o,null)},error:function(e,t,o){o&&(console.log("APBCT_REST_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin REST API error: "+o+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}apbctLocalStorage={get:function(e,t){void 0===t&&(t="value");e=localStorage.getItem(e);if(null!==e)try{const o=JSON.parse(e);return o.hasOwnProperty(t)?JSON.parse(o[t]):o}catch(e){return new Error(e)}return!1},set:function(e,t){t={value:JSON.stringify(t),timestamp:Math.floor((new Date).getTime()/1e3)};localStorage.setItem(e,JSON.stringify(t))},isAlive:function(e,t){return void 0===t&&(t=86400),this.get(e,"timestamp")+t>Math.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)}};var ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0,ctCheckedEmails={};function apbct_attach_event_handler(e,t,o){"function"==typeof window.addEventListener?e.addEventListener(t,o):e.attachEvent(t,o)}function apbct_remove_event_handler(e,t,o){"function"==typeof window.removeEventListener?e.removeEventListener(t,o):e.detachEvent(t,o)}var ctFunctionFirstKey=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(ctMouseData))},1200),ctFunctionMouseMove=function(e){ctSetMouseMoved(),!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter&&ctMouseStopData())};function ctMouseStopData(){apbct_remove_event_handler(window,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(window,"keydown",ctFunctionFirstKey)}function checkEmail(e){var t=e.target.value;!t||t in ctCheckedEmails||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}))}function ctSetPixelImg(e){ctSetCookie("apbct_pixel_url",e),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")&&jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+e+'">')}function ctGetPixelUrl(){var e=ctGetPixelUrlLocalstorage();if(!1!==e){if(!ctIsOutdatedPixelUrlLocalstorage(e))return void ctSetPixelImg(e);ctCleaPixelUrlLocalstorage(e)}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(e){e&&(ctGetPixelUrlLocalstorage()||ctSetPixelUrlLocalstorage(e),ctSetPixelImg(e))}}):apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{notJson:!0,callback:function(e){e&&(ctGetPixelUrlLocalstorage()||ctSetPixelUrlLocalstorage(e),ctSetPixelImg(e))}})}function ctSetHasScrolled(){apbctLocalStorage.isSet("ct_has_scrolled")&&apbctLocalStorage.get("ct_has_scrolled")||(ctSetCookie("ct_has_scrolled","true"),apbctLocalStorage.set("ct_has_scrolled",!0))}function ctSetMouseMoved(){apbctLocalStorage.isSet("ct_mouse_moved")&&apbctLocalStorage.get("ct_mouse_moved")||(ctSetCookie("ct_mouse_moved","true"),apbctLocalStorage.set("ct_mouse_moved",!0))}function apbct_ready(){var e=apbctLocalStorage.get("ct_cookies_type"),e=(e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled")),[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",ct_date.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["apbct_headless",navigator.webdriver]]);if("native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var o=0;o<t.length;o++){var n=t[o].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?ctGetPixelUrl():e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(checkEmail)),ctSetCookie(e),setTimeout(function(){for(var e=0;e<document.forms.length;e++){var t,o,n=document.forms[e];0==+ctPublic.data__visible_fields_required||"get"===n.method.toString().toLowerCase()||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("sac-form")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||n.name&&-1!==n.name.toString().indexOf("tribe-bar-form")||((t=document.createElement("input")).setAttribute("type","hidden"),t.setAttribute("id","apbct_visible_fields_"+e),t.setAttribute("name","apbct_visible_fields"),(o={})[0]=apbct_collect_visible_fields(n),t.value=JSON.stringify(o),n.append(t),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=e,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)})}},1e3);let a=document.querySelectorAll("[data-original-string]");if(a.length)for(let e=0;e<a.length;++e)a[e].parentElement.href||a[e].parentElement.parentElement.href||a[e].addEventListener("click",function e(t){this.removeEventListener("click",e),apbctAjaxEmailDecode(t)})}function apbctAjaxEmailDecode(t){const o=t.target;o.setAttribute("title",ctPublicFunctions.text__wait_for_decoding),o.style.cursor="progress","rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_decode_email",{data:{encodedEmail:t.target.dataset.originalString},method:"POST",callback:function(e){e.success&&(ctFillDecodedEmail(e.data,t.target),o.setAttribute("title",""),o.removeAttribute("style"))}}):apbct_public_sendAJAX({action:"apbct_decode_email",encodedEmail:t.target.dataset.originalString},{notJson:!0,callback:function(e){e.success&&(ctFillDecodedEmail(e.data,t.target),o.setAttribute("title",""),o.removeAttribute("style"))}})}function ctFillDecodedEmail(e,t){t.innerHTML=e}function apbct_collect_visible_fields(e){var t,o=[],n="",a=0,c="",i=0,l=[];for(t in e.elements)isNaN(+t)||(o[t]=e.elements[t]);return(o=o.filter(function(e){return-1===l.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(l.push(e.getAttribute("name")),!1))})).forEach(function(e,t,o){"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"),a++):(c+=" "+e.getAttribute("name"),i++))}),c=c.trim(),{visible_fields:n=n.trim(),visible_fields_count:a,invisible_fields:c,invisible_fields_count:i}}function apbct_visible_fields_set_cookie(e,t){var o="object"==typeof e&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(o[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(o))}function apbct_js_keys__set_input_value(e,t,o,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var a=document.querySelectorAll("[name^=ct_checkjs]"),c=0;c<a.length;c++)a[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 ctSetPixelUrlLocalstorage(e){localStorage.setItem("session_pixel_url",e),localStorage.setItem(e,Math.floor(Date.now()/1e3).toString())}function ctGetPixelUrlLocalstorage(){var e=localStorage.getItem("session_pixel_url");return null!==e&&e}function ctIsOutdatedPixelUrlLocalstorage(e){e=Number(localStorage.getItem(e));return 10800<Math.floor(Date.now()/1e3).toString()-e}function ctCleaPixelUrlLocalstorage(e){localStorage.removeItem(e),localStorage.removeItem("session_pixel_url")}function ct_protect_external(){for(var e=0;e<document.forms.length;e++)if(void 0===document.forms[e].cleantalk_hidden_action&&void 0===document.forms[e].cleantalk_hidden_method){var t,o,n,a,c,i=document.forms[e];if(i.parentElement&&0<i.parentElement.classList.length&&-1!==i.parentElement.classList[0].indexOf("mewtwo"))return;"string"==typeof i.action&&(isIntegratedForm(i)?(jQuery(i).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(i).prev(),a=i.outerHTML,o=jQuery(i).detach(),t.after(a),(a=document.createElement("input")).name="action",a.value="cleantalk_force_ajax_check",a.type="hidden",(n=document.forms[e]).appendChild(a),void 0!==n.classList&&n.classList.contains("ml-block-form")?void 0!==(a=jQuery("form.ml-block-form").find('button[type="submit"]'))&&a.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(n,t,o)}):document.forms[e].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),o=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,o)}):-1===i.action.indexOf("http://")&&-1===i.action.indexOf("https://")||i.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((a=document.createElement("input")).name="cleantalk_hidden_action",a.value=i.action,a.type="hidden",i.appendChild(a),(c=document.createElement("input")).name="cleantalk_hidden_method",c.value=i.method,c.type="hidden",i.method="POST",i.appendChild(c),i.action=document.location))}}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),o=jQuery(t).find("button, input, textarea, select");e.each(function(e,n){var a=jQuery(n);o.each(function(e,t){var o=jQuery(t);n.outerHTML===t.outerHTML&&o.val(a.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com"))}function sendAjaxCheckingFormData(n,e,t){var o={},a=(o[0]=apbct_collect_visible_fields(n),apbct_visible_fields_set_cookie(o),{}),o=n.elements;(o=Array.prototype.slice.call(o)).forEach(function(e,t){""===e.name?a["input_"+t]=e.value:a[e.name]=e.value}),apbct_public_sendAJAX(a,{async:!1,callback:function(e,t,o){void 0!==o.apbct&&+o.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(n).detach(),t),e.after(t),0===(o=jQuery(t).find("button[type=submit]")).length&&0===(o=jQuery(t).find("input[type=submit]")).length&&0===(o=jQuery(t).find('button[data-element="submit"]')).length&&0===(o=jQuery(t).find('input[type="image"][name="submit"]')).length||o[0].click())},callback_context:null,callback_params:[e,t]})}apbct_attach_event_handler(window,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(window,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(window,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(window,"scroll",ctSetHasScrolled),apbct_attach_event_handler(window,"DOMContentLoaded",apbct_ready),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,o){t.responseText&&-1!==t.responseText.indexOf('"apbct')&&void 0!==(t=JSON.parse(t.responseText)).apbct&&(t=t.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:t.comment}})),cleantalkModal.loaded=t.comment,cleantalkModal.open(),1==+t.stop_script&&window.stop())}),cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,o,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},o={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},a={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},c={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},i={styles:{overflow:"hidden"},toString:e},l=document.createElement("style"),i=(l.setAttribute("id","cleantalk-modal-styles"),l.innerHTML="body.cleantalk-modal-opened{"+i+"}",l.innerHTML+="#cleantalk-modal-overlay{"+t+"}",l.innerHTML+="#cleantalk-modal-close{"+n+"}",l.innerHTML+="#cleantalk-modal-close:before{"+a+"}",l.innerHTML+="#cleantalk-modal-close:after{"+c+"}",document.body.append(l),document.createElement("div")),t=(i.setAttribute("id","cleantalk-modal-overlay"),document.body.append(i),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),n=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",o),i.append(t),document.createElement("div")),a=(n.setAttribute("id","cleantalk-modal-close"),t.append(n),document.createElement("div"));this.loaded?a.innerHTML=this.loaded:(a.innerHTML="Loading...",this.load("get_options_template")),a.setAttribute("id","cleantalk-modal-content"),t.append(a),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)}),jQuery(document).ready(function(){"undefined"!=typeof ctPublicGDPR&&ctPublicGDPR.gdpr_forms&&ctPublicGDPR.gdpr_forms.forEach(function(e,t,o){var n=jQuery("#"+e+", ."+e);n.is("form")||(n.find("form")[0]?n=n.children("form").first():jQuery(".wpcf7[role=form]")[0]&&-1!==jQuery(".wpcf7[role=form]").attr("id").indexOf("wpcf7-f"+e)?n=jQuery(".wpcf7[role=form]"):jQuery(".frm_forms")[0]&&-1!==jQuery(".frm_forms").first().attr("id").indexOf("frm_form_"+e)?n=jQuery(".frm_forms").first().children("form"):jQuery(".wpforms-form")[0]&&-1!==jQuery(".wpforms-form").first().attr("id").indexOf("wpforms-form-"+e)&&(n=jQuery(".wpforms-form"))),!n.is("form")&&"form"!==n.attr("role")||n.append('<input id="apbct_gdpr_'+t+'" type="checkbox" required="required " style="display: inline; margin-right: 10px;">').append('<label style="display: inline;" for="apbct_gdpr_'+t+'">'+ctPublicGDPR.gdpr_text+"</label>")})}),window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
js/cleantalk-admin-settings-page.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_banner_check(){var c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null!==a)c.push(a[key]);else if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){function c(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))}c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class= 'apbct-icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){a.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}function apbct_save_button_position(){var t,e,n,a,c,s,o,i;null!==document.getElementById("apbct_settings__before_advanced_settings")&&null!==document.getElementById("apbct_settings__after_advanced_settings")&&null!==document.getElementById("apbct_settings__button_section")&&null!==document.getElementById("apbct_settings__advanced_settings")&&null!==document.getElementById("apbct_hidden_section_nav")&&(t=window.innerHeight,n=(e=document.getElementById("apbct_settings__advanced_settings")).getBoundingClientRect().top,c=(a=document.getElementById("apbct_settings__button_section")).getBoundingClientRect().height,o=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,i=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<o+i+c?(a.style.bottom="",a.style.top=o+i+20+"px"):(a.style.bottom=0,a.style.top="")):jQuery("#apbct_settings__main_save_button").show(),s.style.top=n<=0?30-n+"px":0)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var c,t=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0===t.data("id")?console.log('Attribute "data-id" not set for the option.'):(t={template_id:t.data("id"),template_name:t.data("name"),settings:t.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}}))}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");n={template_name:n}}else n={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbct_settings__showDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbct_banner_check(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbct_save_button_position(),window.addEventListener("scroll",apbct_save_button_position),jQuery("#ct_adv_showhide a").on("click",apbct_save_button_position),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();if(""===t||null===t.match(/^[a-z\d]{3,15}$/))return jQuery("#apbct_button__get_key_auto__wrapper").show(),void jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!0);jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!1)}),jQuery("#apbct_setting_apikey").val()&&jQuery("#apbct_button__get_key_auto__wrapper").hide()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
1
+ function apbct_banner_check(){var c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null!==a)c.push(a[key]);else if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){function c(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))}c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class= 'apbct-icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){a.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}function apbct_save_button_position(){var t,e,n,a,c,s,o,i;null!==document.getElementById("apbct_settings__before_advanced_settings")&&null!==document.getElementById("apbct_settings__after_advanced_settings")&&null!==document.getElementById("apbct_settings__button_section")&&null!==document.getElementById("apbct_settings__advanced_settings")&&null!==document.getElementById("apbct_hidden_section_nav")&&(t=window.innerHeight,n=(e=document.getElementById("apbct_settings__advanced_settings")).getBoundingClientRect().top,c=(a=document.getElementById("apbct_settings__button_section")).getBoundingClientRect().height,o=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,i=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<o+i+c?(a.style.bottom="",a.style.top=o+i+20+"px"):(a.style.bottom=0,a.style.top="")):jQuery("#apbct_settings__main_save_button").show(),s.style.top=n<=0?30-n+"px":0)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var c,t=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0===t.data("id")?console.log('Attribute "data-id" not set for the option.'):(t={template_id:t.data("id"),template_name:t.data("name"),settings:t.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}}))}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");n={template_name:n}}else n={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbct_settings__showDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbct_banner_check(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbct_save_button_position(),window.addEventListener("scroll",apbct_save_button_position),jQuery("#ct_adv_showhide a").on("click",apbct_save_button_position),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();if(""===t||null===t.match(/^[a-z\d]{3,30}$/))return jQuery("#apbct_button__get_key_auto__wrapper").show(),void jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!0);jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!1)}),jQuery("#apbct_setting_apikey").val()&&jQuery("#apbct_button__get_key_auto__wrapper").hide()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
js/cleantalk-admin-settings-page.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\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\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\n\t\tapbct_banner_check();\n\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\tapbct_save_button_position();\n\twindow.addEventListener('scroll', apbct_save_button_position);\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\n\n\n\t/**\n\t * Change cleantalk account email\n\t */\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\n\t\te.preventDefault();\n\n\t\tvar $this = jQuery(this);\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\n\t\tvar accountEmail = accountEmailField.text();\n\n\t\t$this.toggleClass('active');\n\n\t\tif ($this.hasClass('active')) {\n\t\t\t$this.text($this.data('save-text'));\n\t\t\taccountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.on('keydown', function (e) {\n\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t\taccountEmailField.on('input', function (e) {\n\t\t\t\tif (e.inputType === 'insertParagraph') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tapbct_admin_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_update_account_email',\n\t\t\t\t\taccountEmail: accountEmail\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttimeout: 5000,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (result.error !== undefined) {\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\taccountEmailField.attr('contenteditable', 'false');\n\t\t\t$this.text($this.data('default-text'));\n\t\t}\n\t});\n\n\t/**\n\t * Validate apkikey and hide get auto btn\n\t */\n\tjQuery('#apbct_setting_apikey').on('input', function () {\n\t\tvar enteredValue = jQuery(this).val();\n\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,15}$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\n\t\t\treturn;\n\t\t}\n\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() ) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction apbct_save_button_position() {\n\tif (\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\n\t) {\n\t\treturn;\n\t}\n\tvar docInnerHeight = window.innerHeight;\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\n\n\t// Set Save button position\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\n\t\tjQuery('#apbct_settings__main_save_button').hide();\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\n\t\t\tbuttonBlock.style.bottom = '';\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\n\t\t} else {\n\t\t\tbuttonBlock.style.bottom = 0;\n\t\t\tbuttonBlock.style.top = '';\n\t\t}\n\t} else {\n\t\tjQuery('#apbct_settings__main_save_button').show();\n\t}\n\n\t// Set nav position\n\tif ( advSettingsOffset <= 0 ) {\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\n\t} else {\n\t\tnavBlock.style.top = 0;\n\t}\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","push","key","getElementsByClassName","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","apbct_save_button_position","docInnerHeight","advSettingsBlock","advSettingsOffset","buttonBlock","buttonHeight","navBlock","navBlockOffset","navBlockHeight","window","innerHeight","getBoundingClientRect","height","getComputedStyle","display","style","bottom","ready","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","prop"],"mappings":"AAwRA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACpCF,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACxCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IA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AAO,wBAAwBgD,IAAI,eAAgB,UAMvDiE,EAAkBnC,KAAK,kBAAmB,SAC1CkC,EAAMG,KAAKH,EAAMpH,KAAK,oBAOxBI,OAAO,yBAAyByD,GAAG,QAAS,WAC3C,IAAIiE,EAAe1H,OAAO+E,MAAMF,MAEhC,GAAqB,KAAjB6C,GAAiE,OAA1CA,EAAaC,MAAM,mBAG7C,OAFA3H,OAAO,wCAAwC0B,YAC/C1B,OAAO,+CAA+C4H,KAAK,YAAY,GAIxE5H,OAAO,wCAAwCE,OAC/CF,OAAO,+CAA+C4H,KAAK,YAAY,KAGnE5H,OAAO,yBAAyB6E,OACpC7E,OAAO,wCAAwCE"}
1
+ {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\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\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\n\t\tapbct_banner_check();\n\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\tapbct_save_button_position();\n\twindow.addEventListener('scroll', apbct_save_button_position);\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\n\n\n\t/**\n\t * Change cleantalk account email\n\t */\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\n\t\te.preventDefault();\n\n\t\tvar $this = jQuery(this);\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\n\t\tvar accountEmail = accountEmailField.text();\n\n\t\t$this.toggleClass('active');\n\n\t\tif ($this.hasClass('active')) {\n\t\t\t$this.text($this.data('save-text'));\n\t\t\taccountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.on('keydown', function (e) {\n\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t\taccountEmailField.on('input', function (e) {\n\t\t\t\tif (e.inputType === 'insertParagraph') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tapbct_admin_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_update_account_email',\n\t\t\t\t\taccountEmail: accountEmail\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttimeout: 5000,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (result.error !== undefined) {\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\taccountEmailField.attr('contenteditable', 'false');\n\t\t\t$this.text($this.data('default-text'));\n\t\t}\n\t});\n\n\t/**\n\t * Validate apkikey and hide get auto btn\n\t */\n\tjQuery('#apbct_setting_apikey').on('input', function () {\n\t\tvar enteredValue = jQuery(this).val();\n\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,30}$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\n\t\t\treturn;\n\t\t}\n\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() ) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction apbct_save_button_position() {\n\tif (\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\n\t) {\n\t\treturn;\n\t}\n\tvar docInnerHeight = window.innerHeight;\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\n\n\t// Set Save button position\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\n\t\tjQuery('#apbct_settings__main_save_button').hide();\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\n\t\t\tbuttonBlock.style.bottom = '';\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\n\t\t} else {\n\t\t\tbuttonBlock.style.bottom = 0;\n\t\t\tbuttonBlock.style.top = '';\n\t\t}\n\t} else {\n\t\tjQuery('#apbct_settings__main_save_button').show();\n\t}\n\n\t// Set nav position\n\tif ( advSettingsOffset <= 0 ) {\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\n\t} else {\n\t\tnavBlock.style.top = 0;\n\t}\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","push","key","getElementsByClassName","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","apbct_save_button_position","docInnerHeight","advSettingsBlock","advSettingsOffset","buttonBlock","buttonHeight","navBlock","navBlockOffset","navBlockHeight","window","innerHeight","getBoundingClientRect","height","getComputedStyle","display","style","bottom","ready","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","prop"],"mappings":"AAwRA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACpCF,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACxCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,MAErB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,GAClC,GAAY,OAARP,EACHK,EAAIM,KAAMX,EAAIY,WAOf,GAAY,QADZZ,EAAMS,SAASI,uBAAuBN,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIM,KAAMX,EAAIY,QAMXP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,I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AASC,4BAMzC1D,OAAO,+BAA+ByD,GAAG,QAAS,SAAUjB,GAC3DA,EAAEuE,iBAEF,IAAIC,EAAQhH,OAAO+E,MACfkC,EAAoBjH,OAAO,wBAC3BkH,EAAeD,EAAkBE,OAErCH,EAAMI,YAAY,UAEdJ,EAAMrE,SAAS,WAClBqE,EAAMG,KAAKH,EAAMpH,KAAK,cACtBqH,EAAkBnC,KAAK,kBAAmB,QAC1CmC,EAAkBxD,GAAG,UAAW,SAAUjB,GAC1B,UAAXA,EAAE6E,MACL7E,EAAEuE,mBAGJE,EAAkBxD,GAAG,QAAS,SAAUjB,GACnB,oBAAhBA,EAAE8E,WACL9E,EAAEuE,qBAIJvH,qBACC,CACCC,OAAQ,6BACRyH,aAAcA,GAEf,CACC9B,QAAS,IACT1F,SAAU,SAASC,EAAQC,EAAMC,EAAQC,QACjByH,IAAnB5H,EAAO0G,SAA4C,OAAnB1G,EAAO0G,cACdkB,IAAxB5H,EAAO6H,cACVxH,OAAO,4BAA4B8E,KAAK,OAAQnF,EAAO6H,mBAIpCD,IAAjB5H,EAAO8H,OACVzH,OAAO,wBAAwBgD,IAAI,eAAgB,UAMvDiE,EAAkBnC,KAAK,kBAAmB,SAC1CkC,EAAMG,KAAKH,EAAMpH,KAAK,oBAOxBI,OAAO,yBAAyByD,GAAG,QAAS,WAC3C,IAAIiE,EAAe1H,OAAO+E,MAAMF,MAEhC,GAAqB,KAAjB6C,GAAiE,OAA1CA,EAAaC,MAAM,mBAG7C,OAFA3H,OAAO,wCAAwC0B,YAC/C1B,OAAO,+CAA+C4H,KAAK,YAAY,GAIxE5H,OAAO,wCAAwCE,OAC/CF,OAAO,+CAA+C4H,KAAK,YAAY,KAGnE5H,OAAO,yBAAyB6E,OACpC7E,OAAO,wCAAwCE"}
js/cleantalk_external.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_protect_external(){for(var e,t,n,a,o,i,c=0;c<document.forms.length;c++)void 0!==document.forms[c].cleantalk_hidden_action||void 0!==document.forms[c].cleantalk_hidden_method||"string"==typeof(e=document.forms[c]).action&&(isIntegratedForm(e)?(jQuery(e).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(e).prev(),o=e.outerHTML,n=jQuery(e).detach(),t.after(o),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(a=document.forms[c]).appendChild(o),void 0!==a.classList&&a.classList.contains("ml-block-form")?void 0!==(o=jQuery("form.ml-block-form").find('button[type="submit"]'))&&o.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(a,t,n)}):document.forms[c].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),n=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,n)}):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((o=document.createElement("input")).name="cleantalk_hidden_action",o.value=e.action,o.type="hidden",e.appendChild(o),(i=document.createElement("input")).name="cleantalk_hidden_method",i.value=e.method,i.type="hidden",e.method="POST",e.appendChild(i),e.action=document.location))}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),n=jQuery(t).find("button, input, textarea, select");e.each(function(e,a){var o=jQuery(a);n.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com"))}function sendAjaxCheckingFormData(a,e,t){var n={},o=(n[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(n),{}),n=a.elements;(n=Array.prototype.slice.call(n)).forEach(function(e,t){""===e.name?o["input_"+t]=e.value:o[e.name]=e.value}),apbct_public_sendAJAX(o,{async:!1,callback:function(e,t,n){void 0!==n.apbct&&+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),t),e.after(t),0===(n=jQuery(t).find("button[type=submit]")).length&&0===(n=jQuery(t).find("input[type=submit]")).length&&0===(n=jQuery(t).find('button[data-element="submit"]')).length&&0===(n=jQuery(t).find('input[type="image"][name="submit"]')).length||n[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
1
+ function ct_protect_external(){for(var e=0;e<document.forms.length;e++)if(void 0===document.forms[e].cleantalk_hidden_action&&void 0===document.forms[e].cleantalk_hidden_method){var t,n,a,o,i,c=document.forms[e];if(c.parentElement&&-1!==c.parentElement.classList[0].indexOf("mewtwo"))return;"string"==typeof c.action&&(isIntegratedForm(c)?(jQuery(c).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(c).prev(),o=c.outerHTML,n=jQuery(c).detach(),t.after(o),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(a=document.forms[e]).appendChild(o),void 0!==a.classList&&a.classList.contains("ml-block-form")?void 0!==(o=jQuery("form.ml-block-form").find('button[type="submit"]'))&&o.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(a,t,n)}):document.forms[e].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),n=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,n)}):-1===c.action.indexOf("http://")&&-1===c.action.indexOf("https://")||c.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((o=document.createElement("input")).name="cleantalk_hidden_action",o.value=c.action,o.type="hidden",c.appendChild(o),(i=document.createElement("input")).name="cleantalk_hidden_method",i.value=c.method,i.type="hidden",c.method="POST",c.appendChild(i),c.action=document.location))}}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),n=jQuery(t).find("button, input, textarea, select");e.each(function(e,a){var o=jQuery(a);n.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com"))}function sendAjaxCheckingFormData(a,e,t){var n={},o=(n[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(n),{}),n=a.elements;(n=Array.prototype.slice.call(n)).forEach(function(e,t){""===e.name?o["input_"+t]=e.value:o[e.name]=e.value}),apbct_public_sendAJAX(o,{async:!1,callback:function(e,t,n){void 0!==n.apbct&&+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),t),e.after(t),0===(n=jQuery(t).find("button[type=submit]")).length&&0===(n=jQuery(t).find("input[type=submit]")).length&&0===(n=jQuery(t).find('button[data-element="submit"]')).length&&0===(n=jQuery(t).find('input[type="image"][name="submit"]')).length||n[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
js/cleantalk_external.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // if (currentForm.action.indexOf('tp.media') !== -1){\n // return\n // }\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST'\n\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 || // Mailerlite integration\n formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1\n\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","currentForm","prev","form_original","reUseCurrentForm","ct_action","ct_method","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","jQuery","before","form_html","outerHTML","detach","after","force_action","createElement","name","value","type","appendChild","classList","contains","mailerliteSubmitButton","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","currentTarget","clone","action","indexOf","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","data","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","apbct","blocked","subm_button","callback_context","callback_params","window","onload","setTime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EAAK,SAAWW,GAAKD,EAAKlD,MAE1BwC,EAAKU,EAAKnD,MAAQmD,EAAKlD,QAI/BoD,sBACIZ,EACA,CACIa,OAAO,EACPC,SAAU,SAAU5E,EAAM4D,EAAciB,QAEfpE,IAAjBoE,EAAOC,QAA0BD,EAAOC,MAAMC,UAI9CpC,4CAFe9B,OAAO8C,GAAM1C,SAE0B2C,GAEtD5D,EAAKkB,MAAO0C,GAIe,KADvBoB,EAAcnE,OAAO+C,GAAchC,KAAK,wBAC5BpB,QAMW,KAD3BwE,EAAcnE,OAAO+C,GAAchC,KAAK,uBACxBpB,QAOW,KAD3BwE,EAAcnE,OAAO+C,GAAchC,KAAK,kCACxBpB,QAOW,KAD3BwE,EAAcnE,OAAO+C,GAAchC,KAAK,uCACxBpB,QAnBZwE,EAAY,GAAGnD,UAyB3BoD,iBAAkB,KAClBC,gBAAiB,CAAClF,EAAM4D,KAlGpCuB,OAAOC,OAAS,WACZC,WAAW,WACPvF,uBACD"}
1
+ {"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if (currentForm.parentElement && currentForm.parentElement.classList[0].indexOf('mewtwo') !== -1){\n return\n }\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST'\n\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 || // Mailerlite integration\n formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1\n\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","prev","form_original","reUseCurrentForm","ct_action","ct_method","currentForm","parentElement","classList","indexOf","isIntegratedForm","jQuery","before","form_html","outerHTML","detach","after","force_action","createElement","name","value","type","appendChild","contains","mailerliteSubmitButton","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","currentTarget","clone","action","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","data","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","apbct","blocked","subm_button","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACL,IAAI,IAAIC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAEtC,QAAkDI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAASC,MAAMF,GAAGM,wBAAuC,CAGpH,IAaYC,EAEAC,EASAC,EAkCIC,EAMAC,EAhEZC,EAAcX,SAASC,MAAMF,GAEjC,GAAIY,EAAYC,gBAA+E,IAA9DD,EAAYC,cAAcC,UAAU,GAAGC,QAAQ,UAC5E,OAG6B,iBAAvBH,EAAkB,SAErBI,iBAAiBJ,IAEhBK,OAAQL,GAAcM,OAAO,gEAGzBX,EAAOU,OAAOL,GAAaL,OAC3BY,EAAYP,EAAYQ,UACxBZ,EAAgBS,OAAOL,GAAaS,SAExCd,EAAKe,MAAOH,IAERI,EAAetB,SAASuB,cAAc,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KAD3B+E,EAAcjE,OAAO6C,GAAc/B,KAAK,uCACxB5B,QAnBZ+E,EAAY,GAAGlD,UAyB3BmD,iBAAkB,KAClBC,gBAAiB,CAAC7E,EAAMuD,KAlGpCuB,OAAOC,OAAS,WACZC,WAAW,WACPxF,uBACD"}
lib/Cleantalk/Antispam/DisableComments.php CHANGED
@@ -204,7 +204,7 @@ class DisableComments
204
  if ( $this->isCurrentTypeToDisable() ) {
205
  wp_enqueue_script(
206
  'cleantalk-disable-comments-gutenberg',
207
- plugin_dir_url(__FILE__) . 'assets/apbct-disable-comments.js',
208
  array(),
209
  APBCT_VERSION,
210
  true
204
  if ( $this->isCurrentTypeToDisable() ) {
205
  wp_enqueue_script(
206
  'cleantalk-disable-comments-gutenberg',
207
+ APBCT_JS_ASSETS_PATH . '/apbct-disable-comments.min.js',
208
  array(),
209
  APBCT_VERSION,
210
  true
lib/Cleantalk/ApbctWP/AdminNotices.php CHANGED
@@ -24,7 +24,8 @@ class AdminNotices
24
  'notice_key_is_incorrect',
25
  'notice_trial',
26
  'notice_renew',
27
- 'notice_incompatibility'
 
28
  );
29
 
30
  /**
@@ -206,6 +207,33 @@ class AdminNotices
206
  }
207
  }
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  /**
210
  * Callback for the notice hook
211
  * @psalm-suppress PossiblyUnusedMethod
@@ -250,11 +278,17 @@ class AdminNotices
250
  */
251
  private function isDismissedNotice($notice_uid)
252
  {
253
- $notice_date_option = get_option('cleantalk_' . $notice_uid . '_dismissed');
 
 
 
 
 
 
254
 
255
  if ( $notice_date_option !== false && \Cleantalk\Common\Helper::dateValidate($notice_date_option) ) {
256
  $current_date = date_create();
257
- $notice_date = date_create(get_option('cleantalk_' . $notice_uid . '_dismissed'));
258
 
259
  $diff = date_diff($current_date, $notice_date);
260
 
24
  'notice_key_is_incorrect',
25
  'notice_trial',
26
  'notice_renew',
27
+ 'notice_incompatibility',
28
+ 'notice_review'
29
  );
30
 
31
  /**
207
  }
208
  }
209
 
210
+ /**
211
+ * Callback for the notice hook
212
+ * @deprecated
213
+ * @psalm-suppress PossiblyUnusedMethod
214
+ */
215
+ public function notice_review() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
216
+ {
217
+ if ($this->apbct->notice_review == 1) {
218
+ $review_link = "<a class='button' href='https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/?filter=5' target='_blank'>"
219
+ . __('SHARE', 'cleantalk-spam-protect') .
220
+ "</a>";
221
+ $content = '<div class="apbct-notice notice notice-success is-dismissible" id="cleantalk_notice_review">
222
+ <div class="flex-row">
223
+ <h3>'
224
+ . __('Share your positive energy with us – give us a 5-star rating on WordPress.', 'cleantalk-spam-protect') .
225
+ '</h3>
226
+ <p class="caption">'
227
+ . __('Anti-Spam by CleanTalk.', 'cleantalk-spam-protect') .
228
+ '</p>
229
+ </div>'
230
+ . $review_link .
231
+ '</div>';
232
+
233
+ echo $content;
234
+ }
235
+ }
236
+
237
  /**
238
  * Callback for the notice hook
239
  * @psalm-suppress PossiblyUnusedMethod
278
  */
279
  private function isDismissedNotice($notice_uid)
280
  {
281
+ $option_name = 'cleantalk_' . $notice_uid . '_dismissed';
282
+ $notice_date_option = get_option($option_name);
283
+
284
+ // Infinity for notice_review
285
+ if ($notice_date_option !== false && strpos($option_name, 'notice_review')) {
286
+ return true;
287
+ }
288
 
289
  if ( $notice_date_option !== false && \Cleantalk\Common\Helper::dateValidate($notice_date_option) ) {
290
  $current_date = date_create();
291
+ $notice_date = date_create($notice_date_option);
292
 
293
  $diff = date_diff($current_date, $notice_date);
294
 
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php CHANGED
@@ -431,7 +431,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
431
  CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html"
432
  );
433
 
434
- $js_url = APBCT_URL_PATH . '/js/apbct-public--functions.min.js?' . APBCT_VERSION;
435
 
436
  $net_count = $apbct->stats['sfw']['entries'];
437
 
431
  CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html"
432
  );
433
 
434
+ $js_url = APBCT_URL_PATH . '/js/apbct-public-bundle.min.js?' . APBCT_VERSION;
435
 
436
  $net_count = $apbct->stats['sfw']['entries'];
437
 
lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php CHANGED
@@ -210,7 +210,7 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule
210
  CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html'
211
  );
212
 
213
- $js_url = APBCT_URL_PATH . '/js/apbct-public--functions.min.js?' . APBCT_VERSION;
214
 
215
  $net_count = $apbct->stats['sfw']['entries'];
216
 
210
  CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html'
211
  );
212
 
213
+ $js_url = APBCT_URL_PATH . '/js/apbct-public-bundle.min.js?' . APBCT_VERSION;
214
 
215
  $net_count = $apbct->stats['sfw']['entries'];
216
 
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -287,7 +287,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
287
  CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html"
288
  );
289
 
290
- $js_url = APBCT_URL_PATH . '/js/apbct-public--functions.min.js?' . APBCT_VERSION;
291
 
292
  $net_count = $apbct->stats['sfw']['entries'];
293
 
287
  CLEANTALK_PLUGIN_DIR . "lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html"
288
  );
289
 
290
+ $js_url = APBCT_URL_PATH . '/js/apbct-public-bundle.min.js?' . APBCT_VERSION;
291
 
292
  $net_count = $apbct->stats['sfw']['entries'];
293
 
lib/Cleantalk/ApbctWP/RemoteCalls.php CHANGED
@@ -15,10 +15,26 @@ class RemoteCalls
15
  */
16
  public static function check()
17
  {
18
- return
19
- Request::get('spbc_remote_call_token') &&
20
- Request::get('spbc_remote_call_action') &&
21
- in_array(Request::get('plugin_name'), array('antispam', 'anti-spam', 'apbct'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
 
24
  /**
@@ -34,31 +50,35 @@ class RemoteCalls
34
  $action = strtolower(Request::get('spbc_remote_call_action'));
35
  $token = strtolower(Request::get('spbc_remote_call_token'));
36
 
37
- if (isset($apbct->remote_calls[$action])) {
38
  $cooldown = isset($apbct->remote_calls[$action]['cooldown']) ? $apbct->remote_calls[$action]['cooldown'] : self::COOLDOWN;
39
 
40
  // Return OK for test remote calls
41
- if (Request::get('test')) {
42
  die('OK');
43
  }
44
 
45
  if (
46
  time() - $apbct->remote_calls[$action]['last_call'] >= $cooldown ||
47
- ( $action === 'sfw_update' && Request::get('file_urls') )
48
  ) {
49
  $apbct->remote_calls[$action]['last_call'] = time();
50
  $apbct->save('remote_calls');
51
 
52
  // Check Access key
53
- if ($token == strtolower(md5($apbct->api_key))) {
 
 
 
 
54
  // Flag to let plugin know that Remote Call is running.
55
  $apbct->rc_running = true;
56
 
57
  $action = 'action__' . $action;
58
 
59
- if (method_exists(__CLASS__, $action)) {
60
  // Delay before perform action;
61
- if (Request::get('delay')) {
62
  sleep((int)Request::get('delay'));
63
  $params = $_REQUEST;
64
  unset($params['delay']);
@@ -84,7 +104,7 @@ class RemoteCalls
84
  $out = 'FAIL ' . json_encode(array('error' => 'UNKNOWN_ACTION'));
85
  }
86
 
87
- if ($out) {
88
  die($out);
89
  }
90
  }
@@ -133,7 +153,7 @@ class RemoteCalls
133
  {
134
  $result = apbct_sfw_update__worker();
135
 
136
- if ( ! empty($result['error'])) {
137
  apbct_sfw_update__cleanData();
138
 
139
  die('FAIL ' . json_encode(array('error' => $result['error'])));
@@ -168,14 +188,6 @@ class RemoteCalls
168
  return apbct_rc__activate_plugin(Request::get('plugin'));
169
  }
170
 
171
- /**
172
- * Insert Access key
173
- */
174
- public static function action__insert_auth_key() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
175
- {
176
- return apbct_rc__insert_auth_key(Request::get('auth_key'), Request::get('plugin'));
177
- }
178
-
179
  /**
180
  * Update settins
181
  */
@@ -211,15 +223,16 @@ class RemoteCalls
211
  $out['data'] = $apbct->data;
212
  $out['cron'] = $apbct->cron;
213
  $out['errors'] = $apbct->errors;
 
214
  $out['queue'] = get_option('cleantalk_sfw_update_queue');
215
  $out['servers_connection'] = apbct_test_connection();
216
 
217
- if (APBCT_WPMS) {
218
  $out['network_settings'] = $apbct->network_settings;
219
  $out['network_data'] = $apbct->network_data;
220
  }
221
 
222
- if (Request::equal('out', 'json')) {
223
  die(json_encode($out));
224
  }
225
  array_walk($out, function (&$val, $_key) {
@@ -227,7 +240,7 @@ class RemoteCalls
227
  });
228
 
229
  array_walk_recursive($out, function (&$val, $_key) {
230
- if (is_int($val) && preg_match('@^\d{9,11}$@', (string)$val)) {
231
  $val = date('Y-m-d H:i:s', $val);
232
  }
233
  });
@@ -253,7 +266,7 @@ class RemoteCalls
253
  Request::get('period') &&
254
  Request::get('first_call')
255
  ) {
256
- $cron = new Cron();
257
  $update_result = $cron->updateTask(
258
  Request::get('task'),
259
  Request::get('handler'),
@@ -264,4 +277,52 @@ class RemoteCalls
264
 
265
  die($update_result ? 'OK' : 'FAIL');
266
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  }
15
  */
16
  public static function check()
17
  {
18
+ return Request::get('spbc_remote_call_token')
19
+ ? self::checkWithToken()
20
+ : self::checkWithoutToken();
21
+ }
22
+
23
+ public static function checkWithToken()
24
+ {
25
+ return Request::get('spbc_remote_call_token') &&
26
+ Request::get('spbc_remote_call_action') &&
27
+ in_array(Request::get('plugin_name'), array('antispam', 'anti-spam', 'apbct'));
28
+ }
29
+
30
+ public static function checkWithoutToken()
31
+ {
32
+ global $apbct;
33
+
34
+ return ! $apbct->key_is_ok &&
35
+ Request::get('spbc_remote_call_action') &&
36
+ in_array(Request::get('plugin_name'), array('antispam', 'anti-spam', 'apbct')) &&
37
+ strpos(Helper::ipResolve(Helper::ipGet()), 'cleantalk.org') !== false;
38
  }
39
 
40
  /**
50
  $action = strtolower(Request::get('spbc_remote_call_action'));
51
  $token = strtolower(Request::get('spbc_remote_call_token'));
52
 
53
+ if ( isset($apbct->remote_calls[$action]) ) {
54
  $cooldown = isset($apbct->remote_calls[$action]['cooldown']) ? $apbct->remote_calls[$action]['cooldown'] : self::COOLDOWN;
55
 
56
  // Return OK for test remote calls
57
+ if ( Request::get('test') ) {
58
  die('OK');
59
  }
60
 
61
  if (
62
  time() - $apbct->remote_calls[$action]['last_call'] >= $cooldown ||
63
+ ($action === 'sfw_update' && Request::get('file_urls'))
64
  ) {
65
  $apbct->remote_calls[$action]['last_call'] = time();
66
  $apbct->save('remote_calls');
67
 
68
  // Check Access key
69
+ if (
70
+ ($token === strtolower(md5($apbct->api_key)) ||
71
+ $token === strtolower(hash('sha256', $apbct->api_key))) ||
72
+ self::checkWithoutToken()
73
+ ) {
74
  // Flag to let plugin know that Remote Call is running.
75
  $apbct->rc_running = true;
76
 
77
  $action = 'action__' . $action;
78
 
79
+ if ( method_exists(__CLASS__, $action) ) {
80
  // Delay before perform action;
81
+ if ( Request::get('delay') ) {
82
  sleep((int)Request::get('delay'));
83
  $params = $_REQUEST;
84
  unset($params['delay']);
104
  $out = 'FAIL ' . json_encode(array('error' => 'UNKNOWN_ACTION'));
105
  }
106
 
107
+ if ( $out ) {
108
  die($out);
109
  }
110
  }
153
  {
154
  $result = apbct_sfw_update__worker();
155
 
156
+ if ( ! empty($result['error']) ) {
157
  apbct_sfw_update__cleanData();
158
 
159
  die('FAIL ' . json_encode(array('error' => $result['error'])));
188
  return apbct_rc__activate_plugin(Request::get('plugin'));
189
  }
190
 
 
 
 
 
 
 
 
 
191
  /**
192
  * Update settins
193
  */
223
  $out['data'] = $apbct->data;
224
  $out['cron'] = $apbct->cron;
225
  $out['errors'] = $apbct->errors;
226
+ $out['debug'] = $apbct->debug;
227
  $out['queue'] = get_option('cleantalk_sfw_update_queue');
228
  $out['servers_connection'] = apbct_test_connection();
229
 
230
+ if ( APBCT_WPMS ) {
231
  $out['network_settings'] = $apbct->network_settings;
232
  $out['network_data'] = $apbct->network_data;
233
  }
234
 
235
+ if ( Request::equal('out', 'json') ) {
236
  die(json_encode($out));
237
  }
238
  array_walk($out, function (&$val, $_key) {
240
  });
241
 
242
  array_walk_recursive($out, function (&$val, $_key) {
243
+ if ( is_int($val) && preg_match('@^\d{9,11}$@', (string)$val) ) {
244
  $val = date('Y-m-d H:i:s', $val);
245
  }
246
  });
266
  Request::get('period') &&
267
  Request::get('first_call')
268
  ) {
269
+ $cron = new Cron();
270
  $update_result = $cron->updateTask(
271
  Request::get('task'),
272
  Request::get('handler'),
277
 
278
  die($update_result ? 'OK' : 'FAIL');
279
  }
280
+
281
+ public static function action__post_api_key() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
282
+ {
283
+ global $apbct;
284
+
285
+ if ( ! headers_sent() ) {
286
+ header("Content-Type: application/json");
287
+ }
288
+
289
+ $key = trim(Request::get('api_key'));
290
+ if ( ! apbct_api_key__is_correct($key) ) {
291
+ die(json_encode(['FAIL' => ['error' => 'Api key is incorrect']]));
292
+ }
293
+
294
+ require_once APBCT_DIR_PATH . 'inc/cleantalk-settings.php';
295
+
296
+ $template_id = Request::get('apply_template_id');
297
+ if ( ! empty($template_id) ) {
298
+ $templates = CleantalkSettingsTemplates::getOptionsTemplate($key);
299
+ if ( ! empty($templates) ) {
300
+ foreach ( $templates as $template ) {
301
+ if ( $template['template_id'] == $template_id && ! empty($template['options_site']) ) {
302
+ $template_name = $template['template_id'];
303
+ $settings = $template['options_site'];
304
+ $settings = array_replace((array)$apbct->settings, json_decode($settings, true));
305
+
306
+ $settings = \apbct_settings__validate($settings);
307
+
308
+ $apbct->settings = $settings;
309
+ $apbct->save('settings');
310
+ $apbct->data['current_settings_template_id'] = $template_id;
311
+ $apbct->data['current_settings_template_name'] = $template_name;
312
+ $apbct->save('data');
313
+ break;
314
+ }
315
+ }
316
+ }
317
+ }
318
+
319
+ $apbct->storage['settings']['apikey'] = $key;
320
+ $apbct->api_key = $key;
321
+ $apbct->key_is_ok = true;
322
+ $apbct->save('settings');
323
+
324
+ \apbct_settings__sync(true);
325
+
326
+ die(json_encode(['OK' => ['template_id' => $template_id]]));
327
+ }
328
  }
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -259,7 +259,6 @@ class State extends \Cleantalk\Common\State
259
  // Installation
260
  'install_plugin' => array('last_call' => 0, 'cooldown' => 0),
261
  'activate_plugin' => array('last_call' => 0, 'cooldown' => 0),
262
- 'insert_auth_key' => array('last_call' => 0, 'cooldown' => 0),
263
  'deactivate_plugin' => array('last_call' => 0, 'cooldown' => 0),
264
  'uninstall_plugin' => array('last_call' => 0, 'cooldown' => 0),
265
 
@@ -269,6 +268,9 @@ class State extends \Cleantalk\Common\State
269
 
270
  // cron update
271
  'cron_update_task' => array('last_call' => 0),
 
 
 
272
  );
273
 
274
  public $def_stats = array(
259
  // Installation
260
  'install_plugin' => array('last_call' => 0, 'cooldown' => 0),
261
  'activate_plugin' => array('last_call' => 0, 'cooldown' => 0),
 
262
  'deactivate_plugin' => array('last_call' => 0, 'cooldown' => 0),
263
  'uninstall_plugin' => array('last_call' => 0, 'cooldown' => 0),
264
 
268
 
269
  // cron update
270
  'cron_update_task' => array('last_call' => 0),
271
+
272
+ // Insert api key (RC without token)
273
+ 'post_api_key' => array('last_call' => 0,),
274
  );
275
 
276
  public $def_stats = array(
lib/Cleantalk/Common/HTTP/Request.php CHANGED
@@ -417,8 +417,8 @@ class Request
417
  $this->options = array_replace(
418
  array(
419
  CURLOPT_URL => ! is_array($this->url) ? $this->url : null,
420
- CURLOPT_TIMEOUT => 10,
421
- CURLOPT_LOW_SPEED_TIME => 7,
422
  CURLOPT_RETURNTRANSFER => true,
423
  CURLOPT_CONNECTTIMEOUT => 5000,
424
  CURLOPT_FORBID_REUSE => true,
417
  $this->options = array_replace(
418
  array(
419
  CURLOPT_URL => ! is_array($this->url) ? $this->url : null,
420
+ CURLOPT_TIMEOUT => 50,
421
+ CURLOPT_LOW_SPEED_TIME => 25,
422
  CURLOPT_RETURNTRANSFER => true,
423
  CURLOPT_CONNECTTIMEOUT => 5000,
424
  CURLOPT_FORBID_REUSE => true,
readme.txt CHANGED
@@ -602,6 +602,26 @@ If your website has forms that send data to external sources, you can enable opt
602
 
603
  == Changelog ==
604
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
  = 5.179.1 Jun 21 2022 =
606
  #### General contact form catching fixed
607
  * Revert "Integration before common aa (#129)"
602
 
603
  == Changelog ==
604
 
605
+ = 5.180 Jun 30 2022 =
606
+ #### Getting api key from the CleanTalk Dashboard implemented, SFW updating improved, code quality improved and some minor issues fixed.
607
+ * New. API key length extended to 30 symbols.
608
+ * New. Remote call. RC post_api_key implemented.
609
+ * New: Option 'cleantalk_debug' now outputs in 'debug' remote call.
610
+ * Upd. SFW. Direct update during fallback.
611
+ * Fix. Honeypot fields for search. Search forms with GET method now handles correct.
612
+ * Fix. Ajax. Prevent JS errors on ajax general contact forms.
613
+ * Fix. apbct_need_to_process_unknown_post_request() Add Divi themes exclusion to proceed them to contact_form_validate().
614
+ * Fix. General contact form catching fixed.
615
+ * Fix. cleantalk-pluggable.php. Skip service requests of enable-jquery-migrate-helper
616
+ * Added notice_review banner
617
+ * Fix. cleantalk_external.js. Exclude mewtwo flight forms.
618
+ * Fix. Code. Compressing JS gulp task updated.
619
+ * Fix. Request.php. Extend CURL timeout and low-speed detection limit.
620
+ * Fix. Cleantalk.php. Exclude timestamp refreshing via template_rediret hook for alternative cookies mode.
621
+ * Fix. External forms JS error fixed.
622
+ * Fix. cleantalk-public-integrations.php-> apbct_form_search__add_fields(). Force to run pregmatch search if DOM content is broken.
623
+ * Fix. Honeypot. Styles moved to the separated file.
624
+
625
  = 5.179.1 Jun 21 2022 =
626
  #### General contact form catching fixed
627
  * Revert "Integration before common aa (#129)"