Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.181

Version Description

Jul 14 2022 =

One integration added, SFW testing page updated, code quality improved and some minor issues fixed.

  • New. Integrations. WP User Meta integration.
  • Upd. SFW. Testing page updated.
  • Fix. WP discuzz integration. Check for spam if comment is edited.
  • Fix. WP discuzz integration. Remove unnecessary data when check on comment edition.
  • Fix. Admin banner. Security attention mark fixed.
  • Fix. Code. Sanitizing incoming data.
  • Fix. CSS. Fix stylesheet source name and minifed name.
  • Fix. apcbt-public-bundle. New detection method for mailerlite classes to prevent default submit clicks.
  • Fix. HTTP lib. Multi request error handling fixed.
  • Fix: setting page JS key validating.
  • Fix: Replace array_* function implemented on State properties.
  • Mod: ApbctWP/State to use the direct equation on properties.
  • Fix. Integrations. WPUserMeta. Added case of user-meta-pro
Download this release

Release Info

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

Code changes from version 5.180.2 to 5.181

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.180.2
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -310,7 +310,7 @@ $apbct_active_integrations = array(
310
  'ajax' => false
311
  ),
312
  'Wpdiscuz' => array(
313
- 'hook' => array('wpdAddComment', 'wpdAddInlineComment'),
314
  'setting' => 'forms__comments_test',
315
  'ajax' => true
316
  ),
@@ -363,6 +363,11 @@ $apbct_active_integrations = array(
363
  'setting' => 'forms__registrations_test',
364
  'ajax' => false
365
  ),
 
 
 
 
 
366
  );
367
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
368
 
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.181
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
310
  'ajax' => false
311
  ),
312
  'Wpdiscuz' => array(
313
+ 'hook' => array('wpdAddComment', 'wpdAddInlineComment', 'wpdSaveEditedComment'),
314
  'setting' => 'forms__comments_test',
315
  'ajax' => true
316
  ),
363
  'setting' => 'forms__registrations_test',
364
  'ajax' => false
365
  ),
366
+ 'WPUserMeta' => array(
367
+ 'hook' => 'user_meta_pre_user_register',
368
+ 'setting' => 'forms__registrations_test',
369
+ 'ajax' => false
370
+ ),
371
  );
372
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
373
 
css/cleantalk-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
@@ -58,7 +58,7 @@ function apbct_add_buttons_to_comments_and_users($_unused_argument)
58
  }
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>
@@ -171,19 +171,19 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
171
  foreach ( $apbct->brief_data['top5_spam_ip'] as $val ) { ?>
172
  <tr>
173
  <td><?php
174
- echo $val[0]; ?></td>
175
 
176
  <td class="ct_widget_block__country_cell">
177
  <?php
178
- echo $val[1] ? "<img src='" . APBCT_URL_PATH . "/inc/images/flags/" . strtolower(
179
- isset($val[1]['country_code']) ? $val[1]['country_code'] : 'a1'
180
  ) . ".png'>" : ''; ?>
181
  <?php
182
- echo isset($val[1]['country_name']) ? $val[1]['country_name'] : 'Unknown'; ?>
183
  </td>
184
 
185
  <td style='text-align: center;'><?php
186
- echo $val[2]; ?></td>
187
  </tr>
188
  <?php
189
  } ?>
@@ -191,7 +191,7 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
191
  <?php
192
  if ( $apbct->user_token ) { ?>
193
  <a target='_blank' href='https://cleantalk.org/my?user_token=<?php
194
- echo $apbct->user_token; ?>&cp_mode=antispam'>
195
  <input class='ct_widget_button' id='ct_widget_button_view_all' type='button' value='View all'>
196
  </a>
197
  <?php
@@ -591,14 +591,28 @@ function apbct_admin__badge__get_premium($print = true, $out = '')
591
  . ($print ? __('Make it right!', 'cleantalk-spam-protect') . ' ' : '')
592
  . sprintf(
593
  __('%sGet premium%s', 'cleantalk-spam-protect'),
594
- '<a href="https://cleantalk.org/my/bill/recharge?user_token=' . $apbct->user_token . '" target="_blank">',
595
  '</a>'
596
  )
597
  . '</b>';
598
  }
599
 
600
  if ( $print ) {
601
- echo $out;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  } else {
603
  return $out;
604
  }
@@ -661,6 +675,9 @@ function apbct_admin__admin_bar__add_structure($wp_admin_bar)
661
  'security-malware-firewall'
662
  ) . '</a></span>'
663
  : '<a>' . __('Security', 'security-malware-firewall') . '</a>';
 
 
 
664
  }
665
 
666
  if ( isset($spbc_title) &&
@@ -1112,9 +1129,7 @@ function apbct_comment__send_feedback(
1112
  }
1113
 
1114
  if ( ! $direct_call ) {
1115
- echo ! empty($result) ? $result : 0;
1116
- die();
1117
- } else {
1118
  }
1119
  }
1120
 
@@ -1150,8 +1165,7 @@ function apbct_user__send_feedback($user_id = null, $status = null, $direct_call
1150
  }
1151
 
1152
  if ( ! $direct_call ) {
1153
- echo ! empty($result) ? $result : 0;
1154
- die();
1155
  }
1156
  }
1157
 
58
  }
59
 
60
  echo '
61
+ <a href="' . Escape::escAttr($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>
171
  foreach ( $apbct->brief_data['top5_spam_ip'] as $val ) { ?>
172
  <tr>
173
  <td><?php
174
+ echo Escape::escHtml($val[0]); ?></td>
175
 
176
  <td class="ct_widget_block__country_cell">
177
  <?php
178
+ echo $val[1] ? "<img src='" . Escape::escHtml(APBCT_URL_PATH) . "/inc/images/flags/" . strtolower(
179
+ isset($val[1]['country_code']) ? Escape::escHtml($val[1]['country_code']) : 'a1'
180
  ) . ".png'>" : ''; ?>
181
  <?php
182
+ echo isset($val[1]['country_name']) ? Escape::escHtml($val[1]['country_name']) : 'Unknown'; ?>
183
  </td>
184
 
185
  <td style='text-align: center;'><?php
186
+ echo Escape::escHtml($val[2]); ?></td>
187
  </tr>
188
  <?php
189
  } ?>
191
  <?php
192
  if ( $apbct->user_token ) { ?>
193
  <a target='_blank' href='https://cleantalk.org/my?user_token=<?php
194
+ echo Escape::escHtml($apbct->user_token); ?>&cp_mode=antispam'>
195
  <input class='ct_widget_button' id='ct_widget_button_view_all' type='button' value='View all'>
196
  </a>
197
  <?php
591
  . ($print ? __('Make it right!', 'cleantalk-spam-protect') . ' ' : '')
592
  . sprintf(
593
  __('%sGet premium%s', 'cleantalk-spam-protect'),
594
+ '<a href="https://cleantalk.org/my/bill/recharge?user_token=' . Escape::escHtml($apbct->user_token) . '" target="_blank">',
595
  '</a>'
596
  )
597
  . '</b>';
598
  }
599
 
600
  if ( $print ) {
601
+ echo wp_kses(
602
+ $out,
603
+ array(
604
+ 'a' => array(
605
+ 'href' => true,
606
+ 'title' => true,
607
+ '_target' => true,
608
+ ),
609
+ 'br' => array(),
610
+ 'p' => array(),
611
+ 'b' => array(
612
+ 'style' => true,
613
+ ),
614
+ )
615
+ );
616
  } else {
617
  return $out;
618
  }
675
  'security-malware-firewall'
676
  ) . '</a></span>'
677
  : '<a>' . __('Security', 'security-malware-firewall') . '</a>';
678
+
679
+ $spbc_attention_mark = $spbc->notice_show ? '<i class="spbc-icon-attention-alt ctlk---red"></i>' : '';
680
+ $spbc_title .= $spbc_attention_mark;
681
  }
682
 
683
  if ( isset($spbc_title) &&
1129
  }
1130
 
1131
  if ( ! $direct_call ) {
1132
+ ! empty($result) ? die($result) : die(0);
 
 
1133
  }
1134
  }
1135
 
1165
  }
1166
 
1167
  if ( ! $direct_call ) {
1168
+ ! empty($result) ? die($result) : die(0);
 
1169
  }
1170
  }
1171
 
inc/cleantalk-ajax.php CHANGED
@@ -401,7 +401,9 @@ function ct_ajax_hook($message_obj = null)
401
  'alhbrmeu',
402
  // Ninja Forms
403
  'nf_preview_update',
404
- 'nf_save_form'
 
 
405
  );
406
 
407
  global $apbct;
401
  'alhbrmeu',
402
  // Ninja Forms
403
  'nf_preview_update',
404
+ 'nf_save_form',
405
+ // WPUserMeta registration plugin exclusion
406
+ 'pf_ajax_request'
407
  );
408
 
409
  global $apbct;
inc/cleantalk-common.php CHANGED
@@ -139,7 +139,7 @@ function apbct_base_call($params = array(), $reg_flag = false)
139
 
140
  // Skip duplicate requests
141
  if (
142
- key_exists($apbct->plugin_request_id, $apbct->plugin_request_ids) &&
143
  current_filter() !== 'woocommerce_registration_errors' && // Prevent skip checking woocommerce registration during checkout
144
  current_filter() !== 'um_submit_form_register' // Prevent skip checking UltimateMember register
145
  ) {
@@ -148,7 +148,7 @@ function apbct_base_call($params = array(), $reg_flag = false)
148
  return array('ct_result' => new CleantalkResponse());
149
  }
150
 
151
- $apbct->plugin_request_ids = array_merge($apbct->plugin_request_ids, array($apbct->plugin_request_id => time()));
152
  $apbct->save('plugin_request_ids');
153
  /* End of Request ID rotation */
154
 
@@ -953,7 +953,7 @@ function ct_delete_spam_comments()
953
  /**
954
  * Get data from an ARRAY recursively
955
  *
956
- * @param $arr
957
  * @param array $message
958
  * @param null|string $email
959
  * @param array $nickname
139
 
140
  // Skip duplicate requests
141
  if (
142
+ isset($apbct->plugin_request_ids[ $apbct->plugin_request_id ]) &&
143
  current_filter() !== 'woocommerce_registration_errors' && // Prevent skip checking woocommerce registration during checkout
144
  current_filter() !== 'um_submit_form_register' // Prevent skip checking UltimateMember register
145
  ) {
148
  return array('ct_result' => new CleantalkResponse());
149
  }
150
 
151
+ $apbct->plugin_request_ids[ $apbct->plugin_request_id ] = time();
152
  $apbct->save('plugin_request_ids');
153
  /* End of Request ID rotation */
154
 
953
  /**
954
  * Get data from an ARRAY recursively
955
  *
956
+ * @param array $arr
957
  * @param array $message
958
  * @param null|string $email
959
  * @param array $nickname
inc/cleantalk-public-integrations.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\Helper;
 
4
  use Cleantalk\ApbctWP\State;
5
  use Cleantalk\ApbctWP\Variables\Cookie;
6
  use Cleantalk\Variables\Get;
@@ -67,7 +68,7 @@ function ct_validate_ccf_submission($value, $_field_id, $_required)
67
 
68
  //If it's the last field of the form
69
  (! isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
70
- $form_id = $_POST['form_id'];
71
  if ( $ct_global_temporary_data['count'] != count(get_post_meta($form_id, 'ccf_attached_fields', true)) ) {
72
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
73
 
@@ -98,7 +99,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(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,7 +152,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(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
155
 
156
  //Making a call
157
  $base_call_result = apbct_base_call(
@@ -348,7 +349,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(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,7 +486,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(Cookie::get('ct_checkjs'), true),
489
  'sender_info' => array('sender_url' => null)
490
  );
491
 
@@ -543,17 +544,17 @@ function apbct_wc__add_to_cart_unlogged_user(
543
  * [quantity] => 1
544
  *)
545
  */
546
- $message = $_POST ?: array();
547
 
548
  $post_info['comment_type'] = 'order__add_to_cart';
549
- $post_info['post_url'] = Server::get('HTTP_REFERER');
550
 
551
  //Making a call
552
  $base_call_result = apbct_base_call(
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,7 +615,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(Cookie::get('ct_checkjs'), true),
618
  'sender_info' => array('sender_url' => null),
619
  )
620
  );
@@ -727,7 +728,7 @@ function apbct_form__formidable__testSpam($errors, $_form)
727
  /**
728
  * Filter for POST
729
  */
730
- $input_array = apply_filters('apbct__filter_post', $_POST['item_meta']);
731
 
732
  $form_data = array();
733
  foreach ( $input_array as $key => $value ) {
@@ -764,7 +765,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(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
768
 
769
  $base_call_result = apbct_base_call(
770
  array(
@@ -810,11 +811,8 @@ function apbct__formidable_get_key_field_for_ajax_response($_form = array())
810
  {
811
  $key_field = '113';
812
 
813
- if (
814
- isset($_POST['item_meta']) &&
815
- is_array($_POST['item_meta'])
816
- ) {
817
- $key_field = array_keys($_POST['item_meta'])[1];
818
  } elseif (is_array($_form) && isset($_form['item_meta'])) {
819
  foreach ($_form['item_meta'] as $key => $value) {
820
  if ($value) {
@@ -869,7 +867,7 @@ function ct_bbp_new_pre_content($comment)
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();
@@ -878,8 +876,8 @@ function ct_bbp_new_pre_content($comment)
878
  $sender_email = $current_user->user_email;
879
  $sender_nickname = $current_user->display_name;
880
  } else {
881
- $sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
882
- $sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
883
  }
884
 
885
  $base_call_result = apbct_base_call(
@@ -889,7 +887,7 @@ function ct_bbp_new_pre_content($comment)
889
  'sender_nickname' => $sender_nickname,
890
  'post_info' => $post_info,
891
  'js_on' => $checkjs,
892
- 'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
893
  )
894
  );
895
  $ct_result = $base_call_result['ct_result'];
@@ -1057,7 +1055,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(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
1061
 
1062
  $example = null;
1063
  if ( $apbct->data['relevance_test'] ) {
@@ -1119,7 +1117,7 @@ function ct_preprocess_comment($comment)
1119
  ) {
1120
  $honeypot_field = 0;
1121
  // if url is filled then pass them to $base_call_data as additional fields
1122
- $base_call_data['sender_info']['honeypot_field_value'] = Post::get('url');
1123
  $base_call_data['sender_info']['honeypot_field_source'] = 'url';
1124
  }
1125
 
@@ -1312,8 +1310,8 @@ function ct_login_message($message)
1312
  */
1313
  function ct_registration_errors_ppress($reg_errors, $_form_id)
1314
  {
1315
- $email = $_POST['reg_email'];
1316
- $login = $_POST['reg_username'];
1317
 
1318
  $reg_errors = ct_registration_errors($reg_errors, $login, $email);
1319
 
@@ -1380,7 +1378,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(Cookie::get('ct_checkjs'), true),
1384
  )
1385
  );
1386
 
@@ -1401,10 +1399,10 @@ function ct_test_registration($nickname, $email, $ip = null)
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
 
@@ -1467,23 +1465,23 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1467
 
1468
  $facebook = false;
1469
  // Facebook registration
1470
- if ( $sanitized_user_login === null && isset($_POST['FB_userdata']) ) {
1471
- $sanitized_user_login = $_POST['FB_userdata']['name'];
1472
  $facebook = true;
1473
  }
1474
- if ( $user_email === null && isset($_POST['FB_userdata']) ) {
1475
- $user_email = $_POST['FB_userdata']['email'];
1476
  $facebook = true;
1477
  }
1478
 
1479
  // BuddyPress actions
1480
  $buddypress = false;
1481
- if ( $sanitized_user_login === null && isset($_POST['signup_username']) ) {
1482
- $sanitized_user_login = $_POST['signup_username'];
1483
  $buddypress = true;
1484
  }
1485
- if ( $user_email === null && isset($_POST['signup_email']) ) {
1486
- $user_email = $_POST['signup_email'];
1487
  $buddypress = true;
1488
  }
1489
 
@@ -1503,8 +1501,8 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
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
 
@@ -1541,7 +1539,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1541
  $fields_numbers_to_check = explode(',', Post::get('signup_profile_field_ids'));
1542
  foreach ( $fields_numbers_to_check as $field_number ) {
1543
  $field_name = 'field_' . $field_number;
1544
- $field_value = Post::get($field_name) ? Post::get($field_name) : '';
1545
  $field_values .= $field_value . "\n";
1546
  }
1547
  $base_call_array['message'] = $field_values;
@@ -1682,7 +1680,7 @@ function apbct_registration__UltimateMembers__check($args)
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
 
@@ -1807,13 +1805,6 @@ function ct_contact_form_is_spam($form)
1807
  return null;
1808
  }
1809
 
1810
- $js_field_name = $ct_checkjs_jpcf;
1811
- foreach ( $_POST as $k => $_v ) {
1812
- if ( preg_match("/^.+$ct_checkjs_jpcf$/", $k) ) {
1813
- $js_field_name = $k;
1814
- }
1815
- }
1816
-
1817
  $sender_email = null;
1818
  $sender_nickname = null;
1819
  $message = '';
@@ -1836,7 +1827,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(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get($ct_checkjs_jpcf)),
1840
 
1841
  )
1842
  );
@@ -1875,7 +1866,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(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get($ct_checkjs_jpcf)),
1879
  )
1880
  );
1881
  $ct_result = $base_call_result['ct_result'];
@@ -1959,7 +1950,7 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null)
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
  */
@@ -2429,7 +2420,7 @@ function apbct_form__WPForms__testSpam()
2429
  return;
2430
  }
2431
 
2432
- $checkjs = apbct_js_test(Post::get('ct_checkjs_wpforms'));
2433
 
2434
  $email = $apbct->form_data['email'] ?: null;
2435
 
@@ -2450,7 +2441,7 @@ function apbct_form__WPForms__testSpam()
2450
  unset($form_data['name']);
2451
  }
2452
 
2453
- $params = ct_get_fields_any($apbct->form_data, $email, $nickname);
2454
 
2455
  if ( is_array($params['nickname']) ) {
2456
  $params['nickname'] = implode(' ', $params['nickname']);
@@ -2550,10 +2541,9 @@ function ct_quform_post_validate($result, $form)
2550
  $input_array = apply_filters('apbct__filter_post', $form->getValues());
2551
 
2552
  $ct_temp_msg_data = ct_get_fields_any($input_array);
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,7 +2624,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(Post::get('ct_checkjs')),
2638
  )
2639
  );
2640
 
@@ -2705,10 +2695,10 @@ function ct_check_wplp()
2705
  if ( array_key_exists('form_input_values', $_POST) ) {
2706
  $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
2707
  if ( is_array($form_input_values) && array_key_exists('null', $form_input_values) ) {
2708
- $message = $form_input_values['null'];
2709
  }
2710
- } elseif ( array_key_exists('null', $_POST) ) {
2711
- $message = $_POST['null'];
2712
  }
2713
 
2714
  $base_call_result = apbct_base_call(
@@ -2730,7 +2720,7 @@ function ct_check_wplp()
2730
  Cookie::set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
2731
  } else {
2732
  // Next POST/AJAX submit(s) of same WPLP form
2733
- $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
2734
  }
2735
  if ( $cleantalk_comment !== 'OK' ) {
2736
  ct_die_extended($cleantalk_comment);
@@ -2880,7 +2870,7 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
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(
@@ -2952,8 +2942,8 @@ function ct_s2member_registration_test($post_key)
2952
  return null;
2953
  }
2954
 
2955
- $sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
2956
- $sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
2957
 
2958
  //Making a call
2959
  $base_call_result = apbct_base_call(
@@ -3105,7 +3095,7 @@ function apbct_form__inevio__testSpam()
3105
  return false;
3106
  }
3107
  $form_data = array();
3108
- parse_str($_POST['data'], $form_data);
3109
 
3110
  $name = isset($form_data['name']) ? $form_data['name'] : '';
3111
  $email = isset($form_data['email']) ? $form_data['email'] : '';
@@ -3285,7 +3275,7 @@ function apbct_custom_forms_trappings()
3285
  global $apbct;
3286
 
3287
  // Registration form of Wishlist Members plugin
3288
- if ( $apbct->settings['forms__registrations_test'] && isset($_POST['action']) && $_POST['action'] === 'wpm_register' ) {
3289
  return true;
3290
  }
3291
 
@@ -3479,7 +3469,7 @@ function apbct_advanced_classifieds_directory_pro__check_register($response, $_f
3479
  Post::get('username') &&
3480
  Post::get('email')
3481
  ) {
3482
- $data = ct_get_fields_any($_POST, Post::get('email'));
3483
 
3484
  $base_call_result = apbct_base_call(
3485
  array(
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\Helper;
4
+ use Cleantalk\ApbctWP\Sanitize;
5
  use Cleantalk\ApbctWP\State;
6
  use Cleantalk\ApbctWP\Variables\Cookie;
7
  use Cleantalk\Variables\Get;
68
 
69
  //If it's the last field of the form
70
  (! isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
71
+ $form_id = Sanitize::cleanInt(Post::get('form_id'));
72
  if ( $ct_global_temporary_data['count'] != count(get_post_meta($form_id, 'ccf_attached_fields', true)) ) {
73
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
74
 
99
  $post_info['comment_type'] = 'feedback_custom_contact_forms';
100
  $post_info['post_url'] = apbct_get_server_variable('HTTP_REFERER');
101
 
102
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs')));
103
 
104
  //Making a call
105
  $base_call_result = apbct_base_call(
152
  $post_info['comment_type'] = 'feedback';
153
  $post_info['post_url'] = apbct_get_server_variable('HTTP_REFERER');
154
 
155
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs')));
156
 
157
  //Making a call
158
  $base_call_result = apbct_base_call(
349
  'comment_type' => 'buddypress_comment',
350
  'post_url' => apbct_get_server_variable('HTTP_REFERER'),
351
  ),
352
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs'))),
353
  'sender_info' => array('sender_url' => null),
354
  'exception_action' => $exception_action === true ? 1 : null
355
  )
486
  'sender_email' => $sender_email,
487
  'sender_nickname' => $sender_nickname,
488
  'post_info' => $post_info,
489
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true),
490
  'sender_info' => array('sender_url' => null)
491
  );
492
 
544
  * [quantity] => 1
545
  *)
546
  */
547
+ $message = apply_filters('apbct__filter_post', $_POST);
548
 
549
  $post_info['comment_type'] = 'order__add_to_cart';
550
+ $post_info['post_url'] = Sanitize::cleanUrl(Server::get('HTTP_REFERER'));
551
 
552
  //Making a call
553
  $base_call_result = apbct_base_call(
554
  array(
555
  'message' => $message,
556
  'post_info' => $post_info,
557
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true),
558
  'sender_info' => array('sender_url' => null),
559
  )
560
  );
615
  'sender_email' => $sender_email,
616
  'sender_nickname' => $sender_nickname,
617
  'post_info' => $post_info,
618
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true),
619
  'sender_info' => array('sender_url' => null),
620
  )
621
  );
728
  /**
729
  * Filter for POST
730
  */
731
+ $input_array = apply_filters('apbct__filter_post', Post::get('item_meta'));
732
 
733
  $form_data = array();
734
  foreach ( $input_array as $key => $value ) {
765
  // Combine it with non-scalar values
766
  $message = array_merge($tmp_message, $tmp_message2);
767
 
768
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs')));
769
 
770
  $base_call_result = apbct_base_call(
771
  array(
811
  {
812
  $key_field = '113';
813
 
814
+ if ( is_array(Post::get('item_meta')) ) {
815
+ $key_field = array_keys(Post::get('item_meta'))[1];
 
 
 
816
  } elseif (is_array($_form) && isset($_form['item_meta'])) {
817
  foreach ($_form['item_meta'] as $key => $value) {
818
  if ($value) {
867
  return $comment;
868
  }
869
 
870
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs')));
871
 
872
  $post_info['comment_type'] = 'bbpress_comment';
873
  $post_info['post_url'] = bbp_get_topic_permalink();
876
  $sender_email = $current_user->user_email;
877
  $sender_nickname = $current_user->display_name;
878
  } else {
879
+ $sender_email = Sanitize::cleanEmail(Post::get('bbp_anonymous_email'));
880
+ $sender_nickname = Sanitize::cleanUser(Post::get('bbp_anonymous_name'));
881
  }
882
 
883
  $base_call_result = apbct_base_call(
887
  'sender_nickname' => $sender_nickname,
888
  'post_info' => $post_info,
889
  'js_on' => $checkjs,
890
+ 'sender_info' => array('sender_url' => Sanitize::cleanUrl(Post::get('bbp_anonymous_website'))),
891
  )
892
  );
893
  $ct_result = $base_call_result['ct_result'];
1055
  // Comment type
1056
  $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1057
 
1058
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs')));
1059
 
1060
  $example = null;
1061
  if ( $apbct->data['relevance_test'] ) {
1117
  ) {
1118
  $honeypot_field = 0;
1119
  // if url is filled then pass them to $base_call_data as additional fields
1120
+ $base_call_data['sender_info']['honeypot_field_value'] = Sanitize::cleanTextField(Post::get('url'));
1121
  $base_call_data['sender_info']['honeypot_field_source'] = 'url';
1122
  }
1123
 
1310
  */
1311
  function ct_registration_errors_ppress($reg_errors, $_form_id)
1312
  {
1313
+ $email = Sanitize::cleanEmail(Post::get('reg_email'));
1314
+ $login = Sanitize::cleanUser(Post::get('reg_username'));
1315
 
1316
  $reg_errors = ct_registration_errors($reg_errors, $login, $email);
1317
 
1378
  'sender_email' => $email,
1379
  'sender_nickname' => $nickname,
1380
  'post_info' => array('comment_type' => 'feedback_plugin_check'),
1381
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true),
1382
  )
1383
  );
1384
 
1399
  global $ct_checkjs_register_form;
1400
 
1401
  if ( apbct_js_test(Post::get($ct_checkjs_register_form)) ) {
1402
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Post::get($ct_checkjs_register_form)));
1403
  $sender_info['post_checkjs_passed'] = $checkjs;
1404
  } else {
1405
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
1406
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1407
  }
1408
 
1465
 
1466
  $facebook = false;
1467
  // Facebook registration
1468
+ if ( $sanitized_user_login === null && Post::get('FB_userdata') ) {
1469
+ $sanitized_user_login = Sanitize::cleanUser(Post::get('FB_userdata')['name']);
1470
  $facebook = true;
1471
  }
1472
+ if ( $user_email === null && Post::get('FB_userdata') ) {
1473
+ $user_email = Sanitize::cleanEmail(Post::get('FB_userdata')['email']);
1474
  $facebook = true;
1475
  }
1476
 
1477
  // BuddyPress actions
1478
  $buddypress = false;
1479
+ if ( $sanitized_user_login === null && Post::get('signup_username') ) {
1480
+ $sanitized_user_login = Sanitize::cleanUser(Post::get('signup_username'));
1481
  $buddypress = true;
1482
  }
1483
+ if ( $user_email === null && Post::get('signup_email') ) {
1484
+ $user_email = Sanitize::cleanEmail(Post::get('signup_email'));
1485
  $buddypress = true;
1486
  }
1487
 
1501
  $checkjs_cookie = $checkjs;
1502
  } else {
1503
  // This hack can be helpful when plugin uses with untested themes&signups plugins.
1504
+ $checkjs_post = apbct_js_test(Sanitize::cleanTextField(Post::get($ct_checkjs_register_form)));
1505
+ $checkjs_cookie = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
1506
  $checkjs = $checkjs_cookie ?: $checkjs_post;
1507
  }
1508
 
1539
  $fields_numbers_to_check = explode(',', Post::get('signup_profile_field_ids'));
1540
  foreach ( $fields_numbers_to_check as $field_number ) {
1541
  $field_name = 'field_' . $field_number;
1542
+ $field_value = Post::get($field_name) ? Sanitize::cleanTextareaField(Post::get($field_name)) : '';
1543
  $field_values .= $field_value . "\n";
1544
  }
1545
  $base_call_array['message'] = $field_values;
1680
 
1681
  // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1682
  if ( $checkjs == 0 ) {
1683
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
1684
  $sender_info['cookie_checkjs_passed'] = $checkjs;
1685
  }
1686
 
1805
  return null;
1806
  }
1807
 
 
 
 
 
 
 
 
1808
  $sender_email = null;
1809
  $sender_nickname = null;
1810
  $message = '';
1827
  'sender_nickname' => $sender_nickname,
1828
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1829
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1830
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get($ct_checkjs_jpcf))),
1831
 
1832
  )
1833
  );
1866
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1867
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1868
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1869
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get($ct_checkjs_jpcf))),
1870
  )
1871
  );
1872
  $ct_result = $base_call_result['ct_result'];
1950
  return $spam;
1951
  }
1952
 
1953
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get($ct_checkjs_cf7)));
1954
  /**
1955
  * Filter for POST
1956
  */
2420
  return;
2421
  }
2422
 
2423
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs_wpforms')));
2424
 
2425
  $email = $apbct->form_data['email'] ?: null;
2426
 
2441
  unset($form_data['name']);
2442
  }
2443
 
2444
+ $params = ct_get_fields_any((array)$apbct->form_data, $email, $nickname);
2445
 
2446
  if ( is_array($params['nickname']) ) {
2447
  $params['nickname'] = implode(' ', $params['nickname']);
2541
  $input_array = apply_filters('apbct__filter_post', $form->getValues());
2542
 
2543
  $ct_temp_msg_data = ct_get_fields_any($input_array);
 
2544
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2545
 
2546
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
2547
  $base_call_result = apbct_base_call(
2548
  array(
2549
  'message' => $form->getValues(),
2624
  'sender_email' => $sender_email,
2625
  'sender_nickname' => $sender_nickname,
2626
  'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2627
+ 'js_on' => apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs'))),
2628
  )
2629
  );
2630
 
2695
  if ( array_key_exists('form_input_values', $_POST) ) {
2696
  $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
2697
  if ( is_array($form_input_values) && array_key_exists('null', $form_input_values) ) {
2698
+ $message = Sanitize::cleanTextareaField($form_input_values['null']);
2699
  }
2700
+ } elseif ( Post::get('null') ) {
2701
+ $message = Sanitize::cleanTextareaField(Post::get('null'));
2702
  }
2703
 
2704
  $base_call_result = apbct_base_call(
2720
  Cookie::set($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
2721
  } else {
2722
  // Next POST/AJAX submit(s) of same WPLP form
2723
+ $cleantalk_comment = Sanitize::cleanTextField(Cookie::get($ct_wplp_result_label));
2724
  }
2725
  if ( $cleantalk_comment !== 'OK' ) {
2726
  ct_die_extended($cleantalk_comment);
2870
  $message['subject'] = $subject;
2871
  }
2872
 
2873
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs'))) ?: apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
2874
 
2875
  $base_call_result = apbct_base_call(
2876
  array(
2942
  return null;
2943
  }
2944
 
2945
+ $sender_email = Sanitize::cleanEmail(Post::get($post_key)['email']);
2946
+ $sender_nickname = Sanitize::cleanUser(Post::get($post_key)['username']);
2947
 
2948
  //Making a call
2949
  $base_call_result = apbct_base_call(
3095
  return false;
3096
  }
3097
  $form_data = array();
3098
+ parse_str(Post::get('data'), $form_data);
3099
 
3100
  $name = isset($form_data['name']) ? $form_data['name'] : '';
3101
  $email = isset($form_data['email']) ? $form_data['email'] : '';
3275
  global $apbct;
3276
 
3277
  // Registration form of Wishlist Members plugin
3278
+ if ( $apbct->settings['forms__registrations_test'] && Post::get('action') === 'wpm_register' ) {
3279
  return true;
3280
  }
3281
 
3469
  Post::get('username') &&
3470
  Post::get('email')
3471
  ) {
3472
+ $data = ct_get_fields_any($_POST, Sanitize::cleanEmail(Post::get('email')));
3473
 
3474
  $base_call_result = apbct_base_call(
3475
  array(
inc/cleantalk-public-validate.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  use Cleantalk\ApbctWP\Variables\Cookie;
4
  use Cleantalk\Variables\Post;
5
  use Cleantalk\Variables\Server;
@@ -97,7 +98,7 @@ function ct_contact_form_validate()
97
  isset($_POST['wpforms_id'], $_POST['wpforms_author']) || //Skip wpforms
98
  (isset($_POST['somfrp_action'], $_POST['submitted']) && $_POST['somfrp_action'] == 'somfrp_lost_pass') || // Frontend Reset Password exclusion
99
  (isset($_POST['action']) && $_POST['action'] == 'dokan_save_account_details') ||
100
- \Cleantalk\Variables\Post::get('action') === 'frm_get_lookup_text_value' || // Exception for Formidable multilevel form
101
  (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'reset_pass') || //Reset pass exclusion
102
  (isset($_POST['action'], $_POST['register_unspecified_nonce_field']) && $_POST['action'] == 'register') || // Profile Builder have a direct integration
103
  (isset($_POST['_wpmem_register_nonce']) && wp_verify_nonce($_POST['_wpmem_register_nonce'], 'wpmem_longform_nonce')) || // WP Members have a direct integration
@@ -161,7 +162,7 @@ function ct_contact_form_validate()
161
  }
162
  }
163
  //Skip system fields for divi
164
- if ( strpos(\Cleantalk\Variables\Post::get('action'), 'et_pb_contactform_submit') === 0 ) {
165
  foreach ( $_POST as $key => $value ) {
166
  if ( strpos($key, 'et_pb_contact_email_fields') === 0 ) {
167
  unset($_POST[$key]);
@@ -219,11 +220,11 @@ function ct_contact_form_validate()
219
  }
220
 
221
  if ( isset($_POST['TellAFriend_Link']) ) {
222
- $tmp = $_POST['TellAFriend_Link'];
223
  unset($_POST['TellAFriend_Link']);
224
  }
225
 
226
- $checkjs = apbct_js_test(Cookie::get('ct_checkjs'), true) ?: apbct_js_test(Post::get('ct_checkjs'));
227
 
228
  $base_call_result = apbct_base_call(
229
  array(
1
  <?php
2
 
3
+ use Cleantalk\ApbctWP\Sanitize;
4
  use Cleantalk\ApbctWP\Variables\Cookie;
5
  use Cleantalk\Variables\Post;
6
  use Cleantalk\Variables\Server;
98
  isset($_POST['wpforms_id'], $_POST['wpforms_author']) || //Skip wpforms
99
  (isset($_POST['somfrp_action'], $_POST['submitted']) && $_POST['somfrp_action'] == 'somfrp_lost_pass') || // Frontend Reset Password exclusion
100
  (isset($_POST['action']) && $_POST['action'] == 'dokan_save_account_details') ||
101
+ Post::get('action') === 'frm_get_lookup_text_value' || // Exception for Formidable multilevel form
102
  (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'reset_pass') || //Reset pass exclusion
103
  (isset($_POST['action'], $_POST['register_unspecified_nonce_field']) && $_POST['action'] == 'register') || // Profile Builder have a direct integration
104
  (isset($_POST['_wpmem_register_nonce']) && wp_verify_nonce($_POST['_wpmem_register_nonce'], 'wpmem_longform_nonce')) || // WP Members have a direct integration
162
  }
163
  }
164
  //Skip system fields for divi
165
+ if ( strpos(Post::get('action'), 'et_pb_contactform_submit') === 0 ) {
166
  foreach ( $_POST as $key => $value ) {
167
  if ( strpos($key, 'et_pb_contact_email_fields') === 0 ) {
168
  unset($_POST[$key]);
220
  }
221
 
222
  if ( isset($_POST['TellAFriend_Link']) ) {
223
+ $tmp = Sanitize::cleanTextField(Post::get('TellAFriend_Link'));
224
  unset($_POST['TellAFriend_Link']);
225
  }
226
 
227
+ $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ?: apbct_js_test(Sanitize::cleanTextField(Post::get('ct_checkjs')));
228
 
229
  $base_call_result = apbct_base_call(
230
  array(
inc/cleantalk-public.php CHANGED
@@ -1,11 +1,12 @@
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\Escape;
 
4
  use Cleantalk\ApbctWP\Variables\Cookie;
5
- use Cleantalk\Common\Helper;
6
  use Cleantalk\Variables\Get;
7
  use Cleantalk\Variables\Post;
8
  use Cleantalk\Variables\Request;
 
9
 
10
  /**
11
  * Init functions
@@ -264,10 +265,7 @@ function apbct_init()
264
  if ( defined('LANDINGPAGES_CURRENT_VERSION') && ! empty($_POST) ) {
265
  if ( Post::get('action') === 'inbound_store_lead' ) { // AJAX action(s)
266
  ct_check_wplp();
267
- } elseif (
268
- array_key_exists('inbound_submitted', $_POST) &&
269
- $_POST['inbound_submitted'] == '1'
270
- ) {
271
  // Final submit
272
  ct_check_wplp();
273
  }
@@ -500,9 +498,7 @@ function apbct_buffer_modify_by_dom()
500
 
501
  $html = $dom->getElementsByTagName('html');
502
 
503
- return is_object($html) && isset($html[0], $html[0]->childNodes[0]) && $dom->getElementsByTagName(
504
- 'rss'
505
- )->length == 0
506
  ? $dom->saveHTML()
507
  : $apbct->buffer;
508
  }
@@ -852,7 +848,7 @@ function ct_die($_comment_id, $_comment_status)
852
  if ( ! $ct_jp_comments ) {
853
  $back_script = '<script>setTimeout("history.back()", 5000);</script>';
854
  } elseif ( isset($_SERVER['HTTP_REFERER']) ) {
855
- $back_link = '<a href="' . $_SERVER['HTTP_REFERER'] . '">' . __('Back') . '</a>';
856
  }
857
 
858
  if ( file_exists(CLEANTALK_PLUGIN_DIR . "templates/lock-pages/lock-page-ct-die.html") ) {
@@ -902,7 +898,7 @@ function ct_die_extended($comment_body)
902
  if ( ! $ct_jp_comments ) {
903
  $back_script = '<script>setTimeout("history.back()", 5000);</script>';
904
  } else {
905
- $back_link = '<a href="' . $_SERVER['HTTP_REFERER'] . '">' . __('Back') . '</a>';
906
  }
907
 
908
  if ( file_exists(CLEANTALK_PLUGIN_DIR . "templates/lock-pages/lock-page-ct-die.html") ) {
@@ -962,7 +958,7 @@ function apbct_js_test($check_js_value = '', $is_cookie = false)
962
  $out = ct_get_checkjs_value() === $js_key ? 1 : 0;
963
  // Random key check
964
  } else {
965
- $out = array_key_exists($js_key, $apbct->js_keys) ? 1 : 0;
966
  }
967
  }
968
 
@@ -1315,7 +1311,7 @@ function ct_enqueue_styles_public()
1315
  ) {
1316
  wp_enqueue_style(
1317
  'ct_public_css',
1318
- APBCT_CSS_ASSETS_PATH . '/clentalak-public.min.css',
1319
  array(),
1320
  APBCT_VERSION
1321
  );
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\Escape;
4
+ use Cleantalk\ApbctWP\Sanitize;
5
  use Cleantalk\ApbctWP\Variables\Cookie;
 
6
  use Cleantalk\Variables\Get;
7
  use Cleantalk\Variables\Post;
8
  use Cleantalk\Variables\Request;
9
+ use Cleantalk\Variables\Server;
10
 
11
  /**
12
  * Init functions
265
  if ( defined('LANDINGPAGES_CURRENT_VERSION') && ! empty($_POST) ) {
266
  if ( Post::get('action') === 'inbound_store_lead' ) { // AJAX action(s)
267
  ct_check_wplp();
268
+ } elseif ( Post::get('inbound_submitted') === '1' ) {
 
 
 
269
  // Final submit
270
  ct_check_wplp();
271
  }
498
 
499
  $html = $dom->getElementsByTagName('html');
500
 
501
+ return is_object($html) && isset($html[0], $html[0]->childNodes[0]) && $dom->getElementsByTagName('rss')->length == 0
 
 
502
  ? $dom->saveHTML()
503
  : $apbct->buffer;
504
  }
848
  if ( ! $ct_jp_comments ) {
849
  $back_script = '<script>setTimeout("history.back()", 5000);</script>';
850
  } elseif ( isset($_SERVER['HTTP_REFERER']) ) {
851
+ $back_link = '<a href="' . Sanitize::cleanUrl(Server::get('HTTP_REFERER')) . '">' . __('Back') . '</a>';
852
  }
853
 
854
  if ( file_exists(CLEANTALK_PLUGIN_DIR . "templates/lock-pages/lock-page-ct-die.html") ) {
898
  if ( ! $ct_jp_comments ) {
899
  $back_script = '<script>setTimeout("history.back()", 5000);</script>';
900
  } else {
901
+ $back_link = '<a href="' . Sanitize::cleanUrl(Server::get('HTTP_REFERER')) . '">' . __('Back') . '</a>';
902
  }
903
 
904
  if ( file_exists(CLEANTALK_PLUGIN_DIR . "templates/lock-pages/lock-page-ct-die.html") ) {
958
  $out = ct_get_checkjs_value() === $js_key ? 1 : 0;
959
  // Random key check
960
  } else {
961
+ $out = isset($apbct->js_keys[ $js_key ]) ? 1 : 0;
962
  }
963
  }
964
 
1311
  ) {
1312
  wp_enqueue_style(
1313
  'ct_public_css',
1314
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-public.min.css',
1315
  array(),
1316
  APBCT_VERSION
1317
  );
js/apbct-public-bundle.min.js CHANGED
@@ -1 +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)};
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=document.forms[e];if(o.parentElement&&0<o.parentElement.classList.length&&-1!==o.parentElement.classList[0].indexOf("mewtwo"))return;if("string"==typeof o.action)if(isIntegratedForm(o)){jQuery(o).before('<i class="cleantalk_placeholder" style="display: none;"></i>');var n=jQuery(o).prev(),a=o.outerHTML,c=jQuery(o).detach(),a=(n.after(a),document.createElement("input")),i=(a.name="action",a.value="cleantalk_force_ajax_check",a.type="hidden",document.forms[e]);i.appendChild(a);let t=!1;if(void 0!==i.classList){let e=["newsletterform","ml-block-form"];e.forEach(function(e){i.classList.contains(e)&&(t=e)})}if(t){let e=jQuery("form."+t).find('button[type="submit"]');void 0!==e&&e.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(i,n,c)})}else document.forms[e].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),o=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,o)}}else-1===o.action.indexOf("http://")&&-1===o.action.indexOf("https://")||o.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((a=document.createElement("input")).name="cleantalk_hidden_action",a.value=o.action,a.type="hidden",o.appendChild(a),(t=document.createElement("input")).name="cleantalk_hidden_method",t.value=o.method,t.type="hidden",o.method="POST",o.appendChild(t),o.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,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
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){if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}else 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){var c=function(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")?(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))}})):console.log('Attribute "data-id" not set for the option.')}),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")){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))}})}else console.log('Attribute "data-id" not set for the option.')}),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(){self=jQuery(this),apbct_settings__showDescription(self,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 e=jQuery(this),n=jQuery("#apbct-account-email"),t=n.text();e.toggleClass("active"),e.hasClass("active")?(e.text(e.data("save-text")),n.attr("contenteditable","true"),n.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),n.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:t},{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")}}),n.attr("contenteditable","false"),e.text(e.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}\s*$/))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,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,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,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(){\r\n\r\n\t// Crunch for Right to Left direction languages\r\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\r\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\r\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\r\n\t\t}\r\n\t}\r\n\r\n\t// Show/Hide access key\r\n jQuery('#apbct_showApiKey').on('click', function(){\r\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\r\n jQuery('.apbct_setting---apikey+div').show();\r\n jQuery(this).fadeOut(300);\r\n });\r\n\r\n\tvar d = new Date();\r\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\r\n\r\n\t// Key KEY automatically\r\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_get_key_auto'},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\r\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\r\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\r\n\t\t\t\t\tif(result.reload)\r\n\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\tif(result.getTemplates) {\r\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\r\n\t\t\t\t\t\tcleantalkModal.open();\r\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\t// Import settings\r\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\r\n\t\tjQuery('#apbct-ajax-result').remove();\r\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\r\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\r\n\t\ttemplateNameInput.css('border-color', 'inherit');\r\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\r\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar data = {\r\n\t\t\t'template_id' : optionSelected.data('id'),\r\n\t\t\t'template_name' : optionSelected.data('name'),\r\n\t\t\t'settings' : optionSelected.data('settings')\r\n\t\t};\r\n\t\tvar button = this;\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'settings_templates_import', data: data},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: button,\r\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\r\n\t\t\t\tnotJson: true,\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif(result.success) {\r\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\r\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\r\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\t// Export settings\r\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\r\n\t\tjQuery('#apbct-ajax-result').remove();\r\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\r\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\r\n\t\ttemplateNameInput.css('border-color', 'inherit');\r\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\r\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif( optionSelected.data('id') === 'new_template' ) {\r\n\t\t\tvar templateName = templateNameInput.val();\r\n\t\t\tif( templateName === '' ) {\r\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tvar data = {\r\n\t\t\t\t'template_name' : templateName\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar data = {\r\n\t\t\t\t'template_id' : optionSelected.data('id')\r\n\t\t\t}\r\n\t\t}\r\n\t\tvar button = this;\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'settings_templates_export', data: data},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: button,\r\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\r\n\t\t\t\tnotJson: true,\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif(result.success) {\r\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\r\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\r\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\t// Reset settings\r\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\r\n\t\tvar button = this;\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'settings_templates_reset'},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: button,\r\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\r\n\t\t\t\tnotJson: true,\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif(result.success) {\r\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\r\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\r\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\r\n\t\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\t// Sync button\r\n\tjQuery('#apbct_button__sync').on('click', function(){\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_sync'},\r\n\t\t\t{\r\n\t\t\t\ttimeout: 25000,\r\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\r\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\r\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\r\n\t\t\t\t\tif(result.reload)\r\n\t\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t});\r\n\r\n\tif( ctSettingsPage.key_changed )\r\n\t\tjQuery('#apbct_button__sync').click();\r\n\r\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\r\n\t\tself = jQuery(this);\r\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\r\n\t});\r\n\r\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\r\n\t\tapbct_banner_check();\r\n\r\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\r\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\r\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\r\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\r\n\t\t} else {\r\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\r\n\t\t}\r\n\t});\r\n\r\n\tapbct_save_button_position();\r\n\twindow.addEventListener('scroll', apbct_save_button_position);\r\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\r\n\r\n\r\n\t/**\r\n\t * Change cleantalk account email\r\n\t */\r\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\r\n\t\te.preventDefault();\r\n\r\n\t\tvar $this = jQuery(this);\r\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\r\n\t\tvar accountEmail = accountEmailField.text();\r\n\r\n\t\t$this.toggleClass('active');\r\n\r\n\t\tif ($this.hasClass('active')) {\r\n\t\t\t$this.text($this.data('save-text'));\r\n\t\t\taccountEmailField.attr('contenteditable', 'true');\r\n\t\t\taccountEmailField.on('keydown', function (e) {\r\n\t\t\t\tif (e.code === 'Enter') {\r\n\t\t\t\t\te.preventDefault()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\taccountEmailField.on('input', function (e) {\r\n\t\t\t\tif (e.inputType === 'insertParagraph') {\r\n\t\t\t\t\te.preventDefault()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t} else {\r\n\t\t\tapbct_admin_sendAJAX(\r\n\t\t\t\t{\r\n\t\t\t\t\taction: 'apbct_update_account_email',\r\n\t\t\t\t\taccountEmail: accountEmail\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\ttimeout: 5000,\r\n\t\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\r\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\r\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (result.error !== undefined) {\r\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t);\r\n\r\n\t\t\taccountEmailField.attr('contenteditable', 'false');\r\n\t\t\t$this.text($this.data('default-text'));\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t * Validate apkikey and hide get auto btn\r\n\t */\r\n\tjQuery('#apbct_setting_apikey').on('input', function () {\r\n\t\tvar enteredValue = jQuery(this).val();\r\n\r\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,30}\\s*$/) === null) {\r\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\r\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\r\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\r\n\t});\r\n\r\n\tif ( jQuery('#apbct_setting_apikey').val() ) {\r\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\r\n\t}\r\n\r\n});\r\n\r\n/**\r\n * Checking current account status for renew notice\r\n */\r\nfunction apbct_banner_check() {\r\n\tvar bannerChecker = setInterval( function() {\r\n\t\tapbct_admin_sendAJAX(\r\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\r\n\t\t\t{\r\n\t\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\t\tif (result.close_renew_banner) {\r\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\r\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\r\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\r\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\r\n\t\t\t\t\t\tclearInterval(bannerChecker);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t}, 900000);\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector passed in string separated by ,\r\n *\r\n * @param elems\r\n * @returns {*}\r\n */\r\nfunction apbct_get_elems(elems){\r\n elems = elems.split(',');\r\n for( var i=0, len = elems.length, tmp; i < len; i++){\r\n tmp = jQuery('#'+elems[i]);\r\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\r\n }\r\n return elems;\r\n}\r\n\r\n/**\r\n * Select elems like #{selector} or .{selector}\r\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\r\n *\r\n * @param elems string|array\r\n * @returns array\r\n */\r\nfunction apbct_get_elems__native(elems){\r\n\r\n\t// Make array from a string\r\n\tif(typeof elems === 'string')\r\n\t\telems = elems.split(',');\r\n\r\n\tvar out = [];\r\n\r\n\telems.forEach(function(elem, i, arr) {\r\n\r\n\t\t// try to get elements with such IDs\r\n\t\tvar tmp = document.getElementById(elem);\r\n\t\tif (tmp !== null){\r\n\t\t\tout.push( tmp[key] );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// try to get elements with such class name\r\n\t\t// write each elem from collection to new element of output array\r\n\t\ttmp = document.getElementsByClassName(elem);\r\n\t\tif (tmp !== null && tmp.length !==0 ){\r\n\t\t\tfor(key in tmp){\r\n\t\t\t\tif( +key >= 0 ){\r\n\t\t\t\t\tout.push( tmp[key] );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\treturn out;\r\n}\r\n\r\nfunction apbct_show_hide_elem(elems){\r\n\telems = apbct_get_elems(elems);\r\n for( var i=0, len = elems.length; i < len; i++){\r\n elems[i].each(function (i, elem) {\r\n elem = jQuery(elem);\r\n var label = elem.next('label') || elem.prev('label') || null;\r\n if (elem.is(\":visible\")) {\r\n elem.hide();\r\n if (label) label.hide();\r\n } else {\r\n elem.show();\r\n if (label) label.show();\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\r\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\r\n *\r\n * @param ids string|array Selectors\r\n * @param enable\r\n */\r\nfunction apbctSettingsDependencies(ids, enable){\r\n\r\n\r\n\tenable = ! isNaN(enable) ? enable : null;\r\n\r\n\t// Get elements\r\n\tvar elems = apbct_get_elems__native( ids );\r\n\r\n\telems.forEach(function(elem, i, arr){\r\n\r\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\r\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\r\n\r\n\t\t// Set defined state\r\n\t\tif(enable === null) // Set\r\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\r\n\r\n\t\tenable === 1 ? do_enable() : do_disable();\r\n\r\n\t\tif( elem.getAttribute('apbct_children') !== null){\r\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\r\n\t\t\tif( state !== null ) {\r\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t});\r\n}\r\n\r\nfunction apbctSettingsDependencies_getState( elem ){\r\n\r\n\tvar state;\r\n\r\n\tswitch ( elem.getAttribute( 'type' ) ){\r\n\t\tcase 'checkbox':\r\n\t\t\tstate = +elem.checked;\r\n\t\t\tbreak;\r\n\t\tcase 'radio':\r\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tstate = null;\r\n\t}\r\n\r\n\treturn state;\r\n}\r\n\r\nfunction apbct_settings__showDescription(label, setting_id){\r\n\r\n\tvar remove_desc_func = function(e){\r\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\r\n\t\t\tjQuery('.apbct_long_desc').remove();\r\n\t\t\tjQuery(document).off('click', remove_desc_func);\r\n\t\t}\r\n\t};\r\n\r\n\tremove_desc_func();\r\n\r\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\r\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\r\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\r\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t.css({\r\n\t\t\ttop: label.position().top - 5,\r\n\t\t\tleft: label.position().left + 25\r\n\t\t});\r\n\r\n\r\n\tapbct_admin_sendAJAX(\r\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\r\n\t\t{\r\n\t\t\tspinner: obj.children('img'),\r\n\t\t\tcallback: function(result, data, params, obj){\r\n\r\n\t\t\t\tobj.empty()\r\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\r\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\r\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\r\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\r\n\r\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\r\n\t\t\t}\r\n\t\t},\r\n\t\tobj\r\n\t);\r\n}\r\n\r\nfunction apbct_save_button_position() {\r\n\tif (\r\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\r\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\r\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\r\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\r\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\r\n\t) {\r\n\t\treturn;\r\n\t}\r\n\tvar docInnerHeight = window.innerHeight;\r\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\r\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\r\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\r\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\r\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\r\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\r\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\r\n\r\n\t// Set Save button position\r\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\r\n\t\tjQuery('#apbct_settings__main_save_button').hide();\r\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\r\n\t\t\tbuttonBlock.style.bottom = '';\r\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\r\n\t\t} else {\r\n\t\t\tbuttonBlock.style.bottom = 0;\r\n\t\t\tbuttonBlock.style.top = '';\r\n\t\t}\r\n\t} else {\r\n\t\tjQuery('#apbct_settings__main_save_button').show();\r\n\t}\r\n\r\n\t// Set nav position\r\n\tif ( advSettingsOffset <= 0 ) {\r\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\r\n\t} else {\r\n\t\tnavBlock.style.top = 0;\r\n\t}\r\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","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","template_id","template_name","settings","notJson","success","insertAfter","close","console","log","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,GAQJ,GAAY,QADZA,EAAMS,SAASE,uBAAuBJ,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIQ,KAAMb,EAAIY,WAVhBP,EAAIQ,KAAMb,EAAIY,QAgBTP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,IACvCF,EAAME,GAAGc,KAAK,SAAUd,EAAGM,GAEvB,IAAIS,GADJT,EAAOb,OAAOa,IACGU,KAAK,UAAYV,EAAKW,KAAK,UAAY,KACpDX,EAAKY,GAAG,aACRZ,EAAKX,OACDoB,GAAOA,EAAMpB,SAEjBW,EAAKa,OACDJ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ntegrationBase
9
+ {
10
+ private $return_argument = true;
11
+
12
+ public function getDataForChecking($argument)
13
+ {
14
+ $this->return_argument = $argument;
15
+ if (
16
+ (
17
+ apbct_is_plugin_active('user-meta/user-meta.php')
18
+ ||
19
+ apbct_is_plugin_active('user-meta-pro/user-meta.php')
20
+ )
21
+ && !empty($_POST)
22
+ && Post::get('user_email')
23
+ && Post::get('user_login')
24
+ ) {
25
+ /**
26
+ * Filter for POST
27
+ */
28
+ $input_array = apply_filters('apbct__filter_post', $_POST);
29
+ $data = ct_get_fields_any($input_array);
30
+ $data['register'] = true;
31
+
32
+ if ( Post::get('is_ajax') === 'true' ) {
33
+ return null;
34
+ }
35
+
36
+ return $data;
37
+ }
38
+
39
+ return null;
40
+ }
41
+
42
+ /**
43
+ * @param $message
44
+ *
45
+ * @return WP_Error
46
+ * @psalm-suppress UnusedVariable
47
+ */
48
+ public function doBlock($message)
49
+ {
50
+ return new WP_Error('invalid_email', $message);
51
+ }
52
+
53
+ public function allow()
54
+ {
55
+ return $this->return_argument;
56
+ }
57
+ }
lib/Cleantalk/Antispam/Integrations/Wpdiscuz.php CHANGED
@@ -11,12 +11,16 @@ class Wpdiscuz extends IntegrationBase
11
  */
12
  $input_array = apply_filters('apbct__filter_post', $_POST);
13
 
14
- if ( isset($input_array['wc_name'], $input_array['wc_email'], $input_array['wc_comment']) ) {
 
 
 
 
15
  return array(
16
- 'message' => $input_array['wc_comment'],
17
- 'email' => $input_array['wc_email'],
18
- 'nickname' => $input_array['wc_name'],
19
- 'sender_url' => isset($input_array['wc_website']) ? $input_array['wc_website'] : ''
20
  );
21
  }
22
 
11
  */
12
  $input_array = apply_filters('apbct__filter_post', $_POST);
13
 
14
+ if (
15
+ isset($input_array['wc_name']) ||
16
+ isset($input_array['wc_email']) ||
17
+ isset($input_array['wc_comment'])
18
+ ) {
19
  return array(
20
+ 'message' => isset($input_array['wc_comment']) ? $input_array['wc_comment'] : '',
21
+ 'email' => isset($input_array['wc_email']) ? $input_array['wc_email'] : '',
22
+ 'nickname' => isset($input_array['wc_name']) ? $input_array['wc_name'] : '',
23
+ 'sender_url' => isset($input_array['wc_website']) ? $input_array['wc_website'] : ''
24
  );
25
  }
26
 
lib/Cleantalk/ApbctWP/CleantalkListTable.php CHANGED
@@ -50,7 +50,7 @@ class CleantalkListTable {
50
  * The current screen.
51
  *
52
  * @since 3.1.0
53
- * @var object
54
  */
55
  protected $screen;
56
 
@@ -173,8 +173,8 @@ class CleantalkListTable {
173
 
174
  if ( empty( $this->modes ) ) {
175
  $this->modes = array(
176
- 'list' => __( 'List View' ),
177
- 'excerpt' => __( 'Excerpt View' ),
178
  );
179
  }
180
  }
@@ -188,7 +188,7 @@ class CleantalkListTable {
188
  * @return mixed Property.
189
  */
190
  public function __get( $name ) {
191
- if ( in_array( $name, $this->compat_fields ) ) {
192
  return $this->$name;
193
  }
194
  }
@@ -203,7 +203,7 @@ class CleantalkListTable {
203
  * @return mixed Newly-set property.
204
  */
205
  public function __set( $name, $value ) {
206
- if ( in_array( $name, $this->compat_fields ) ) {
207
  return $this->$name = $value;
208
  }
209
  }
@@ -214,12 +214,14 @@ class CleantalkListTable {
214
  * @since 4.0.0
215
  *
216
  * @param string $name Property to check if set.
217
- * @return bool Whether the property is set.
218
  */
219
  public function __isset( $name ) {
220
- if ( in_array( $name, $this->compat_fields ) ) {
221
  return isset( $this->$name );
222
  }
 
 
223
  }
224
 
225
  /**
@@ -230,7 +232,7 @@ class CleantalkListTable {
230
  * @param string $name Property to unset.
231
  */
232
  public function __unset( $name ) {
233
- if ( in_array( $name, $this->compat_fields ) ) {
234
  unset( $this->$name );
235
  }
236
  }
@@ -240,12 +242,12 @@ class CleantalkListTable {
240
  *
241
  * @since 4.0.0
242
  *
243
- * @param string $name Method to call.
244
- * @param array $arguments Arguments to pass when calling.
245
  * @return mixed|bool Return value of the callback, false otherwise.
246
  */
247
  public function __call( $name, $arguments ) {
248
- if ( in_array( $name, $this->compat_methods ) ) {
249
  return $this->$name( ...$arguments );
250
  }
251
  return false;
@@ -258,7 +260,7 @@ class CleantalkListTable {
258
  * @abstract
259
  */
260
  public function ajax_user_can() {
261
- die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
262
  }
263
 
264
  /**
@@ -270,7 +272,7 @@ class CleantalkListTable {
270
  * @abstract
271
  */
272
  public function prepare_items() {
273
- die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
274
  }
275
 
276
  /**
@@ -320,6 +322,8 @@ class CleantalkListTable {
320
  if ( isset( $this->_pagination_args[ $key ] ) ) {
321
  return $this->_pagination_args[ $key ];
322
  }
 
 
323
  }
324
 
325
  /**
@@ -379,8 +383,10 @@ class CleantalkListTable {
379
  }
380
 
381
  /**
382
- * Get an associative array ( id => link ) with the list
383
- * of views available on this table.
 
 
384
  *
385
  * @since 3.1.0
386
  *
@@ -391,7 +397,7 @@ class CleantalkListTable {
391
  }
392
 
393
  /**
394
- * Display the list of views available on this table.
395
  *
396
  * @since 3.1.0
397
  */
@@ -401,9 +407,9 @@ class CleantalkListTable {
401
  * Filters the list of available list table views.
402
  *
403
  * The dynamic portion of the hook name, `$this->screen->id`, refers
404
- * to the ID of the current screen, usually a string.
405
  *
406
- * @since 3.5.0
407
  *
408
  * @param string[] $views An array of available list table views.
409
  */
@@ -424,10 +430,29 @@ class CleantalkListTable {
424
  }
425
 
426
  /**
427
- * Get an associative array ( option_name => option_title ) with the list
428
- * of bulk actions available on this table.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  *
430
  * @since 3.1.0
 
431
  *
432
  * @return array
433
  */
@@ -436,7 +461,7 @@ class CleantalkListTable {
436
  }
437
 
438
  /**
439
- * Display the bulk actions dropdown.
440
  *
441
  * @since 3.1.0
442
  *
@@ -446,20 +471,21 @@ class CleantalkListTable {
446
  protected function bulk_actions( $which = '' ) {
447
  if ( is_null( $this->_actions ) ) {
448
  $this->_actions = $this->get_bulk_actions();
 
449
  /**
450
- * Filters the list table Bulk Actions drop-down.
451
  *
452
  * The dynamic portion of the hook name, `$this->screen->id`, refers
453
- * to the ID of the current screen, usually a string.
454
  *
455
- * This filter can currently only be used to remove bulk actions.
 
456
  *
457
- * @since 3.5.0
458
- *
459
- * @param string[] $actions An array of the available bulk actions.
460
  */
461
- $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
462
- $two = '';
 
463
  } else {
464
  $two = '2';
465
  }
@@ -470,12 +496,23 @@ class CleantalkListTable {
470
 
471
  echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
472
  echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
473
- echo '<option value="-1">' . __( 'Bulk Actions' ) . "</option>\n";
474
 
475
- foreach ( $this->_actions as $name => $title ) {
476
- $class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
 
 
 
 
 
 
 
 
 
 
477
 
478
- echo "\t" . '<option value="' . $name . '"' . $class . '>' . $title . "</option>\n";
 
479
  }
480
 
481
  echo "</select>\n";
@@ -485,11 +522,11 @@ class CleantalkListTable {
485
  }
486
 
487
  /**
488
- * Get the current action selected from the bulk actions dropdown.
489
  *
490
  * @since 3.1.0
491
  *
492
- * @return string|false The action name or False if no action was selected
493
  */
494
  public function current_action() {
495
  if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
@@ -497,39 +534,46 @@ class CleantalkListTable {
497
  }
498
 
499
  if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
500
- return $_REQUEST['action'];
501
- }
502
-
503
- if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
504
- return $_REQUEST['action2'];
505
  }
506
 
507
  return false;
508
  }
509
 
510
  /**
511
- * Generate row actions div
512
  *
513
  * @since 3.1.0
514
  *
515
  * @param string[] $actions An array of action links.
516
  * @param bool $always_visible Whether the actions should be always visible.
517
- * @return string
518
  */
519
  protected function row_actions( $actions, $always_visible = false ) {
520
  $action_count = count( $actions );
521
- $i = 0;
522
 
523
  if ( ! $action_count ) {
524
  return '';
525
  }
526
 
 
 
 
 
 
 
527
  $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
 
 
 
528
  foreach ( $actions as $action => $link ) {
529
  ++$i;
530
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
531
- $out .= "<span class='$action'>$link$sep</span>";
 
 
532
  }
 
533
  $out .= '</div>';
534
 
535
  $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
@@ -538,14 +582,14 @@ class CleantalkListTable {
538
  }
539
 
540
  /**
541
- * Display a monthly dropdown for filtering items
542
  *
543
  * @since 3.1.0
544
  *
545
- * @global wpdb $wpdb WordPress database abstraction object.
546
- * @global WP_Locale $wp_locale WordPress date and time locale object.
547
  *
548
- * @param string $post_type
549
  */
550
  protected function months_dropdown( $post_type ) {
551
  global $wpdb, $wp_locale;
@@ -562,33 +606,45 @@ class CleantalkListTable {
562
  return;
563
  }
564
 
565
- $extra_checks = "AND post_status != 'auto-draft'";
566
- if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
567
- $extra_checks .= " AND post_status != 'trash'";
568
- } elseif ( isset( $_GET['post_status'] ) ) {
569
- $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
570
- }
 
 
 
 
 
 
 
 
 
 
 
571
 
572
- $months = $wpdb->get_results(
573
- $wpdb->prepare(
574
- "
575
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
576
- FROM $wpdb->posts
577
- WHERE post_type = %s
578
- $extra_checks
579
- ORDER BY post_date DESC
580
- ",
581
- $post_type
582
- )
583
- );
 
584
 
585
  /**
586
  * Filters the 'Months' drop-down results.
587
  *
588
  * @since 3.7.0
589
  *
590
- * @param object $months The months drop-down query results.
591
- * @param string $post_type The post type.
592
  */
593
  $months = apply_filters( 'months_dropdown_results', $months, $post_type );
594
 
@@ -600,7 +656,7 @@ class CleantalkListTable {
600
 
601
  $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
602
  ?>
603
- <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
604
  <select name="m" id="filter-by-date">
605
  <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
606
  <?php
@@ -626,7 +682,7 @@ class CleantalkListTable {
626
  }
627
 
628
  /**
629
- * Display a view switcher
630
  *
631
  * @since 3.1.0
632
  *
@@ -645,9 +701,10 @@ class CleantalkListTable {
645
  $classes[] = 'current';
646
  $aria_current = ' aria-current="page"';
647
  }
 
648
  printf(
649
  "<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
650
- esc_url( add_query_arg( 'mode', $mode ) ),
651
  implode( ' ', $classes ),
652
  $title
653
  );
@@ -658,7 +715,7 @@ class CleantalkListTable {
658
  }
659
 
660
  /**
661
- * Display a comment count bubble
662
  *
663
  * @since 3.1.0
664
  *
@@ -689,14 +746,21 @@ class CleantalkListTable {
689
  $pending_comments_number
690
  );
691
 
692
- // No comments at all.
693
  if ( ! $approved_comments && ! $pending_comments ) {
 
694
  printf(
695
  '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
696
  __( 'No comments' )
697
  );
698
- // Approved comments have different display depending on some conditions.
 
 
 
 
 
 
699
  } elseif ( $approved_comments ) {
 
700
  printf(
701
  '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
702
  esc_url(
@@ -712,6 +776,7 @@ class CleantalkListTable {
712
  $pending_comments ? $approved_phrase : $approved_only_phrase
713
  );
714
  } else {
 
715
  printf(
716
  '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
717
  $approved_comments_number,
@@ -744,7 +809,7 @@ class CleantalkListTable {
744
  }
745
 
746
  /**
747
- * Get the current page number
748
  *
749
  * @since 3.1.0
750
  *
@@ -761,28 +826,39 @@ class CleantalkListTable {
761
  }
762
 
763
  /**
764
- * Get number of items to display on a single page
765
  *
766
  * @since 3.1.0
767
  *
768
- * @param string $option
769
- * @param int $default
770
  * @return int
771
  */
772
- protected function get_items_per_page( $option, $default = 20 ) {
773
  $per_page = (int) get_user_option( $option );
774
  if ( empty( $per_page ) || $per_page < 1 ) {
775
- $per_page = $default;
776
  }
777
 
778
  /**
779
  * Filters the number of items to be displayed on each page of the list table.
780
  *
781
- * The dynamic hook name, $option, refers to the `per_page` option depending
782
- * on the type of list table in use. Possible values include: 'edit_comments_per_page',
783
- * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
784
- * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
785
- * 'edit_{$post_type}_per_page', etc.
 
 
 
 
 
 
 
 
 
 
 
786
  *
787
  * @since 2.9.0
788
  *
@@ -792,7 +868,7 @@ class CleantalkListTable {
792
  }
793
 
794
  /**
795
- * Display the pagination.
796
  *
797
  * @since 3.1.0
798
  *
@@ -823,7 +899,7 @@ class CleantalkListTable {
823
  $current = $this->get_pagenum();
824
  $removable_query_args = wp_removable_query_args();
825
 
826
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
827
 
828
  $current_url = remove_query_arg( $removable_query_args, $current_url );
829
 
@@ -837,20 +913,14 @@ class CleantalkListTable {
837
  $disable_prev = false;
838
  $disable_next = false;
839
 
840
- if ( $current == 1 ) {
841
  $disable_first = true;
842
  $disable_prev = true;
843
  }
844
- if ( $current == 2 ) {
845
- $disable_first = true;
846
- }
847
- if ( $current == $total_pages ) {
848
  $disable_last = true;
849
  $disable_next = true;
850
  }
851
- if ( $current == $total_pages - 1 ) {
852
- $disable_last = true;
853
- }
854
 
855
  if ( $disable_first ) {
856
  $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
@@ -919,7 +989,7 @@ class CleantalkListTable {
919
  if ( ! empty( $infinite_scroll ) ) {
920
  $pagination_links_class .= ' hide-if-js';
921
  }
922
- $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
923
 
924
  if ( $total_pages ) {
925
  $page_class = $total_pages < 2 ? ' one-page' : '';
@@ -932,8 +1002,10 @@ class CleantalkListTable {
932
  }
933
 
934
  /**
935
- * Get a list of columns. The format is:
936
- * 'internal-name' => 'Title'
 
 
937
  *
938
  * @since 3.1.0
939
  * @abstract
@@ -941,16 +1013,16 @@ class CleantalkListTable {
941
  * @return array
942
  */
943
  public function get_columns() {
944
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
945
  }
946
 
947
  /**
948
- * Get a list of sortable columns. The format is:
949
- * 'internal-name' => 'orderby'
950
- * or
951
- * 'internal-name' => array( 'orderby', true )
952
  *
953
- * The second format will make the initial sorting order be descending
 
 
 
954
  *
955
  * @since 3.1.0
956
  *
@@ -1011,10 +1083,10 @@ class CleantalkListTable {
1011
  $columns = get_column_headers( $this->screen );
1012
  $default = $this->get_default_primary_column_name();
1013
 
1014
- // If the primary column doesn't exist fall back to the
1015
- // first non-checkbox column.
1016
  if ( ! isset( $columns[ $default ] ) ) {
1017
- $default = CleantalkListTable::get_default_primary_column_name();
1018
  }
1019
 
1020
  /**
@@ -1035,17 +1107,22 @@ class CleantalkListTable {
1035
  }
1036
 
1037
  /**
1038
- * Get a list of all, hidden and sortable columns, with filter applied
1039
  *
1040
  * @since 3.1.0
1041
  *
1042
  * @return array
1043
  */
1044
  protected function get_column_info() {
1045
- // $_column_headers is already set / cached
1046
  if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
1047
- // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
1048
- // In 4.3, we added a fourth argument for primary column.
 
 
 
 
 
1049
  $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
1050
  foreach ( $this->_column_headers as $key => $value ) {
1051
  $column_headers[ $key ] = $value;
@@ -1062,9 +1139,9 @@ class CleantalkListTable {
1062
  * Filters the list table sortable columns for a specific screen.
1063
  *
1064
  * The dynamic portion of the hook name, `$this->screen->id`, refers
1065
- * to the ID of the current screen, usually a string.
1066
  *
1067
- * @since 3.5.0
1068
  *
1069
  * @param array $sortable_columns An array of sortable columns.
1070
  */
@@ -1091,7 +1168,7 @@ class CleantalkListTable {
1091
  }
1092
 
1093
  /**
1094
- * Return number of visible columns
1095
  *
1096
  * @since 3.1.0
1097
  *
@@ -1104,22 +1181,20 @@ class CleantalkListTable {
1104
  }
1105
 
1106
  /**
1107
- * Print column headers, accounting for hidden and sortable columns.
1108
  *
1109
  * @since 3.1.0
1110
  *
1111
- * @staticvar int $cb_counter
1112
- *
1113
- * @param bool $with_id Whether to set the id attribute or not
1114
  */
1115
  public function print_column_headers( $with_id = true ) {
1116
  list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1117
 
1118
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1119
  $current_url = remove_query_arg( 'paged', $current_url );
1120
 
1121
  if ( isset( $_GET['orderby'] ) ) {
1122
- $current_orderby = $_GET['orderby'];
1123
  } else {
1124
  $current_orderby = '';
1125
  }
@@ -1133,20 +1208,20 @@ class CleantalkListTable {
1133
  if ( ! empty( $columns['cb'] ) ) {
1134
  static $cb_counter = 1;
1135
  $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
1136
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
1137
  $cb_counter++;
1138
  }
1139
 
1140
  foreach ( $columns as $column_key => $column_display_name ) {
1141
  $class = array( 'manage-column', "column-$column_key" );
1142
 
1143
- if ( in_array( $column_key, $hidden ) ) {
1144
  $class[] = 'hidden';
1145
  }
1146
 
1147
  if ( 'cb' === $column_key ) {
1148
  $class[] = 'check-column';
1149
- } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
1150
  $class[] = 'num';
1151
  }
1152
 
@@ -1158,16 +1233,26 @@ class CleantalkListTable {
1158
  list( $orderby, $desc_first ) = $sortable[ $column_key ];
1159
 
1160
  if ( $current_orderby === $orderby ) {
1161
- $order = 'asc' === $current_order ? 'desc' : 'asc';
 
1162
  $class[] = 'sorted';
1163
  $class[] = $current_order;
1164
  } else {
1165
- $order = $desc_first ? 'desc' : 'asc';
 
 
 
 
 
1166
  $class[] = 'sortable';
1167
- $class[] = $desc_first ? 'asc' : 'desc';
1168
  }
1169
 
1170
- $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
 
 
 
 
1171
  }
1172
 
1173
  $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
@@ -1175,7 +1260,7 @@ class CleantalkListTable {
1175
  $id = $with_id ? "id='$column_key'" : '';
1176
 
1177
  if ( ! empty( $class ) ) {
1178
- $class = "class='" . join( ' ', $class ) . "'";
1179
  }
1180
 
1181
  echo "<$tag $scope $id $class>$column_display_name</$tag>";
@@ -1223,18 +1308,22 @@ class CleantalkListTable {
1223
  }
1224
 
1225
  /**
1226
- * Get a list of CSS classes for the WP_List_Table table tag.
1227
  *
1228
  * @since 3.1.0
1229
  *
1230
- * @return array List of CSS classes for the table tag.
1231
  */
1232
  protected function get_table_classes() {
1233
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
 
 
 
 
1234
  }
1235
 
1236
  /**
1237
- * Generate the table navigation above or below the table
1238
  *
1239
  * @since 3.1.0
1240
  * @param string $which
@@ -1262,7 +1351,7 @@ class CleantalkListTable {
1262
  }
1263
 
1264
  /**
1265
- * Extra controls to be displayed between bulk actions and pagination
1266
  *
1267
  * @since 3.1.0
1268
  *
@@ -1271,7 +1360,7 @@ class CleantalkListTable {
1271
  protected function extra_tablenav( $which ) {}
1272
 
1273
  /**
1274
- * Generate the tbody element for the list table.
1275
  *
1276
  * @since 3.1.0
1277
  */
@@ -1286,7 +1375,7 @@ class CleantalkListTable {
1286
  }
1287
 
1288
  /**
1289
- * Generate the table rows
1290
  *
1291
  * @since 3.1.0
1292
  */
@@ -1297,11 +1386,11 @@ class CleantalkListTable {
1297
  }
1298
 
1299
  /**
1300
- * Generates content for a single row of the table
1301
  *
1302
  * @since 3.1.0
1303
  *
1304
- * @param object $item The current item
1305
  */
1306
  public function single_row( $item ) {
1307
  echo '<tr>';
@@ -1310,22 +1399,22 @@ class CleantalkListTable {
1310
  }
1311
 
1312
  /**
1313
- * @param object $item
1314
  * @param string $column_name
1315
  */
1316
  protected function column_default( $item, $column_name ) {}
1317
 
1318
  /**
1319
- * @param object $item
1320
  */
1321
  protected function column_cb( $item ) {}
1322
 
1323
  /**
1324
- * Generates the columns for a single row of the table
1325
  *
1326
  * @since 3.1.0
1327
  *
1328
- * @param object $item The current item
1329
  */
1330
  protected function single_row_columns( $item ) {
1331
  list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
@@ -1336,13 +1425,13 @@ class CleantalkListTable {
1336
  $classes .= ' has-row-actions column-primary';
1337
  }
1338
 
1339
- if ( in_array( $column_name, $hidden ) ) {
1340
  $classes .= ' hidden';
1341
  }
1342
 
1343
  // Comments column uses HTML in the display name with screen reader text.
1344
- // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string.
1345
- $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
1346
 
1347
  $attributes = "class='$classes' $data";
1348
 
@@ -1377,17 +1466,18 @@ class CleantalkListTable {
1377
  *
1378
  * @since 4.3.0
1379
  *
1380
- * @param object $item The item being acted upon.
1381
- * @param string $column_name Current column name.
1382
- * @param string $primary Primary column name.
1383
- * @return string The row actions HTML, or an empty string if the current column is the primary column.
 
1384
  */
1385
  protected function handle_row_actions( $item, $column_name, $primary ) {
1386
  return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
1387
  }
1388
 
1389
  /**
1390
- * Handle an incoming ajax request (called from admin-ajax.php)
1391
  *
1392
  * @since 3.1.0
1393
  */
@@ -1421,7 +1511,9 @@ class CleantalkListTable {
1421
  }
1422
 
1423
  /**
1424
- * Send required variables to JavaScript land
 
 
1425
  */
1426
  public function _js_vars() {
1427
  $args = array(
50
  * The current screen.
51
  *
52
  * @since 3.1.0
53
+ * @var \WP_Screen
54
  */
55
  protected $screen;
56
 
173
 
174
  if ( empty( $this->modes ) ) {
175
  $this->modes = array(
176
+ 'list' => __( 'Compact view' ),
177
+ 'excerpt' => __( 'Extended view' ),
178
  );
179
  }
180
  }
188
  * @return mixed Property.
189
  */
190
  public function __get( $name ) {
191
+ if ( in_array( $name, $this->compat_fields, true ) ) {
192
  return $this->$name;
193
  }
194
  }
203
  * @return mixed Newly-set property.
204
  */
205
  public function __set( $name, $value ) {
206
+ if ( in_array( $name, $this->compat_fields, true ) ) {
207
  return $this->$name = $value;
208
  }
209
  }
214
  * @since 4.0.0
215
  *
216
  * @param string $name Property to check if set.
217
+ * @return bool Whether the property is a back-compat property and it is set.
218
  */
219
  public function __isset( $name ) {
220
+ if ( in_array( $name, $this->compat_fields, true ) ) {
221
  return isset( $this->$name );
222
  }
223
+
224
+ return false;
225
  }
226
 
227
  /**
232
  * @param string $name Property to unset.
233
  */
234
  public function __unset( $name ) {
235
+ if ( in_array( $name, $this->compat_fields, true ) ) {
236
  unset( $this->$name );
237
  }
238
  }
242
  *
243
  * @since 4.0.0
244
  *
245
+ * @param string $name Method to call.
246
+ * @param array $arguments Arguments to pass when calling.
247
  * @return mixed|bool Return value of the callback, false otherwise.
248
  */
249
  public function __call( $name, $arguments ) {
250
+ if ( in_array( $name, $this->compat_methods, true ) ) {
251
  return $this->$name( ...$arguments );
252
  }
253
  return false;
260
  * @abstract
261
  */
262
  public function ajax_user_can() {
263
+ die( 'function WP_List_Table::ajax_user_can() must be overridden in a subclass.' );
264
  }
265
 
266
  /**
272
  * @abstract
273
  */
274
  public function prepare_items() {
275
+ die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' );
276
  }
277
 
278
  /**
322
  if ( isset( $this->_pagination_args[ $key ] ) ) {
323
  return $this->_pagination_args[ $key ];
324
  }
325
+
326
+ return 0;
327
  }
328
 
329
  /**
383
  }
384
 
385
  /**
386
+ * Gets the list of views available on this table.
387
+ *
388
+ * The format is an associative array:
389
+ * - `'id' => 'link'`
390
  *
391
  * @since 3.1.0
392
  *
397
  }
398
 
399
  /**
400
+ * Displays the list of views available on this table.
401
  *
402
  * @since 3.1.0
403
  */
407
  * Filters the list of available list table views.
408
  *
409
  * The dynamic portion of the hook name, `$this->screen->id`, refers
410
+ * to the ID of the current screen.
411
  *
412
+ * @since 3.1.0
413
  *
414
  * @param string[] $views An array of available list table views.
415
  */
430
  }
431
 
432
  /**
433
+ * Retrieves the list of bulk actions available for this table.
434
+ *
435
+ * The format is an associative array where each element represents either a top level option value and label, or
436
+ * an array representing an optgroup and its options.
437
+ *
438
+ * For a standard option, the array element key is the field value and the array element value is the field label.
439
+ *
440
+ * For an optgroup, the array element key is the label and the array element value is an associative array of
441
+ * options as above.
442
+ *
443
+ * Example:
444
+ *
445
+ * [
446
+ * 'edit' => 'Edit',
447
+ * 'delete' => 'Delete',
448
+ * 'Change State' => [
449
+ * 'feature' => 'Featured',
450
+ * 'sale' => 'On Sale',
451
+ * ]
452
+ * ]
453
  *
454
  * @since 3.1.0
455
+ * @since 5.6.0 A bulk action can now contain an array of options in order to create an optgroup.
456
  *
457
  * @return array
458
  */
461
  }
462
 
463
  /**
464
+ * Displays the bulk actions dropdown.
465
  *
466
  * @since 3.1.0
467
  *
471
  protected function bulk_actions( $which = '' ) {
472
  if ( is_null( $this->_actions ) ) {
473
  $this->_actions = $this->get_bulk_actions();
474
+
475
  /**
476
+ * Filters the items in the bulk actions menu of the list table.
477
  *
478
  * The dynamic portion of the hook name, `$this->screen->id`, refers
479
+ * to the ID of the current screen.
480
  *
481
+ * @since 3.1.0
482
+ * @since 5.6.0 A bulk action can now contain an array of options in order to create an optgroup.
483
  *
484
+ * @param array $actions An array of the available bulk actions.
 
 
485
  */
486
+ $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
487
+
488
+ $two = '';
489
  } else {
490
  $two = '2';
491
  }
496
 
497
  echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
498
  echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
499
+ echo '<option value="-1">' . __( 'Bulk actions' ) . "</option>\n";
500
 
501
+ foreach ( $this->_actions as $key => $value ) {
502
+ if ( is_array( $value ) ) {
503
+ echo "\t" . '<optgroup label="' . esc_attr( $key ) . '">' . "\n";
504
+
505
+ foreach ( $value as $name => $title ) {
506
+ $class = ( 'edit' === $name ) ? ' class="hide-if-no-js"' : '';
507
+
508
+ echo "\t\t" . '<option value="' . esc_attr( $name ) . '"' . $class . '>' . $title . "</option>\n";
509
+ }
510
+ echo "\t" . "</optgroup>\n";
511
+ } else {
512
+ $class = ( 'edit' === $key ) ? ' class="hide-if-no-js"' : '';
513
 
514
+ echo "\t" . '<option value="' . esc_attr( $key ) . '"' . $class . '>' . $value . "</option>\n";
515
+ }
516
  }
517
 
518
  echo "</select>\n";
522
  }
523
 
524
  /**
525
+ * Gets the current action selected from the bulk actions dropdown.
526
  *
527
  * @since 3.1.0
528
  *
529
+ * @return string|false The action name. False if no action was selected.
530
  */
531
  public function current_action() {
532
  if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
534
  }
535
 
536
  if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
537
+ return sanitize_text_field($_REQUEST['action']);
 
 
 
 
538
  }
539
 
540
  return false;
541
  }
542
 
543
  /**
544
+ * Generates the required HTML for a list of row action links.
545
  *
546
  * @since 3.1.0
547
  *
548
  * @param string[] $actions An array of action links.
549
  * @param bool $always_visible Whether the actions should be always visible.
550
+ * @return string The HTML for the row actions.
551
  */
552
  protected function row_actions( $actions, $always_visible = false ) {
553
  $action_count = count( $actions );
 
554
 
555
  if ( ! $action_count ) {
556
  return '';
557
  }
558
 
559
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
560
+
561
+ if ( 'excerpt' === $mode ) {
562
+ $always_visible = true;
563
+ }
564
+
565
  $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
566
+
567
+ $i = 0;
568
+
569
  foreach ( $actions as $action => $link ) {
570
  ++$i;
571
+
572
+ $sep = ( $i < $action_count ) ? ' | ' : '';
573
+
574
+ $out .= "<span class='$action'>$link$sep</span>";
575
  }
576
+
577
  $out .= '</div>';
578
 
579
  $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
582
  }
583
 
584
  /**
585
+ * Displays a dropdown for filtering items in the list table by month.
586
  *
587
  * @since 3.1.0
588
  *
589
+ * @global \wpdb $wpdb WordPress database abstraction object.
590
+ * @global \WP_Locale $wp_locale WordPress date and time locale object.
591
  *
592
+ * @param string $post_type The post type.
593
  */
594
  protected function months_dropdown( $post_type ) {
595
  global $wpdb, $wp_locale;
606
  return;
607
  }
608
 
609
+ /**
610
+ * Filters to short-circuit performing the months dropdown query.
611
+ *
612
+ * @since 5.7.0
613
+ *
614
+ * @param object[]|false $months 'Months' drop-down results. Default false.
615
+ * @param string $post_type The post type.
616
+ */
617
+ $months = apply_filters( 'pre_months_dropdown_query', false, $post_type );
618
+
619
+ if ( ! is_array( $months ) ) {
620
+ $extra_checks = "AND post_status != 'auto-draft'";
621
+ if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
622
+ $extra_checks .= " AND post_status != 'trash'";
623
+ } elseif ( isset( $_GET['post_status'] ) ) {
624
+ $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
625
+ }
626
 
627
+ $months = $wpdb->get_results(
628
+ $wpdb->prepare(
629
+ "
630
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
631
+ FROM $wpdb->posts
632
+ WHERE post_type = %s
633
+ $extra_checks
634
+ ORDER BY post_date DESC
635
+ ",
636
+ $post_type
637
+ )
638
+ );
639
+ }
640
 
641
  /**
642
  * Filters the 'Months' drop-down results.
643
  *
644
  * @since 3.7.0
645
  *
646
+ * @param object[] $months Array of the months drop-down query results.
647
+ * @param string $post_type The post type.
648
  */
649
  $months = apply_filters( 'months_dropdown_results', $months, $post_type );
650
 
656
 
657
  $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
658
  ?>
659
+ <label for="filter-by-date" class="screen-reader-text"><?php echo get_post_type_object( $post_type )->labels->filter_by_date; ?></label>
660
  <select name="m" id="filter-by-date">
661
  <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
662
  <?php
682
  }
683
 
684
  /**
685
+ * Displays a view switcher.
686
  *
687
  * @since 3.1.0
688
  *
701
  $classes[] = 'current';
702
  $aria_current = ' aria-current="page"';
703
  }
704
+
705
  printf(
706
  "<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
707
+ esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ),
708
  implode( ' ', $classes ),
709
  $title
710
  );
715
  }
716
 
717
  /**
718
+ * Displays a comment count bubble.
719
  *
720
  * @since 3.1.0
721
  *
746
  $pending_comments_number
747
  );
748
 
 
749
  if ( ! $approved_comments && ! $pending_comments ) {
750
+ // No comments at all.
751
  printf(
752
  '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
753
  __( 'No comments' )
754
  );
755
+ } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
756
+ // Don't link the comment bubble for a trashed post.
757
+ printf(
758
+ '<span class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
759
+ $approved_comments_number,
760
+ $pending_comments ? $approved_phrase : $approved_only_phrase
761
+ );
762
  } elseif ( $approved_comments ) {
763
+ // Link the comment bubble to approved comments.
764
  printf(
765
  '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
766
  esc_url(
776
  $pending_comments ? $approved_phrase : $approved_only_phrase
777
  );
778
  } else {
779
+ // Don't link the comment bubble when there are no approved comments.
780
  printf(
781
  '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
782
  $approved_comments_number,
809
  }
810
 
811
  /**
812
+ * Gets the current page number.
813
  *
814
  * @since 3.1.0
815
  *
826
  }
827
 
828
  /**
829
+ * Gets the number of items to display on a single page.
830
  *
831
  * @since 3.1.0
832
  *
833
+ * @param string $option User option name.
834
+ * @param int $default_value Optional. The number of items to display. Default 20.
835
  * @return int
836
  */
837
+ protected function get_items_per_page( $option, $default_value = 20 ) {
838
  $per_page = (int) get_user_option( $option );
839
  if ( empty( $per_page ) || $per_page < 1 ) {
840
+ $per_page = $default_value;
841
  }
842
 
843
  /**
844
  * Filters the number of items to be displayed on each page of the list table.
845
  *
846
+ * The dynamic hook name, `$option`, refers to the `per_page` option depending
847
+ * on the type of list table in use. Possible filter names include:
848
+ *
849
+ * - `edit_comments_per_page`
850
+ * - `sites_network_per_page`
851
+ * - `site_themes_network_per_page`
852
+ * - `themes_network_per_page'`
853
+ * - `users_network_per_page`
854
+ * - `edit_post_per_page`
855
+ * - `edit_page_per_page'`
856
+ * - `edit_{$post_type}_per_page`
857
+ * - `edit_post_tag_per_page`
858
+ * - `edit_category_per_page`
859
+ * - `edit_{$taxonomy}_per_page`
860
+ * - `site_users_network_per_page`
861
+ * - `users_per_page`
862
  *
863
  * @since 2.9.0
864
  *
868
  }
869
 
870
  /**
871
+ * Displays the pagination.
872
  *
873
  * @since 3.1.0
874
  *
899
  $current = $this->get_pagenum();
900
  $removable_query_args = wp_removable_query_args();
901
 
902
+ $current_url = set_url_scheme( sanitize_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) );
903
 
904
  $current_url = remove_query_arg( $removable_query_args, $current_url );
905
 
913
  $disable_prev = false;
914
  $disable_next = false;
915
 
916
+ if ( 1 == $current ) {
917
  $disable_first = true;
918
  $disable_prev = true;
919
  }
920
+ if ( $total_pages == $current ) {
 
 
 
921
  $disable_last = true;
922
  $disable_next = true;
923
  }
 
 
 
924
 
925
  if ( $disable_first ) {
926
  $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
989
  if ( ! empty( $infinite_scroll ) ) {
990
  $pagination_links_class .= ' hide-if-js';
991
  }
992
+ $output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
993
 
994
  if ( $total_pages ) {
995
  $page_class = $total_pages < 2 ? ' one-page' : '';
1002
  }
1003
 
1004
  /**
1005
+ * Gets a list of columns.
1006
+ *
1007
+ * The format is:
1008
+ * - `'internal-name' => 'Title'`
1009
  *
1010
  * @since 3.1.0
1011
  * @abstract
1013
  * @return array
1014
  */
1015
  public function get_columns() {
1016
+ die( 'function WP_List_Table::get_columns() must be overridden in a subclass.' );
1017
  }
1018
 
1019
  /**
1020
+ * Gets a list of sortable columns.
 
 
 
1021
  *
1022
+ * The format is:
1023
+ * - `'internal-name' => 'orderby'`
1024
+ * - `'internal-name' => array( 'orderby', 'asc' )` - The second element sets the initial sorting order.
1025
+ * - `'internal-name' => array( 'orderby', true )` - The second element makes the initial order descending.
1026
  *
1027
  * @since 3.1.0
1028
  *
1083
  $columns = get_column_headers( $this->screen );
1084
  $default = $this->get_default_primary_column_name();
1085
 
1086
+ // If the primary column doesn't exist,
1087
+ // fall back to the first non-checkbox column.
1088
  if ( ! isset( $columns[ $default ] ) ) {
1089
+ $default = self::get_default_primary_column_name();
1090
  }
1091
 
1092
  /**
1107
  }
1108
 
1109
  /**
1110
+ * Gets a list of all, hidden, and sortable columns, with filter applied.
1111
  *
1112
  * @since 3.1.0
1113
  *
1114
  * @return array
1115
  */
1116
  protected function get_column_info() {
1117
+ // $_column_headers is already set / cached.
1118
  if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
1119
+ /*
1120
+ * Backward compatibility for `$_column_headers` format prior to WordPress 4.3.
1121
+ *
1122
+ * In WordPress 4.3 the primary column name was added as a fourth item in the
1123
+ * column headers property. This ensures the primary column name is included
1124
+ * in plugins setting the property directly in the three item format.
1125
+ */
1126
  $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
1127
  foreach ( $this->_column_headers as $key => $value ) {
1128
  $column_headers[ $key ] = $value;
1139
  * Filters the list table sortable columns for a specific screen.
1140
  *
1141
  * The dynamic portion of the hook name, `$this->screen->id`, refers
1142
+ * to the ID of the current screen.
1143
  *
1144
+ * @since 3.1.0
1145
  *
1146
  * @param array $sortable_columns An array of sortable columns.
1147
  */
1168
  }
1169
 
1170
  /**
1171
+ * Returns the number of visible columns.
1172
  *
1173
  * @since 3.1.0
1174
  *
1181
  }
1182
 
1183
  /**
1184
+ * Prints column headers, accounting for hidden and sortable columns.
1185
  *
1186
  * @since 3.1.0
1187
  *
1188
+ * @param bool $with_id Whether to set the ID attribute or not
 
 
1189
  */
1190
  public function print_column_headers( $with_id = true ) {
1191
  list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1192
 
1193
+ $current_url = set_url_scheme( sanitize_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) );
1194
  $current_url = remove_query_arg( 'paged', $current_url );
1195
 
1196
  if ( isset( $_GET['orderby'] ) ) {
1197
+ $current_orderby = sanitize_text_field($_GET['orderby']);
1198
  } else {
1199
  $current_orderby = '';
1200
  }
1208
  if ( ! empty( $columns['cb'] ) ) {
1209
  static $cb_counter = 1;
1210
  $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
1211
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
1212
  $cb_counter++;
1213
  }
1214
 
1215
  foreach ( $columns as $column_key => $column_display_name ) {
1216
  $class = array( 'manage-column', "column-$column_key" );
1217
 
1218
+ if ( in_array( $column_key, $hidden, true ) ) {
1219
  $class[] = 'hidden';
1220
  }
1221
 
1222
  if ( 'cb' === $column_key ) {
1223
  $class[] = 'check-column';
1224
+ } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
1225
  $class[] = 'num';
1226
  }
1227
 
1233
  list( $orderby, $desc_first ) = $sortable[ $column_key ];
1234
 
1235
  if ( $current_orderby === $orderby ) {
1236
+ $order = 'asc' === $current_order ? 'desc' : 'asc';
1237
+
1238
  $class[] = 'sorted';
1239
  $class[] = $current_order;
1240
  } else {
1241
+ $order = strtolower( $desc_first );
1242
+
1243
+ if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) {
1244
+ $order = $desc_first ? 'desc' : 'asc';
1245
+ }
1246
+
1247
  $class[] = 'sortable';
1248
+ $class[] = 'desc' === $order ? 'asc' : 'desc';
1249
  }
1250
 
1251
+ $column_display_name = sprintf(
1252
+ '<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
1253
+ esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ),
1254
+ $column_display_name
1255
+ );
1256
  }
1257
 
1258
  $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
1260
  $id = $with_id ? "id='$column_key'" : '';
1261
 
1262
  if ( ! empty( $class ) ) {
1263
+ $class = "class='" . implode( ' ', $class ) . "'";
1264
  }
1265
 
1266
  echo "<$tag $scope $id $class>$column_display_name</$tag>";
1308
  }
1309
 
1310
  /**
1311
+ * Gets a list of CSS classes for the WP_List_Table table tag.
1312
  *
1313
  * @since 3.1.0
1314
  *
1315
+ * @return string[] Array of CSS classes for the table tag.
1316
  */
1317
  protected function get_table_classes() {
1318
+ $mode = get_user_setting( 'posts_list_mode', 'list' );
1319
+
1320
+ $mode_class = esc_attr( 'table-view-' . $mode );
1321
+
1322
+ return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] );
1323
  }
1324
 
1325
  /**
1326
+ * Generates the table navigation above or below the table
1327
  *
1328
  * @since 3.1.0
1329
  * @param string $which
1351
  }
1352
 
1353
  /**
1354
+ * Extra controls to be displayed between bulk actions and pagination.
1355
  *
1356
  * @since 3.1.0
1357
  *
1360
  protected function extra_tablenav( $which ) {}
1361
 
1362
  /**
1363
+ * Generates the tbody element for the list table.
1364
  *
1365
  * @since 3.1.0
1366
  */
1375
  }
1376
 
1377
  /**
1378
+ * Generates the table rows.
1379
  *
1380
  * @since 3.1.0
1381
  */
1386
  }
1387
 
1388
  /**
1389
+ * Generates content for a single row of the table.
1390
  *
1391
  * @since 3.1.0
1392
  *
1393
+ * @param object|array $item The current item
1394
  */
1395
  public function single_row( $item ) {
1396
  echo '<tr>';
1399
  }
1400
 
1401
  /**
1402
+ * @param object|array $item
1403
  * @param string $column_name
1404
  */
1405
  protected function column_default( $item, $column_name ) {}
1406
 
1407
  /**
1408
+ * @param object|array $item
1409
  */
1410
  protected function column_cb( $item ) {}
1411
 
1412
  /**
1413
+ * Generates the columns for a single row of the table.
1414
  *
1415
  * @since 3.1.0
1416
  *
1417
+ * @param object|array $item The current item.
1418
  */
1419
  protected function single_row_columns( $item ) {
1420
  list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1425
  $classes .= ' has-row-actions column-primary';
1426
  }
1427
 
1428
+ if ( in_array( $column_name, $hidden, true ) ) {
1429
  $classes .= ' hidden';
1430
  }
1431
 
1432
  // Comments column uses HTML in the display name with screen reader text.
1433
+ // Strip tags to get closer to a user-friendly string.
1434
+ $data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"';
1435
 
1436
  $attributes = "class='$classes' $data";
1437
 
1466
  *
1467
  * @since 4.3.0
1468
  *
1469
+ * @param object|array $item The item being acted upon.
1470
+ * @param string $column_name Current column name.
1471
+ * @param string $primary Primary column name.
1472
+ * @return string The row actions HTML, or an empty string
1473
+ * if the current column is not the primary column.
1474
  */
1475
  protected function handle_row_actions( $item, $column_name, $primary ) {
1476
  return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
1477
  }
1478
 
1479
  /**
1480
+ * Handles an incoming ajax request (called from admin-ajax.php)
1481
  *
1482
  * @since 3.1.0
1483
  */
1511
  }
1512
 
1513
  /**
1514
+ * Sends required variables to JavaScript land.
1515
+ *
1516
+ * @since 3.1.0
1517
  */
1518
  public function _js_vars() {
1519
  $args = array(
lib/Cleantalk/ApbctWP/FindSpam/ListTable/Comments.php CHANGED
@@ -44,7 +44,7 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
44
  /**
45
  * CheckBox column
46
  *
47
- * @param object $item
48
  *
49
  * @psalm-suppress InvalidArrayAccess
50
  */
@@ -180,7 +180,7 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
180
  /**
181
  * Rest of columns
182
  *
183
- * @param object $item
184
  * @param string $column_name
185
  *
186
  * @return bool|string|void
44
  /**
45
  * CheckBox column
46
  *
47
+ * @param object|array $item
48
  *
49
  * @psalm-suppress InvalidArrayAccess
50
  */
180
  /**
181
  * Rest of columns
182
  *
183
+ * @param object|array $item
184
  * @param string $column_name
185
  *
186
  * @return bool|string|void
lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php CHANGED
@@ -54,7 +54,7 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
54
  /**
55
  * CheckBox column
56
  *
57
- * @param object $item
58
  *
59
  * @psalm-suppress InvalidArrayAccess
60
  */
@@ -128,7 +128,7 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
128
  /**
129
  * Rest of columns
130
  *
131
- * @param object $item
132
  * @param string $column_name
133
  *
134
  * @return bool|string|void
54
  /**
55
  * CheckBox column
56
  *
57
+ * @param object|array $item
58
  *
59
  * @psalm-suppress InvalidArrayAccess
60
  */
128
  /**
129
  * Rest of columns
130
  *
131
+ * @param object|array $item
132
  * @param string $column_name
133
  *
134
  * @return bool|string|void
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -16,6 +16,11 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
16
  */
17
  private $test;
18
 
 
 
 
 
 
19
  // Additional params
20
  private $sfw_counter = false;
21
  private $api_key = false;
@@ -84,9 +89,16 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
84
  $results = array();
85
  $status = 0;
86
 
 
 
 
 
87
  // Skip by cookie
88
  foreach ($this->ip_array as $current_ip) {
89
- if (strpos(Cookie::get('ct_sfw_pass_key'), md5($current_ip . $this->api_key)) === 0) {
 
 
 
90
  if (Cookie::get('ct_sfw_passed')) {
91
  if ( ! headers_sent()) {
92
  Cookie::set(
@@ -148,10 +160,10 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
148
  WHERE network IN (" . implode(',', $needles) . ")
149
  AND network = " . $current_ip_v4 . " & mask
150
  AND " . rand(1, 100000) . "
151
- ORDER BY mask DESC LIMIT 1"
152
  );
153
 
154
-
155
  if ( ! empty($db_results)) {
156
  foreach ($db_results as $db_result) {
157
  $result_entry = array(
@@ -164,15 +176,14 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
164
 
165
  if ((int)$db_result['status'] === 1) {
166
  $result_entry['status'] = 'PASS_SFW__BY_WHITELIST';
167
- if ( $_origin === 'sfw_test' ) {
168
- $result_entry['status'] = 'PASS_SFW__BY_STATUS';
169
- }
170
  break;
171
  }
172
  if ((int)$db_result['status'] === 0) {
173
  $this->blocked_ips[] = Helper::ipLong2ip($db_result['network']);
174
  $result_entry['status'] = 'DENY_SFW';
175
  }
 
 
176
  }
177
  } else {
178
  $result_entry = array(
@@ -183,6 +194,10 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
183
  }
184
 
185
  $results[] = $result_entry;
 
 
 
 
186
  }
187
 
188
  return $results;
@@ -299,6 +314,12 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
299
  '<a href="' . $result['ip'] . '" target="_blank">' . $result['ip'] . '</a>'
300
  );
301
 
 
 
 
 
 
 
302
  // Translation
303
  $replaces = array(
304
  '{SFW_DIE_NOTICE_IP}' => $block_message,
@@ -325,7 +346,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
325
  '{SERVICE_ID}' => $apbct->data['service_id'] . ', ' . $net_count,
326
  '{HOST}' => get_home_url() . ', ' . APBCT_VERSION,
327
  '{GENERATED}' => '<p>The page was generated at&nbsp;' . date('D, d M Y H:i:s') . '</p>',
328
- '{REQUEST_URI}' => Server::get('REQUEST_URI'),
329
 
330
  // Cookie
331
  '{COOKIE_PREFIX}' => '',
@@ -348,18 +369,12 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
348
  /**
349
  * Message about IP status
350
  */
351
- if (! empty(Get::get('sfw_test_ip'))) {
352
- $message_ip_status = __(
353
- 'IP in the common blacklist',
354
- 'cleantalk-spam-protect'
355
- );
356
  $message_ip_status_color = 'red';
357
 
358
- if ($result['status'] === 'PASS_SFW__BY_STATUS') {
359
- $message_ip_status = __(
360
- 'IP in the common whitelist',
361
- 'cleantalk-spam-protect'
362
- );
363
  $message_ip_status_color = 'green';
364
  }
365
 
16
  */
17
  private $test;
18
 
19
+ /**
20
+ * @var int
21
+ */
22
+ private $test_status;
23
+
24
  // Additional params
25
  private $sfw_counter = false;
26
  private $api_key = false;
89
  $results = array();
90
  $status = 0;
91
 
92
+ if ( $this->test ) {
93
+ unset($_COOKIE['ct_sfw_pass_key']);
94
+ }
95
+
96
  // Skip by cookie
97
  foreach ($this->ip_array as $current_ip) {
98
+ if (
99
+ isset($_COOKIE['ct_sfw_pass_key'])
100
+ && strpos($_COOKIE['ct_sfw_pass_key'], md5($current_ip . $this->api_key)) === 0
101
+ ) {
102
  if (Cookie::get('ct_sfw_passed')) {
103
  if ( ! headers_sent()) {
104
  Cookie::set(
160
  WHERE network IN (" . implode(',', $needles) . ")
161
  AND network = " . $current_ip_v4 . " & mask
162
  AND " . rand(1, 100000) . "
163
+ ORDER BY status DESC LIMIT 1"
164
  );
165
 
166
+ $test_status = 1;
167
  if ( ! empty($db_results)) {
168
  foreach ($db_results as $db_result) {
169
  $result_entry = array(
176
 
177
  if ((int)$db_result['status'] === 1) {
178
  $result_entry['status'] = 'PASS_SFW__BY_WHITELIST';
 
 
 
179
  break;
180
  }
181
  if ((int)$db_result['status'] === 0) {
182
  $this->blocked_ips[] = Helper::ipLong2ip($db_result['network']);
183
  $result_entry['status'] = 'DENY_SFW';
184
  }
185
+
186
+ $test_status = (int)$db_result['status'];
187
  }
188
  } else {
189
  $result_entry = array(
194
  }
195
 
196
  $results[] = $result_entry;
197
+
198
+ if ( $this->test && $_origin === 'sfw_test' ) {
199
+ $this->test_status = $test_status;
200
+ }
201
  }
202
 
203
  return $results;
314
  '<a href="' . $result['ip'] . '" target="_blank">' . $result['ip'] . '</a>'
315
  );
316
 
317
+ $request_uri = Server::get('REQUEST_URI');
318
+ if ( $this->test ) {
319
+ // Remove "sfw_test_ip" get parameter from the uri
320
+ $request_uri = preg_replace('%sfw_test_ip=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}&?%', '', $request_uri);
321
+ }
322
+
323
  // Translation
324
  $replaces = array(
325
  '{SFW_DIE_NOTICE_IP}' => $block_message,
346
  '{SERVICE_ID}' => $apbct->data['service_id'] . ', ' . $net_count,
347
  '{HOST}' => get_home_url() . ', ' . APBCT_VERSION,
348
  '{GENERATED}' => '<p>The page was generated at&nbsp;' . date('D, d M Y H:i:s') . '</p>',
349
+ '{REQUEST_URI}' => $request_uri,
350
 
351
  // Cookie
352
  '{COOKIE_PREFIX}' => '',
369
  /**
370
  * Message about IP status
371
  */
372
+ if ( $this->test ) {
373
+ $message_ip_status = __('IP in the common blacklist', 'cleantalk-spam-protect');
 
 
 
374
  $message_ip_status_color = 'red';
375
 
376
+ if ($this->test_status === 1) {
377
+ $message_ip_status = __('IP in the whitelist', 'cleantalk-spam-protect');
 
 
 
378
  $message_ip_status_color = 'green';
379
  }
380
 
lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html CHANGED
@@ -192,7 +192,11 @@
192
  }
193
 
194
  function get_current_url() {
195
- document.write(window.location.href);
 
 
 
 
196
  return null;
197
  }
198
  </script>
192
  }
193
 
194
  function get_current_url() {
195
+ var apbctSfwRandomGet = '';
196
+ if( +ctPublicFunctions.sfw__random_get ) {
197
+ apbctSfwRandomGet = '?sfw=pass' + Math.round(ct_date.getTime()/1000);
198
+ }
199
+ document.write(window.location.origin + window.location.pathname + apbctSfwRandomGet);
200
  return null;
201
  }
202
  </script>
lib/Cleantalk/ApbctWP/HTTP/Request.php CHANGED
@@ -57,6 +57,12 @@ class Request extends \Cleantalk\Common\HTTP\Request
57
  return new Response($response, []);
58
  }
59
 
 
 
 
 
 
 
60
  protected function requestMulti()
61
  {
62
  global $apbct;
@@ -87,10 +93,7 @@ class Request extends \Cleantalk\Common\HTTP\Request
87
 
88
  foreach ( $responses_raw as $response ) {
89
  if ( $response instanceof \Requests_Exception ) {
90
- /**
91
- * @psalm-suppress UndefinedPropertyFetch
92
- */
93
- $responses[$response->url] = new Response(['error' => $response->getMessage()], []);
94
  continue;
95
  }
96
  if ( $response instanceof \Requests_Response ) {
57
  return new Response($response, []);
58
  }
59
 
60
+ /**
61
+ * @inheritDoc
62
+ *
63
+ * @psalm-suppress InvalidReturnType
64
+ * @psalm-suppress InvalidReturnStatement
65
+ */
66
  protected function requestMulti()
67
  {
68
  global $apbct;
93
 
94
  foreach ( $responses_raw as $response ) {
95
  if ( $response instanceof \Requests_Exception ) {
96
+ $responses[$this->url] = new Response(['error' => $response->getMessage()], []);
 
 
 
97
  continue;
98
  }
99
  if ( $response instanceof \Requests_Response ) {
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -727,8 +727,10 @@ class State extends \Cleantalk\Common\State
727
  */
728
  public function __set($name, $value)
729
  {
 
 
730
  $this->storage[$name] = $value;
731
- if (isset($this->storage['data'][$name])) {
732
  $this->storage['data'][$name] = $value;
733
  }
734
  }
@@ -746,29 +748,25 @@ class State extends \Cleantalk\Common\State
746
  public function &__get($name)
747
  {
748
  // First check in storage
749
- if (isset($this->storage[$name])) {
750
  $option = $this->storage[$name];
751
-
752
- return $option;
753
  // Then in data
754
- } elseif (isset($this->storage['data'][$name])) {
755
  $this->$name = $this->storage['data'][$name];
756
  $option = $this->storage['data'][$name];
757
 
758
- return $option;
759
-
760
  // Otherwise, try to get it from db settings table
761
  // it will be arrayObject || scalar || null
762
  } else {
763
  $option = $this->getOption($name);
764
-
765
- return $option;
766
  }
 
 
767
  }
768
 
769
  public function __isset($name)
770
  {
771
- return isset($this->storage[$name]);
772
  }
773
 
774
  public function __unset($name)
727
  */
728
  public function __set($name, $value)
729
  {
730
+ $value = is_array($value) ? new ArrayObject($value) : $value;
731
+
732
  $this->storage[$name] = $value;
733
+ if ( isset($this->storage['data'][$name]) ) {
734
  $this->storage['data'][$name] = $value;
735
  }
736
  }
748
  public function &__get($name)
749
  {
750
  // First check in storage
751
+ if ( isset($this->storage[$name]) ) {
752
  $option = $this->storage[$name];
 
 
753
  // Then in data
754
+ } elseif ( isset($this->storage['data'][$name]) ) {
755
  $this->$name = $this->storage['data'][$name];
756
  $option = $this->storage['data'][$name];
757
 
 
 
758
  // Otherwise, try to get it from db settings table
759
  // it will be arrayObject || scalar || null
760
  } else {
761
  $option = $this->getOption($name);
 
 
762
  }
763
+
764
+ return $option;
765
  }
766
 
767
  public function __isset($name)
768
  {
769
+ return (bool) $this->$name;
770
  }
771
 
772
  public function __unset($name)
lib/Cleantalk/Common/Firewall.php CHANGED
@@ -48,7 +48,6 @@ class Firewall
48
  'DENY_ANTICRAWLER',
49
  'DENY_SFW',
50
  'PASS_SFW__BY_WHITELIST',
51
- 'PASS_SFW__BY_STATUS',
52
  // Highest
53
  );
54
 
@@ -137,7 +136,6 @@ class Firewall
137
  $result['status'],
138
  array(
139
  'PASS_SFW__BY_WHITELIST',
140
- 'PASS_SFW__BY_STATUS',
141
  'PASS_SFW',
142
  'PASS_ANTIFLOOD',
143
  'PASS_ANTICRAWLER',
@@ -168,11 +166,11 @@ class Firewall
168
  if (strpos($result['status'], 'DENY') !== false) {
169
  $this->fw_modules[$module_name]->actionsForDenied($result);
170
  $this->fw_modules[$module_name]->diePage($result);
171
- // Allowed
172
- } elseif ($result['status'] === 'PASS_SFW__BY_STATUS') {
173
- $this->fw_modules[$module_name]->actionsForPassed($result);
174
- $this->fw_modules[$module_name]->diePage($result);
175
  } else {
 
 
 
176
  $this->fw_modules[$module_name]->actionsForPassed($result);
177
  }
178
  }
48
  'DENY_ANTICRAWLER',
49
  'DENY_SFW',
50
  'PASS_SFW__BY_WHITELIST',
 
51
  // Highest
52
  );
53
 
136
  $result['status'],
137
  array(
138
  'PASS_SFW__BY_WHITELIST',
 
139
  'PASS_SFW',
140
  'PASS_ANTIFLOOD',
141
  'PASS_ANTICRAWLER',
166
  if (strpos($result['status'], 'DENY') !== false) {
167
  $this->fw_modules[$module_name]->actionsForDenied($result);
168
  $this->fw_modules[$module_name]->diePage($result);
169
+ // Allowed
 
 
 
170
  } else {
171
+ if ( Get::get('sfw_test_ip') ) {
172
+ $this->fw_modules[$module_name]->diePage($result);
173
+ }
174
  $this->fw_modules[$module_name]->actionsForPassed($result);
175
  }
176
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 6.0
6
  Requires PHP: 5.6
7
- Stable tag: 5.180.2
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -602,6 +602,22 @@ If your website has forms that send data to external sources, you can enable opt
602
 
603
  == Changelog ==
604
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
  = 5.180.2 Jul 04 2022 =
606
  #### SpamFireWall working fixed.
607
  * Fix. Updater. Updater actions moved from the hook "upgrader_process_complete"
4
  Requires at least: 3.0
5
  Tested up to: 6.0
6
  Requires PHP: 5.6
7
+ Stable tag: 5.181
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
602
 
603
  == Changelog ==
604
 
605
+ = 5.181 Jul 14 2022 =
606
+ #### One integration added, SFW testing page updated, code quality improved and some minor issues fixed.
607
+ * New. Integrations. WP User Meta integration.
608
+ * Upd. SFW. Testing page updated.
609
+ * Fix. WP discuzz integration. Check for spam if comment is edited.
610
+ * Fix. WP discuzz integration. Remove unnecessary data when check on comment edition.
611
+ * Fix. Admin banner. Security attention mark fixed.
612
+ * Fix. Code. Sanitizing incoming data.
613
+ * Fix. CSS. Fix stylesheet source name and minifed name.
614
+ * Fix. apcbt-public-bundle. New detection method for mailerlite classes to prevent default submit clicks.
615
+ * Fix. HTTP lib. Multi request error handling fixed.
616
+ * Fix: setting page JS key validating.
617
+ * Fix: Replace array_* function implemented on State properties.
618
+ * Mod: ApbctWP/State to use the direct equation on properties.
619
+ * Fix. Integrations. WPUserMeta. Added case of user-meta-pro
620
+
621
  = 5.180.2 Jul 04 2022 =
622
  #### SpamFireWall working fixed.
623
  * Fix. Updater. Updater actions moved from the hook "upgrader_process_complete"