Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.175

Version Description

Apr 14 2022 =

Integration added, typos fixed, user scanner improved and minor issues fixed.

  • New. Integration. Events Manager plugin integration implemented.
  • New. Code. New validate classes.
  • New. Code. New validate sub-classes in ApbctWP.
  • Upd. Readme. One more AntiSpam feature added.
  • Mod: PlansoFormBuilder integration
  • Fix. External forms. Capturing buffer fixed.
  • Fix. Integration. Simple Ajax Chat sending fixed.
  • Fix. Exclusions. Special flag to prevent exclusions implemented.
  • Fix. Getting key errors handle.
  • Fix. Getting key error output fixed.
  • Fix: Added VFB_Pro integration
  • Fix. Settings api. Long description for text fields implemented.
  • Fix. Settings. Long description for hoster api key removed.
  • Fix. Settings. Long descriptions UTM marks fixed.
  • Fix. Comments checker. Dates ranges fixed.
  • Fix. Code. Core based JqueryUI use on users/comments checking page.
  • Fix. Code. Moderate API answer fixed.
  • Fix. Code. Including assets fixed.
  • Fix. Text. Typos on company brand terms fixed.
  • Fix: Glitched redirect after plugin activation.
  • Fix. Settings. Hoster Access Key long description mark removed.
  • Fix: Filter visible fields for AvadaFormBuilder
  • Fix. Code. Using wrappers for calling global variables.
  • Fix. Code. Cookie secure attribute fixed.
  • Fix. Code. Refactoring the user scanning engine.
  • Fix. Cookie. Getting cookies fixed.
  • Upd. Settings. SFW long description added.
  • Upd. Localization. SFW, AC, AF titles is not localized now.
  • Fix. Common. Collecting visited urls fixed.
  • Fix. Integration. JP contact form checking JS fixed.
  • Fix. Integration. CF7 form checking JS fixed.
Download this release

Release Info

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

Code changes from version 5.174.1 to 5.175

Files changed (84) hide show
  1. cleantalk.php +71 -53
  2. inc/cleantalk-admin.php +36 -51
  3. inc/cleantalk-ajax.php +78 -62
  4. inc/cleantalk-common.php +11 -7
  5. inc/cleantalk-pluggable.php +26 -27
  6. inc/cleantalk-public-integrations.php +25 -18
  7. inc/cleantalk-public-validate.php +1 -1
  8. inc/cleantalk-public.php +63 -42
  9. inc/cleantalk-settings.php +65 -52
  10. inc/cleantalk-updater.php +1 -1
  11. js/apbct-fingerprint.min.js +1 -1
  12. js/apbct-fingerprint.min.js.map +1 -1
  13. js/apbct-public--alt.min.js +1 -1
  14. js/apbct-public--alt.min.js.map +1 -1
  15. js/apbct-public--functions.min.js +1 -1
  16. js/apbct-public--functions.min.js.map +1 -1
  17. js/apbct-public.min.js +1 -1
  18. js/apbct-public.min.js.map +1 -1
  19. js/cleantalk-admin-settings-page.min.js +1 -1
  20. js/cleantalk-admin-settings-page.min.js.map +1 -1
  21. js/cleantalk-admin.min.js +1 -1
  22. js/cleantalk-admin.min.js.map +1 -1
  23. js/cleantalk-comments-checkspam.min.js +1 -1
  24. js/cleantalk-comments-checkspam.min.js.map +1 -1
  25. js/cleantalk-comments-editscreen.min.js.map +1 -1
  26. js/cleantalk-dashboard-widget.min.js +1 -1
  27. js/cleantalk-dashboard-widget.min.js.map +1 -1
  28. js/cleantalk-modal.min.js +1 -1
  29. js/cleantalk-modal.min.js.map +1 -1
  30. js/cleantalk-public-admin.min.js +1 -1
  31. js/cleantalk-public-admin.min.js.map +1 -1
  32. js/cleantalk-users-checkspam.min.js +1 -1
  33. js/cleantalk-users-checkspam.min.js.map +1 -1
  34. js/cleantalk-users-editscreen.min.js +1 -1
  35. js/cleantalk_external.min.js +1 -1
  36. js/cleantalk_external.min.js.map +1 -1
  37. js/cleantalk_internal.min.js +1 -1
  38. js/cleantalk_internal.min.js.map +1 -1
  39. lib/Cleantalk/Antispam/Cleantalk.php +1 -1
  40. lib/Cleantalk/Antispam/CleantalkResponse.php +4 -4
  41. lib/Cleantalk/Antispam/DisableComments.php +1 -1
  42. lib/Cleantalk/Antispam/Integrations/ContactBank.php +4 -2
  43. lib/Cleantalk/Antispam/Integrations/ElfsightContactForm.php +4 -2
  44. lib/Cleantalk/Antispam/Integrations/EstimationForm.php +4 -2
  45. lib/Cleantalk/Antispam/Integrations/EventsManager.php +37 -0
  46. lib/Cleantalk/Antispam/Integrations/FluentForm.php +4 -2
  47. lib/Cleantalk/Antispam/Integrations/OvaLogin.php +5 -3
  48. lib/Cleantalk/Antispam/Integrations/PlansoFormBuilder.php +28 -0
  49. lib/Cleantalk/ApbctWP/API.php +2 -2
  50. lib/Cleantalk/ApbctWP/Activator.php +3 -3
  51. lib/Cleantalk/ApbctWP/AdminNotices.php +8 -5
  52. lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php +6 -4
  53. lib/Cleantalk/ApbctWP/CleantalkUpgrader.php +1 -1
  54. lib/Cleantalk/ApbctWP/DB.php +2 -2
  55. lib/Cleantalk/ApbctWP/Escape.php +104 -0
  56. lib/Cleantalk/ApbctWP/FindSpam/Checker.php +4 -15
  57. lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php +16 -14
  58. lib/Cleantalk/ApbctWP/FindSpam/ListTable/Comments.php +14 -11
  59. lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsLogs.php +5 -3
  60. lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php +17 -34
  61. lib/Cleantalk/ApbctWP/FindSpam/ListTable/UsersLogs.php +5 -3
  62. lib/Cleantalk/ApbctWP/FindSpam/ListTable/UsersScan.php +4 -10
  63. lib/Cleantalk/ApbctWP/FindSpam/Page.php +1 -1
  64. lib/Cleantalk/ApbctWP/FindSpam/UsersChecker.php +94 -149
  65. lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php +3 -2
  66. lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php +1 -1
  67. lib/Cleantalk/ApbctWP/Firewall/SFW.php +2 -2
  68. lib/Cleantalk/ApbctWP/Helper.php +3 -3
  69. lib/Cleantalk/ApbctWP/RemoteCalls.php +2 -2
  70. lib/Cleantalk/ApbctWP/Sanitize.php +142 -0
  71. lib/Cleantalk/ApbctWP/State.php +11 -7
  72. lib/Cleantalk/ApbctWP/UpdatePlugin/DbAnalyzer.php +3 -3
  73. lib/Cleantalk/ApbctWP/Validate.php +16 -0
  74. lib/Cleantalk/ApbctWP/Variables/Cookie.php +20 -24
  75. lib/Cleantalk/Common/API.php +3 -3
  76. lib/Cleantalk/Common/Compatibility.php +1 -1
  77. lib/Cleantalk/Common/Cron.php +1 -1
  78. lib/Cleantalk/Common/Escape.php +88 -0
  79. lib/Cleantalk/Common/Helper.php +3 -1
  80. lib/Cleantalk/Common/Sanitize.php +206 -0
  81. lib/Cleantalk/Common/Validate.php +88 -0
  82. lib/Cleantalk/Variables/Cookie.php +2 -2
  83. lib/Cleantalk/Variables/ServerVariables.php +20 -3
  84. readme.txt +36 -1
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.174.1
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -34,6 +34,7 @@ use Cleantalk\Common\DNS;
34
  use Cleantalk\Common\Firewall;
35
  use Cleantalk\Common\Schema;
36
  use Cleantalk\Variables\Get;
 
37
  use Cleantalk\Variables\Request;
38
  use Cleantalk\Variables\Server;
39
 
@@ -60,6 +61,9 @@ if ( preg_match('@^(\d+)\.(\d+)\.(\d{1,2})-(dev|fix)$@', $plugin_version__agent,
60
  define('APBCT_NAME', $plugin_info['Name']);
61
  define('APBCT_VERSION', $plugin_info['Version']);
62
  define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP path. Plugin root folder without '/'.
 
 
 
63
  define('APBCT_DIR_PATH', dirname(__FILE__) . '/'); //System path. Plugin root folder with '/'.
64
  define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
65
  define(
@@ -77,7 +81,7 @@ define('APBCT_SETTINGS', 'cleantalk_settings'); //Option name with plugi
77
  define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
78
  define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
79
 
80
- // Multisite
81
  define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
82
 
83
  // Different params
@@ -216,9 +220,9 @@ add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
216
 
217
  // Set cookie only for public pages and for non-AJAX requests
218
  if ( ! is_admin() && ! apbct_is_ajax() && ! defined('DOING_CRON')
219
- && empty($_POST['ct_checkjs_register_form']) // Buddy press registration fix
220
- && empty($_GET['ct_checkjs_search_default']) // Search form fix
221
- && empty($_POST['action']) //bbPress
222
  ) {
223
  add_action('template_redirect', 'apbct_cookie', 2);
224
  add_action('template_redirect', 'apbct_store__urls', 2);
@@ -231,7 +235,11 @@ if ( ! is_admin() && ! apbct_is_ajax() && ! defined('DOING_CRON')
231
  // Early checks
232
 
233
  // Iphorm
234
- if ( isset($_POST['iphorm_ajax'], $_POST['iphorm_id'], $_POST['iphorm_uid']) ) {
 
 
 
 
235
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
236
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
237
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
@@ -241,8 +249,8 @@ if ( isset($_POST['iphorm_ajax'], $_POST['iphorm_id'], $_POST['iphorm_uid']) ) {
241
 
242
  // Facebook
243
  if ( $apbct->settings['forms__general_contact_forms_test'] == 1
244
- && ( ! empty($_POST['action']) && $_POST['action'] === 'fb_intialize')
245
- && ! empty($_POST['FB_userdata'])
246
  ) {
247
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
248
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
@@ -328,6 +336,16 @@ $apbct_active_integrations = array(
328
  'setting' => 'forms__contact_forms_test',
329
  'ajax' => false
330
  ),
 
 
 
 
 
 
 
 
 
 
331
  );
332
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
333
 
@@ -335,8 +353,7 @@ new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct-
335
  if (
336
  apbct_is_in_uri('admin-ajax.php') &&
337
  sizeof($_POST) > 0 &&
338
- isset($_GET['action']) &&
339
- $_GET['action'] === 'ninja_forms_ajax_submit'
340
  ) {
341
  $_POST['action'] = 'ninja_forms_ajax_submit';
342
  }
@@ -483,7 +500,7 @@ if ( is_admin() || is_network_admin() ) {
483
  }
484
  }
485
 
486
- if ( apbct_is_ajax() || isset($_POST['cma-action']) ) {
487
  $_cleantalk_hooked_actions = array();
488
  $_cleantalk_ajax_actions_to_check = array();
489
 
@@ -493,11 +510,11 @@ if ( is_admin() || is_network_admin() ) {
493
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
494
 
495
  // Feedback for comments
496
- if ( isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment' ) {
497
  add_action('wp_ajax_nopriv_ct_feedback_comment', 'apbct_comment__send_feedback', 1);
498
  add_action('wp_ajax_ct_feedback_comment', 'apbct_comment__send_feedback', 1);
499
  }
500
- if ( isset($_POST['action']) && $_POST['action'] == 'ct_feedback_user' ) {
501
  add_action('wp_ajax_nopriv_ct_feedback_user', 'apbct_user__send_feedback', 1);
502
  add_action('wp_ajax_ct_feedback_user', 'apbct_user__send_feedback', 1);
503
  }
@@ -507,12 +524,12 @@ if ( is_admin() || is_network_admin() ) {
507
  // if Unknown action or Known action with mandatory check
508
  if (
509
  ( ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1) &&
510
- isset($_POST['action']) &&
511
  (
512
- ! in_array($_POST['action'], $_cleantalk_hooked_actions) ||
513
- in_array($_POST['action'], $_cleantalk_ajax_actions_to_check)
514
  ) &&
515
- ! in_array($_POST['action'], array_column($apbct_active_integrations, 'hook'))
516
  ) {
517
  add_action('plugins_loaded', 'ct_ajax_hook');
518
  }
@@ -547,9 +564,9 @@ if ( is_admin() || is_network_admin() ) {
547
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
548
  //Bitrix24 contact form
549
  if ( $apbct->settings['forms__general_contact_forms_test'] == 1 &&
550
- ! empty($_POST['your-phone']) &&
551
- ! empty($_POST['your-email']) &&
552
- ! empty($_POST['your-message'])
553
  ) {
554
  ct_contact_form_validate();
555
  }
@@ -590,7 +607,7 @@ if ( is_admin() || is_network_admin() ) {
590
  add_filter('wp_die_handler', 'apbct_comment__sanitize_data__before_wp_die', 1); // Check comments after validation
591
 
592
  // Registrations
593
- if ( ! isset($_POST['wp-submit']) ) {
594
  add_action('login_form_register', 'apbct_cookie');
595
  add_action('login_form_register', 'apbct_store__urls');
596
  }
@@ -600,7 +617,7 @@ if ( is_admin() || is_network_admin() ) {
600
  add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
601
  add_action('user_register', 'apbct_user_register');
602
 
603
- // Multisite registrations
604
  add_action('signup_extra_fields', 'ct_register_form');
605
  add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
606
 
@@ -611,8 +628,8 @@ if ( is_admin() || is_network_admin() ) {
611
  add_filter('wp_list_comments_args', 'ct_wp_list_comments_args');
612
 
613
  // Ait-Themes fix
614
- if ( isset($_GET['ait-action']) && $_GET['ait-action'] === 'register' ) {
615
- $tmp = $_POST['redirect_to'];
616
  unset($_POST['redirect_to']);
617
  ct_contact_form_validate();
618
  $_POST['redirect_to'] = $tmp;
@@ -642,10 +659,10 @@ function apbct_sfw__check()
642
  }
643
 
644
  // Skip the check
645
- if ( ! empty($_GET['access']) ) {
646
  $spbc_settings = get_option('spbc_settings');
647
  $spbc_key = ! empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
648
- if ( $_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key) ) {
649
  \Cleantalk\Variables\Cookie::set(
650
  'spbc_firewall_pass_key',
651
  md5(apbct_get_server_variable('REMOTE_ADDR') . $spbc_key),
@@ -748,8 +765,11 @@ function apbct_plugin_redirect()
748
  {
749
  global $apbct;
750
  wp_suspend_cache_addition(true);
751
- if ( get_option('ct_plugin_do_activation_redirect', false) && ! isset($_GET['activate-multi']) ) {
752
- delete_option('ct_plugin_do_activation_redirect');
 
 
 
753
  ct_account_status_check(null, false);
754
  apbct_sfw_update__init(3); // Updating SFW
755
  wp_redirect($apbct->settings_link);
@@ -853,7 +873,7 @@ function apbct_sfw_update__init($delay = 0)
853
  return false;
854
  }
855
 
856
- // Key is empty
857
  if ( ! $apbct->api_key && ! $apbct->ip_license ) {
858
  return array('error' => 'SFW UPDATE INIT: KEY_IS_EMPTY');
859
  }
@@ -1480,7 +1500,7 @@ function apbct_sfw_direct_update()
1480
 
1481
  $api_key = $apbct->api_key;
1482
 
1483
- // Key is empty
1484
  if ( empty($api_key) ) {
1485
  return array('error' => 'SFW DIRECT UPDATE: KEY_IS_EMPTY');
1486
  }
@@ -1678,7 +1698,7 @@ function apbct_antiflood__clear_table()
1678
  }
1679
 
1680
  /**
1681
- * Install plugin from wordpress catalog
1682
  *
1683
  * @param null|WP $_wp
1684
  * @param null|string|array $plugin
@@ -1690,7 +1710,7 @@ function apbct_rc__install_plugin($_wp = null, $plugin = null)
1690
  global $wp_version;
1691
 
1692
  if ( is_null($plugin) ) {
1693
- $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : null;
1694
  }
1695
 
1696
  if ( $plugin ) {
@@ -1748,7 +1768,7 @@ function apbct_rc__install_plugin($_wp = null, $plugin = null)
1748
  function apbct_rc__activate_plugin($plugin)
1749
  {
1750
  if ( ! $plugin ) {
1751
- $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : null;
1752
  }
1753
 
1754
  if ( $plugin ) {
@@ -1774,7 +1794,7 @@ function apbct_rc__activate_plugin($plugin)
1774
  }
1775
 
1776
  /**
1777
- * Uninstall plugin from wordpress catalog
1778
  *
1779
  * @param null $plugin
1780
  */
@@ -1783,14 +1803,14 @@ function apbct_rc__deactivate_plugin($plugin = null)
1783
  global $apbct;
1784
 
1785
  if ( is_null($plugin) ) {
1786
- $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : null;
1787
  }
1788
 
1789
  if ( $plugin ) {
1790
  // Switching complete deactivation for security
1791
- if ( $plugin === 'security-malware-firewall/security-malware-firewall.php' && ! empty($_GET['misc__complete_deactivation']) ) {
1792
  $spbc_settings = get_option('spbc_settings');
1793
- $spbc_settings['misc__complete_deactivation'] = (int)$_GET['misc__complete_deactivation'];
1794
  update_option('spbc_settings', $spbc_settings);
1795
  }
1796
 
@@ -1820,7 +1840,7 @@ function apbct_rc__deactivate_plugin($plugin = null)
1820
 
1821
 
1822
  /**
1823
- * Uninstall plugin from wordpress. Delete files.
1824
  *
1825
  * @param null $plugin
1826
  */
@@ -1829,14 +1849,14 @@ function apbct_rc__uninstall_plugin($plugin = null)
1829
  global $apbct;
1830
 
1831
  if ( is_null($plugin) ) {
1832
- $plugin = isset($_GET['plugin']) ? $_GET['plugin'] : null;
1833
  }
1834
 
1835
  if ( $plugin ) {
1836
  // Switching complete deactivation for security
1837
- if ( $plugin === 'security-malware-firewall/security-malware-firewall.php' && ! empty($_GET['misc__complete_deactivation']) ) {
1838
  $spbc_settings = get_option('spbc_settings');
1839
- $spbc_settings['misc__complete_deactivation'] = (int)$_GET['misc__complete_deactivation'];
1840
  update_option('spbc_settings', $spbc_settings);
1841
  }
1842
 
@@ -2094,7 +2114,7 @@ function apbct_rc__insert_auth_key($key, $plugin)
2094
  $data['key_is_ok'] = true;
2095
  update_option('spbc_data', $data);
2096
 
2097
- // Set key
2098
  $settings = get_option('spbc_settings', array());
2099
  $settings['spbc_key'] = $key;
2100
  update_option('spbc_settings', $settings);
@@ -2118,7 +2138,7 @@ function apbct_rc__insert_auth_key($key, $plugin)
2118
  }
2119
 
2120
  /**
2121
- * Putting Wordpress to maintenance mode.
2122
  * For given duration in seconds
2123
  *
2124
  * @param $duration
@@ -2239,8 +2259,6 @@ function apbct__hook__wp_logout__delete_trial_notice_cookie()
2239
 
2240
  /**
2241
  * Store URLs
2242
- *
2243
- * @ToDo need to be refactored psalm notices about InvalidArrayOffset
2244
  */
2245
  function apbct_store__urls()
2246
  {
@@ -2261,12 +2279,12 @@ function apbct_store__urls()
2261
  $site_url = parse_url(get_option('home'), PHP_URL_HOST);
2262
 
2263
  // Get already stored URLs
2264
- $urls = Cookie::get('apbct_urls', array(), 'array');
2265
- /** @psalm-suppress InvalidArrayOffset */
 
2266
  $urls[$current_url][] = time();
2267
 
2268
  // Rotating. Saving only latest 10
2269
- /** @psalm-suppress InvalidArrayOffset */
2270
  $urls[$current_url] = count($urls[$current_url]) > 5 ? array_slice(
2271
  $urls[$current_url],
2272
  1,
@@ -2275,7 +2293,7 @@ function apbct_store__urls()
2275
  $urls = count($urls) > 5 ? array_slice($urls, 1, 5) : $urls;
2276
 
2277
  // Saving
2278
- Cookie::set('apbct_urls', json_encode($urls), time() + 86400 * 3, '/', $site_url, null, true, 'Lax');
2279
 
2280
  // REFERER
2281
  // Get current referer
@@ -2338,7 +2356,7 @@ function apbct_cookie()
2338
  $domain = '';
2339
 
2340
  // Submit time
2341
- if ( empty($_POST['ct_multipage_form']) ) { // Do not start/reset page timer if it is multi page form (Gravity forms))
2342
  $apbct_timestamp = time();
2343
  Cookie::set('apbct_timestamp', (string)$apbct_timestamp, 0, '/', $domain, null, true);
2344
  $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
@@ -2397,8 +2415,8 @@ function apbct_cookies_test()
2397
  return 1;
2398
  }
2399
 
2400
- if ( isset($_COOKIE['apbct_cookies_test']) ) {
2401
- $cookie_test = json_decode(urldecode($_COOKIE['apbct_cookies_test']), true);
2402
 
2403
  if ( ! is_array($cookie_test) ) {
2404
  return 0;
@@ -2492,7 +2510,7 @@ function ct_mail_send_connection_report()
2492
  {
2493
  global $apbct;
2494
 
2495
- if ( ($apbct->settings['misc__send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || ! empty($_GET['ct_send_connection_report']) ) {
2496
  $to = "welcome@cleantalk.org";
2497
  $subject = "Connection report for " . apbct_get_server_variable('HTTP_HOST');
2498
  $message = '
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.175
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
34
  use Cleantalk\Common\Firewall;
35
  use Cleantalk\Common\Schema;
36
  use Cleantalk\Variables\Get;
37
+ use Cleantalk\Variables\Post;
38
  use Cleantalk\Variables\Request;
39
  use Cleantalk\Variables\Server;
40
 
61
  define('APBCT_NAME', $plugin_info['Name']);
62
  define('APBCT_VERSION', $plugin_info['Version']);
63
  define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP path. Plugin root folder without '/'.
64
+ define('APBCT_CSS_ASSETS_PATH', plugins_url('css', __FILE__)); //CSS assets path. Plugin root folder without '/'.
65
+ define('APBCT_JS_ASSETS_PATH', plugins_url('js', __FILE__)); //JS assets path. Plugin root folder without '/'.
66
+ define('APBCT_IMG_ASSETS_PATH', plugins_url('inc/images', __FILE__)); //IMAGES assets path. Plugin root folder without '/'.
67
  define('APBCT_DIR_PATH', dirname(__FILE__) . '/'); //System path. Plugin root folder with '/'.
68
  define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
69
  define(
81
  define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
82
  define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
83
 
84
+ // WordPress Multisite
85
  define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
86
 
87
  // Different params
220
 
221
  // Set cookie only for public pages and for non-AJAX requests
222
  if ( ! is_admin() && ! apbct_is_ajax() && ! defined('DOING_CRON')
223
+ && empty(Post::get('ct_checkjs_register_form')) // Buddy press registration fix
224
+ && empty(Get::get('ct_checkjs_search_default')) // Search form fix
225
+ && empty(Post::get('action')) //bbPress
226
  ) {
227
  add_action('template_redirect', 'apbct_cookie', 2);
228
  add_action('template_redirect', 'apbct_store__urls', 2);
235
  // Early checks
236
 
237
  // Iphorm
238
+ if (
239
+ Post::get('iphorm_ajax') !== '' &&
240
+ Post::get('iphorm_id') !== '' &&
241
+ Post::get('iphorm_uid') !== ''
242
+ ) {
243
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
244
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
245
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
249
 
250
  // Facebook
251
  if ( $apbct->settings['forms__general_contact_forms_test'] == 1
252
+ && ( Post::get('action') === 'fb_intialize')
253
+ && ! empty(Post::get('FB_userdata'))
254
  ) {
255
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
256
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
336
  'setting' => 'forms__contact_forms_test',
337
  'ajax' => false
338
  ),
339
+ 'EventsManager' => array(
340
+ 'hook' => 'em_booking_validate',
341
+ 'setting' => 'forms__contact_forms_test',
342
+ 'ajax' => false
343
+ ),
344
+ 'PlansoFormBuilder' => array(
345
+ 'hook' => 'psfb_validate_form_request',
346
+ 'setting' => 'forms__contact_forms_test',
347
+ 'ajax' => false
348
+ ),
349
  );
350
  new \Cleantalk\Antispam\Integrations($apbct_active_integrations, (array)$apbct->settings);
351
 
353
  if (
354
  apbct_is_in_uri('admin-ajax.php') &&
355
  sizeof($_POST) > 0 &&
356
+ Get::get('action') === 'ninja_forms_ajax_submit'
 
357
  ) {
358
  $_POST['action'] = 'ninja_forms_ajax_submit';
359
  }
500
  }
501
  }
502
 
503
+ if ( apbct_is_ajax() || Post::get('cma-action') !== '' ) {
504
  $_cleantalk_hooked_actions = array();
505
  $_cleantalk_ajax_actions_to_check = array();
506
 
510
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
511
 
512
  // Feedback for comments
513
+ if ( Post::get('action') === 'ct_feedback_comment' ) {
514
  add_action('wp_ajax_nopriv_ct_feedback_comment', 'apbct_comment__send_feedback', 1);
515
  add_action('wp_ajax_ct_feedback_comment', 'apbct_comment__send_feedback', 1);
516
  }
517
+ if ( Post::get('action') === 'ct_feedback_user' ) {
518
  add_action('wp_ajax_nopriv_ct_feedback_user', 'apbct_user__send_feedback', 1);
519
  add_action('wp_ajax_ct_feedback_user', 'apbct_user__send_feedback', 1);
520
  }
524
  // if Unknown action or Known action with mandatory check
525
  if (
526
  ( ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1) &&
527
+ Post::get('action') !== '' &&
528
  (
529
+ ! in_array(Post::get('action'), $_cleantalk_hooked_actions) ||
530
+ in_array(Post::get('action'), $_cleantalk_ajax_actions_to_check)
531
  ) &&
532
+ ! in_array(Post::get('action'), array_column($apbct_active_integrations, 'hook'))
533
  ) {
534
  add_action('plugins_loaded', 'ct_ajax_hook');
535
  }
564
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
565
  //Bitrix24 contact form
566
  if ( $apbct->settings['forms__general_contact_forms_test'] == 1 &&
567
+ ! empty(Post::get('your-phone')) &&
568
+ ! empty(Post::get('your-email')) &&
569
+ ! empty(Post::get('your-message'))
570
  ) {
571
  ct_contact_form_validate();
572
  }
607
  add_filter('wp_die_handler', 'apbct_comment__sanitize_data__before_wp_die', 1); // Check comments after validation
608
 
609
  // Registrations
610
+ if ( ! Post::get('wp-submit') ) {
611
  add_action('login_form_register', 'apbct_cookie');
612
  add_action('login_form_register', 'apbct_store__urls');
613
  }
617
  add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
618
  add_action('user_register', 'apbct_user_register');
619
 
620
+ // WordPress Multisite registrations
621
  add_action('signup_extra_fields', 'ct_register_form');
622
  add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
623
 
628
  add_filter('wp_list_comments_args', 'ct_wp_list_comments_args');
629
 
630
  // Ait-Themes fix
631
+ if ( Get::get('ait-action') === 'register' ) {
632
+ $tmp = Post::get('redirect_to');
633
  unset($_POST['redirect_to']);
634
  ct_contact_form_validate();
635
  $_POST['redirect_to'] = $tmp;
659
  }
660
 
661
  // Skip the check
662
+ if ( ! empty(Get::get('access')) ) {
663
  $spbc_settings = get_option('spbc_settings');
664
  $spbc_key = ! empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
665
+ if ( Get::get('access') === $apbct->api_key || ($spbc_key !== false && Get::get('access') === $spbc_key) ) {
666
  \Cleantalk\Variables\Cookie::set(
667
  'spbc_firewall_pass_key',
668
  md5(apbct_get_server_variable('REMOTE_ADDR') . $spbc_key),
765
  {
766
  global $apbct;
767
  wp_suspend_cache_addition(true);
768
+ if (
769
+ get_option('ct_plugin_do_activation_redirect', false) &&
770
+ delete_option('ct_plugin_do_activation_redirect') &&
771
+ ! Get::get('activate-multi')
772
+ ) {
773
  ct_account_status_check(null, false);
774
  apbct_sfw_update__init(3); // Updating SFW
775
  wp_redirect($apbct->settings_link);
873
  return false;
874
  }
875
 
876
+ // The Access key is empty
877
  if ( ! $apbct->api_key && ! $apbct->ip_license ) {
878
  return array('error' => 'SFW UPDATE INIT: KEY_IS_EMPTY');
879
  }
1500
 
1501
  $api_key = $apbct->api_key;
1502
 
1503
+ // The Access key is empty
1504
  if ( empty($api_key) ) {
1505
  return array('error' => 'SFW DIRECT UPDATE: KEY_IS_EMPTY');
1506
  }
1698
  }
1699
 
1700
  /**
1701
+ * Install plugin from WordPress catalog
1702
  *
1703
  * @param null|WP $_wp
1704
  * @param null|string|array $plugin
1710
  global $wp_version;
1711
 
1712
  if ( is_null($plugin) ) {
1713
+ $plugin = Get::get('plugin') ? (string) Get::get('plugin') : null;
1714
  }
1715
 
1716
  if ( $plugin ) {
1768
  function apbct_rc__activate_plugin($plugin)
1769
  {
1770
  if ( ! $plugin ) {
1771
+ $plugin = Get::get('plugin') ? (string) Get::get('plugin') : null;
1772
  }
1773
 
1774
  if ( $plugin ) {
1794
  }
1795
 
1796
  /**
1797
+ * Uninstall plugin from WordPress catalog
1798
  *
1799
  * @param null $plugin
1800
  */
1803
  global $apbct;
1804
 
1805
  if ( is_null($plugin) ) {
1806
+ $plugin = Get::get('plugin') ? (string) Get::get('plugin') : null;
1807
  }
1808
 
1809
  if ( $plugin ) {
1810
  // Switching complete deactivation for security
1811
+ if ( $plugin === 'security-malware-firewall/security-malware-firewall.php' && ! empty(Get::get('misc__complete_deactivation')) ) {
1812
  $spbc_settings = get_option('spbc_settings');
1813
+ $spbc_settings['misc__complete_deactivation'] = (int) Get::get('misc__complete_deactivation');
1814
  update_option('spbc_settings', $spbc_settings);
1815
  }
1816
 
1840
 
1841
 
1842
  /**
1843
+ * Uninstall plugin from WordPress. Delete files.
1844
  *
1845
  * @param null $plugin
1846
  */
1849
  global $apbct;
1850
 
1851
  if ( is_null($plugin) ) {
1852
+ $plugin = Get::get('plugin') ? (string) Get::get('plugin') : null;
1853
  }
1854
 
1855
  if ( $plugin ) {
1856
  // Switching complete deactivation for security
1857
+ if ( $plugin === 'security-malware-firewall/security-malware-firewall.php' && ! empty(Get::get('misc__complete_deactivation')) ) {
1858
  $spbc_settings = get_option('spbc_settings');
1859
+ $spbc_settings['misc__complete_deactivation'] = (int) Get::get('misc__complete_deactivation');
1860
  update_option('spbc_settings', $spbc_settings);
1861
  }
1862
 
2114
  $data['key_is_ok'] = true;
2115
  update_option('spbc_data', $data);
2116
 
2117
+ // Set Access key
2118
  $settings = get_option('spbc_settings', array());
2119
  $settings['spbc_key'] = $key;
2120
  update_option('spbc_settings', $settings);
2138
  }
2139
 
2140
  /**
2141
+ * Putting WordPress to maintenance mode.
2142
  * For given duration in seconds
2143
  *
2144
  * @param $duration
2259
 
2260
  /**
2261
  * Store URLs
 
 
2262
  */
2263
  function apbct_store__urls()
2264
  {
2279
  $site_url = parse_url(get_option('home'), PHP_URL_HOST);
2280
 
2281
  // Get already stored URLs
2282
+ $urls = Cookie::get('apbct_urls');
2283
+ $urls = $urls === '' ? [] : json_decode($urls, true);
2284
+
2285
  $urls[$current_url][] = time();
2286
 
2287
  // Rotating. Saving only latest 10
 
2288
  $urls[$current_url] = count($urls[$current_url]) > 5 ? array_slice(
2289
  $urls[$current_url],
2290
  1,
2293
  $urls = count($urls) > 5 ? array_slice($urls, 1, 5) : $urls;
2294
 
2295
  // Saving
2296
+ Cookie::set('apbct_urls', json_encode($urls, JSON_UNESCAPED_SLASHES), time() + 86400 * 3, '/', $site_url, null, true, 'Lax');
2297
 
2298
  // REFERER
2299
  // Get current referer
2356
  $domain = '';
2357
 
2358
  // Submit time
2359
+ if ( empty(Post::get('ct_multipage_form')) ) { // Do not start/reset page timer if it is multi page form (Gravity forms))
2360
  $apbct_timestamp = time();
2361
  Cookie::set('apbct_timestamp', (string)$apbct_timestamp, 0, '/', $domain, null, true);
2362
  $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
2415
  return 1;
2416
  }
2417
 
2418
+ if ( Cookie::get('apbct_cookies_test') ) {
2419
+ $cookie_test = json_decode(urldecode(Cookie::get('apbct_cookies_test')), true);
2420
 
2421
  if ( ! is_array($cookie_test) ) {
2422
  return 0;
2510
  {
2511
  global $apbct;
2512
 
2513
+ if ( ($apbct->settings['misc__send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || ! empty(Get::get('ct_send_connection_report')) ) {
2514
  $to = "welcome@cleantalk.org";
2515
  $subject = "Connection report for " . apbct_get_server_variable('HTTP_HOST');
2516
  $message = '
inc/cleantalk-admin.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
 
 
4
  use Cleantalk\Variables\Server;
5
 
6
  require_once('cleantalk-settings.php');
@@ -56,7 +58,7 @@ function apbct_add_buttons_to_comments_and_users($_unused_argument)
56
 
57
  echo '
58
  <a href="' . $button_url__check . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
59
- <img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
60
  ' . sprintf(__('Find spam %s', 'cleantalk-spam-protect'), $button_description) . '
61
  </a>
62
  ';
@@ -92,8 +94,7 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
92
  echo "<div id='ct_widget_wrapper'>";
93
  ?>
94
  <div class='ct_widget_top_links'>
95
- <img src="<?php
96
- echo plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif'); ?>" class='ct_preloader'>
97
  <?php
98
  echo sprintf(
99
  __("%sRefresh%s", 'cleantalk-spam-protect'),
@@ -111,7 +112,7 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
111
  <input type='hidden' name='ct_brief_refresh' value='1'>
112
  </form>
113
  <h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php
114
- _e('7 days anti-spam stats', 'cleantalk-spam-protect'); ?></h4>
115
  <div class='ct_widget_block ct_widget_chart_wrapper'>
116
  <div id='ct_widget_chart'></div>
117
  </div>
@@ -144,7 +145,7 @@ function ct_dashboard_statistics_widget_output($_post, $_callback_args)
144
  . '</h2>';
145
  if ( $apbct->user_token && ! $apbct->white_label ) {
146
  echo '<h2 class="ct_widget_activate_header">'
147
- . __('Please, visit your dashboard.', 'cleantalk-spam-protect')
148
  . '</h2>'
149
  . '<a target="_blank" href="https://cleantalk.org/my?user_token=' . $apbct->user_token . '&cp_mode=antispam">'
150
  . '<input class="ct_widget_button ct_widget_activate_button ct_widget_resolve_button" type="button" value="VISIT CONTROL PANEL">'
@@ -273,11 +274,11 @@ function apbct_admin__init()
273
  }
274
 
275
  // Getting dashboard widget statistics
276
- if ( ! empty($_POST['ct_brief_refresh']) ) {
277
  cleantalk_get_brief_data($apbct->api_key);
278
  }
279
 
280
- // Getting key like hoster. Only once!
281
  if (
282
  ! is_main_site() &&
283
  $apbct->white_label &&
@@ -354,7 +355,7 @@ function apbct_admin__plugin_action_links($links, $_file)
354
  function apbct_admin__register_plugin_links($links, $file, $plugin_data)
355
  {
356
  global $apbct;
357
- $plugin_name = $plugin_data['Name'] ?: 'Antispam by Cleantalk';
358
 
359
  //Return if it's not our plugin
360
  if ( $file != $apbct->base_name ) {
@@ -416,20 +417,20 @@ function apbct_admin__enqueue_scripts($hook)
416
  // Scripts to all admin pages
417
  wp_enqueue_script(
418
  'ct_admin_js_notices',
419
- plugins_url('/cleantalk-spam-protect/js/cleantalk-admin.min.js'),
420
  array(),
421
  APBCT_VERSION
422
  );
423
  wp_enqueue_style(
424
  'ct_admin_css',
425
- plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.min.css'),
426
  array(),
427
  APBCT_VERSION,
428
  'all'
429
  );
430
  wp_enqueue_style(
431
  'ct_icons',
432
- plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'),
433
  array(),
434
  APBCT_VERSION,
435
  'all'
@@ -448,14 +449,14 @@ function apbct_admin__enqueue_scripts($hook)
448
  if ( $hook == 'index.php' && apbct_is_user_role_in(array('administrator')) ) {
449
  wp_enqueue_style(
450
  'ct_admin_css_widget_dashboard',
451
- plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.min.css'),
452
  array(),
453
  APBCT_VERSION,
454
  'all'
455
  );
456
  wp_enqueue_style(
457
  'ct_icons',
458
- plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'),
459
  array(),
460
  APBCT_VERSION,
461
  'all'
@@ -463,13 +464,13 @@ function apbct_admin__enqueue_scripts($hook)
463
 
464
  wp_enqueue_script(
465
  'ct_gstatic_charts_loader',
466
- plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget--google-charts.min.js'),
467
  array(),
468
  APBCT_VERSION
469
  );
470
  wp_enqueue_script(
471
  'ct_admin_js_widget_dashboard',
472
- plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.min.js'),
473
  array('ct_gstatic_charts_loader'),
474
  APBCT_VERSION
475
  );
@@ -497,44 +498,29 @@ function apbct_admin__enqueue_scripts($hook)
497
 
498
  // SETTINGS's page JavaScript and CSS
499
  if ( $hook == 'settings_page_cleantalk' ) {
500
- // jQueryUI
501
- wp_enqueue_script(
502
- 'jqueryui',
503
- plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'),
504
- array('jquery'),
505
- '1.12.1'
506
- );
507
- wp_enqueue_style(
508
- 'jqueryui_css',
509
- plugins_url('/cleantalk-spam-protect/css/jquery-ui.min.css'),
510
- array(),
511
- '1.21.1',
512
- 'all'
513
- );
514
-
515
  wp_enqueue_script(
516
  'cleantalk_admin_js_settings_page',
517
- plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.min.js'),
518
  array(),
519
  APBCT_VERSION
520
  );
521
  wp_enqueue_style(
522
  'cleantalk_admin_css_settings_page',
523
- plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.min.css'),
524
  array(),
525
  APBCT_VERSION,
526
  'all'
527
  );
528
 
529
  wp_localize_script('cleantalk_admin_js_settings_page', 'ctSettingsPage', array(
530
- 'ct_subtitle' => $apbct->ip_license ? __('Hosting AntiSpam', 'cleantalk-spam-protect') : '',
531
  'ip_license' => $apbct->ip_license ? true : false,
532
  'key_changed' => ! empty($apbct->data['key_changed']) ? true : false,
533
  ));
534
 
535
  wp_enqueue_script(
536
  'cleantalk-modal',
537
- plugins_url('/cleantalk-spam-protect/js/cleantalk-modal.min.js'),
538
  array(),
539
  APBCT_VERSION
540
  );
@@ -544,7 +530,7 @@ function apbct_admin__enqueue_scripts($hook)
544
  if ( $hook == 'edit-comments.php' ) {
545
  wp_enqueue_script(
546
  'ct_comments_editscreen',
547
- plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-editscreen.min.js'),
548
  array(),
549
  APBCT_VERSION
550
  );
@@ -568,14 +554,14 @@ function apbct_admin__enqueue_scripts($hook)
568
  if ( $hook == 'users.php' ) {
569
  wp_enqueue_style(
570
  'ct_icons',
571
- plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'),
572
  array(),
573
  APBCT_VERSION,
574
  'all'
575
  );
576
  wp_enqueue_script(
577
  'ct_users_editscreen',
578
- plugins_url('/cleantalk-spam-protect/js/cleantalk-users-editscreen.min.js'),
579
  array(),
580
  APBCT_VERSION
581
  );
@@ -663,7 +649,7 @@ function apbct_admin__admin_bar__add_structure($wp_admin_bar)
663
  . '</div>',
664
  ));
665
 
666
- // Antispam
667
  // Install link
668
  if ( ! $spbc ) {
669
  $spbc_title = '<a>' . __('Security', 'security-malware-firewall') . '</a>';
@@ -699,14 +685,14 @@ function apbct_admin__admin_bar__prepare_counters()
699
  global $apbct;
700
 
701
  //Reset or create user counter
702
- if ( ! empty($_GET['ct_reset_user_counter']) ) {
703
  $apbct->data['user_counter']['accepted'] = 0;
704
  $apbct->data['user_counter']['blocked'] = 0;
705
  $apbct->data['user_counter']['since'] = date('d M');
706
  $apbct->saveData();
707
  }
708
  //Reset or create all counters
709
- if ( ! empty($_GET['ct_reset_all_counters']) ) {
710
  $apbct->data['admin_bar__sfw_counter'] = array('all' => 0, 'blocked' => 0);
711
  $apbct->data['admin_bar__all_time_counter'] = array('accepted' => 0, 'blocked' => 0);
712
  $apbct->data['user_counter'] = array(
@@ -770,7 +756,7 @@ function apbct_admin__admin_bar__add_counter($after)
770
 
771
  $counter__sum__layout = ($after ? ' / ' : '<div class="cleantalk_admin_bar__sum_counter">') .
772
  '<span title="' . __(
773
- 'All anti-spam events',
774
  'cleantalk-spam-protect'
775
  ) . '">' . $apbct->counter__sum . '</span>' .
776
  '</div>';
@@ -1088,9 +1074,9 @@ function apbct_comment__send_feedback(
1088
  check_ajax_referer('ct_secret_nonce', 'security');
1089
  }
1090
 
1091
- $comment_id = ! $comment_id && isset($_POST['comment_id']) ? $_POST['comment_id'] : false;
1092
- $comment_status = ! $comment_status && isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
1093
- $change_status = ! $change_status && isset($_POST['change_status']) ? $_POST['change_status'] : false;
1094
 
1095
  // If enter params is empty exit
1096
  if ( ! $comment_id || ! $comment_status ) {
@@ -1143,20 +1129,20 @@ function apbct_user__send_feedback($user_id = null, $status = null, $direct_call
1143
  check_ajax_referer('ct_secret_nonce', 'security');
1144
 
1145
  if ( ! $direct_call ) {
1146
- $user_id = $_POST['user_id'];
1147
- $status = $_POST['status'];
1148
  }
1149
 
1150
  $hash = get_user_meta($user_id, 'ct_hash', true);
1151
 
1152
  if ( $hash ) {
1153
- if ( $status == 'approve' || $status == 1 ) {
1154
  $result = ct_send_feedback($hash . ":1");
1155
- $result === true ? 1 : 0;
1156
  }
1157
- if ( $status == 'spam' || $status == 'disapprove' || $status == 0 ) {
1158
  $result = ct_send_feedback($hash . ":0");
1159
- $result === true ? 1 : 0;
1160
  }
1161
  } else {
1162
  $result = 'no_hash';
@@ -1165,7 +1151,6 @@ function apbct_user__send_feedback($user_id = null, $status = null, $direct_call
1165
  if ( ! $direct_call ) {
1166
  echo ! empty($result) ? $result : 0;
1167
  die();
1168
- } else {
1169
  }
1170
  }
1171
 
1
  <?php
2
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
4
+ use Cleantalk\Variables\Get;
5
+ use Cleantalk\Variables\Post;
6
  use Cleantalk\Variables\Server;
7
 
8
  require_once('cleantalk-settings.php');
58
 
59
  echo '
60
  <a href="' . $button_url__check . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
61
+ <img src="' . $apbct->logo__small__colored . '" alt="CleanTalk Anti-Spam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
62
  ' . sprintf(__('Find spam %s', 'cleantalk-spam-protect'), $button_description) . '
63
  </a>
64
  ';
94
  echo "<div id='ct_widget_wrapper'>";
95
  ?>
96
  <div class='ct_widget_top_links'>
97
+ <img src="<?php echo APBCT_IMG_ASSETS_PATH . '/preloader.gif'; ?>" class='ct_preloader'>
 
98
  <?php
99
  echo sprintf(
100
  __("%sRefresh%s", 'cleantalk-spam-protect'),
112
  <input type='hidden' name='ct_brief_refresh' value='1'>
113
  </form>
114
  <h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php
115
+ _e('7 days Anti-Spam stats', 'cleantalk-spam-protect'); ?></h4>
116
  <div class='ct_widget_block ct_widget_chart_wrapper'>
117
  <div id='ct_widget_chart'></div>
118
  </div>
145
  . '</h2>';
146
  if ( $apbct->user_token && ! $apbct->white_label ) {
147
  echo '<h2 class="ct_widget_activate_header">'
148
+ . __('Please, visit your Dashboard.', 'cleantalk-spam-protect')
149
  . '</h2>'
150
  . '<a target="_blank" href="https://cleantalk.org/my?user_token=' . $apbct->user_token . '&cp_mode=antispam">'
151
  . '<input class="ct_widget_button ct_widget_activate_button ct_widget_resolve_button" type="button" value="VISIT CONTROL PANEL">'
274
  }
275
 
276
  // Getting dashboard widget statistics
277
+ if ( (int) Post::get('ct_brief_refresh') === 1 ) {
278
  cleantalk_get_brief_data($apbct->api_key);
279
  }
280
 
281
+ // Getting Access key like a hoster. Only once!
282
  if (
283
  ! is_main_site() &&
284
  $apbct->white_label &&
355
  function apbct_admin__register_plugin_links($links, $file, $plugin_data)
356
  {
357
  global $apbct;
358
+ $plugin_name = $plugin_data['Name'] ?: 'Anti-Spam by CleanTalk';
359
 
360
  //Return if it's not our plugin
361
  if ( $file != $apbct->base_name ) {
417
  // Scripts to all admin pages
418
  wp_enqueue_script(
419
  'ct_admin_js_notices',
420
+ APBCT_JS_ASSETS_PATH . '/cleantalk-admin.min.js',
421
  array(),
422
  APBCT_VERSION
423
  );
424
  wp_enqueue_style(
425
  'ct_admin_css',
426
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-admin.min.css',
427
  array(),
428
  APBCT_VERSION,
429
  'all'
430
  );
431
  wp_enqueue_style(
432
  'ct_icons',
433
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-icons.min.css',
434
  array(),
435
  APBCT_VERSION,
436
  'all'
449
  if ( $hook == 'index.php' && apbct_is_user_role_in(array('administrator')) ) {
450
  wp_enqueue_style(
451
  'ct_admin_css_widget_dashboard',
452
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-dashboard-widget.min.css',
453
  array(),
454
  APBCT_VERSION,
455
  'all'
456
  );
457
  wp_enqueue_style(
458
  'ct_icons',
459
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-icons.min.css',
460
  array(),
461
  APBCT_VERSION,
462
  'all'
464
 
465
  wp_enqueue_script(
466
  'ct_gstatic_charts_loader',
467
+ APBCT_JS_ASSETS_PATH . '/cleantalk-dashboard-widget--google-charts.min.js',
468
  array(),
469
  APBCT_VERSION
470
  );
471
  wp_enqueue_script(
472
  'ct_admin_js_widget_dashboard',
473
+ APBCT_JS_ASSETS_PATH . '/cleantalk-dashboard-widget.min.js',
474
  array('ct_gstatic_charts_loader'),
475
  APBCT_VERSION
476
  );
498
 
499
  // SETTINGS's page JavaScript and CSS
500
  if ( $hook == 'settings_page_cleantalk' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
  wp_enqueue_script(
502
  'cleantalk_admin_js_settings_page',
503
+ APBCT_JS_ASSETS_PATH . '/cleantalk-admin-settings-page.min.js',
504
  array(),
505
  APBCT_VERSION
506
  );
507
  wp_enqueue_style(
508
  'cleantalk_admin_css_settings_page',
509
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-admin-settings-page.min.css',
510
  array(),
511
  APBCT_VERSION,
512
  'all'
513
  );
514
 
515
  wp_localize_script('cleantalk_admin_js_settings_page', 'ctSettingsPage', array(
516
+ 'ct_subtitle' => $apbct->ip_license ? __('Hosting Anti-Spam', 'cleantalk-spam-protect') : '',
517
  'ip_license' => $apbct->ip_license ? true : false,
518
  'key_changed' => ! empty($apbct->data['key_changed']) ? true : false,
519
  ));
520
 
521
  wp_enqueue_script(
522
  'cleantalk-modal',
523
+ APBCT_JS_ASSETS_PATH . '/cleantalk-modal.min.js',
524
  array(),
525
  APBCT_VERSION
526
  );
530
  if ( $hook == 'edit-comments.php' ) {
531
  wp_enqueue_script(
532
  'ct_comments_editscreen',
533
+ APBCT_JS_ASSETS_PATH . '/cleantalk-comments-editscreen.min.js',
534
  array(),
535
  APBCT_VERSION
536
  );
554
  if ( $hook == 'users.php' ) {
555
  wp_enqueue_style(
556
  'ct_icons',
557
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-icons.min.css',
558
  array(),
559
  APBCT_VERSION,
560
  'all'
561
  );
562
  wp_enqueue_script(
563
  'ct_users_editscreen',
564
+ APBCT_JS_ASSETS_PATH . '/cleantalk-users-editscreen.min.js',
565
  array(),
566
  APBCT_VERSION
567
  );
649
  . '</div>',
650
  ));
651
 
652
+ // Anti-Spam
653
  // Install link
654
  if ( ! $spbc ) {
655
  $spbc_title = '<a>' . __('Security', 'security-malware-firewall') . '</a>';
685
  global $apbct;
686
 
687
  //Reset or create user counter
688
+ if ( ! empty(Get::get('ct_reset_user_counter')) ) {
689
  $apbct->data['user_counter']['accepted'] = 0;
690
  $apbct->data['user_counter']['blocked'] = 0;
691
  $apbct->data['user_counter']['since'] = date('d M');
692
  $apbct->saveData();
693
  }
694
  //Reset or create all counters
695
+ if ( ! empty(Get::get('ct_reset_all_counters')) ) {
696
  $apbct->data['admin_bar__sfw_counter'] = array('all' => 0, 'blocked' => 0);
697
  $apbct->data['admin_bar__all_time_counter'] = array('accepted' => 0, 'blocked' => 0);
698
  $apbct->data['user_counter'] = array(
756
 
757
  $counter__sum__layout = ($after ? ' / ' : '<div class="cleantalk_admin_bar__sum_counter">') .
758
  '<span title="' . __(
759
+ 'All Anti-Spam events',
760
  'cleantalk-spam-protect'
761
  ) . '">' . $apbct->counter__sum . '</span>' .
762
  '</div>';
1074
  check_ajax_referer('ct_secret_nonce', 'security');
1075
  }
1076
 
1077
+ $comment_id = ! $comment_id && Post::get('comment_id') ? (int) Post::get('comment_id') : null;
1078
+ $comment_status = ! $comment_status && Post::get('comment_status') ? (string) Post::get('comment_status') : null;
1079
+ $change_status = ! $change_status && Post::get('change_status') ? (bool) Post::get('change_status') : false;
1080
 
1081
  // If enter params is empty exit
1082
  if ( ! $comment_id || ! $comment_status ) {
1129
  check_ajax_referer('ct_secret_nonce', 'security');
1130
 
1131
  if ( ! $direct_call ) {
1132
+ $user_id = (int) Post::get('user_id');
1133
+ $status = Post::get('status', null, 'word');
1134
  }
1135
 
1136
  $hash = get_user_meta($user_id, 'ct_hash', true);
1137
 
1138
  if ( $hash ) {
1139
+ if ( $status === 'approve' || $status === '1' ) {
1140
  $result = ct_send_feedback($hash . ":1");
1141
+ $result = $result === true ? 1 : 0;
1142
  }
1143
+ if ( $status === 'spam' || $status === 'disapprove' || $status === '0' ) {
1144
  $result = ct_send_feedback($hash . ":0");
1145
+ $result = $result === true ? 1 : 0;
1146
  }
1147
  } else {
1148
  $result = 'no_hash';
1151
  if ( ! $direct_call ) {
1152
  echo ! empty($result) ? $result : 0;
1153
  die();
 
1154
  }
1155
  }
1156
 
inc/cleantalk-ajax.php CHANGED
@@ -4,6 +4,7 @@
4
  * AJAX functions
5
  */
6
 
 
7
  use Cleantalk\Variables\Post;
8
 
9
  $_cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
@@ -62,7 +63,7 @@ add_action('wp_ajax_zn_do_login', 'ct_ajax_hook', 1);
62
  $_cleantalk_hooked_actions[] = 'zn_do_login';
63
 
64
  /*hooks for zn_do_login */
65
- if ( isset($_POST['action']) && $_POST['action'] === 'cscf-submitform' ) {
66
  add_filter('preprocess_comment', 'ct_ajax_hook', 1);
67
  $_cleantalk_hooked_actions[] = 'cscf-submitform';
68
  }
@@ -143,11 +144,11 @@ add_action('wp_ajax_nopriv_elementor_pro_forms_send_form', 'apbct_form__elemento
143
  */
144
  function ct_validate_email_ajaxlogin($email = null)
145
  {
146
- $email = is_null($email) ? $email : $_POST['email'];
147
- $email = sanitize_email($email);
148
  $is_good = ! ( ! filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email));
149
 
150
- if ( class_exists('AjaxLogin') && isset($_POST['action']) && $_POST['action'] === 'validate_email' ) {
151
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
152
  $sender_info['post_checkjs_passed'] = $checkjs;
153
  if ( $checkjs === null ) {
@@ -201,7 +202,7 @@ function ct_validate_email_ajaxlogin($email = null)
201
  */
202
  function ct_user_register_ajaxlogin($user_id)
203
  {
204
- if ( class_exists('AjaxLogin') && isset($_POST['action']) && $_POST['action'] === 'register_submit' ) {
205
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
206
  $sender_info['post_checkjs_passed'] = $checkjs;
207
  if ( $checkjs === null ) {
@@ -212,8 +213,8 @@ function ct_user_register_ajaxlogin($user_id)
212
  //Making a call
213
  $base_call_result = apbct_base_call(
214
  array(
215
- 'sender_email' => sanitize_email($_POST['email']),
216
- 'sender_nickname' => sanitize_email($_POST['login']),
217
  'sender_info' => $sender_info,
218
  'js_on' => $checkjs,
219
  ),
@@ -405,9 +406,9 @@ function ct_ajax_hook($message_obj = null)
405
  // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
406
  ( ! $apbct->settings['data__protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0) || // Logged in user
407
  apbct_exclusions_check__url() || // url exclusions
408
- (isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
409
- (isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
410
- isset($_POST['quform_submit']) || //QForms multi-paged form skip
411
  // QAEngine Theme fix
412
  ((string)current_filter() !== 'et_pre_insert_answer' &&
413
  (
@@ -415,9 +416,9 @@ function ct_ajax_hook($message_obj = null)
415
  (isset($message_obj['post_author']) && (int)$message_obj['post_author'] === 0)
416
  )
417
  ) ||
418
- (isset($_POST['action'], $_POST['arm_action']) && $_POST['action'] === 'arm_shortcode_form_ajax_action' && $_POST['arm_action'] === 'please-login') || //arm forms skip login
419
- (isset($_POST['action']) && $_POST['action'] === 'erf_login_user' && in_array('easy-registration-forms/erforms.php', apply_filters('active_plugins', get_option('active_plugins')))) || //Easy Registration Forms login form skip
420
- (isset($_POST['action'], $_POST['endpoint'], $_POST['method']) && $_POST['action'] === 'mailpoet' && $_POST['endpoint'] === 'ImportExport' && $_POST['method'] === 'processImport') //Mailpoet import
421
  ) {
422
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
423
 
@@ -457,33 +458,38 @@ function ct_ajax_hook($message_obj = null)
457
  }
458
 
459
  //CSCF fix
460
- if ( isset($_POST['action']) && $_POST['action'] === 'cscf-submitform' ) {
461
  $ct_post_temp[] = $message_obj['comment_author'];
462
  $ct_post_temp[] = $message_obj['comment_author_email'];
463
  $ct_post_temp[] = $message_obj['comment_content'];
464
  }
465
 
466
  //??? fix
467
- if ( isset($_POST['action'], $_POST['target']) && ($_POST['action'] === 'request_appointment' || $_POST['action'] === 'send_message') ) {
468
  $ct_post_temp = $_POST;
469
  $ct_post_temp['target'] = 1;
470
  }
471
 
472
  //UserPro fix
473
- if ( isset($_POST['action'], $_POST['template']) && $_POST['action'] === 'userpro_process_form' && $_POST['template'] === 'register' ) {
474
  $ct_post_temp = $_POST;
475
  $ct_post_temp['shortcode'] = '';
476
  }
477
  //Pre-filled form 426869223
478
- if ( isset($_POST['action'], $_POST['response-email-address'], $_POST['response-email-sender-address']) && $_POST['action'] === 'contact-owner:send' ) {
 
 
 
 
 
479
  unset($_POST['response-email-address']);
480
  unset($_POST['response-email-sender-address']);
481
  }
482
  //Reviewer fix
483
- if ( isset($_POST['action']) && $_POST['action'] === 'rwp_ajax_action_rating' ) {
484
- $ct_post_temp['name'] = $_POST['user_name'];
485
- $ct_post_temp['email'] = $_POST['user_email'];
486
- $ct_post_temp['comment'] = $_POST['comment'];
487
  }
488
  //Woocommerce checkout
489
  if ( Post::get('action') === 'woocommerce_checkout' || Post::get('action') === 'save_data' ) {
@@ -512,7 +518,7 @@ function ct_ajax_hook($message_obj = null)
512
  }
513
  }
514
  }
515
- if ( isset($_POST['action']) && $_POST['action'] === 'ufbl_front_form_action' ) {
516
  $ct_post_temp = $_POST;
517
  foreach ( $ct_post_temp as $key => $_value ) {
518
  if ( preg_match('/form_data_\d_name/', $key) ) {
@@ -523,11 +529,14 @@ function ct_ajax_hook($message_obj = null)
523
 
524
  // Kali form integration
525
  if (Post::hasString('action', 'kaliforms_form_process')) {
526
- $ct_post_temp = $_POST['data'];
527
  }
528
 
529
  // Fusion Builder Avada Form integration
530
- if (Post::hasString('action', 'fusion_form_submit_form_to_database_email')) {
 
 
 
531
  if (Post::get('formData')) {
532
  $form_data = Post::get('formData');
533
  $form_data = explode('&', $form_data);
@@ -578,7 +587,7 @@ function ct_ajax_hook($message_obj = null)
578
  }
579
 
580
  // Mailpoet3 admin skip fix
581
- if ( isset($_POST['action'], $_POST['method']) && $_POST['action'] === 'mailpoet' && $_POST['method'] === 'save' ) {
582
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
583
 
584
  return false;
@@ -631,78 +640,78 @@ function ct_ajax_hook($message_obj = null)
631
  $ct_result = $base_call_result['ct_result'];
632
 
633
  if ( $ct_result->allow == 0 ) {
634
- if ( isset($_POST['action']) && $_POST['action'] === 'wpuf_submit_register' ) {
635
  $result = array('success' => false, 'error' => $ct_result->comment);
636
  @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
637
  print json_encode($result);
638
  die();
639
  }
640
 
641
- if ( isset($_POST['action']) && $_POST['action'] === 'mymail_form_submit' ) {
642
  $result = array('success' => false, 'html' => $ct_result->comment);
643
  @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
644
  print json_encode($result);
645
  die();
646
  }
647
 
648
- if ( isset($_POST['action'], $_POST['task']) && $_POST['action'] === 'wysija_ajax' && $_POST['task'] !== 'send_preview' && $_POST['task'] !== 'send_test_mail' ) {
649
  $result = array('result' => false, 'msgs' => array('updated' => array($ct_result->comment)));
650
- print $_GET['callback'] . '(' . json_encode($result) . ');';
651
  die();
652
  }
653
 
654
- if ( isset($_POST['action']) && $_POST['action'] === 'cs_registration_validation' ) {
655
  $result = array("type" => "error", "message" => $ct_result->comment);
656
  print json_encode($result);
657
  die();
658
  }
659
 
660
- if ( isset($_POST['action']) && ($_POST['action'] === 'request_appointment' || $_POST['action'] === 'send_message') ) {
661
  print $ct_result->comment;
662
  die();
663
  }
664
 
665
- if ( isset($_POST['action']) && $_POST['action'] === 'zn_do_login' ) {
666
  print '<div id="login_error">' . $ct_result->comment . '</div>';
667
  die();
668
  }
669
 
670
- if ( isset($_POST['action']) && $_POST['action'] === 'vfb_submit' ) {
671
  $result = array('result' => false, 'message' => $ct_result->comment);
672
  @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
673
  print json_encode($result);
674
  die();
675
  }
676
 
677
- if ( isset($_POST['action']) && $_POST['action'] === 'woocommerce_checkout' ) {
678
  print $ct_result->comment;
679
  die();
680
  }
681
 
682
- if ( isset($_POST['cma-action']) && $_POST['cma-action'] === 'add' ) {
683
  $result = array('success' => 0, 'thread_id' => null, 'messages' => array($ct_result->comment));
684
  print json_encode($result);
685
  die();
686
  }
687
 
688
- if ( isset($_POST['action']) && $_POST['action'] === 'td_mod_register' ) {
689
  print json_encode(array('register', 0, $ct_result->comment));
690
  die();
691
  }
692
 
693
- if ( isset($_POST['action']) && $_POST['action'] === 'tmpl_ajax_check_user_email' ) {
694
  print "17,email";
695
  die();
696
  }
697
 
698
- if ( isset($_POST['action']) && ($_POST['action'] === 'tevolution_submit_from_preview' || $_POST['action'] === 'submit_form_recaptcha_validation') ) {
699
  print $ct_result->comment;
700
  die();
701
  }
702
 
703
  // WooWaitList
704
  // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
705
- if ( isset($_POST['action']) && $_POST['action'] === 'wew_save_to_db_callback' ) {
706
  $result = array();
707
  $result['error'] = 1;
708
  $result['message'] = $ct_result->comment;
@@ -712,9 +721,9 @@ function ct_ajax_hook($message_obj = null)
712
  }
713
 
714
  // UserPro
715
- if ( isset($_POST['action'], $_POST['template']) && $_POST['action'] === 'userpro_process_form' && $_POST['template'] === 'register' ) {
716
  foreach ( $_POST as $key => $value ) {
717
- $output[$key] = $value;
718
  }
719
  $output['template'] = $ct_result->comment;
720
  $output = json_encode($output);
@@ -723,7 +732,7 @@ function ct_ajax_hook($message_obj = null)
723
  }
724
 
725
  // Quick event manager
726
- if ( isset($_POST['action']) && $_POST['action'] === 'qem_validate_form' ) {
727
  $errors[] = 'registration_forbidden';
728
  $result = array(
729
  'success' => 'false',
@@ -735,7 +744,7 @@ function ct_ajax_hook($message_obj = null)
735
  }
736
 
737
  // Quick Contact Form
738
- if ( isset($_POST['action']) && $_POST['action'] === 'qcf_validate_form' ) {
739
  $result = array(
740
  'blurb' => "<h1>" . $ct_result->comment . "</h1>",
741
  'display' => "Oops, got a few problems here",
@@ -752,12 +761,17 @@ function ct_ajax_hook($message_obj = null)
752
  }
753
 
754
  // Usernoise Contact Form
755
- if ( isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']) ) {
 
 
 
 
 
756
  return array($ct_result->comment);
757
  }
758
 
759
  // amoForms
760
- if ( isset($_POST['action']) && $_POST['action'] === 'amoforms_submit' ) {
761
  $result = array(
762
  'result' => true,
763
  'type' => "html",
@@ -769,7 +783,7 @@ function ct_ajax_hook($message_obj = null)
769
  }
770
 
771
  // MailChimp for Wordpress Premium
772
- if ( ! empty($_POST['_mc4wp_form_id']) ) {
773
  return 'ct_mc4wp_response';
774
  }
775
 
@@ -779,7 +793,7 @@ function ct_ajax_hook($message_obj = null)
779
  }
780
 
781
  //ES Add subscriber
782
- if ( isset($_POST['action']) && $_POST['action'] === 'es_add_subscriber' ) {
783
  $result = array(
784
  'error' => 'unexpected-error',
785
  );
@@ -788,7 +802,7 @@ function ct_ajax_hook($message_obj = null)
788
  }
789
 
790
  //Convertplug. Strpos because action value dynamically changes and depends on mailing service
791
- if ( isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false ) {
792
  $result = array(
793
  'action' => "message",
794
  'detailed_msg' => "",
@@ -802,7 +816,7 @@ function ct_ajax_hook($message_obj = null)
802
  }
803
 
804
  // Ultimate Form Builder
805
- if ( isset($_POST['action']) && $_POST['action'] === 'ufbl_front_form_action' ) {
806
  $result = array(
807
  'error_keys' => array(),
808
  'error_flag' => 1,
@@ -813,7 +827,7 @@ function ct_ajax_hook($message_obj = null)
813
  }
814
 
815
  // Smart Forms
816
- if ( isset($_POST['action']) && $_POST['action'] === 'rednao_smart_forms_save_form_values' ) {
817
  $result = array(
818
  'message' => $ct_result->comment,
819
  'refreshCaptcha' => 'n',
@@ -824,10 +838,10 @@ function ct_ajax_hook($message_obj = null)
824
  }
825
 
826
  //cFormsII
827
- if ( isset($_POST['action']) && $_POST['action'] === 'submitcform' ) {
828
  header('Content-Type: application/json');
829
  $result = array(
830
- 'no' => isset($_POST['cforms_id']) ? $_POST['cforms_id'] : '',
831
  'result' => 'failure',
832
  'html' => $ct_result->comment,
833
  'hide' => false,
@@ -838,7 +852,7 @@ function ct_ajax_hook($message_obj = null)
838
  }
839
 
840
  //Contact Form by Web-Settler
841
- if ( isset($_POST['smFieldData']) ) {
842
  $result = array(
843
  'signal' => true,
844
  'code' => 0,
@@ -852,7 +866,7 @@ function ct_ajax_hook($message_obj = null)
852
  }
853
 
854
  //Reviewer
855
- if ( isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating' ) {
856
  $result = array(
857
  'success' => false,
858
  'data' => array(0 => $ct_result->comment)
@@ -863,9 +877,11 @@ function ct_ajax_hook($message_obj = null)
863
 
864
  // CouponXXL Theme
865
  if (
866
- isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) &&
867
- strpos($_POST['_wp_http_referer'], '/register/account') !== false &&
868
- $_POST['action'] === 'register'
 
 
869
  ) {
870
  $result = array(
871
  'message' => '<div class="alert alert-error">' . $ct_result->comment . '</div>',
@@ -874,7 +890,7 @@ function ct_ajax_hook($message_obj = null)
874
  }
875
 
876
  //ConvertPro
877
- if ( isset($_POST['action']) && ($_POST['action'] === 'cp_v2_notify_admin' || $_POST['action'] === 'cpro_notify_via_email') ) {
878
  $result = array(
879
  'success' => false,
880
  'data' => array('error' => $ct_result->comment, 'style_slug' => 'convertprot-form'),
@@ -884,7 +900,7 @@ function ct_ajax_hook($message_obj = null)
884
  }
885
 
886
  //Easy Forms for Mailchimp
887
- if ( isset($_POST['action']) && $_POST['action'] === 'process_form_submission' ) {
888
  wp_send_json_error(
889
  array(
890
  'error' => 1,
@@ -894,12 +910,12 @@ function ct_ajax_hook($message_obj = null)
894
  }
895
 
896
  //Optin wheel
897
- if ( isset($_POST['action']) && ($_POST['action'] === 'wof-lite-email-optin' || $_POST['action'] === 'wof-email-optin') ) {
898
  wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
899
  }
900
 
901
  // Forminator
902
- if ( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ) {
903
  wp_send_json_error(
904
  array(
905
  'message' => $ct_result->comment,
@@ -911,7 +927,7 @@ function ct_ajax_hook($message_obj = null)
911
  }
912
 
913
  // Easy Registration Form
914
- if ( isset($_POST['action']) && strpos($_POST['action'], 'erf_submit_form') !== false ) {
915
  wp_send_json_error(array(0 => array('username_error', $ct_result->comment)));
916
  }
917
 
4
  * AJAX functions
5
  */
6
 
7
+ use Cleantalk\Variables\Get;
8
  use Cleantalk\Variables\Post;
9
 
10
  $_cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
63
  $_cleantalk_hooked_actions[] = 'zn_do_login';
64
 
65
  /*hooks for zn_do_login */
66
+ if ( Post::get('action') === 'cscf-submitform' ) {
67
  add_filter('preprocess_comment', 'ct_ajax_hook', 1);
68
  $_cleantalk_hooked_actions[] = 'cscf-submitform';
69
  }
144
  */
145
  function ct_validate_email_ajaxlogin($email = null)
146
  {
147
+ $email = is_null($email) ? $email : Post::get('email');
148
+ $email = \Cleantalk\ApbctWP\Sanitize::cleanEmail($email);
149
  $is_good = ! ( ! filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email));
150
 
151
+ if ( class_exists('AjaxLogin') && Post::get('action') === 'validate_email' ) {
152
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
153
  $sender_info['post_checkjs_passed'] = $checkjs;
154
  if ( $checkjs === null ) {
202
  */
203
  function ct_user_register_ajaxlogin($user_id)
204
  {
205
+ if ( class_exists('AjaxLogin') && Post::get('action') === 'register_submit' ) {
206
  $checkjs = apbct_js_test('ct_checkjs', $_POST);
207
  $sender_info['post_checkjs_passed'] = $checkjs;
208
  if ( $checkjs === null ) {
213
  //Making a call
214
  $base_call_result = apbct_base_call(
215
  array(
216
+ 'sender_email' => Post::get('email', null, 'cleanEmail'),
217
+ 'sender_nickname' => Post::get('login', null, 'cleanEmail'),
218
  'sender_info' => $sender_info,
219
  'js_on' => $checkjs,
220
  ),
406
  // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
407
  ( ! $apbct->settings['data__protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0) || // Logged in user
408
  apbct_exclusions_check__url() || // url exclusions
409
+ (Post::get('action') && in_array(Post::get('action'), $skip_post)) || // Special params
410
+ (Get::get('action') && in_array(Get::get('action'), $skip_post)) || // Special params
411
+ Post::get('quform_submit') || //QForms multi-paged form skip
412
  // QAEngine Theme fix
413
  ((string)current_filter() !== 'et_pre_insert_answer' &&
414
  (
416
  (isset($message_obj['post_author']) && (int)$message_obj['post_author'] === 0)
417
  )
418
  ) ||
419
+ (Post::get('action') === 'arm_shortcode_form_ajax_action' && Post::get('arm_action') === 'please-login') || //arm forms skip login
420
+ (Post::get('action') === 'erf_login_user' && in_array('easy-registration-forms/erforms.php', apply_filters('active_plugins', get_option('active_plugins')))) || //Easy Registration Forms login form skip
421
+ (Post::get('action') === 'mailpoet' && Post::get('endpoint') === 'ImportExport' && Post::get('method') === 'processImport') //Mailpoet import
422
  ) {
423
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
424
 
458
  }
459
 
460
  //CSCF fix
461
+ if ( Post::get('action') === 'cscf-submitform' ) {
462
  $ct_post_temp[] = $message_obj['comment_author'];
463
  $ct_post_temp[] = $message_obj['comment_author_email'];
464
  $ct_post_temp[] = $message_obj['comment_content'];
465
  }
466
 
467
  //??? fix
468
+ if ( Post::get('target') && (Post::get('action') === 'request_appointment' || Post::get('action') === 'send_message') ) {
469
  $ct_post_temp = $_POST;
470
  $ct_post_temp['target'] = 1;
471
  }
472
 
473
  //UserPro fix
474
+ if ( Post::get('action') === 'userpro_process_form' && Post::get('template') === 'register' ) {
475
  $ct_post_temp = $_POST;
476
  $ct_post_temp['shortcode'] = '';
477
  }
478
  //Pre-filled form 426869223
479
+ if (
480
+ Post::get('action') !== '' &&
481
+ Post::get('response-email-address') !== '' &&
482
+ Post::get('response-email-sender-address') !== '' &&
483
+ Post::get('action') === 'contact-owner:send'
484
+ ) {
485
  unset($_POST['response-email-address']);
486
  unset($_POST['response-email-sender-address']);
487
  }
488
  //Reviewer fix
489
+ if ( Post::get('action') === 'rwp_ajax_action_rating' ) {
490
+ $ct_post_temp['name'] = Post::get('user_name');
491
+ $ct_post_temp['email'] = Post::get('user_email', null, 'cleanEmail');
492
+ $ct_post_temp['comment'] = Post::get('comment');
493
  }
494
  //Woocommerce checkout
495
  if ( Post::get('action') === 'woocommerce_checkout' || Post::get('action') === 'save_data' ) {
518
  }
519
  }
520
  }
521
+ if ( Post::get('action') === 'ufbl_front_form_action' ) {
522
  $ct_post_temp = $_POST;
523
  foreach ( $ct_post_temp as $key => $_value ) {
524
  if ( preg_match('/form_data_\d_name/', $key) ) {
529
 
530
  // Kali form integration
531
  if (Post::hasString('action', 'kaliforms_form_process')) {
532
+ $ct_post_temp = Post::get('data');
533
  }
534
 
535
  // Fusion Builder Avada Form integration
536
+ if (
537
+ Post::hasString('action', 'fusion_form_submit_form_to_database_email') ||
538
+ Post::hasString('action', 'fusion_form_submit_form_to_email')
539
+ ) {
540
  if (Post::get('formData')) {
541
  $form_data = Post::get('formData');
542
  $form_data = explode('&', $form_data);
587
  }
588
 
589
  // Mailpoet3 admin skip fix
590
+ if ( Post::get('action') === 'mailpoet' && Post::get('method') === 'save' ) {
591
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
592
 
593
  return false;
640
  $ct_result = $base_call_result['ct_result'];
641
 
642
  if ( $ct_result->allow == 0 ) {
643
+ if ( Post::get('action') === 'wpuf_submit_register' ) {
644
  $result = array('success' => false, 'error' => $ct_result->comment);
645
  @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
646
  print json_encode($result);
647
  die();
648
  }
649
 
650
+ if ( Post::get('action') === 'mymail_form_submit' ) {
651
  $result = array('success' => false, 'html' => $ct_result->comment);
652
  @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
653
  print json_encode($result);
654
  die();
655
  }
656
 
657
+ if ( Post::get('action') === 'wysija_ajax' && Post::get('task') !== 'send_preview' && Post::get('task') !== 'send_test_mail' ) {
658
  $result = array('result' => false, 'msgs' => array('updated' => array($ct_result->comment)));
659
+ print Get::get('callback') . '(' . json_encode($result) . ');';
660
  die();
661
  }
662
 
663
+ if ( Post::get('action') === 'cs_registration_validation' ) {
664
  $result = array("type" => "error", "message" => $ct_result->comment);
665
  print json_encode($result);
666
  die();
667
  }
668
 
669
+ if ( Post::get('action') === 'request_appointment' || Post::get('action') === 'send_message' ) {
670
  print $ct_result->comment;
671
  die();
672
  }
673
 
674
+ if ( Post::get('action') === 'zn_do_login' ) {
675
  print '<div id="login_error">' . $ct_result->comment . '</div>';
676
  die();
677
  }
678
 
679
+ if ( Post::get('action') === 'vfb_submit' ) {
680
  $result = array('result' => false, 'message' => $ct_result->comment);
681
  @header('Content-Type: application/json; charset=' . get_option('blog_charset'));
682
  print json_encode($result);
683
  die();
684
  }
685
 
686
+ if ( Post::get('action') === 'woocommerce_checkout' ) {
687
  print $ct_result->comment;
688
  die();
689
  }
690
 
691
+ if ( Post::get('cma-action') === 'add' ) {
692
  $result = array('success' => 0, 'thread_id' => null, 'messages' => array($ct_result->comment));
693
  print json_encode($result);
694
  die();
695
  }
696
 
697
+ if ( Post::get('action') === 'td_mod_register' ) {
698
  print json_encode(array('register', 0, $ct_result->comment));
699
  die();
700
  }
701
 
702
+ if ( Post::get('action') === 'tmpl_ajax_check_user_email' ) {
703
  print "17,email";
704
  die();
705
  }
706
 
707
+ if ( Post::get('action') === 'tevolution_submit_from_preview' || Post::get('action') === 'submit_form_recaptcha_validation' ) {
708
  print $ct_result->comment;
709
  die();
710
  }
711
 
712
  // WooWaitList
713
  // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
714
+ if ( Post::get('action') === 'wew_save_to_db_callback' ) {
715
  $result = array();
716
  $result['error'] = 1;
717
  $result['message'] = $ct_result->comment;
721
  }
722
 
723
  // UserPro
724
+ if ( Post::get('action') === 'userpro_process_form' && Post::get('template') === 'register' ) {
725
  foreach ( $_POST as $key => $value ) {
726
+ $output[\Cleantalk\ApbctWP\Sanitize::cleanXss($key)] = \Cleantalk\ApbctWP\Sanitize::cleanXss($value);
727
  }
728
  $output['template'] = $ct_result->comment;
729
  $output = json_encode($output);
732
  }
733
 
734
  // Quick event manager
735
+ if ( Post::get('action') === 'qem_validate_form' ) {
736
  $errors[] = 'registration_forbidden';
737
  $result = array(
738
  'success' => 'false',
744
  }
745
 
746
  // Quick Contact Form
747
+ if ( Post::get('action') === 'qcf_validate_form' ) {
748
  $result = array(
749
  'blurb' => "<h1>" . $ct_result->comment . "</h1>",
750
  'display' => "Oops, got a few problems here",
761
  }
762
 
763
  // Usernoise Contact Form
764
+ if (
765
+ Post::get('title') &&
766
+ Post::get('email') &&
767
+ Post::get('type') &&
768
+ Post::get('ct_checkjs')
769
+ ) {
770
  return array($ct_result->comment);
771
  }
772
 
773
  // amoForms
774
+ if ( Post::get('action') === 'amoforms_submit' ) {
775
  $result = array(
776
  'result' => true,
777
  'type' => "html",
783
  }
784
 
785
  // MailChimp for Wordpress Premium
786
+ if ( ! empty(Post::get('_mc4wp_form_id')) ) {
787
  return 'ct_mc4wp_response';
788
  }
789
 
793
  }
794
 
795
  //ES Add subscriber
796
+ if ( Post::get('action') === 'es_add_subscriber' ) {
797
  $result = array(
798
  'error' => 'unexpected-error',
799
  );
802
  }
803
 
804
  //Convertplug. Strpos because action value dynamically changes and depends on mailing service
805
+ if ( strpos(Post::get('action'), '_add_subscriber') !== false ) {
806
  $result = array(
807
  'action' => "message",
808
  'detailed_msg' => "",
816
  }
817
 
818
  // Ultimate Form Builder
819
+ if ( Post::get('action') === 'ufbl_front_form_action' ) {
820
  $result = array(
821
  'error_keys' => array(),
822
  'error_flag' => 1,
827
  }
828
 
829
  // Smart Forms
830
+ if ( Post::get('action') === 'rednao_smart_forms_save_form_values' ) {
831
  $result = array(
832
  'message' => $ct_result->comment,
833
  'refreshCaptcha' => 'n',
838
  }
839
 
840
  //cFormsII
841
+ if ( Post::get('action') === 'submitcform' ) {
842
  header('Content-Type: application/json');
843
  $result = array(
844
+ 'no' => Post::get('cforms_id', null, 'xss'),
845
  'result' => 'failure',
846
  'html' => $ct_result->comment,
847
  'hide' => false,
852
  }
853
 
854
  //Contact Form by Web-Settler
855
+ if ( Post::get('smFieldData') ) {
856
  $result = array(
857
  'signal' => true,
858
  'code' => 0,
866
  }
867
 
868
  //Reviewer
869
+ if ( Post::get('action') === 'rwp_ajax_action_rating' ) {
870
  $result = array(
871
  'success' => false,
872
  'data' => array(0 => $ct_result->comment)
877
 
878
  // CouponXXL Theme
879
  if (
880
+ Post::get('_wp_http_referer') &&
881
+ Post::get('register_field') &&
882
+ Post::get('action') &&
883
+ strpos(Post::get('_wp_http_referer'), '/register/account') !== false &&
884
+ Post::get('action') === 'register'
885
  ) {
886
  $result = array(
887
  'message' => '<div class="alert alert-error">' . $ct_result->comment . '</div>',
890
  }
891
 
892
  //ConvertPro
893
+ if ( Post::get('action') === 'cp_v2_notify_admin' || Post::get('action') === 'cpro_notify_via_email' ) {
894
  $result = array(
895
  'success' => false,
896
  'data' => array('error' => $ct_result->comment, 'style_slug' => 'convertprot-form'),
900
  }
901
 
902
  //Easy Forms for Mailchimp
903
+ if ( Post::get('action') === 'process_form_submission' ) {
904
  wp_send_json_error(
905
  array(
906
  'error' => 1,
910
  }
911
 
912
  //Optin wheel
913
+ if ( Post::get('action') === 'wof-lite-email-optin' || Post::get('action') === 'wof-email-optin' ) {
914
  wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
915
  }
916
 
917
  // Forminator
918
+ if ( strpos(Post::get('action'), 'forminator_submit') !== false ) {
919
  wp_send_json_error(
920
  array(
921
  'message' => $ct_result->comment,
927
  }
928
 
929
  // Easy Registration Form
930
+ if ( strpos(Post::get('action'), 'erf_submit_form') !== false ) {
931
  wp_send_json_error(array(0 => array('username_error', $ct_result->comment)));
932
  }
933
 
inc/cleantalk-common.php CHANGED
@@ -330,6 +330,10 @@ function apbct_exclusions_check($func = null)
330
  {
331
  global $apbct;
332
 
 
 
 
 
333
  // Common exclusions
334
  if (
335
  apbct_exclusions_check__ip() ||
@@ -487,8 +491,8 @@ function apbct_get_sender_info()
487
  $visible_fields_collection = '';
488
  if ( Cookie::getVisibleFields() ) {
489
  $visible_fields_collection = Cookie::getVisibleFields();
490
- } elseif ( isset($_POST['apbct_visible_fields']) ) {
491
- $visible_fields_collection = stripslashes($_POST['apbct_visible_fields']);
492
  }
493
 
494
  $visible_fields = apbct_visible_fields__process($visible_fields_collection);
@@ -501,7 +505,7 @@ function apbct_get_sender_info()
501
  'USER_AGENT' => apbct_get_server_variable('HTTP_USER_AGENT'),
502
  'page_url' => apbct_sender_info___get_page_url(),
503
  'cms_lang' => substr(get_locale(), 0, 2),
504
- 'ct_options' => json_encode($apbct->settings),
505
  'fields_number' => sizeof($_POST),
506
  'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
507
  // Raw data to validated JavaScript test in the cloud
@@ -778,7 +782,7 @@ function ct_get_admin_email()
778
  // WPMS - Main site, common account
779
  $admin_email = get_site_option('admin_email');
780
  } else {
781
- // WPMS - Individual account, individual key
782
  $admin_email = get_blog_option(get_current_blog_id(), 'admin_email');
783
  }
784
 
@@ -793,7 +797,7 @@ function ct_get_admin_email()
793
  }
794
 
795
  /**
796
- * Inner function - Current Cleantalk working server info
797
  * @return array Array of server data
798
  */
799
  function ct_get_server()
@@ -834,7 +838,7 @@ function ct_hash($new_hash = '')
834
  /**
835
  * Inner function - Write manual moderation results to PHP sessions
836
  *
837
- * @param string $hash Cleantalk comment hash
838
  * @param string $message comment_content
839
  * @param int $allow flag good comment (1) or bad (0)
840
  *
@@ -1025,7 +1029,7 @@ function apbct_is_regexp($regexp)
1025
 
1026
  function cleantalk_debug($key, $value)
1027
  {
1028
- if ( isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']) ) {
1029
  @header($key . ": " . $value);
1030
  }
1031
  }
330
  {
331
  global $apbct;
332
 
333
+ if ( Post::get('apbct_do_not_exclude') ) {
334
+ return false;
335
+ }
336
+
337
  // Common exclusions
338
  if (
339
  apbct_exclusions_check__ip() ||
491
  $visible_fields_collection = '';
492
  if ( Cookie::getVisibleFields() ) {
493
  $visible_fields_collection = Cookie::getVisibleFields();
494
+ } elseif ( Post::get('apbct_visible_fields') ) {
495
+ $visible_fields_collection = stripslashes(Post::get('apbct_visible_fields'));
496
  }
497
 
498
  $visible_fields = apbct_visible_fields__process($visible_fields_collection);
505
  'USER_AGENT' => apbct_get_server_variable('HTTP_USER_AGENT'),
506
  'page_url' => apbct_sender_info___get_page_url(),
507
  'cms_lang' => substr(get_locale(), 0, 2),
508
+ 'ct_options' => json_encode($apbct->settings, JSON_UNESCAPED_SLASHES),
509
  'fields_number' => sizeof($_POST),
510
  'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
511
  // Raw data to validated JavaScript test in the cloud
782
  // WPMS - Main site, common account
783
  $admin_email = get_site_option('admin_email');
784
  } else {
785
+ // WPMS - Individual account, individual Access key
786
  $admin_email = get_blog_option(get_current_blog_id(), 'admin_email');
787
  }
788
 
797
  }
798
 
799
  /**
800
+ * Inner function - Current CleanTalk working server info
801
  * @return array Array of server data
802
  */
803
  function ct_get_server()
838
  /**
839
  * Inner function - Write manual moderation results to PHP sessions
840
  *
841
+ * @param string $hash CleanTalk comment hash
842
  * @param string $message comment_content
843
  * @param int $allow flag good comment (1) or bad (0)
844
  *
1029
 
1030
  function cleantalk_debug($key, $value)
1031
  {
1032
+ if ( Cookie::get('cleantalk_debug')) {
1033
  @header($key . ": " . $value);
1034
  }
1035
  }
inc/cleantalk-pluggable.php CHANGED
@@ -346,8 +346,8 @@ function apbct_is_ajax()
346
  apbct_get_server_variable('HTTP_X_REQUESTED_WITH') &&
347
  strtolower(apbct_get_server_variable('HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest'
348
  ) || // by Request type
349
- ! empty($_POST['quform_ajax']) || // special. QForms
350
- ! empty($_POST['iphorm_ajax']); // special. IPHorm
351
  }
352
 
353
  /**
@@ -434,7 +434,7 @@ function apbct_is_in_uri($str)
434
 
435
  /**
436
  * Checking if current request is a cron job
437
- * Support for wordpress < 4.8.0
438
  *
439
  * @return bool
440
  * @psalm-suppress RedundantCondition
@@ -495,8 +495,8 @@ function apbct_is_direct_trackback()
495
  return
496
  Server::hasString('REQUEST_URI', '/trackback') &&
497
  isset($_POST) &&
498
- isset($_POST['url']) && ! empty($_POST['url']) &&
499
- isset($_POST['title']) && ! empty($_POST['title']);
500
  }
501
 
502
  /**
@@ -570,45 +570,38 @@ function apbct_is_skip_request($ajax = false)
570
 
571
  // Bookly Plugin admin actions skip
572
  if ( apbct_is_plugin_active('bookly-responsive-appointment-booking-tool/main.php') &&
573
- isset($_POST['action']) &&
574
- strpos($_POST['action'], 'bookly') !== false &&
575
- is_admin() ) {
576
  return 'bookly_pro_update_staff_advanced';
577
  }
578
  // Youzier login form skip
579
  if ( apbct_is_plugin_active('youzer/youzer.php') &&
580
- isset($_POST['action']) &&
581
- $_POST['action'] === 'yz_ajax_login' ) {
582
  return 'youzier_login_form';
583
  }
584
  // Youzify login form skip
585
  if ( apbct_is_plugin_active('youzify/youzify.php') &&
586
- isset($_POST['action']) &&
587
- $_POST['action'] === 'youzify_ajax_login' ) {
588
  return 'youzify_login_form';
589
  }
590
  // InJob theme lost password skip
591
  if ( apbct_is_plugin_active('iwjob/iwjob.php') &&
592
- isset($_POST['action']) &&
593
- $_POST['action'] === 'iwj_lostpass' ) {
594
  return 'injob_theme_plugin';
595
  }
596
  // Divi builder skip
597
  if ( apbct_is_theme_active('Divi') &&
598
- isset($_POST['action']) &&
599
- ($_POST['action'] === 'save_epanel' || $_POST['action'] === 'et_fb_ajax_save') ) {
600
  return 'divi_builder_skip';
601
  }
602
  // Email Before Download plugin https://wordpress.org/plugins/email-before-download/ action skip
603
  if ( apbct_is_plugin_active('email-before-download/email-before-download.php') &&
604
- isset($_POST['action']) &&
605
- $_POST['action'] === 'ebd_inline_links' ) {
606
  return 'ebd_inline_links';
607
  }
608
  // WP Discuz skip service requests. The plugin have the direct integration
609
  if ( apbct_is_plugin_active('wpdiscuz/class.WpdiscuzCore.php') &&
610
- isset($_POST['action']) &&
611
- strpos($_POST['action'], 'wpd') !== false ) {
612
  return 'ebd_inline_links';
613
  }
614
  // Exception for plugin https://ru.wordpress.org/plugins/easy-login-woocommerce/ login form
@@ -628,8 +621,7 @@ function apbct_is_skip_request($ajax = false)
628
  }
629
  // Newspaper theme login form
630
  if ( apbct_is_theme_active('Newspaper') &&
631
- isset($_POST['action']) &&
632
- ($_POST['action'] == 'td_mod_login' || $_POST['action'] == 'td_mod_remember_pass') ) {
633
  return 'Newspaper_theme_login_form';
634
  }
635
  // Save abandoned cart checking skip
@@ -694,14 +686,12 @@ function apbct_is_skip_request($ajax = false)
694
 
695
  // W2DC - https://codecanyon.net/item/web-20-directory-plugin-for-wordpress/6463373
696
  if ( apbct_is_plugin_active('w2dc/w2dc.php') &&
697
- isset($_POST['action']) &&
698
- $_POST['action'] === 'vp_w2dc_ajax_vpt_option_save' &&
699
  is_admin() ) {
700
  return 'w2dc_skipped';
701
  }
702
  if ( (apbct_is_plugin_active('elementor/elementor.php') || apbct_is_plugin_active('elementor-pro/elementor-pro.php')) &&
703
- isset($_POST['actions_save_builder_action']) &&
704
- $_POST['actions_save_builder_action'] === 'save_builder' &&
705
  is_admin() ) {
706
  return 'elementor_skip';
707
  }
@@ -827,7 +817,7 @@ function apbct_is_skip_request($ajax = false)
827
  }
828
  // UltimateMember password reset skip
829
  if ( apbct_is_plugin_active('ultimate-member/ultimate-member.php') &&
830
- isset($_POST['_um_password_reset']) && $_POST['_um_password_reset'] == 1 ) {
831
  return 'ultimatemember_password_reset';
832
  }
833
  // UltimateMember password reset skip
@@ -917,6 +907,15 @@ function apbct_is_skip_request($ajax = false)
917
  }
918
  }
919
 
 
 
 
 
 
 
 
 
 
920
  return false;
921
  }
922
 
346
  apbct_get_server_variable('HTTP_X_REQUESTED_WITH') &&
347
  strtolower(apbct_get_server_variable('HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest'
348
  ) || // by Request type
349
+ ! empty(Post::get('quform_ajax')) || // special. QForms
350
+ ! empty(Post::get('iphorm_ajax')); // special. IPHorm
351
  }
352
 
353
  /**
434
 
435
  /**
436
  * Checking if current request is a cron job
437
+ * Support for WordPress < 4.8.0
438
  *
439
  * @return bool
440
  * @psalm-suppress RedundantCondition
495
  return
496
  Server::hasString('REQUEST_URI', '/trackback') &&
497
  isset($_POST) &&
498
+ ! empty(Post::get('url')) &&
499
+ ! empty(Post::get('title'));
500
  }
501
 
502
  /**
570
 
571
  // Bookly Plugin admin actions skip
572
  if ( apbct_is_plugin_active('bookly-responsive-appointment-booking-tool/main.php') &&
573
+ strpos(Post::get('action'), 'bookly') !== false &&
574
+ is_admin() ) {
 
575
  return 'bookly_pro_update_staff_advanced';
576
  }
577
  // Youzier login form skip
578
  if ( apbct_is_plugin_active('youzer/youzer.php') &&
579
+ Post::get('action') === 'yz_ajax_login' ) {
 
580
  return 'youzier_login_form';
581
  }
582
  // Youzify login form skip
583
  if ( apbct_is_plugin_active('youzify/youzify.php') &&
584
+ Post::get('action') === 'youzify_ajax_login' ) {
 
585
  return 'youzify_login_form';
586
  }
587
  // InJob theme lost password skip
588
  if ( apbct_is_plugin_active('iwjob/iwjob.php') &&
589
+ Post::get('action') === 'iwj_lostpass' ) {
 
590
  return 'injob_theme_plugin';
591
  }
592
  // Divi builder skip
593
  if ( apbct_is_theme_active('Divi') &&
594
+ (Post::get('action') === 'save_epanel' || Post::get('action') === 'et_fb_ajax_save') ) {
 
595
  return 'divi_builder_skip';
596
  }
597
  // Email Before Download plugin https://wordpress.org/plugins/email-before-download/ action skip
598
  if ( apbct_is_plugin_active('email-before-download/email-before-download.php') &&
599
+ Post::get('action') === 'ebd_inline_links' ) {
 
600
  return 'ebd_inline_links';
601
  }
602
  // WP Discuz skip service requests. The plugin have the direct integration
603
  if ( apbct_is_plugin_active('wpdiscuz/class.WpdiscuzCore.php') &&
604
+ strpos(Post::get('action'), 'wpd') !== false ) {
 
605
  return 'ebd_inline_links';
606
  }
607
  // Exception for plugin https://ru.wordpress.org/plugins/easy-login-woocommerce/ login form
621
  }
622
  // Newspaper theme login form
623
  if ( apbct_is_theme_active('Newspaper') &&
624
+ (Post::get('action') === 'td_mod_login' || Post::get('action') === 'td_mod_remember_pass') ) {
 
625
  return 'Newspaper_theme_login_form';
626
  }
627
  // Save abandoned cart checking skip
686
 
687
  // W2DC - https://codecanyon.net/item/web-20-directory-plugin-for-wordpress/6463373
688
  if ( apbct_is_plugin_active('w2dc/w2dc.php') &&
689
+ Post::get('action') === 'vp_w2dc_ajax_vpt_option_save' &&
 
690
  is_admin() ) {
691
  return 'w2dc_skipped';
692
  }
693
  if ( (apbct_is_plugin_active('elementor/elementor.php') || apbct_is_plugin_active('elementor-pro/elementor-pro.php')) &&
694
+ Post::get('actions_save_builder_action') === 'save_builder' &&
 
695
  is_admin() ) {
696
  return 'elementor_skip';
697
  }
817
  }
818
  // UltimateMember password reset skip
819
  if ( apbct_is_plugin_active('ultimate-member/ultimate-member.php') &&
820
+ (int) Post::get('_um_password_reset') === 1 ) {
821
  return 'ultimatemember_password_reset';
822
  }
823
  // UltimateMember password reset skip
907
  }
908
  }
909
 
910
+ // Event Manager - there is the direct integration
911
+ if (
912
+ apbct_is_plugin_active('events-manager/events-manager.php') &&
913
+ Post::get('action') === 'booking_add' &&
914
+ wp_verify_nonce(Post::get('_wpnonce'), 'booking_add')
915
+ ) {
916
+ return 'Event Manager skip';
917
+ }
918
+
919
  return false;
920
  }
921
 
inc/cleantalk-public-integrations.php CHANGED
@@ -3,7 +3,9 @@
3
  use Cleantalk\ApbctWP\Helper;
4
  use Cleantalk\ApbctWP\State;
5
  use Cleantalk\ApbctWP\Variables\Cookie;
 
6
  use Cleantalk\Variables\Post;
 
7
  use Cleantalk\Variables\Server;
8
 
9
  // MailChimp Premium for Wordpress
@@ -443,7 +445,7 @@ function apbct_search_add_noindex()
443
  return;
444
  }
445
 
446
- echo '<!-- meta by Cleantalk AntiSpam Protection plugin -->' . "\n";
447
  echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
448
  }
449
 
@@ -1222,8 +1224,8 @@ function ct_login_message($message)
1222
  global $errors, $apbct, $apbct_cookie_register_ok_label;
1223
 
1224
  if ( $apbct->settings['forms__registrations_test'] != 0 ) {
1225
- if ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
1226
- if ( isset($_COOKIE[$apbct_cookie_register_ok_label]) ) {
1227
  if ( is_wp_error($errors) ) {
1228
  $errors->add(
1229
  'ct_message',
@@ -1548,11 +1550,11 @@ function apbct_registration__Wordpress__changeMailNotification(
1548
 
1549
  $wp_new_user_notification_email_admin['message'] = PHP_EOL
1550
  . __(
1551
- 'CleanTalk AntiSpam: This registration is spam.',
1552
  'cleantalk-spam-protect'
1553
  )
1554
  . "\n" . __(
1555
- 'CleanTalk\'s anti-spam database:',
1556
  'cleantalk-spam-protect'
1557
  )
1558
  . "\n" . 'IP: ' . $apbct->sender_ip
@@ -1757,7 +1759,8 @@ function ct_contact_form_is_spam($form)
1757
  'sender_nickname' => $sender_nickname,
1758
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1759
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1760
- 'js_on' => apbct_js_test($js_field_name, $_POST),
 
1761
  )
1762
  );
1763
  $ct_result = $base_call_result['ct_result'];
@@ -1780,7 +1783,7 @@ function ct_contact_form_is_spam($form)
1780
  */
1781
  function ct_contact_form_is_spam_jetpack($_is_spam, $form)
1782
  {
1783
- global $apbct, $ct_comment;
1784
 
1785
  if ( $apbct->settings['forms__contact_forms_test'] == 0 ) {
1786
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
@@ -1795,6 +1798,7 @@ function ct_contact_form_is_spam_jetpack($_is_spam, $form)
1795
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1796
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1797
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
 
1798
  )
1799
  );
1800
  $ct_result = $base_call_result['ct_result'];
@@ -1877,8 +1881,7 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null)
1877
  return $spam;
1878
  }
1879
 
1880
- $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST) ?: apbct_js_test('ct_checkjs', $_COOKIE, true);
1881
-
1882
  /**
1883
  * Filter for POST
1884
  */
@@ -1967,8 +1970,8 @@ function apbct_form__contactForm7__changeMailNotification($component)
1967
  global $apbct;
1968
 
1969
  $component['body'] =
1970
- __('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
1971
- . PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
1972
  . PHP_EOL . 'IP: ' . $apbct->sender_ip
1973
  . PHP_EOL . 'Email: ' . $apbct->sender_email
1974
  . PHP_EOL . sprintf(
@@ -2016,7 +2019,7 @@ function apbct_form__ninjaForms__testSpam()
2016
 
2017
  // Choosing between POST and GET
2018
  $params = ct_get_fields_any(
2019
- isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $input_array
2020
  );
2021
 
2022
  $sender_email = $params['email'] ?: '';
@@ -2180,7 +2183,7 @@ function apbct_form__seedprod_coming_soon__testSpam()
2180
  . "</h1><h2>" . $ct_result->comment . "</h2>"
2181
  );
2182
 
2183
- echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
2184
  exit();
2185
  }
2186
  }
@@ -2200,8 +2203,8 @@ function apbct_form__ninjaForms__changeMailNotification($message, $_data, $actio
2200
  $message .= wpautop(
2201
  PHP_EOL . '---'
2202
  . PHP_EOL
2203
- . __('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2204
- . PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2205
  . PHP_EOL . 'IP: ' . $apbct->sender_ip
2206
  . PHP_EOL . 'Email: ' . $apbct->sender_email
2207
  . PHP_EOL .
@@ -2421,8 +2424,8 @@ function apbct_form__WPForms__changeMailNotification($message, $_wpforms_email)
2421
  PHP_EOL
2422
  . '---'
2423
  . PHP_EOL
2424
- . __('CleanTalk AntiSpam: This message is spam.', 'cleantalk-spam-protect')
2425
- . PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
2426
  . PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
2427
  . PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
2428
  . PHP_EOL
@@ -3202,7 +3205,11 @@ function apbct_custom_forms_trappings()
3202
  }
3203
 
3204
  // Registration form of eMember plugin
3205
- if ( $apbct->settings['forms__registrations_test'] && isset($_REQUEST['emember-form-builder-submit']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'emember-form-builder-nonce') ) {
 
 
 
 
3206
  return true;
3207
  }
3208
 
3
  use Cleantalk\ApbctWP\Helper;
4
  use Cleantalk\ApbctWP\State;
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
  // MailChimp Premium for Wordpress
445
  return;
446
  }
447
 
448
+ echo '<!-- meta by CleanTalk Anti-Spam Protection plugin -->' . "\n";
449
  echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
450
  }
451
 
1224
  global $errors, $apbct, $apbct_cookie_register_ok_label;
1225
 
1226
  if ( $apbct->settings['forms__registrations_test'] != 0 ) {
1227
+ if ( 'registered' === Get::get('checkemail') ) {
1228
+ if ( Cookie::get($apbct_cookie_register_ok_label) ) {
1229
  if ( is_wp_error($errors) ) {
1230
  $errors->add(
1231
  'ct_message',
1550
 
1551
  $wp_new_user_notification_email_admin['message'] = PHP_EOL
1552
  . __(
1553
+ 'CleanTalk Anti-Spam: This registration is spam.',
1554
  'cleantalk-spam-protect'
1555
  )
1556
  . "\n" . __(
1557
+ 'CleanTalk\'s Anti-Spam database:',
1558
  'cleantalk-spam-protect'
1559
  )
1560
  . "\n" . 'IP: ' . $apbct->sender_ip
1759
  'sender_nickname' => $sender_nickname,
1760
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1761
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1762
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test($ct_checkjs_jpcf, $_POST),
1763
+
1764
  )
1765
  );
1766
  $ct_result = $base_call_result['ct_result'];
1783
  */
1784
  function ct_contact_form_is_spam_jetpack($_is_spam, $form)
1785
  {
1786
+ global $apbct, $ct_comment, $ct_checkjs_jpcf;
1787
 
1788
  if ( $apbct->settings['forms__contact_forms_test'] == 0 ) {
1789
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
1798
  'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
1799
  'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
1800
  'sender_info' => array('sender_url' => @$form['comment_author_url']),
1801
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test($ct_checkjs_jpcf, $_POST),
1802
  )
1803
  );
1804
  $ct_result = $base_call_result['ct_result'];
1881
  return $spam;
1882
  }
1883
 
1884
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test($ct_checkjs_cf7, $_POST);
 
1885
  /**
1886
  * Filter for POST
1887
  */
1970
  global $apbct;
1971
 
1972
  $component['body'] =
1973
+ __('CleanTalk Anti-Spam: This message is spam.', 'cleantalk-spam-protect')
1974
+ . PHP_EOL . __('CleanTalk\'s Anti-Spam database:', 'cleantalk-spam-protect')
1975
  . PHP_EOL . 'IP: ' . $apbct->sender_ip
1976
  . PHP_EOL . 'Email: ' . $apbct->sender_email
1977
  . PHP_EOL . sprintf(
2019
 
2020
  // Choosing between POST and GET
2021
  $params = ct_get_fields_any(
2022
+ Get::get('ninja_forms_ajax_submit') || Get::get('nf_ajax_submit') ? $_GET : $input_array
2023
  );
2024
 
2025
  $sender_email = $params['email'] ?: '';
2183
  . "</h1><h2>" . $ct_result->comment . "</h2>"
2184
  );
2185
 
2186
+ echo sanitize_text_field(Get::get('callback')) . '(' . json_encode($response) . ')';
2187
  exit();
2188
  }
2189
  }
2203
  $message .= wpautop(
2204
  PHP_EOL . '---'
2205
  . PHP_EOL
2206
+ . __('CleanTalk Anti-Spam: This message is spam.', 'cleantalk-spam-protect')
2207
+ . PHP_EOL . __('CleanTalk\'s Anti-Spam database:', 'cleantalk-spam-protect')
2208
  . PHP_EOL . 'IP: ' . $apbct->sender_ip
2209
  . PHP_EOL . 'Email: ' . $apbct->sender_email
2210
  . PHP_EOL .
2424
  PHP_EOL
2425
  . '---'
2426
  . PHP_EOL
2427
+ . __('CleanTalk Anti-Spam: This message is spam.', 'cleantalk-spam-protect')
2428
+ . PHP_EOL . __('CleanTalk\'s Anti-Spam database:', 'cleantalk-spam-protect')
2429
  . PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
2430
  . PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
2431
  . PHP_EOL
3205
  }
3206
 
3207
  // Registration form of eMember plugin
3208
+ if (
3209
+ $apbct->settings['forms__registrations_test'] &&
3210
+ Request::get('emember-form-builder-submit') &&
3211
+ wp_verify_nonce(Request::get('_wpnonce'), 'emember-form-builder-nonce')
3212
+ ) {
3213
  return true;
3214
  }
3215
 
inc/cleantalk-public-validate.php CHANGED
@@ -308,7 +308,7 @@ function ct_contact_form_validate()
308
  die();
309
  // Enfold Theme Contact Form. Using $contact_form
310
  } elseif ( ! empty($contact_form) && $contact_form == 'contact_form_enfold_theme' ) {
311
- echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: " . $ct_result->comment . "</h3><a href='.'><-Back</a></div></div>";
312
  die();
313
  } else {
314
  ct_die(null, null);
308
  die();
309
  // Enfold Theme Contact Form. Using $contact_form
310
  } elseif ( ! empty($contact_form) && $contact_form == 'contact_form_enfold_theme' ) {
311
+ echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Anti-Spam by CleanTalk: " . $ct_result->comment . "</h3><a href='.'><-Back</a></div></div>";
312
  die();
313
  } else {
314
  ct_die(null, null);
inc/cleantalk-public.php CHANGED
@@ -1,7 +1,11 @@
1
  <?php
2
 
 
3
  use Cleantalk\ApbctWP\Variables\Cookie;
4
  use Cleantalk\Common\Helper;
 
 
 
5
 
6
  /**
7
  * Init functions
@@ -20,7 +24,7 @@ function apbct_init()
20
  }
21
 
22
  //Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
23
- if ( (isset($_POST['action']) && $_POST['action'] === 'ct_check_internal') &&
24
  $apbct->settings['forms__check_internal']
25
  ) {
26
  $ct_result = ct_contact_form_validate();
@@ -34,11 +38,11 @@ function apbct_init()
34
  }
35
 
36
  //fix for EPM registration form
37
- if ( isset($_POST) && isset($_POST['reg_email']) && shortcode_exists('epm_registration_form') ) {
38
  unset($_POST['ct_checkjs_register_form']);
39
  }
40
 
41
- if ( isset($_POST['_wpnonce-et-pb-contact-form-submitted']) ) {
42
  add_shortcode('et_pb_contact_form', 'ct_contact_form_validate');
43
  }
44
 
@@ -75,13 +79,13 @@ function apbct_init()
75
  }
76
  }
77
 
78
- // Check and redirecct
79
  if ( apbct_is_post()
80
- && isset($_POST['cleantalk_hidden_method'])
81
- && isset($_POST['cleantalk_hidden_action'])
82
  ) {
83
- $action = htmlspecialchars($_POST['cleantalk_hidden_action']);
84
- $method = htmlspecialchars($_POST['cleantalk_hidden_method']);
85
  unset($_POST['cleantalk_hidden_action']);
86
  unset($_POST['cleantalk_hidden_method']);
87
  ct_contact_form_validate();
@@ -102,7 +106,11 @@ function apbct_init()
102
  }
103
  }
104
 
105
- if ( isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id']) ) {
 
 
 
 
106
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
107
  ct_ajax_hook();
108
  }
@@ -112,21 +120,35 @@ function apbct_init()
112
  add_action('wp', 'ct_ajax_hook', 1);
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  //hook for Anonymous Post
116
- if ( $apbct->settings['data__general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']) ) {
117
  add_action('wp', 'ct_contact_form_validate_postdata', 1);
118
  }
119
 
120
- if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7']) && ! apbct_is_direct_trackback() ) {
121
  add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata', 1);
122
  add_action('init', 'ct_contact_form_validate', 999);
123
- if ( isset($_POST['reg_redirect_link']) && isset($_POST['tmpl_registration_nonce_field']) ) {
 
 
 
124
  unset($_POST['ct_checkjs_register_form']);
125
  add_action('init', 'ct_contact_form_validate', 999);
126
  }
127
  }
128
 
129
- if ( $apbct->settings['data__general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']) ) {
130
  add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata', 1);
131
  }
132
 
@@ -142,7 +164,7 @@ function apbct_init()
142
  if ( $apbct->settings['forms__wc_checkout_test'] == 1 ) {
143
  add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
144
  }
145
- if ( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] === 'checkout' && empty($apbct->settings['forms__wc_register_from_order']) ) {
146
  remove_filter('woocommerce_registration_errors', 'ct_registration_errors', 1);
147
  }
148
 
@@ -222,7 +244,7 @@ function apbct_init()
222
 
223
  // intercept WordPress Landing Pages POST
224
  if ( defined('LANDINGPAGES_CURRENT_VERSION') && ! empty($_POST) ) {
225
- if ( array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead' ) { // AJAX action(s)
226
  ct_check_wplp();
227
  } elseif (
228
  array_key_exists('inbound_submitted', $_POST) &&
@@ -267,10 +289,12 @@ function apbct_init()
267
  }
268
 
269
  //Pirate forms
270
- if ( defined('PIRATE_FORMS_VERSION') ) {
271
- if ( isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'] ) {
272
- apbct_form__piratesForm__testSpam();
273
- }
 
 
274
  }
275
 
276
  // QForms integration
@@ -318,12 +342,12 @@ function apbct_init()
318
  }
319
 
320
  if ( apbct_is_user_enable() ) {
321
- if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && ! isset($_POST['comment_post_ID']) && ! isset($_GET['for']) && ! apbct_is_direct_trackback() ) {
322
  add_action('init', 'ct_contact_form_validate', 999);
323
  }
324
  if ( apbct_is_post() &&
325
  $apbct->settings['data__general_postdata_test'] == 1 &&
326
- ! isset($_POST['ct_checkjs_cf7']) &&
327
  ! is_admin() &&
328
  ! apbct_is_user_role_in(array('administrator', 'moderator'))
329
  ) {
@@ -393,7 +417,7 @@ function apbct_buffer_modify_by_string()
393
  $action = count($group_action) > 0 ? $group_action[1] : $site_url;
394
 
395
  $action__host = parse_url($action, PHP_URL_HOST);
396
- if ( $site__host != $action__host ) {
397
  preg_match('/method="(\S*)"/', $match[0], $group_method);
398
  $method = count($group_method) > 0 ? $group_method[1] : 'get';
399
 
@@ -433,7 +457,7 @@ function apbct_buffer_modify_by_dom()
433
  $action__host = parse_url($action, PHP_URL_HOST);
434
 
435
  // Check if the form directed to the third party site
436
- if ( $site__host != $action__host ) {
437
  $method = $form->getAttribute('method');
438
  $method = $method ?: 'get';
439
  // Directs form to our site
@@ -690,7 +714,7 @@ function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $_c
690
  }
691
 
692
  /**
693
- * Changes email notification for spam comment for native Wordpress comment system
694
  *
695
  * @param string $notify_message Body of email notification
696
  * @param $_comment_id
@@ -702,8 +726,8 @@ function apbct_comment__Wordpress__changeMailNotification($notify_message, $_com
702
  global $apbct;
703
 
704
  return PHP_EOL
705
- . __('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk-spam-protect')
706
- . "\n" . __('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk-spam-protect')
707
  . "\n" . 'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
708
  . "\n" . 'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
709
  . "\n" . PHP_EOL . sprintf(
@@ -767,7 +791,7 @@ function ct_die($_comment_id, $_comment_status)
767
  if ( defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE != true ) {
768
  $message_title = '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . $message_title;
769
  }
770
- if ( isset($_POST['et_pb_contact_email']) ) {
771
  $message_title = 'Blacklisted';
772
  }
773
 
@@ -799,11 +823,11 @@ function ct_die($_comment_id, $_comment_status)
799
  }
800
 
801
  http_response_code(200);
802
- die("Forbidden. Sender blacklisted. Blocked by Cleantalk");
803
  }
804
 
805
  /**
806
- * Set die page with Cleantalk comment from parameter.
807
  *
808
  * @param $comment_body
809
  */
@@ -849,7 +873,7 @@ function ct_die_extended($comment_body)
849
  }
850
 
851
  http_response_code(200);
852
- die("Forbidden. Sender blacklisted. Blocked by Cleantalk");
853
  }
854
 
855
  /**
@@ -1175,7 +1199,7 @@ function ct_enqueue_scripts_public($_hook)
1175
  if ( $apbct->settings['forms__check_external'] ) {
1176
  wp_enqueue_script(
1177
  'ct_external',
1178
- plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'),
1179
  array('jquery'),
1180
  APBCT_VERSION,
1181
  false /*in header*/
@@ -1186,7 +1210,7 @@ function ct_enqueue_scripts_public($_hook)
1186
  if ( $apbct->settings['forms__check_internal'] ) {
1187
  wp_enqueue_script(
1188
  'ct_internal',
1189
- plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'),
1190
  array('jquery'),
1191
  APBCT_VERSION,
1192
  false /*in header*/
@@ -1200,14 +1224,14 @@ function ct_enqueue_scripts_public($_hook)
1200
 
1201
  wp_enqueue_style(
1202
  'ct_public_admin_css',
1203
- plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'),
1204
  array(),
1205
  APBCT_VERSION,
1206
  'all'
1207
  );
1208
  wp_enqueue_script(
1209
  'ct_public_admin_js',
1210
- plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.min.js'),
1211
  array('jquery'),
1212
  APBCT_VERSION,
1213
  false /*in header*/
@@ -1235,7 +1259,7 @@ function ct_enqueue_scripts_public($_hook)
1235
  if ( $apbct->settings['misc__debug_ajax'] ) {
1236
  wp_enqueue_script(
1237
  'ct_debug_js',
1238
- plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'),
1239
  array('jquery'),
1240
  APBCT_VERSION,
1241
  false /*in header*/
@@ -1267,7 +1291,7 @@ function apbct_enqueue_and_localize_public_scripts()
1267
  );
1268
  wp_enqueue_script(
1269
  'cleantalk-modal',
1270
- plugins_url('/cleantalk-spam-protect/js/cleantalk-modal.min.js'),
1271
  array(),
1272
  APBCT_VERSION
1273
  );
@@ -1329,16 +1353,14 @@ function ct_comments_output($curr_comment, $_param2, $wp_list_comments_args)
1329
 
1330
  echo "<p class='ct_comment_logo_title'>
1331
  " . __('by', 'cleantalk-spam-protect')
1332
- . " <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='" . plugins_url(
1333
- ) . "/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
1334
  . " <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
1335
  . "</p></div>";
1336
  // Outputs email if exists
1337
  if ( $email ) {
1338
  echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
1339
  . "$email"
1340
- . "&nbsp;<img src='" . plugins_url(
1341
- ) . "/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
1342
  . "</a>";
1343
  } else {
1344
  echo __('No email', 'cleantalk-spam-protect');
@@ -1349,8 +1371,7 @@ function ct_comments_output($curr_comment, $_param2, $wp_list_comments_args)
1349
  if ( $ip ) {
1350
  echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
1351
  . "$ip"
1352
- . "&nbsp;<img src='" . plugins_url(
1353
- ) . "/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
1354
  . "</a>";
1355
  } else {
1356
  echo __('No IP', 'cleantalk-spam-protect');
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
24
  }
25
 
26
  //Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
27
+ if ( (Post::get('action') === 'ct_check_internal') &&
28
  $apbct->settings['forms__check_internal']
29
  ) {
30
  $ct_result = ct_contact_form_validate();
38
  }
39
 
40
  //fix for EPM registration form
41
+ if ( Post::get('reg_email') && shortcode_exists('epm_registration_form') ) {
42
  unset($_POST['ct_checkjs_register_form']);
43
  }
44
 
45
+ if ( Post::get('_wpnonce-et-pb-contact-form-submitted') !== '' ) {
46
  add_shortcode('et_pb_contact_form', 'ct_contact_form_validate');
47
  }
48
 
79
  }
80
  }
81
 
82
+ // Check and redirect
83
  if ( apbct_is_post()
84
+ && Post::get('cleantalk_hidden_method') !== ''
85
+ && Post::get('cleantalk_hidden_action') !== ''
86
  ) {
87
+ $action = Escape::escHtml(Post::get('cleantalk_hidden_method'));
88
+ $method = Escape::escHtml(Post::get('cleantalk_hidden_action'));
89
  unset($_POST['cleantalk_hidden_action']);
90
  unset($_POST['cleantalk_hidden_method']);
91
  ct_contact_form_validate();
106
  }
107
  }
108
 
109
+ if (
110
+ Post::get('quform_ajax') &&
111
+ Post::get('quform_csrf_token') &&
112
+ Post::get('quform_form_id')
113
+ ) {
114
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
115
  ct_ajax_hook();
116
  }
120
  add_action('wp', 'ct_ajax_hook', 1);
121
  }
122
 
123
+ /** VFB_Pro integration */
124
+ if (
125
+ ! empty($_POST) &&
126
+ $apbct->settings['forms__contact_forms_test'] == 1 &&
127
+ empty(Post::get('ct_checkjs_cf7')) &&
128
+ apbct_is_plugin_active('vfb-pro/vfb-pro.php') &&
129
+ ! empty(Post::get('_vfb-form-id'))
130
+ ) {
131
+ ct_contact_form_validate();
132
+ }
133
+
134
  //hook for Anonymous Post
135
+ if ( $apbct->settings['data__general_postdata_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) ) {
136
  add_action('wp', 'ct_contact_form_validate_postdata', 1);
137
  }
138
 
139
+ if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) && ! apbct_is_direct_trackback() ) {
140
  add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata', 1);
141
  add_action('init', 'ct_contact_form_validate', 999);
142
+ if (
143
+ Post::get('reg_redirect_link') !== '' &&
144
+ Post::get('tmpl_registration_nonce_field') !== ''
145
+ ) {
146
  unset($_POST['ct_checkjs_register_form']);
147
  add_action('init', 'ct_contact_form_validate', 999);
148
  }
149
  }
150
 
151
+ if ( $apbct->settings['data__general_postdata_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) ) {
152
  add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata', 1);
153
  }
154
 
164
  if ( $apbct->settings['forms__wc_checkout_test'] == 1 ) {
165
  add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
166
  }
167
+ if ( Request::get('wc-ajax') === 'checkout' && empty($apbct->settings['forms__wc_register_from_order']) ) {
168
  remove_filter('woocommerce_registration_errors', 'ct_registration_errors', 1);
169
  }
170
 
244
 
245
  // intercept WordPress Landing Pages POST
246
  if ( defined('LANDINGPAGES_CURRENT_VERSION') && ! empty($_POST) ) {
247
+ if ( Post::get('action') === 'inbound_store_lead' ) { // AJAX action(s)
248
  ct_check_wplp();
249
  } elseif (
250
  array_key_exists('inbound_submitted', $_POST) &&
289
  }
290
 
291
  //Pirate forms
292
+ if (
293
+ defined('PIRATE_FORMS_VERSION') &&
294
+ Post::get('pirate-forms-contact-name') &&
295
+ Post::get('pirate-forms-contact-email')
296
+ ) {
297
+ apbct_form__piratesForm__testSpam();
298
  }
299
 
300
  // QForms integration
342
  }
343
 
344
  if ( apbct_is_user_enable() ) {
345
+ if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && ! Post::get('comment_post_ID') && ! Get::get('for') && ! apbct_is_direct_trackback() ) {
346
  add_action('init', 'ct_contact_form_validate', 999);
347
  }
348
  if ( apbct_is_post() &&
349
  $apbct->settings['data__general_postdata_test'] == 1 &&
350
+ ! Post::get('ct_checkjs_cf7') &&
351
  ! is_admin() &&
352
  ! apbct_is_user_role_in(array('administrator', 'moderator'))
353
  ) {
417
  $action = count($group_action) > 0 ? $group_action[1] : $site_url;
418
 
419
  $action__host = parse_url($action, PHP_URL_HOST);
420
+ if ( $action__host !== null && $site__host != $action__host ) {
421
  preg_match('/method="(\S*)"/', $match[0], $group_method);
422
  $method = count($group_method) > 0 ? $group_method[1] : 'get';
423
 
457
  $action__host = parse_url($action, PHP_URL_HOST);
458
 
459
  // Check if the form directed to the third party site
460
+ if ( $action__host !== null && $site__host != $action__host ) {
461
  $method = $form->getAttribute('method');
462
  $method = $method ?: 'get';
463
  // Directs form to our site
714
  }
715
 
716
  /**
717
+ * Changes email notification for spam comment for native WordPress comment system
718
  *
719
  * @param string $notify_message Body of email notification
720
  * @param $_comment_id
726
  global $apbct;
727
 
728
  return PHP_EOL
729
+ . __('CleanTalk Anti-Spam: This message is possible spam.', 'cleantalk-spam-protect')
730
+ . "\n" . __('You could check it in CleanTalk\'s Anti-Spam database:', 'cleantalk-spam-protect')
731
  . "\n" . 'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
732
  . "\n" . 'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
733
  . "\n" . PHP_EOL . sprintf(
791
  if ( defined('CLEANTALK_DISABLE_BLOCKING_TITLE') && CLEANTALK_DISABLE_BLOCKING_TITLE != true ) {
792
  $message_title = '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . $message_title;
793
  }
794
+ if ( Post::get('et_pb_contact_email') ) {
795
  $message_title = 'Blacklisted';
796
  }
797
 
823
  }
824
 
825
  http_response_code(200);
826
+ die("Forbidden. Sender blacklisted. Blocked by CleanTalk");
827
  }
828
 
829
  /**
830
+ * Set die page with CleanTalk comment from parameter.
831
  *
832
  * @param $comment_body
833
  */
873
  }
874
 
875
  http_response_code(200);
876
+ die("Forbidden. Sender blacklisted. Blocked by CleanTalk");
877
  }
878
 
879
  /**
1199
  if ( $apbct->settings['forms__check_external'] ) {
1200
  wp_enqueue_script(
1201
  'ct_external',
1202
+ APBCT_JS_ASSETS_PATH . '/cleantalk_external.min.js',
1203
  array('jquery'),
1204
  APBCT_VERSION,
1205
  false /*in header*/
1210
  if ( $apbct->settings['forms__check_internal'] ) {
1211
  wp_enqueue_script(
1212
  'ct_internal',
1213
+ APBCT_JS_ASSETS_PATH . '/cleantalk_internal.min.js',
1214
  array('jquery'),
1215
  APBCT_VERSION,
1216
  false /*in header*/
1224
 
1225
  wp_enqueue_style(
1226
  'ct_public_admin_css',
1227
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-public-admin.min.css',
1228
  array(),
1229
  APBCT_VERSION,
1230
  'all'
1231
  );
1232
  wp_enqueue_script(
1233
  'ct_public_admin_js',
1234
+ APBCT_JS_ASSETS_PATH . '/cleantalk-public-admin.min.js',
1235
  array('jquery'),
1236
  APBCT_VERSION,
1237
  false /*in header*/
1259
  if ( $apbct->settings['misc__debug_ajax'] ) {
1260
  wp_enqueue_script(
1261
  'ct_debug_js',
1262
+ APBCT_JS_ASSETS_PATH . '/cleantalk-debug-ajax.min.js',
1263
  array('jquery'),
1264
  APBCT_VERSION,
1265
  false /*in header*/
1291
  );
1292
  wp_enqueue_script(
1293
  'cleantalk-modal',
1294
+ APBCT_JS_ASSETS_PATH . '/cleantalk-modal.min.js',
1295
  array(),
1296
  APBCT_VERSION
1297
  );
1353
 
1354
  echo "<p class='ct_comment_logo_title'>
1355
  " . __('by', 'cleantalk-spam-protect')
1356
+ . " <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='" . APBCT_IMG_ASSETS_PATH . "/logo_color.png'></a>"
 
1357
  . " <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
1358
  . "</p></div>";
1359
  // Outputs email if exists
1360
  if ( $email ) {
1361
  echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
1362
  . "$email"
1363
+ . "&nbsp;<img src='" . APBCT_IMG_ASSETS_PATH . "/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
 
1364
  . "</a>";
1365
  } else {
1366
  echo __('No email', 'cleantalk-spam-protect');
1371
  if ( $ip ) {
1372
  echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
1373
  . "$ip"
1374
+ . "&nbsp;<img src='" . APBCT_IMG_ASSETS_PATH . "/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
 
1375
  . "</a>";
1376
  } else {
1377
  echo __('No IP', 'cleantalk-spam-protect');
inc/cleantalk-settings.php CHANGED
@@ -132,7 +132,7 @@ function apbct_settings__set_fileds()
132
  'fields' => array(
133
  'sfw__enabled' => array(
134
  'type' => 'checkbox',
135
- 'title' => __('SpamFireWall', 'cleantalk-spam-protect'),
136
  'description' =>
137
  __(
138
  "This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.",
@@ -145,6 +145,7 @@ function apbct_settings__set_fileds()
145
  )
146
  . $additional_sfw_description,
147
  'childrens' => array('sfw__anti_flood', 'sfw__anti_crawler', 'sfw__use_delete_to_clear_table'),
 
148
  ),
149
  ),
150
  ),
@@ -187,12 +188,12 @@ function apbct_settings__set_fileds()
187
  'forms__general_contact_forms_test' => array(
188
  'title' => __('Custom contact forms', 'cleantalk-spam-protect'),
189
  'description' => __(
190
- 'Anti spam test for any WordPress themes or contacts forms.',
191
  'cleantalk-spam-protect'
192
  ),
193
  ),
194
  'forms__search_test' => array(
195
- 'title' => __('Test default Wordpress search form for spam', 'cleantalk-spam-protect'),
196
  'description' =>
197
  __('Spam protection for Search form.', 'cleantalk-spam-protect')
198
  . (! $apbct->white_label || is_main_site() ?
@@ -236,7 +237,7 @@ function apbct_settings__set_fileds()
236
  'fields' => array(
237
  'forms__wc_checkout_test' => array(
238
  'title' => __('WooCommerce checkout form', 'cleantalk-spam-protect'),
239
- 'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk-spam-protect'),
240
  'childrens' => array('forms__wc_register_from_order'),
241
  'reverse_trigger' => true,
242
  'options' => array(
@@ -247,7 +248,7 @@ function apbct_settings__set_fileds()
247
  'forms__wc_register_from_order' => array(
248
  'title' => __('Spam test for registration during checkout', 'cleantalk-spam-protect'),
249
  'description' => __(
250
- 'Enable anti spam test for registration process which during woocommerce\'s checkout.',
251
  'cleantalk-spam-protect'
252
  ),
253
  'parent' => 'forms__wc_checkout_test',
@@ -404,7 +405,7 @@ function apbct_settings__set_fileds()
404
  . '&nbsp;'
405
  . '<a href="https://cleantalk.org/my/?user_token='
406
  . $apbct->user_token . '&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">'
407
- . __('CleanTalk dashboard', 'cleantalk-spam-protect')
408
  . '</a>.' : '')
409
  . '<br />'
410
  . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk-spam-protect'),
@@ -461,7 +462,7 @@ function apbct_settings__set_fileds()
461
  ),
462
  ),
463
  'wp__use_builtin_http_api' => array(
464
- 'title' => __("Use Wordpress HTTP API", 'cleantalk-spam-protect'),
465
  'description' => __(
466
  'Alternative way to connect the Cloud. Use this if you have connection problems.',
467
  'cleantalk-spam-protect'
@@ -482,7 +483,7 @@ function apbct_settings__set_fileds()
482
  'title' => __('Add a CleanTalk Pixel to improve IP-detection', 'cleantalk-spam-protect'),
483
  'description' =>
484
  __(
485
- 'Upload small graphic file from Cleantalk\'s server to improve IP-detection.',
486
  'cleantalk-spam-protect'
487
  )
488
  . '<br>'
@@ -642,7 +643,7 @@ function apbct_settings__set_fileds()
642
  ),
643
  'sfw__anti_crawler' => array(
644
  'type' => 'checkbox',
645
- 'title' => __('Anti-Crawler', 'cleantalk-spam-protect') . $additional_ac_title,
646
  'class' => 'apbct_settings-field_wrapper',
647
  'parent' => 'sfw__enabled',
648
  'description' =>
@@ -659,7 +660,7 @@ function apbct_settings__set_fileds()
659
  ),
660
  'sfw__anti_flood' => array(
661
  'type' => 'checkbox',
662
- 'title' => __('Anti-Flood', 'cleantalk-spam-protect'),
663
  'class' => 'apbct_settings-field_wrapper',
664
  'parent' => 'sfw__enabled',
665
  'childrens' => array('sfw__anti_flood__view_limit',),
@@ -671,7 +672,7 @@ function apbct_settings__set_fileds()
671
  ),
672
  'sfw__anti_flood__view_limit' => array(
673
  'type' => 'text',
674
- 'title' => __('Anti-Flood Page Views Limit', 'cleantalk-spam-protect'),
675
  'class' => 'apbct_settings-field_wrapper--sub',
676
  'parent' => 'sfw__anti_flood',
677
  'description' => __(
@@ -739,7 +740,7 @@ function apbct_settings__set_fileds()
739
  ),
740
  'description' => sprintf(
741
  __(
742
- "If enabled, overrides similar Wordpress %sdiscussion settings%s.",
743
  'cleantalk-spam-protect'
744
  ),
745
  '<a href="options-discussion.php">',
@@ -813,7 +814,7 @@ function apbct_settings__set_fileds__network($fields)
813
  'children_enable' => 0,
814
  ),
815
  ),
816
- 'title' => __('Wordpress Multisite Work Mode', 'cleantalk-spam-protect'),
817
  'description' => __(
818
  'You can choose the work mode here for the child blogs and how they will operate with the CleanTalk Cloud. Press "?" for the detailed description.',
819
  'cleantalk-spam-protect'
@@ -826,14 +827,13 @@ function apbct_settings__set_fileds__network($fields)
826
  'multisite__hoster_api_key' => array(
827
  'type' => 'text',
828
  'required' => true,
829
- 'title' => __('Hoster API key', 'cleantalk-spam-protect'),
830
  'description' => sprintf(
831
- __('Copy the key from your %sCleantalk Profile%s', 'cleantalk-spam-protect'),
832
  '<a href="https://cleantalk.org/my/profile#api_keys" target="_blank">',
833
  '</a>'
834
  ),
835
  'class' => 'apbct_settings-field_wrapper--sub',
836
- 'long_description' => true,
837
  'display' => APBCT_WPMS && is_main_site(),
838
  'disabled' => ! isset($apbct->network_settings['multisite__work_mode']) || $apbct->network_settings['multisite__work_mode'] != 1,
839
  'parent' => 'multisite__work_mode',
@@ -865,7 +865,7 @@ function apbct_settings__set_fileds__network($fields)
865
  'title' => __('Plugin name', 'cleantalk-spam-protect'),
866
  'description' => sprintf(
867
  __(
868
- "Specify plugin name. Leave empty for deafult %sAnti-Spam by Cleantalk%s",
869
  'cleantalk-spam-protect'
870
  ),
871
  '<b>',
@@ -1029,7 +1029,7 @@ function apbct_settings__display()
1029
  // Subtitle for IP license
1030
  if ( $apbct->moderate_ip ) {
1031
  echo '<h4 class="apbct_settings-subtitle apbct_color--gray">' .
1032
- __('Hosting AntiSpam', 'cleantalk-spam-protect') . '</h4>';
1033
  }
1034
 
1035
  echo '<form action="options.php" method="post">';
@@ -1042,7 +1042,7 @@ function apbct_settings__display()
1042
 
1043
  echo __('CleanTalk\'s tech support:', 'cleantalk-spam-protect')
1044
  . '&nbsp;'
1045
- . '<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
1046
  . '<br>';
1047
  echo __('Plugin Homepage at', 'cleantalk-spam-protect') .
1048
  ' <a href="https://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
@@ -1086,7 +1086,7 @@ function apbct_settings__display()
1086
  if ( $apbct->network_settings['multisite__work_mode'] != 2 || is_main_site() ) {
1087
  // CP button
1088
  echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token=' . $apbct->user_token . '&cp_mode=antispam">'
1089
- . __('Click here to get anti-spam statistics', 'cleantalk-spam-protect')
1090
  . '</a>';
1091
  echo '&nbsp;&nbsp;';
1092
  }
@@ -1121,7 +1121,7 @@ function apbct_settings__display()
1121
  settings_fields('cleantalk_settings');
1122
  do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
1123
 
1124
- // Disabled save button if key empty
1125
  $disabled = '';
1126
  if (! $apbct->key_is_ok) {
1127
  $disabled = 'disabled';
@@ -1204,9 +1204,9 @@ function apbct_settings__error__output($return = false)
1204
 
1205
  $error_texts = array(
1206
  // Misc
1207
- 'key_invalid' => __('Error occurred while API key validating. Error: ', 'cleantalk-spam-protect'),
1208
  'key_get' => __(
1209
- 'Error occurred while automatically gettings access key. Error: ',
1210
  'cleantalk-spam-protect'
1211
  ),
1212
  'sfw_send_logs' => __(
@@ -1226,7 +1226,7 @@ function apbct_settings__error__output($return = false)
1226
  'cleantalk-spam-protect'
1227
  ),
1228
  'api' => __('Error occurred while executing API call. Error: ', 'cleantalk-spam-protect'),
1229
- 'cron' => __('Error occurred while executing CleantalkCron job. Error: ', 'cleantalk-spam-protect'),
1230
  'sfw_outdated' => __(
1231
  'Error occurred on last SpamFireWall check. Error: ',
1232
  'cleantalk-spam-protect'
@@ -1474,9 +1474,9 @@ function apbct_settings__field__state()
1474
  );
1475
  }
1476
  if ( $apbct->moderate_ip ) {
1477
- print "<br /><br />The anti-spam service is paid by your hosting provider. License #" . $apbct->data['ip_license'] . ".<br />";
1478
  if ( $apbct->api_key ) {
1479
- print esc_html__('The access key is not required.', 'cleantalk-spam-protect');
1480
  }
1481
  }
1482
 
@@ -1492,7 +1492,7 @@ function apbct_settings__field__apikey()
1492
 
1493
  echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
1494
 
1495
- // Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
1496
  if ( APBCT_WPMS && ! is_main_site() && ( ! $apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY')) ) {
1497
  _e('<h3>Access key is provided by network administrator</h3>', 'cleantalk-spam-protect');
1498
 
@@ -1517,10 +1517,10 @@ function apbct_settings__field__apikey()
1517
  . '"
1518
  key="' . $apbct->api_key . '"
1519
  size="20"
1520
- placeholder="' . __('Enter the key', 'cleantalk-spam-protect') . '"'
1521
  . ' />';
1522
 
1523
- // Show account name associated with key
1524
  if ( ! empty($apbct->data['account_name_ob']) ) {
1525
  echo '<div class="apbct_display--none">'
1526
  . sprintf(
@@ -1530,10 +1530,10 @@ function apbct_settings__field__apikey()
1530
  . '</div>';
1531
  };
1532
 
1533
- // Show key button
1534
  if ( (apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok) ) {
1535
  echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
1536
- . __('Show the access key', 'cleantalk-spam-protect')
1537
  . '</a>';
1538
  }
1539
 
@@ -1617,7 +1617,7 @@ function apbct_field_service_utilization()
1617
  }
1618
  } else {
1619
  _e(
1620
- 'Enter the Hoster API key and synchronize with cloud to find out your hoster account utilization.',
1621
  'cleantalk-spam-protect'
1622
  );
1623
  }
@@ -1813,7 +1813,7 @@ function apbct_get_all_child_domains($except_main_site = false)
1813
  }
1814
 
1815
  /**
1816
- * Get all current Wordpress roles
1817
  *
1818
  * @return array
1819
  */
@@ -1970,6 +1970,11 @@ function apbct_settings__field__draw($params = array())
1970
 
1971
  // Text type
1972
  case 'text':
 
 
 
 
 
1973
  echo '<input
1974
  type="text"
1975
  id="apbct_setting_' . $params['name'] . '"
@@ -1982,7 +1987,7 @@ function apbct_settings__field__draw($params = array())
1982
  . ' />'
1983
  . '&nbsp;'
1984
  . '<label for="apbct_setting_' . $params['name'] . '" class="apbct_setting-field_title--' . $params['type'] . '">'
1985
- . $params['title']
1986
  . '</label>';
1987
  echo '<div class="apbct_settings-field_description">'
1988
  . $params['description']
@@ -2075,7 +2080,7 @@ function apbct_settings__validate($settings)
2075
  $settings['sfw__anti_flood__view_limit'] = ($settings['sfw__anti_flood__view_limit'] == 0 ? 20 : $settings['sfw__anti_flood__view_limit']); // Default if 0 passed
2076
  $settings['sfw__anti_flood__view_limit'] = ($settings['sfw__anti_flood__view_limit'] < 5 ? 5 : $settings['sfw__anti_flood__view_limit']); //
2077
 
2078
- // Validating API key
2079
  $settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
2080
 
2081
  $apbct->data['key_changed'] = $settings['apikey'] !== $apbct->settings['apikey'];
@@ -2086,7 +2091,7 @@ function apbct_settings__validate($settings)
2086
  $settings['apikey'] = is_main_site() || $apbct->allow_custom_key || $apbct->white_label ? $settings['apikey'] : $apbct->network_settings['apikey'];
2087
  $settings['apikey'] = is_main_site() || ! $settings['multisite__white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
2088
 
2089
- // Show notice if the api key is empty
2090
  if ( ! apbct_api_key__is_correct() ) {
2091
  $apbct->data['key_is_ok'] = false;
2092
  $apbct->data['notice_show'] = 1;
@@ -2371,9 +2376,9 @@ function apbct_settings__get_key_auto($direct_call = false)
2371
  $admin_email = ct_get_admin_email();
2372
 
2373
  /**
2374
- * Filters the email to get API key
2375
  *
2376
- * @param string email to get API key
2377
  */
2378
  $filtered_admin_email = apply_filters('apbct_get_api_key_email', $admin_email);
2379
 
@@ -2428,6 +2433,7 @@ function apbct_settings__get_key_auto($direct_call = false)
2428
  $out = array(
2429
  'success' => true,
2430
  'reload' => false,
 
2431
  );
2432
  }
2433
 
@@ -2448,7 +2454,7 @@ function apbct_settings__update_account_email()
2448
  $account_email = Post::get('accountEmail');
2449
 
2450
  // not valid email
2451
- if (!$account_email || !filter_var($_POST['accountEmail'], FILTER_VALIDATE_EMAIL)) {
2452
  die(
2453
  json_encode(
2454
  array(
@@ -2574,7 +2580,7 @@ function apbct_settings__get__long_description()
2574
  {
2575
  check_ajax_referer('ct_secret_nonce');
2576
 
2577
- $setting_id = $_POST['setting_id'] ?: '';
2578
 
2579
  $descriptions = array(
2580
  'multisite__work_mode' => array(
@@ -2589,13 +2595,6 @@ function apbct_settings__get__long_description()
2589
  'cleantalk-spam-protect'
2590
  )
2591
  ),
2592
- 'multisite__hoster_api_key' => array(
2593
- 'title' => __('Hoster API key', 'cleantalk-spam-protect'),
2594
- 'desc' => __(
2595
- 'You could find it here:<br><a href ="https://cleantalk-screenshots.s3.amazonaws.com/help/hosting-antispam/hapi-ru.png"><img src="https://cleantalk-screenshots.s3.amazonaws.com/help/hosting-antispam/hapi-ru.png"></a><br>Press on the screenshot to zoom.',
2596
- 'cleantalk-spam-protect'
2597
- )
2598
- ),
2599
  'data__set_cookies' => array(
2600
  'title' => __('Cookies setting', 'cleantalk-spam-protect'),
2601
  'desc' => sprintf(
@@ -2611,14 +2610,14 @@ function apbct_settings__get__long_description()
2611
  )
2612
  ),
2613
  'sfw__anti_crawler' => array(
2614
- 'title' => __('Anti-Crawler', 'cleantalk-spam-protect'),
2615
  'desc' => sprintf(
2616
  __('CleanTalk Anti-Crawler — this option is meant to block all types of bots visiting website pages that can search vulnerabilities on a website, attempt to hack a site, collect personal data, price parsing or content and images, generate 404 error pages, or aggressive website scanning bots. %s', 'cleantalk-spam-protect'),
2617
  '<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}#anticrawl" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
2618
  )
2619
  ),
2620
  'sfw__anti_flood' => array(
2621
- 'title' => __('Anti-Flood', 'cleantalk-spam-protect'),
2622
  'desc' => sprintf(
2623
  __('CleanTalk Anti-Flood — this option is meant to block aggressive bots. You can set the maximum number of website pages your visitors can click on within 1 minute. If any IP exceeds the set number it will get the CleanTalk blocking screen for 30 seconds. It\'s impossible for the IP to open any website pages while the 30-second timer takes place. %s', 'cleantalk-spam-protect'),
2624
  '<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}#antiflood" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
@@ -2633,12 +2632,26 @@ function apbct_settings__get__long_description()
2633
  ),
2634
  'data__honeypot_field' => array(
2635
  'title' => __('Honeypot field', 'cleantalk-spam-protect'),
2636
- 'desc' => __('The option helps to block bots on the WC order form and default registration form. Enable this option if you have passed spam on these forms.', 'cleantalk-spam-protect')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2637
  ),
2638
  );
2639
 
2640
  if ( ! empty($setting_id) ) {
2641
- $utm = '?utm_source=apbct_hint_' . $setting_id . '&utm_medium=WordPress&utm_campaign=ABPCT_Settings';
2642
  $descriptions[$setting_id]['desc'] = str_replace('{utm_mark}', $utm, $descriptions[$setting_id]['desc']);
2643
  }
2644
 
@@ -2765,7 +2778,7 @@ add_action('apbct_before_returning_settings', 'apbct__send_local_settings_to_api
2765
 
2766
  function apbct__send_local_settings_to_api($settings)
2767
  {
2768
- // Current API key
2769
  $api_key = $settings['apikey'] ?: '';
2770
 
2771
  // Settings to JSON
132
  'fields' => array(
133
  'sfw__enabled' => array(
134
  'type' => 'checkbox',
135
+ 'title' => 'SpamFireWall', // Do not to localize this phrase
136
  'description' =>
137
  __(
138
  "This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.",
145
  )
146
  . $additional_sfw_description,
147
  'childrens' => array('sfw__anti_flood', 'sfw__anti_crawler', 'sfw__use_delete_to_clear_table'),
148
+ 'long_description' => true,
149
  ),
150
  ),
151
  ),
188
  'forms__general_contact_forms_test' => array(
189
  'title' => __('Custom contact forms', 'cleantalk-spam-protect'),
190
  'description' => __(
191
+ 'Anti-Spam test for any WordPress themes or contacts forms.',
192
  'cleantalk-spam-protect'
193
  ),
194
  ),
195
  'forms__search_test' => array(
196
+ 'title' => __('Test default WordPress search form for spam', 'cleantalk-spam-protect'),
197
  'description' =>
198
  __('Spam protection for Search form.', 'cleantalk-spam-protect')
199
  . (! $apbct->white_label || is_main_site() ?
237
  'fields' => array(
238
  'forms__wc_checkout_test' => array(
239
  'title' => __('WooCommerce checkout form', 'cleantalk-spam-protect'),
240
+ 'description' => __('Anti-Spam test for WooCommerce checkout form.', 'cleantalk-spam-protect'),
241
  'childrens' => array('forms__wc_register_from_order'),
242
  'reverse_trigger' => true,
243
  'options' => array(
248
  'forms__wc_register_from_order' => array(
249
  'title' => __('Spam test for registration during checkout', 'cleantalk-spam-protect'),
250
  'description' => __(
251
+ 'Enable Anti-Spam test for registration process which during woocommerce\'s checkout.',
252
  'cleantalk-spam-protect'
253
  ),
254
  'parent' => 'forms__wc_checkout_test',
405
  . '&nbsp;'
406
  . '<a href="https://cleantalk.org/my/?user_token='
407
  . $apbct->user_token . '&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">'
408
+ . __('CleanTalk Dashboard', 'cleantalk-spam-protect')
409
  . '</a>.' : '')
410
  . '<br />'
411
  . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk-spam-protect'),
462
  ),
463
  ),
464
  'wp__use_builtin_http_api' => array(
465
+ 'title' => __("Use WordPress HTTP API", 'cleantalk-spam-protect'),
466
  'description' => __(
467
  'Alternative way to connect the Cloud. Use this if you have connection problems.',
468
  'cleantalk-spam-protect'
483
  'title' => __('Add a CleanTalk Pixel to improve IP-detection', 'cleantalk-spam-protect'),
484
  'description' =>
485
  __(
486
+ 'Upload small graphic file from CleanTalk\'s server to improve IP-detection.',
487
  'cleantalk-spam-protect'
488
  )
489
  . '<br>'
643
  ),
644
  'sfw__anti_crawler' => array(
645
  'type' => 'checkbox',
646
+ 'title' => 'Anti-Crawler' . $additional_ac_title, // Do not to localize this phrase
647
  'class' => 'apbct_settings-field_wrapper',
648
  'parent' => 'sfw__enabled',
649
  'description' =>
660
  ),
661
  'sfw__anti_flood' => array(
662
  'type' => 'checkbox',
663
+ 'title' => 'Anti-Flood', // Do not to localize this phrase
664
  'class' => 'apbct_settings-field_wrapper',
665
  'parent' => 'sfw__enabled',
666
  'childrens' => array('sfw__anti_flood__view_limit',),
672
  ),
673
  'sfw__anti_flood__view_limit' => array(
674
  'type' => 'text',
675
+ 'title' => 'Anti-Flood ' . __('Page Views Limit', 'cleantalk-spam-protect'), // Do not to localize this phrase
676
  'class' => 'apbct_settings-field_wrapper--sub',
677
  'parent' => 'sfw__anti_flood',
678
  'description' => __(
740
  ),
741
  'description' => sprintf(
742
  __(
743
+ "If enabled, overrides similar WordPress %sdiscussion settings%s.",
744
  'cleantalk-spam-protect'
745
  ),
746
  '<a href="options-discussion.php">',
814
  'children_enable' => 0,
815
  ),
816
  ),
817
+ 'title' => __('WordPress Multisite Work Mode', 'cleantalk-spam-protect'),
818
  'description' => __(
819
  'You can choose the work mode here for the child blogs and how they will operate with the CleanTalk Cloud. Press "?" for the detailed description.',
820
  'cleantalk-spam-protect'
827
  'multisite__hoster_api_key' => array(
828
  'type' => 'text',
829
  'required' => true,
830
+ 'title' => __('Hoster Access key', 'cleantalk-spam-protect'),
831
  'description' => sprintf(
832
+ __('Copy the Access key from your %sCleanTalk Profile%s', 'cleantalk-spam-protect'),
833
  '<a href="https://cleantalk.org/my/profile#api_keys" target="_blank">',
834
  '</a>'
835
  ),
836
  'class' => 'apbct_settings-field_wrapper--sub',
 
837
  'display' => APBCT_WPMS && is_main_site(),
838
  'disabled' => ! isset($apbct->network_settings['multisite__work_mode']) || $apbct->network_settings['multisite__work_mode'] != 1,
839
  'parent' => 'multisite__work_mode',
865
  'title' => __('Plugin name', 'cleantalk-spam-protect'),
866
  'description' => sprintf(
867
  __(
868
+ "Specify plugin name. Leave empty for deafult %sAnti-Spam by CleanTalk%s",
869
  'cleantalk-spam-protect'
870
  ),
871
  '<b>',
1029
  // Subtitle for IP license
1030
  if ( $apbct->moderate_ip ) {
1031
  echo '<h4 class="apbct_settings-subtitle apbct_color--gray">' .
1032
+ __('Hosting Anti-Spam', 'cleantalk-spam-protect') . '</h4>';
1033
  }
1034
 
1035
  echo '<form action="options.php" method="post">';
1042
 
1043
  echo __('CleanTalk\'s tech support:', 'cleantalk-spam-protect')
1044
  . '&nbsp;'
1045
+ . '<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">WordPress.org</a>.'
1046
  . '<br>';
1047
  echo __('Plugin Homepage at', 'cleantalk-spam-protect') .
1048
  ' <a href="https://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
1086
  if ( $apbct->network_settings['multisite__work_mode'] != 2 || is_main_site() ) {
1087
  // CP button
1088
  echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token=' . $apbct->user_token . '&cp_mode=antispam">'
1089
+ . __('Click here to get Anti-Spam statistics', 'cleantalk-spam-protect')
1090
  . '</a>';
1091
  echo '&nbsp;&nbsp;';
1092
  }
1121
  settings_fields('cleantalk_settings');
1122
  do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
1123
 
1124
+ // Disabled save button if the Access key empty
1125
  $disabled = '';
1126
  if (! $apbct->key_is_ok) {
1127
  $disabled = 'disabled';
1204
 
1205
  $error_texts = array(
1206
  // Misc
1207
+ 'key_invalid' => __('Error occurred while Access key validating. Error: ', 'cleantalk-spam-protect'),
1208
  'key_get' => __(
1209
+ 'Error occurred while automatically get Access key. Error: ',
1210
  'cleantalk-spam-protect'
1211
  ),
1212
  'sfw_send_logs' => __(
1226
  'cleantalk-spam-protect'
1227
  ),
1228
  'api' => __('Error occurred while executing API call. Error: ', 'cleantalk-spam-protect'),
1229
+ 'cron' => __('Error occurred while executing CleanTalk Cron job. Error: ', 'cleantalk-spam-protect'),
1230
  'sfw_outdated' => __(
1231
  'Error occurred on last SpamFireWall check. Error: ',
1232
  'cleantalk-spam-protect'
1474
  );
1475
  }
1476
  if ( $apbct->moderate_ip ) {
1477
+ print "<br /><br />The Anti-Spam service is paid by your hosting provider. License #" . $apbct->data['ip_license'] . ".<br />";
1478
  if ( $apbct->api_key ) {
1479
+ print esc_html__('The Access key is not required.', 'cleantalk-spam-protect');
1480
  }
1481
  }
1482
 
1492
 
1493
  echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
1494
 
1495
+ // Using the Access key from Main site, or from CLEANTALK_ACCESS_KEY constant
1496
  if ( APBCT_WPMS && ! is_main_site() && ( ! $apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY')) ) {
1497
  _e('<h3>Access key is provided by network administrator</h3>', 'cleantalk-spam-protect');
1498
 
1517
  . '"
1518
  key="' . $apbct->api_key . '"
1519
  size="20"
1520
+ placeholder="' . __('Enter the Access key', 'cleantalk-spam-protect') . '"'
1521
  . ' />';
1522
 
1523
+ // Show account name associated with the Access key
1524
  if ( ! empty($apbct->data['account_name_ob']) ) {
1525
  echo '<div class="apbct_display--none">'
1526
  . sprintf(
1530
  . '</div>';
1531
  };
1532
 
1533
+ // Show Access key button
1534
  if ( (apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok) ) {
1535
  echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
1536
+ . __('Show the Access key', 'cleantalk-spam-protect')
1537
  . '</a>';
1538
  }
1539
 
1617
  }
1618
  } else {
1619
  _e(
1620
+ 'Enter the Hoster Access key and synchronize with cloud to find out your hoster account utilization.',
1621
  'cleantalk-spam-protect'
1622
  );
1623
  }
1813
  }
1814
 
1815
  /**
1816
+ * Get all current WordPress roles
1817
  *
1818
  * @return array
1819
  */
1970
 
1971
  // Text type
1972
  case 'text':
1973
+ // Popup description
1974
+ $popup = '';
1975
+ if ( isset($params['long_description']) ) {
1976
+ $popup = '<i setting="' . $params['name'] . '" class="apbct_settings-long_description---show apbct-icon-help-circled"></i>';
1977
+ }
1978
  echo '<input
1979
  type="text"
1980
  id="apbct_setting_' . $params['name'] . '"
1987
  . ' />'
1988
  . '&nbsp;'
1989
  . '<label for="apbct_setting_' . $params['name'] . '" class="apbct_setting-field_title--' . $params['type'] . '">'
1990
+ . $params['title'] . $popup
1991
  . '</label>';
1992
  echo '<div class="apbct_settings-field_description">'
1993
  . $params['description']
2080
  $settings['sfw__anti_flood__view_limit'] = ($settings['sfw__anti_flood__view_limit'] == 0 ? 20 : $settings['sfw__anti_flood__view_limit']); // Default if 0 passed
2081
  $settings['sfw__anti_flood__view_limit'] = ($settings['sfw__anti_flood__view_limit'] < 5 ? 5 : $settings['sfw__anti_flood__view_limit']); //
2082
 
2083
+ // Validating Access key
2084
  $settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
2085
 
2086
  $apbct->data['key_changed'] = $settings['apikey'] !== $apbct->settings['apikey'];
2091
  $settings['apikey'] = is_main_site() || $apbct->allow_custom_key || $apbct->white_label ? $settings['apikey'] : $apbct->network_settings['apikey'];
2092
  $settings['apikey'] = is_main_site() || ! $settings['multisite__white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
2093
 
2094
+ // Show notice if the Access key is empty
2095
  if ( ! apbct_api_key__is_correct() ) {
2096
  $apbct->data['key_is_ok'] = false;
2097
  $apbct->data['notice_show'] = 1;
2376
  $admin_email = ct_get_admin_email();
2377
 
2378
  /**
2379
+ * Filters the email to get Access key
2380
  *
2381
+ * @param string email to get Access key
2382
  */
2383
  $filtered_admin_email = apply_filters('apbct_get_api_key_email', $admin_email);
2384
 
2433
  $out = array(
2434
  'success' => true,
2435
  'reload' => false,
2436
+ 'error' => isset($result['error_message']) ? esc_html($result['error_message']) : esc_html($result['error'])
2437
  );
2438
  }
2439
 
2454
  $account_email = Post::get('accountEmail');
2455
 
2456
  // not valid email
2457
+ if (!$account_email || !filter_var(Post::get('accountEmail'), FILTER_VALIDATE_EMAIL)) {
2458
  die(
2459
  json_encode(
2460
  array(
2580
  {
2581
  check_ajax_referer('ct_secret_nonce');
2582
 
2583
+ $setting_id = (string) Post::get('setting_id', null, 'word');
2584
 
2585
  $descriptions = array(
2586
  'multisite__work_mode' => array(
2595
  'cleantalk-spam-protect'
2596
  )
2597
  ),
 
 
 
 
 
 
 
2598
  'data__set_cookies' => array(
2599
  'title' => __('Cookies setting', 'cleantalk-spam-protect'),
2600
  'desc' => sprintf(
2610
  )
2611
  ),
2612
  'sfw__anti_crawler' => array(
2613
+ 'title' => 'Anti-Crawler', // Do not to localize this phrase
2614
  'desc' => sprintf(
2615
  __('CleanTalk Anti-Crawler — this option is meant to block all types of bots visiting website pages that can search vulnerabilities on a website, attempt to hack a site, collect personal data, price parsing or content and images, generate 404 error pages, or aggressive website scanning bots. %s', 'cleantalk-spam-protect'),
2616
  '<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}#anticrawl" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
2617
  )
2618
  ),
2619
  'sfw__anti_flood' => array(
2620
+ 'title' => 'Anti-Flood', // Do not to localize this phrase
2621
  'desc' => sprintf(
2622
  __('CleanTalk Anti-Flood — this option is meant to block aggressive bots. You can set the maximum number of website pages your visitors can click on within 1 minute. If any IP exceeds the set number it will get the CleanTalk blocking screen for 30 seconds. It\'s impossible for the IP to open any website pages while the 30-second timer takes place. %s', 'cleantalk-spam-protect'),
2623
  '<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}#antiflood" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
2632
  ),
2633
  'data__honeypot_field' => array(
2634
  'title' => __('Honeypot field', 'cleantalk-spam-protect'),
2635
+ 'desc' => sprintf(
2636
+ esc_html__('The option helps to block bots . The honeypot field option adds a hidden field to the form. When spambots come to a website form, they can fill out each input field. Enable this option to make the protection stronger on these forms. Learn more about supported forms %s', 'cleantalk-spam-protect'),
2637
+ '<a href="https://cleantalk.org/help/wordpress-plugin-settings{utm_mark}#honeypot" target="_blank">' . __('here.', 'cleantalk-spam-protect') . '</a>'
2638
+ )
2639
+ ),
2640
+ 'sfw__enabled' => array(
2641
+ 'title' => 'SpamFireWall',
2642
+ 'desc' => sprintf(
2643
+ '<p>' . esc_html__('SpamFireWall is a part of the anti-spam service and blocks the most spam active bots before the site pages load.', 'cleantalk-spam-protect') . '</p>'
2644
+ . '<p>' . esc_html__('Anti-Crawler is an add-on to SFW and helps to strengthen the protection against spam bots. Disabled by default.', 'cleantalk-spam-protect') . '</p>'
2645
+ . '<p>' . esc_html__('CleanTalk Anti-Flood is also an add-on to SFW and limits the number of pages visited per minute. Disabled by default.', 'cleantalk-spam-protect') . '</p>'
2646
+ . '<p>' . esc_html__('You can read more about SFW modes %s', 'cleantalk-spam-protect') . '</p>'
2647
+ . '<p>' . esc_html__('Read out the article if you are using Varnish on your server.', 'cleantalk-spam-protect'),
2648
+ '<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}" target="_blank">' . __('here.', 'cleantalk-spam-protect') . '</a>'
2649
+ )
2650
  ),
2651
  );
2652
 
2653
  if ( ! empty($setting_id) ) {
2654
+ $utm = '?utm_source=apbct_hint_' . esc_attr($setting_id) . '&utm_medium=WordPress&utm_campaign=ABPCT_Settings';
2655
  $descriptions[$setting_id]['desc'] = str_replace('{utm_mark}', $utm, $descriptions[$setting_id]['desc']);
2656
  }
2657
 
2778
 
2779
  function apbct__send_local_settings_to_api($settings)
2780
  {
2781
+ // Current Access key
2782
  $api_key = $settings['apikey'] ?: '';
2783
 
2784
  // Settings to JSON
inc/cleantalk-updater.php CHANGED
@@ -458,7 +458,7 @@ function apbct_update_to_5_138_0()
458
 
459
  switch_to_blog($blog);
460
 
461
- // Getting key
462
  $settings = $net_settings['allow_custom_key']
463
  ? get_option('cleantalk_settings')
464
  : $main_blog_settings;
458
 
459
  switch_to_blog($blog);
460
 
461
+ // Getting Access key
462
  $settings = $net_settings['allow_custom_key']
463
  ? get_option('cleantalk_settings')
464
  : $main_blog_settings;
js/apbct-fingerprint.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Fingerprint=e()}(this,function(){"use strict";function t(t){var o=Array.prototype.forEach,e=Array.prototype.map;this.each=function(t,e,n){if(null!==t)if(o&&t.forEach===o)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(e.call(n,t[r],r,t)==={})return}else for(var a in t)if(t.hasOwnProperty(a)&&e.call(n,t[a],a,t)==={})return},this.map=function(t,r,i){var a=[];return null==t?a:e&&t.map===e?t.map(r,i):(this.each(t,function(t,e,n){a[a.length]=r.call(i,t,e,n)}),a)},"object"==typeof t?(this.hasher=t.hasher,this.screen_resolution=t.screen_resolution,this.screen_orientation=t.screen_orientation,this.canvas=t.canvas,this.ie_activex=t.ie_activex):"function"==typeof t&&(this.hasher=t)}return t.prototype={get:function(){var t,e=[];return e.push(navigator.userAgent),e.push(navigator.language),e.push(screen.colorDepth),!this.screen_resolution||void 0!==(t=this.getScreenResolution())&&e.push(t.join("x")),e.push((new Date).getTimezoneOffset()),e.push(this.hasSessionStorage()),e.push(this.hasLocalStorage()),e.push(this.hasIndexDb()),document.body?e.push(typeof document.body.addBehavior):e.push("undefined"),e.push(typeof window.openDatabase),e.push(navigator.cpuClass),e.push(navigator.platform),e.push(navigator.doNotTrack),e.push(this.getPluginsString()),this.canvas&&this.isCanvasSupported()&&e.push(this.getCanvasFingerprint()),this.hasher?this.hasher(e.join("###"),31):this.murmurhash3_32_gc(e.join("###"),31)},murmurhash3_32_gc:function(t,e){for(var n,r,i=3&t.length,a=t.length-i,o=e,s=3432918353,h=461845907,c=0;c<a;)r=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,o=27492+(65535&(n=5*(65535&(o=(o^=r=(65535&(r=(r=(65535&r)*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*h+(((r>>>16)*h&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(r=0,i){case 3:r^=(255&t.charCodeAt(c+2))<<16;case 2:r^=(255&t.charCodeAt(c+1))<<8;case 1:o^=r=(65535&(r=(r=(65535&(r^=255&t.charCodeAt(c)))*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*h+(((r>>>16)*h&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0},hasLocalStorage:function(){try{return!!window.localStorage}catch(t){return!0}},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},hasIndexDb:function(){try{return!!window.indexedDB}catch(t){return!0}},isCanvasSupported:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},getPluginsString:function(){return this.isIE()&&this.ie_activex?this.getIEPluginsString():this.getRegularPluginsString()},getRegularPluginsString:function(){return this.map(navigator.plugins,function(t){var e=this.map(t,function(t){return[t.type,t.suffixes].join("~")}).join(",");return[t.name,t.description,e].join("::")},this).join(";")},getIEPluginsString:function(){if(window.ActiveXObject){return this.map(["ShockwaveFlash.ShockwaveFlash","AcroPDF.PDF","PDF.PdfCtrl","QuickTime.QuickTime","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","RealPlayer","SWCtl.SWCtl","WMPlayer.OCX","AgControl.AgControl","Skype.Detection"],function(t){try{return new ActiveXObject(t),t}catch(t){return null}}).join(";")}return""},getScreenResolution:function(){var t=!this.screen_orientation||screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height];return t},getCanvasFingerprint:function(){var t=document.createElement("canvas"),e=t.getContext("2d"),n="http://valve.github.io";return e.textBaseline="top",e.font="14px 'Arial'",e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText(n,4,17),t.toDataURL()}},t});
2
  //# sourceMappingURL=apbct-fingerprint.min.js.map
1
+ !function(t,e){"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Fingerprint=e()}(this,function(){"use strict";function t(t){var o=Array.prototype.forEach,e=Array.prototype.map;this.each=function(t,e,n){if(null!==t)if(o&&t.forEach===o)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(e.call(n,t[r],r,t)==={})return}else for(var a in t)if(t.hasOwnProperty(a)&&e.call(n,t[a],a,t)==={})return},this.map=function(t,r,i){var a=[];return null==t?a:e&&t.map===e?t.map(r,i):(this.each(t,function(t,e,n){a[a.length]=r.call(i,t,e,n)}),a)},"object"==typeof t?(this.hasher=t.hasher,this.screen_resolution=t.screen_resolution,this.screen_orientation=t.screen_orientation,this.canvas=t.canvas,this.ie_activex=t.ie_activex):"function"==typeof t&&(this.hasher=t)}return t.prototype={get:function(){var t,e=[];return e.push(navigator.userAgent),e.push(navigator.language),e.push(screen.colorDepth),this.screen_resolution&&void 0!==(t=this.getScreenResolution())&&e.push(t.join("x")),e.push((new Date).getTimezoneOffset()),e.push(this.hasSessionStorage()),e.push(this.hasLocalStorage()),e.push(this.hasIndexDb()),document.body?e.push(typeof document.body.addBehavior):e.push("undefined"),e.push(typeof window.openDatabase),e.push(navigator.cpuClass),e.push(navigator.platform),e.push(navigator.doNotTrack),e.push(this.getPluginsString()),this.canvas&&this.isCanvasSupported()&&e.push(this.getCanvasFingerprint()),this.hasher?this.hasher(e.join("###"),31):this.murmurhash3_32_gc(e.join("###"),31)},murmurhash3_32_gc:function(t,e){for(var n,r,i=3&t.length,a=t.length-i,o=e,s=3432918353,h=461845907,c=0;c<a;)r=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,o=27492+(65535&(n=5*(65535&(o=(o^=r=(65535&(r=(r=(65535&r)*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*h+(((r>>>16)*h&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(r=0,i){case 3:r^=(255&t.charCodeAt(c+2))<<16;case 2:r^=(255&t.charCodeAt(c+1))<<8;case 1:o^=r=(65535&(r=(r=(65535&(r^=255&t.charCodeAt(c)))*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*h+(((r>>>16)*h&65535)<<16)&4294967295}return o=2246822507*(65535&(o=(o^=t.length)^o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0},hasLocalStorage:function(){try{return!!window.localStorage}catch(t){return!0}},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},hasIndexDb:function(){try{return!!window.indexedDB}catch(t){return!0}},isCanvasSupported:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},getPluginsString:function(){return this.isIE()&&this.ie_activex?this.getIEPluginsString():this.getRegularPluginsString()},getRegularPluginsString:function(){return this.map(navigator.plugins,function(t){var e=this.map(t,function(t){return[t.type,t.suffixes].join("~")}).join(",");return[t.name,t.description,e].join("::")},this).join(";")},getIEPluginsString:function(){return window.ActiveXObject?this.map(["ShockwaveFlash.ShockwaveFlash","AcroPDF.PDF","PDF.PdfCtrl","QuickTime.QuickTime","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","RealPlayer","SWCtl.SWCtl","WMPlayer.OCX","AgControl.AgControl","Skype.Detection"],function(t){try{return new ActiveXObject(t),t}catch(t){return null}}).join(";"):""},getScreenResolution:function(){var t=!this.screen_orientation||screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height];return t},getCanvasFingerprint:function(){var t=document.createElement("canvas"),e=t.getContext("2d"),n="http://valve.github.io";return e.textBaseline="top",e.font="14px 'Arial'",e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText(n,4,17),t.toDataURL()}},t});
2
  //# sourceMappingURL=apbct-fingerprint.min.js.map
js/apbct-fingerprint.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-fingerprint.min.js","sources":["apbct-fingerprint.js"],"sourcesContent":["/*\n* fingerprintJS 0.5.5 - Fast browser fingerprint library\n* https://github.com/Valve/fingerprintjs\n* Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com)\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n;(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }\n else if (typeof define === 'function' && define.amd) { define(definition); }\n else { context[name] = definition(); }\n})('Fingerprint', this, function () {\n 'use strict';\n\n var Fingerprint = function (options) {\n var nativeForEach, nativeMap;\n nativeForEach = Array.prototype.forEach;\n nativeMap = Array.prototype.map;\n\n this.each = function (obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (iterator.call(context, obj[i], i, obj) === {}) return;\n }\n } else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (iterator.call(context, obj[key], key, obj) === {}) return;\n }\n }\n }\n };\n\n this.map = function(obj, iterator, context) {\n var results = [];\n // Not using strict equality so that this acts as a\n // shortcut to checking for `null` and `undefined`.\n if (obj == null) return results;\n if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n this.each(obj, function(value, index, list) {\n results[results.length] = iterator.call(context, value, index, list);\n });\n return results;\n };\n\n if (typeof options == 'object'){\n this.hasher = options.hasher;\n this.screen_resolution = options.screen_resolution;\n this.screen_orientation = options.screen_orientation;\n this.canvas = options.canvas;\n this.ie_activex = options.ie_activex;\n } else if(typeof options == 'function'){\n this.hasher = options;\n }\n };\n\n Fingerprint.prototype = {\n get: function(){\n var keys = [];\n keys.push(navigator.userAgent);\n keys.push(navigator.language);\n keys.push(screen.colorDepth);\n if (this.screen_resolution) {\n var resolution = this.getScreenResolution();\n if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs\n keys.push(resolution.join('x'));\n }\n }\n keys.push(new Date().getTimezoneOffset());\n keys.push(this.hasSessionStorage());\n keys.push(this.hasLocalStorage());\n keys.push(this.hasIndexDb());\n //body might not be defined at this point or removed programmatically\n if(document.body){\n keys.push(typeof(document.body.addBehavior));\n } else {\n keys.push(typeof undefined);\n }\n keys.push(typeof(window.openDatabase));\n keys.push(navigator.cpuClass);\n keys.push(navigator.platform);\n keys.push(navigator.doNotTrack);\n keys.push(this.getPluginsString());\n if(this.canvas && this.isCanvasSupported()){\n keys.push(this.getCanvasFingerprint());\n }\n if(this.hasher){\n return this.hasher(keys.join('###'), 31);\n } else {\n return this.murmurhash3_32_gc(keys.join('###'), 31);\n }\n },\n\n /**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\n murmurhash3_32_gc: function(key, seed) {\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key.charCodeAt(i) & 0xff)) |\n ((key.charCodeAt(++i) & 0xff) << 8) |\n ((key.charCodeAt(++i) & 0xff) << 16) |\n ((key.charCodeAt(++i) & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n },\n\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n hasLocalStorage: function () {\n try{\n return !!window.localStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasSessionStorage: function () {\n try{\n return !!window.sessionStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasIndexDb: function () {\n try{\n return !!window.indexedDB;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n isCanvasSupported: function () {\n var elem = document.createElement('canvas');\n return !!(elem.getContext && elem.getContext('2d'));\n },\n\n isIE: function () {\n if(navigator.appName === 'Microsoft Internet Explorer') {\n return true;\n } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11\n return true;\n }\n return false;\n },\n\n getPluginsString: function () {\n if(this.isIE() && this.ie_activex){\n return this.getIEPluginsString();\n } else {\n return this.getRegularPluginsString();\n }\n },\n\n getRegularPluginsString: function () {\n return this.map(navigator.plugins, function (p) {\n var mimeTypes = this.map(p, function(mt){\n return [mt.type, mt.suffixes].join('~');\n }).join(',');\n return [p.name, p.description, mimeTypes].join('::');\n }, this).join(';');\n },\n\n getIEPluginsString: function () {\n if(window.ActiveXObject){\n var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin\n 'AcroPDF.PDF', // Adobe PDF reader 7+\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\n 'QuickTime.QuickTime', // QuickTime\n // 5 versions of real players\n 'rmocx.RealPlayer G2 Control',\n 'rmocx.RealPlayer G2 Control.1',\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\n 'RealPlayer',\n 'SWCtl.SWCtl', // ShockWave player\n 'WMPlayer.OCX', // Windows media player\n 'AgControl.AgControl', // Silverlight\n 'Skype.Detection'];\n\n // starting to detect plugins in IE\n return this.map(names, function(name){\n try{\n new ActiveXObject(name);\n return name;\n } catch(e){\n return null;\n }\n }).join(';');\n } else {\n return \"\"; // behavior prior version 0.5.0, not breaking backwards compat.\n }\n },\n\n getScreenResolution: function () {\n var resolution;\n if(this.screen_orientation){\n resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height];\n }else{\n resolution = [screen.height, screen.width];\n }\n return resolution;\n },\n\n getCanvasFingerprint: function () {\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n // https://www.browserleaks.com/canvas#how-does-it-work\n var txt = 'http://valve.github.io';\n ctx.textBaseline = \"top\";\n ctx.font = \"14px 'Arial'\";\n ctx.textBaseline = \"alphabetic\";\n ctx.fillStyle = \"#f60\";\n ctx.fillRect(125,1,62,20);\n ctx.fillStyle = \"#069\";\n ctx.fillText(txt, 2, 15);\n ctx.fillStyle = \"rgba(102, 204, 0, 0.7)\";\n ctx.fillText(txt, 4, 17);\n return canvas.toDataURL();\n }\n };\n\n\n return Fingerprint;\n\n});"],"names":["context","definition","module","exports","define","amd","this","Fingerprint","options","nativeForEach","Array","prototype","forEach","nativeMap","map","each","obj","iterator","length","i","l","call","key","hasOwnProperty","results","value","index","list","hasher","screen_resolution","screen_orientation","canvas","ie_activex","get","resolution","keys","push","navigator","userAgent","language","screen","colorDepth","getScreenResolution","join","Date","getTimezoneOffset","hasSessionStorage","hasLocalStorage","hasIndexDb","document","body","window","cpuClass","platform","doNotTrack","getPluginsString","isCanvasSupported","getCanvasFingerprint","murmurhash3_32_gc","seed","h1b","k1","remainder","bytes","h1","c1","c2","charCodeAt","localStorage","e","sessionStorage","indexedDB","elem","createElement","getContext","isIE","appName","test","getIEPluginsString","getRegularPluginsString","plugins","p","mimeTypes","mt","type","suffixes","name","description","ActiveXObject","height","width","ctx","txt","textBaseline","font","fillStyle","fillRect","fillText","toDataURL"],"mappings":"CAkBC,SAAiBA,EAASC,GACH,oBAAXC,QAA0BA,OAAOC,QAAWD,OAAOC,QAAUF,IAC7C,mBAAXG,QAAyBA,OAAOC,IAAOD,OAAOH,GACvDD,EAAY,YAAIC,IAHxB,CAIiBK,KAAM,wBAGJ,SAAdC,EAAwBC,GAC1B,IACAC,EAAgBC,MAAMC,UAAUC,QAChCC,EAAYH,MAAMC,UAAUG,IAE5BR,KAAKS,KAAO,SAAUC,EAAKC,EAAUjB,GACnC,GAAY,OAARgB,EAGJ,GAAIP,GAAiBO,EAAIJ,UAAYH,EACnCO,EAAIJ,QAAQK,EAAUjB,QACjB,GAAIgB,EAAIE,UAAYF,EAAIE,QAC7B,IAAK,IAAIC,EAAI,EAAGC,EAAIJ,EAAIE,OAAQC,EAAIC,EAAGD,IACrC,GAAIF,EAASI,KAAKrB,EAASgB,EAAIG,GAAIA,EAAGH,KAAS,GAAI,YAGrD,IAAK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MAExB,CAAClD,OAAOiD,OAAQjD,OAAOkD,OAF0C,CAAClD,OAAOkD,MAAOlD,OAAOiD,QAItG,OAAOvD,GAGVuB,qBAAsB,WACpB,IAAI1B,EAASkB,SAASwB,cAAc,UAChCkB,EAAM5D,EAAO2C,WAAW,MAExBkB,EAAM,yBAUV,OATAD,EAAIE,aAAe,MACnBF,EAAIG,KAAO,eACXH,EAAIE,aAAe,aACnBF,EAAII,UAAY,OAChBJ,EAAIK,SAAS,IAAI,EAAE,GAAG,IACtBL,EAAII,UAAY,OAChBJ,EAAIM,SAASL,EAAK,EAAG,IACrBD,EAAII,UAAY,yBAChBJ,EAAIM,SAASL,EAAK,EAAG,IACd7D,EAAOmE,cAKX3F"}
1
+ {"version":3,"file":"apbct-fingerprint.min.js","sources":["apbct-fingerprint.js"],"sourcesContent":["/*\n* fingerprintJS 0.5.5 - Fast browser fingerprint library\n* https://github.com/Valve/fingerprintjs\n* Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com)\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n;(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }\n else if (typeof define === 'function' && define.amd) { define(definition); }\n else { context[name] = definition(); }\n})('Fingerprint', this, function () {\n 'use strict';\n\n var Fingerprint = function (options) {\n var nativeForEach, nativeMap;\n nativeForEach = Array.prototype.forEach;\n nativeMap = Array.prototype.map;\n\n this.each = function (obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (iterator.call(context, obj[i], i, obj) === {}) return;\n }\n } else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (iterator.call(context, obj[key], key, obj) === {}) return;\n }\n }\n }\n };\n\n this.map = function(obj, iterator, context) {\n var results = [];\n // Not using strict equality so that this acts as a\n // shortcut to checking for `null` and `undefined`.\n if (obj == null) return results;\n if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n this.each(obj, function(value, index, list) {\n results[results.length] = iterator.call(context, value, index, list);\n });\n return results;\n };\n\n if (typeof options == 'object'){\n this.hasher = options.hasher;\n this.screen_resolution = options.screen_resolution;\n this.screen_orientation = options.screen_orientation;\n this.canvas = options.canvas;\n this.ie_activex = options.ie_activex;\n } else if(typeof options == 'function'){\n this.hasher = options;\n }\n };\n\n Fingerprint.prototype = {\n get: function(){\n var keys = [];\n keys.push(navigator.userAgent);\n keys.push(navigator.language);\n keys.push(screen.colorDepth);\n if (this.screen_resolution) {\n var resolution = this.getScreenResolution();\n if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs\n keys.push(resolution.join('x'));\n }\n }\n keys.push(new Date().getTimezoneOffset());\n keys.push(this.hasSessionStorage());\n keys.push(this.hasLocalStorage());\n keys.push(this.hasIndexDb());\n //body might not be defined at this point or removed programmatically\n if(document.body){\n keys.push(typeof(document.body.addBehavior));\n } else {\n keys.push(typeof undefined);\n }\n keys.push(typeof(window.openDatabase));\n keys.push(navigator.cpuClass);\n keys.push(navigator.platform);\n keys.push(navigator.doNotTrack);\n keys.push(this.getPluginsString());\n if(this.canvas && this.isCanvasSupported()){\n keys.push(this.getCanvasFingerprint());\n }\n if(this.hasher){\n return this.hasher(keys.join('###'), 31);\n } else {\n return this.murmurhash3_32_gc(keys.join('###'), 31);\n }\n },\n\n /**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\n murmurhash3_32_gc: function(key, seed) {\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key.charCodeAt(i) & 0xff)) |\n ((key.charCodeAt(++i) & 0xff) << 8) |\n ((key.charCodeAt(++i) & 0xff) << 16) |\n ((key.charCodeAt(++i) & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n },\n\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n hasLocalStorage: function () {\n try{\n return !!window.localStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasSessionStorage: function () {\n try{\n return !!window.sessionStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasIndexDb: function () {\n try{\n return !!window.indexedDB;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n isCanvasSupported: function () {\n var elem = document.createElement('canvas');\n return !!(elem.getContext && elem.getContext('2d'));\n },\n\n isIE: function () {\n if(navigator.appName === 'Microsoft Internet Explorer') {\n return true;\n } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11\n return true;\n }\n return false;\n },\n\n getPluginsString: function () {\n if(this.isIE() && this.ie_activex){\n return this.getIEPluginsString();\n } else {\n return this.getRegularPluginsString();\n }\n },\n\n getRegularPluginsString: function () {\n return this.map(navigator.plugins, function (p) {\n var mimeTypes = this.map(p, function(mt){\n return [mt.type, mt.suffixes].join('~');\n }).join(',');\n return [p.name, p.description, mimeTypes].join('::');\n }, this).join(';');\n },\n\n getIEPluginsString: function () {\n if(window.ActiveXObject){\n var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin\n 'AcroPDF.PDF', // Adobe PDF reader 7+\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\n 'QuickTime.QuickTime', // QuickTime\n // 5 versions of real players\n 'rmocx.RealPlayer G2 Control',\n 'rmocx.RealPlayer G2 Control.1',\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\n 'RealPlayer',\n 'SWCtl.SWCtl', // ShockWave player\n 'WMPlayer.OCX', // Windows media player\n 'AgControl.AgControl', // Silverlight\n 'Skype.Detection'];\n\n // starting to detect plugins in IE\n return this.map(names, function(name){\n try{\n new ActiveXObject(name);\n return name;\n } catch(e){\n return null;\n }\n }).join(';');\n } else {\n return \"\"; // behavior prior version 0.5.0, not breaking backwards compat.\n }\n },\n\n getScreenResolution: function () {\n var resolution;\n if(this.screen_orientation){\n resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height];\n }else{\n resolution = [screen.height, screen.width];\n }\n return resolution;\n },\n\n getCanvasFingerprint: function () {\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n // https://www.browserleaks.com/canvas#how-does-it-work\n var txt = 'http://valve.github.io';\n ctx.textBaseline = \"top\";\n ctx.font = \"14px 'Arial'\";\n ctx.textBaseline = \"alphabetic\";\n ctx.fillStyle = \"#f60\";\n ctx.fillRect(125,1,62,20);\n ctx.fillStyle = \"#069\";\n ctx.fillText(txt, 2, 15);\n ctx.fillStyle = \"rgba(102, 204, 0, 0.7)\";\n ctx.fillText(txt, 4, 17);\n return canvas.toDataURL();\n }\n };\n\n\n return Fingerprint;\n\n});"],"names":["context","definition","module","exports","define","amd","this","Fingerprint","options","nativeForEach","Array","prototype","forEach","nativeMap","map","each","obj","iterator","length","i","l","call","key","hasOwnProperty","results","value","index","list","hasher","screen_resolution","screen_orientation","canvas","ie_activex","get","resolution","keys","push","navigator","userAgent","language","screen","colorDepth","getScreenResolution","join","Date","getTimezoneOffset","hasSessionStorage","hasLocalStorage","hasIndexDb","document","body","window","cpuClass","platform","doNotTrack","getPluginsString","isCanvasSupported","getCanvasFingerprint","murmurhash3_32_gc","seed","h1b","k1","remainder","bytes","h1","c1","c2","charCodeAt","localStorage","e","sessionStorage","indexedDB","elem","createElement","getContext","isIE","appName","test","getIEPluginsString","getRegularPluginsString","plugins","p","mimeTypes","mt","type","suffixes","name","description","ActiveXObject","height","width","ctx","txt","textBaseline","font","fillStyle","fillRect","fillText","toDataURL"],"mappings":"CAkBC,SAAiBA,EAASC,GACH,oBAAXC,QAA0BA,OAAOC,QAAWD,OAAOC,QAAUF,IAC7C,mBAAXG,QAAyBA,OAAOC,IAAOD,OAAOH,GACvDD,EAAY,YAAIC,IAHxB,CAIiBK,KAAM,wBAGJ,SAAdC,EAAwBC,GAC1B,IACAC,EAAgBC,MAAMC,UAAUC,QAChCC,EAAYH,MAAMC,UAAUG,IAE5BR,KAAKS,KAAO,SAAUC,EAAKC,EAAUjB,GACnC,GAAY,OAARgB,EAGJ,GAAIP,GAAiBO,EAAIJ,UAAYH,EACnCO,EAAIJ,QAAQK,EAAUjB,QACjB,GAAIgB,EAAIE,UAAYF,EAAIE,QAC7B,IAAK,IAAIC,EAAI,EAAGC,EAAIJ,EAAIE,OAAQC,EAAIC,EAAGD,IACrC,GAAIF,EAASI,KAAKrB,EAASgB,EAAIG,GAAIA,EAAGH,KAAS,GAAI,YAGrD,IAAK,IAAIM,KAAON,EACd,GAAIA,EAAIO,eAAeD,IACjBL,EAASI,KAAKrB,EAASgB,EAAIM,GAAMA,EAAKN,KAAS,GAAI,QAM/DV,KAAKQ,IAAM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,UAChCkB,EAAM5D,EAAO2C,WAAW,MAExBkB,EAAM,yBAUV,OATAD,EAAIE,aAAe,MACnBF,EAAIG,KAAO,eACXH,EAAIE,aAAe,aACnBF,EAAII,UAAY,OAChBJ,EAAIK,SAAS,IAAI,EAAE,GAAG,IACtBL,EAAII,UAAY,OAChBJ,EAAIM,SAASL,EAAK,EAAG,IACrBD,EAAII,UAAY,yBAChBJ,EAAIM,SAASL,EAAK,EAAG,IACd7D,EAAOmE,cAKX3F"}
js/apbct-public--alt.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var apbct_fingerprint=new Fingerprint({canvas:!0,ie_activex:!0,hasher:apbct_md5}).get();function apbct_cookie__get(n,i){var s={};return"string"==typeof(n=n||null)&&(n=n.split()),"none"==(i=i||["apbct_","ct_"])&&(i=null),"string"==typeof i&&(i=i.split()),document.cookie.split(";").forEach(function(o,e,c){var t=o.trim().split("=");n&&n.forEach(function(o,e,c){t[0]===o&&(s[t[0]]=t[1])}),i&&i.forEach(function(o,e,c){0===t[0].indexOf(o)&&(s[t[0]]=t[1])})}),s}function apbct_cookie__delete(n,i){var s=new Date(0);"string"==typeof(n=n||null)&&(n=n.split()),"none"==(i=i||["apbct_","ct_"])&&(i=null),"string"==typeof i&&(i=i.split()),document.cookie.split(";").forEach(function(o,e,c){var t=o.trim().split("=");n&&n.forEach(function(o,e,c){t[0]===o&&(document.cookie=t[0]+"=; path=/; expires="+s.toUTCString()+"; samesite=lax")}),i&&i.forEach(function(o,e,c){0===t[0].indexOf(o)&&(document.cookie=t[0]+"=; path=/; expires="+s.toUTCString()+"; samesite=lax")})})}jQuery(document).ready(function(){jQuery.ajax({type:"POST",url:apbctPublicAlt.ajax_url,data:{apbct_action:"get_sessions",apbct_secret:apbctPublicAlt.nonce,session_id:apbct_fingerprint},async:!0,success:function(o){if(console.log("success"),(o=JSON.parse(o)).result)for(cookie in console.log(o),o.cookies)console.log(cookie),document.cookie=cookie+"="+o.cookies[cookie]+"; path=/; samesite=lax";else console.log(o),console.log("APBCT SESSIONS GET ERROR")},error:function(o){console.log("err"),console.log(o)}}),window.onunload=function(){cookies=apbct_cookie__get(),console.log("leave"),jQuery.ajax({type:"POST",url:apbctPublicAlt.ajax_url,data:{apbct_action:"set_sessions",apbct_secret:apbctPublicAlt.nonce,session_id:apbct_fingerprint,data:cookies},async:!1,success:function(o){(o=JSON.parse(o)).result?(console.log("success"),console.log(o),apbct_cookie__delete(),console.log("cookie DELETED")):(console.log("APBCT SESSIONS GET ERROR"),console.log(o))},error:function(o){console.log("err"),console.log(o)}})}});
2
  //# sourceMappingURL=apbct-public--alt.min.js.map
1
+ var apbct_fingerprint=new Fingerprint({canvas:!0,ie_activex:!0,hasher:apbct_md5}).get();function apbct_cookie__get(n,i){var s={};return"string"==typeof(n=n||null)&&(n=n.split()),"string"==typeof(i="none"==(i=i||["apbct_","ct_"])?null:i)&&(i=i.split()),document.cookie.split(";").forEach(function(o,e,c){var t=o.trim().split("=");n&&n.forEach(function(o,e,c){t[0]===o&&(s[t[0]]=t[1])}),i&&i.forEach(function(o,e,c){0===t[0].indexOf(o)&&(s[t[0]]=t[1])})}),s}function apbct_cookie__delete(n,i){var s=new Date(0);"string"==typeof(n=n||null)&&(n=n.split()),"string"==typeof(i="none"==(i=i||["apbct_","ct_"])?null:i)&&(i=i.split()),document.cookie.split(";").forEach(function(o,e,c){var t=o.trim().split("=");n&&n.forEach(function(o,e,c){t[0]===o&&(document.cookie=t[0]+"=; path=/; expires="+s.toUTCString()+"; samesite=lax")}),i&&i.forEach(function(o,e,c){0===t[0].indexOf(o)&&(document.cookie=t[0]+"=; path=/; expires="+s.toUTCString()+"; samesite=lax")})})}jQuery(document).ready(function(){jQuery.ajax({type:"POST",url:apbctPublicAlt.ajax_url,data:{apbct_action:"get_sessions",apbct_secret:apbctPublicAlt.nonce,session_id:apbct_fingerprint},async:!0,success:function(o){if(console.log("success"),(o=JSON.parse(o)).result)for(cookie in console.log(o),o.cookies)console.log(cookie),document.cookie=cookie+"="+o.cookies[cookie]+"; path=/; samesite=lax";else console.log(o),console.log("APBCT SESSIONS GET ERROR")},error:function(o){console.log("err"),console.log(o)}}),window.onunload=function(){cookies=apbct_cookie__get(),console.log("leave"),jQuery.ajax({type:"POST",url:apbctPublicAlt.ajax_url,data:{apbct_action:"set_sessions",apbct_secret:apbctPublicAlt.nonce,session_id:apbct_fingerprint,data:cookies},async:!1,success:function(o){(o=JSON.parse(o)).result?(console.log("success"),console.log(o),apbct_cookie__delete(),console.log("cookie DELETED")):(console.log("APBCT SESSIONS GET ERROR"),console.log(o))},error:function(o){console.log("err"),console.log(o)}})}});
2
  //# sourceMappingURL=apbct-public--alt.min.js.map
js/apbct-public--alt.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public--alt.min.js","sources":["apbct-public--alt.js"],"sourcesContent":["// Fingerprint\nvar apbct_fingerprint = new Fingerprint({canvas: true, ie_activex: true, hasher: apbct_md5}).get();\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\n/* Function: Deletes cookie with prefix */\nfunction apbct_cookie__delete(names, prefixes){\n\tvar date = new Date(0);\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\t\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\n\t\t\t});\n\t\t}\n\t});\n}\n\njQuery(document).ready(function(){\n\t\n\t jQuery.ajax({\n\t\t type: \"POST\",\n\t\t url: apbctPublicAlt.ajax_url,\n\t\t data: {\n\t\t\t apbct_action: 'get_sessions',\n\t\t\t apbct_secret: apbctPublicAlt.nonce,\n\t\t\t session_id: apbct_fingerprint,\n\t\t },\n\t\t async: true,\n\t\t success: function(msg){\n\t\t\t console.log('success');\n\t\t\t msg = JSON.parse(msg);\n\t\t\t\n\t\t\t if(msg.result){\n\t\t\t\t console.log(msg);\n\t\t\t\t for(cookie in msg.cookies){\n\t\t\t\t\t console.log(cookie);\n//\t\t\t\t\t console.log(msg.cookies[cookie]);\n\t\t\t\t\t document.cookie = cookie + \"=\" + msg.cookies[cookie] + \"; path=/; samesite=lax\";\n\t\t\t\t };\n\t\t\t }else{\n\t\t\t\t console.log(msg);\n\t\t\t\t console.log('APBCT SESSIONS GET ERROR');\n\t\t\t }\n\t\t },\n\t\t error: function(err){\n\t\t\t console.log('err');\n\t\t\t console.log(err);\n\t\t }\n\t });\n\t\n\twindow.onunload = function(){\n\t\t\n\t\t// Getting ct_ and apbct_ cookies\n\t\t cookies = apbct_cookie__get();\n\t\t\n\t\tconsole.log('leave');\n\t\t\n\t\t jQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: apbctPublicAlt.ajax_url,\n\t\t\tdata: {\n\t\t\t\tapbct_action: 'set_sessions',\n\t\t\t\tapbct_secret: apbctPublicAlt.nonce,\n\t\t\t\tsession_id: apbct_fingerprint,\n\t\t\t\tdata: cookies,\n\t\t\t},\n\t\t\tasync: false,\n\t\t\tsuccess: function(msg){\n\t\t\t\tmsg = JSON.parse(msg);\n\t\t\t\tif(msg.result){\n\t\t\t\t\tconsole.log('success');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t\t// Deleting ct_ and apbct_ cookies on success\n\t\t\t\t\tapbct_cookie__delete();\n\t\t\t\t\tconsole.log('cookie DELETED');\n\t\t\t\t}else{\n\t\t\t\t\tconsole.log('APBCT SESSIONS GET ERROR');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(err){\n\t\t\t\tconsole.log('err');\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}); \n\t}\n});"],"names":["apbct_fingerprint","Fingerprint","canvas","ie_activex","hasher","apbct_md5","get","apbct_cookie__get","names","prefixes","cookie","split","document","forEach","item","i","arr","curr","trim","name","all","prefix","indexOf","apbct_cookie__delete","date","Date","toUTCString","jQuery","ready","ajax","type","url","apbctPublicAlt","ajax_url","data","apbct_action","apbct_secret","nonce","session_id","async","success","msg","console","log","JSON","parse","result","cookies","error","err","window","onunload"],"mappings":"AACA,IAAIA,kBAAoB,IAAIC,YAAY,CAACC,QAAQ,EAAMC,YAAY,EAAMC,OAAQC,YAAYC,MAG7F,SAASC,kBAAkBC,EAAOC,GACjC,IAAIC,EAAS,GAuBb,MArBmB,iBADnBF,EAAQA,GAAS,QACYA,EAAQA,EAAMG,SAE5B,SADfF,EAAWA,GAAY,CAAC,SAAU,UACFA,EAAW,MACr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QAAQC,IAAIjC,QAEZE,SAASF,OAASA,OAAS,IAAM+B,EAAIM,QAAQrC,QAAU,8BAGxDgC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,6BAGdK,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM,MAIfC,OAAOC,SAAW,WAGhBJ,QAAUxC,oBAEXmC,QAAQC,IAAI,SAEXhB,OAAOE,KAAK,CACZC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,kBACZkC,KAAMa,SAEPR,OAAO,EACPC,QAAS,SAASC,IACjBA,EAAMG,KAAKC,MAAMJ,IACVK,QACNJ,QAAQC,IAAI,WACZD,QAAQC,IAAIF,GAEZlB,uBACAmB,QAAQC,IAAI,oBAEZD,QAAQC,IAAI,4BACZD,QAAQC,IAAIF,KAGdO,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM"}
1
+ {"version":3,"file":"apbct-public--alt.min.js","sources":["apbct-public--alt.js"],"sourcesContent":["// Fingerprint\nvar apbct_fingerprint = new Fingerprint({canvas: true, ie_activex: true, hasher: apbct_md5}).get();\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\n/* Function: Deletes cookie with prefix */\nfunction apbct_cookie__delete(names, prefixes){\n\tvar date = new Date(0);\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\t\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\n\t\t\t});\n\t\t}\n\t});\n}\n\njQuery(document).ready(function(){\n\t\n\t jQuery.ajax({\n\t\t type: \"POST\",\n\t\t url: apbctPublicAlt.ajax_url,\n\t\t data: {\n\t\t\t apbct_action: 'get_sessions',\n\t\t\t apbct_secret: apbctPublicAlt.nonce,\n\t\t\t session_id: apbct_fingerprint,\n\t\t },\n\t\t async: true,\n\t\t success: function(msg){\n\t\t\t console.log('success');\n\t\t\t msg = JSON.parse(msg);\n\t\t\t\n\t\t\t if(msg.result){\n\t\t\t\t console.log(msg);\n\t\t\t\t for(cookie in msg.cookies){\n\t\t\t\t\t console.log(cookie);\n//\t\t\t\t\t console.log(msg.cookies[cookie]);\n\t\t\t\t\t document.cookie = cookie + \"=\" + msg.cookies[cookie] + \"; path=/; samesite=lax\";\n\t\t\t\t };\n\t\t\t }else{\n\t\t\t\t console.log(msg);\n\t\t\t\t console.log('APBCT SESSIONS GET ERROR');\n\t\t\t }\n\t\t },\n\t\t error: function(err){\n\t\t\t console.log('err');\n\t\t\t console.log(err);\n\t\t }\n\t });\n\t\n\twindow.onunload = function(){\n\t\t\n\t\t// Getting ct_ and apbct_ cookies\n\t\t cookies = apbct_cookie__get();\n\t\t\n\t\tconsole.log('leave');\n\t\t\n\t\t jQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: apbctPublicAlt.ajax_url,\n\t\t\tdata: {\n\t\t\t\tapbct_action: 'set_sessions',\n\t\t\t\tapbct_secret: apbctPublicAlt.nonce,\n\t\t\t\tsession_id: apbct_fingerprint,\n\t\t\t\tdata: cookies,\n\t\t\t},\n\t\t\tasync: false,\n\t\t\tsuccess: function(msg){\n\t\t\t\tmsg = JSON.parse(msg);\n\t\t\t\tif(msg.result){\n\t\t\t\t\tconsole.log('success');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t\t// Deleting ct_ and apbct_ cookies on success\n\t\t\t\t\tapbct_cookie__delete();\n\t\t\t\t\tconsole.log('cookie DELETED');\n\t\t\t\t}else{\n\t\t\t\t\tconsole.log('APBCT SESSIONS GET ERROR');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(err){\n\t\t\t\tconsole.log('err');\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}); \n\t}\n});"],"names":["apbct_fingerprint","Fingerprint","canvas","ie_activex","hasher","apbct_md5","get","apbct_cookie__get","names","prefixes","cookie","split","document","forEach","item","i","arr","curr","trim","name","all","prefix","indexOf","apbct_cookie__delete","date","Date","toUTCString","jQuery","ready","ajax","type","url","apbctPublicAlt","ajax_url","data","apbct_action","apbct_secret","nonce","session_id","async","success","msg","console","log","JSON","parse","result","cookies","error","err","window","onunload"],"mappings":"AACA,IAAIA,kBAAoB,IAAIC,YAAY,CAACC,QAAQ,EAAMC,YAAY,EAAMC,OAAQC,YAAYC,MAG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C,mBAEbuC,OAAO,EACPC,QAAS,SAASC,GAIjB,GAHAC,QAAQC,IAAI,YACZF,EAAMG,KAAKC,MAAMJ,IAEVK,OAEN,IAAIpC,UADJgC,QAAQC,IAAIF,GACEA,EAAIM,QACjBL,QAAQC,IAAIjC,QAEZE,SAASF,OAASA,OAAS,IAAM+B,EAAIM,QAAQrC,QAAU,8BAGxDgC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,6BAGdK,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM,MAIfC,OAAOC,SAAW,WAGhBJ,QAAUxC,oBAEXmC,QAAQC,IAAI,SAEXhB,OAAOE,KAAK,CACZC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,kBACZkC,KAAMa,SAEPR,OAAO,EACPC,QAAS,SAASC,IACjBA,EAAMG,KAAKC,MAAMJ,IACVK,QACNJ,QAAQC,IAAI,WACZD,QAAQC,IAAIF,GAEZlB,uBACAmB,QAAQC,IAAI,oBAEZD,QAAQC,IAAI,4BACZD,QAAQC,IAAIF,KAGdO,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM"}
js/apbct-public--functions.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ctSetCookie(t,o,n){var e;("string"==typeof t&&"string"==typeof o||"number"==typeof o)&&(e="ct_pointer_data"===t,t=[[t,o,n]]),"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?t.forEach(function(t,o,n){var e=void 0!==t[2]?"expires="+e+"; ":"",a="https:"===location.protocol?"; secure":"";document.cookie=t[0]+"="+encodeURIComponent(t[1])+"; "+e+"path=/; samesite=lax"+a}):"alternative"!==ctPublicFunctions.data__cookies_type||e||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{apbct_ajax:1,notJson:1}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function ctDeleteCookie(t){var o;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(o="https:"===location.protocol?"; secure":"",document.cookie=t+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+o):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(o,n,e){var a=n.callback||null,c=n.callback_context||null,s=n.callback_params||null,t=n.async||!0,l=n.notJson||null,i=n.timeout||15e3,e=e||null,u=n.button||null,r=n.spinner||null,_=n.progressbar||null,p=n.silent||null,b=n.no_nonce||null,d=n.apbct_ajax||null;"string"==typeof o?(b||(o=o+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce),o=o+"&no_cache="+Math.random()):(b||(o._ajax_nonce=ctPublicFunctions._ajax_nonce),o.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),r&&jQuery(r).css("display","inline"),jQuery.ajax({type:"POST",url:d?ctPublicFunctions._apbct_ajax_url:ctPublicFunctions._ajax_url,data:o,async:t,success:function(t){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),l||(t=JSON.parse(t)),t.error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):a&&(s?a.apply(c,s.concat(t,o,n,e)):a(t,o,n,e))},error:function(t,o,n){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:i})}function apbct_public_sendREST(o,n){var e=n.callback||null,t=n.data||[],a=n.method||"POST";jQuery.ajax({type:a,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+o,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):e&&e(t,o,n,null)},error:function(t,o,n){n&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}
2
  //# sourceMappingURL=apbct-public--functions.min.js.map
1
+ function ctSetCookie(t,o,n){var e;("string"==typeof t&&"string"==typeof o||"number"==typeof o)&&(e="ct_pointer_data"===t,t=[[t,o,n]]),"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?t.forEach(function(t,o,n){var e=void 0!==t[2]?"expires="+e+"; ":"",a="https:"===location.protocol?"; secure":"";document.cookie=t[0]+"="+encodeURIComponent(t[1])+"; "+e+"path=/; samesite=lax"+a}):"alternative"!==ctPublicFunctions.data__cookies_type||e||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{apbct_ajax:1,notJson:1}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function ctDeleteCookie(t){var o;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(o="https:"===location.protocol?"; secure":"",document.cookie=t+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+o):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(o,n,e){var a=n.callback||null,c=n.callback_context||null,s=n.callback_params||null,t=n.async||!0,l=n.notJson||null,i=n.timeout||15e3,e=e||null,u=n.button||null,r=n.spinner||null,_=n.progressbar||null,p=n.silent||null,b=n.no_nonce||null,d=n.apbct_ajax||null;"string"==typeof o?o=(o=b?o:o+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce)+"&no_cache="+Math.random():(b||(o._ajax_nonce=ctPublicFunctions._ajax_nonce),o.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),r&&jQuery(r).css("display","inline"),jQuery.ajax({type:"POST",url:d?ctPublicFunctions._apbct_ajax_url:ctPublicFunctions._ajax_url,data:o,async:t,success:function(t){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),(t=l?t:JSON.parse(t)).error?(setTimeout(function(){_&&_.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):a&&(s?a.apply(c,s.concat(t,o,n,e)):a(t,o,n,e))},error:function(t,o,n){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),r&&jQuery(r).css("display","none"),n&&!p&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:i})}function apbct_public_sendREST(o,n){var e=n.callback||null,t=n.data||[],a=n.method||"POST";jQuery.ajax({type:a,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+o,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):e&&e(t,o,n,null)},error:function(t,o,n){n&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(o),console.log("Anti-spam by Cleantalk plugin REST API error: "+n+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}
2
  //# sourceMappingURL=apbct-public--functions.min.js.map
js/apbct-public--functions.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n }else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n apbct_ajax: 1,\n notJson: 1,\n }\n );\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n var apbct_ajax = params.apbct_ajax || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: apbct_ajax ? ctPublicFunctions._apbct_ajax_url : ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__cookies_type","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_ajax","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_apbct_ajax_url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,SAAzCE,kBAAkBC,qBA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C,iBAAkB,aAAcnE,kBAAkBoE,cAE1DpB,QAAS,SAASC,GACXA,EAAOI,MACNG,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C7B,GAECA,EAASyB,EAAQc,EAAOzC,EADd,OAKtB+B,MAAO,SAASO,EAAOC,EAAYC,GAC3BA,IACAN,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc"}
1
+ {"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n }else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n apbct_ajax: 1,\n notJson: 1,\n }\n );\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n var apbct_ajax = params.apbct_ajax || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: apbct_ajax ? ctPublicFunctions._apbct_ajax_url : ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__cookies_type","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","apbct_ajax","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_apbct_ajax_url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,SAAzCE,kBAAkBC,qBAI6B,WAAzCD,kBAAkBC,mBACxBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASP,EAAK,GAAK,IAAMQ,mBAAmBR,EAAK,IAAM,KAAOL,EAAU,uBAAyBQ,IAI/D,gBAAzCN,kBAAkBC,oBAA0CF,IAGxB,SAAtCC,kBAAkBY,gBAClBC,sBACI,eACA,CACIC,OAAQ,OACRC,KAAM,CAAEnB,QAASA,KAKmB,gBAAtCI,kBAAkBY,gBACxBI,sBACI,CACIC,OAAQ,gCACRrB,QAASA,GAEb,CACIsB,WAAY,EACZC,QAAS,IAG4B,eAAtCnB,kBAAkBY,iBACzBI,sBACI,CACIC,OAAQ,gCACRrB,QAASA,GAEb,CACIuB,QAAS,MAO7B,SAASC,eAAeC,GAEpB,IAMQf,EANqC,SAAzCN,kBAAkBC,qBAI6B,WAAzCD,kBAAkBC,oBAEpBK,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASW,EAAa,mEAAuEf,GAGhGN,kBAAkBC,oBAKhC,SAASe,sBAAsBD,EAAMO,EAAQC,GAGzC,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,QAAS,EACxBR,EAAcG,EAAO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AAI,wCAA0CK,EAAc,yGAG5ElC,QAASA,IAIjB,SAASf,sBAAuBkD,EAAOzC,GAEnC,IAAIE,EAAWF,EAAOE,UAAY,KAC9BT,EAAWO,EAAOP,MAAQ,GAC1BD,EAAWQ,EAAOR,QAAU,OAEhC2B,OAAOE,KAAK,CACRC,KAAM9B,EACN+B,IAAK7C,kBAAkBgE,UAAY,yBAA2BD,EAC9DhD,KAAMA,EACNkD,WAAa,SAAWC,GACpBA,EAAIC,iBAAkB,aAAcnE,kBAAkBoE,cAE1DpB,QAAS,SAASC,GACXA,EAAOI,MACNG,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C7B,GAECA,EAASyB,EAAQc,EAAOzC,EADd,OAKtB+B,MAAO,SAASO,EAAOC,EAAYC,GAC3BA,IACAN,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc"}
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_collect_visible_fields(t){var e=[],n="",c=0,o="",a=0,i=[];for(var l in t.elements)isNaN(+l)||(e[l]=t.elements[l]);return(e=e.filter(function(t){return-1===i.indexOf(t.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(t.getAttribute("type"))||(i.push(t.getAttribute("name")),!1))})).forEach(function(t,e,i){"submit"!==t.getAttribute("type")&&null!==t.getAttribute("name")&&"ct_checkjs"!==t.getAttribute("name")&&("none"!==getComputedStyle(t).display&&"hidden"!==getComputedStyle(t).visibility&&"0"!==getComputedStyle(t).opacity&&"hidden"!==t.getAttribute("type")||t.classList.contains("wp-editor-area")?(n+=" "+t.getAttribute("name"),c++):(o+=" "+t.getAttribute("name"),a++))}),o=o.trim(),{visible_fields:n=n.trim(),visible_fields_count:c,invisible_fields:o,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(t,e){var i="object"==typeof t&&null!==t?t:{};if("native"===ctPublic.data__cookies_type)for(var n in i){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==e?e:n),JSON.stringify(i[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_js_keys__set_input_value(t,e,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var c=document.querySelectorAll("[name^=ct_checkjs]"),o=0;o<c.length;o++)c[o].value=t.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}!function(){var o=new Date,e=(new Date).getTime(),i=!0,n=[],c=0,a={},t=!1,l=!1;function s(t,e,i){"function"==typeof window.addEventListener?t.addEventListener(e,i):t.attachEvent(e,i)}function _(t,e,i){"function"==typeof window.removeEventListener?t.removeEventListener(e,i):t.detachEvent(e,i)}var u=function(){var t=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",t),_(window,"mousedown",u),_(window,"keydown",u)},d=setInterval(function(){i=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(t){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(t.clientY),Math.round(t.clientX),Math.round((new Date).getTime()-e)]),i=!1,50<=++c&&(_(window,"mousemove",m),clearInterval(d),clearInterval(r)))};function p(t){var e=t.target.value;!e||e in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:e},callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{apbct_ajax:1,callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}function b(t){ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&(document.getElementById("apbct_pixel")||jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+t+'">'))}s(window,"mousemove",m),s(window,"mousedown",u),s(window,"keydown",u),s(window,"scroll",function(){t||(ctSetCookie("ct_has_scrolled","true"),t=!0)}),s(window,"DOMContentLoaded",function(){var t,e=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",o.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["ct_has_scrolled","false"],["ct_mouse_moved","false"]];if("native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var i=document.cookie.split(";");if(0!==i.length)for(var n=0;n<i.length;n++){var c=i[n].trim().split("=")[0];0===c.indexOf("apbct_visible_fields_")&&ctDeleteCookie(c)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(t){t&&b(t)}}):(t="custom_ajax"===ctPublicFunctions.data__ajax_type?1:0,apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{apbct_ajax:t,notJson:!0,callback:function(t){t&&b(t)}})):e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(p)),ctSetCookie(e),setTimeout(function(){for(var t=0;t<document.forms.length;t++){var e,i,n=document.forms[t];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("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||((e=document.createElement("input")).setAttribute("type","hidden"),e.setAttribute("id","apbct_visible_fields_"+t),e.setAttribute("name","apbct_visible_fields"),(i={})[0]=apbct_collect_visible_fields(n),e.value=JSON.stringify(i),n.append(e),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=t,n.onsubmit=function(t){var e;"native"!==ctPublic.data__cookies_type&&void 0!==t.target.ctFormIndex&&((e={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(e,t.target.ctFormIndex)),t.target.onsubmit_prev instanceof Function&&setTimeout(function(){t.target.onsubmit_prev.call(t.target,t)},500)})}},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(t,e,i){var n;!e.responseText||-1===e.responseText.indexOf('"apbct')||void 0!==(n=JSON.parse(e.responseText)).apbct&&(n=n.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n.comment}})),cleantalkModal.loaded=n.comment,cleantalkModal.open(),1==+n.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
1
+ function apbct_collect_visible_fields(t){var e,i=[],n="",c=0,o="",a=0,l=[];for(e in t.elements)isNaN(+e)||(i[e]=t.elements[e]);return(i=i.filter(function(t){return-1===l.indexOf(t.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(t.getAttribute("type"))||(l.push(t.getAttribute("name")),!1))})).forEach(function(t,e,i){"submit"!==t.getAttribute("type")&&null!==t.getAttribute("name")&&"ct_checkjs"!==t.getAttribute("name")&&("none"!==getComputedStyle(t).display&&"hidden"!==getComputedStyle(t).visibility&&"0"!==getComputedStyle(t).opacity&&"hidden"!==t.getAttribute("type")||t.classList.contains("wp-editor-area")?(n+=" "+t.getAttribute("name"),c++):(o+=" "+t.getAttribute("name"),a++))}),o=o.trim(),{visible_fields:n=n.trim(),visible_fields_count:c,invisible_fields:o,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(t,e){var i="object"==typeof t&&null!==t?t:{};if("native"===ctPublic.data__cookies_type)for(var n in i){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==e?e:n),JSON.stringify(i[n]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_js_keys__set_input_value(t,e,i,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var c=document.querySelectorAll("[name^=ct_checkjs]"),o=0;o<c.length;o++)c[o].value=t.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}!function(){var o=new Date,e=(new Date).getTime(),i=!0,n=[],c=0,a={},t=!1,l=!1;function s(t,e,i){"function"==typeof window.addEventListener?t.addEventListener(e,i):t.attachEvent(e,i)}function _(t,e,i){"function"==typeof window.removeEventListener?t.removeEventListener(e,i):t.detachEvent(e,i)}var d=function(t){var e=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",e),_(window,"mousedown",d),_(window,"keydown",d)},u=setInterval(function(){i=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(n))},1200),m=function(t){l||(ctSetCookie("ct_mouse_moved","true"),l=!0),!0===i&&(n.push([Math.round(t.clientY),Math.round(t.clientX),Math.round((new Date).getTime()-e)]),i=!1,50<=++c&&(_(window,"mousemove",m),clearInterval(u),clearInterval(r)))};function p(t){var e=t.target.value;!e||e in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:e},callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"custom_ajax"===ctPublicFunctions.data__ajax_type?apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{apbct_ajax:1,callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}function b(t){ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")&&jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+t+'">')}s(window,"mousemove",m),s(window,"mousedown",d),s(window,"keydown",d),s(window,"scroll",function(){t||(ctSetCookie("ct_has_scrolled","true"),t=!0)}),s(window,"DOMContentLoaded",function(){var t,e=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",o.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["ct_has_scrolled","false"],["ct_mouse_moved","false"]];if("native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var i=document.cookie.split(";");if(0!==i.length)for(var n=0;n<i.length;n++){var c=i[n].trim().split("=")[0];0===c.indexOf("apbct_visible_fields_")&&ctDeleteCookie(c)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(t){t&&b(t)}}):(t="custom_ajax"===ctPublicFunctions.data__ajax_type?1:0,apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{apbct_ajax:t,notJson:!0,callback:function(t){t&&b(t)}})):e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(p)),ctSetCookie(e),setTimeout(function(){for(var t=0;t<document.forms.length;t++){var e,i,n=document.forms[t];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()||((e=document.createElement("input")).setAttribute("type","hidden"),e.setAttribute("id","apbct_visible_fields_"+t),e.setAttribute("name","apbct_visible_fields"),(i={})[0]=apbct_collect_visible_fields(n),e.value=JSON.stringify(i),n.append(e),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=t,n.onsubmit=function(t){var e;"native"!==ctPublic.data__cookies_type&&void 0!==t.target.ctFormIndex&&((e={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(e,t.target.ctFormIndex)),t.target.onsubmit_prev instanceof Function&&setTimeout(function(){t.target.onsubmit_prev.call(t.target,t)},500)})}},1e3)})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(t,e,i){e.responseText&&-1!==e.responseText.indexOf('"apbct')&&void 0!==(e=JSON.parse(e.responseText)).apbct&&(e=e.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:e.comment}})),cleantalkModal.loaded=e.comment,cleantalkModal.open(),1==+e.stop_script&&window.stop())});
2
  //# sourceMappingURL=apbct-public.min.js.map
js/apbct-public.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Using AJAX request and handler\n\t\t\t}else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tapbct_ajax: 1,\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetPixelImg(pixelUrl) {\n\t\tctSetCookie('apbct_pixel_url', pixelUrl);\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + pixelUrl + '\">' );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctGetPixelUrl() {\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'apbct_get_pixel_url',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t// Using AJAX request and handler\n\t\t}else{\n\t\t\tvar ajaxType = ctPublicFunctions.data__ajax_type === 'custom_ajax' ? 1 : 0;\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tapbct_ajax: ajaxType,\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t];\n\n\t\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tctGetPixelUrl();\n\t\t\t} else {\n\t\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' // Custom form\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\t\tvar visibleFieldsToInput = {};\n\t\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\t\tform.append( hiddenInput );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( ctPublic.data__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["apbct_collect_visible_fields","form","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__cookies_type","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","floor","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","target","ctPublicFunctions","data__ajax_type","apbct_public_sendREST","method","email","timestamp","now","apbct_public_sendAJAX","action","apbct_ajax","ctSetPixelImg","pixelUrl","pixel__enabled","getElementById","jQuery","append","ajaxType","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","notJson","pixel__url","data__email_check_before_post","blur","setTimeout","forms","hiddenInput","visibleFieldsToInput","data__visible_fields_required","toString","toLowerCase","parentElement","id","name","createElement","setAttribute","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","ajaxComplete","xhr","settings","response","responseText","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAmSA,SAASA,6BAA8BC,GAGtC,IAAIC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAAmB,GACnBC,EAAyB,EACzBC,EAA8B,GAE/B,IAAI,IAAIC,KAAOP,EAAKQ,SACfC,OAAOF,KACVN,EAAOM,GAAOP,EAAKQ,SAASD,IAsD9B,OAlDAN,EAASA,EAAOS,OAAO,SAASC,GAG/B,OAA0E,IAAtEL,EAA4BM,QAASD,EAAKE,aAAa,YAItD,IAAM,CAAC,QAAS,YAAYD,QAASD,EAAKE,aAAa,WAC3DP,EAA4BQ,KAAMH,EAAKE,aAAa,UAC7C,OAMFE,QAAQ,SAASJ,EAAMK,EAAGR,GAGO,WAAtCG,EAAKE,aAAa,SACoB,OAAtCF,EAAKE,aAAa,SACoB,eAAtCF,EAAKE,aAAa,UAMoB,SAAtCI,iBAAiBN,GAAMO,SACe,WAAtCD,iBAAiBN,GAAMQ,YACe,MAAtCF,iBAAiBN,GAAMS,SACe,WAAtCT,EAAKE,aAAa,SAEdF,EAAKU,UAAUC,SAAS,mBAU5BpB,GAAkB,IAAMS,EAAKE,aAAa,QAC1CV,MAPCC,GAAoB,I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YS,aAAc,OAAQ,yBAC9BR,EAAuB,IACN,GAAKjI,6BAA6BC,GACvD+H,EAAYjF,MAAQV,KAAKC,UAAU2F,GACnChI,EAAK+G,OAAQgB,GAEb/H,EAAKyI,cAAgBzI,EAAK0I,SAE1B1I,EAAK2I,YAAc3H,EACnBhB,EAAK0I,SAAW,SAAUjE,GAEzB,IAEKjD,EAFgC,WAAhCQ,SAASC,yBAAuE,IAA7BwC,EAAMsB,OAAO4C,eAEhEnH,EAAiB,IACN,GAAKzB,6BAA6B6I,MACjDhH,gCAAiCJ,EAAgBiD,EAAMsB,OAAO4C,cAI3DlE,EAAMsB,OAAO0C,yBAAyBI,UACzChB,WAAW,WACVpD,EAAMsB,OAAO0C,cAAcK,KAAKrE,EAAMsB,OAAQtB,IAC5C,SAKJ,OA7RL,GAsZqB,oBAAXqC,QAGTA,OAAOnE,UAAUoG,aAAa,SAAUtE,EAAOuE,EAAKC,GACnD,IACKC,GADDF,EAAIG,eAAwD,IAAxCH,EAAIG,aAAavI,QAAQ,gBAElB,KAD1BsI,EAAW9G,KAAKgH,MAAMJ,EAAIG,eACVE,QACnBH,EAAWA,EAASG,OACPC,UACZ3G,SAAS4G,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAAST,EAASU,YAK9BC,eAAeC,OAASZ,EAASU,QACjCC,eAAeE,OAEa,IAAxBb,EAASc,aACZrF,OAAOsF"}
1
+ {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Using AJAX request and handler\n\t\t\t}else if( ctPublicFunctions.data__ajax_type === 'custom_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tapbct_ajax: 1,\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetPixelImg(pixelUrl) {\n\t\tctSetCookie('apbct_pixel_url', pixelUrl);\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + pixelUrl + '\">' );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctGetPixelUrl() {\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'apbct_get_pixel_url',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t// Using AJAX request and handler\n\t\t}else{\n\t\t\tvar ajaxType = ctPublicFunctions.data__ajax_type === 'custom_ajax' ? 1 : 0;\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tapbct_ajax: ajaxType,\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t];\n\n\t\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tctGetPixelUrl();\n\t\t\t} else {\n\t\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' // Custom form\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\t\tvar visibleFieldsToInput = {};\n\t\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\t\tform.append( hiddenInput );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( ctPublic.data__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}"],"names":["apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__cookies_type","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","event","callback","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","floor","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","target","ctPublicFunctions","data__ajax_type","apbct_public_sendREST","method","email","timestamp","now","apbct_public_sendAJAX","action","apbct_ajax","ctSetPixelImg","pixelUrl","pixel__enabled","getElementById","jQuery","append","ajaxType","initCookies","getTimezoneOffset","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","notJson","pixel__url","data__email_check_before_post","blur","setTimeout","forms","hiddenInput","visibleFieldsToInput","data__visible_fields_required","toString","toLowerCase","parentElement","id","name","createElement","setAttribute","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","ajaxComplete","xhr","settings","responseText","response","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkMod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ACzChB,WAAW,WACVpD,EAAMsB,OAAO0C,cAAcK,KAAKrE,EAAMsB,OAAQtB,IAC5C,SAKJ,OA9RL,GAuZqB,oBAAXqC,QAGTA,OAAOnE,UAAUoG,aAAa,SAAUtE,EAAOuE,EAAKC,GAC/CD,EAAIE,eAAwD,IAAxCF,EAAIE,aAAatI,QAAQ,gBAElB,KAD1BuI,EAAW/G,KAAKgH,MAAMJ,EAAIE,eACVG,QACnBF,EAAWA,EAASE,OACPC,UACZ3G,SAAS4G,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAASR,EAASS,YAK9BC,eAAeC,OAASX,EAASS,QACjCC,eAAeE,OAEa,IAAxBZ,EAASa,aACZrF,OAAOsF"}
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){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;null===c&&(c=null===t.getAttribute("disabled")?0:1),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_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__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 t,c,e=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0!==e.data("id")?(t={template_id:e.data("id"),template_name:e.data("name"),settings:e.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");var a={template_name:n}}else a={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:a},{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"),a=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:a},{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,15}$/))return jQuery("#apbct_button__get_key_auto__wrapper").show(),void jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!0);jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!1)}),jQuery("#apbct_setting_apikey").val()&&jQuery("#apbct_button__get_key_auto__wrapper").hide()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
1
+ function apbct_banner_check(){var c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null!==a)c.push(a[key]);else if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){function c(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))}c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class= 'apbct-icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){a.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}function apbct_save_button_position(){var t,e,n,a,c,s,o,i;null!==document.getElementById("apbct_settings__before_advanced_settings")&&null!==document.getElementById("apbct_settings__after_advanced_settings")&&null!==document.getElementById("apbct_settings__button_section")&&null!==document.getElementById("apbct_settings__advanced_settings")&&null!==document.getElementById("apbct_hidden_section_nav")&&(t=window.innerHeight,n=(e=document.getElementById("apbct_settings__advanced_settings")).getBoundingClientRect().top,c=(a=document.getElementById("apbct_settings__button_section")).getBoundingClientRect().height,o=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,i=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<o+i+c?(a.style.bottom="",a.style.top=o+i+20+"px"):(a.style.bottom=0,a.style.top="")):jQuery("#apbct_settings__main_save_button").show(),s.style.top=n<=0?30-n+"px":0)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var c,t=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0===t.data("id")?console.log('Attribute "data-id" not set for the option.'):(t={template_id:t.data("id"),template_name:t.data("name"),settings:t.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}}))}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");n={template_name:n}}else n={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbct_settings__showDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbct_banner_check(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbct_save_button_position(),window.addEventListener("scroll",apbct_save_button_position),jQuery("#ct_adv_showhide a").on("click",apbct_save_button_position),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val();if(""===t||null===t.match(/^[a-z\d]{3,15}$/))return jQuery("#apbct_button__get_key_auto__wrapper").show(),void jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!0);jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery('button.cleantalk_link[value="save_changes"]').prop("disabled",!1)}),jQuery("#apbct_setting_apikey").val()&&jQuery("#apbct_button__get_key_auto__wrapper").hide()});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
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\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\n\t\tapbct_banner_check();\n\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\tapbct_save_button_position();\n\twindow.addEventListener('scroll', apbct_save_button_position);\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\n\n\n\t/**\n\t * Change cleantalk account email\n\t */\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\n\t\te.preventDefault();\n\n\t\tvar $this = jQuery(this);\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\n\t\tvar accountEmail = accountEmailField.text();\n\n\t\t$this.toggleClass('active');\n\n\t\tif ($this.hasClass('active')) {\n\t\t\t$this.text($this.data('save-text'));\n\t\t\taccountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.on('keydown', function (e) {\n\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t\taccountEmailField.on('input', function (e) {\n\t\t\t\tif (e.inputType === 'insertParagraph') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tapbct_admin_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_update_account_email',\n\t\t\t\t\taccountEmail: accountEmail\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttimeout: 5000,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (result.error !== undefined) {\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\taccountEmailField.attr('contenteditable', 'false');\n\t\t\t$this.text($this.data('default-text'));\n\t\t}\n\t});\n\n\t/**\n\t * Validate apkikey and hide get auto btn\n\t */\n\tjQuery('#apbct_setting_apikey').on('input', function () {\n\t\tvar enteredValue = jQuery(this).val();\n\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,15}$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\n\t\t\treturn;\n\t\t}\n\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() ) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction apbct_save_button_position() {\n\tif (\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\n\t) {\n\t\treturn;\n\t}\n\tvar docInnerHeight = window.innerHeight;\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\n\n\t// Set Save button position\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\n\t\tjQuery('#apbct_settings__main_save_button').hide();\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\n\t\t\tbuttonBlock.style.bottom = '';\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\n\t\t} else {\n\t\t\tbuttonBlock.style.bottom = 0;\n\t\t\tbuttonBlock.style.top = '';\n\t\t}\n\t} else {\n\t\tjQuery('#apbct_settings__main_save_button').show();\n\t}\n\n\t// Set nav position\n\tif ( advSettingsOffset <= 0 ) {\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\n\t} else {\n\t\tnavBlock.style.top = 0;\n\t}\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","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","dialog","modal","my","at","of","width","draggable","resizable","closeText","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":"AAuSA,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,EA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EAAMG,KAAKH,EAAM7H,KAAK,oBAOxBI,OAAO,yBAAyByD,GAAG,QAAS,WAC3C,IAAI0E,EAAenI,OAAO+E,MAAMF,MAEhC,GAAqB,KAAjBsD,GAAiE,OAA1CA,EAAaC,MAAM,mBAG7C,OAFApI,OAAO,wCAAwC0B,YAC/C1B,OAAO,+CAA+CqI,KAAK,YAAY,GAIxErI,OAAO,wCAAwCE,OAC/CF,OAAO,+CAA+CqI,KAAK,YAAY,KAGnErI,OAAO,yBAAyB6E,OACpC7E,OAAO,wCAAwCE"}
1
+ {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length)\n\t\tapbct_banner_check();\n\n\tjQuery(document).on('change', '#apbct_settings_templates_export',function(){\n\t\tvar optionSelected = jQuery(\"option:selected\", this);\n\t\tif ( optionSelected.data(\"id\") === 'new_template' ) {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n\t\t} else {\n\t\t\tjQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n\t\t}\n\t});\n\n\tapbct_save_button_position();\n\twindow.addEventListener('scroll', apbct_save_button_position);\n\tjQuery('#ct_adv_showhide a').on('click', apbct_save_button_position);\n\n\n\t/**\n\t * Change cleantalk account email\n\t */\n\tjQuery('#apbct-change-account-email').on('click', function (e) {\n\t\te.preventDefault();\n\n\t\tvar $this = jQuery(this);\n\t\tvar accountEmailField = jQuery('#apbct-account-email');\n\t\tvar accountEmail = accountEmailField.text();\n\n\t\t$this.toggleClass('active');\n\n\t\tif ($this.hasClass('active')) {\n\t\t\t$this.text($this.data('save-text'));\n\t\t\taccountEmailField.attr('contenteditable', 'true');\n\t\t\taccountEmailField.on('keydown', function (e) {\n\t\t\t\tif (e.code === 'Enter') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t\taccountEmailField.on('input', function (e) {\n\t\t\t\tif (e.inputType === 'insertParagraph') {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tapbct_admin_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_update_account_email',\n\t\t\t\t\taccountEmail: accountEmail\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttimeout: 5000,\n\t\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\t\tif (result.success !== undefined && result.success === 'ok') {\n\t\t\t\t\t\t\tif (result.manuallyLink !== undefined) {\n\t\t\t\t\t\t\t\tjQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (result.error !== undefined) {\n\t\t\t\t\t\t\tjQuery('#apbct-account-email').css('border-color', 'red');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\taccountEmailField.attr('contenteditable', 'false');\n\t\t\t$this.text($this.data('default-text'));\n\t\t}\n\t});\n\n\t/**\n\t * Validate apkikey and hide get auto btn\n\t */\n\tjQuery('#apbct_setting_apikey').on('input', function () {\n\t\tvar enteredValue = jQuery(this).val();\n\n\t\tif (enteredValue === '' || enteredValue.match(/^[a-z\\d]{3,15}$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', true);\n\t\t\treturn;\n\t\t}\n\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').prop('disabled', false);\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() ) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n});\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbct_banner_check() {\n\tvar bannerChecker = setInterval( function() {\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_settings__check_renew_banner'},\n\t\t\t{\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif (result.close_renew_banner) {\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_renew').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_renew').hide('slow');\n\t\t\t\t\t\tif (jQuery('#cleantalk_notice_trial').length)\n\t\t\t\t\t\t\tjQuery('#cleantalk_notice_trial').hide('slow');\n\t\t\t\t\t\tclearInterval(bannerChecker);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param elems\n * @returns {*}\n */\nfunction apbct_get_elems(elems){\n elems = elems.split(',');\n for( var i=0, len = elems.length, tmp; i < len; i++){\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param elems string|array\n * @returns array\n */\nfunction apbct_get_elems__native(elems){\n\n\t// Make array from a string\n\tif(typeof elems === 'string')\n\t\telems = elems.split(',');\n\n\tvar out = [];\n\n\telems.forEach(function(elem, i, arr) {\n\n\t\t// try to get elements with such IDs\n\t\tvar tmp = document.getElementById(elem);\n\t\tif (tmp !== null){\n\t\t\tout.push( tmp[key] );\n\t\t\treturn;\n\t\t}\n\n\t\t// try to get elements with such class name\n\t\t// write each elem from collection to new element of output array\n\t\ttmp = document.getElementsByClassName(elem);\n\t\tif (tmp !== null && tmp.length !==0 ){\n\t\t\tfor(key in tmp){\n\t\t\t\tif( +key >= 0 ){\n\t\t\t\t\tout.push( tmp[key] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\treturn out;\n}\n\nfunction apbct_show_hide_elem(elems){\n\telems = apbct_get_elems(elems);\n for( var i=0, len = elems.length; i < len; i++){\n elems[i].each(function (i, elem) {\n elem = jQuery(elem);\n var label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(\":visible\")) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param ids string|array Selectors\n * @param enable\n */\nfunction apbctSettingsDependencies(ids, enable){\n\n\n\tenable = ! isNaN(enable) ? enable : null;\n\n\t// Get elements\n\tvar elems = apbct_get_elems__native( ids );\n\n\telems.forEach(function(elem, i, arr){\n\n\t\tvar do_disable = function(){elem.setAttribute('disabled', 'disabled');},\n\t\t\tdo_enable = function(){elem.removeAttribute('disabled');};\n\n\t\t// Set defined state\n\t\tif(enable === null) // Set\n\t\t\tenable = elem.getAttribute('disabled') === null ? 0 : 1;\n\n\t\tenable === 1 ? do_enable() : do_disable();\n\n\t\tif( elem.getAttribute('apbct_children') !== null){\n\t\t\tvar state = apbctSettingsDependencies_getState( elem ) && enable;\n\t\t\tif( state !== null ) {\n\t\t\t\tapbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n\t\t\t}\n\t\t}\n\n\t});\n}\n\nfunction apbctSettingsDependencies_getState( elem ){\n\n\tvar state;\n\n\tswitch ( elem.getAttribute( 'type' ) ){\n\t\tcase 'checkbox':\n\t\t\tstate = +elem.checked;\n\t\t\tbreak;\n\t\tcase 'radio':\n\t\t\tstate = +(+elem.getAttribute('value') === 1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstate = null;\n\t}\n\n\treturn state;\n}\n\nfunction apbct_settings__showDescription(label, setting_id){\n\n\tvar remove_desc_func = function(e){\n\t\tif(typeof e === 'undefined' || ((jQuery(e.target).parent('.apbct_long_desc').length == 0 || jQuery(e.target).hasClass('apbct_long_desc__cancel')) && !jQuery(e.target).hasClass('apbct_long_description__show'))){\n\t\t\tjQuery('.apbct_long_desc').remove();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tlabel.after(\"<div id='apbct_long_desc__\"+setting_id+\"' class='apbct_long_desc'></div>\");\n\tvar obj = jQuery('#apbct_long_desc__'+setting_id);\n\tobj.append(\"<i class= 'apbct-icon-spin1 animate-spin'></i>\")\n\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t.css({\n\t\t\ttop: label.position().top - 5,\n\t\t\tleft: label.position().left + 25\n\t\t});\n\n\n\tapbct_admin_sendAJAX(\n\t\t{action: 'apbct_settings__get__long_description', setting_id: setting_id},\n\t\t{\n\t\t\tspinner: obj.children('img'),\n\t\t\tcallback: function(result, data, params, obj){\n\n\t\t\t\tobj.empty()\n\t\t\t\t\t.append(\"<div class='apbct_long_desc__angle'></div>\")\n\t\t\t\t\t.append(\"<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>\")\n\t\t\t\t\t.append(\"<h3 class='apbct_long_desc__title'>\"+result.title+\"</h3>\")\n\t\t\t\t\t.append(\"<p>\"+result.desc+\"</p>\");\n\n\t\t\t\tjQuery(document).on('click', remove_desc_func);\n\t\t\t}\n\t\t},\n\t\tobj\n\t);\n}\n\nfunction apbct_save_button_position() {\n\tif (\n\t\tdocument.getElementById('apbct_settings__before_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__after_advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_settings__button_section') === null ||\n\t\tdocument.getElementById('apbct_settings__advanced_settings') === null ||\n\t\tdocument.getElementById('apbct_hidden_section_nav') === null\n\t) {\n\t\treturn;\n\t}\n\tvar docInnerHeight = window.innerHeight;\n\tvar advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n\tvar advSettingsOffset = advSettingsBlock.getBoundingClientRect().top;\n\tvar buttonBlock = document.getElementById('apbct_settings__button_section');\n\tvar buttonHeight = buttonBlock.getBoundingClientRect().height;\n\tvar navBlock = document.getElementById('apbct_hidden_section_nav');\n\tvar navBlockOffset = navBlock.getBoundingClientRect().top;\n\tvar navBlockHeight = navBlock.getBoundingClientRect().height;\n\n\t// Set Save button position\n\tif ( getComputedStyle(advSettingsBlock).display !== \"none\" ) {\n\t\tjQuery('#apbct_settings__main_save_button').hide();\n\t\tif ( docInnerHeight < navBlockOffset + navBlockHeight + buttonHeight ) {\n\t\t\tbuttonBlock.style.bottom = '';\n\t\t\tbuttonBlock.style.top = navBlockOffset + navBlockHeight + 20 + 'px';\n\t\t} else {\n\t\t\tbuttonBlock.style.bottom = 0;\n\t\t\tbuttonBlock.style.top = '';\n\t\t}\n\t} else {\n\t\tjQuery('#apbct_settings__main_save_button').show();\n\t}\n\n\t// Set nav position\n\tif ( advSettingsOffset <= 0 ) {\n\t\tnavBlock.style.top = - advSettingsOffset + 30 + 'px';\n\t} else {\n\t\tnavBlock.style.top = 0;\n\t}\n}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","push","key","getElementsByClassName","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependencies_getState","checked","apbct_settings__showDescription","setting_id","remove_desc_func","e","target","parent","hasClass","remove","off","after","append","css","top","position","left","spinner","children","empty","title","desc","on","apbct_save_button_position","docInnerHeight","advSettingsBlock","advSettingsOffset","buttonBlock","buttonHeight","navBlock","navBlockOffset","navBlockHeight","window","innerHeight","getBoundingClientRect","height","getComputedStyle","display","style","bottom","ready","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","console","log","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find","preventDefault","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","prop"],"mappings":"AAwRA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACpCF,OAAO,2BAA2BC,QACrCD,OAAO,2BAA2BE,KAAK,QACxCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD,OAAOD,EAUX,SAASK,wBAAwBL,GAGZ,iBAAVA,IACTA,EAAQA,EAAMI,MAAM,MAErB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,GAClC,GAAY,OAARP,EACHK,EAAIM,KAAMX,EAAIY,WAOf,GAAY,QADZZ,EAAMS,SAASI,uBAAuBN,KACJ,IAAdP,EAAIL,OACvB,IAAIiB,OAAOZ,EACE,IAAPY,KACJP,EAAIM,KAAMX,EAAIY,QAMXP,EAGR,SAASS,qBAAqBf,GAE1B,IAAK,IAAIE,EAAE,EAAGC,GADjBH,EAAQD,gBAAgBC,IACKJ,OAAQM,EAAIC,EAAKD,IACvCF,EAAME,GAAGc,KAAK,SAAUd,EAAGM,GAEvB,IAAIS,GADJT,EAAOb,OAAOa,IAC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IAAIC,EAAQhH,OAAO+E,MACfkC,EAAoBjH,OAAO,wBAC3BkH,EAAeD,EAAkBE,OAErCH,EAAMI,YAAY,UAEdJ,EAAMrE,SAAS,WAClBqE,EAAMG,KAAKH,EAAMpH,KAAK,cACtBqH,EAAkBnC,KAAK,kBAAmB,QAC1CmC,EAAkBxD,GAAG,UAAW,SAAUjB,GAC1B,UAAXA,EAAE6E,MACL7E,EAAEuE,mBAGJE,EAAkBxD,GAAG,QAAS,SAAUjB,GACnB,oBAAhBA,EAAE8E,WACL9E,EAAEuE,qBAIJvH,qBACC,CACCC,OAAQ,6BACRyH,aAAcA,GAEf,CACC9B,QAAS,IACT1F,SAAU,SAASC,EAAQC,EAAMC,EAAQC,QACjByH,IAAnB5H,EAAO0G,SAA4C,OAAnB1G,EAAO0G,cACdkB,IAAxB5H,EAAO6H,cACVxH,OAAO,4BAA4B8E,KAAK,OAAQnF,EAAO6H,mBAIpCD,IAAjB5H,EAAO8H,OACVzH,OAAO,wBAAwBgD,IAAI,eAAgB,UAMvDiE,EAAkBnC,KAAK,kBAAmB,SAC1CkC,EAAMG,KAAKH,EAAMpH,KAAK,oBAOxBI,OAAO,yBAAyByD,GAAG,QAAS,WAC3C,IAAIiE,EAAe1H,OAAO+E,MAAMF,MAEhC,GAAqB,KAAjB6C,GAAiE,OAA1CA,EAAaC,MAAM,mBAG7C,OAFA3H,OAAO,wCAAwC0B,YAC/C1B,OAAO,+CAA+C4H,KAAK,YAAY,GAIxE5H,OAAO,wCAAwCE,OAC/CF,OAAO,+CAA+C4H,KAAK,YAAY,KAGnE5H,OAAO,yBAAyB6E,OACpC7E,OAAO,wCAAwCE"}
js/cleantalk-admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_admin_sendAJAX(n,o,t){var a=o.callback||null,c=o.callback_context||null,l=o.callback_params||null,e=o.async||!0,r=o.notJson||null,s=o.timeout||15e3,t=t||null,i=o.button||null,u=o.spinner||null,d=o.progressbar||null;"string"==typeof n?n=n+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(n._ajax_nonce=ctAdminCommon._ajax_nonce,n.no_cache=Math.random()),i&&(i.setAttribute("disabled","disabled"),i.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,async:e,success:function(e){i&&(i.removeAttribute("disabled"),i.style.cursor="pointer"),u&&jQuery(u).css("display","none"),r||(e=JSON.parse(e)),e.error?(setTimeout(function(){d&&d.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):a&&(l?a.apply(c,l.concat(e,n,o,t)):a(e,n,o,t))},error:function(e,n,o){i&&(i.removeAttribute("disabled"),i.style.cursor="pointer"),u&&jQuery(u).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o)},timeout:s})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),n="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+n}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap").css("display","inline-block"),jQuery("body").on("click",".apbct-notice .notice-dismiss",function(e){var n=jQuery(e.target).parent().attr("id");n&&apbct_admin_sendAJAX({action:"cleantalk_dismiss_notice",notice_id:n},{callback:null})})});
2
  //# sourceMappingURL=cleantalk-admin.min.js.map
1
+ function apbct_admin_sendAJAX(n,o,a){var t=o.callback||null,l=o.callback_context||null,c=o.callback_params||null,e=o.async||!0,r=o.notJson||null,s=o.timeout||15e3,a=a||null,i=o.button||null,u=o.spinner||null,d=o.progressbar||null;"string"==typeof n?n=n+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(n._ajax_nonce=ctAdminCommon._ajax_nonce,n.no_cache=Math.random()),i&&(i.setAttribute("disabled","disabled"),i.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,async:e,success:function(e){i&&(i.removeAttribute("disabled"),i.style.cursor="pointer"),u&&jQuery(u).css("display","none"),(e=r?e:JSON.parse(e)).error?(setTimeout(function(){d&&d.fadeOut("slow")},1e3),"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded="Error:<br>"+e.error.toString(),cleantalkModal.open()):alert("Error happens: "+(e.error||"Unkown"))):t&&(c?t.apply(l,c.concat(e,n,o,a)):t(e,n,o,a))},error:function(e,n,o){i&&(i.removeAttribute("disabled"),i.style.cursor="pointer"),u&&jQuery(u).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o)},timeout:s})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),n="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+n}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap").css("display","inline-block"),jQuery("body").on("click",".apbct-notice .notice-dismiss",function(e){e=jQuery(e.target).parent().attr("id");e&&apbct_admin_sendAJAX({action:"cleantalk_dismiss_notice",notice_id:e},{callback:null})})});
2
  //# sourceMappingURL=cleantalk-admin.min.js.map
js/cleantalk-admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Auto update banner close handler\n\tjQuery('.apbct_update_notice').on('click', 'button', function(){\n\t\tvar ct_date = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\tdocument.cookie = \"apbct_update_banner_closed=1; path=/; expires=\" + ct_date.toUTCString() + \"; samesite=lax\" + ctSecure;\n\t});\n\t\n\tjQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space','nowrap').css('display','inline-block');\n\n\tjQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e){\n\t\tvar apbct_notice_name = jQuery(e.target).parent().attr('id');\n\t\tif( apbct_notice_name ) {\n\t\t\tapbct_admin_sendAJAX( { 'action' : 'cleantalk_dismiss_notice', 'notice_id' : apbct_notice_name }, { 'callback' : null } );\n\t\t}\n\t});\n\t\n});\nfunction apbct_admin_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\n\tif(typeof (data) === 'string') {\n\t\tdata = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n\t} else {\n\t\tdata._ajax_nonce = ctAdminCommon._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctAdminCommon._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}"],"names":["apbct_admin_sendAJAX","data","params","obj","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","ctSecure","location","protocol","cookie","toUTCString","e","apbct_notice_name","target","parent","attr","action","notice_id"],"mappings":"AAmBA,SAASA,qBAAqBC,EAAMC,EAAQC,GAG3C,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,QAAS,EACxBC,EAAcN,EAAOM,SAAe,KACpCC,EAAcP,EAAOO,SAAe,KACpCN,EAAcA,GAAsB,KACpCO,EAAcR,EAAOQ,QAAe,KACpCC,EAAcT,EAAOS,SAAe,KACpCC,EAAcV,EAAOU,aAAe,KAEnB,iBAAX,EACTX,EAAOA,EAAO,gBAAkBY,cAAcC,YAAc,aAAeC,KAAKC,UAEhFf,EAAKa,YAAcD,cAAcC,YACjCb,EAAKgB,SAAWF,KAAKC,UAGnBN,IAAUA,EAAOQ,aAAa,WAAY,YAAaR,EAAOS,MAAMC,OAAS,eAC7ET,GAASU,OAAOV,GAASW,IAAI,UAAW,UAE3CD,OAAOE,KAAK,CACXC,KAAM,OACNC,IAAKZ,cAAca,UACnBzB,KAAMA,EACNM,MAAOA,EACPoB,QAAS,SAASC,GACdlB,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOS,MAAMC,OAAS,WACpET,GAAUU,OAAOV,GAASW,IAAI,UAAW,QACxCd,IAASoB,EAASE,KAAKC,MAAMH,IAC9BA,EAAOI,OACTC,WAAW,WAAerB,GAAaA,EAAYsB,QAAQ,SAAY,KACvEC,MAAM,mBAAqBP,EAAOI,OAAS,YAExC5B,IACEE,EACHF,EAASgC,MAAO/B,EAAkBC,EAAgB+B,OAAQT,EAAQ3B,EAAMC,EAAQC,IAEhFC,EAASwB,EAAQ3B,EAAMC,EAAQC,KAInC6B,MAAO,SAASM,EAAOC,EAAYC,GAC/B9B,IAAUA,EAAOmB,gBAAgB,YAAanB,EAAOS,MAAMC,OAAS,WACpET,GAASU,OAAOV,GAASW,IAAI,UAAW,QAC3CmB,QAAQC,IAAI,oBACZD,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEb/B,QAASA,IAxEXY,OAAOsB,UAAUC,MAAM,WAGtBvB,OAAO,wBAAwBwB,GAAG,QAAS,SAAU,WACpD,IAAIC,EAAU,IAAIC,MAAK,IAAIA,MAAOC,UAAY,QAC1CC,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DR,SAASS,OAAS,iDAAmDN,EAAQO,cAAgB,iBAAmBJ,IAGjH5B,OAAO,mDAAmDC,IAAI,cAAc,UAAUA,IAAI,UAAU,gBAEpGD,OAAO,QAAQwB,GAAG,QAAS,gCAAiC,SAASS,GACpE,IAAIC,EAAoBlC,OAAOiC,EAAEE,QAAQC,SAASC,KAAK,MACnDH,GACHvD,qBAAsB,CAAE2D,OAAW,2BAA4BC,UAAcL,GAAqB,CAAEnD,SAAa"}
1
+ {"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Auto update banner close handler\n\tjQuery('.apbct_update_notice').on('click', 'button', function(){\n\t\tvar ct_date = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\tdocument.cookie = \"apbct_update_banner_closed=1; path=/; expires=\" + ct_date.toUTCString() + \"; samesite=lax\" + ctSecure;\n\t});\n\t\n\tjQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space','nowrap').css('display','inline-block');\n\n\tjQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e){\n\t\tvar apbct_notice_name = jQuery(e.target).parent().attr('id');\n\t\tif( apbct_notice_name ) {\n\t\t\tapbct_admin_sendAJAX( { 'action' : 'cleantalk_dismiss_notice', 'notice_id' : apbct_notice_name }, { 'callback' : null } );\n\t\t}\n\t});\n\t\n});\nfunction apbct_admin_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\n\tif(typeof (data) === 'string') {\n\t\tdata = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n\t} else {\n\t\tdata._ajax_nonce = ctAdminCommon._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctAdminCommon._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\tif( typeof cleantalkModal !== 'undefined' ) {\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = 'Error:<br>' + result.error.toString();\n\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t} else {\n\t\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t\t}\n\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}"],"names":["apbct_admin_sendAJAX","data","params","obj","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","cleantalkModal","loaded","toString","open","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","ctSecure","location","protocol","cookie","toUTCString","e","apbct_notice_name","target","parent","attr","action","notice_id"],"mappings":"AAmBA,SAASA,qBAAqBC,EAAMC,EAAQC,GAG3C,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,Q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,QAAS,SAAU,WACpD,IAAIC,EAAU,IAAIC,MAAK,IAAIA,MAAOC,UAAY,QAC1CC,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DR,SAASS,OAAS,iDAAmDN,EAAQO,cAAgB,iBAAmBJ,IAGjHhC,OAAO,mDAAmDC,IAAI,cAAc,UAAUA,IAAI,UAAU,gBAEpGD,OAAO,QAAQ4B,GAAG,QAAS,gCAAiC,SAASS,GAChEC,EAAoBtC,OAAOqC,EAAEE,QAAQC,SAASC,KAAK,MACnDH,GACH3D,qBAAsB,CAAE+D,OAAW,2BAA4BC,UAAcL,GAAqB,CAAEvD,SAAa"}
js/cleantalk-comments-checkspam.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ct_working=!(String.prototype.printf=function(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctCommentsCheck.ct_prev_accurate,ct_prev_from=ctCommentsCheck.ct_prev_from,ct_prev_till=ctCommentsCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctCommentsCheck.ct_ajax_nonce,ct_comments_total=0,ct_comments_checked=0,ct_comments_spam=0,ct_comments_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_comments(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c="https:"===location.protocol?"; secure":"";document.cookie="apbct_check_comments_offset=0; path=/; samesite=lax"+c;var a={action:"ajax_clear_comments",security:ct_ajax_nonce,from:e,till:t};jQuery.ajax({type:"POST",url:ajaxurl,data:a,success:function(e){ct_show_info(),ct_send_comments()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_comments(),ct_show_info()}function ct_send_comments(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_comments",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,offset:Number(ctGetCookie("apbct_check_comments_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c,a;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_comments():(t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||!0===ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_comments_checked+=e.checked,ct_comments_spam+=e.spam,ct_comments_bad+=e.bad,ct_comments_total+=e.total,ct_unchecked=ct_comments_total-ct_comments_checked-ct_comments_bad,c=(c=String(ctCommentsCheck.ct_status_string)).printf(ct_comments_checked,ct_comments_spam,ct_comments_bad),0<parseInt(ct_comments_spam)&&(c+=ctCommentsCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),+ct_comments_total<ct_comments_checked+ct_comments_bad&&(document.cookie="ct_comments_start_check=1; path=/; samesite=lax",location.href="edit-comments.php?page=ct_check_spam"),a=Number(ctGetCookie("apbct_check_comments_offset"))+100,document.cookie="apbct_check_comments_offset="+a+"; path=/",ct_send_comments()))},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_send_comments(),3e3)},timeout:25e3})}}function ct_show_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();var e;jQuery("#ct_cooling_notice").hide(),ct_comments_total||(e={action:"ajax_info_comments",security:ct_ajax_nonce},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_comments_total=e.total,ct_comments_spam=e.spam,ct_comments_checked=e.checked,ct_comments_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_show_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_trash_all(a){var e={action:"ajax_trash_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_trash_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_trash_all(a),3e3)},timeout:25e3})}function ct_spam_all(a){var e={action:"ajax_spam_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_spam_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_spam_all(a),3e3)},timeout:25e3})}function ctGetCookie(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_spam_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_spam_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_info(),ct_send_comments()):ct_clear_comments())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_spam_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),"1"===ctCommentsCheck.start&&(document.cookie="ct_comments_start_check=0; expires="+new Date(0).toUTCString()+"; path=/; samesite=lax",jQuery("#ct_check_spam_button").click()),jQuery(".ct_trash_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_trash_all)&&void ct_trash_all(e)}),jQuery(".ct_spam_all").click(function(e){return!!confirm(ctCommentsCheck.ct_confirm_spam_all)&&void ct_spam_all(e)})});
2
  //# sourceMappingURL=cleantalk-comments-checkspam.min.js.map
1
+ var ct_working=!(String.prototype.printf=function(){var e,t=this;for(e in arguments)var c=t.substring(0,t.indexOf("%s",0)),a=t.substring(t.indexOf("%s",0)+2,t.length),t=c+arguments[e]+a;return t}),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctCommentsCheck.ct_prev_accurate,ct_prev_from=ctCommentsCheck.ct_prev_from,ct_prev_till=ctCommentsCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctCommentsCheck.ct_ajax_nonce,ct_comments_total=0,ct_comments_checked=0,ct_comments_spam=0,ct_comments_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function animate_comment(e,t){ct_close_animate?.3==e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_comments(){var e=0,t=0,c=(jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val()),"https:"===location.protocol?"; secure":"");document.cookie="apbct_check_comments_offset=0; path=/; samesite=lax"+c,jQuery.ajax({type:"POST",url:ajaxurl,data:{action:"ajax_clear_comments",security:ct_ajax_nonce,from:e,till:t},success:function(e){ct_show_info(),ct_send_comments()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_comments(),ct_show_info()}function ct_send_comments(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var e={action:"ajax_check_comments",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,offset:Number(ctGetCookie("apbct_check_comments_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_comments():(t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||!0===ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="edit-comments.php?page=ct_check_spam",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_comments_checked+=e.checked,ct_comments_spam+=e.spam,ct_comments_bad+=e.bad,ct_comments_total+=e.total,ct_unchecked=ct_comments_total-ct_comments_checked-ct_comments_bad,t=(t=String(ctCommentsCheck.ct_status_string)).printf(ct_comments_checked,ct_comments_spam,ct_comments_bad),0<parseInt(ct_comments_spam)&&(t+=ctCommentsCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(t),jQuery("#ct_error_message").hide(),+ct_comments_total<ct_comments_checked+ct_comments_bad&&(document.cookie="ct_comments_start_check=1; path=/; samesite=lax",location.href="edit-comments.php?page=ct_check_spam"),e=Number(ctGetCookie("apbct_check_comments_offset"))+100,document.cookie="apbct_check_comments_offset="+e+"; path=/",ct_send_comments()))},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_send_comments(),3e3)},timeout:25e3})}}function ct_show_info(){if(ct_working){if(1==ct_cooling_down_flag)return jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),void jQuery("#ct_cooling_notice").show();var e;jQuery("#ct_cooling_notice").hide(),ct_comments_total||(e={action:"ajax_info_comments",security:ct_ajax_nonce},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_comments_total=e.total,ct_comments_spam=e.spam,ct_comments_checked=e.checked,ct_comments_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_show_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_trash_all(a){var e={action:"ajax_trash_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_trash_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_trash_all(a),3e3)},timeout:25e3})}function ct_spam_all(a){var e={action:"ajax_spam_all",security:ct_ajax_nonce};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){0<e?(jQuery("#cleantalk_comments_left").html(e),ct_spam_all(a)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="edit-comments.php?page=ct_check_spam")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check comments"),setTimeout(ct_spam_all(a),3e3)},timeout:25e3})}function ctGetCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_spam_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_spam_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var a=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),e=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);a.not(this).datepicker("option",t,e),document.cookie="ct_spam_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_spam_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function e(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""==ct_date_from||""==ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_info(),ct_send_comments()):ct_clear_comments())}jQuery("#ct_check_spam_button").click(function(){e(!(document.cookie="ct_paused_spam_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){e(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_spam_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),"1"===ctCommentsCheck.start&&(document.cookie="ct_comments_start_check=0; expires="+new Date(0).toUTCString()+"; path=/; samesite=lax",jQuery("#ct_check_spam_button").click()),jQuery(".ct_trash_all").click(function(e){if(!confirm(ctCommentsCheck.ct_confirm_trash_all))return!1;ct_trash_all(e)}),jQuery(".ct_spam_all").click(function(e){if(!confirm(ctCommentsCheck.ct_confirm_spam_all))return!1;ct_spam_all(e)})});
2
  //# sourceMappingURL=cleantalk-comments-checkspam.min.js.map
js/cleantalk-comments-checkspam.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-comments-checkspam.min.js","sources":["cleantalk-comments-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\n\tct_comments_total = 0,\n\tct_comments_checked = 0,\n\tct_comments_spam = 0,\n\tct_comments_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to==0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_comments(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\t\n\tvar data = {\n\t\t'action' : 'ajax_clear_comments',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}\n\t});\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_comments();\n\tct_show_info();\n}\n\nfunction ct_send_comments(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\t\n\tvar data = {\n\t\t'action': 'ajax_check_comments',\n\t\t'security': ct_ajax_nonce,\n\t\t'new_check': ct_new_check,\n\t\t'unchecked': ct_unchecked,\n\t\t'offset' : Number(ctGetCookie('apbct_check_comments_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_comments();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_comments_checked += msg.checked;\n\t\t\t\t\tct_comments_spam += msg.spam;\n\t\t\t\t\tct_comments_bad += msg.bad;\n\t\t\t\t\tct_comments_total += msg.total;\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_checked, ct_comments_spam, ct_comments_bad);\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\t// If DB woks not properly\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/; samesite=lax';\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\t}\n\n\t\t\t\t\tvar offset = Number(ctGetCookie('apbct_check_comments_offset')) + 100;\n\t\t\t\t\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + offset + \"; path=/\";\n\t\t\t\t\t\n\t\t\t\t\tct_send_comments();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_send_comments(), 3000); \n },\n timeout: 25000\n\t});\n}\nfunction ct_show_info(){\n\t\n\tif(ct_working){\n\t\t\n\t\tif(ct_cooling_down_flag == true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\n\t\t\tjQuery('#ct_cooling_notice').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif(!ct_comments_total){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_comments',\n\t\t\t\t'security': ct_ajax_nonce\n\t\t\t};\n\t\t\t\n\t\t\tif(ct_date_from && ct_date_till){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_comments_total = msg.total;\n\t\t\t\t\tct_comments_spam = msg.spam;\n\t\t\t\t\tct_comments_checked = msg.checked;\n\t\t\t\t\tct_comments_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\nfunction ct_trash_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_trash_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_trash_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_trash_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\nfunction ct_spam_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_spam_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_spam_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_spam_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\njQuery(document).ready(function(){\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n jQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\tfunction ct_start_check(continue_check){\n\n continue_check = continue_check || null;\n\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\t\t\t\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\t\t\t\t\t\t\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\n\t\t\t\talert('Please, specify a date range.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\t\tct_accurate_check = true;\n\t\t}\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_working_message').show();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_pause').show();\n\n\t\tct_working=true;\n\t\t\n\t\tif(continue_check){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}else\n\t\t\tct_clear_comments();\n\t\t\n\t}\n\t\n\t// Check comments\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_spam_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\n\n\tif(ctCommentsCheck.start === '1'){\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/; samesite=lax';\n\t\tjQuery('#ct_check_spam_button').click();\t\n\t}\n\n\t// Delete all spam comments\n\tjQuery(\".ct_trash_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_trash_all))\n\t\t\treturn false;\n\n\t\tct_trash_all( e );\n\n\t});\n\n\t// Mark as spam all spam comments\n\tjQuery(\".ct_spam_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_spam_all))\n\t\t\treturn false;\n\n\t\tct_spam_all( e );\n\n\t});\n\n});\n\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n\tvar matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}"],"names":["ct_working","String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","from","till","is","val","ctSecure","location","protocol","document","cookie","data","action","security","ajax","type","url","ajaxurl","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","offset","Number","ctGetCookie","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","href","end","hide","checked","spam","bad","total","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_trash_all","e","target","addClass","css","removeClass","ct_spam_all","name","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","alert","click","ct_check","accurate","JSON","stringify","start","Date","toUTCString","ct_confirm_trash_all","ct_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sBAAuBX,OAAO,uBAAuBM,MAAO,yBAC9EI,SAASC,OAAS,sBAAuBX,OAAO,uBAAuBM,MAAO,4BAKjF,SAASwF,EAAeC,GAEjBA,EAAiBA,GAAkB,KAEtC/F,OAAO,wBAAwBK,GAAG,cAEpCV,aAAeK,OAAO,uBAAuBM,MAC7CV,aAAeI,OAAO,uBAAuBM,MAExB,IAAhBX,cAAsC,IAAhBC,cAC1BoG,MAAM,kCAKLhG,OAAO,sBAAsBK,GAAG,cAClCzB,mBAAoB,GAGrBoB,OAAO,eAAeuC,OACtBvC,OAAO,uBAAuBkD,OAC9BlD,OAAO,iBAAiBkD,OACxBlD,OAAO,aAAakD,OAEpBtF,YAAW,EAERmI,GACF1E,eACAC,oBAEApB,qBAKFF,OAAO,yBAAyBiG,MAAM,WAErCH,IADApF,SAASC,OAAS,mDAGnBX,OAAO,4BAA4BiG,MAAM,WACxCH,GAAe,KAIhB9F,OAAO,aAAa0E,GAAG,QAAS,WAC/B7F,UAAW,EACX,IAAIqH,EAAW,CACdC,SAAYvH,kBACZuB,KAAYR,aACZS,KAAYR,cAEbc,SAASC,OAAS,wBAA0ByF,KAAKC,UAAUH,GAAY,2BAI3C,MAA1BnH,gBAAgBuH,QAClB5F,SAASC,OAAS,sCAAwC,IAAI4F,KAAK,GAAGC,cAAgB,yBACtFxG,OAAO,yBAAyBiG,SAIjCjG,OAAO,iBAAiBiG,MAAM,SAAUrC,GAEvC,QAAKzB,QAAQpD,gBAAgB0H,4BAG7B9C,aAAcC,KAKf5D,OAAO,gBAAgBiG,MAAM,SAAUrC,GAEtC,QAAKzB,QAAQpD,gBAAgB2H,2BAG7BzC,YAAaL"}
1
+ {"version":3,"file":"cleantalk-comments-checkspam.min.js","sources":["cleantalk-comments-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctCommentsCheck.ct_prev_accurate,\n\tct_prev_from = ctCommentsCheck.ct_prev_from,\t\n\tct_prev_till = ctCommentsCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctCommentsCheck.ct_ajax_nonce,\n\tct_comments_total = 0,\n\tct_comments_checked = 0,\n\tct_comments_spam = 0,\n\tct_comments_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to==0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_comments(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\t\n\tvar data = {\n\t\t'action' : 'ajax_clear_comments',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}\n\t});\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_comments();\n\tct_show_info();\n}\n\nfunction ct_send_comments(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\t\n\tvar data = {\n\t\t'action': 'ajax_check_comments',\n\t\t'security': ct_ajax_nonce,\n\t\t'new_check': ct_new_check,\n\t\t'unchecked': ct_unchecked,\n\t\t'offset' : Number(ctGetCookie('apbct_check_comments_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_comments();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause === true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_comments_checked += msg.checked;\n\t\t\t\t\tct_comments_spam += msg.spam;\n\t\t\t\t\tct_comments_bad += msg.bad;\n\t\t\t\t\tct_comments_total += msg.total;\n\t\t\t\t\tct_unchecked = ct_comments_total - ct_comments_checked - ct_comments_bad;\n\t\t\t\t\tvar status_string = String(ctCommentsCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_comments_checked, ct_comments_spam, ct_comments_bad);\n\t\t\t\t\tif(parseInt(ct_comments_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctCommentsCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\t// If DB woks not properly\n\t\t\t\t\tif(+ct_comments_total < ct_comments_checked + ct_comments_bad){\n\t\t\t\t\t\tdocument.cookie = 'ct_comments_start_check=1; path=/; samesite=lax';\n\t\t\t\t\t\tlocation.href = 'edit-comments.php?page=ct_check_spam';\n\t\t\t\t\t}\n\n\t\t\t\t\tvar offset = Number(ctGetCookie('apbct_check_comments_offset')) + 100;\n\t\t\t\t\tdocument.cookie = 'apbct_check_comments_offset' + \"=\" + offset + \"; path=/\";\n\t\t\t\t\t\n\t\t\t\t\tct_send_comments();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_send_comments(), 3000); \n },\n timeout: 25000\n\t});\n}\nfunction ct_show_info(){\n\t\n\tif(ct_working){\n\t\t\n\t\tif(ct_cooling_down_flag == true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)');\n\t\t\tjQuery('#ct_cooling_notice').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif(!ct_comments_total){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_comments',\n\t\t\t\t'security': ct_ajax_nonce\n\t\t\t};\n\t\t\t\n\t\t\tif(ct_date_from && ct_date_till){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_comments_total = msg.total;\n\t\t\t\t\tct_comments_spam = msg.spam;\n\t\t\t\t\tct_comments_checked = msg.checked;\n\t\t\t\t\tct_comments_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\t\t\tsetTimeout(ct_show_info(), 3000); \n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\nfunction ct_trash_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_trash_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_trash_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_trash_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\nfunction ct_spam_all( e ) {\n\n\tvar data = {\n\t\t'action': 'ajax_spam_all',\n\t\t'security': ct_ajax_nonce\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_comments_left').html(msg);\n\t\t\t\tct_spam_all( e );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='edit-comments.php?page=ct_check_spam';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check comments');\n\t\t\tsetTimeout(ct_spam_all( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n\n}\n\njQuery(document).ready(function(){\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_spam_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n jQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_spam_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_spam_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\tfunction ct_start_check(continue_check){\n\n continue_check = continue_check || null;\n\n\t\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\t\t\t\n\t\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\t\t\t\t\t\t\n\t\t\tif(!(ct_date_from != '' && ct_date_till != '')){\n\t\t\t\talert('Please, specify a date range.');\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\t\tct_accurate_check = true;\n\t\t}\n\t\t\n\t\tjQuery('.ct_to_hide').hide();\n\t\tjQuery('#ct_working_message').show();\n\t\tjQuery('#ct_preloader').show();\n\t\tjQuery('#ct_pause').show();\n\n\t\tct_working=true;\n\t\t\n\t\tif(continue_check){\n\t\t\tct_show_info();\n\t\t\tct_send_comments();\n\t\t}else\n\t\t\tct_clear_comments();\n\t\t\n\t}\n\t\n\t// Check comments\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_spam_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_spam_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\n\n\tif(ctCommentsCheck.start === '1'){\n\t\tdocument.cookie = 'ct_comments_start_check=0; expires=' + new Date(0).toUTCString() + '; path=/; samesite=lax';\n\t\tjQuery('#ct_check_spam_button').click();\t\n\t}\n\n\t// Delete all spam comments\n\tjQuery(\".ct_trash_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_trash_all))\n\t\t\treturn false;\n\n\t\tct_trash_all( e );\n\n\t});\n\n\t// Mark as spam all spam comments\n\tjQuery(\".ct_spam_all\").click(function( e ){\n\n\t\tif (!confirm(ctCommentsCheck.ct_confirm_spam_all))\n\t\t\treturn false;\n\n\t\tct_spam_all( e );\n\n\t});\n\n});\n\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n\tvar matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}"],"names":["ct_working","String","prototype","printf","arg","formatted","this","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctCommentsCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_comments_total","ct_comments_checked","ct_comments_spam","ct_comments_bad","ct_unchecked","ct_date_from","ct_date_till","animate_comment","to","id","jQuery","fadeTo","ct_clear_comments","from","till","ctSecure","is","val","location","protocol","document","cookie","ajax","type","url","ajaxurl","data","action","security","success","msg","ct_show_info","ct_send_comments","ct_cooling_down_toggle","setTimeout","new_check","unchecked","offset","Number","ctGetCookie","status_string","parseJSON","parseInt","error","confirm","error_message","new_href","href","end","hide","checked","spam","bad","total","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_trash_all","e","target","addClass","css","removeClass","ct_spam_all","name","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_start_check","continue_check","alert","click","ct_check","accurate","JSON","stringify","start","Date","toUTCString","ct_confirm_trash_all","ct_confirm_spam_all"],"mappings":"AAYA,IAAIA,aAXJC,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,QAAQ,KAAM,IAClEC,EAAmBN,EAAUI,UAAUJ,EAAUK,QAAQ,KAAM,GAAG,EAAGL,EAAUO,QACnFP,EAAYG,EAAmBD,UAAUH,GAAOO,EAE9C,OAAON,IAKVQ,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,gBAAgBD,iBACnCE,aAAeD,gBAAgBC,aAC/BC,aAAeF,gBAAgBE,aAE5BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,gBAAgBM,cACnCC,kBAAoB,EACpBC,oBAAsB,EACtBC,iBAAmB,EACnBC,gBAAkB,EAClBC,aAAe,QACfC,aAAe,EACfC,aAAe,EAEhB,SAASC,gBAAgBC,EAAGC,GACxBpB,iBACK,IAAJmB,EACFE,OAAO,YAAYD,GAAIE,OAAO,IAAIH,EAAG,WACpCD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AAS,sCAAwC,IAAI4F,KAAK,GAAGC,cAAgB,yBACtFxG,OAAO,yBAAyBiG,SAIjCjG,OAAO,iBAAiBiG,MAAM,SAAUrC,GAEvC,IAAK1B,QAAQnD,gBAAgB0H,sBAC5B,OAAO,EAER9C,aAAcC,KAKf5D,OAAO,gBAAgBiG,MAAM,SAAUrC,GAEtC,IAAK1B,QAAQnD,gBAAgB2H,qBAC5B,OAAO,EAERzC,YAAaL"}
js/cleantalk-comments-editscreen.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-comments-editscreen.min.js","sources":["cleantalk-comments-editscreen.js"],"sourcesContent":["function ct_is_email(str){\n\treturn str.search(/.*@.*\\..*/);\n}\nfunction ct_is_ip(str){\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\n}\n\njQuery(document).ready(function(){\n\n\t/* Shows link to blacklists near every email and IP address */\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\n\t\t\tvar ct_curr_str = jQuery(this).html();\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\n\t\t\t}\n\t\t});\n\t\t\n\t/* Feedback for comments */\n\tvar ct_comment_id;\n\t\n\t// For approved\n\tjQuery('span.approve').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\n\t\n\t// For unapprove\n\tjQuery('span.unapprove').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\n\t});\n\t\n\t// For spammed\n\tjQuery('span.spam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\n\t\t\n\t\tsetTimeout(function(){\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\n\t\t\t\tvar result = jQuery(this).attr('href');\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\n\t\t\t\tct_comment_id = result[1];\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\n\t\t\t});\n\t\t}, 202);\n\t\t\n\t});\n\t\n\t// For unspammed\n\tjQuery('span.unspam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\n\t});\n\t\n\t// For untrashed\n\tjQuery('span.untrash a').on('click', function(){\n\t\tvar result = jQuery(this).attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\t\n});\n\n// Send feedback to backend\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\n\t\n\tvar data = {\n\t\t'action': 'ct_feedback_comment',\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\n\t\t'comment_id': ct_comment_id,\n\t\t'comment_status': ct_comment_status\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n timeout: 5000\n\t});\n}\n\n// Outputs CT message about feedback\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\n\tif(ct_result == 1){\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\n\t\t}\n\t\tif(ct_comment_status == 'spam'){\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg);\n\t\t\t}else{\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\n\t\t\t}\n\t\t}\n\t}\n\tif(ct_result == 0){\n\t\t// Error occurred\n\t}if(ct_result == 'no_hash'){\n\t\t// No hash for this comment\n\t}\n}\n"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg","is","document","ready","parseInt","ct_show_check_links","each","ct_curr_str","this","after","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAwEnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,UAErD,QAArB9B,IACCS,OAAO,MAAMsB,GAAG,SAAShC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiByB,kBAE9BrB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,OACAG,IAAI,aAAc,yBAClBF,OAAO,yBAAyBC,SAAS,MACxCD,OAAO,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C,OAAO6B,MAAMK,KAAK,SACfC,MAAM,8BACtB7C,EAAgB2C,EAAO,GACvBM,gBAAkBlD,yBAAyBC,EAAe,UAAW"}
1
+ {"version":3,"file":"cleantalk-comments-editscreen.min.js","sources":["cleantalk-comments-editscreen.js"],"sourcesContent":["function ct_is_email(str){\n\treturn str.search(/.*@.*\\..*/);\n}\nfunction ct_is_ip(str){\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\n}\n\njQuery(document).ready(function(){\n\n\t/* Shows link to blacklists near every email and IP address */\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\n\t\t\tvar ct_curr_str = jQuery(this).html();\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\n\t\t\t}\n\t\t});\n\t\t\n\t/* Feedback for comments */\n\tvar ct_comment_id;\n\t\n\t// For approved\n\tjQuery('span.approve').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\n\t\n\t// For unapprove\n\tjQuery('span.unapprove').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\n\t});\n\t\n\t// For spammed\n\tjQuery('span.spam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\n\t\t\n\t\tsetTimeout(function(){\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\n\t\t\t\tvar result = jQuery(this).attr('href');\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\n\t\t\t\tct_comment_id = result[1];\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\n\t\t\t});\n\t\t}, 202);\n\t\t\n\t});\n\t\n\t// For unspammed\n\tjQuery('span.unspam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\n\t});\n\t\n\t// For untrashed\n\tjQuery('span.untrash a').on('click', function(){\n\t\tvar result = jQuery(this).attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\t\n});\n\n// Send feedback to backend\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\n\t\n\tvar data = {\n\t\t'action': 'ct_feedback_comment',\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\n\t\t'comment_id': ct_comment_id,\n\t\t'comment_status': ct_comment_status\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n timeout: 5000\n\t});\n}\n\n// Outputs CT message about feedback\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\n\tif(ct_result == 1){\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\n\t\t}\n\t\tif(ct_comment_status == 'spam'){\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg);\n\t\t\t}else{\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\n\t\t\t}\n\t\t}\n\t}\n\tif(ct_result == 0){\n\t\t// Error occurred\n\t}if(ct_result == 'no_hash'){\n\t\t// No hash for this comment\n\t}\n}\n"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg","is","document","ready","parseInt","ct_show_check_links","each","ct_curr_str","this","after","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAwEnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,UAErD,QAArB9B,IACCS,OAAO,MAAMsB,GAAG,SAAShC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiByB,kBAE9BrB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,OACAG,IAAI,aAAc,yBAClBF,OAAO,yBAAyBC,SAAS,MACxCD,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,YArH/ErB,OAAOuB,UAAUC,MAAM,WAYtB,IAAIlC,EATDmC,SAAS7B,iBAAiB8B,sBAC5B1B,OAAO,uCAAuC2B,KAAK,WAClD,IAAIC,EAAc5B,OAAO6B,MAAMb,QACC,GAA7B/B,YAAY2C,KAAgD,GAA1BxC,SAASwC,IAC7C5B,OAAO6B,MAAMC,MAAM,mDAAmDF,EAAY,6DAA6DA,EAAY,uCAAuChC,iBAAiBmC,mBAAmB,YAQzO/B,OAAO,gBAAgBgC,GAAG,QAAS,WAClC,IACAC,GAASA,EADIjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BACtB7C,EAAgB2C,EAAO,GAEvB5C,yBADA+C,gBAAkB9C,EACsB,UAAW,KAIpDU,OAAO,kBAAkBgC,GAAG,QAAS,WACpC,IACAC,GAASA,EADIjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BACtB7C,EAAgB2C,EAAO,GAEvB5C,yBADA+C,gBAAkB9C,EACsB,OAAQ,KAIjDU,OAAO,aAAagC,GAAG,QAAS,WAC/B,IACAC,GAASA,EADIjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BACtB7C,EAAgB2C,EAAO,GAEvB5C,yBADA+C,gBAAkB9C,EACsB,OAAQ,GAEhD+C,WAAW,WACVrC,OAAO,WAAWV,EAAc,kBAAkBgD,MAAM,WACvD,IACAL,GAASA,EADIjC,OAAO6B,MAAMK,KAAK,SACfC,MAAM,+BAEtB9C,yBADAC,EAAgB2C,EAAO,GACiB,UAAW,MAElD,OAKJjC,OAAO,eAAegC,GAAG,QAAS,WACjC,IACAC,GAASA,EADIjC,OAAO6B,MAAMV,SAAS,KAAKe,KAAK,SAC7BC,MAAM,8BAEtB9C,yBADAC,EAAgB2C,EAAO,GACiB,UAAW,KAIpDjC,OAAO,kBAAkBgC,GAAG,QAAS,WACpC,IACAC,GAASA,EADIjC,OAAO6B,MAAMK,KAAK,SACfC,MAAM,8BACtB7C,EAAgB2C,EAAO,GACvBM,gBAAkBlD,yBAAyBC,EAAe,UAAW"}
js/cleantalk-dashboard-widget.min.js CHANGED
@@ -1,2 +1,2 @@
1
- jQuery(document).ready(function(){jQuery(".ct_widget_refresh_link").on("click",function(){jQuery(".ct_preloader").show(),setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),setTimeout(function(){jQuery("#ct_refresh_form").submit()},2500)}),"#ct_widget"==location.hash&&setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),jQuery("#ct_widget_wrapper").parent().css("padding",0);var a=document.getElementById("ct_widget_chart"),o=navigator.language||navigator.userLanguage;google.charts.load("current",{packages:["corechart","bar"]}),google.charts.setOnLoadCallback(function(){var t=new google.visualization.DataTable;t.addColumn("string","Spam Blocked"),t.addColumn("number","Frequency"),function(t){var e=new Intl.DateTimeFormat(o,{month:"short",day:"numeric"});t.sort(function(t,e){return new Date(t[0])-new Date(e[0])}),t.forEach(function(t){t[0]=Date.parse(t[0]),t[0]=e.format(t[0])})}(apbctDashboardWidget.data),t.addRows(apbctDashboardWidget.data);var e={width:jQuery(".ct_widget_block").first().width(),height:300,colors:["steelblue"],legend:"none",bar:{groupWidth:"95%"},chartArea:{left:30,top:20,width:"93%",height:"80%"},vAxis:{gridlines:{count:5}}};{a&&new google.visualization.ColumnChart(a).draw(t,e)}})});
2
  //# sourceMappingURL=cleantalk-dashboard-widget.min.js.map
1
+ jQuery(document).ready(function(){jQuery(".ct_widget_refresh_link").on("click",function(){jQuery(".ct_preloader").show(),setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),setTimeout(function(){jQuery("#ct_refresh_form").submit()},2500)}),"#ct_widget"==location.hash&&setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),jQuery("#ct_widget_wrapper").parent().css("padding",0);var a=document.getElementById("ct_widget_chart"),o=navigator.language||navigator.userLanguage;google.charts.load("current",{packages:["corechart","bar"]}),google.charts.setOnLoadCallback(function(){var t=new google.visualization.DataTable,e=(t.addColumn("string","Spam Blocked"),t.addColumn("number","Frequency"),function(t){var e=new Intl.DateTimeFormat(o,{month:"short",day:"numeric"});t.sort(function(t,e){return new Date(t[0])-new Date(e[0])}),t.forEach(function(t){t[0]=Date.parse(t[0]),t[0]=e.format(t[0])})}(apbctDashboardWidget.data),t.addRows(apbctDashboardWidget.data),{width:jQuery(".ct_widget_block").first().width(),height:300,colors:["steelblue"],legend:"none",bar:{groupWidth:"95%"},chartArea:{left:30,top:20,width:"93%",height:"80%"},vAxis:{gridlines:{count:5}}});a&&new google.visualization.ColumnChart(a).draw(t,e)})});
2
  //# sourceMappingURL=cleantalk-dashboard-widget.min.js.map
js/cleantalk-dashboard-widget.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-dashboard-widget.min.js","sources":["cleantalk-dashboard-widget.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set \"refresh\" link handler\n\tjQuery(\".ct_widget_refresh_link\").on('click', function(){\n\t\tjQuery('.ct_preloader').show();\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\t\t\n\t\tsetTimeout(function(){jQuery(\"#ct_refresh_form\").submit();}, 2500);\n\t});\n\t\n\tif(location.hash == '#ct_widget')\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\n\t\n\t// Fixing default wrapper style\n\tjQuery(\"#ct_widget_wrapper\").parent().css('padding', 0);\n\t\n\t// Chart \n\tvar ct_chart = document.getElementById('ct_widget_chart'),\n\t\tlocale = navigator.language || navigator.userLanguage;\n\t\t\n\tfunction ctParseData(date){\n\t\tvar date_formatter = new Intl.DateTimeFormat(locale, {\n\t\t\tmonth: \"short\",\n\t\t\tday: \"numeric\"\n\t\t});\t\n\t\tdate.sort(function(a,b){\n\t\t\treturn new Date(a[0]) - new Date(b[0]) \n\t\t});\t\t\t\n\t\tdate.forEach(function(d){\t\n\t\t\td[0] = Date.parse(d[0]);\n\t\t\td[0] = date_formatter.format(d[0]);\n\t\t});\t\t\n\t}\n\t\t\n\tgoogle.charts.load('current', {packages:['corechart', 'bar']});\n\tgoogle.charts.setOnLoadCallback(drawStuff);\n\n\tfunction drawStuff() {\n\t\tvar data = new google.visualization.DataTable();\n\t\tdata.addColumn('string', 'Spam Blocked');\n\t\tdata.addColumn('number', 'Frequency');\n\t\t\n\t\tctParseData(apbctDashboardWidget.data);\n\t\tdata.addRows(apbctDashboardWidget.data);\n\t\n\t\tvar options = {\n\t\t\twidth: jQuery(\".ct_widget_block\").first().width(),\n\t\t\theight: 300,\n\t\t\tcolors: ['steelblue'],\n\t\t\tlegend: 'none',\n\t\t\tbar: {groupWidth: '95%'},\n\t\t\tchartArea:{left:30,top:20,width:'93%',height:'80%'},\n\t\t\tvAxis: { gridlines: { count: 5 } }\n\t\t};\n\n\t\tif(ct_chart){\n\t\t\tvar chart = new google.visualization.ColumnChart(ct_chart);\n\t\t\tchart.draw(data, options);\n\t\t}\n\t};\t\n});"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","ct_chart","getElementById","locale","navigator","language","userLanguage","google","charts","load","packages","setOnLoadCallback","data","visualization","DataTable","addColumn","date","date_formatter","Intl","DateTimeFormat","month","day","sort","a","b","Date","forEach","d","parse","format","ctParseData","apbctDashboardWidget","addRows","options","width","first","height","colors","legend","bar","groupWidth","chartArea","left","vAxis","gridlines","count","ColumnChart","draw"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,2BAA2BG,GAAG,QAAS,WAC7CH,OAAO,iBAAiBI,OACxBC,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAC7FJ,WAAW,WAAWL,OAAO,oBAAoBU,UAAY,QAG1C,cAAjBC,SAASC,MACXP,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAG9FT,OAAO,sBAAsBa,SAASC,IAAI,UAAW,GAGrD,IAAIC,EAAWd,SAASe,eAAe,mBACtCC,EAASC,UAAUC,UAAYD,UAAUE,aAgB1CC,OAAOC,OAAOC,KAAK,UAAW,CAACC,SAAS,CAAC,YAAa,SACtDH,OAAOC,OAAOG,kBAEd,WACC,IAAIC,EAAO,IAAIL,OAAOM,cAAcC,UACpCF,EAAKG,UAAU,SAAU,gBACzBH,EAAKG,UAAU,SAAU,aApB1B,SAAqBC,GACpB,IAAIC,EAAiB,IAAIC,KAAKC,eAAehB,EAAQ,CACpDiB,MAAO,QACPC,IAAK,YAENL,EAAKM,KAAK,SAASC,EAAEC,GACpB,OAAO,IAAIC,KAAKF,EAAE,IAAM,IAAIE,KAAKD,EAAE,MAEpCR,EAAKU,QAAQ,SAASC,GACrBA,EAAE,GAAKF,KAAKG,MAAMD,EAAE,IACpBA,EAAE,GAAKV,EAAeY,OAAOF,EAAE,MAYhCG,CAAYC,qBAAqBnB,MACjCA,EAAKoB,QAAQD,qBAAqBnB,MAElC,IAAIqB,EAAU,CACbC,MAAOhD,OAAO,oBAAoBiD,QAAQD,QAC1CE,OAAQ,IACRC,OAAQ,CAAC,aACTC,OAAQ,OACRC,IAAK,CAACC,WAAY,OAClBC,UAAU,CAACC,KAAK,GAAG/C,IAAI,GAAGuC,MAAM,MAAME,OAAO,OAC7CO,MAAO,CAAEC,UAAW,CAAEC,MAAO,KAG9B,CAAG5C,GACU,IAAIM,OAAOM,cAAciC,YAAY7C,GAC3C8C,KAAKnC,EAAMqB"}
1
+ {"version":3,"file":"cleantalk-dashboard-widget.min.js","sources":["cleantalk-dashboard-widget.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set \"refresh\" link handler\n\tjQuery(\".ct_widget_refresh_link\").on('click', function(){\n\t\tjQuery('.ct_preloader').show();\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\t\t\n\t\tsetTimeout(function(){jQuery(\"#ct_refresh_form\").submit();}, 2500);\n\t});\n\t\n\tif(location.hash == '#ct_widget')\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\n\t\n\t// Fixing default wrapper style\n\tjQuery(\"#ct_widget_wrapper\").parent().css('padding', 0);\n\t\n\t// Chart \n\tvar ct_chart = document.getElementById('ct_widget_chart'),\n\t\tlocale = navigator.language || navigator.userLanguage;\n\t\t\n\tfunction ctParseData(date){\n\t\tvar date_formatter = new Intl.DateTimeFormat(locale, {\n\t\t\tmonth: \"short\",\n\t\t\tday: \"numeric\"\n\t\t});\t\n\t\tdate.sort(function(a,b){\n\t\t\treturn new Date(a[0]) - new Date(b[0]) \n\t\t});\t\t\t\n\t\tdate.forEach(function(d){\t\n\t\t\td[0] = Date.parse(d[0]);\n\t\t\td[0] = date_formatter.format(d[0]);\n\t\t});\t\t\n\t}\n\t\t\n\tgoogle.charts.load('current', {packages:['corechart', 'bar']});\n\tgoogle.charts.setOnLoadCallback(drawStuff);\n\n\tfunction drawStuff() {\n\t\tvar data = new google.visualization.DataTable();\n\t\tdata.addColumn('string', 'Spam Blocked');\n\t\tdata.addColumn('number', 'Frequency');\n\t\t\n\t\tctParseData(apbctDashboardWidget.data);\n\t\tdata.addRows(apbctDashboardWidget.data);\n\t\n\t\tvar options = {\n\t\t\twidth: jQuery(\".ct_widget_block\").first().width(),\n\t\t\theight: 300,\n\t\t\tcolors: ['steelblue'],\n\t\t\tlegend: 'none',\n\t\t\tbar: {groupWidth: '95%'},\n\t\t\tchartArea:{left:30,top:20,width:'93%',height:'80%'},\n\t\t\tvAxis: { gridlines: { count: 5 } }\n\t\t};\n\n\t\tif(ct_chart){\n\t\t\tvar chart = new google.visualization.ColumnChart(ct_chart);\n\t\t\tchart.draw(data, options);\n\t\t}\n\t};\t\n});"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","ct_chart","getElementById","locale","navigator","language","userLanguage","google","charts","load","packages","setOnLoadCallback","data","visualization","DataTable","options","addColumn","date","date_formatter","Intl","DateTimeFormat","month","day","sort","a","b","Date","forEach","d","parse","format","ctParseData","apbctDashboardWidget","addRows","width","first","height","colors","legend","bar","groupWidth","chartArea","left","vAxis","gridlines","count","ColumnChart","draw"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,2BAA2BG,GAAG,QAAS,WAC7CH,OAAO,iBAAiBI,OACxBC,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAC7FJ,WAAW,WAAWL,OAAO,oBAAoBU,UAAY,QAG1C,cAAjBC,SAASC,MACXP,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAG9FT,OAAO,sBAAsBa,SAASC,IAAI,UAAW,GAGrD,IAAIC,EAAWd,SAASe,eAAe,mBACtCC,EAASC,UAAUC,UAAYD,UAAUE,aAgB1CC,OAAOC,OAAOC,KAAK,UAAW,CAACC,SAAS,CAAC,YAAa,SACtDH,OAAOC,OAAOG,kBAEd,WACC,IAAIC,EAAO,IAAIL,OAAOM,cAAcC,UAOhCC,GANJH,EAAKI,UAAU,SAAU,gBACzBJ,EAAKI,UAAU,SAAU,aApB1B,SAAqBC,GACpB,IAAIC,EAAiB,IAAIC,KAAKC,eAAejB,EAAQ,CACpDkB,MAAO,QACPC,IAAK,YAENL,EAAKM,KAAK,SAASC,EAAEC,GACpB,OAAO,IAAIC,KAAKF,EAAE,IAAM,IAAIE,KAAKD,EAAE,MAEpCR,EAAKU,QAAQ,SAASC,GACrBA,EAAE,GAAKF,KAAKG,MAAMD,EAAE,IACpBA,EAAE,GAAKV,EAAeY,OAAOF,EAAE,MAYhCG,CAAYC,qBAAqBpB,MACjCA,EAAKqB,QAAQD,qBAAqBpB,MAEpB,CACbsB,MAAOhD,OAAO,oBAAoBiD,QAAQD,QAC1CE,OAAQ,IACRC,OAAQ,CAAC,aACTC,OAAQ,OACRC,IAAK,CAACC,WAAY,OAClBC,UAAU,CAACC,KAAK,GAAG/C,IAAI,GAAGuC,MAAM,MAAME,OAAO,OAC7CO,MAAO,CAAEC,UAAW,CAAEC,MAAO,MAG3B5C,GACU,IAAIM,OAAOM,cAAciC,YAAY7C,GAC3C8C,KAAKnC,EAAMG"}
js/cleantalk-modal.min.js CHANGED
@@ -1,2 +1,2 @@
1
- cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,a,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},a={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},o={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},l={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},d={styles:{overflow:"hidden"},toString:e},i=document.createElement("style");i.setAttribute("id","cleantalk-modal-styles"),i.innerHTML="body.cleantalk-modal-opened{"+d+"}",i.innerHTML+="#cleantalk-modal-overlay{"+t+"}",i.innerHTML+="#cleantalk-modal-close{"+n+"}",i.innerHTML+="#cleantalk-modal-close:before{"+o+"}",i.innerHTML+="#cleantalk-modal-close:after{"+l+"}",document.body.append(i);var c=document.createElement("div");c.setAttribute("id","cleantalk-modal-overlay"),document.body.append(c),document.body.classList.add("cleantalk-modal-opened");var r=document.createElement("div");r.setAttribute("id","cleantalk-modal-inner"),r.setAttribute("style",a),c.append(r);var s=document.createElement("div");s.setAttribute("id","cleantalk-modal-close"),r.append(s);var p=document.createElement("div");this.loaded?p.innerHTML=this.loaded:(p.innerHTML="Loading...",this.load("get_options_template")),p.setAttribute("id","cleantalk-modal-content"),r.append(p),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
  //# sourceMappingURL=cleantalk-modal.min.js.map
1
+ cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,n,a){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e="";for(key in this.styles)e+=key+":"+this.styles[key]+";";return e}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},n={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},a={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},o={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},l={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},d={styles:{overflow:"hidden"},toString:e},i=document.createElement("style"),d=(i.setAttribute("id","cleantalk-modal-styles"),i.innerHTML="body.cleantalk-modal-opened{"+d+"}",i.innerHTML+="#cleantalk-modal-overlay{"+t+"}",i.innerHTML+="#cleantalk-modal-close{"+a+"}",i.innerHTML+="#cleantalk-modal-close:before{"+o+"}",i.innerHTML+="#cleantalk-modal-close:after{"+l+"}",document.body.append(i),document.createElement("div")),t=(d.setAttribute("id","cleantalk-modal-overlay"),document.body.append(d),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),a=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",n),d.append(t),document.createElement("div")),o=(a.setAttribute("id","cleantalk-modal-close"),t.append(a),document.createElement("div"));this.loaded?o.innerHTML=this.loaded:(o.innerHTML="Loading...",this.load("get_options_template")),o.setAttribute("id","cleantalk-modal-content"),t.append(o),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}},document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
  //# sourceMappingURL=cleantalk-modal.min.js.map
js/cleantalk-modal.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-modal.min.js","sources":["cleantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n \"box-sizing\" : \"content-box\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});"],"names":["cleantalkModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","apbct_admin_sendAJAX","apbct_public_sendAJAX","notJson","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","border","border-radius","box-shadow","closeCss","cursor","right","box-sizing","closeCssBefore","content","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","createElement","setAttribute","innerHTML","body","append","overlay","classList","add","inner","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"AACAA,eAAiB,CAGbC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EAGTC,KAAM,SAAUC,GACNC,KAAKN,SACPM,KAAKL,SAAU,EACfM,SAAW,SAAUC,EAAQC,EAAMC,EAAQC,GACvCZ,eAAeE,SAAU,EACzBF,eAAeC,OAASQ,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leantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\ncleantalkModal = {\n\n // Flags\n loaded: false,\n loading: false,\n opened: false,\n opening: false,\n\n // Methods\n load: function( action ) {\n if( ! this.loaded ) {\n this.loading = true;\n callback = function( result, data, params, obj ) {\n cleantalkModal.loading = false;\n cleantalkModal.loaded = result;\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalContentLoaded\", {\n bubbles: true,\n } )\n );\n };\n if( typeof apbct_admin_sendAJAX === \"function\" ) {\n apbct_admin_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n } else {\n apbct_public_sendAJAX( { 'action' : action }, { 'callback': callback, 'notJson': true } );\n }\n\n }\n },\n\n open: function () {\n /* Cleantalk Modal CSS start */\n var renderCss = function () {\n var cssStr = '';\n for ( key in this.styles ) {\n cssStr += key + ':' + this.styles[key] + ';';\n }\n return cssStr;\n };\n var overlayCss = {\n styles: {\n \"z-index\": \"9999\",\n \"position\": \"fixed\",\n \"top\": \"0\",\n \"left\": \"0\",\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"background\": \"rgba(0,0,0,0.5)\",\n \"display\": \"flex\",\n \"justify-content\" : \"center\",\n \"align-items\" : \"center\",\n },\n toString: renderCss\n };\n var innerCss = {\n styles: {\n \"position\" : \"relative\",\n \"padding\" : \"30px\",\n \"background\" : \"#FFF\",\n \"border\" : \"1px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"4px\",\n \"box-shadow\" : \"7px 7px 5px 0px rgba(50,50,50,0.75)\",\n },\n toString: renderCss\n };\n var closeCss = {\n styles: {\n \"position\" : \"absolute\",\n \"background\" : \"#FFF\",\n \"width\" : \"20px\",\n \"height\" : \"20px\",\n \"border\" : \"2px solid rgba(0,0,0,0.75)\",\n \"border-radius\" : \"15px\",\n \"cursor\" : \"pointer\",\n \"top\" : \"-8px\",\n \"right\" : \"-8px\",\n \"box-sizing\" : \"content-box\",\n },\n toString: renderCss\n };\n var closeCssBefore = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(45deg)\",\n },\n toString: renderCss\n };\n var closeCssAfter = {\n styles: {\n \"content\" : \"\\\"\\\"\",\n \"display\" : \"block\",\n \"position\" : \"absolute\",\n \"background\" : \"#000\",\n \"border-radius\" : \"1px\",\n \"width\" : \"2px\",\n \"height\" : \"16px\",\n \"top\" : \"2px\",\n \"left\" : \"9px\",\n \"transform\" : \"rotate(-45deg)\",\n },\n toString: renderCss\n };\n var bodyCss = {\n styles: {\n \"overflow\" : \"hidden\",\n },\n toString: renderCss\n };\n var cleantalkModalStyle = document.createElement( 'style' );\n cleantalkModalStyle.setAttribute( 'id', 'cleantalk-modal-styles' );\n cleantalkModalStyle.innerHTML = 'body.cleantalk-modal-opened{' + bodyCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-overlay{' + overlayCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close{' + closeCss + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:before{' + closeCssBefore + '}';\n cleantalkModalStyle.innerHTML += '#cleantalk-modal-close:after{' + closeCssAfter + '}';\n document.body.append( cleantalkModalStyle );\n /* Cleantalk Modal CSS end */\n\n var overlay = document.createElement( 'div' );\n overlay.setAttribute( 'id', 'cleantalk-modal-overlay' );\n document.body.append( overlay );\n\n document.body.classList.add( 'cleantalk-modal-opened' );\n\n var inner = document.createElement( 'div' );\n inner.setAttribute( 'id', 'cleantalk-modal-inner' );\n inner.setAttribute( 'style', innerCss );\n overlay.append( inner );\n\n var close = document.createElement( 'div' );\n close.setAttribute( 'id', 'cleantalk-modal-close' );\n inner.append( close );\n\n var content = document.createElement( 'div' );\n if ( this.loaded ) {\n content.innerHTML = this.loaded;\n } else {\n content.innerHTML = 'Loading...';\n // @ToDo Here is hardcoded parameter. Have to get this from a 'data-' attribute.\n this.load( 'get_options_template' );\n }\n content.setAttribute( 'id', 'cleantalk-modal-content' );\n inner.append( content );\n\n this.opened = true;\n },\n\n close: function () {\n document.body.classList.remove( 'cleantalk-modal-opened' );\n document.getElementById( 'cleantalk-modal-overlay' ).remove();\n document.getElementById( 'cleantalk-modal-styles' ).remove();\n document.dispatchEvent(\n new CustomEvent( \"cleantalkModalClosed\", {\n bubbles: true,\n } )\n );\n }\n\n};\n\n/* Cleantalk Modal helpers */\ndocument.addEventListener('click',function( e ){\n if( e.target && e.target.id === 'cleantalk-modal-overlay' || e.target.id === 'cleantalk-modal-close' ){\n cleantalkModal.close();\n }\n});\ndocument.addEventListener(\"cleantalkModalContentLoaded\", function( e ) {\n if( cleantalkModal.opened && cleantalkModal.loaded ) {\n document.getElementById( 'cleantalk-modal-content' ).innerHTML = cleantalkModal.loaded;\n }\n});"],"names":["cleantalkModal","loaded","loading","opened","opening","load","action","this","callback","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","apbct_admin_sendAJAX","apbct_public_sendAJAX","notJson","open","renderCss","cssStr","key","styles","overlayCss","z-index","position","top","left","width","height","background","display","justify-content","align-items","toString","innerCss","padding","border","border-radius","box-shadow","closeCss","cursor","right","box-sizing","closeCssBefore","content","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","createElement","overlay","setAttribute","innerHTML","body","append","inner","classList","add","close","remove","getElementById","addEventListener","e","target","id"],"mappings":"AACAA,eAAiB,CAGbC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EAGTC,KAAM,SAAUC,GACNC,KAAKN,SACPM,KAAKL,SAAU,EACfM,SAAW,SAAUC,EAAQC,EAAMC,EAAQC,GACvCZ,eAAeE,SAAU,EACzBF,eAAeC,OAASQ,EACxBI,SAASC,cACL,IAAIC,YAAa,8BAA+B,CAC5CC,SAAS,OAIe,mBAAzBC,qBACPA,qBAEAC,uBAFsB,CA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AAa,0BAA4Bd,EAAW,IACxEU,EAAoBI,WAAa,iCAAmCV,EAAiB,IACrFM,EAAoBI,WAAa,gCAAkCP,EAAgB,IACnFpC,SAAS4C,KAAKC,OAAQN,GAGRvC,SAASwC,cAAe,QAMlCM,GALJL,EAAQC,aAAc,KAAM,2BAC5B1C,SAAS4C,KAAKC,OAAQJ,GAEtBzC,SAAS4C,KAAKG,UAAUC,IAAK,0BAEjBhD,SAASwC,cAAe,QAKhCS,GAJJH,EAAMJ,aAAc,KAAM,yBAC1BI,EAAMJ,aAAc,QAASlB,GAC7BiB,EAAQI,OAAQC,GAEJ9C,SAASwC,cAAe,QAIhCN,GAHJe,EAAMP,aAAc,KAAM,yBAC1BI,EAAMD,OAAQI,GAEAjD,SAASwC,cAAe,QACjC9C,KAAKN,OACN8C,EAAQS,UAAYjD,KAAKN,QAEzB8C,EAAQS,UAAY,aAEpBjD,KAAKF,KAAM,yBAEf0C,EAAQQ,aAAc,KAAM,2BAC5BI,EAAMD,OAAQX,GAEdxC,KAAKJ,QAAS,GAGlB2D,MAAO,WACHjD,SAAS4C,KAAKG,UAAUG,OAAQ,0BAChClD,SAASmD,eAAgB,2BAA4BD,SACrDlD,SAASmD,eAAgB,0BAA2BD,SACpDlD,SAASC,cACL,IAAIC,YAAa,uBAAwB,CACrCC,SAAS,OAQzBH,SAASoD,iBAAiB,QAAQ,SAAUC,IACpCA,EAAEC,QAA0B,4BAAhBD,EAAEC,OAAOC,IAAoD,0BAAhBF,EAAEC,OAAOC,KAClEpE,eAAe8D,UAGvBjD,SAASoD,iBAAiB,8BAA+B,SAAUC,GAC3DlE,eAAeG,QAAUH,eAAeC,SACxCY,SAASmD,eAAgB,2BAA4BR,UAAYxD,eAAeC"}
js/cleantalk-public-admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- jQuery(document).ready(function(){jQuery(".ct_comment_info").parents().each(function(){if(0<(e=jQuery(this).css("background-color")).length&&"rgba(0, 0, 0, 0)"!=e)return jQuery(".ct_comment_info").css("background",e),!1});var c=jQuery(".ct_comment_info").prev().last().css("float");jQuery(".ct_comment_info").css("float",c);var t=jQuery(".ct_comment_info");jQuery(t).each(function(e,c){curr_elem=jQuery(c),curr_elem.parent().prepend(curr_elem)}),jQuery(".ct_this_is").on("click",function(){var t=jQuery(this),a=jQuery(this).siblings(".ct_feedback_wrap"),s=jQuery(".ct_feedback_msg"),n=t.hasClass("ct_this_is_spam")?"spam":"approve",e={action:"ct_feedback_comment",security:ctPublicAdmin.ct_ajax_nonce,comment_id:t.attr("commentid"),comment_status:n,change_status:1};jQuery.ajax({type:"POST",url:ctPublicAdmin.ajaxurl,data:e,success:function(e){t.hide(),t.siblings("span.ct_this_is").show(),jQuery(".ct_feedback_result").hide(),"approve"==n?jQuery(".ct_feedback_result_not_spam").show():jQuery(".ct_feedback_result_spam").show(),1==e?(s.addClass("ct_feedback_success"),s.html(ctPublicAdmin.ct_feedback_msg)):0==e?(s.addClass("ct_feedback_error"),s.html(ctPublicAdmin.ct_feedback_error)):"no_hash"==e&&(s.addClass("ct_feedback_no_hash"),s.html(ctPublicAdmin.ct_feedback_no_hash)),a.show(),a.css("display","inline-block");var c=a.data("interval_id");clearInterval(c),c=setTimeout(function(){a.fadeOut(1e3)},5e3),a.data("interval_id",c)},error:function(e,c,t){console.log(e),console.log(c),console.log(t)},timeout:5e3})})});
2
  //# sourceMappingURL=cleantalk-public-admin.min.js.map
1
+ jQuery(document).ready(function(){jQuery(".ct_comment_info").parents().each(function(){if(0<(e=jQuery(this).css("background-color")).length&&"rgba(0, 0, 0, 0)"!=e)return jQuery(".ct_comment_info").css("background",e),!1});var c=jQuery(".ct_comment_info").prev().last().css("float"),c=(jQuery(".ct_comment_info").css("float",c),jQuery(".ct_comment_info"));jQuery(c).each(function(e,c){(curr_elem=jQuery(c)).parent().prepend(curr_elem)}),jQuery(".ct_this_is").on("click",function(){var c=jQuery(this),t=jQuery(this).siblings(".ct_feedback_wrap"),a=jQuery(".ct_feedback_msg"),s=c.hasClass("ct_this_is_spam")?"spam":"approve",e={action:"ct_feedback_comment",security:ctPublicAdmin.ct_ajax_nonce,comment_id:c.attr("commentid"),comment_status:s,change_status:1};jQuery.ajax({type:"POST",url:ctPublicAdmin.ajaxurl,data:e,success:function(e){c.hide(),c.siblings("span.ct_this_is").show(),jQuery(".ct_feedback_result").hide(),("approve"==s?jQuery(".ct_feedback_result_not_spam"):jQuery(".ct_feedback_result_spam")).show(),1==e?(a.addClass("ct_feedback_success"),a.html(ctPublicAdmin.ct_feedback_msg)):0==e?(a.addClass("ct_feedback_error"),a.html(ctPublicAdmin.ct_feedback_error)):"no_hash"==e&&(a.addClass("ct_feedback_no_hash"),a.html(ctPublicAdmin.ct_feedback_no_hash)),t.show(),t.css("display","inline-block");e=t.data("interval_id");clearInterval(e),e=setTimeout(function(){t.fadeOut(1e3)},5e3),t.data("interval_id",e)},error:function(e,c,t){console.log(e),console.log(c),console.log(t)},timeout:5e3})})});
2
  //# sourceMappingURL=cleantalk-public-admin.min.js.map
js/cleantalk-public-admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-public-admin.min.js","sources":["cleantalk-public-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set background-color similar to parents\njQuery('.ct_comment_info').parents().each(function() {\n if ((e = jQuery(this).css('background-color')).length > 0 && e != 'rgba(0, 0, 0, 0)'){ \n \tjQuery('.ct_comment_info').css('background', e);\n \treturn false;\n }\n});\n\t\n\t// Set same float style with article\n\tvar ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');\n\tjQuery('.ct_comment_info').css('float', ct_post_float);\n\t\n\tvar ct_posts = jQuery('.ct_comment_info');\n\t\n\tjQuery(ct_posts).each(function(indx, elem){\n\t\tcurr_elem = jQuery(elem);\n\t\tcurr_elem.parent().prepend(curr_elem);\n\t});\n\t\n\t// Handler for buttons\n\tjQuery('.ct_this_is').on('click', function(){\n\t\t\n\t\tvar ct_current_button = jQuery(this),\n\t\t\tct_feedback_wrap = jQuery(this).siblings('.ct_feedback_wrap'),\n\t\t\tct_feedback_msg = jQuery('.ct_feedback_msg'),\n\t\t\tct_comment_status;\n\t\t\t\n\t\tif(ct_current_button.hasClass('ct_this_is_spam'))\n\t\t\tct_comment_status = 'spam';\n\t\telse\n\t\t\tct_comment_status = 'approve';\n\t\t\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_comment',\n\t\t\t'security': ctPublicAdmin.ct_ajax_nonce,\n\t\t\t'comment_id': ct_current_button.attr('commentid'),\n\t\t\t'comment_status': ct_comment_status,\n\t\t\t'change_status': 1\n\t\t};\n\t\t\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ctPublicAdmin.ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tct_current_button.hide();\n\t\t\t\tct_current_button.siblings('span.ct_this_is').show();\n\t\t\t\t\n\t\t\t\tjQuery('.ct_feedback_result').hide();\n\t\t\t\tif(ct_comment_status == 'approve')\n\t\t\t\t\tjQuery('.ct_feedback_result_not_spam').show();\n\t\t\t\telse\n\t\t\t\t\tjQuery('.ct_feedback_result_spam').show();\n\t\t\t\t\n\t\t\t\tif(msg == 1){\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_success');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_msg);\n\t\t\t\t}else if(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_error');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_error);\n\t\t\t\t}else if(msg == 'no_hash'){\n\t\t\t\t\t// No hash for this comment\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_no_hash');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_no_hash);\n\t\t\t\t}\n\t\t\t\t// Hidding feedback message for every message type\n\t\t\t\tct_feedback_wrap.show();\n\t\t\t\tct_feedback_wrap.css('display', 'inline-block');\n\t\t\t\t\n\t\t\t\tvar ct_timeout_id = ct_feedback_wrap.data('interval_id');\n\t\t\t\tclearInterval(ct_timeout_id);\n\t\t\t\tct_timeout_id = setTimeout(function(){\n\t\t\t\t\tct_feedback_wrap.fadeOut(1000);\n\t\t\t\t}, 5000);\n\t\t\t\tct_feedback_wrap.data('interval_id', ct_timeout_id);\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log(errorThrown);\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t});\n\t\n});"],"names":["jQuery","document","ready","parents","each","e","this","css","length","ct_post_float","prev","last","ct_posts","indx","elem","curr_elem","parent","prepend","on","ct_current_button","ct_feedback_wrap","siblings","ct_feedback_msg","ct_comment_status","hasClass","data","action","security","ctPublicAdmin","ct_ajax_nonce","comment_id","attr","comment_status","change_status","ajax","type","url","ajaxurl","success","msg","hide","show","addClass","html","ct_feedback_error","ct_feedback_no_hash","ct_timeout_id","clearInterval","setTimeout","fadeOut","error","jqXHR","textStatus","errorThrown","console","log","timeout"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGvBF,OAAO,oBAAoBG,UAAUC,KAAK,WACxC,GAAwD,GAAnDC,EAAIL,OAAOM,MAAMC,IAAI,qBAAqBC,QAAmB,oBAALH,EAE5D,OADAL,OAAO,oBAAoBO,IAAI,aAAcF,IACtC,IAKT,IAAII,EAAgBT,OAAO,oBAAoBU,OAAOC,OAAOJ,IAAI,SACjEP,OAAO,oBAAoBO,IAAI,QAASE,GAExC,IAAIG,EAAWZ,OAAO,oBAEtBA,OAAOY,GAAUR,KAAK,SAASS,EAAMC,GACpCC,UAAYf,OAAOc,GACnBC,UAAUC,SAASC,QAAQF,aAI5Bf,OAAO,eAAekB,GAAG,QAAS,WAEjC,IAAIC,EAAoBnB,OAAOM,MAC9Bc,EAAmBpB,OAAOM,MAAMe,SAAS,qBACzCC,EAAkBtB,OAAO,oBAIzBuB,EADEJ,EAAkBK,SAAS,mBACT,OAEA,UAEjBC,EAAO,CACVC,OAAU,sBACVC,SAAYC,cAAcC,cAC1BC,WAAcX,EAAkBY,KAAK,aACrCC,eAAkBT,EAClBU,cAAiB,GAGlBjC,OAAOkC,KAAK,CACXC,KAAM,OACNC,IAAKR,cAAcS,QACnBZ,KAAMA,EACNa,QAAS,SAASC,GACjBpB,EAAkBqB,OAClBrB,EAAkBE,SAAS,mBAAmBoB,OAE9CzC,OAAO,uBAAuBwC,OACN,WAArBjB,EACFvB,OAAO,gCAAgCyC,OAEvCzC,OAAO,4BAA4ByC,OAE1B,GAAPF,GACFjB,EAAgBoB,SAAS,uBACzBpB,EAAgBqB,KAAKf,cAAcN,kBACpB,GAAPiB,GAERjB,EAAgBoB,SAAS,qBACzBpB,EAAgBqB,KAAKf,cAAcgB,oBACpB,WAAPL,IAERjB,EAAgBoB,SAAS,uBACzBpB,EAAgBqB,KAAKf,cAAciB,sBAGpCzB,EAAiBqB,OACjBrB,EAAiBb,IAAI,UAAW,gBAEhC,IAAIuC,EAAgB1B,EAAiBK,KAAK,eAC1CsB,cAAcD,GACdA,EAAgBE,WAAW,WAC1B5B,EAAiB6B,QAAQ,MACvB,KACH7B,EAAiBK,KAAK,cAAeqB,IAEtCI,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbG,QAAS"}
1
+ {"version":3,"file":"cleantalk-public-admin.min.js","sources":["cleantalk-public-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set background-color similar to parents\njQuery('.ct_comment_info').parents().each(function() {\n if ((e = jQuery(this).css('background-color')).length > 0 && e != 'rgba(0, 0, 0, 0)'){ \n \tjQuery('.ct_comment_info').css('background', e);\n \treturn false;\n }\n});\n\t\n\t// Set same float style with article\n\tvar ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');\n\tjQuery('.ct_comment_info').css('float', ct_post_float);\n\t\n\tvar ct_posts = jQuery('.ct_comment_info');\n\t\n\tjQuery(ct_posts).each(function(indx, elem){\n\t\tcurr_elem = jQuery(elem);\n\t\tcurr_elem.parent().prepend(curr_elem);\n\t});\n\t\n\t// Handler for buttons\n\tjQuery('.ct_this_is').on('click', function(){\n\t\t\n\t\tvar ct_current_button = jQuery(this),\n\t\t\tct_feedback_wrap = jQuery(this).siblings('.ct_feedback_wrap'),\n\t\t\tct_feedback_msg = jQuery('.ct_feedback_msg'),\n\t\t\tct_comment_status;\n\t\t\t\n\t\tif(ct_current_button.hasClass('ct_this_is_spam'))\n\t\t\tct_comment_status = 'spam';\n\t\telse\n\t\t\tct_comment_status = 'approve';\n\t\t\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_comment',\n\t\t\t'security': ctPublicAdmin.ct_ajax_nonce,\n\t\t\t'comment_id': ct_current_button.attr('commentid'),\n\t\t\t'comment_status': ct_comment_status,\n\t\t\t'change_status': 1\n\t\t};\n\t\t\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ctPublicAdmin.ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tct_current_button.hide();\n\t\t\t\tct_current_button.siblings('span.ct_this_is').show();\n\t\t\t\t\n\t\t\t\tjQuery('.ct_feedback_result').hide();\n\t\t\t\tif(ct_comment_status == 'approve')\n\t\t\t\t\tjQuery('.ct_feedback_result_not_spam').show();\n\t\t\t\telse\n\t\t\t\t\tjQuery('.ct_feedback_result_spam').show();\n\t\t\t\t\n\t\t\t\tif(msg == 1){\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_success');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_msg);\n\t\t\t\t}else if(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_error');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_error);\n\t\t\t\t}else if(msg == 'no_hash'){\n\t\t\t\t\t// No hash for this comment\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_no_hash');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_no_hash);\n\t\t\t\t}\n\t\t\t\t// Hidding feedback message for every message type\n\t\t\t\tct_feedback_wrap.show();\n\t\t\t\tct_feedback_wrap.css('display', 'inline-block');\n\t\t\t\t\n\t\t\t\tvar ct_timeout_id = ct_feedback_wrap.data('interval_id');\n\t\t\t\tclearInterval(ct_timeout_id);\n\t\t\t\tct_timeout_id = setTimeout(function(){\n\t\t\t\t\tct_feedback_wrap.fadeOut(1000);\n\t\t\t\t}, 5000);\n\t\t\t\tct_feedback_wrap.data('interval_id', ct_timeout_id);\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log(errorThrown);\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t});\n\t\n});"],"names":["jQuery","document","ready","parents","each","e","this","css","length","ct_post_float","prev","last","ct_posts","indx","elem","curr_elem","parent","prepend","on","ct_current_button","ct_feedback_wrap","siblings","ct_feedback_msg","ct_comment_status","hasClass","data","action","security","ctPublicAdmin","ct_ajax_nonce","comment_id","attr","comment_status","change_status","ajax","type","url","ajaxurl","success","msg","hide","show","addClass","html","ct_feedback_error","ct_feedback_no_hash","ct_timeout_id","clearInterval","setTimeout","fadeOut","error","jqXHR","textStatus","errorThrown","console","log","timeout"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGvBF,OAAO,oBAAoBG,UAAUC,KAAK,WACxC,GAAwD,GAAnDC,EAAIL,OAAOM,MAAMC,IAAI,qBAAqBC,QAAmB,oBAALH,EAE5D,OADAL,OAAO,oBAAoBO,IAAI,aAAcF,IACtC,IAKT,IAAII,EAAgBT,OAAO,oBAAoBU,OAAOC,OAAOJ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(){var e=this;for(var t in arguments)var c=e.substring(0,e.indexOf("%s",0)),a=e.substring(e.indexOf("%s",0)+2,e.length),e=c+arguments[t]+a;return e};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"none"===(r=r||["apbct_","ct_"])&&(r=null),"string"==typeof r&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0;jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val());var c={action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random()};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(ct_users_bad)+parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,c=(c=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0<parseInt(ct_users_spam)&&(c+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(c),jQuery("#ct_error_message").hide(),ct_send_users()))},error:function(e,t,c){20<a&&(a-=20,document.cookie="ct_check_users__amount="+a+"; path=/; samesite=lax"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){if(ct_working){if(!0===ct_cooling_down_flag)return void jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)").show();var e;jQuery("#ct_cooling_notice").hide(),ct_users_total||(e={action:"ajax_info_users",security:ct_ajax_nonce,no_cache:Math.random()},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3}))}}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_start_check(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}function ct_delete_all_users(a){var t={action:"ajax_delete_all_users",security:ct_ajax_nonce,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users(a,t)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="users.php?page=ct_check_users")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(a),3e3)},timeout:25e3})}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_users_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_users_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var _=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),a=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);_.not(this).datepicker("option",t,a),document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function t(t){t=t||null;var e={action:"ajax_insert_users",security:ct_ajax_nonce,no_cache:Math.random()};t&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert("Deleted "+e+" users"):alert("Inserted "+e+" users")}})}jQuery("#ct_check_spam_button").click(function(){ct_start_check(!(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){ct_start_check(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id,no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}});e={action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve",no_cache:Math.random()};jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery(".ct_get_csv_file").click(function(a){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t,c;0===parseInt(e)?alert(ctUsersCheck.ct_bad_csv):(t=URL.createObjectURL(new Blob([e])),(c=document.createElement("a")).href=t,c.download=ctUsersCheck.ct_csv_filename+".csv",document.body.appendChild(c),c.click()),jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden")}})}),jQuery(".ct_insert_users").click(function(e){t()}),jQuery(".ct_insert_users__delete").click(function(e){t(!0)}),jQuery(".ct_delete_all_users").click(function(e){return!!confirm(ctUsersCheck.ct_confirm_deletion_all)&&void ct_delete_all_users(e)})});
2
  //# sourceMappingURL=cleantalk-users-checkspam.min.js.map
1
+ String.prototype.printf=function(){var e,t=this;for(e in arguments)var c=t.substring(0,t.indexOf("%s",0)),a=t.substring(t.indexOf("%s",0)+2,t.length),t=c+arguments[e]+a;return t};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"string"==typeof(r="none"===(r=r||["apbct_","ct_"])?null:r)&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0,c=(jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val()),"https:"===location.protocol?"; secure":""),c=(document.cookie="apbct_check_users_offset=0; path=/; samesite=lax"+c,{action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random(),offset:Number(getCookie("apbct_check_users_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(ct_users_bad)+parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,t=(t=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0<parseInt(ct_users_spam)&&(t+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(t),jQuery("#ct_error_message").hide(),e=Number(getCookie("apbct_check_users_offset"))+100,t="https:"===location.protocol?"; secure":"",document.cookie="apbct_check_users_offset="+e+"; samesite=lax"+t,ct_send_users()))},error:function(e,t,c){20<a&&(a-=20,document.cookie="ct_check_users__amount="+a+"; path=/; samesite=lax"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){var e;ct_working&&(!0===ct_cooling_down_flag?jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)").show():(jQuery("#ct_cooling_notice").hide(),ct_users_total||(e={action:"ajax_info_users",security:ct_ajax_nonce,no_cache:Math.random()},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3}))))}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_start_check(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}function ct_delete_all_users(a){var t={action:"ajax_delete_all_users",security:ct_ajax_nonce,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users(a,t)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="users.php?page=ct_check_users")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(a),3e3)},timeout:25e3})}function getCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_users_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_users_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var a=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),e=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);a.not(this).datepicker("option",t,e),document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function t(t){t=t||null;var e={action:"ajax_insert_users",security:ct_ajax_nonce,no_cache:Math.random()};t&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert("Deleted "+e+" users"):alert("Inserted "+e+" users")}})}jQuery("#ct_check_spam_button").click(function(){ct_start_check(!(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){ct_start_check(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id,no_cache:Math.random()},e=(jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}}),{action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve",no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery(".ct_get_csv_file").click(function(c){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename,no_cache:Math.random()};jQuery("."+c.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;0===parseInt(e)?alert(ctUsersCheck.ct_bad_csv):(e=URL.createObjectURL(new Blob([e])),(t=document.createElement("a")).href=e,t.download=ctUsersCheck.ct_csv_filename+".csv",document.body.appendChild(t),t.click()),jQuery("."+c.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden")}})}),jQuery(".ct_insert_users").click(function(e){t()}),jQuery(".ct_insert_users__delete").click(function(e){t(!0)}),jQuery(".ct_delete_all_users").click(function(e){if(!confirm(ctUsersCheck.ct_confirm_deletion_all))return!1;ct_delete_all_users(e)})});
2
  //# sourceMappingURL=cleantalk-users-checkspam.min.js.map
js/cleantalk-users-checkspam.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Set deafult amount to check by request.\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\n\tct_prev_till = ctUsersCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\n\tct_users_total = 0,\n\tct_users_checked = 0,\n\tct_users_spam = 0,\n\tct_users_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes === 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\nfunction apbct_get_cookie( name ){\n\tvar cookie = apbct_cookie__get( name, name );\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\n\t\treturn cookie[name];\n\t}else\n\t\treturn null;\n}\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to === 0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_users(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\tvar data = {\n\t\t'action' : 'ajax_clear_users',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}\n\t});\n\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_users();\n\tct_show_users_info();\n}\n\nfunction ct_send_users(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\n\n\tvar data = {\n\t\taction: 'ajax_check_users',\n\t\tsecurity: ct_ajax_nonce,\n\t\tnew_check: ct_new_check,\n\t\tunchecked: ct_unchecked,\n\t\tamount: check_amount,\n\t\t'no_cache': Math.random()\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_users();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\n\t\t\t\t\tct_users_bad = parseInt( ct_users_bad ) + parseInt( msg.bad );\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tif(check_amount > 20){\n\t\t\t\tcheck_amount -= 20;\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\n\t\t\t}\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\t\n\tif( ct_working ){\n\t\t\n\t\tif(ct_cooling_down_flag === true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif( ! ct_users_total ){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce,\n\t\t\t\t'no_cache': Math.random()\n\t\t\t};\n\t\t\t\n\t\t\tif( ct_date_from && ct_date_till ){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\n// Main function of checking\nfunction ct_start_check( continue_check ){\n\n\tcontinue_check = continue_check || null;\n\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\n\t\t\talert('Please, specify a date range.');\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\tct_accurate_check = true;\n\t}\n\n\tjQuery('.ct_to_hide').hide();\n\tjQuery('#ct_working_message').show();\n\tjQuery('#ct_preloader').show();\n\tjQuery('#ct_pause').show();\n\n\tct_working = true;\n\n\tif( continue_check ){\n\t\tct_show_users_info();\n\t\tct_send_users();\n\t} else {\n\t\tct_clear_users();\n\t}\n\n}\n\nfunction ct_delete_all_users( e ){\n\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users( e, data );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Setting dependences\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\t\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\t\t\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\t\t\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\t\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve',\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t\t\n\t});\n\t\n\t// Request to Download CSV file.\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery('.' + e.target.id).addClass('disabled');\n\t\tjQuery('.spinner').css('visibility', 'visible');\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif( parseInt(msg) === 0 ) {\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\t} else {\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\n\n\t\t\t\t\tvar dummy = document.createElement('a');\n\t\t\t\t\tdummy.href = url;\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\n\n\t\t\t\t\tdocument.body.appendChild(dummy);\n\t\t\t\t\tdummy.click();\n\t\t\t\t}\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t}\n\t\t});\n\t});\n\n\t// Delete inserted users\n\tjQuery(\".ct_insert_users\").click(function( e ){\n\t\tct_insert_users();\n\t});\n\n\t// Insert users\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\n\t\tct_insert_users( true );\n\t});\n\n\t// Delete all spam users\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\n\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\n\t\t\treturn false;\n\n\t\tct_delete_all_users( e );\n\n\t});\n\n\tfunction ct_insert_users(delete_accounts){\n\n\t\tdelete_accounts = delete_accounts || null;\n\n\t\tvar data = {\n\t\t\t'action': 'ajax_insert_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\n\t\tif(delete_accounts)\n\t\t\tdata['delete'] = true;\n\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(delete_accounts)\n\t\t\t\t\talert('Deleted ' + msg + ' users');\n\t\t\t\telse\n\t\t\t\t\talert('Inserted ' + msg + ' users');\n\t\t\t}\n\t\t});\n\t}\n\n});"],"names":["String","prototype","printf","formatted","this","arg","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","is","val","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","check_amount","new_check","unchecked","amount","new_href","status_string","parseJSON","parseInt","error","confirm","error_message","location","href","end","hide","checked","spam","bad","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_delete_all_users","e","target","addClass","css","removeClass","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","click","ct_check","accurate","JSON","stringify","ct_id","fadeOut","remove","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","createElement","download","body","appendChild","ct_confirm_deletion_all"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IAAIC,EAAYC,KAChB,IAAK,IAAIC,KAAOC,UAClB,IAAIC,EAAmBJ,EAAUK,UAAU,EAAGL,EAAUM,QAAQ,KAAM,IAClEC,EAAmBP,EAAUK,UAAUL,EAAUM,QAAQ,KAAM,GAAG,EAAGN,EAAUQ,QACnFR,EAAYI,EAAmBD,UAAUD,GAAOK,EAE9C,OAAOP,GAOX,IAAIS,aAHJC,SAASC,OAAS,oDAIjBC,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,aAAaD,iBAChCE,aAAmBD,aAAaC,aAChCC,aAAmBF,aAAaE,aAE7BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,aAAaM,cAChCC,eAAiB,EACjBC,iBAAmB,EACnBC,cAAgB,EAChBC,aAAe,EACfC,aAAe,QACfC,aAAe,EACfC,aAAe,EAGhB,SAASC,kBAAkBC,EAAOC,GACjC,IAAIvB,EAAS,GAuBb,MArBmB,iBADnBsB,EAAQA,GAAS,QACYA,EAAQA,EAAME,SAE3B,UADhBD,EAAWA,GAAY,CAAC,SAAU,UACDA,EAAW,MACtB,iBAAZA,IAAsBA,EAAWA,EAASC,SACpDzB,SAASC,OAAOwB,MAAM,KAAKC,QAAQ,SAASC,EAAMC,EAAGC,GACpD,IAAIC,EAAOH,EAAKI,OAAON,MAAM,KAE1BF,GACFA,EAAMG,QAAQ,SAASM,EAAMJ,EAAGK,GAC5BH,EAAK,KAAOE,IACd/B,EAAO6B,EAAK,IAAOA,EAAK,MAIxBN,GACFA,EAASE,QAAQ,SAASQ,EAAQN,EAAGK,GACL,IAA5BH,EAAK,GAAGlC,QAAQsC,KAClBjC,EAAO6B,EAAK,IAAOA,EAAK,QAIrB7B,EAGR,SAASkC,iBAAkBH,GAC1B,IA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6F,OAAOC,QAAQ,OAAQ,WACzC9F,OAAO,YAAY6F,OAAOE,cAMzBxF,EAAO,CACVC,OAAU,mBACVC,SAAYlC,cACZyH,QAAWH,MACXI,OAAU,UACVvF,SAAYC,KAAKC,UAElBZ,OAAOa,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLT,KAAMA,EACNU,QAAS,SAASC,KAWlBa,MAAO,SAASa,EAAOC,EAAYC,KAGnCE,QAAS,QAMXhD,OAAO,oBAAoBwF,MAAM,SAAU5B,GAC1C,IAAIrD,EAAO,CACVC,OAAU,uBACVC,SAAYlC,cACZ2H,SAAYjI,aAAakI,gBACzBzF,SAAYC,KAAKC,UAElBZ,OAAO,IAAM4D,EAAEC,OAAO9D,IAAI+D,SAAS,YACnC9D,OAAO,YAAY+D,IAAI,aAAc,WACrC/D,OAAOa,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLT,KAAMA,EACNU,QAAS,SAASC,GACjB,IAGKH,EAEAqF,EALiB,IAAlBtE,SAASZ,GACZwC,MAAMzF,aAAaoI,aAEftF,EAAMuF,IAAIC,gBAAgB,IAAIC,KAAK,CAACtF,MAEpCkF,EAAQ3I,SAASgJ,cAAc,MAC7BtE,KAAOpB,EACbqF,EAAMM,SAAWzI,aAAakI,gBAAkB,OAEhD1I,SAASkJ,KAAKC,YAAYR,GAC1BA,EAAMZ,SAEPxF,OAAO,IAAM4D,EAAEC,OAAO9D,IAAIiE,YAAY,YACtChE,OAAO,YAAY+D,IAAI,aAAc,eAMxC/D,OAAO,oBAAoBwF,MAAM,SAAU5B,GAC1C0B,MAIDtF,OAAO,4BAA4BwF,MAAM,SAAU5B,GAClD0B,GAAiB,KAIlBtF,OAAO,wBAAwBwF,MAAM,SAAU5B,GAE9C,QAAO5B,QAAS/D,aAAa4I,+BAG7BlD,oBAAqBC"}
1
+ {"version":3,"file":"cleantalk-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Set deafult amount to check by request.\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\n\tct_prev_till = ctUsersCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\n\tct_users_total = 0,\n\tct_users_checked = 0,\n\tct_users_spam = 0,\n\tct_users_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes === 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\nfunction apbct_get_cookie( name ){\n\tvar cookie = apbct_cookie__get( name, name );\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\n\t\treturn cookie[name];\n\t}else\n\t\treturn null;\n}\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to === 0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_users(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\n\tvar data = {\n\t\t'action' : 'ajax_clear_users',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}\n\t});\n\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_users();\n\tct_show_users_info();\n}\n\nfunction ct_send_users(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\n\n\tvar data = {\n\t\taction: 'ajax_check_users',\n\t\tsecurity: ct_ajax_nonce,\n\t\tnew_check: ct_new_check,\n\t\tunchecked: ct_unchecked,\n\t\tamount: check_amount,\n\t\t'no_cache': Math.random(),\n\t\t'offset' : Number(getCookie('apbct_check_users_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_users();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\n\t\t\t\t\tct_users_bad = parseInt( ct_users_bad ) + parseInt( msg.bad );\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\n\t\t\t\t\tvar offset = Number(getCookie('apbct_check_users_offset')) + 100;\n\t\t\t\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\t\t\t\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + offset + \"; samesite=lax\" + ctSecure;\n\t\t\t\t\t\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tif(check_amount > 20){\n\t\t\t\tcheck_amount -= 20;\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\n\t\t\t}\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\t\n\tif( ct_working ){\n\t\t\n\t\tif(ct_cooling_down_flag === true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif( ! ct_users_total ){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce,\n\t\t\t\t'no_cache': Math.random()\n\t\t\t};\n\t\t\t\n\t\t\tif( ct_date_from && ct_date_till ){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\n// Main function of checking\nfunction ct_start_check( continue_check ){\n\n\tcontinue_check = continue_check || null;\n\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\n\t\t\talert('Please, specify a date range.');\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\tct_accurate_check = true;\n\t}\n\n\tjQuery('.ct_to_hide').hide();\n\tjQuery('#ct_working_message').show();\n\tjQuery('#ct_preloader').show();\n\tjQuery('#ct_pause').show();\n\n\tct_working = true;\n\n\tif( continue_check ){\n\t\tct_show_users_info();\n\t\tct_send_users();\n\t} else {\n\t\tct_clear_users();\n\t}\n\n}\n\nfunction ct_delete_all_users( e ){\n\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users( e, data );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Setting dependences\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\t\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\t\t\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\t\t\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\t\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve',\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t\t\n\t});\n\t\n\t// Request to Download CSV file.\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery('.' + e.target.id).addClass('disabled');\n\t\tjQuery('.spinner').css('visibility', 'visible');\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif( parseInt(msg) === 0 ) {\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\t} else {\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\n\n\t\t\t\t\tvar dummy = document.createElement('a');\n\t\t\t\t\tdummy.href = url;\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\n\n\t\t\t\t\tdocument.body.appendChild(dummy);\n\t\t\t\t\tdummy.click();\n\t\t\t\t}\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t}\n\t\t});\n\t});\n\n\t// Delete inserted users\n\tjQuery(\".ct_insert_users\").click(function( e ){\n\t\tct_insert_users();\n\t});\n\n\t// Insert users\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\n\t\tct_insert_users( true );\n\t});\n\n\t// Delete all spam users\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\n\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\n\t\t\treturn false;\n\n\t\tct_delete_all_users( e );\n\n\t});\n\n\tfunction ct_insert_users(delete_accounts){\n\n\t\tdelete_accounts = delete_accounts || null;\n\n\t\tvar data = {\n\t\t\t'action': 'ajax_insert_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\n\t\tif(delete_accounts)\n\t\t\tdata['delete'] = true;\n\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(delete_accounts)\n\t\t\t\t\talert('Deleted ' + msg + ' users');\n\t\t\t\telse\n\t\t\t\t\talert('Inserted ' + msg + ' users');\n\t\t\t}\n\t\t});\n\t}\n\n});\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction getCookie(name) {\n\tlet matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n} "],"names":["String","prototype","printf","arg","formatted","this","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","ctSecure","is","val","location","protocol","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","check_amount","new_check","unchecked","amount","offset","Number","getCookie","parseJSON","parseInt","error","confirm","error_message","new_href","href","end","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_delete_all_users","e","target","addClass","css","removeClass","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","click","ct_check","accurate","JSON","stringify","ct_id","fadeOut","remove","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","createElement","download","body","appendChild","ct_confirm_deletion_all"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,QAAQ,KAAM,IAClEC,EAAmBN,EAAUI,UAAUJ,EAAUK,QAAQ,KAAM,GAAG,EAAGL,EAAUO,QACnFP,EAAYG,EAAmBD,UAAUH,GAAOO,EAE9C,OAAON,GAOX,IAAIQ,aAHJC,SAASC,OAAS,oDAIjBC,cAAe,EACfC,sBAAuB,EACvBC,kBAAmB,EACnBC,mBAAoB,EACpBC,UAAW,EACXC,iBAAmBC,aAAaD,iBAChCE,aAAmBD,aAAaC,aAChCC,aAAmBF,aAAaE,aAE7BC,kBAAoB,IACvBC,oBAAsB,EACtBC,gBAAkB,GAEfC,cAAgBN,aAAaM,cAChCC,eAAiB,EACjBC,iBAAmB,EACnBC,cAAgB,EAChBC,aAAe,EACfC,aAAe,QACfC,aAAe,EACfC,aAAe,EAGhB,SAASC,kBAAkBC,EAAOC,GACjC,IAAIvB,EAAS,GAuBb,MArBmB,iBADnBsB,EAAQA,GAAS,QACYA,EAAQA,EAAME,SAGrB,iBADWD,EAAjB,UADhBA,EAAWA,GAAY,CAAC,SAA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AAS,YACnCnE,OAAO,YAAYoE,IAAI,aAAc,WACrCpE,OAAOgB,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLT,KAAMA,EACNU,QAAS,SAASC,GACjB,IAKK0F,EALiB,IAAlB7E,SAASb,GACZ0C,MAAM9F,aAAa+I,aAEf9F,EAAM+F,IAAIC,gBAAgB,IAAIC,KAAK,CAAC9F,MAEpC0F,EAAQtJ,SAAS2J,cAAc,MAC7B7E,KAAOrB,EACb6F,EAAMM,SAAWpJ,aAAa6I,gBAAkB,OAEhDrJ,SAAS6J,KAAKC,YAAYR,GAC1BA,EAAMZ,SAEPnG,OAAO,IAAMiE,EAAEC,OAAOnE,IAAIsE,YAAY,YACtCrE,OAAO,YAAYoE,IAAI,aAAc,eAMxCpE,OAAO,oBAAoBmG,MAAM,SAAUlC,GAC1CgC,MAIDjG,OAAO,4BAA4BmG,MAAM,SAAUlC,GAClDgC,GAAiB,KAIlBjG,OAAO,wBAAwBmG,MAAM,SAAUlC,GAE9C,IAAO7B,QAASnE,aAAauJ,yBAC5B,OAAO,EAERxD,oBAAqBC"}
js/cleantalk-users-editscreen.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_is_email(e){return e.search(/.*@.*\..*/)}function ct_is_ip(e){return e.search(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)}jQuery(document).ready(function(){parseInt(ctUsersScreen.ct_show_check_links)&&(jQuery(".column-email a").each(function(){var e=jQuery(this).html();-1!==ct_is_email(e)&&jQuery(this).after('&nbsp;<a href="https://cleantalk.org/blacklists/'+e+'" target="_blank" title="https://cleantalk.org/blacklists/'+e+'" class="ct_link_new_tab"><img src="'+ctUsersScreen.ct_img_src_new_tab+'"></a>')}),jQuery(".username.column-username").each(function(){var e=jQuery(this).siblings(".apbct_status").children("span"),t=e.attr("id"),c=e.text(),r=jQuery("<span>",{text:c}),s=jQuery("<i>",{class:"apbct-icon-ok"}),a=jQuery("<i>",{class:"apbct-icon-cancel",css:{color:"red"}});"apbct_not_checked"===t&&jQuery(this).children(".row-actions").before(s).before(r),"apbct_checked_not_spam"===t&&(s.attr("style","color:green;"),jQuery(this).children(".row-actions").before(s).before(r)),"apbct_checked_spam"===t&&jQuery(this).children(".row-actions").before(a).before(r)}))});
2
  //# sourceMappingURL=cleantalk-users-editscreen.min.js.map
1
+ function ct_is_email(e){return e.search(/.*@.*\..*/)}function ct_is_ip(e){return e.search(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)}jQuery(document).ready(function(){parseInt(ctUsersScreen.ct_show_check_links)&&(jQuery(".column-email a").each(function(){var e=jQuery(this).html();-1!==ct_is_email(e)&&jQuery(this).after('&nbsp;<a href="https://cleantalk.org/blacklists/'+e+'" target="_blank" title="https://cleantalk.org/blacklists/'+e+'" class="ct_link_new_tab"><img src="'+ctUsersScreen.ct_img_src_new_tab+'"></a>')}),jQuery(".username.column-username").each(function(){var e=jQuery(this).siblings(".apbct_status").children("span"),t=e.attr("id"),e=e.text(),e=jQuery("<span>",{text:e}),c=jQuery("<i>",{class:"apbct-icon-ok"}),r=jQuery("<i>",{class:"apbct-icon-cancel",css:{color:"red"}});"apbct_not_checked"===t&&jQuery(this).children(".row-actions").before(c).before(e),"apbct_checked_not_spam"===t&&(c.attr("style","color:green;"),jQuery(this).children(".row-actions").before(c).before(e)),"apbct_checked_spam"===t&&jQuery(this).children(".row-actions").before(r).before(e)}))});
2
  //# sourceMappingURL=cleantalk-users-editscreen.min.js.map
js/cleantalk_external.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_protect_external(){for(var e,t,n,a,o,c,i,l,r,d=0;d<document.forms.length;d++){void 0!==document.forms[d].cleantalk_hidden_action||void 0!==document.forms[d].cleantalk_hidden_method||"string"==typeof(e=document.forms[d]).action&&(isIntegratedForm(e)?(jQuery(e).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(e).prev(),n=e.outerHTML,a=jQuery(e).detach(),t.after(n),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(c=document.forms[d]).appendChild(o),void 0!==c.classList&&c.classList.contains("ml-block-form")?void 0!==(i=jQuery("form.ml-block-form").find('button[type="submit"]'))&&i.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(c,t,a)}):document.forms[d].onsubmit=function(e){e.preventDefault(),sendAjaxCheckingFormData(c,t,a)}):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((l=document.createElement("input")).name="cleantalk_hidden_action",l.value=e.action,l.type="hidden",e.appendChild(l),(r=document.createElement("input")).name="cleantalk_hidden_method",r.value=e.method,r.type="hidden",e.method="POST",e.appendChild(r),e.action=document.location))}}function apbct_replace_inputs_values_from_other_form(e,t){var n=jQuery(e).find("button, input, textarea, select"),c=jQuery(t).find("button, input, textarea, select");n.each(function(e,a){var o=jQuery(a);c.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com"))}function sendAjaxCheckingFormData(o,e,t){var n={};n[0]=apbct_collect_visible_fields(o),apbct_visible_fields_set_cookie(n);var a={},c=o.elements;(c=Array.prototype.slice.call(c)).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,n){var a;+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(o).detach(),t),e.after(t),0!==(a=jQuery(t).find("button[type=submit]")).length&&a[0].click(),0!==(a=jQuery(t).find('button[data-element="submit"]')).length&&a[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
1
+ function ct_protect_external(){for(var e,t,n,a,o,c,i=0;i<document.forms.length;i++)void 0!==document.forms[i].cleantalk_hidden_action||void 0!==document.forms[i].cleantalk_hidden_method||"string"==typeof(e=document.forms[i]).action&&(isIntegratedForm(e)?(jQuery(e).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(e).prev(),o=e.outerHTML,n=jQuery(e).detach(),t.after(o),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(a=document.forms[i]).appendChild(o),void 0!==a.classList&&a.classList.contains("ml-block-form")?void 0!==(o=jQuery("form.ml-block-form").find('button[type="submit"]'))&&o.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(a,t,n)}):document.forms[i].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),n=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,n)}):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((o=document.createElement("input")).name="cleantalk_hidden_action",o.value=e.action,o.type="hidden",e.appendChild(o),(c=document.createElement("input")).name="cleantalk_hidden_method",c.value=e.method,c.type="hidden",e.method="POST",e.appendChild(c),e.action=document.location))}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),n=jQuery(t).find("button, input, textarea, select");e.each(function(e,a){var o=jQuery(a);n.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com"))}function sendAjaxCheckingFormData(a,e,t){var n={},o=(n[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(n),{}),n=a.elements;(n=Array.prototype.slice.call(n)).forEach(function(e,t){""===e.name?o["input_"+t]=e.value:o[e.name]=e.value}),apbct_public_sendAJAX(o,{async:!1,callback:function(e,t,n){+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),t),e.after(t),0!==(n=jQuery(t).find("button[type=submit]")).length&&n[0].click(),0!==(n=jQuery(t).find('button[data-element="submit"]')).length&&n[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
2
  //# sourceMappingURL=cleantalk_external.min.js.map
js/cleantalk_external.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n\n event.preventDefault();\n\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST';\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 // Mailerlite integration\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","currentForm","prev","form_html","form_original","force_action","reUseCurrentForm","mailerliteSubmitButton","ct_action","ct_method","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","jQuery","before","outerHTML","detach","after","createElement","name","value","type","appendChild","classList","contains","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","action","indexOf","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","data","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","subm_button","apbct","blocked","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACL,IAAI,IAKQC,EAQQC,EACAC,EACAC,EAIAC,EAKAC,EAMIC,EA0BAC,EAMAC,EA9DhBC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,IAAK,MAEOI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAAS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.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST';\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 // Mailerlite integration\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","currentForm","prev","form_original","reUseCurrentForm","ct_action","ct_method","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","jQuery","before","form_html","outerHTML","detach","after","force_action","createElement","name","value","type","appendChild","classList","contains","mailerliteSubmitButton","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","currentTarget","clone","action","indexOf","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","data","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","apbct","blocked","subm_button","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACL,IAAI,IAKQC,EAQQC,EAEAC,EASAC,EAkCIC,EAMAC,EAhEhBC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,SAEYI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAASC,MAAMF,GAAGM,yBAK5C,iBAF7BZ,EAAcO,SAASC,MAAMF,IAEL,SAErBO,iBAAiBb,IAChBc,OAAQd,GAAce,OAAO,gEAGzBd,EAAOa,OAAOd,GAAaC,OAC3Be,EAAYhB,EAAYiB,UACxBf,EAAgBY,OAAOd,GAAakB,SAExCjB,EAAKkB,MAAOH,IAERI,EAAeb,SAASc,cAAc,UAC7BC,KAAO,SACpBF,EAAaG,MAAQ,6BACrBH,EAAaI,KAAO,UAEhBrB,EAAmBI,SAASC,MAAMF,IAEr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UACgD,IAA5CqB,EAAWpB,QAAQ,sBAC2B,IAA9CoB,EAAWpB,QAAQ,4BACgB5B,IAAjC+C,EAAQE,WAAWjC,WAA2B+B,EAAQE,WAAWjC,UAAUC,SAAS,mBAC5C,IAA1C+B,EAAWpB,QAAQ,mBAW3B,SAASL,yBAAyB2B,EAAM3D,EAAM4D,GAE1C,IAAIC,EAAiB,GAIjBC,GAHJD,EAAe,GAAKE,6BAA6BJ,GACjDK,gCAAiCH,GAEtB,IACPI,EAAQN,EAAKO,UAGjBD,EAFQE,MAAMC,UAAUC,MAAMC,KAAKL,IAE7BM,QAAS,SAAUC,EAAMC,GACT,KAAdD,EAAKnD,KACLyC,EAAK,SAAWW,GAAKD,EAAKlD,MAE1BwC,EAAKU,EAAKnD,MAAQmD,EAAKlD,QAI/BoD,sBACIZ,EACA,CACIa,OAAO,EACPC,SAAU,SAAU5E,EAAM4D,EAAciB,IAE7BA,EAAOC,MAAMC,UAIhBpC,4CAFe9B,OAAO8C,GAAM1C,SAE0B2C,GAEtD5D,EAAKkB,MAAO0C,GAIe,KADvBoB,EAAcnE,OAAO+C,GAAchC,KAAK,wBAC5BpB,QACZwE,EAAY,GAAGnD,QAKQ,KAD3BmD,EAAcnE,OAAO+C,GAAchC,KAAK,kCACxBpB,QACZwE,EAAY,GAAGnD,UAK3BoD,iBAAkB,KAClBC,gBAAiB,CAAClF,EAAM4D,KA1EpCuB,OAAOC,OAAS,WACZC,WAAW,WACPvF,uBACD"}
js/cleantalk_internal.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ct_check_internal(t){var e={},n=t.elements;for(var c in n)"submit"!=n[c].type&&null!=n[c].value&&""!=n[c].value&&(e[n[c].name]=t.elements[c].value);e.action="ct_check_internal",jQuery.ajax({type:"POST",url:ctNocache.blog_home,datatype:"text",data:e,success:function(e){if("true"!=e)return alert(e),!1;t.submit()},error:function(){t.submit()}})}window.addEventListener("DOMContentLoaded",function(){var e="",t="";for(i=0;i<document.forms.length;i++)"string"==typeof document.forms[i].action&&(-1==(e=(t=document.forms[i]).action).indexOf("http://")&&-1==e.indexOf("https://")||-1!=e.search(/\/wp-content\/themes.*\.php$/)&&-1!=e.indexOf(ctNocache.blog_home)&&(ctPrevHandler=t.click,jQuery(t).off("**"),jQuery(t).off(),jQuery(t).on("submit",function(){return ct_check_internal(t),!1})))});
2
  //# sourceMappingURL=cleantalk_internal.min.js.map
1
+ function ct_check_internal(t){var e,n={},c=t.elements;for(e in c)"submit"!=c[e].type&&null!=c[e].value&&""!=c[e].value&&(n[c[e].name]=t.elements[e].value);n.action="ct_check_internal",jQuery.ajax({type:"POST",url:ctNocache.blog_home,datatype:"text",data:n,success:function(e){if("true"!=e)return alert(e),!1;t.submit()},error:function(){t.submit()}})}window.addEventListener("DOMContentLoaded",function(){var e,t="";for(i=0;i<document.forms.length;i++)"string"!=typeof document.forms[i].action||-1==(t=(e=document.forms[i]).action).indexOf("http://")&&-1==t.indexOf("https://")||-1!=t.search(/\/wp-content\/themes.*\.php$/)&&-1!=t.indexOf(ctNocache.blog_home)&&(ctPrevHandler=e.click,jQuery(e).off("**"),jQuery(e).off(),jQuery(e).on("submit",function(){return ct_check_internal(e),!1}))});
2
  //# sourceMappingURL=cleantalk_internal.min.js.map
js/cleantalk_internal.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk_internal.min.js","sources":["cleantalk_internal.js"],"sourcesContent":["function ct_check_internal(currForm){\n \n//Gathering data\n var ct_data = {},\n elems = currForm.elements;\n\n for (var key in elems) {\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\n continue;\n ct_data[elems[key].name] = currForm.elements[key].value;\n }\n ct_data['action'] = 'ct_check_internal';\n\n//AJAX Request\n jQuery.ajax({\n type: 'POST',\n url: ctNocache.blog_home,\n datatype : 'text',\n data: ct_data,\n success: function(data){\n if(data == 'true'){\n currForm.submit();\n }else{\n alert(data);\n return false;\n }\n },\n error: function(){\n currForm.submit();\n }\n }); \n}\n\nwindow.addEventListener('DOMContentLoaded', function () {\n var ct_currAction = '',\n ct_currForm = '';\n for(i=0;i<document.forms.length;i++){\n if(typeof(document.forms[i].action)=='string'){\n ct_currForm = document.forms[i];\n ct_currAction = ct_currForm.action;\n if(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){\n if(ct_currAction.search(/\\/wp-content\\/themes.*\\.php$/) != (-1) && ct_currAction.indexOf(ctNocache.blog_home) != (-1)){\n ctPrevHandler = ct_currForm.click;\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(){\n ct_check_internal(ct_currForm);\n return false;\n });\n }\n }\n }\n }\n});"],"names":["ct_check_internal","currForm","ct_data","elems","elements","key","type","undefined","value","name","jQuery","ajax","url","ctNocache","blog_home","datatype","data","success","alert","submit","error","window","addEventListener","ct_currAction","ct_currForm","i","document","forms","length","action","indexOf","search","ctPrevHandler","click","off","on"],"mappings":"AAAA,SAASA,kBAAkBC,GAGvB,IAAIC,EAAU,GACVC,EAAQF,EAASG,SAErB,IAAK,IAAIC,KAAOF,EACU,UAAnBA,EAAME,GAAKC,MAAwCC,MAApBJ,EAAME,GAAKG,OAA0C,IAApBL,EAAME,GAAKG,QAE9EN,EAAQC,EAAME,GAAKI,MAAQR,EAASG,SAASC,GAAKG,OAEtDN,EAAgB,OAAI,oBAGpBQ,OAAOC,KAAK,CACRL,KAAM,OACNM,IAAKC,UAAUC,UACfC,SAAW,OACXC,KAAMd,EACNe,QAAS,SAASD,GACd,GAAW,QAARA,EAIC,OADAE,MAAMF,IACC,EAHPf,EAASkB,UAMjBC,MAAO,WACHnB,EAASkB,YAKrBE,OAAOC,iBAAiB,mBAAoB,WACxC,IAAIC,EAAgB,GAChBC,EAAc,GAClB,IAAIC,EAAE,EAAEA,EAAEC,SAASC,MAAMC,OAAOH,IACS,iBAA3BC,SAASC,MAAMF,GAAS,UAGQ,IADtCF,GADAC,EAAcE,SAASC,MAAMF,IACDI,QACXC,QAAQ,aAAoD,GAApCP,EAAcO,QAAQ,cACE,GAA1DP,EAAcQ,OAAO,kCAA2F,GAAhDR,EAAcO,QAAQjB,UAAUC,aAC/FkB,cAAgBR,EAAYS,MAC5BvB,OAAOc,GAAaU,IAAI,MACxBxB,OAAOc,GAAaU,MACpBxB,OAAOc,GAAaW,GAAG,SAAU,WAE7B,OADAnC,kBAAkBwB,IACX"}
1
+ {"version":3,"file":"cleantalk_internal.min.js","sources":["cleantalk_internal.js"],"sourcesContent":["function ct_check_internal(currForm){\n \n//Gathering data\n var ct_data = {},\n elems = currForm.elements;\n\n for (var key in elems) {\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\n continue;\n ct_data[elems[key].name] = currForm.elements[key].value;\n }\n ct_data['action'] = 'ct_check_internal';\n\n//AJAX Request\n jQuery.ajax({\n type: 'POST',\n url: ctNocache.blog_home,\n datatype : 'text',\n data: ct_data,\n success: function(data){\n if(data == 'true'){\n currForm.submit();\n }else{\n alert(data);\n return false;\n }\n },\n error: function(){\n currForm.submit();\n }\n }); \n}\n\nwindow.addEventListener('DOMContentLoaded', function () {\n var ct_currAction = '',\n ct_currForm = '';\n for(i=0;i<document.forms.length;i++){\n if(typeof(document.forms[i].action)=='string'){\n ct_currForm = document.forms[i];\n ct_currAction = ct_currForm.action;\n if(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){\n if(ct_currAction.search(/\\/wp-content\\/themes.*\\.php$/) != (-1) && ct_currAction.indexOf(ctNocache.blog_home) != (-1)){\n ctPrevHandler = ct_currForm.click;\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(){\n ct_check_internal(ct_currForm);\n return false;\n });\n }\n }\n }\n }\n});"],"names":["ct_check_internal","currForm","key","ct_data","elems","elements","type","undefined","value","name","jQuery","ajax","url","ctNocache","blog_home","datatype","data","success","alert","submit","error","window","addEventListener","ct_currForm","ct_currAction","i","document","forms","length","action","indexOf","search","ctPrevHandler","click","off","on"],"mappings":"AAAA,SAASA,kBAAkBC,GAGvB,IAGSC,EAHLC,EAAU,GACVC,EAAQH,EAASI,SAErB,IAASH,KAAOE,EACU,UAAnBA,EAAMF,GAAKI,MAAwCC,MAApBH,EAAMF,GAAKM,OAA0C,IAApBJ,EAAMF,GAAKM,QAE9EL,EAAQC,EAAMF,GAAKO,MAAQR,EAASI,SAASH,GAAKM,OAEtDL,EAAgB,OAAI,oBAGpBO,OAAOC,KAAK,CACRL,KAAM,OACNM,IAAKC,UAAUC,UACfC,SAAW,OACXC,KAAMb,EACNc,QAAS,SAASD,GACd,GAAW,QAARA,EAIC,OADAE,MAAMF,IACC,EAHPf,EAASkB,UAMjBC,MAAO,WACHnB,EAASkB,YAKrBE,OAAOC,iBAAiB,mBAAoB,WACxC,IACIC,EADAC,EAAgB,GAEpB,IAAIC,EAAE,EAAEA,EAAEC,SAASC,MAAMC,OAAOH,IACS,iBAA3BC,SAASC,MAAMF,GAAS,SAGQ,IADtCD,GADAD,EAAcG,SAASC,MAAMF,IACDI,QACXC,QAAQ,aAAoD,GAApCN,EAAcM,QAAQ,cACE,GAA1DN,EAAcO,OAAO,kCAA2F,GAAhDP,EAAcM,QAAQjB,UAAUC,aAC/FkB,cAAgBT,EAAYU,MAC5BvB,OAAOa,GAAaW,IAAI,MACxBxB,OAAOa,GAAaW,MACpBxB,OAAOa,GAAaY,GAAG,SAAU,WAE7B,OADAnC,kBAAkBuB,IACX"}
lib/Cleantalk/Antispam/Cleantalk.php CHANGED
@@ -19,7 +19,7 @@ use Cleantalk\ApbctWP\Helper;
19
  class Cleantalk
20
  {
21
  /**
22
- * Use Wordpress built-in API
23
  * @var bool
24
  */
25
  public $use_bultin_api = false;
19
  class Cleantalk
20
  {
21
  /**
22
+ * Use WordPress built-in API
23
  * @var bool
24
  */
25
  public $use_bultin_api = false;
lib/Cleantalk/Antispam/CleantalkResponse.php CHANGED
@@ -129,10 +129,10 @@ class CleantalkResponse
129
  public function __construct($obj = null)
130
  {
131
  $this->errno = isset($obj->errno) ? $obj->errno : 0;
132
- $this->errstr = isset($obj->errstr) ? preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", $obj->errstr) : null;
133
 
134
  $this->stop_words = isset($obj->stop_words) ? utf8_decode($obj->stop_words) : null;
135
- $this->comment = isset($obj->comment) ? utf8_decode($obj->comment) : null;
136
  $this->blacklisted = isset($obj->blacklisted) ? $obj->blacklisted : null;
137
  $this->allow = isset($obj->allow) ? $obj->allow : 1;
138
  $this->id = isset($obj->id) ? $obj->id : null;
@@ -142,7 +142,7 @@ class CleantalkResponse
142
  $this->sms_allow = isset($obj->sms_allow) ? $obj->sms_allow : null;
143
  $this->sms = isset($obj->sms) ? $obj->sms : null;
144
  $this->sms_error_code = isset($obj->sms_error_code) ? $obj->sms_error_code : null;
145
- $this->sms_error_text = isset($obj->sms_error_text) ? $obj->sms_error_text : null;
146
  $this->stop_queue = isset($obj->stop_queue) ? $obj->stop_queue : 0;
147
  $this->inactive = isset($obj->inactive) ? $obj->inactive : 0;
148
  $this->account_status = isset($obj->account_status) ? $obj->account_status : -1;
@@ -150,7 +150,7 @@ class CleantalkResponse
150
  $this->codes = isset($obj->codes) ? explode(' ', $obj->codes) : array();
151
 
152
  if ( $this->errno !== 0 && $this->errstr !== null && $this->comment === null ) {
153
- $this->comment = '*** ' . $this->errstr . ' Antispam service cleantalk.org ***';
154
  }
155
  }
156
  }
129
  public function __construct($obj = null)
130
  {
131
  $this->errno = isset($obj->errno) ? $obj->errno : 0;
132
+ $this->errstr = isset($obj->errstr) ? preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", htmlspecialchars($obj->errstr)) : null;
133
 
134
  $this->stop_words = isset($obj->stop_words) ? utf8_decode($obj->stop_words) : null;
135
+ $this->comment = isset($obj->comment) ? strip_tags(utf8_decode($obj->comment), '<p><a><br>') : null;
136
  $this->blacklisted = isset($obj->blacklisted) ? $obj->blacklisted : null;
137
  $this->allow = isset($obj->allow) ? $obj->allow : 1;
138
  $this->id = isset($obj->id) ? $obj->id : null;
142
  $this->sms_allow = isset($obj->sms_allow) ? $obj->sms_allow : null;
143
  $this->sms = isset($obj->sms) ? $obj->sms : null;
144
  $this->sms_error_code = isset($obj->sms_error_code) ? $obj->sms_error_code : null;
145
+ $this->sms_error_text = isset($obj->sms_error_text) ? htmlspecialchars($obj->sms_error_text) : null;
146
  $this->stop_queue = isset($obj->stop_queue) ? $obj->stop_queue : 0;
147
  $this->inactive = isset($obj->inactive) ? $obj->inactive : 0;
148
  $this->account_status = isset($obj->account_status) ? $obj->account_status : -1;
150
  $this->codes = isset($obj->codes) ? explode(' ', $obj->codes) : array();
151
 
152
  if ( $this->errno !== 0 && $this->errstr !== null && $this->comment === null ) {
153
+ $this->comment = '*** ' . $this->errstr . ' Anti-Spam service cleantalk.org ***';
154
  }
155
  }
156
  }
lib/Cleantalk/Antispam/DisableComments.php CHANGED
@@ -19,7 +19,7 @@ class DisableComments
19
  use Singleton;
20
 
21
  /**
22
- * Determs is Wordpress Multisite is enabled
23
  *
24
  * @var bool
25
  */
19
  use Singleton;
20
 
21
  /**
22
+ * Determs is WordPress Multisite is enabled
23
  *
24
  * @var bool
25
  */
lib/Cleantalk/Antispam/Integrations/ContactBank.php CHANGED
@@ -2,12 +2,14 @@
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
 
 
5
  class ContactBank extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- if ( isset($_REQUEST['param']) ) {
10
- parse_str(isset($_REQUEST['data']) ? base64_decode($_REQUEST['data']) : '', $form_data);
11
 
12
  /**
13
  * Filter for POST
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
5
+ use Cleantalk\Variables\Request;
6
+
7
  class ContactBank extends IntegrationBase
8
  {
9
  public function getDataForChecking($argument)
10
  {
11
+ if ( Request::get('param') ) {
12
+ parse_str(Request::get('data') ? base64_decode(Request::get('data')) : '', $form_data);
13
 
14
  /**
15
  * Filter for POST
lib/Cleantalk/Antispam/Integrations/ElfsightContactForm.php CHANGED
@@ -2,15 +2,17 @@
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
 
 
5
  class ElfsightContactForm extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- if ( isset($_POST['fields']) ) {
10
  /**
11
  * Filter for POST
12
  */
13
- $input_array = apply_filters('apbct__filter_post', $_POST['fields']);
14
 
15
  return ct_get_fields_any($input_array);
16
  }
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class ElfsightContactForm extends IntegrationBase
8
  {
9
  public function getDataForChecking($argument)
10
  {
11
+ if ( Post::get('fields') ) {
12
  /**
13
  * Filter for POST
14
  */
15
+ $input_array = apply_filters('apbct__filter_post', Post::get('fields'));
16
 
17
  return ct_get_fields_any($input_array);
18
  }
lib/Cleantalk/Antispam/Integrations/EstimationForm.php CHANGED
@@ -2,15 +2,17 @@
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
 
 
5
  class EstimationForm extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- if ( isset($_POST['customerInfos']) ) {
10
  /**
11
  * Filter for POST
12
  */
13
- $input_array = apply_filters('apbct__filter_post', $_POST['customerInfos']);
14
 
15
  return ct_get_fields_any($input_array);
16
  }
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class EstimationForm extends IntegrationBase
8
  {
9
  public function getDataForChecking($argument)
10
  {
11
+ if ( Post::get('customerInfos') ) {
12
  /**
13
  * Filter for POST
14
  */
15
+ $input_array = apply_filters('apbct__filter_post', Post::get('customerInfos'));
16
 
17
  return ct_get_fields_any($input_array);
18
  }
lib/Cleantalk/Antispam/Integrations/EventsManager.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ use Cleantalk\Variables\Get;
6
+
7
+ class EventsManager extends IntegrationBase
8
+ {
9
+ public function getDataForChecking($argument)
10
+ {
11
+ /**
12
+ * Filter for POST
13
+ */
14
+ $input_array = apply_filters('apbct__filter_post', $_POST);
15
+
16
+ return ct_get_fields_any($input_array);
17
+ }
18
+
19
+ public function doBlock($message)
20
+ {
21
+ if ( Get::get('callback') ) {
22
+ $callback = htmlspecialchars(Get::get('callback'));
23
+ $output = array(
24
+ 'result' => false,
25
+ 'message' => '',
26
+ 'errors' => $message,
27
+ );
28
+ die($callback . '(' . json_encode($output) . ')');
29
+ }
30
+ return false;
31
+ }
32
+
33
+ public function allow()
34
+ {
35
+ return true;
36
+ }
37
+ }
lib/Cleantalk/Antispam/Integrations/FluentForm.php CHANGED
@@ -2,12 +2,14 @@
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
 
 
5
  class FluentForm extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- if ( isset($_POST['data']) ) {
10
- parse_str($_POST['data'], $form_data);
11
 
12
  /**
13
  * Filter for POST
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class FluentForm extends IntegrationBase
8
  {
9
  public function getDataForChecking($argument)
10
  {
11
+ if ( Post::get('data') ) {
12
+ parse_str(Post::get('data'), $form_data);
13
 
14
  /**
15
  * Filter for POST
lib/Cleantalk/Antispam/Integrations/OvaLogin.php CHANGED
@@ -2,14 +2,16 @@
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
 
 
5
  class OvaLogin extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
  if ( apbct_is_plugin_active('ova-login/ova-login.php')
10
- && !empty($_POST)
11
- && isset($_POST['email'])
12
- && isset($_POST['username'])
13
  ) {
14
  /**
15
  * Filter for POST
2
 
3
  namespace Cleantalk\Antispam\Integrations;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class OvaLogin extends IntegrationBase
8
  {
9
  public function getDataForChecking($argument)
10
  {
11
  if ( apbct_is_plugin_active('ova-login/ova-login.php')
12
+ && ! empty($_POST)
13
+ && Post::get('email')
14
+ && Post::get('username')
15
  ) {
16
  /**
17
  * Filter for POST
lib/Cleantalk/Antispam/Integrations/PlansoFormBuilder.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ class PlansoFormBuilder extends IntegrationBase
6
+ {
7
+ public function getDataForChecking($argument)
8
+ {
9
+ /**
10
+ * Filter for POST
11
+ */
12
+ $input_array = apply_filters('apbct__filter_post', $_POST);
13
+
14
+ return ct_get_fields_any($input_array);
15
+ }
16
+
17
+ public function doBlock($message)
18
+ {
19
+ global $ct_comment;
20
+ $ct_comment = $message;
21
+ ct_die(null, null);
22
+ }
23
+
24
+ public function allow()
25
+ {
26
+ return true;
27
+ }
28
+ }
lib/Cleantalk/ApbctWP/API.php CHANGED
@@ -4,7 +4,7 @@ namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
  * Class API.
7
- * Compatible only with Wordpress.
8
  *
9
  * @depends \Cleantalk\Common\API
10
  *
@@ -46,7 +46,7 @@ class API extends \Cleantalk\Common\API
46
 
47
  /**
48
  * Function sends raw request to API server.
49
- * May use built in Wordpress HTTP-API
50
  *
51
  * @param array Data to send
52
  * @param string API server URL
4
 
5
  /**
6
  * Class API.
7
+ * Compatible only with WordPress.
8
  *
9
  * @depends \Cleantalk\Common\API
10
  *
46
 
47
  /**
48
  * Function sends raw request to API server.
49
+ * May use built in WordPress HTTP-API
50
  *
51
  * @param array Data to send
52
  * @param string API server URL
lib/Cleantalk/ApbctWP/Activator.php CHANGED
@@ -114,7 +114,7 @@ class Activator
114
  }
115
 
116
  /**
117
- * Checking if a third party hook need to get API key automatically
118
  *
119
  * @return void
120
  */
@@ -128,9 +128,9 @@ class Activator
128
  return;
129
  }
130
  /**
131
- * Filters a getting API key flag
132
  *
133
- * @param bool Set true if you want to get key automatically after activation the plugin
134
  */
135
  $is_get_api_key = apply_filters('apbct_is_get_api_key', false);
136
  if ( $is_get_api_key ) {
114
  }
115
 
116
  /**
117
+ * Checking if a third party hook need to get Access key automatically
118
  *
119
  * @return void
120
  */
128
  return;
129
  }
130
  /**
131
+ * Filters a getting Access key flag
132
  *
133
+ * @param bool Set true if you want to get the Access key automatically after activation the plugin
134
  */
135
  $is_get_api_key = apply_filters('apbct_is_get_api_key', false);
136
  if ( $is_get_api_key ) {
lib/Cleantalk/ApbctWP/AdminNotices.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace Cleantalk\ApbctWP;
4
 
 
 
 
5
  class AdminNotices
6
  {
7
  /*
@@ -51,8 +54,8 @@ class AdminNotices
51
  {
52
  global $apbct;
53
  $this->apbct = $apbct;
54
- $this->is_cleantalk_page = isset($_GET['page']) &&
55
- in_array($_GET['page'], array('cleantalk', 'ct_check_spam', 'ct_check_users'));
56
  $this->user_token = $this->apbct->user_token ? '&user_token=' . $this->apbct->user_token : '';
57
 
58
  $self_owned_key = $this->apbct->moderate_ip == 0 && ! defined('CLEANTALK_ACCESS_KEY');
@@ -189,7 +192,7 @@ class AdminNotices
189
  $link_html = sprintf($renew_link, "<b>" . __('next year', 'cleantalk-spam-protect') . "</b>");
190
 
191
  $content = sprintf(
192
- __("Please renew your anti-spam license for %s.", 'cleantalk-spam-protect'),
193
  $link_html
194
  );
195
  $additional_content =
@@ -267,11 +270,11 @@ class AdminNotices
267
  {
268
  check_ajax_referer('ct_secret_nonce');
269
 
270
- if ( ! isset($_POST['notice_id']) ) {
271
  wp_send_json_error(esc_html__('Wrong request.', 'cleantalk-spam-protect'));
272
  }
273
 
274
- $notice = sanitize_text_field($_POST['notice_id']);
275
  $uid = get_current_user_id();
276
  $notice_uid = $notice . '_' . $uid;
277
  $current_date = current_time('Y-m-d');
2
 
3
  namespace Cleantalk\ApbctWP;
4
 
5
+ use Cleantalk\Variables\Get;
6
+ use Cleantalk\Variables\Post;
7
+
8
  class AdminNotices
9
  {
10
  /*
54
  {
55
  global $apbct;
56
  $this->apbct = $apbct;
57
+ $this->is_cleantalk_page = Get::get('page') &&
58
+ in_array((array)Get::get('page'), array('cleantalk', 'ct_check_spam', 'ct_check_users'));
59
  $this->user_token = $this->apbct->user_token ? '&user_token=' . $this->apbct->user_token : '';
60
 
61
  $self_owned_key = $this->apbct->moderate_ip == 0 && ! defined('CLEANTALK_ACCESS_KEY');
192
  $link_html = sprintf($renew_link, "<b>" . __('next year', 'cleantalk-spam-protect') . "</b>");
193
 
194
  $content = sprintf(
195
+ __("Please renew your Anti-Spam license for %s.", 'cleantalk-spam-protect'),
196
  $link_html
197
  );
198
  $additional_content =
270
  {
271
  check_ajax_referer('ct_secret_nonce');
272
 
273
+ if ( ! Post::get('notice_id') ) {
274
  wp_send_json_error(esc_html__('Wrong request.', 'cleantalk-spam-protect'));
275
  }
276
 
277
+ $notice = sanitize_text_field(Post::get('notice_id'));
278
  $uid = get_current_user_id();
279
  $notice_uid = $notice . '_' . $uid;
280
  $current_date = current_time('Y-m-d');
lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace Cleantalk\ApbctWP;
4
 
 
 
5
  class CleantalkSettingsTemplates
6
  {
7
  private $api_key;
@@ -48,8 +50,8 @@ class CleantalkSettingsTemplates
48
  {
49
  check_ajax_referer('ct_secret_nonce', 'security');
50
  $error_text = 'Export handler error.';
51
- if ( isset($_POST['data']) && is_array($_POST['data']) ) {
52
- $template_info = $_POST['data'];
53
  if ( isset($template_info['template_id']) ) {
54
  $template_id = sanitize_text_field($template_info['template_id']);
55
  $res = \Cleantalk\Common\API::methodServicesTemplatesUpdate(
@@ -91,8 +93,8 @@ class CleantalkSettingsTemplates
91
  public function settingsTemplatesImportAjax()
92
  {
93
  check_ajax_referer('ct_secret_nonce', 'security');
94
- if ( isset($_POST['data']) && is_array($_POST['data']) ) {
95
- $template_info = $_POST['data'];
96
  if ( isset($template_info['template_id'], $template_info['template_name'], $template_info['settings']) ) {
97
  $res = $this->setPluginOptions(
98
  (int)$template_info['template_id'],
2
 
3
  namespace Cleantalk\ApbctWP;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class CleantalkSettingsTemplates
8
  {
9
  private $api_key;
50
  {
51
  check_ajax_referer('ct_secret_nonce', 'security');
52
  $error_text = 'Export handler error.';
53
+ if ( is_array(Post::get('data')) ) {
54
+ $template_info = Post::get('data');
55
  if ( isset($template_info['template_id']) ) {
56
  $template_id = sanitize_text_field($template_info['template_id']);
57
  $res = \Cleantalk\Common\API::methodServicesTemplatesUpdate(
93
  public function settingsTemplatesImportAjax()
94
  {
95
  check_ajax_referer('ct_secret_nonce', 'security');
96
+ if ( is_array(Post::get('data')) ) {
97
+ $template_info = Post::get('data');
98
  if ( isset($template_info['template_id'], $template_info['template_name'], $template_info['settings']) ) {
99
  $res = $this->setPluginOptions(
100
  (int)$template_info['template_id'],
lib/Cleantalk/ApbctWP/CleantalkUpgrader.php CHANGED
@@ -3,7 +3,7 @@
3
  namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
- * Antispam by CleanTalk plugin
7
  *
8
  * Class that extends the WP Core Plugin_Upgrader.
9
  *
3
  namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
+ * Anti-Spam by CleanTalk plugin
7
  *
8
  * Class that extends the WP Core Plugin_Upgrader.
9
  *
lib/Cleantalk/ApbctWP/DB.php CHANGED
@@ -3,8 +3,8 @@
3
  namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
- * CleanTalk Wordpress Data Base driver
7
- * Compatible only with Wordpress.
8
  * Uses singleton pattern.
9
  *
10
  * @depends \Cleantalk\Common\DB
3
  namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
+ * CleanTalk WordPress Data Base driver
7
+ * Compatible only with WordPress.
8
  * Uses singleton pattern.
9
  *
10
  * @depends \Cleantalk\Common\DB
lib/Cleantalk/ApbctWP/Escape.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ class Escape extends \Cleantalk\Common\Escape
6
+ {
7
+ /**
8
+ * Simple method: escape attribute
9
+ *
10
+ * @param $text
11
+ *
12
+ * @return string|void
13
+ */
14
+ public static function escAttr($text)
15
+ {
16
+ return esc_attr($text);
17
+ }
18
+
19
+ /**
20
+ * Simple method: escape html
21
+ *
22
+ * @param $text
23
+ *
24
+ * @return string
25
+ */
26
+ public static function escHtml($text)
27
+ {
28
+ return esc_html($text);
29
+ }
30
+
31
+ /**
32
+ * Simple method: escape js
33
+ *
34
+ * @param $text
35
+ *
36
+ * @return string
37
+ */
38
+ public static function escJs($text)
39
+ {
40
+ return esc_js($text);
41
+ }
42
+
43
+ /**
44
+ * Simple method: escape textarea
45
+ *
46
+ * @param $text
47
+ *
48
+ * @return string
49
+ */
50
+ public static function escTextarea($text)
51
+ {
52
+ return esc_textarea($text);
53
+ }
54
+
55
+ /**
56
+ * Simple method: escape url
57
+ *
58
+ * @param $text
59
+ *
60
+ * @return string|null
61
+ */
62
+ public static function escUrl($text)
63
+ {
64
+ return esc_url($text);
65
+ }
66
+
67
+ /**
68
+ * Simple method: escape url raw
69
+ *
70
+ * @param $text
71
+ *
72
+ * @return string|null
73
+ */
74
+ public static function escUrlRaw($text)
75
+ {
76
+ return esc_url_raw($text);
77
+ }
78
+
79
+ /**
80
+ * Simple method: escape kses
81
+ *
82
+ * @param $string
83
+ * @param $allowed_html
84
+ * @param array $allowed_protocols
85
+ *
86
+ * @return string
87
+ */
88
+ public static function escKses($string, $allowed_html, $allowed_protocols = array())
89
+ {
90
+ return wp_kses($string, $allowed_html, $allowed_protocols = array());
91
+ }
92
+
93
+ /**
94
+ * Simple method: escape kses post
95
+ *
96
+ * @param $data
97
+ *
98
+ * @return string
99
+ */
100
+ public static function escKsesPost($data)
101
+ {
102
+ return wp_kses_post($data);
103
+ }
104
+ }
lib/Cleantalk/ApbctWP/FindSpam/Checker.php CHANGED
@@ -22,21 +22,10 @@ abstract class Checker
22
  $this->apbct = $apbct;
23
 
24
  // jQueryUI
25
- wp_enqueue_script(
26
- 'jqueryui',
27
- plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'),
28
- array('jquery'),
29
- '1.12.1'
30
- );
31
  wp_enqueue_style(
32
  'jqueryui_css',
33
- plugins_url('/cleantalk-spam-protect/css/jquery-ui.min.css'),
34
- array(),
35
- '1.21.1'
36
- );
37
- wp_enqueue_style(
38
- 'jqueryui_theme_css',
39
- plugins_url('/cleantalk-spam-protect/css/jquery-ui.theme.min.css'),
40
  array(),
41
  '1.21.1'
42
  );
@@ -44,8 +33,8 @@ abstract class Checker
44
  // Common CSS
45
  wp_enqueue_style(
46
  'cleantalk_admin_css_settings_page',
47
- plugins_url('/cleantalk-spam-protect/css/cleantalk-spam-check.min.css'),
48
- array('jqueryui_css'),
49
  APBCT_VERSION
50
  );
51
  }
22
  $this->apbct = $apbct;
23
 
24
  // jQueryUI
25
+ wp_enqueue_script('jquery-ui-datepicker');
 
 
 
 
 
26
  wp_enqueue_style(
27
  'jqueryui_css',
28
+ APBCT_CSS_ASSETS_PATH . '/jquery-ui.min.css',
 
 
 
 
 
 
29
  array(),
30
  '1.21.1'
31
  );
33
  // Common CSS
34
  wp_enqueue_style(
35
  'cleantalk_admin_css_settings_page',
36
+ APBCT_CSS_ASSETS_PATH . '/cleantalk-spam-check.min.css',
37
+ array(),
38
  APBCT_VERSION
39
  );
40
  }
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -3,6 +3,8 @@
3
  namespace Cleantalk\ApbctWP\FindSpam;
4
 
5
  use Cleantalk\ApbctWP\API;
 
 
6
 
7
  class CommentsChecker extends Checker
8
  {
@@ -15,8 +17,8 @@ class CommentsChecker extends Checker
15
  $this->page_slug = 'spam';
16
 
17
  // Preparing data
18
- if ( ! empty($_COOKIE['ct_paused_comments_check']) ) {
19
- $prev_check = json_decode(stripslashes($_COOKIE['ct_paused_comments_check']), true);
20
  $prev_check_from = $prev_check_till = '';
21
  if (
22
  ! empty($prev_check['from']) && ! empty($prev_check['till']) &&
@@ -30,8 +32,8 @@ class CommentsChecker extends Checker
30
 
31
  wp_enqueue_script(
32
  'ct_comments_checkspam',
33
- plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-checkspam.min.js'),
34
- array('jquery', 'jqueryui'),
35
  APBCT_VERSION
36
  );
37
  wp_localize_script('ct_comments_checkspam', 'ctCommentsCheck', array(
@@ -54,7 +56,7 @@ class CommentsChecker extends Checker
54
  'Please do backup of WordPress database before delete any accounts!',
55
  'cleantalk-spam-protect'
56
  ) . '</p>',
57
- 'start' => ! empty($_COOKIE['ct_comments_start_check']),
58
  ));
59
  }
60
 
@@ -131,20 +133,20 @@ class CommentsChecker extends Checker
131
 
132
  $sql_where = "WHERE NOT comment_approved = 'spam'";
133
  $sql_where .= " AND comment_type = 'comment'";
134
- if ( isset($_POST['from'], $_POST['till']) ) {
135
- $from_date = date('Y-m-d', intval(strtotime($_POST['from'])));
136
- $till_date = date('Y-m-d', intval(strtotime($_POST['till'])));
137
 
138
- $sql_where = " AND comment_date_gmt > '$from_date 00:00:00' AND comment_date_gmt < '$till_date 23:59:59'";
139
  }
140
 
141
- $offset = $_COOKIE['apbct_check_comments_offset'] ?: 0;
142
 
143
  $query = "SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
144
  FROM $wpdb->comments
145
  $sql_where
146
  ORDER BY comment_ID
147
- LIMIT 100 OFFSET " . (int) $offset;
148
 
149
  $c = $wpdb->get_results($query);
150
 
@@ -165,7 +167,7 @@ class CommentsChecker extends Checker
165
  }
166
  }
167
 
168
- if ( ! empty($_POST['accurate_check']) ) {
169
  // Leaving comments only with first comment's date. Unsetting others.
170
 
171
  foreach ( $c as $comment_index => $comment ) {
@@ -214,7 +216,7 @@ class CommentsChecker extends Checker
214
 
215
  // Drop if data empty and there's no comments to check
216
  if ( count($data) === 0 ) {
217
- if ( $_POST['unchecked'] === 0 ) {
218
  $check_result['end'] = 1;
219
  }
220
  print json_encode($check_result);
@@ -224,7 +226,7 @@ class CommentsChecker extends Checker
224
  $result = API::methodSpamCheckCms(
225
  $apbct->api_key,
226
  $data,
227
- ! empty($_POST['accurate_check']) ? $curr_date : null
228
  );
229
 
230
  if ( empty($result['error']) ) {
3
  namespace Cleantalk\ApbctWP\FindSpam;
4
 
5
  use Cleantalk\ApbctWP\API;
6
+ use Cleantalk\ApbctWP\Variables\Cookie;
7
+ use Cleantalk\Variables\Post;
8
 
9
  class CommentsChecker extends Checker
10
  {
17
  $this->page_slug = 'spam';
18
 
19
  // Preparing data
20
+ if ( Cookie::get('ct_paused_comments_check') ) {
21
+ $prev_check = json_decode(stripslashes(Cookie::get('ct_paused_comments_check')), true);
22
  $prev_check_from = $prev_check_till = '';
23
  if (
24
  ! empty($prev_check['from']) && ! empty($prev_check['till']) &&
32
 
33
  wp_enqueue_script(
34
  'ct_comments_checkspam',
35
+ APBCT_JS_ASSETS_PATH . '/cleantalk-comments-checkspam.min.js',
36
+ array('jquery', 'jquery-ui-datepicker'),
37
  APBCT_VERSION
38
  );
39
  wp_localize_script('ct_comments_checkspam', 'ctCommentsCheck', array(
56
  'Please do backup of WordPress database before delete any accounts!',
57
  'cleantalk-spam-protect'
58
  ) . '</p>',
59
+ 'start' => ! empty(Cookie::get('ct_comments_start_check')),
60
  ));
61
  }
62
 
133
 
134
  $sql_where = "WHERE NOT comment_approved = 'spam'";
135
  $sql_where .= " AND comment_type = 'comment'";
136
+ if ( Post::get('from') && Post::get('till') ) {
137
+ $from_date = date('Y-m-d', intval(strtotime(Post::get('from'))));
138
+ $till_date = date('Y-m-d', intval(strtotime(Post::get('till'))));
139
 
140
+ $sql_where .= " AND comment_date_gmt > '$from_date 00:00:00' AND comment_date_gmt < '$till_date 23:59:59'";
141
  }
142
 
143
+ $offset = Cookie::get('apbct_check_comments_offset') ? (int) Cookie::get('apbct_check_comments_offset') : 0;
144
 
145
  $query = "SELECT comment_ID, comment_date_gmt, comment_author_IP, comment_author_email
146
  FROM $wpdb->comments
147
  $sql_where
148
  ORDER BY comment_ID
149
+ LIMIT 100 OFFSET " . $offset;
150
 
151
  $c = $wpdb->get_results($query);
152
 
167
  }
168
  }
169
 
170
+ if ( ! empty(Post::get('accurate_check')) ) {
171
  // Leaving comments only with first comment's date. Unsetting others.
172
 
173
  foreach ( $c as $comment_index => $comment ) {
216
 
217
  // Drop if data empty and there's no comments to check
218
  if ( count($data) === 0 ) {
219
+ if ( (int) Post::get('unchecked') === 0 ) {
220
  $check_result['end'] = 1;
221
  }
222
  print json_encode($check_result);
226
  $result = API::methodSpamCheckCms(
227
  $apbct->api_key,
228
  $data,
229
+ ! empty(Post::get('accurate_check')) ? $curr_date : null
230
  );
231
 
232
  if ( empty($result['error']) ) {
lib/Cleantalk/ApbctWP/FindSpam/ListTable/Comments.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
 
 
 
5
  class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
6
  {
7
  protected $apbct;
@@ -128,17 +131,17 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
128
  $actions = array(
129
  'approve' => sprintf(
130
  '<span class="approve"><a href="?page=%s&action=%s&spam=%s">Approve</a></span>',
131
- htmlspecialchars(addslashes($_GET['page'])),
132
  'approve',
133
  $id
134
  ),
135
  'spam' => sprintf(
136
  '<span class="spam"><a href="?page=%s&action=%s&spam=%s">Spam</a></span>',
137
- htmlspecialchars(addslashes($_GET['page'])),
138
  'spam',
139
  $id
140
  ),
141
- 'trash' => sprintf('<a href="?page=%s&action=%s&spam=%s">Trash</a>', htmlspecialchars(addslashes($_GET['page'])), 'trash', $id),
142
  );
143
 
144
  return sprintf('%1$s %2$s', $column_content, $this->row_actions($actions));
@@ -209,7 +212,7 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
209
 
210
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
211
  {
212
- if ( empty($_POST['spamids']) || empty($_POST['_wpnonce']) ) {
213
  return;
214
  }
215
 
@@ -217,36 +220,36 @@ class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
217
  return;
218
  }
219
 
220
- if ( ! wp_verify_nonce($_POST['_wpnonce'], 'bulk-' . $this->_args['plural']) ) {
221
  wp_die('nonce error');
222
  }
223
 
224
  if ( 'trash' === $action ) {
225
- $this->moveToTrash($_POST['spamids']);
226
  }
227
 
228
  if ( 'spam' === $action ) {
229
- $this->moveToSpam($_POST['spamids']);
230
  }
231
  }
232
 
233
  public function row_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
234
  {
235
- if ( empty($_GET['action']) ) {
236
  return;
237
  }
238
 
239
- if ( $_GET['action'] === 'approve' ) {
240
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
241
  $this->approveSpam($id);
242
  }
243
 
244
- if ( $_GET['action'] === 'trash' ) {
245
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
246
  $this->moveToTrash(array($id));
247
  }
248
 
249
- if ( $_GET['action'] === 'spam' ) {
250
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
251
  $this->moveToSpam(array($id));
252
  }
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
5
+ use Cleantalk\Variables\Get;
6
+ use Cleantalk\Variables\Post;
7
+
8
  class Comments extends \Cleantalk\ApbctWP\CleantalkListTable
9
  {
10
  protected $apbct;
131
  $actions = array(
132
  'approve' => sprintf(
133
  '<span class="approve"><a href="?page=%s&action=%s&spam=%s">Approve</a></span>',
134
+ htmlspecialchars(addslashes(Get::get('page'))),
135
  'approve',
136
  $id
137
  ),
138
  'spam' => sprintf(
139
  '<span class="spam"><a href="?page=%s&action=%s&spam=%s">Spam</a></span>',
140
+ htmlspecialchars(addslashes(Get::get('page'))),
141
  'spam',
142
  $id
143
  ),
144
+ 'trash' => sprintf('<a href="?page=%s&action=%s&spam=%s">Trash</a>', htmlspecialchars(addslashes(Get::get('page'))), 'trash', $id),
145
  );
146
 
147
  return sprintf('%1$s %2$s', $column_content, $this->row_actions($actions));
212
 
213
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
214
  {
215
+ if ( empty(Post::get('spamids')) || empty(Post::get('_wpnonce')) ) {
216
  return;
217
  }
218
 
220
  return;
221
  }
222
 
223
+ if ( ! wp_verify_nonce(Post::get('_wpnonce'), 'bulk-' . $this->_args['plural']) ) {
224
  wp_die('nonce error');
225
  }
226
 
227
  if ( 'trash' === $action ) {
228
+ $this->moveToTrash(Post::get('spamids'));
229
  }
230
 
231
  if ( 'spam' === $action ) {
232
+ $this->moveToSpam(Post::get('spamids'));
233
  }
234
  }
235
 
236
  public function row_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
237
  {
238
+ if ( empty(Get::get('action')) ) {
239
  return;
240
  }
241
 
242
+ if ( Get::get('action') === 'approve' ) {
243
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
244
  $this->approveSpam($id);
245
  }
246
 
247
+ if ( Get::get('action') === 'trash' ) {
248
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
249
  $this->moveToTrash(array($id));
250
  }
251
 
252
+ if ( Get::get('action') === 'spam' ) {
253
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
254
  $this->moveToSpam(array($id));
255
  }
lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsLogs.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
 
 
5
  class CommentsLogs extends Comments
6
  {
7
  // Set columns
@@ -43,7 +45,7 @@ class CommentsLogs extends Comments
43
 
44
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
45
  {
46
- if ( empty($_POST['spamids']) || empty($_POST['_wpnonce']) ) {
47
  return;
48
  }
49
 
@@ -51,11 +53,11 @@ class CommentsLogs extends Comments
51
  return;
52
  }
53
 
54
- if ( ! wp_verify_nonce($_POST['_wpnonce'], 'bulk-' . $this->_args['plural']) ) {
55
  wp_die('nonce error');
56
  }
57
 
58
- $this->removeLogs($_POST['spamids']);
59
  }
60
 
61
  public function no_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class CommentsLogs extends Comments
8
  {
9
  // Set columns
45
 
46
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
47
  {
48
+ if ( empty(Post::get('spamids')) || empty(Post::get('_wpnonce')) ) {
49
  return;
50
  }
51
 
53
  return;
54
  }
55
 
56
+ if ( ! wp_verify_nonce(Post::get('_wpnonce'), 'bulk-' . $this->_args['plural']) ) {
57
  wp_die('nonce error');
58
  }
59
 
60
+ $this->removeLogs(Post::get('spamids'));
61
  }
62
 
63
  public function no_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
 
 
 
5
  class Users extends \Cleantalk\ApbctWP\CleantalkListTable
6
  {
7
  protected $apbct;
@@ -113,7 +116,7 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
113
  $actions = array(
114
  'delete' => sprintf(
115
  '<a href="?page=%s&action=%s&spam=%s">Delete</a>',
116
- htmlspecialchars(addslashes($_GET['page'])),
117
  'delete',
118
  $user_obj->ID
119
  ),
@@ -159,7 +162,7 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
159
 
160
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
161
  {
162
- if ( empty($_POST['spamids']) || empty($_POST['_wpnonce']) ) {
163
  return;
164
  }
165
 
@@ -167,20 +170,20 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
167
  return;
168
  }
169
 
170
- if ( ! wp_verify_nonce($_POST['_wpnonce'], 'bulk-' . $this->_args['plural']) ) {
171
  wp_die('nonce error');
172
  }
173
 
174
- $this->removeSpam($_POST['spamids']);
175
  }
176
 
177
  public function row_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
178
  {
179
- if ( empty($_GET['action']) ) {
180
  return;
181
  }
182
 
183
- if ( $_GET['action'] === 'delete' ) {
184
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
185
  $this->removeSpam(array($id));
186
  }
@@ -212,33 +215,21 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
212
  }
213
 
214
  /**
215
- * @return \WP_User_Query
216
  * @psalm-suppress PossiblyUnusedMethod
217
  */
218
  public function getTotal()
219
  {
220
- $params_total = array(
221
- 'fields' => 'ID',
222
- 'count' => true,
223
- 'orderby' => 'user_registered'
224
- );
225
-
226
- return new \WP_User_Query($params_total);
227
  }
228
 
229
  /**
230
- * @return \WP_User_Query
231
  * @psalm-suppress PossiblyUnusedMethod
232
  */
233
  public function getChecked()
234
  {
235
- $params_spam = array(
236
- 'fields' => 'ID',
237
- 'meta_key' => 'ct_checked',
238
- 'count_total' => true,
239
- );
240
-
241
- return new \WP_User_Query($params_spam);
242
  }
243
 
244
  /**
@@ -271,21 +262,13 @@ class Users extends \Cleantalk\ApbctWP\CleantalkListTable
271
  return new \WP_User_Query($params_spam);
272
  }
273
 
274
- public function getSpamNow()
275
  {
276
  $params_spam = array(
 
 
277
  'fields' => 'ID',
278
- 'meta_query' => array(
279
- 'relation' => 'AND',
280
- array(
281
- 'key' => 'ct_marked_as_spam',
282
- 'compare' => 'EXISTS'
283
- ),
284
- array(
285
- 'key' => 'ct_checked_now',
286
- 'compare' => 'EXISTS'
287
- ),
288
- ),
289
  'count_total' => true,
290
  );
291
 
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
5
+ use Cleantalk\Variables\Get;
6
+ use Cleantalk\Variables\Post;
7
+
8
  class Users extends \Cleantalk\ApbctWP\CleantalkListTable
9
  {
10
  protected $apbct;
116
  $actions = array(
117
  'delete' => sprintf(
118
  '<a href="?page=%s&action=%s&spam=%s">Delete</a>',
119
+ htmlspecialchars(addslashes(Get::get('page'))),
120
  'delete',
121
  $user_obj->ID
122
  ),
162
 
163
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
164
  {
165
+ if ( empty(Post::get('spamids')) || empty(Post::get('_wpnonce')) ) {
166
  return;
167
  }
168
 
170
  return;
171
  }
172
 
173
+ if ( ! wp_verify_nonce(Post::get('_wpnonce'), 'bulk-' . $this->_args['plural']) ) {
174
  wp_die('nonce error');
175
  }
176
 
177
+ $this->removeSpam(Post::get('spamids'));
178
  }
179
 
180
  public function row_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
181
  {
182
+ if ( empty(Get::get('action')) ) {
183
  return;
184
  }
185
 
186
+ if ( Get::get('action') === 'delete' ) {
187
  $id = filter_input(INPUT_GET, 'spam', FILTER_SANITIZE_NUMBER_INT);
188
  $this->removeSpam(array($id));
189
  }
215
  }
216
 
217
  /**
218
+ * @return integer
219
  * @psalm-suppress PossiblyUnusedMethod
220
  */
221
  public function getTotal()
222
  {
223
+ return count_users()['total_users'];
 
 
 
 
 
 
224
  }
225
 
226
  /**
227
+ * @return integer
228
  * @psalm-suppress PossiblyUnusedMethod
229
  */
230
  public function getChecked()
231
  {
232
+ return $this->apbct->data['count_checked_users'];
 
 
 
 
 
 
233
  }
234
 
235
  /**
262
  return new \WP_User_Query($params_spam);
263
  }
264
 
265
+ public function getSpamNow($per_page, $current_page)
266
  {
267
  $params_spam = array(
268
+ 'number' => $per_page,
269
+ 'offset' => ( $current_page - 1 ) * $per_page,
270
  'fields' => 'ID',
271
+ 'meta_key' => 'ct_marked_as_spam',
 
 
 
 
 
 
 
 
 
 
272
  'count_total' => true,
273
  );
274
 
lib/Cleantalk/ApbctWP/FindSpam/ListTable/UsersLogs.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
 
 
5
  class UsersLogs extends Users
6
  {
7
  // Set columns
@@ -43,7 +45,7 @@ class UsersLogs extends Users
43
 
44
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
45
  {
46
- if ( empty($_POST['spamids']) || empty($_POST['_wpnonce']) ) {
47
  return;
48
  }
49
 
@@ -51,11 +53,11 @@ class UsersLogs extends Users
51
  return;
52
  }
53
 
54
- if ( ! wp_verify_nonce($_POST['_wpnonce'], 'bulk-' . $this->_args['plural']) ) {
55
  wp_die('nonce error');
56
  }
57
 
58
- $this->removeLogs($_POST['spamids']);
59
  }
60
 
61
  public function no_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam\ListTable;
4
 
5
+ use Cleantalk\Variables\Post;
6
+
7
  class UsersLogs extends Users
8
  {
9
  // Set columns
45
 
46
  public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
47
  {
48
+ if ( empty(Post::get('spamids')) || empty(Post::get('_wpnonce')) ) {
49
  return;
50
  }
51
 
53
  return;
54
  }
55
 
56
+ if ( ! wp_verify_nonce(Post::get('_wpnonce'), 'bulk-' . $this->_args['plural']) ) {
57
  wp_die('nonce error');
58
  }
59
 
60
+ $this->removeLogs(Post::get('spamids'));
61
  }
62
 
63
  public function no_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
lib/Cleantalk/ApbctWP/FindSpam/ListTable/UsersScan.php CHANGED
@@ -17,22 +17,16 @@ class UsersScan extends Users
17
  $per_page = 10;
18
  }
19
 
20
- $scanned_users = $this->getSpamNow();
 
 
21
 
22
  $this->set_pagination_args(array(
23
  'total_items' => $scanned_users->get_total(),
24
  'per_page' => $per_page,
25
  ));
26
 
27
- $current_page = $this->get_pagenum();
28
-
29
- $scanned_users_to_show = array_slice(
30
- $scanned_users->get_results(),
31
- (($current_page - 1) * $per_page),
32
- $per_page
33
- );
34
-
35
- foreach ( $scanned_users_to_show as $user_id ) {
36
  $user_obj = get_userdata($user_id);
37
 
38
  $items = array(
17
  $per_page = 10;
18
  }
19
 
20
+ $current_page = $this->get_pagenum();
21
+
22
+ $scanned_users = $this->getSpamNow($per_page, $current_page);
23
 
24
  $this->set_pagination_args(array(
25
  'total_items' => $scanned_users->get_total(),
26
  'per_page' => $per_page,
27
  ));
28
 
29
+ foreach ( $scanned_users->get_results() as $user_id ) {
 
 
 
 
 
 
 
 
30
  $user_obj = get_userdata($user_id);
31
 
32
  $items = array(
lib/Cleantalk/ApbctWP/FindSpam/Page.php CHANGED
@@ -78,7 +78,7 @@ class Page
78
  if ( 1 == $this->spam_checker->getApbct()->moderate_ip ) {
79
  echo '<h3>'
80
  . sprintf(
81
- __('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk-spam-protect'),
82
  '<a href="' . ( is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk' ) . '">',
83
  '</a>'
84
  )
78
  if ( 1 == $this->spam_checker->getApbct()->moderate_ip ) {
79
  echo '<h3>'
80
  . sprintf(
81
+ __('Anti-Spam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk-spam-protect'),
82
  '<a href="' . ( is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk' ) . '">',
83
  '</a>'
84
  )
lib/Cleantalk/ApbctWP/FindSpam/UsersChecker.php CHANGED
@@ -2,6 +2,9 @@
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam;
4
 
 
 
 
5
  class UsersChecker extends Checker
6
  {
7
  public function __construct()
@@ -14,8 +17,8 @@ class UsersChecker extends Checker
14
 
15
  // Preparing data
16
  $current_user = wp_get_current_user();
17
- if ( ! empty($_COOKIE['ct_paused_users_check']) ) {
18
- $prev_check = json_decode(stripslashes($_COOKIE['ct_paused_users_check']), true);
19
  $prev_check_from = $prev_check_till = '';
20
  if (
21
  ! empty($prev_check['from']) && ! empty($prev_check['till']) &&
@@ -29,8 +32,8 @@ class UsersChecker extends Checker
29
 
30
  wp_enqueue_script(
31
  'ct_users_checkspam',
32
- plugins_url('/cleantalk-spam-protect/js/cleantalk-users-checkspam.min.js'),
33
- array('jquery', 'jqueryui'),
34
  APBCT_VERSION
35
  );
36
  wp_localize_script('ct_users_checkspam', 'ctUsersCheck', array(
@@ -64,7 +67,7 @@ class UsersChecker extends Checker
64
 
65
  wp_enqueue_style(
66
  'cleantalk_admin_css_settings_page',
67
- plugins_url() . '/cleantalk-spam-protect/css/cleantalk-spam-check.min.css',
68
  array(),
69
  APBCT_VERSION,
70
  'all'
@@ -140,47 +143,25 @@ class UsersChecker extends Checker
140
  */
141
  public static function lastCheckDate()
142
  {
143
- // Checked users
144
- $params = array(
145
- 'fields' => 'ID',
146
- 'meta_key' => 'ct_checked',
147
- 'count_total' => true,
148
- 'orderby' => 'ct_checked'
149
- );
150
- $tmp = new \WP_User_Query($params);
151
- $cnt_checked = $tmp->get_total();
152
 
153
- if ( $cnt_checked > 0 ) {
154
- // If we have checked users return last checking date
155
- $users = $tmp->get_results();
 
 
 
 
 
 
156
 
157
- return date("M j Y", strtotime(get_user_meta(end($users), 'ct_checked', true)));
158
- } else {
159
- // If we have not any checked users return first user registered date
160
- $params = array(
161
- 'fields' => 'ID',
162
- 'number' => 1,
163
- 'orderby' => 'user_registered'
164
- );
165
- $tmp = new \WP_User_Query($params);
166
 
167
- return self::getUserRegister(current($tmp->get_results()));
 
168
  }
169
- }
170
 
171
- /**
172
- * Get date user registered
173
- *
174
- * @param $user_id
175
- *
176
- * @return string Date format"M j Y"
177
- */
178
- private static function getUserRegister($user_id)
179
- {
180
- $user_data = get_userdata($user_id);
181
- $registered = $user_data->user_registered;
182
-
183
- return date("M j Y", strtotime($registered));
184
  }
185
 
186
  public static function ctAjaxCheckUsers()
@@ -194,8 +175,8 @@ class UsersChecker extends Checker
194
  $wc_active = true;
195
  }
196
 
197
- $amount = ! empty($_POST['amount']) && intval($_POST['amount'])
198
- ? (int)$_POST['amount']
199
  : 100;
200
 
201
  $skip_roles = array(
@@ -204,31 +185,37 @@ class UsersChecker extends Checker
204
 
205
  $from_till = '';
206
 
207
- if ( isset($_POST['from'], $_POST['till']) ) {
208
- $from_date = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
209
- $till_date = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
210
 
211
- $from_till = " AND $wpdb->users.user_registered >= '$from_date' AND $wpdb->users.user_registered <= '$till_date'";
212
  }
213
 
214
  $wc_orders = '';
215
 
216
  if ( $wc_active && ! empty($_POST['accurate_check']) ) {
217
- $wc_orders = " AND NOT EXISTS (SELECT posts.* FROM {$wpdb->posts} AS posts INNER JOIN {$wpdb->postmeta} AS postmeta WHERE posts.post_type = 'shop_order' AND posts.post_status = 'wc-completed' AND posts.ID = postmeta.post_id AND postmeta.meta_key = '_customer_user' AND postmeta.meta_value = {$wpdb->users}.ID)";
 
 
 
 
 
 
 
 
218
  }
219
 
 
 
220
  $u = $wpdb->get_results(
221
  "
222
  SELECT {$wpdb->users}.ID, {$wpdb->users}.user_email, {$wpdb->users}.user_registered
223
  FROM {$wpdb->users}
224
- WHERE
225
- NOT EXISTS(SELECT * FROM {$wpdb->usermeta} as meta WHERE {$wpdb->users}.ID = meta.user_id AND meta.meta_key = 'ct_bad') AND
226
- NOT EXISTS(SELECT * FROM {$wpdb->usermeta} as meta WHERE {$wpdb->users}.ID = meta.user_id AND meta.meta_key = 'ct_checked') AND
227
- NOT EXISTS(SELECT * FROM {$wpdb->usermeta} as meta WHERE {$wpdb->users}.ID = meta.user_id AND meta.meta_key = 'ct_checked_now')
228
  $wc_orders
229
  $from_till
230
- ORDER BY {$wpdb->users}.user_registered ASC
231
- LIMIT $amount;"
232
  );
233
 
234
  $check_result = array(
@@ -240,7 +227,7 @@ class UsersChecker extends Checker
240
  );
241
 
242
  if ( count($u) > 0 ) {
243
- if ( ! empty($_POST['accurate_check']) ) {
244
  // Leaving users only with first comment's date. Unsetting others.
245
  foreach ( $u as $user_index => $user ) {
246
  if ( ! isset($curr_date) ) {
@@ -272,8 +259,6 @@ class UsersChecker extends Checker
272
  if ( empty($curr_ip) && empty($curr_email) ) {
273
  $check_result['bad']++;
274
  update_user_meta($iValue->ID, 'ct_bad', '1', true);
275
- update_user_meta($iValue->ID, 'ct_checked', date("Y-m-d H:m:s"), true);
276
- update_user_meta($iValue->ID, 'ct_checked_now', '1', true);
277
  unset($u[$i]);
278
  } else {
279
  if ( ! empty($curr_ip) ) {
@@ -289,12 +274,16 @@ class UsersChecker extends Checker
289
  }
290
  }
291
 
 
 
 
 
292
  // Recombining after checking and unsetting
293
  $u = array_values($u);
294
 
295
  // Drop if data empty and there's no users to check
296
  if ( count($data) === 0 ) {
297
- if ( $_POST['unchecked'] === 0 ) {
298
  $check_result['end'] = 1;
299
  }
300
  print json_encode($check_result);
@@ -304,14 +293,12 @@ class UsersChecker extends Checker
304
  $result = \Cleantalk\ApbctWP\API::methodSpamCheckCms(
305
  $apbct->api_key,
306
  $data,
307
- ! empty($_POST['accurate_check']) ? $curr_date : null
308
  );
309
 
310
  if ( empty($result['error']) ) {
311
  foreach ( $u as $iValue ) {
312
  $check_result['checked']++;
313
- update_user_meta($iValue->ID, 'ct_checked', date("Y-m-d H:m:s"), true);
314
- update_user_meta($iValue->ID, 'ct_checked_now', date("Y-m-d H:m:s"), true);
315
 
316
  // Do not display forbidden roles.
317
  foreach ( $skip_roles as $role ) {
@@ -342,6 +329,10 @@ class UsersChecker extends Checker
342
  update_user_meta($iValue->ID, 'ct_marked_as_spam', '1', true);
343
  }
344
  }
 
 
 
 
345
  } else {
346
  $check_result['error'] = 1;
347
  $check_result['error_message'] = $result['error'];
@@ -372,34 +363,15 @@ class UsersChecker extends Checker
372
  {
373
  check_ajax_referer('ct_secret_nonce', 'security');
374
 
375
- global $wpdb;
376
- $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_checked_now')");
377
 
378
- if ( isset($_POST['from']) && isset($_POST['till']) ) {
379
- if (
380
- preg_match('/^[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}$/', $_POST['from']) &&
381
- preg_match('/^[a-zA-Z]{3}\s{1}\d{1,2}\s{1}\d{4}$/', $_POST['till'])
382
- ) {
383
- $from = date('Y-m-d', intval(strtotime($_POST['from']))) . ' 00:00:00';
384
- $till = date('Y-m-d', intval(strtotime($_POST['till']))) . ' 23:59:59';
385
-
386
- $wpdb->query(
387
- "DELETE FROM {$wpdb->usermeta} WHERE
388
- meta_key IN ('ct_checked','ct_marked_as_spam','ct_bad')
389
- AND meta_value >= '{$from}'
390
- AND meta_value <= '{$till}';"
391
- );
392
- die();
393
- } else {
394
- $wpdb->query(
395
- "DELETE FROM {$wpdb->usermeta} WHERE
396
- meta_key IN ('ct_checked','ct_marked_as_spam','ct_bad')"
397
- );
398
- die();
399
- }
400
- }
401
 
402
- die();
 
 
403
  }
404
 
405
  public static function ctAjaxInfo($direct_call = false)
@@ -408,39 +380,27 @@ class UsersChecker extends Checker
408
  check_ajax_referer('ct_secret_nonce', 'security');
409
  }
410
 
411
- global $wpdb;
412
 
413
  // Checked users
414
- $cnt_checked = $wpdb->get_results(
415
- "
416
- SELECT COUNT(*) AS cnt
417
- FROM {$wpdb->usermeta}
418
- WHERE meta_key='ct_checked_now'"
419
- )[0]->cnt;
420
 
421
- // Spam users
422
- $cnt_spam = $wpdb->get_results(
423
- "
424
- SELECT COUNT({$wpdb->users}.ID) AS cnt
425
- FROM {$wpdb->users}
426
- INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
427
- INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
428
- WHERE
429
- meta1.meta_key = 'ct_marked_as_spam' AND
430
- meta2.meta_key = 'ct_checked_now';"
431
- )[0]->cnt;
 
 
432
 
433
  // Bad users (without IP and Email)
434
- $cnt_bad = $wpdb->get_results(
435
- "
436
- SELECT COUNT({$wpdb->users}.ID) AS cnt
437
- FROM {$wpdb->users}
438
- INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
439
- INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
440
- WHERE
441
- meta1.meta_key = 'ct_bad' AND
442
- meta2.meta_key = 'ct_checked_now';"
443
- )[0]->cnt;
444
 
445
  $return = array(
446
  'message' => '',
@@ -503,39 +463,27 @@ class UsersChecker extends Checker
503
 
504
  private static function getLogData()
505
  {
506
- global $wpdb;
507
-
508
  // Checked users
509
- $cnt_checked = $wpdb->get_results(
510
- "
511
- SELECT COUNT(*) AS cnt
512
- FROM {$wpdb->usermeta}
513
- WHERE meta_key='ct_checked_now'"
514
- )[0]->cnt;
515
 
516
- // Spam users
517
- $cnt_spam = $wpdb->get_results(
518
- "
519
- SELECT COUNT({$wpdb->users}.ID) AS cnt
520
- FROM {$wpdb->users}
521
- INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
522
- INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
523
- WHERE
524
- meta1.meta_key = 'ct_marked_as_spam' AND
525
- meta2.meta_key = 'ct_checked_now';"
526
- )[0]->cnt;
 
 
 
 
527
 
528
  // Bad users (without IP and Email)
529
- $cnt_bad = $wpdb->get_results(
530
- "
531
- SELECT COUNT({$wpdb->users}.ID) AS cnt
532
- FROM {$wpdb->users}
533
- INNER JOIN {$wpdb->usermeta} AS meta1 ON ( {$wpdb->users}.ID = meta1.user_id )
534
- INNER JOIN {$wpdb->usermeta} AS meta2 ON ( {$wpdb->users}.ID = meta2.user_id )
535
- WHERE
536
- meta1.meta_key = 'ct_bad' AND
537
- meta2.meta_key = 'ct_checked_now';"
538
- )[0]->cnt;
539
 
540
  return array(
541
  'spam' => $cnt_spam,
@@ -559,9 +507,6 @@ class UsersChecker extends Checker
559
  'key' => 'ct_marked_as_spam',
560
  'compare' => '1'
561
  ),
562
- array(
563
- 'key' => 'ct_checked_now'
564
- ),
565
  ),
566
  'orderby' => 'registered',
567
  'order' => 'ASC',
@@ -580,7 +525,7 @@ class UsersChecker extends Checker
580
  $text .= PHP_EOL;
581
  }
582
 
583
- $filename = ! empty($_POST['filename']) ? $_POST['filename'] : false;
584
 
585
  if ( $filename !== false ) {
586
  header('Content-Type: text/csv');
@@ -598,7 +543,7 @@ class UsersChecker extends Checker
598
  global $wpdb;
599
 
600
  //* TEST DELETION
601
- if ( ! empty($_POST['delete']) ) {
602
  $users = get_users(array('search' => 'user_*', 'search_columns' => array('login', 'nicename')));
603
  $deleted = 0;
604
  $amount_to_delete = 1000;
2
 
3
  namespace Cleantalk\ApbctWP\FindSpam;
4
 
5
+ use Cleantalk\ApbctWP\Variables\Cookie;
6
+ use Cleantalk\Variables\Post;
7
+
8
  class UsersChecker extends Checker
9
  {
10
  public function __construct()
17
 
18
  // Preparing data
19
  $current_user = wp_get_current_user();
20
+ if ( ! empty(Cookie::get('ct_paused_users_check')) ) {
21
+ $prev_check = json_decode(stripslashes(Cookie::get('ct_paused_users_check')), true);
22
  $prev_check_from = $prev_check_till = '';
23
  if (
24
  ! empty($prev_check['from']) && ! empty($prev_check['till']) &&
32
 
33
  wp_enqueue_script(
34
  'ct_users_checkspam',
35
+ APBCT_JS_ASSETS_PATH . '/cleantalk-users-checkspam.min.js',
36
+ array('jquery', 'jquery-ui-datepicker'),
37
  APBCT_VERSION
38
  );
39
  wp_localize_script('ct_users_checkspam', 'ctUsersCheck', array(
67
 
68
  wp_enqueue_style(
69
  'cleantalk_admin_css_settings_page',
70
+ APBCT_JS_ASSETS_PATH . '/cleantalk-spam-check.min.css',
71
  array(),
72
  APBCT_VERSION,
73
  'all'
143
  */
144
  public static function lastCheckDate()
145
  {
146
+ global $wpdb;
 
 
 
 
 
 
 
 
147
 
148
+ /**
149
+ * We are trying to get the date of the last scan by actually
150
+ * requesting the start date. But unfortunately, the start date
151
+ * stores the end date. At least for the user scanner.
152
+ */
153
+ $sql = "SELECT `start_time`
154
+ FROM " . APBCT_SPAMSCAN_LOGS . "
155
+ WHERE `scan_type` = 'users'
156
+ ORDER BY start_time DESC LIMIT 1";
157
 
158
+ $lastCheckDate = $wpdb->get_col($sql);
 
 
 
 
 
 
 
 
159
 
160
+ if ($lastCheckDate) {
161
+ return date('M j Y', strtotime($lastCheckDate[0]));
162
  }
 
163
 
164
+ return date('M j Y');
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
166
 
167
  public static function ctAjaxCheckUsers()
175
  $wc_active = true;
176
  }
177
 
178
+ $amount = ! empty(Post::get('amount'))
179
+ ? (int) Post::get('amount')
180
  : 100;
181
 
182
  $skip_roles = array(
185
 
186
  $from_till = '';
187
 
188
+ if ( Post::get('from') && Post::get('till') ) {
189
+ $from_date = date('Y-m-d', intval(strtotime(Post::get('from')))) . ' 00:00:00';
190
+ $till_date = date('Y-m-d', intval(strtotime(Post::get('till')))) . ' 23:59:59';
191
 
192
+ $from_till = "WHERE $wpdb->users.user_registered >= '$from_date' AND $wpdb->users.user_registered <= '$till_date'";
193
  }
194
 
195
  $wc_orders = '';
196
 
197
  if ( $wc_active && ! empty($_POST['accurate_check']) ) {
198
+ $sql_command = $from_till ? ' AND' : 'WHERE';
199
+ $wc_orders = $sql_command
200
+ . " NOT EXISTS (SELECT posts.* FROM {$wpdb->posts} AS posts"
201
+ . " INNER JOIN {$wpdb->postmeta} AS postmeta"
202
+ . " WHERE posts.post_type = 'shop_order'"
203
+ . " AND posts.post_status = 'wc-completed'"
204
+ . " AND posts.ID = postmeta.post_id"
205
+ . " AND postmeta.meta_key = '_customer_user'"
206
+ . " AND postmeta.meta_value = {$wpdb->users}.ID)";
207
  }
208
 
209
+ $offset = (int)$_COOKIE['apbct_check_users_offset'] ?: 0;
210
+
211
  $u = $wpdb->get_results(
212
  "
213
  SELECT {$wpdb->users}.ID, {$wpdb->users}.user_email, {$wpdb->users}.user_registered
214
  FROM {$wpdb->users}
 
 
 
 
215
  $wc_orders
216
  $from_till
217
+ ORDER BY {$wpdb->users}.ID ASC
218
+ LIMIT $amount OFFSET $offset;"
219
  );
220
 
221
  $check_result = array(
227
  );
228
 
229
  if ( count($u) > 0 ) {
230
+ if ( ! empty(Post::get('accurate_check')) ) {
231
  // Leaving users only with first comment's date. Unsetting others.
232
  foreach ( $u as $user_index => $user ) {
233
  if ( ! isset($curr_date) ) {
259
  if ( empty($curr_ip) && empty($curr_email) ) {
260
  $check_result['bad']++;
261
  update_user_meta($iValue->ID, 'ct_bad', '1', true);
 
 
262
  unset($u[$i]);
263
  } else {
264
  if ( ! empty($curr_ip) ) {
274
  }
275
  }
276
 
277
+ // save count bad comments to State:data
278
+ $apbct->data['count_bad_users'] += $check_result['bad'];
279
+ $apbct->saveData();
280
+
281
  // Recombining after checking and unsetting
282
  $u = array_values($u);
283
 
284
  // Drop if data empty and there's no users to check
285
  if ( count($data) === 0 ) {
286
+ if ( (int) Post::get('unchecked') === 0 ) {
287
  $check_result['end'] = 1;
288
  }
289
  print json_encode($check_result);
293
  $result = \Cleantalk\ApbctWP\API::methodSpamCheckCms(
294
  $apbct->api_key,
295
  $data,
296
+ ! empty(Post::get('accurate_check')) ? $curr_date : null
297
  );
298
 
299
  if ( empty($result['error']) ) {
300
  foreach ( $u as $iValue ) {
301
  $check_result['checked']++;
 
 
302
 
303
  // Do not display forbidden roles.
304
  foreach ( $skip_roles as $role ) {
329
  update_user_meta($iValue->ID, 'ct_marked_as_spam', '1', true);
330
  }
331
  }
332
+
333
+ // save count checked comments to State:data
334
+ $apbct->data['count_checked_users'] = $offset + $check_result['checked'];
335
+ $apbct->saveData();
336
  } else {
337
  $check_result['error'] = 1;
338
  $check_result['error_message'] = $result['error'];
363
  {
364
  check_ajax_referer('ct_secret_nonce', 'security');
365
 
366
+ global $wpdb, $apbct;
 
367
 
368
+ $apbct->data['count_checked_users'] = 0;
369
+ $apbct->data['count_bad_users'] = 0;
370
+ $apbct->saveData();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
 
372
+ $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ('ct_marked_as_spam')");
373
+
374
+ die;
375
  }
376
 
377
  public static function ctAjaxInfo($direct_call = false)
380
  check_ajax_referer('ct_secret_nonce', 'security');
381
  }
382
 
383
+ global $wpdb, $apbct;
384
 
385
  // Checked users
386
+ $cnt_checked = $apbct->data['count_checked_users'];
 
 
 
 
 
387
 
388
+ // Spam comments
389
+ $params_spam = array(
390
+ 'count_total' => true,
391
+ 'meta_query' => array(
392
+ 'relation' => 'AND',
393
+ array(
394
+ 'key' => 'ct_marked_as_spam',
395
+ 'compare' => '=',
396
+ 'value' => 1
397
+ )
398
+ ),
399
+ );
400
+ $cnt_spam = count(get_users($params_spam));
401
 
402
  // Bad users (without IP and Email)
403
+ $cnt_bad = $apbct->data['count_bad_users'];
 
 
 
 
 
 
 
 
 
404
 
405
  $return = array(
406
  'message' => '',
463
 
464
  private static function getLogData()
465
  {
 
 
466
  // Checked users
467
+ global $apbct;
 
 
 
 
 
468
 
469
+ $cnt_checked = $apbct->data['count_checked_users'];
470
+
471
+ // Spam comments
472
+ $params_spam = array(
473
+ 'count' => true,
474
+ 'meta_query' => array(
475
+ 'relation' => 'AND',
476
+ array(
477
+ 'key' => 'ct_marked_as_spam',
478
+ 'compare' => '=',
479
+ 'value' => 1
480
+ )
481
+ ),
482
+ );
483
+ $cnt_spam = get_users($params_spam);
484
 
485
  // Bad users (without IP and Email)
486
+ $cnt_bad = $apbct->data['count_bad_users'];
 
 
 
 
 
 
 
 
 
487
 
488
  return array(
489
  'spam' => $cnt_spam,
507
  'key' => 'ct_marked_as_spam',
508
  'compare' => '1'
509
  ),
 
 
 
510
  ),
511
  'orderby' => 'registered',
512
  'order' => 'ASC',
525
  $text .= PHP_EOL;
526
  }
527
 
528
+ $filename = ! empty(Post::get('filename')) ? Post::get('filename') : false;
529
 
530
  if ( $filename !== false ) {
531
  header('Content-Type: text/csv');
543
  global $wpdb;
544
 
545
  //* TEST DELETION
546
+ if ( ! empty(Post::get('delete')) ) {
547
  $users = get_users(array('search' => 'user_*', 'search_columns' => array('login', 'nicename')));
548
  $deleted = 0;
549
  $amount_to_delete = 1000;
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php CHANGED
@@ -4,6 +4,7 @@ namespace Cleantalk\ApbctWP\Firewall;
4
 
5
  use Cleantalk\Common\Helper;
6
  use Cleantalk\ApbctWP\Variables\Cookie;
 
7
  use Cleantalk\Variables\Server;
8
 
9
  /**
@@ -454,7 +455,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
454
  3
455
  ) . '<br>'
456
  . __('Don\'t close this page. Please, wait for 3 seconds to pass to the page.', 'cleantalk-spam-protect'),
457
- '{CLEANTALK_TITLE}' => __('Antispam by CleanTalk', 'cleantalk-spam-protect'),
458
  '{REMOTE_ADDRESS}' => $result['ip'],
459
  '{SERVICE_ID}' => $this->apbct->data['service_id'] . ', ' . $net_count,
460
  '{HOST}' => get_home_url() . ', ' . APBCT_VERSION,
@@ -468,7 +469,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule
468
  $this->sfw_die_page = str_replace($place_holder, $replace, $this->sfw_die_page);
469
  }
470
 
471
- if ( isset($_GET['debug']) ) {
472
  $debug = '<h1>Headers</h1>'
473
  . str_replace("\n", "<br>", print_r(\apache_request_headers(), true))
474
  . '<h1>$_SERVER</h1>'
4
 
5
  use Cleantalk\Common\Helper;
6
  use Cleantalk\ApbctWP\Variables\Cookie;
7
+ use Cleantalk\Variables\Get;
8
  use Cleantalk\Variables\Server;
9
 
10
  /**
455
  3
456
  ) . '<br>'
457
  . __('Don\'t close this page. Please, wait for 3 seconds to pass to the page.', 'cleantalk-spam-protect'),
458
+ '{CLEANTALK_TITLE}' => __('Anti-Spam by CleanTalk', 'cleantalk-spam-protect'),
459
  '{REMOTE_ADDRESS}' => $result['ip'],
460
  '{SERVICE_ID}' => $this->apbct->data['service_id'] . ', ' . $net_count,
461
  '{HOST}' => get_home_url() . ', ' . APBCT_VERSION,
469
  $this->sfw_die_page = str_replace($place_holder, $replace, $this->sfw_die_page);
470
  }
471
 
472
+ if ( Get::get('debug') ) {
473
  $debug = '<h1>Headers</h1>'
474
  . str_replace("\n", "<br>", print_r(\apache_request_headers(), true))
475
  . '<h1>$_SERVER</h1>'
lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php CHANGED
@@ -231,7 +231,7 @@ class AntiFlood extends \Cleantalk\Common\Firewall\FirewallModule
231
  ),
232
  30
233
  ),
234
- '{CLEANTALK_TITLE}' => __('Antispam by CleanTalk', 'cleantalk-spam-protect'),
235
  '{REMOTE_ADDRESS}' => $result['ip'],
236
  '{REQUEST_URI}' => Server::get('REQUEST_URI'),
237
  '{SERVICE_ID}' => $this->apbct->data['service_id'] . ', ' . $net_count,
231
  ),
232
  30
233
  ),
234
+ '{CLEANTALK_TITLE}' => __('Anti-Spam by CleanTalk', 'cleantalk-spam-protect'),
235
  '{REMOTE_ADDRESS}' => $result['ip'],
236
  '{REQUEST_URI}' => Server::get('REQUEST_URI'),
237
  '{SERVICE_ID}' => $this->apbct->data['service_id'] . ', ' . $net_count,
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -344,7 +344,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
344
  /**
345
  * Message about IP status
346
  */
347
- if (! empty($_GET['sfw_test_ip'])) {
348
  $message_ip_status = __(
349
  'IP in the common blacklist',
350
  'cleantalk-spam-protect'
@@ -441,7 +441,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
441
  *
442
  * @param $db
443
  * @param $log_table
444
- * @param string $ct_key API key
445
  * @param bool $_use_delete_command Determs whether use DELETE or TRUNCATE to delete the logs table data
446
  *
447
  * @return array|bool array('error' => STRING)
344
  /**
345
  * Message about IP status
346
  */
347
+ if (! empty(Get::get('sfw_test_ip'))) {
348
  $message_ip_status = __(
349
  'IP in the common blacklist',
350
  'cleantalk-spam-protect'
441
  *
442
  * @param $db
443
  * @param $log_table
444
+ * @param string $ct_key Access key
445
  * @param bool $_use_delete_command Determs whether use DELETE or TRUNCATE to delete the logs table data
446
  *
447
  * @return array|bool array('error' => STRING)
lib/Cleantalk/ApbctWP/Helper.php CHANGED
@@ -3,12 +3,12 @@
3
  namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
- * CleanTalk Antispam Helper class.
7
- * Compatible only with Wordpress.
8
  *
9
  * @depends \Cleantalk\Common\Helper
10
  *
11
- * @package Antispam Plugin by CleanTalk
12
  * @subpackage Helper
13
  * @Version 1.0
14
  * @author Cleantalk team (welcome@cleantalk.org)
3
  namespace Cleantalk\ApbctWP;
4
 
5
  /**
6
+ * CleanTalk Anti-Spam Helper class.
7
+ * Compatible only with WordPress.
8
  *
9
  * @depends \Cleantalk\Common\Helper
10
  *
11
+ * @package Anti-Spam Plugin by CleanTalk
12
  * @subpackage Helper
13
  * @Version 1.0
14
  * @author Cleantalk team (welcome@cleantalk.org)
lib/Cleantalk/ApbctWP/RemoteCalls.php CHANGED
@@ -49,7 +49,7 @@ class RemoteCalls
49
  $apbct->remote_calls[$action]['last_call'] = time();
50
  $apbct->save('remote_calls');
51
 
52
- // Check API key
53
  if ($token == strtolower(md5($apbct->api_key))) {
54
  // Flag to let plugin know that Remote Call is running.
55
  $apbct->rc_running = true;
@@ -177,7 +177,7 @@ class RemoteCalls
177
  }
178
 
179
  /**
180
- * Insert API key
181
  */
182
  public static function action__insert_auth_key() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
183
  {
49
  $apbct->remote_calls[$action]['last_call'] = time();
50
  $apbct->save('remote_calls');
51
 
52
+ // Check Access key
53
  if ($token == strtolower(md5($apbct->api_key))) {
54
  // Flag to let plugin know that Remote Call is running.
55
  $apbct->rc_running = true;
177
  }
178
 
179
  /**
180
+ * Insert Access key
181
  */
182
  public static function action__insert_auth_key() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
183
  {
lib/Cleantalk/ApbctWP/Sanitize.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ class Sanitize extends \Cleantalk\Common\Sanitize
6
+ {
7
+ /**
8
+ * Simple method: clean url
9
+ */
10
+ public static function cleanUrl($variable)
11
+ {
12
+ return sanitize_url($variable);
13
+ }
14
+
15
+ /**
16
+ * Simple method: clean email
17
+ */
18
+ public static function cleanEmail($variable)
19
+ {
20
+ return sanitize_email($variable);
21
+ }
22
+
23
+ /**
24
+ * Simple method: clean file name
25
+ */
26
+ public static function cleanFileName($variable)
27
+ {
28
+ return sanitize_file_name($variable);
29
+ }
30
+
31
+ /**
32
+ * Simple method: clean hex color
33
+ */
34
+ public static function cleanHexColor($variable)
35
+ {
36
+ return sanitize_hex_color($variable);
37
+ }
38
+
39
+ /**
40
+ * Simple method: clean hex color no hash
41
+ */
42
+ public static function cleanHexColorNoHash($variable)
43
+ {
44
+ return sanitize_hex_color_no_hash($variable);
45
+ }
46
+
47
+ /**
48
+ * Simple method: clean html class
49
+ */
50
+ public static function cleanHtmlClass($variable)
51
+ {
52
+ return sanitize_html_class($variable);
53
+ }
54
+
55
+ /**
56
+ * Simple method: clean key
57
+ */
58
+ public static function cleanKey($variable)
59
+ {
60
+ return sanitize_key($variable);
61
+ }
62
+
63
+ /**
64
+ * Simple method: clean meta
65
+ */
66
+ public static function cleanMeta($meta_key, $meta_value, $object_type)
67
+ {
68
+ return sanitize_meta($meta_key, $meta_value, $object_type);
69
+ }
70
+
71
+ /**
72
+ * Simple method: clean mime type
73
+ */
74
+ public static function cleanMimeType($variable)
75
+ {
76
+ return sanitize_mime_type($variable);
77
+ }
78
+
79
+ /**
80
+ * Simple method: clean option
81
+ */
82
+ public static function cleanOption($option, $value)
83
+ {
84
+ return sanitize_option($option, $value);
85
+ }
86
+
87
+ /**
88
+ * Simple method: clean sql order by
89
+ */
90
+ public static function cleanSqlOrderBy($variable)
91
+ {
92
+ return sanitize_sql_orderby($variable);
93
+ }
94
+
95
+ /**
96
+ * Simple method: clean text field
97
+ */
98
+ public static function cleanTextField($variable)
99
+ {
100
+ return sanitize_text_field($variable);
101
+ }
102
+
103
+ /**
104
+ * Simple method: clean textarea field
105
+ */
106
+ public static function cleanTextareaField($variable)
107
+ {
108
+ return sanitize_textarea_field($variable);
109
+ }
110
+
111
+ /**
112
+ * Simple method: clean title
113
+ */
114
+ public static function cleanTitle($variable)
115
+ {
116
+ return sanitize_title($variable);
117
+ }
118
+
119
+ /**
120
+ * Simple method: clean title for query
121
+ */
122
+ public static function cleanTitleForQuery($variable)
123
+ {
124
+ return sanitize_title_for_query($variable);
125
+ }
126
+
127
+ /**
128
+ * Simple method: clean title with dashes
129
+ */
130
+ public static function cleanTitleWithDashes($variable)
131
+ {
132
+ return sanitize_title_with_dashes($variable);
133
+ }
134
+
135
+ /**
136
+ * Simple method: clean user
137
+ */
138
+ public static function cleanUser($variable)
139
+ {
140
+ return sanitize_user($variable);
141
+ }
142
+ }
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -5,7 +5,7 @@ namespace Cleantalk\ApbctWP;
5
  use ArrayObject;
6
 
7
  /**
8
- * CleanTalk Antispam State class
9
  *
10
  * @package Antiospam Plugin by CleanTalk
11
  * @subpackage State
@@ -46,7 +46,7 @@ class State extends \Cleantalk\Common\State
46
  'forms__comments_test' => 1,
47
  'forms__contact_forms_test' => 1,
48
  'forms__general_contact_forms_test' => 1,
49
- // Antispam test for unsupported and untested contact forms
50
  'forms__wc_checkout_test' => 1,
51
  // WooCommerce checkout default test
52
  'forms__wc_register_from_order' => 1,
@@ -54,7 +54,7 @@ class State extends \Cleantalk\Common\State
54
  'forms__wc_add_to_cart' => 0,
55
  // Woocommerce add to cart
56
  'forms__search_test' => 1,
57
- // Test default Wordpress form
58
  'forms__check_external' => 0,
59
  'forms__check_external__capture_buffer' => 0,
60
  'forms__check_internal' => 0,
@@ -123,7 +123,7 @@ class State extends \Cleantalk\Common\State
123
 
124
  // WordPress
125
  'wp__use_builtin_http_api' => 1,
126
- // Using Wordpress HTTP built in API
127
  'wp__comment_notify' => 1,
128
  'wp__comment_notify__roles' => array('administrator'),
129
  'wp__dashboard_widget__show' => 1,
@@ -143,7 +143,7 @@ class State extends \Cleantalk\Common\State
143
  'ajax_type' => false, // Ajax type
144
  'cookies_type' => 'native', // Native / Alternative / None
145
 
146
- // Antispam
147
  'spam_store_days' => 15, // Days before delete comments from folder Spam
148
  'relevance_test' => 0, // Test comment for relevance
149
  'notice_api_errors' => 0, // Send API error notices to WP admin
@@ -209,11 +209,15 @@ class State extends \Cleantalk\Common\State
209
  // Comment's test
210
  'count_checked_comments' => 0,
211
  'count_bad_comments' => 0,
 
 
 
 
212
  );
213
 
214
  public $def_network_settings = array(
215
 
216
- // Key
217
  'apikey' => '',
218
  'multisite__allow_custom_settings' => 1,
219
  'multisite__work_mode' => 1,
@@ -446,7 +450,7 @@ class State extends \Cleantalk\Common\State
446
  $this->data['cookies_type'] = 'none';
447
  }
448
 
449
- // Network with Mutual key
450
  if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) {
451
  // Get stats from main blog
452
  switch_to_blog(get_main_site_id());
5
  use ArrayObject;
6
 
7
  /**
8
+ * CleanTalk Anti-Spam State class
9
  *
10
  * @package Antiospam Plugin by CleanTalk
11
  * @subpackage State
46
  'forms__comments_test' => 1,
47
  'forms__contact_forms_test' => 1,
48
  'forms__general_contact_forms_test' => 1,
49
+ // Anti-Spam test for unsupported and untested contact forms
50
  'forms__wc_checkout_test' => 1,
51
  // WooCommerce checkout default test
52
  'forms__wc_register_from_order' => 1,
54
  'forms__wc_add_to_cart' => 0,
55
  // Woocommerce add to cart
56
  'forms__search_test' => 1,
57
+ // Test default WordPress form
58
  'forms__check_external' => 0,
59
  'forms__check_external__capture_buffer' => 0,
60
  'forms__check_internal' => 0,
123
 
124
  // WordPress
125
  'wp__use_builtin_http_api' => 1,
126
+ // Using WordPress HTTP built in API
127
  'wp__comment_notify' => 1,
128
  'wp__comment_notify__roles' => array('administrator'),
129
  'wp__dashboard_widget__show' => 1,
143
  'ajax_type' => false, // Ajax type
144
  'cookies_type' => 'native', // Native / Alternative / None
145
 
146
+ // Anti-Spam
147
  'spam_store_days' => 15, // Days before delete comments from folder Spam
148
  'relevance_test' => 0, // Test comment for relevance
149
  'notice_api_errors' => 0, // Send API error notices to WP admin
209
  // Comment's test
210
  'count_checked_comments' => 0,
211
  'count_bad_comments' => 0,
212
+
213
+ // User's test
214
+ 'count_checked_users' => 0,
215
+ 'count_bad_users' => 0,
216
  );
217
 
218
  public $def_network_settings = array(
219
 
220
+ // Access key
221
  'apikey' => '',
222
  'multisite__allow_custom_settings' => 1,
223
  'multisite__work_mode' => 1,
450
  $this->data['cookies_type'] = 'none';
451
  }
452
 
453
+ // Network with Mutual Access key
454
  if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) {
455
  // Get stats from main blog
456
  switch_to_blog(get_main_site_id());
lib/Cleantalk/ApbctWP/UpdatePlugin/DbAnalyzer.php CHANGED
@@ -27,7 +27,7 @@ class DbAnalyzer
27
  private $table_not_exists;
28
 
29
  /**
30
- * Multisite is On
31
  */
32
  private $multisite;
33
 
@@ -40,7 +40,7 @@ class DbAnalyzer
40
  }
41
 
42
  /**
43
- * Cheking multisite
44
  */
45
  private function checkingMultisite()
46
  {
@@ -60,7 +60,7 @@ class DbAnalyzer
60
  if ($this->dbSchema) {
61
  $schema_table_keys = array_keys($this->dbSchema);
62
 
63
- // Multisite
64
  if ($this->multisite) {
65
  $sites = get_sites();
66
 
27
  private $table_not_exists;
28
 
29
  /**
30
+ * WordPress Multisite is On
31
  */
32
  private $multisite;
33
 
40
  }
41
 
42
  /**
43
+ * Cheking WordPress Multisite
44
  */
45
  private function checkingMultisite()
46
  {
60
  if ($this->dbSchema) {
61
  $schema_table_keys = array_keys($this->dbSchema);
62
 
63
+ // WordPress Multisite
64
  if ($this->multisite) {
65
  $sites = get_sites();
66
 
lib/Cleantalk/ApbctWP/Validate.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ class Validate extends \Cleantalk\Common\Validate
6
+ {
7
+ public static function isEmail($variable)
8
+ {
9
+ return is_email($variable);
10
+ }
11
+
12
+ public static function isValidFilePath($variable)
13
+ {
14
+ return validate_file($variable);
15
+ }
16
+ }
lib/Cleantalk/ApbctWP/Variables/Cookie.php CHANGED
@@ -3,19 +3,16 @@
3
  namespace Cleantalk\ApbctWP\Variables;
4
 
5
  use Cleantalk\ApbctWP\Helper;
 
 
6
  use Cleantalk\Variables\Server;
7
 
8
  class Cookie extends \Cleantalk\Variables\Cookie
9
  {
10
  /**
11
- * @param string $name
12
- * @param string|array $default
13
- * @param null|string $cast_to
14
- * @param false $raw
15
- *
16
- * @return string|array
17
  */
18
- public static function get($name, $default = '', $cast_to = null, $raw = false)
19
  {
20
  global $apbct;
21
 
@@ -38,21 +35,23 @@ class Cookie extends \Cleantalk\Variables\Cookie
38
  }
39
  }
40
 
 
 
 
 
 
 
 
 
 
41
  // Remember for further calls
42
  static::getInstance()->rememberVariable($name, $value);
43
  }
44
 
45
- // Decoding by default
46
- if ( ! $raw) {
47
- $value = urldecode($value); // URL decode
48
- $value = Helper::isJson($value) ? json_decode($value, true) : $value; // JSON decode
49
- if ( ! is_null($cast_to)) {
50
- settype($value, $cast_to);
51
- $value = $cast_to === 'array' && $value === array('') ? array() : $value;
52
- }
53
- }
54
 
55
- return ! $value ? $default : $value;
56
  }
57
 
58
  /**
@@ -116,10 +115,9 @@ class Cookie extends \Cleantalk\Variables\Cookie
116
  $httponly = false,
117
  $samesite = 'Lax'
118
  ) {
 
119
  // For PHP 7.3+ and above
120
- if (version_compare(phpversion(), '7.3.0', '>=')) {
121
- $secure = ! is_null($secure) ? $secure : Server::get('HTTPS') || Server::get('SERVER_PORT') == 443;
122
-
123
  $params = array(
124
  'expires' => $expires,
125
  'path' => $path,
@@ -146,8 +144,6 @@ class Cookie extends \Cleantalk\Variables\Cookie
146
  * Getting visible fields collection
147
  *
148
  * @return array
149
- *
150
- * @psalm-suppress InvalidReturnType, InvalidReturnStatement
151
  */
152
  public static function getVisibleFields()
153
  {
@@ -155,7 +151,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
155
 
156
  if ( $apbct->data['cookies_type'] === 'native' ) {
157
  // Get from separated native cookies and convert it to collection
158
- $visible_fields_cookies_array = array_filter($_COOKIE, static function ($key) {
159
  return strpos($key, 'apbct_visible_fields_') !== false;
160
  }, ARRAY_FILTER_USE_KEY);
161
  $visible_fields_collection = array();
@@ -166,7 +162,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
166
  }
167
  } else {
168
  // Get from alt cookies storage
169
- $visible_fields_collection = self::get('apbct_visible_fields', array(), 'array');
170
  }
171
 
172
  return $visible_fields_collection;
3
  namespace Cleantalk\ApbctWP\Variables;
4
 
5
  use Cleantalk\ApbctWP\Helper;
6
+ use Cleantalk\ApbctWP\Sanitize;
7
+ use Cleantalk\ApbctWP\Validate;
8
  use Cleantalk\Variables\Server;
9
 
10
  class Cookie extends \Cleantalk\Variables\Cookie
11
  {
12
  /**
13
+ * @inheritDoc
 
 
 
 
 
14
  */
15
+ public static function get($name, $validation_filter = null, $sanitize_filter = null)
16
  {
17
  global $apbct;
18
 
35
  }
36
  }
37
 
38
+ // Validate variable
39
+ if ( $validation_filter && ! Validate::validate($value, $validation_filter) ) {
40
+ return false;
41
+ }
42
+
43
+ if ( $sanitize_filter ) {
44
+ $value = Sanitize::sanitize($value, $sanitize_filter);
45
+ }
46
+
47
  // Remember for further calls
48
  static::getInstance()->rememberVariable($name, $value);
49
  }
50
 
51
+ // Decoding
52
+ $value = urldecode($value); // URL decode
 
 
 
 
 
 
 
53
 
54
+ return $value;
55
  }
56
 
57
  /**
115
  $httponly = false,
116
  $samesite = 'Lax'
117
  ) {
118
+ $secure = ! is_null($secure) ? $secure : ! in_array(Server::get('HTTPS'), ['off', '']) || Server::get('SERVER_PORT') == 443;
119
  // For PHP 7.3+ and above
120
+ if ( version_compare(phpversion(), '7.3.0', '>=') ) {
 
 
121
  $params = array(
122
  'expires' => $expires,
123
  'path' => $path,
144
  * Getting visible fields collection
145
  *
146
  * @return array
 
 
147
  */
148
  public static function getVisibleFields()
149
  {
151
 
152
  if ( $apbct->data['cookies_type'] === 'native' ) {
153
  // Get from separated native cookies and convert it to collection
154
+ $visible_fields_cookies_array = array_filter($_COOKIE, function ($key) {
155
  return strpos($key, 'apbct_visible_fields_') !== false;
156
  }, ARRAY_FILTER_USE_KEY);
157
  $visible_fields_collection = array();
162
  }
163
  } else {
164
  // Get from alt cookies storage
165
+ $visible_fields_collection = (array) self::get('apbct_visible_fields');
166
  }
167
 
168
  return $visible_fields_collection;
lib/Cleantalk/Common/API.php CHANGED
@@ -49,7 +49,7 @@ class API
49
 
50
  /**
51
  * Wrapper for get_api_key API method.
52
- * Gets access key automatically.
53
  *
54
  * @param string $product_name Type of product
55
  * @param string $email Website admin email
@@ -154,7 +154,7 @@ class API
154
  * Wrapper for notice_paid_till API method.
155
  * Gets information about renew notice.
156
  *
157
- * @param string $api_key API key
158
  * @param string $path_to_cms Website URL
159
  * @param string $product_name
160
  * @param bool $do_check
@@ -244,7 +244,7 @@ class API
244
  * Wrapper for notice_paid_till API method.
245
  * Gets information about renew notice.
246
  *
247
- * @param string $api_key API key
248
  * @param string $path_to_cms Website URL
249
  * @param string $product_name
250
  * @param bool $do_check
49
 
50
  /**
51
  * Wrapper for get_api_key API method.
52
+ * Gets Access key automatically.
53
  *
54
  * @param string $product_name Type of product
55
  * @param string $email Website admin email
154
  * Wrapper for notice_paid_till API method.
155
  * Gets information about renew notice.
156
  *
157
+ * @param string $api_key Access key
158
  * @param string $path_to_cms Website URL
159
  * @param string $product_name
160
  * @param bool $do_check
244
  * Wrapper for notice_paid_till API method.
245
  * Gets information about renew notice.
246
  *
247
+ * @param string $api_key Access key
248
  * @param string $path_to_cms Website URL
249
  * @param string $product_name
250
  * @param bool $do_check
lib/Cleantalk/Common/Compatibility.php CHANGED
@@ -5,7 +5,7 @@ namespace Cleantalk\Common;
5
  /**
6
  * CleanTalk Compatibility class.
7
  *
8
- * @package PHP Antispam by CleanTalk
9
  * @subpackage Compatibility
10
  * @Version 3.5
11
  * @author Cleantalk team (welcome@cleantalk.org)
5
  /**
6
  * CleanTalk Compatibility class.
7
  *
8
+ * @package PHP Anti-Spam by CleanTalk
9
  * @subpackage Compatibility
10
  * @Version 3.5
11
  * @author Cleantalk team (welcome@cleantalk.org)
lib/Cleantalk/Common/Cron.php CHANGED
@@ -5,7 +5,7 @@ namespace Cleantalk\Common;
5
  /**
6
  * CleanTalk Cron class
7
  *
8
- * @package Antispam by CleanTalk
9
  * @Version 2.1.1
10
  * @author Cleantalk team (welcome@cleantalk.org)
11
  * @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
5
  /**
6
  * CleanTalk Cron class
7
  *
8
+ * @package Anti-Spam by CleanTalk
9
  * @Version 2.1.1
10
  * @author Cleantalk team (welcome@cleantalk.org)
11
  * @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
lib/Cleantalk/Common/Escape.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Common;
4
+
5
+ class Escape
6
+ {
7
+ /**
8
+ * Simple method: escape html attribute
9
+ *
10
+ * @param $text
11
+ */
12
+ public static function escAttr($text)
13
+ {
14
+ // TODO
15
+ }
16
+
17
+ /**
18
+ * Simple method: escape html
19
+ *
20
+ * @param $text
21
+ */
22
+ public static function escHtml($text)
23
+ {
24
+ return htmlspecialchars($text);
25
+ }
26
+
27
+ /**
28
+ * Simple method: escape js
29
+ *
30
+ * @param $text
31
+ */
32
+ public static function escJs($text)
33
+ {
34
+ // TODO
35
+ }
36
+
37
+ /**
38
+ * Simple method: escape textarea
39
+ *
40
+ * @param $text
41
+ */
42
+ public static function escTextarea($text)
43
+ {
44
+ // TODO
45
+ }
46
+
47
+ /**
48
+ * Simple method: escape url
49
+ *
50
+ * @param $text
51
+ */
52
+ public static function escUrl($text)
53
+ {
54
+ // TODO
55
+ }
56
+
57
+ /**
58
+ * Simple method: escape url raw
59
+ *
60
+ * @param $text
61
+ */
62
+ public static function escUrlRaw($text)
63
+ {
64
+ // TODO
65
+ }
66
+
67
+ /**
68
+ * Simple method: escape kses
69
+ *
70
+ * @param $string
71
+ * @param $allowed_html
72
+ * @param array $allowed_protocols
73
+ */
74
+ public static function escKses($string, $allowed_html, $allowed_protocols = array())
75
+ {
76
+ // TODO
77
+ }
78
+
79
+ /**
80
+ * Simple method: escape kses post
81
+ *
82
+ * @param $data
83
+ */
84
+ public static function escKsesPost($data)
85
+ {
86
+ // TODO
87
+ }
88
+ }
lib/Cleantalk/Common/Helper.php CHANGED
@@ -9,7 +9,7 @@ use Cleantalk\Variables\Server;
9
  * CleanTalk Helper class.
10
  * Compatible with any CMS.
11
  *
12
- * @package PHP Antispam by CleanTalk
13
  * @subpackage Helper
14
  * @Version 4.0
15
  * @author Cleantalk team (welcome@cleantalk.org)
@@ -93,6 +93,7 @@ class Helper
93
  *
94
  * @psalm-suppress InvalidReturnStatement
95
  * @psalm-suppress ComplexMethod
 
96
  */
97
  public static function ipGet($ip_type_to_get = 'real', $v4_only = true, $headers = array())
98
  {
@@ -990,6 +991,7 @@ class Helper
990
  * @param string $string
991
  *
992
  * @return bool
 
993
  */
994
  public static function isJson($string)
995
  {
9
  * CleanTalk Helper class.
10
  * Compatible with any CMS.
11
  *
12
+ * @package PHP Anti-Spam by CleanTalk
13
  * @subpackage Helper
14
  * @Version 4.0
15
  * @author Cleantalk team (welcome@cleantalk.org)
93
  *
94
  * @psalm-suppress InvalidReturnStatement
95
  * @psalm-suppress ComplexMethod
96
+ * @psalm-suppress FalsableReturnStatement
97
  */
98
  public static function ipGet($ip_type_to_get = 'real', $v4_only = true, $headers = array())
99
  {
991
  * @param string $string
992
  *
993
  * @return bool
994
+ * @psalm-suppress PossiblyUnusedMethod
995
  */
996
  public static function isJson($string)
997
  {
lib/Cleantalk/Common/Sanitize.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Common;
4
+
5
+ class Sanitize
6
+ {
7
+ /**
8
+ * Runs sanitizing process for input
9
+ *
10
+ * Now contains no filters: xss, url
11
+ *
12
+ * @param mixed $variable Input to sanitize
13
+ * @param string $filter_name Sanitizing filter name
14
+ *
15
+ * @return string
16
+ */
17
+ public static function sanitize($variable, $filter_name)
18
+ {
19
+ switch ( $filter_name ) {
20
+ // XSS. Recursive.
21
+ case 'xss':
22
+ return static::cleanXss($variable);
23
+
24
+ // URL
25
+ case 'url':
26
+ return static::cleanUrl($variable);
27
+
28
+ // Simple string
29
+ case 'word':
30
+ return static::cleanWord($variable);
31
+
32
+ case 'int':
33
+ return static::cleanInt($variable);
34
+
35
+ case 'cleanEmail':
36
+ return static::cleanEmail($variable);
37
+ }
38
+
39
+ return $variable;
40
+ }
41
+
42
+ /**
43
+ * Simple method: clean xss
44
+ */
45
+ public static function cleanXss($variable)
46
+ {
47
+ $variable_filtered = preg_replace('#[\'"].*?>.*?<#i', '', $variable);
48
+
49
+ return $variable === $variable_filtered
50
+ ? htmlspecialchars($variable_filtered)
51
+ : static::sanitize($variable_filtered, 'xss');
52
+ }
53
+
54
+ /**
55
+ * Simple method: clean url
56
+ */
57
+ public static function cleanUrl($variable)
58
+ {
59
+ return preg_replace('#[^a-zA-Z0-9$\-_.+!*\'(),{}|\\^~\[\]`<>\#%";\/?:@&=.]#i', '', $variable);
60
+ }
61
+
62
+ /**
63
+ * Simple method: clean word
64
+ */
65
+ public static function cleanWord($variable)
66
+ {
67
+ return preg_replace('#[^a-zA-Z0-9_.\-,]#', '', $variable);
68
+ }
69
+
70
+ /**
71
+ * Simple method: clean int
72
+ */
73
+ public static function cleanInt($variable)
74
+ {
75
+ return preg_replace('#[^0-9.,]#', '', $variable);
76
+ }
77
+
78
+ /**
79
+ * Simple method: clean email
80
+ */
81
+ public static function cleanEmail($variable)
82
+ {
83
+ // TODO
84
+ return $variable;
85
+ }
86
+
87
+ /**
88
+ * Simple method: clean file name
89
+ */
90
+ public static function cleanFileName($variable)
91
+ {
92
+ // TODO
93
+ }
94
+
95
+ /**
96
+ * Simple method: clean hex color
97
+ */
98
+ public static function cleanHexColor($variable)
99
+ {
100
+ // TODO
101
+ }
102
+
103
+ /**
104
+ * Simple method: clean hex color no hash
105
+ */
106
+ public static function cleanHexColorNoHash($variable)
107
+ {
108
+ // TODO
109
+ }
110
+
111
+ /**
112
+ * Simple method: clean html class
113
+ */
114
+ public static function cleanHtmlClass($variable)
115
+ {
116
+ // TODO
117
+ }
118
+
119
+ /**
120
+ * Simple method: clean key
121
+ */
122
+ public static function cleanKey($variable)
123
+ {
124
+ // TODO
125
+ }
126
+
127
+ /**
128
+ * Simple method: clean meta
129
+ */
130
+ public static function cleanMeta($meta_key, $meta_value, $object_type)
131
+ {
132
+ // TODO
133
+ }
134
+
135
+ /**
136
+ * Simple method: clean mime type
137
+ */
138
+ public static function cleanMimeType($variable)
139
+ {
140
+ // TODO
141
+ }
142
+
143
+ /**
144
+ * Simple method: clean option
145
+ */
146
+ public static function cleanOption($option, $value)
147
+ {
148
+ // TODO
149
+ }
150
+
151
+ /**
152
+ * Simple method: clean sql order by
153
+ */
154
+ public static function cleanSqlOrderBy($variable)
155
+ {
156
+ // TODO
157
+ }
158
+
159
+ /**
160
+ * Simple method: clean text field
161
+ */
162
+ public static function cleanTextField($variable)
163
+ {
164
+ // TODO
165
+ }
166
+
167
+ /**
168
+ * Simple method: clean textarea field
169
+ */
170
+ public static function cleanTextareaField($variable)
171
+ {
172
+ // TODO
173
+ }
174
+
175
+ /**
176
+ * Simple method: clean title
177
+ */
178
+ public static function cleanTitle($variable)
179
+ {
180
+ // TODO
181
+ }
182
+
183
+ /**
184
+ * Simple method: clean title for query
185
+ */
186
+ public static function cleanTitleForQuery($variable)
187
+ {
188
+ // TODO
189
+ }
190
+
191
+ /**
192
+ * Simple method: clean title with dashes
193
+ */
194
+ public static function cleanTitleWithDashes($variable)
195
+ {
196
+ // TODO
197
+ }
198
+
199
+ /**
200
+ * Simple method: clean user
201
+ */
202
+ public static function cleanUser($variable)
203
+ {
204
+ // TODO
205
+ }
206
+ }
lib/Cleantalk/Common/Validate.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Common;
4
+
5
+ class Validate
6
+ {
7
+ /**
8
+ * Runs validation for input parameter
9
+ *
10
+ * Now contains filters: hash
11
+ *
12
+ * @param mixed $variable Input to validate
13
+ * @param string $filter_name Validation filter name
14
+ *
15
+ * @return bool
16
+ */
17
+ public static function validate($variable, $filter_name)
18
+ {
19
+ switch ( $filter_name ) {
20
+ case 'hash':
21
+ return static::isHash($variable);
22
+ case 'int':
23
+ return static::isInt($variable);
24
+ case 'float':
25
+ return static::isFloat($variable);
26
+ case 'word':
27
+ return static::isWord($variable);
28
+ case 'isUrl':
29
+ return static::isUrl($variable);
30
+ }
31
+
32
+ return false;
33
+ }
34
+
35
+ /**
36
+ * Simple method: validate hash
37
+ */
38
+ public static function isHash($variable)
39
+ {
40
+ return preg_match('#^[a-zA-Z0-9]{8,128}$#', $variable) === 1;
41
+ }
42
+
43
+ /**
44
+ * Simple method: validate int
45
+ */
46
+ public static function isInt($variable)
47
+ {
48
+ return preg_match('#^\d+$#', $variable) === 1;
49
+ }
50
+
51
+ /**
52
+ * Simple method: validate float
53
+ */
54
+ public static function isFloat($variable)
55
+ {
56
+ return preg_match('#^[\d.]+\d+$#', $variable) === 1;
57
+ }
58
+
59
+ /**
60
+ * Simple method: validate word
61
+ */
62
+ public static function isWord($variable)
63
+ {
64
+ return preg_match('#^[a-zA-Z0-9_.\-,]+$#', $variable);
65
+ }
66
+
67
+ /**
68
+ * Simple method: validate email
69
+ */
70
+ public static function isEmail($variable)
71
+ {
72
+ // TODO
73
+ }
74
+
75
+ /**
76
+ * Simple method: validate file path (not exists)
77
+ */
78
+ public static function isValidFilePath($variable)
79
+ {
80
+ // TODO
81
+ }
82
+
83
+ public static function isUrl($variable)
84
+ {
85
+ // @ToDo
86
+ return $variable;
87
+ }
88
+ }
lib/Cleantalk/Variables/Cookie.php CHANGED
@@ -70,10 +70,10 @@ class Cookie extends ServerVariables
70
  $httponly = false,
71
  $samesite = 'Lax'
72
  ) {
73
- $secure = ! is_null($secure) ? $secure : Server::get('HTTPS') !== 'off' || Server::get('SERVER_PORT') == 443;
74
 
75
  // For PHP 7.3+ and above
76
- if (version_compare(phpversion(), '7.3.0', '>=')) {
77
  $params = array(
78
  'expires' => $expires,
79
  'path' => $path,
70
  $httponly = false,
71
  $samesite = 'Lax'
72
  ) {
73
+ $secure = ! is_null($secure) ? $secure : ! in_array(Server::get('HTTPS'), ['off', '']) || Server::get('SERVER_PORT') == 443;
74
 
75
  // For PHP 7.3+ and above
76
+ if ( version_compare(phpversion(), '7.3.0', '>=') ) {
77
  $params = array(
78
  'expires' => $expires,
79
  'path' => $path,
lib/Cleantalk/Variables/ServerVariables.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace Cleantalk\Variables;
4
 
 
 
5
  use Cleantalk\Templates\Singleton;
6
 
7
  /**
@@ -26,12 +28,27 @@ abstract class ServerVariables
26
  * Gets variable from ${_SOMETHING}
27
  *
28
  * @param string $name Variable name
 
 
 
 
29
  *
30
- * @return string|array
31
  */
32
- public static function get($name)
33
  {
34
- return static::getInstance()->getVariable($name);
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  /**
2
 
3
  namespace Cleantalk\Variables;
4
 
5
+ use Cleantalk\ApbctWP\Sanitize;
6
+ use Cleantalk\ApbctWP\Validate;
7
  use Cleantalk\Templates\Singleton;
8
 
9
  /**
28
  * Gets variable from ${_SOMETHING}
29
  *
30
  * @param string $name Variable name
31
+ * @param null|string $validation_filter
32
+ * @psalm-param (null|"hash"|"int"|"float"|"word"|"isUrl") $validation_filter
33
+ * @param null|string $sanitize_filter
34
+ * @psalm-param (null|"xss"|"int"|"url"|"word"|"cleanEmail") $sanitize_filter
35
  *
36
+ * @return string|array|false
37
  */
38
+ public static function get($name, $validation_filter = null, $sanitize_filter = null)
39
  {
40
+ $variable = static::getInstance()->getVariable($name);
41
+
42
+ // Validate variable
43
+ if ( $validation_filter && ! Validate::validate($variable, $validation_filter) ) {
44
+ return false;
45
+ }
46
+
47
+ if ( $sanitize_filter ) {
48
+ $variable = Sanitize::sanitize($variable, $sanitize_filter);
49
+ }
50
+
51
+ return $variable;
52
  }
53
 
54
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.9
6
  Requires PHP: 5.6
7
- Stable tag: 5.174.1
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -35,6 +35,7 @@ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bo
35
  19. Spam FireWall: Anti-Flood
36
  20. Spam FireWall: Anti-Crawler
37
  21. Hide «Website» field for comments
 
38
 
39
  = Free trial then $8 per year =
40
  CleanTalk is an anti-spam plugin which works with the premium Cloud Anti-Spam service cleantalk.org. This plugin as a service <a href="https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#6-software-as-a-service-is-permitted">https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#6-software-as-a-service-is-permitted</a>
@@ -595,6 +596,40 @@ If your website has forms that send data to external sources, you can enable opt
595
 
596
  == Changelog ==
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  = 5.174.1 Mar 25 2022 =
599
  * Fix: Comments/Users scanner fixed.
600
 
4
  Requires at least: 3.0
5
  Tested up to: 5.9
6
  Requires PHP: 5.6
7
+ Stable tag: 5.175
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
35
  19. Spam FireWall: Anti-Flood
36
  20. Spam FireWall: Anti-Crawler
37
  21. Hide «Website» field for comments
38
+ 22. Block messages by languages, countries, networks.
39
 
40
  = Free trial then $8 per year =
41
  CleanTalk is an anti-spam plugin which works with the premium Cloud Anti-Spam service cleantalk.org. This plugin as a service <a href="https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#6-software-as-a-service-is-permitted">https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#6-software-as-a-service-is-permitted</a>
596
 
597
  == Changelog ==
598
 
599
+ = 5.175 Apr 14 2022 =
600
+ #### Integration added, typos fixed, user scanner improved and minor issues fixed.
601
+ * New. Integration. Events Manager plugin integration implemented.
602
+ * New. Code. New validate classes.
603
+ * New. Code. New validate sub-classes in ApbctWP.
604
+ * Upd. Readme. One more AntiSpam feature added.
605
+ * Mod: PlansoFormBuilder integration
606
+ * Fix. External forms. Capturing buffer fixed.
607
+ * Fix. Integration. Simple Ajax Chat sending fixed.
608
+ * Fix. Exclusions. Special flag to prevent exclusions implemented.
609
+ * Fix. Getting key errors handle.
610
+ * Fix. Getting key error output fixed.
611
+ * Fix: Added VFB_Pro integration
612
+ * Fix. Settings api. Long description for text fields implemented.
613
+ * Fix. Settings. Long description for hoster api key removed.
614
+ * Fix. Settings. Long descriptions UTM marks fixed.
615
+ * Fix. Comments checker. Dates ranges fixed.
616
+ * Fix. Code. Core based JqueryUI use on users/comments checking page.
617
+ * Fix. Code. Moderate API answer fixed.
618
+ * Fix. Code. Including assets fixed.
619
+ * Fix. Text. Typos on company brand terms fixed.
620
+ * Fix: Glitched redirect after plugin activation.
621
+ * Fix. Settings. Hoster Access Key long description mark removed.
622
+ * Fix: Filter visible fields for AvadaFormBuilder
623
+ * Fix. Code. Using wrappers for calling global variables.
624
+ * Fix. Code. Cookie secure attribute fixed.
625
+ * Fix. Code. Refactoring the user scanning engine.
626
+ * Fix. Cookie. Getting cookies fixed.
627
+ * Upd. Settings. SFW long description added.
628
+ * Upd. Localization. SFW, AC, AF titles is not localized now.
629
+ * Fix. Common. Collecting visited urls fixed.
630
+ * Fix. Integration. JP contact form checking JS fixed.
631
+ * Fix. Integration. CF7 form checking JS fixed.
632
+
633
  = 5.174.1 Mar 25 2022 =
634
  * Fix: Comments/Users scanner fixed.
635