Spam protection, AntiSpam, FireWall by CleanTalk - Version 6.0

Version Description

Dec 1 2022 =

No cookie mode by default, EmailEncoder user-friendly enhancements , trusted text and affiliate settings , prepare SpamFireWall for incremental updating, and some minor issues fixed

  • New. Major version updated.
  • New. Cookies. The plugin does not use browser cookies by default.
  • New. Settings. Trusted text and affiliate links management added.
  • New. SpamFireWall. Now can handle incremental update.
  • New. WooCommerce integration. Spam\no spam feedback now sends to CleanTalk cloud.
  • New. Settings. Some URLs became active links.
  • Mod. Ninja forms integration. Improvements.
  • Mod. Email encoder. Decode all the emails on the page if cloud allowed and remember the state for session.
  • Mod. Connection reports. Totally refactored.
  • Mod. SpamFireWall, Anti-Crawler, Anti-Flood die pages. Settings cookie data via single AJAX.
  • Fix. Comments scanner. Comments counting fixed.
  • Fix. MailChimp for WordPress integration. Fixed.
  • Fix. MC4WP integration. Request catching without JS fixed.
Download this release

Release Info

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

Code changes from version 5.189.1 to 6.0

Files changed (41) hide show
  1. cleantalk.php +105 -85
  2. css/cleantalk-admin-settings-page.min.css +1 -1
  3. css/cleantalk-admin.min.css +1 -1
  4. css/cleantalk-public.min.css +1 -1
  5. inc/cleantalk-admin.php +47 -0
  6. inc/cleantalk-ajax.php +0 -23
  7. inc/cleantalk-common.php +11 -66
  8. inc/cleantalk-public-integrations.php +79 -6
  9. inc/cleantalk-public-validate.php +5 -0
  10. inc/cleantalk-public.php +69 -0
  11. inc/cleantalk-settings.php +202 -101
  12. inc/cleantalk-updater.php +20 -0
  13. js/apbct-public--3--cleantalk-modal.min.js +1 -1
  14. js/apbct-public--3--cleantalk-modal.min.js.map +1 -1
  15. js/apbct-public-bundle.min.js +1 -1
  16. js/apbct-public-bundle.min.js.map +1 -1
  17. js/cleantalk-admin-settings-page.min.js +1 -1
  18. js/cleantalk-admin-settings-page.min.js.map +1 -1
  19. js/cleantalk-comments-checkspam.min.js +1 -1
  20. js/cleantalk-comments-checkspam.min.js.map +1 -1
  21. lib/Cleantalk/Antispam/Cleantalk.php +10 -1
  22. lib/Cleantalk/Antispam/CleantalkResponse.php +9 -1
  23. lib/Cleantalk/Antispam/EmailEncoder.php +45 -17
  24. lib/Cleantalk/ApbctWP/Activator.php +1 -1
  25. lib/Cleantalk/ApbctWP/Antispam/EmailEncoder.php +16 -10
  26. lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php +0 -15
  27. lib/Cleantalk/ApbctWP/ConnectionReports.php +475 -0
  28. lib/Cleantalk/ApbctWP/Deactivator.php +1 -0
  29. lib/Cleantalk/ApbctWP/Escape.php +34 -0
  30. lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php +6 -5
  31. lib/Cleantalk/ApbctWP/Firewall/SFW.php +108 -1
  32. lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html +8 -8
  33. lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html +7 -7
  34. lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html +10 -9
  35. lib/Cleantalk/ApbctWP/RemoteCalls.php +11 -1
  36. lib/Cleantalk/ApbctWP/RestController.php +2 -2
  37. lib/Cleantalk/ApbctWP/State.php +44 -50
  38. lib/Cleantalk/ApbctWP/Variables/Cookie.php +5 -4
  39. lib/Cleantalk/Common/Schema.php +12 -0
  40. lib/Cleantalk/Common/State.php +0 -1
  41. readme.txt +17 -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.189.1
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -193,6 +193,8 @@ apbct_update_actions();
193
  add_action('init', function () {
194
  global $apbct;
195
  // Self cron
 
 
196
  $ct_cron = new Cron();
197
  $tasks_to_run = $ct_cron->checkTasks(); // Check for current tasks. Drop tasks inner counters.
198
  if (
@@ -216,7 +218,11 @@ add_action('init', function () {
216
  }
217
  // Remote calls
218
  if ( RemoteCalls::check() ) {
219
- RemoteCalls::perform();
 
 
 
 
220
  }
221
  });
222
 
@@ -234,9 +240,9 @@ if ( ! is_admin() && ! apbct_is_ajax() && ! defined('DOING_CRON')
234
  add_action('template_redirect', 'apbct_cookie', 2);
235
  add_action('template_redirect', 'apbct_store__urls', 2);
236
  }
237
- if ( empty($_POST) && empty($_GET) ) {
238
- apbct_cookie();
239
- apbct_store__urls();
240
  }
241
  }
242
 
@@ -457,6 +463,9 @@ add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse'
457
  add_filter('frm_entries_before_create', 'apbct_form__formidable__testSpam', 999999, 2);
458
  add_action('frm_entries_footer_scripts', 'apbct_form__formidable__footerScripts', 20, 2);
459
 
 
 
 
460
  // Public actions
461
  if ( ! is_admin() && ! apbct_is_ajax() && ! apbct_is_customize_preview() ) {
462
  // Default search
@@ -1773,6 +1782,93 @@ function ct_sfw_send_logs($api_key = '')
1773
  return $result;
1774
  }
1775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1776
  function apbct_antiflood__clear_table()
1777
  {
1778
  global $apbct;
@@ -2059,6 +2155,7 @@ function apbct_rc__insert_auth_key($key, $plugin)
2059
  $data['notice_trial'] = $result['trial'];
2060
  $data['auto_update_app'] = isset($result['show_auto_update_notice']) ? $result['show_auto_update_notice'] : 0;
2061
  $data['service_id'] = $result['service_id'];
 
2062
  $data['moderate'] = $result['moderate'];
2063
  $data['auto_update_app '] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
2064
  $data['license_trial'] = isset($result['license_trial']) ? $result['license_trial'] : 0;
@@ -2429,6 +2526,7 @@ function ct_account_status_check($api_key = null, $process_errors = true)
2429
 
2430
  // Other
2431
  $apbct->data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
 
2432
  $apbct->data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
2433
  $apbct->data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
2434
  $apbct->data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
@@ -2460,88 +2558,10 @@ function ct_account_status_check($api_key = null, $process_errors = true)
2460
  return $result;
2461
  }
2462
 
2463
- /**
2464
- * Send failed connection reports if exist and still unsent.
2465
- */
2466
- function ct_mail_send_connection_report()
2467
  {
2468
  global $apbct;
2469
-
2470
- if ( ( $apbct->settings['misc__send_connection_reports'] == 1 && isset($apbct->connection_reports['negative']) && $apbct->connection_reports['negative'] > 0 ) || !empty(Get::get('ct_send_connection_report')) ) {
2471
- //skip empty reports for cron job
2472
- $unsent_exist = false;
2473
- foreach ( $apbct->connection_reports['negative_report'] as $_key => $report ) {
2474
- if ( $report['is_sent'] == false ) {
2475
- $unsent_exist = true;
2476
- }
2477
- }
2478
- if ( ! $unsent_exist ) {
2479
- return;
2480
- }
2481
- $to = "welcome@cleantalk.org";
2482
- $subject = "Connection report for " . Server::get('HTTP_HOST');
2483
- $message = '
2484
- <html lang="en">
2485
- <head>
2486
- <title></title>
2487
- </head>
2488
- <body>
2489
- <p>From '
2490
- . $apbct->connection_reports['since']
2491
- . ' to ' . date('d M') . ' has been made '
2492
- . ( $apbct->connection_reports['success'] + $apbct->connection_reports['negative'] )
2493
- . ' calls, where ' . $apbct->connection_reports['success'] . ' were success and '
2494
- . $apbct->connection_reports['negative'] . ' were negative
2495
- </p>
2496
- <p>Negative report:</p>
2497
- <table> <tr>
2498
- <td>&nbsp;</td>
2499
- <td><b>Date</b></td>
2500
- <td><b>Page URL</b></td>
2501
- <td><b>Library report</b></td>
2502
- <td><b>Server IP</b></td>
2503
- </tr>
2504
- ';
2505
- $counter = 0;
2506
- foreach ( $apbct->connection_reports['negative_report'] as $_key => $report ) {
2507
- if ( !$report['is_sent'] ) {
2508
- $message .= '<tr>'
2509
- . '<td>' . ( ++$counter ) . '.</td>'
2510
- . '<td>' . $report['date'] . '</td>'
2511
- . '<td>' . $report['page_url'] . '</td>'
2512
- . '<td>' . $report['lib_report'] . '</td>'
2513
- . '<td>' . $report['work_url'] . '</td>'
2514
- . '</tr>';
2515
- }
2516
- }
2517
- $message .= '</table>';
2518
-
2519
- $message .= '<br>';
2520
- $show_connection_reports_link =
2521
- substr(get_option('home'), -1) === '/' ? get_option('home') : get_option('home') . '/'
2522
- . '?'
2523
- . http_build_query([
2524
- 'plugin_name' => 'apbct',
2525
- 'spbc_remote_call_token' => md5($apbct->api_key),
2526
- 'spbc_remote_call_action' => 'debug',
2527
- 'show_only' => 'connection_reports',
2528
- ]);
2529
- $message .= '<a href="' . $show_connection_reports_link . '" target="_blank">Show connection reports with remote call</a>';
2530
- $message .= '<br>';
2531
-
2532
- $message .= '</body></html>';
2533
-
2534
- $headers = "Content-type: text/html; charset=windows-1251 \r\n";
2535
- $headers .= 'From: ' . ct_get_admin_email();
2536
- /** @psalm-suppress UnusedFunctionCall */
2537
- if ( wp_mail($to, $subject, $message, $headers) ) {
2538
- foreach ( $apbct->storage['connection_reports']['negative_report'] as $_key => &$report ) {
2539
- $report['is_sent'] = true;
2540
- }
2541
- unset($report);
2542
- $apbct->save('connection_reports', true, false);
2543
- }
2544
- }
2545
  }
2546
 
2547
  /**
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: 6.0
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
193
  add_action('init', function () {
194
  global $apbct;
195
  // Self cron
196
+ // Connection reports
197
+ $apbct->setConnectionReports();
198
  $ct_cron = new Cron();
199
  $tasks_to_run = $ct_cron->checkTasks(); // Check for current tasks. Drop tasks inner counters.
200
  if (
218
  }
219
  // Remote calls
220
  if ( RemoteCalls::check() ) {
221
+ try {
222
+ RemoteCalls::perform();
223
+ } catch ( Exception $e ) {
224
+ die(json_encode(array('ERROR:' => $e->getMessage())));
225
+ }
226
  }
227
  });
228
 
240
  add_action('template_redirect', 'apbct_cookie', 2);
241
  add_action('template_redirect', 'apbct_store__urls', 2);
242
  }
243
+ if ( empty($_POST) && empty($_GET) && $apbct->data['key_is_ok']) {
244
+ apbct_cookie();
245
+ apbct_store__urls();
246
  }
247
  }
248
 
463
  add_filter('frm_entries_before_create', 'apbct_form__formidable__testSpam', 999999, 2);
464
  add_action('frm_entries_footer_scripts', 'apbct_form__formidable__footerScripts', 20, 2);
465
 
466
+ /* MailChimp Premium */
467
+ add_filter('mc4wp_form_errors', 'ct_mc4wp_hook');
468
+
469
  // Public actions
470
  if ( ! is_admin() && ! apbct_is_ajax() && ! apbct_is_customize_preview() ) {
471
  // Default search
1782
  return $result;
1783
  }
1784
 
1785
+
1786
+ /**
1787
+ * Handle SFW private_records remote call.
1788
+ * @param $action
1789
+ * @return string JSON string of results
1790
+ * @throws Exception
1791
+ */
1792
+ function apbct_sfw_private_records_handler($action, $test_data = null)
1793
+ {
1794
+
1795
+ $error = 'sfw_private_records_handler: ';
1796
+
1797
+ if ( !empty($action) && (in_array($action, array('add', 'delete'))) ) {
1798
+ $metadata = !empty($test_data) ? $test_data : Post::get('metadata');
1799
+
1800
+ if ( !empty($metadata) ) {
1801
+ $metadata = json_decode(stripslashes($metadata), true);
1802
+ if ( $metadata === 'NULL' || $metadata === null ) {
1803
+ throw new InvalidArgumentException($error . 'metadata JSON decoding failed');
1804
+ }
1805
+ } else {
1806
+ throw new InvalidArgumentException($error . 'metadata is empty');
1807
+ }
1808
+
1809
+ foreach ( $metadata as $_key => &$row ) {
1810
+ $row = explode(',', $row);
1811
+ //do this to get info more obvious
1812
+ $metadata_assoc_array = array(
1813
+ 'network' => (int)$row[0],
1814
+ 'mask' => (int)$row[1],
1815
+ 'status' => isset($row[2]) ? (int)$row[2] : null,
1816
+ 'source' => isset($row[3]) ? (int)$row[3] : null
1817
+ );
1818
+ //validate
1819
+ $validation_error = '';
1820
+ if ( $metadata_assoc_array['network'] === 0
1821
+ || $metadata_assoc_array['network'] > 4294967295
1822
+ ) {
1823
+ $validation_error = 'metadata validate failed on "network" value';
1824
+ }
1825
+ if ( $metadata_assoc_array['mask'] === 0
1826
+ || $metadata_assoc_array['mask'] > 4294967295
1827
+ ) {
1828
+ $validation_error = 'metadata validate failed on "mask" value';
1829
+ }
1830
+ //only for adding
1831
+ if ( $action === 'add' ) {
1832
+ if ( $metadata_assoc_array['source'] !== 1
1833
+ ) {
1834
+ $validation_error = 'metadata validate failed on "source" value';
1835
+ }
1836
+ if ( $metadata_assoc_array['status'] !== 1 && $metadata_assoc_array['status'] !== 0 ) {
1837
+ $validation_error = 'metadata validate failed on "status" value';
1838
+ }
1839
+ }
1840
+
1841
+ if ( !empty($validation_error) ) {
1842
+ throw new InvalidArgumentException($error . $validation_error);
1843
+ }
1844
+ $row = $metadata_assoc_array;
1845
+ }
1846
+ unset($row);
1847
+
1848
+ //method selection
1849
+ if ( $action === 'add' ) {
1850
+ $handler_output = SFW::privateRecordsAdd(
1851
+ DB::getInstance(),
1852
+ APBCT_TBL_FIREWALL_DATA,
1853
+ $metadata
1854
+ );
1855
+ } elseif ( $action === 'delete' ) {
1856
+ $handler_output = SFW::privateRecordsDelete(
1857
+ DB::getInstance(),
1858
+ APBCT_TBL_FIREWALL_DATA,
1859
+ $metadata
1860
+ );
1861
+ } else {
1862
+ $error .= 'unknown action name: ' . $action;
1863
+ throw new InvalidArgumentException($error);
1864
+ }
1865
+ } else {
1866
+ throw new InvalidArgumentException($error . 'empty action name');
1867
+ }
1868
+
1869
+ return json_encode(array('OK' => $handler_output));
1870
+ }
1871
+
1872
  function apbct_antiflood__clear_table()
1873
  {
1874
  global $apbct;
2155
  $data['notice_trial'] = $result['trial'];
2156
  $data['auto_update_app'] = isset($result['show_auto_update_notice']) ? $result['show_auto_update_notice'] : 0;
2157
  $data['service_id'] = $result['service_id'];
2158
+ $data['user_id'] = $result['user_id'];
2159
  $data['moderate'] = $result['moderate'];
2160
  $data['auto_update_app '] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
2161
  $data['license_trial'] = isset($result['license_trial']) ? $result['license_trial'] : 0;
2526
 
2527
  // Other
2528
  $apbct->data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
2529
+ $apbct->data['user_id'] = isset($result['user_id']) ? (int)$result['user_id'] : 0;
2530
  $apbct->data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
2531
  $apbct->data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
2532
  $apbct->data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
2558
  return $result;
2559
  }
2560
 
2561
+ function ct_cron_send_connection_report_email()
 
 
 
2562
  {
2563
  global $apbct;
2564
+ $apbct->getConnectionReports()->sendUnsentReports(true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2565
  }
2566
 
2567
  /**
css/cleantalk-admin-settings-page.min.css CHANGED
@@ -1 +1 @@
1
- .apbct_settings-field_content,.apbct_settings-field_title--radio,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%}.apbct_settings-field_title--radio{margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:10px 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#cleantalk-modal-content,.ct_rate_block{text-align:center}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a,i.animate-spin{color:rgba(120,200,230,1)}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;font-size:25px;line-height:20px;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.--invisible{visibility:hidden}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}.apbct_preloader{height:1em;width:1em;margin-left:.5em;display:inline-block}.key_changed_success,.key_changed_sync{font-size:1.5em;line-height:2em;vertical-align:middle}.--upper-case{text-transform:uppercase}#cleantalk-modal-content>*{display:block;width:100%}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:20px}#apbct_settings__after_advanced_settings{margin-bottom:20px}#apbct_settings__button_section{position:fixed;z-index:9999;width:100%;padding-bottom:40px}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}.apbct_highlighted{outline-offset:5px;outline-color:red;outline-width:3px!important;outline-style:solid!important}.apbct_notice_inner{display:flex;margin-top:10px!important}
1
+ .apbct_settings-field_content,.apbct_settings-field_title--radio,.cleantalk_link-auto,.cleantalk_link-manual,.ct-warning-test-failed,.ct_rate_block,.ct_settings_banner,i.animate-spin{display:inline-block}#apbctTopWarning{margin-bottom:5px}#apbctTopWarning h3{margin:10px 0 5px}#apbctTopWarning h4{margin:10px}#apbctTopWarning h4 span{margin-top:5px}.apbct_settings-subtitle{position:relative;top:-15px;margin:0}.apbct_settings-field_wrapper{margin:15px 0}.apbct_settings-field_wrapper--sub{margin-left:30px!important}.apbct_settings__label{margin-right:10px;font-size:17px;vertical-align:text-bottom}.apbct_settings-field_content--radio,.apbct_settings-field_wrapper>.apbct_settings-field_description{width:70%}.apbct_settings-field_title--radio{margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:10px 0 0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#cleantalk-modal-content,.ct_rate_block{text-align:center}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}.apbct_long_desc a,i.animate-spin{color:rgba(120,200,230,1)}i.animate-spin{-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;font-size:25px;line-height:20px;margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}.--invisible{visibility:hidden}.apbct_preloader{height:1em;width:1em;margin-left:.5em;display:inline-block}.key_changed_success,.key_changed_sync{font-size:1.5em;line-height:2em;vertical-align:middle}.--upper-case{text-transform:uppercase}#cleantalk-modal-content>*{display:block;width:100%}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}.apbct-btn-as-link{padding:0;margin:0;vertical-align:baseline;color:gray;border:0;border-bottom:1px solid;cursor:pointer}#apbct-account-email[contenteditable=true]{padding:6px;background-color:#fff;border:1px solid #ccc}button[value=save_changes]:disabled{color:#2271b1;border-color:#2271b1;background:#f6f7f7}#apbct_settings__advanced_settings{position:relative}#apbct_settings__advanced_settings_inner{width:70%}#apbct_hidden_section_nav{position:absolute;top:0;right:20px}#apbct_settings__after_advanced_settings{margin-bottom:20px}#apbct_settings__button_section{position:fixed;z-index:9999;width:100%;padding-bottom:40px}#cleantalk_notice_review .caption{margin:0 0 15px;color:gray}#cleantalk_notice_review .button{margin-bottom:20px}.apbct_highlighted{outline-offset:5px;outline-color:red;outline-width:3px!important;outline-style:solid!important}.apbct_notice_inner{display:flex;margin-top:10px!important}
css/cleantalk-admin.min.css CHANGED
@@ -1 +1 @@
1
- .cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}.apbct-plugin-errors{margin-left:0;margin-bottom:20px}
1
+ .cleantalk_admin_bar__blocked div,:disabled{cursor:not-allowed!important}.apbct_color--gray{color:gray}.apbct_display--none{display:none}.apbct_bottom_links--left{margin-right:2pc}.apbct_bottom_links--other{margin-right:2pc;margin-left:2pc}.ct_translate_links{color:rgba(150,150,20,1)}.ct_support_links{color:rgba(150,20,20,1)}.ct_faq_links{color:rgba(20,150,20,1)}.ct_setting_links{color:rgba(20,20,150,1)}.ct_translate_links:hover{color:rgba(210,210,20,1)!important}.ct_support_links:hover{color:rgba(250,20,20,1)!important}.ct_faq_links:hover{color:rgba(20,250,20,1)!important}.ct_setting_links:hover{color:rgba(20,20,250,1)!important}.ct_link_new_tab img{float:none!important;margin:0 2px;border:0}#negative_reports_table tr td{padding:7px 5px!important}#wp-admin-bar-cleantalk_admin_bar__parent_node{margin-right:5px}#wp-admin-bar-cleantalk_admin_bar__parent_node span{display:inline-block}#wp-admin-bar-cleantalk_admin_bar__parent_node .apbct-icon-attention-alt{background:#d63638;color:#fff;border-radius:50%;font-size:12px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__spbc_icon{width:14px;height:17px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node img.cleantalk_admin_bar__apbct_icon{width:18px;height:18px;margin-top:7px}#wp-admin-bar-cleantalk_admin_bar__parent_node div.cleantalk_admin_bar__sum_counter{color:#999;display:inline;padding:2px 5px!important}.cleantalk_admin_bar__blocked div a{color:#777!important}.cleantalk_admin_bar__title{vertical-align:top}.cleantalk_admin_bar__separator{height:0!important}.cleantalk-admin_bar--list_wrapper .ab-sub-wrapper ul:last-child{margin-bottom:5px!important}.apbct-plugin-errors{margin-left:0;margin-bottom:20px}
css/cleantalk-public.min.css CHANGED
@@ -1 +1 @@
1
- #honeypot-field-url,.um-form input[type=text].apbct_special_field,.wc_apbct_email_id,input[class*=apbct].apbct_special_field{display:none!important}.apbct-tooltip,.apbct-tooltip--text{border-radius:5px;background:#d3d3d3}.comment-form-cookies-consent{width:100%;overflow:hidden}.apbct-email-encoder{position:relative}.apbct-tooltip{display:none;position:inherit;margin-top:5px;left:5px;opacity:.9}.apbct-tooltip--text{position:sticky;padding:10px;width:max-content}.apbct-tooltip--arrow{position:absolute;background:#d3d3d3;width:10px;height:10px;top:-5px;left:10px;transform:rotate(135deg)}
1
+ #honeypot-field-url,.um-form input[type=text].apbct_special_field,.wc_apbct_email_id,input[class*=apbct].apbct_special_field{display:none!important}.apbct-tooltip,.apbct-tooltip--text{border-radius:5px;background:#d3d3d3}.apbct-trusted-text--div,.apbct-trusted-text--label{text-align:center;width:100%}.comment-form-cookies-consent{width:100%;overflow:hidden}.apbct-email-encoder{position:relative}.apbct-tooltip{display:none;position:inherit;margin-top:5px;left:5px;opacity:.9}.apbct-tooltip--text{position:sticky;padding:10px;width:max-content}.apbct-trusted-text--label,.apbct-trusted-text--label_left{font-size:small!important;padding:5px 0;display:inline-block}.apbct-tooltip--arrow{position:absolute;background:#d3d3d3;width:10px;height:10px;top:-5px;left:10px;transform:rotate(135deg)}.apbct-trusted-text--div{font-size:small!important;display:inline-block;margin-bottom:2pc}.apbct-trusted-text--label_left{text-align:left}.apbct-trusted-text--span{display:inline-block}.apbct-popup-fade:before{content:'';background:#000;position:fixed;left:0;top:0;width:100%;height:100%;opacity:.7;z-index:9999}.apbct-popup{position:fixed;top:20%;left:50%;padding:20px;width:360px;margin-left:-200px;background:#fff;border:1px solid;border-radius:4px;z-index:99999;opacity:1}
inc/cleantalk-admin.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
4
  use Cleantalk\ApbctWP\Escape;
5
  use Cleantalk\ApbctWP\Variables\Get;
@@ -1142,6 +1144,51 @@ function apbct_comment__send_feedback(
1142
  }
1143
  }
1144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1145
  /**
1146
  * Ajax action feedback form user page.
1147
  *
1
  <?php
2
 
3
+ use Cleantalk\Antispam\Cleantalk;
4
+ use Cleantalk\Antispam\CleantalkRequest;
5
  use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
6
  use Cleantalk\ApbctWP\Escape;
7
  use Cleantalk\ApbctWP\Variables\Get;
1144
  }
1145
  }
1146
 
1147
+ /**
1148
+ * @param array $spam_ids
1149
+ * @param string $orders_status
1150
+ */
1151
+ function apbct_woocommerce__orders_send_feedback(array $spam_ids, $orders_status = '0')
1152
+ {
1153
+ if (empty($spam_ids)) {
1154
+ return;
1155
+ }
1156
+
1157
+ global $apbct;
1158
+ $request_ids = array();
1159
+ foreach ($spam_ids as $spam_id) {
1160
+ $request_id = get_post_meta($spam_id, 'cleantalk_order_request_id', true);
1161
+ if ($request_id) {
1162
+ $request_ids[] = $request_id . ':' . $orders_status;
1163
+ }
1164
+ }
1165
+
1166
+ if (!empty($request_ids)) {
1167
+ $feedback = implode(';', $request_ids);
1168
+
1169
+ try {
1170
+ $ct_request = new CleantalkRequest(array(
1171
+ // General
1172
+ 'auth_key' => $apbct->api_key,
1173
+ // Additional
1174
+ 'feedback' => $feedback,
1175
+ ));
1176
+
1177
+ $ct = new Cleantalk();
1178
+
1179
+ // Server URL handling
1180
+ $config = ct_get_server();
1181
+ $ct->server_url = APBCT_MODERATE_URL;
1182
+ $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
1183
+ $ct->server_ttl = $config['ct_server_ttl'];
1184
+ $ct->server_changed = $config['ct_server_changed'];
1185
+
1186
+ $ct->sendFeedback($ct_request);
1187
+ } catch (\Exception $e) {
1188
+ }
1189
+ }
1190
+ }
1191
+
1192
  /**
1193
  * Ajax action feedback form user page.
1194
  *
inc/cleantalk-ajax.php CHANGED
@@ -16,9 +16,6 @@ $_cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer
16
 
17
  $_cleantalk_hooked_actions[] = 'ct_feedback_comment';
18
 
19
- /* MailChimp Premium*/
20
- add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
21
-
22
  /*hooks for Usernoise Form*/
23
  add_action('un_feedback_form_body', 'ct_add_hidden_fields', 1);
24
  add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
@@ -237,26 +234,6 @@ function ct_user_register_ajaxlogin($user_id)
237
  return $user_id;
238
  }
239
 
240
- /**
241
- * Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
242
- *
243
- * @param array $errors
244
- *
245
- * @return array
246
- * @throws Exception
247
- */
248
- function ct_mc4wp_ajax_hook(array $errors)
249
- {
250
- $result = ct_ajax_hook();
251
-
252
- // only return modified errors array when function returned a string value (the message key)
253
- if ( is_string($result) ) {
254
- $errors[] = $result;
255
- }
256
-
257
- return $errors;
258
- }
259
-
260
  /**
261
  * Main handler of ajax forms checking
262
  *
16
 
17
  $_cleantalk_hooked_actions[] = 'ct_feedback_comment';
18
 
 
 
 
19
  /*hooks for Usernoise Form*/
20
  add_action('un_feedback_form_body', 'ct_add_hidden_fields', 1);
21
  add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
234
  return $user_id;
235
  }
236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  /**
238
  * Main handler of ajax forms checking
239
  *
inc/cleantalk-common.php CHANGED
@@ -252,9 +252,6 @@ function apbct_base_call($params = array(), $reg_flag = false)
252
  $apbct->stats['last_request']['server'] = $ct->work_url;
253
  $apbct->save('stats');
254
 
255
- // Add a connection report
256
- apbct_add_connection_report($ct, $ct_request, $ct_result);
257
-
258
  if ( $ct->server_change ) {
259
  update_option(
260
  'cleantalk_server',
@@ -268,7 +265,8 @@ function apbct_base_call($params = array(), $reg_flag = false)
268
  $cron->updateTask('rotate_moderate', 'apbct_rotate_moderate', 86400); // Rotate moderate server
269
  }
270
 
271
- $ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
 
272
 
273
  // Restart submit form counter for failed requests
274
  if ( $ct_result->allow == 0 ) {
@@ -289,61 +287,6 @@ function apbct_base_call($params = array(), $reg_flag = false)
289
  return array('ct' => $ct, 'ct_result' => $ct_result);
290
  }
291
 
292
- /**
293
- * Save and rotate connection reports
294
- *
295
- * @param Cleantalk $cleantalk
296
- * @param CleantalkRequest $request
297
- * @param CleantalkResponse $request_response
298
- *
299
- * @return void
300
- */
301
- function apbct_add_connection_report(
302
- Cleantalk $cleantalk,
303
- CleantalkRequest $request,
304
- CleantalkResponse $request_response
305
- ) {
306
- global $apbct;
307
-
308
- // if not defined, reset the connection reports
309
- if ( empty(Helper::arrayObjectToArray($apbct->connection_reports)) ) {
310
- $apbct->drop('connection_reports');
311
- }
312
-
313
- // if not defined, set the gathering connection report start date
314
- if ( empty($apbct->connection_reports['since']) ) {
315
- $apbct->connection_reports['since'] = date('d M');
316
- }
317
-
318
- // Succeeded connection
319
- if ( $request_response->errno === 0 && empty($request_response->errstr) ) {
320
- $apbct->connection_reports['success']++;
321
-
322
- // Failed to connect. Add a negative report
323
- } else {
324
- $apbct->connection_reports['negative']++;
325
- $apbct->connection_reports['negative_report'][] = array(
326
- 'date' => date("Y-m-d H:i:s"),
327
- 'page_url' => get_site_url() . Server::get('REQUEST_URI'),
328
- 'lib_report' => $request_response->errstr,
329
- 'work_url' => $cleantalk->work_url,
330
- 'content' => $request,
331
- 'is_sent' => false
332
- );
333
-
334
- // Rotate negative reports. Save only last 20
335
- if ( count($apbct->connection_reports['negative_report']) > 20 ) {
336
- $apbct->connection_reports['negative_report'] = array_slice(
337
- $apbct->connection_reports['negative_report'],
338
- -20,
339
- 20
340
- );
341
- }
342
- }
343
-
344
- $apbct->save('connection_reports', true, false);
345
- }
346
-
347
  function apbct_rotate_moderate()
348
  {
349
  $ct = new Cleantalk();
@@ -1118,29 +1061,31 @@ function cleantalk_debug($key, $value)
1118
  * Function changes CleanTalk result object if an error occurred.
1119
  * @return object
1120
  */
1121
- function ct_change_plugin_resonse($ct_result = null, $checkjs = null)
1122
  {
1123
  global $apbct;
1124
 
1125
- if ( ! $ct_result ) {
1126
- return $ct_result;
1127
- }
1128
 
1129
- if ( @intval($ct_result->errno) != 0 ) {
1130
- if ( $checkjs === null || $checkjs != 1 ) {
1131
  $ct_result->allow = 0;
1132
- $ct_result->spam = 1;
1133
  $ct_result->comment = sprintf(
1134
  'We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
1135
  $ct_result->comment,
1136
  $apbct->plugin_name
1137
  );
 
1138
  } else {
1139
  $ct_result->allow = 1;
1140
  $ct_result->comment = 'Allow';
1141
  }
1142
  }
1143
 
 
 
 
1144
  return $ct_result;
1145
  }
1146
 
252
  $apbct->stats['last_request']['server'] = $ct->work_url;
253
  $apbct->save('stats');
254
 
 
 
 
255
  if ( $ct->server_change ) {
256
  update_option(
257
  'cleantalk_server',
265
  $cron->updateTask('rotate_moderate', 'apbct_rotate_moderate', 86400); // Rotate moderate server
266
  }
267
 
268
+ //alternative checks and connection report handler
269
+ $ct_result = ct_checks_on_cleantalk_errors($ct_request, $ct_result);
270
 
271
  // Restart submit form counter for failed requests
272
  if ( $ct_result->allow == 0 ) {
287
  return array('ct' => $ct, 'ct_result' => $ct_result);
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  function apbct_rotate_moderate()
291
  {
292
  $ct = new Cleantalk();
1061
  * Function changes CleanTalk result object if an error occurred.
1062
  * @return object
1063
  */
1064
+ function ct_checks_on_cleantalk_errors(CleantalkRequest $ct_request, CleantalkResponse $ct_result)
1065
  {
1066
  global $apbct;
1067
 
1068
+ $post_blocked_via_js_check = false;
 
 
1069
 
1070
+ if ( (int)($ct_result->errno) != 0 ) {
1071
+ if ( $ct_request->js_on === null || $ct_request->js_on != 1 ) {
1072
  $ct_result->allow = 0;
1073
+ $ct_result->spam = '1';
1074
  $ct_result->comment = sprintf(
1075
  'We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
1076
  $ct_result->comment,
1077
  $apbct->plugin_name
1078
  );
1079
+ $post_blocked_via_js_check = true;
1080
  } else {
1081
  $ct_result->allow = 1;
1082
  $ct_result->comment = 'Allow';
1083
  }
1084
  }
1085
 
1086
+ // Add a connection report
1087
+ $apbct->getConnectionReports()->handleRequest($ct_request, $ct_result, $post_blocked_via_js_check);
1088
+
1089
  return $ct_result;
1090
  }
1091
 
inc/cleantalk-public-integrations.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  use Cleantalk\ApbctWP\Helper;
4
  use Cleantalk\ApbctWP\Sanitize;
5
  use Cleantalk\ApbctWP\State;
@@ -482,6 +483,9 @@ function ct_woocommerce_checkout_check($_data, $errors)
482
 
483
  $ct_result = $base_call_result['ct_result'];
484
 
 
 
 
485
  if ( $ct_result->allow == 0 ) {
486
  wp_send_json(array(
487
  'result' => 'failure',
@@ -492,6 +496,19 @@ function ct_woocommerce_checkout_check($_data, $errors)
492
  }
493
  }
494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  /**
496
  * Triggered when adding an item to the shopping cart
497
  * for un-logged users
@@ -637,6 +654,13 @@ function ct_comment_form($_post_id)
637
 
638
  ct_add_hidden_fields();
639
 
 
 
 
 
 
 
 
640
  return null;
641
  }
642
 
@@ -1256,7 +1280,12 @@ function ct_register_form()
1256
 
1257
  ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1258
  echo ct_add_honeypot_field('wp_register');
1259
-
 
 
 
 
 
1260
  return null;
1261
  }
1262
 
@@ -1560,8 +1589,6 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1560
 
1561
  $ct_signup_done = true;
1562
 
1563
- $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1564
-
1565
  $cleantalk_executed = true;
1566
 
1567
  if ( $ct_result->inactive != 0 ) {
@@ -1901,7 +1928,12 @@ function apbct_form__contactForm7__addField($html)
1901
 
1902
  $html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
1903
  $html .= ct_add_honeypot_field('wp_contact_form_7');
1904
-
 
 
 
 
 
1905
  return $html;
1906
  }
1907
 
@@ -2091,7 +2123,8 @@ function apbct_form__ninjaForms__testSpam()
2091
  /**
2092
  * Filter for POST
2093
  */
2094
- $input_array = apply_filters('apbct__filter_post', $_POST);
 
2095
 
2096
  // Choosing between POST and GET
2097
  $params = ct_get_fields_any(
@@ -2305,6 +2338,12 @@ function apbct_form__WPForms__addField($_form_data, $_some, $_title, $_descripti
2305
  if ( $apbct->settings['forms__contact_forms_test'] == 1 ) {
2306
  ct_add_hidden_fields('ct_checkjs_wpforms');
2307
  echo ct_add_honeypot_field('wp_wpforms');
 
 
 
 
 
 
2308
  }
2309
  }
2310
 
@@ -2578,8 +2617,14 @@ function ct_quform_post_validate($result, $form)
2578
  */
2579
  function ct_si_contact_display_after_fields($string = '', $_style = '', $_form_errors = array(), $_form_id_num = 0)
2580
  {
 
2581
  $string .= ct_add_hidden_fields('ct_checkjs', true);
2582
-
 
 
 
 
 
2583
  return $string;
2584
  }
2585
 
@@ -2740,6 +2785,7 @@ function ct_check_wplp()
2740
  */
2741
  function apbct_form__gravityForms__addField($form_string, $form)
2742
  {
 
2743
  $ct_hidden_field = 'ct_checkjs';
2744
 
2745
  // Do not add a hidden field twice.
@@ -2756,6 +2802,12 @@ function apbct_form__gravityForms__addField($form_string, $form)
2756
 
2757
  // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2758
  $append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
 
 
 
 
 
 
2759
  $form_string = str_replace($search, $append_string . $search, $form_string);
2760
 
2761
  return $form_string;
@@ -3583,15 +3635,24 @@ function apbct__wc_add_spam_action_to_bulk_handle($redirect, $action, $ids)
3583
  return $redirect;
3584
  }
3585
 
 
 
 
3586
  foreach ($ids as $order_id) {
3587
  $order = new WC_Order((int)$order_id);
3588
  if ( $action === 'unspamorder' ) {
3589
  $order->update_status('wc-on-hold');
3590
  } else {
 
3591
  $order->update_status('wc-spamorder');
3592
  }
3593
  }
3594
 
 
 
 
 
 
3595
  return add_query_arg(
3596
  array(
3597
  'bulk_action' => 'marked_' . $action,
@@ -3600,3 +3661,15 @@ function apbct__wc_add_spam_action_to_bulk_handle($redirect, $action, $ids)
3600
  $redirect
3601
  );
3602
  }
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ use Cleantalk\ApbctWP\Escape;
4
  use Cleantalk\ApbctWP\Helper;
5
  use Cleantalk\ApbctWP\Sanitize;
6
  use Cleantalk\ApbctWP\State;
483
 
484
  $ct_result = $base_call_result['ct_result'];
485
 
486
+ // Get request_id and save to static $hash
487
+ ct_hash($ct_result->id);
488
+
489
  if ( $ct_result->allow == 0 ) {
490
  wp_send_json(array(
491
  'result' => 'failure',
496
  }
497
  }
498
 
499
+ /**
500
+ * Save request_id for WC order
501
+ * @param $order_id
502
+ */
503
+ function apbct_woocommerce__add_request_id_to_order_meta($order_id)
504
+ {
505
+ $request_id = ct_hash();
506
+
507
+ if (!empty($request_id)) {
508
+ update_post_meta($order_id, 'cleantalk_order_request_id', sanitize_key($request_id));
509
+ }
510
+ }
511
+
512
  /**
513
  * Triggered when adding an item to the shopping cart
514
  * for un-logged users
654
 
655
  ct_add_hidden_fields();
656
 
657
+ if ( $apbct->settings['trusted_and_affiliate__under_forms'] === '1' ) {
658
+ echo Escape::escKsesPreset(
659
+ apbct_generate_trusted_text_html('label'),
660
+ 'apbct_public__trusted_text'
661
+ );
662
+ }
663
+
664
  return null;
665
  }
666
 
1280
 
1281
  ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1282
  echo ct_add_honeypot_field('wp_register');
1283
+ if ( $apbct->settings['trusted_and_affiliate__under_forms'] === '1' ) {
1284
+ echo Escape::escKsesPreset(
1285
+ apbct_generate_trusted_text_html('label'),
1286
+ 'apbct_public__trusted_text'
1287
+ );
1288
+ }
1289
  return null;
1290
  }
1291
 
1589
 
1590
  $ct_signup_done = true;
1591
 
 
 
1592
  $cleantalk_executed = true;
1593
 
1594
  if ( $ct_result->inactive != 0 ) {
1928
 
1929
  $html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
1930
  $html .= ct_add_honeypot_field('wp_contact_form_7');
1931
+ if ( $apbct->settings['trusted_and_affiliate__under_forms'] === '1' ) {
1932
+ $html .= Escape::escKsesPreset(
1933
+ apbct_generate_trusted_text_html('label_left'),
1934
+ 'apbct_public__trusted_text'
1935
+ );
1936
+ }
1937
  return $html;
1938
  }
1939
 
2123
  /**
2124
  * Filter for POST
2125
  */
2126
+ $formData = isset($_POST['formData']) ? json_decode(stripslashes($_POST['formData']), true) : $_POST;
2127
+ $input_array = apply_filters('apbct__filter_post', $formData);
2128
 
2129
  // Choosing between POST and GET
2130
  $params = ct_get_fields_any(
2338
  if ( $apbct->settings['forms__contact_forms_test'] == 1 ) {
2339
  ct_add_hidden_fields('ct_checkjs_wpforms');
2340
  echo ct_add_honeypot_field('wp_wpforms');
2341
+ if ( $apbct->settings['trusted_and_affiliate__under_forms'] === '1' ) {
2342
+ echo Escape::escKsesPreset(
2343
+ apbct_generate_trusted_text_html('label_left'),
2344
+ 'apbct_public__trusted_text'
2345
+ );
2346
+ }
2347
  }
2348
  }
2349
 
2617
  */
2618
  function ct_si_contact_display_after_fields($string = '', $_style = '', $_form_errors = array(), $_form_id_num = 0)
2619
  {
2620
+ global $apbct;
2621
  $string .= ct_add_hidden_fields('ct_checkjs', true);
2622
+ if ( $apbct->settings['trusted_and_affiliate__under_forms'] === '1' ) {
2623
+ $string .= Escape::escKsesPreset(
2624
+ apbct_generate_trusted_text_html('label_left'),
2625
+ 'apbct_public__trusted_text'
2626
+ );
2627
+ }
2628
  return $string;
2629
  }
2630
 
2785
  */
2786
  function apbct_form__gravityForms__addField($form_string, $form)
2787
  {
2788
+ global $apbct;
2789
  $ct_hidden_field = 'ct_checkjs';
2790
 
2791
  // Do not add a hidden field twice.
2802
 
2803
  // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2804
  $append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
2805
+ if ( $apbct->settings['trusted_and_affiliate__under_forms'] === '1' ) {
2806
+ $append_string .= Escape::escKsesPreset(
2807
+ apbct_generate_trusted_text_html('label_left'),
2808
+ 'apbct_public__trusted_text'
2809
+ );
2810
+ }
2811
  $form_string = str_replace($search, $append_string . $search, $form_string);
2812
 
2813
  return $form_string;
3635
  return $redirect;
3636
  }
3637
 
3638
+ // spam orders
3639
+ $spam_ids = array();
3640
+
3641
  foreach ($ids as $order_id) {
3642
  $order = new WC_Order((int)$order_id);
3643
  if ( $action === 'unspamorder' ) {
3644
  $order->update_status('wc-on-hold');
3645
  } else {
3646
+ $spam_ids[] = $order_id;
3647
  $order->update_status('wc-spamorder');
3648
  }
3649
  }
3650
 
3651
+ // Send feedback to API
3652
+ if (!empty($spam_ids)) {
3653
+ apbct_woocommerce__orders_send_feedback($spam_ids);
3654
+ }
3655
+
3656
  return add_query_arg(
3657
  array(
3658
  'bulk_action' => 'marked_' . $action,
3661
  $redirect
3662
  );
3663
  }
3664
+
3665
+ function ct_mc4wp_hook($errors)
3666
+ {
3667
+ $result = apbct_is_ajax() ? ct_ajax_hook() : ct_contact_form_validate();
3668
+
3669
+ // only return modified errors array when function returned a string value (the message key)
3670
+ if ( is_string($result) ) {
3671
+ $errors[] = $result;
3672
+ }
3673
+
3674
+ return $errors;
3675
+ }
inc/cleantalk-public-validate.php CHANGED
@@ -305,6 +305,11 @@ function ct_contact_form_validate()
305
  ),
306
  )
307
  );
 
 
 
 
 
308
  } else {
309
  ct_die(null, null);
310
  }
305
  ),
306
  )
307
  );
308
+ } elseif (
309
+ ! empty(Post::get('_mc4wp_form_id')) &&
310
+ apbct_is_plugin_active('mailchimp-for-wp/mailchimp-for-wp.php')
311
+ ) {
312
+ add_filter('mc4wp_form_messages', 'ct_add_mc4wp_error_message');
313
  } else {
314
  ct_die(null, null);
315
  }
inc/cleantalk-public.php CHANGED
@@ -159,6 +159,7 @@ function apbct_init()
159
  }
160
  if ( $apbct->settings['forms__wc_checkout_test'] == 1 ) {
161
  add_action('woocommerce_after_checkout_validation', 'ct_woocommerce_checkout_check', 1, 2);
 
162
  }
163
 
164
  //Woocommerce add_to_cart action
@@ -330,6 +331,10 @@ function apbct_init()
330
  add_action('wp_footer', 'apbct_hook__wp_footer', 1);
331
  }
332
 
 
 
 
 
333
  if ( $apbct->settings['data__protect_logged_in'] != 1 && is_user_logged_in() ) {
334
  add_action('init', 'ct_contact_form_validate', 999);
335
  }
@@ -366,6 +371,10 @@ function apbct_init()
366
  ) {
367
  ct_contact_form_validate();
368
  }
 
 
 
 
369
  }
370
 
371
  function apbct_buffer__start()
@@ -1530,3 +1539,63 @@ function apbct_shrotcode_handler__GDPR_public_notice__form($attrs)
1530
 
1531
  return '<script ' . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '') . '>' . $out . '</script>';
1532
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
  if ( $apbct->settings['forms__wc_checkout_test'] == 1 ) {
161
  add_action('woocommerce_after_checkout_validation', 'ct_woocommerce_checkout_check', 1, 2);
162
+ add_action('woocommerce_checkout_update_order_meta', 'apbct_woocommerce__add_request_id_to_order_meta');
163
  }
164
 
165
  //Woocommerce add_to_cart action
331
  add_action('wp_footer', 'apbct_hook__wp_footer', 1);
332
  }
333
 
334
+ if ( $apbct->settings['trusted_and_affiliate__footer'] === '1' ) {
335
+ add_action('wp_footer', 'apbct_hook__wp_footer_trusted_text', 999);
336
+ }
337
+
338
  if ( $apbct->settings['data__protect_logged_in'] != 1 && is_user_logged_in() ) {
339
  add_action('init', 'ct_contact_form_validate', 999);
340
  }
371
  ) {
372
  ct_contact_form_validate();
373
  }
374
+
375
+ if ( $apbct->settings['trusted_and_affiliate__shortcode'] === '1' ) {
376
+ add_shortcode('cleantalk_affiliate_link', 'apbct_trusted_text_shortcode_handler');
377
+ }
378
  }
379
 
380
  function apbct_buffer__start()
1539
 
1540
  return '<script ' . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '') . '>' . $out . '</script>';
1541
  }
1542
+
1543
+ /**
1544
+ * Trusted and affiliate text handlers
1545
+ */
1546
+
1547
+ function apbct_hook__wp_footer_trusted_text()
1548
+ {
1549
+ echo Escape::escKsesPreset(apbct_generate_trusted_text_html(), 'apbct_public__trusted_text');
1550
+ }
1551
+
1552
+ function apbct_trusted_text_shortcode_handler()
1553
+ {
1554
+ return apbct_generate_trusted_text_html('span');
1555
+ }
1556
+
1557
+ function apbct_generate_trusted_text_html($type = 'div')
1558
+ {
1559
+ global $apbct;
1560
+
1561
+ $trusted_text = '';
1562
+
1563
+ $query_data = array(
1564
+ 'product_name' => 'anti-spam',
1565
+ );
1566
+
1567
+ if ( $apbct->settings['trusted_and_affiliate__add_id'] === '1'
1568
+ && !empty($apbct->data['user_id']) ) {
1569
+ $query_data['pid'] = $apbct->data['user_id'];
1570
+ }
1571
+
1572
+ $css_class = 'apbct-trusted-text--' . $type;
1573
+ $cleantalk_tag_with_ref_link = '<a href="https://cleantalk.org/register?'
1574
+ . http_build_query($query_data)
1575
+ . '" target="_blank" rel="nofollow">'
1576
+ . 'CleanTalk Anti-Spam'
1577
+ . '</a>';
1578
+
1579
+ if ( $type === 'div' ) {
1580
+ $trusted_text = '<div class="' . $css_class . '">'
1581
+ . '<p>'
1582
+ . 'Protected by '
1583
+ . $cleantalk_tag_with_ref_link
1584
+ . '</p>'
1585
+ . '</div>';
1586
+ }
1587
+ if ( strpos($type, 'label') !== false ) {
1588
+ $trusted_text = '<label for="hidden_trusted_text" type="hidden" class="' . $css_class . '">'
1589
+ . 'Protected by '
1590
+ . $cleantalk_tag_with_ref_link
1591
+ . '</label>'
1592
+ . '<input type="hidden" name="hidden_trusted_text" id="hidden_trusted_text">';
1593
+ }
1594
+ if ( $type === 'span' ) {
1595
+ $trusted_text = '<span class="' . $css_class . '">'
1596
+ . 'Protected by '
1597
+ . $cleantalk_tag_with_ref_link
1598
+ . '</span>';
1599
+ }
1600
+ return $trusted_text;
1601
+ }
inc/cleantalk-settings.php CHANGED
@@ -53,7 +53,7 @@ function apbct_settings_add_page()
53
  );
54
 
55
  $fields = apbct_settings__set_fields();
56
- $fields = APBCT_WPMS && is_main_site() ? apbct_settings__set_fileds__network($fields) : $fields;
57
  apbct_settings__add_groups_and_fields($fields);
58
  }
59
 
@@ -188,11 +188,27 @@ function apbct_settings__set_fields()
188
  'default_params' => array(),
189
  'description' => '',
190
  'html_before' => '<hr><br>'
191
- . '<span id="ct_adv_showhide">'
192
- . '<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'apbct_settings__advanced_settings\');">'
 
 
 
193
  . __('Advanced settings', 'cleantalk-spam-protect')
194
  . '</a>'
195
  . '</span>'
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  . '<div id="apbct_settings__before_advanced_settings"></div>'
197
  . '<div id="apbct_settings__advanced_settings" style="display: none;">'
198
  . '<div id="apbct_settings__advanced_settings_inner">',
@@ -449,13 +465,7 @@ function apbct_settings__set_fields()
449
  . __(
450
  'Alternative mechanism will store data in database and will not set cookies in browser, so the cache solutions will work just fine.',
451
  'cleantalk-spam-protect'
452
- )
453
- . '<br><b>'
454
- . __(
455
- 'Warning: We strongly recommend you keep the setting on, otherwise it could cause false positives spam detection.',
456
- 'cleantalk-spam-protect'
457
- )
458
- . '</b>',
459
  'long_description' => true,
460
  'input_type' => 'radio',
461
  'options' => array(
@@ -800,12 +810,73 @@ function apbct_settings__set_fields()
800
 
801
  ),
802
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
803
  );
804
 
805
  return $fields;
806
  }
807
 
808
- function apbct_settings__set_fileds__network($fields)
809
  {
810
  global $apbct;
811
 
@@ -813,9 +884,9 @@ function apbct_settings__set_fileds__network($fields)
813
  'wpms_settings' => array(
814
  'default_params' => array(),
815
  'description' => '',
816
- 'html_before' => '<br>'
817
  . '<span id="ct_adv_showhide">'
818
- . '<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'apbct_settings__dwpms_settings\');">'
819
  . __('WordPress Multisite (WPMS) settings', 'cleantalk-spam-protect')
820
  . '</a>'
821
  . '</span>'
@@ -1177,11 +1248,14 @@ function apbct_settings__display()
1177
  }
1178
  }
1179
  $hidden_groups .= '</ul>';
1180
- $hidden_groups .= '<div id="apbct_settings__button_section"><button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'
1181
  . __('Save Changes')
1182
  . '</button></div>';
1183
 
1184
  foreach ( $apbct->settings_fields_in_groups as $group_name => $group ) {
 
 
 
1185
  //html_before
1186
  $out = ! empty($group['html_before']) ? $group['html_before'] : '';
1187
  echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
@@ -1198,12 +1272,40 @@ function apbct_settings__display()
1198
  }
1199
 
1200
  $out = ! empty($group['html_after']) ? $group['html_after'] : '';
 
1201
  echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
1202
  }
1203
 
1204
- echo '<div id="apbct_settings__after_advanced_settings"></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1205
 
1206
- echo '<button id="apbct_settings__main_save_button" name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'
1207
  . __('Save Changes')
1208
  . '</button>';
1209
  echo '<br>';
@@ -1353,7 +1455,7 @@ function apbct_settings__error__output($return = false)
1353
  default:
1354
  $icon = '<span class="dashicons dashicons-hammer" style="color: red;"></span>';
1355
  }
1356
- $out .= '<h4>' . $icon . ' ' . Escape::escHtml($value) . '</h4>';
1357
  }
1358
  $out .= ! $apbct->white_label
1359
  ? '<h4 style="text-align: unset;">' . sprintf(
@@ -1831,88 +1933,50 @@ function apbct_settings__field__statistics()
1831
  echo '<br>';
1832
 
1833
  // Connection reports
1834
- if ( $apbct->connection_reports ) {
1835
- // if no negative show nothing
1836
- if ( $apbct->connection_reports['negative'] == 0 ) {
1837
- _e('There are no failed connections to server.', 'cleantalk-spam-protect');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1838
  } else {
1839
- $unsent_reports_count = 0;
1840
- $reports_html = '';
1841
- foreach ( $apbct->connection_reports['negative_report'] as $key => $report ) {
1842
- //count unsent
1843
- if ( isset($report['is_sent']) && !$report['is_sent'] ) {
1844
- $unsent_reports_count++;
1845
- }
1846
- //colorize
1847
- if ( isset($report['is_sent']) && $report['is_sent'] ) {
1848
- $status = 'Sent';
1849
- $color = 'gray';
1850
- } else {
1851
- $status = 'New';
1852
- $color = 'black';
1853
- }
1854
- //draw reports rows
1855
- $reports_html .= '<tr style="color:' . $color . '">'
1856
- . '<td>' . Escape::escHtml($key + 1) . '.</td>'
1857
- . '<td>' . Escape::escHtml($report['date']) . '</td>'
1858
- . '<td>' . Escape::escUrl($report['page_url']) . '</td>'
1859
- . '<td>' . Escape::escHtml($report['lib_report']) . '</td>'
1860
- . '<td>' . Escape::escUrl($report['work_url']) . '</td>'
1861
- . '<td>' . Escape::escHtml($status) . '</td>'
1862
- . '</tr>';
1863
- }
1864
- //draw main report table
1865
- $reports_html = "<table id='negative_reports_table''>
1866
- <th colspan='6'>Failed connection reports</th>
1867
- <tr>
1868
- <td>#</td>
1869
- <td><b>Date</b></td>
1870
- <td><b>Page URL</b></td>
1871
- <td><b>Report</b></td>
1872
- <td><b>Server IP</b></td>
1873
- <td><b>Status</b></td>
1874
- </tr>"
1875
- //attach reports rows
1876
- . $reports_html
1877
- . "</table>"
1878
- . "<br/>";
1879
- //escaping html
1880
- echo Escape::escKses(
1881
- $reports_html,
1882
- array(
1883
- 'tr' => array(
1884
- 'style' => true
1885
- ),
1886
- 'td' => array(),
1887
- 'th' => array(
1888
- 'colspan' => true
1889
- ),
1890
- 'b' => array(),
1891
- 'br' => array(),
1892
- 'table' => array(
1893
- 'id' => true
1894
- ),
1895
- )
1896
- );
1897
- //if no unsent reports show caption, in another case show the button
1898
- if ( $unsent_reports_count === 0 ) {
1899
- _e('All the reports already have been sent.', 'cleantalk-spam-protect');
1900
- } else {
1901
- echo '<button'
1902
- . ' name="submit"'
1903
- . ' class="cleantalk_link cleantalk_link-manual"'
1904
- . ' value="ct_send_connection_report"'
1905
- . (! $apbct->settings['misc__send_connection_reports'] ? ' disabled="disabled"' : '')
1906
- . '>'
1907
- . __('Send new report', 'cleantalk-spam-protect')
1908
- . '</button>';
1909
- if ( ! $apbct->settings['misc__send_connection_reports'] ) {
1910
- echo '<br><br>';
1911
- _e(
1912
- 'Please, enable "Send connection reports" setting to be able to send reports',
1913
- 'cleantalk-spam-protect'
1914
- );
1915
- }
1916
  }
1917
  }
1918
  }
@@ -1995,7 +2059,6 @@ function apbct_settings__field__draw($params = array())
1995
  ( ! $apbct->network_settings['multisite__allow_custom_settings'] || $apbct->network_settings['multisite__work_mode'] == 2 )
1996
  ? ' disabled="disabled"'
1997
  : $disabled; // Disabled by super admin on sub-sites
1998
-
1999
  $childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---", $params['childrens']) : '';
2000
  $hide = $params['hide'] ? implode(",", $params['hide']) : '';
2001
  //ESC NEED
@@ -2029,6 +2092,8 @@ function apbct_settings__field__draw($params = array())
2029
  . $params['title']
2030
  . '</label>'
2031
  . $popup;
 
 
2032
  echo '<div class="apbct_settings-field_description">'
2033
  . $params['description']
2034
  . '</div>';
@@ -2155,6 +2220,33 @@ function apbct_settings__field__draw($params = array())
2155
  . '</div>';
2156
  break;
2157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2158
  // Textarea type
2159
  case 'textarea':
2160
  //ESC NEED
@@ -2344,8 +2436,7 @@ function apbct_settings__validate($settings)
2344
 
2345
  // Send connection reports
2346
  if ( Post::get('submit') === 'ct_send_connection_report' ) {
2347
- ct_mail_send_connection_report();
2348
-
2349
  return $settings;
2350
  }
2351
 
@@ -2383,6 +2474,7 @@ function apbct_settings__validate($settings)
2383
  'auto_update' => $apbct->data['auto_update'],
2384
  'user_token' => $apbct->data['user_token'],
2385
  'service_id' => $apbct->data['service_id'],
 
2386
  );
2387
  $apbct->saveNetworkData();
2388
  if ( isset($settings['multisite__use_settings_template_apply_for_current_list_sites'])
@@ -2488,6 +2580,7 @@ function apbct_settings__sync($direct_call = false)
2488
  'auto_update' => $apbct->data['auto_update'],
2489
  'user_token' => $apbct->data['user_token'],
2490
  'service_id' => $apbct->data['service_id'],
 
2491
  );
2492
 
2493
  if ( $apbct->network_settings['multisite__work_mode'] == 1 ) {
@@ -2516,6 +2609,7 @@ function apbct_settings__sync($direct_call = false)
2516
 
2517
  // Other
2518
  $apbct->data['service_id'] = 0;
 
2519
  $apbct->data['valid'] = 0;
2520
  $apbct->data['moderate'] = 0;
2521
  $apbct->data['ip_license'] = 0;
@@ -3024,4 +3118,11 @@ function apbct_settings__custom_logo()
3024
  </div>
3025
  </div>
3026
  <?php
 
 
 
 
 
 
 
3027
  }
53
  );
54
 
55
  $fields = apbct_settings__set_fields();
56
+ $fields = APBCT_WPMS && is_main_site() ? apbct_settings__set_fields__network($fields) : $fields;
57
  apbct_settings__add_groups_and_fields($fields);
58
  }
59
 
188
  'default_params' => array(),
189
  'description' => '',
190
  'html_before' => '<hr><br>'
191
+ . '<span id="ct_adv_showhide" class="apbct_bottom_links--left">'
192
+ . '<a href="#" class="apbct_color--gray" onclick="'
193
+ . 'event.preventDefault();'
194
+ . 'apbct_excepted_show_hide(\'apbct_settings__advanced_settings\');'
195
+ . '">'
196
  . __('Advanced settings', 'cleantalk-spam-protect')
197
  . '</a>'
198
  . '</span>'
199
+ . '<span class="apbct_bottom_links--other">'
200
+ . '<a href="#" class="apbct_color--gray" onclick="cleantalkModal.open()">'
201
+ . __('Import/Export settings', 'cleantalk-spam-protect')
202
+ . '</a>'
203
+ . '</span>'
204
+ . '<span id="ct_trusted_text_showhide" class="apbct_bottom_links--other">'
205
+ . '<a href="#" class="apbct_color--gray" onclick="'
206
+ . 'event.preventDefault();'
207
+ . 'apbct_excepted_show_hide(\'trusted_and_affiliate__special_span\');'
208
+ . '">'
209
+ . __('Trust text, affiliate settings', 'cleantalk-spam-protect')
210
+ . '</a>'
211
+ . '</span>'
212
  . '<div id="apbct_settings__before_advanced_settings"></div>'
213
  . '<div id="apbct_settings__advanced_settings" style="display: none;">'
214
  . '<div id="apbct_settings__advanced_settings_inner">',
465
  . __(
466
  'Alternative mechanism will store data in database and will not set cookies in browser, so the cache solutions will work just fine.',
467
  'cleantalk-spam-protect'
468
+ ),
 
 
 
 
 
 
469
  'long_description' => true,
470
  'input_type' => 'radio',
471
  'options' => array(
810
 
811
  ),
812
  ),
813
+
814
+ // Trust text, affiliate settings
815
+ 'trusted_and_affiliate' => array(
816
+ 'title' => __('Trust text, affiliate settings', 'cleantalk-spam-protect'),
817
+ //'section' => 'hidden_section',
818
+ 'fields' => array(
819
+ 'trusted_and_affiliate__shortcode' => array(
820
+ 'title' => __('Shortcode', 'cleantalk-spam-protect'),
821
+ 'description' => __(
822
+ 'You can place this shortcode anywhere on your website. Adds trust text stating that the website is protected from spam by CleanTalk Anti-Spam protection',
823
+ 'cleantalk-spam-protect'
824
+ ),
825
+ 'childrens' => array('trusted_and_affiliate__shortcode_tag'),
826
+ 'reverse_trigger' => true,
827
+ 'type' => 'checkbox'
828
+ ),
829
+ 'trusted_and_affiliate__shortcode_tag' => array(
830
+ 'type' => 'affiliate_shortcode',
831
+ 'title' => __('<- Copy this text and place shortcode wherever you need.', 'cleantalk-spam-protect'),
832
+ 'parent' => 'trusted_and_affiliate__shortcode',
833
+ 'class' => 'apbct_settings-field_wrapper--sub',
834
+ 'disabled' => 'test'
835
+ ),
836
+ 'trusted_and_affiliate__footer' => array(
837
+ 'title' => __('Add to the footer', 'cleantalk-spam-protect'),
838
+ 'description' => __(
839
+ 'Adds trust text stating that the website is protected from spam by CleanTalk Anti-Spam protection to the footer of your website.',
840
+ 'cleantalk-spam-protect'
841
+ ),
842
+ 'parent' => '',
843
+ //'class' => 'apbct_settings-field_wrapper--sub',
844
+ 'reverse_trigger' => true,
845
+ 'type' => 'checkbox'
846
+ ),
847
+ 'trusted_and_affiliate__under_forms' => array(
848
+ 'title' => __(
849
+ 'Add under forms.',
850
+ 'cleantalk-spam-protect'
851
+ ),
852
+ 'description' => __(
853
+ 'Adds trust text stating that the website is protected from spam by CleanTalk Anti-Spam protection under web form on your website.',
854
+ 'cleantalk-spam-protect'
855
+ ),
856
+ 'reverse_trigger' => true,
857
+ 'type' => 'checkbox'
858
+ ),
859
+ 'trusted_and_affiliate__add_id' => array(
860
+ 'title' => __(
861
+ 'Add your affiliate ID to the link placed in the trust text.',
862
+ 'cleantalk-spam-protect'
863
+ ),
864
+ 'description' => __(
865
+ 'If you check this option or checkbox, then your affiliate ID will be added to the referral link. Terms of the {CT_AFFILIATE_TERMS}.',
866
+ 'cleantalk-spam-protect'
867
+ ),
868
+ 'reverse_trigger' => false,
869
+ 'type' => 'checkbox'
870
+ )
871
+ ),
872
+ ),
873
+
874
  );
875
 
876
  return $fields;
877
  }
878
 
879
+ function apbct_settings__set_fields__network($fields)
880
  {
881
  global $apbct;
882
 
884
  'wpms_settings' => array(
885
  'default_params' => array(),
886
  'description' => '',
887
+ 'html_before' => '<br><hr><br>'
888
  . '<span id="ct_adv_showhide">'
889
+ . '<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_excepted_show_hide(\'apbct_settings__dwpms_settings\');">'
890
  . __('WordPress Multisite (WPMS) settings', 'cleantalk-spam-protect')
891
  . '</a>'
892
  . '</span>'
1248
  }
1249
  }
1250
  $hidden_groups .= '</ul>';
1251
+ $hidden_groups .= '<div id="apbct_settings__button_section"><button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes" onclick="apbct_show_required_groups(event,\'apbct_settings__button_section\')">'
1252
  . __('Save Changes')
1253
  . '</button></div>';
1254
 
1255
  foreach ( $apbct->settings_fields_in_groups as $group_name => $group ) {
1256
+ if ( $group_name === 'trusted_and_affiliate' ) {
1257
+ continue;
1258
+ }
1259
  //html_before
1260
  $out = ! empty($group['html_before']) ? $group['html_before'] : '';
1261
  echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
1272
  }
1273
 
1274
  $out = ! empty($group['html_after']) ? $group['html_after'] : '';
1275
+
1276
  echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
1277
  }
1278
 
1279
+ echo '<div id="apbct_settings__after_advanced_settings">';
1280
+ /**
1281
+ * Affiliate section start
1282
+ */
1283
+ $group = $apbct->settings_fields_in_groups['trusted_and_affiliate'];
1284
+ //html_before
1285
+ $out = ! empty($group['html_before']) ? $group['html_before'] : '';
1286
+ echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
1287
+
1288
+ //title
1289
+ $out = ! empty($group['title']) ? '<h3 style="margin-left: 220px;" id="apbct_setting_group__' . $group_name . '">' . $group['title'] . '</h3>' : '';
1290
+ $out = '<span id="trusted_and_affiliate__special_span" style="display: none">' . $out;
1291
+ echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
1292
+
1293
+ do_settings_fields('cleantalk', 'apbct_section__trusted_and_affiliate');
1294
+
1295
+ //html_after
1296
+ if ( ! empty($group['html_after']) && strpos($group['html_after'], '{HIDDEN_SECTION_NAV}') !== false ) {
1297
+ $group['html_after'] = str_replace('{HIDDEN_SECTION_NAV}', $hidden_groups, $group['html_after']);
1298
+ }
1299
+
1300
+ $out = ! empty($group['html_after']) ? $group['html_after'] : '';
1301
+ $out .= '</span>';
1302
+ echo Escape::escKsesPreset($out, 'apbct_settings__display__groups');
1303
+ /**
1304
+ * Affiliate end
1305
+ */
1306
+ echo '</div>';
1307
 
1308
+ echo '<button id="apbct_settings__main_save_button" name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes" onclick="apbct_show_required_groups(event,\'apbct_settings__main_save_button\')">'
1309
  . __('Save Changes')
1310
  . '</button>';
1311
  echo '<br>';
1455
  default:
1456
  $icon = '<span class="dashicons dashicons-hammer" style="color: red;"></span>';
1457
  }
1458
+ $out .= '<h4>' . $icon . ' ' . apbct_render_links_to_tag($value) . '</h4>';
1459
  }
1460
  $out .= ! $apbct->white_label
1461
  ? '<h4 style="text-align: unset;">' . sprintf(
1933
  echo '<br>';
1934
 
1935
  // Connection reports
1936
+ $connection_reports = $apbct->getConnectionReports();
1937
+ if ( ! $connection_reports->hasNegativeReports() ) {
1938
+ _e('There are no failed connections to server.', 'cleantalk-spam-protect');
1939
+ } else {
1940
+ $reports_html = $connection_reports->prepareNegativeReportsHtmlForSettingsPage();
1941
+ //escaping and echoing html
1942
+ echo Escape::escKses(
1943
+ $reports_html,
1944
+ array(
1945
+ 'tr' => array(
1946
+ 'style' => true
1947
+ ),
1948
+ 'td' => array(),
1949
+ 'th' => array(
1950
+ 'colspan' => true
1951
+ ),
1952
+ 'b' => array(),
1953
+ 'br' => array(),
1954
+ 'div' => array(
1955
+ 'id' => true
1956
+ ),
1957
+ 'table' => array(
1958
+ 'id' => true
1959
+ ),
1960
+ )
1961
+ );
1962
+ //if no unsent reports show caption, in another case show the button
1963
+ if ( ! $connection_reports->hasUnsentReports() ) {
1964
+ _e('All the reports already have been sent.', 'cleantalk-spam-protect');
1965
  } else {
1966
+ echo '<button'
1967
+ . ' name="submit"'
1968
+ . ' class="cleantalk_link cleantalk_link-manual"'
1969
+ . ' value="ct_send_connection_report"'
1970
+ . (! $apbct->settings['misc__send_connection_reports'] ? ' disabled="disabled"' : '')
1971
+ . '>'
1972
+ . __('Send new report', 'cleantalk-spam-protect')
1973
+ . '</button>';
1974
+ if ( ! $apbct->settings['misc__send_connection_reports'] ) {
1975
+ echo '<br><br>';
1976
+ _e(
1977
+ 'Please, enable "Send connection reports" setting to be able to send reports',
1978
+ 'cleantalk-spam-protect'
1979
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980
  }
1981
  }
1982
  }
2059
  ( ! $apbct->network_settings['multisite__allow_custom_settings'] || $apbct->network_settings['multisite__work_mode'] == 2 )
2060
  ? ' disabled="disabled"'
2061
  : $disabled; // Disabled by super admin on sub-sites
 
2062
  $childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---", $params['childrens']) : '';
2063
  $hide = $params['hide'] ? implode(",", $params['hide']) : '';
2064
  //ESC NEED
2092
  . $params['title']
2093
  . '</label>'
2094
  . $popup;
2095
+ $href = '<a href="https://cleantalk.org/my/partners" target="_blank">affiliate program are here</a>';
2096
+ $params['description'] = str_replace('{CT_AFFILIATE_TERMS}', $href, $params['description']);
2097
  echo '<div class="apbct_settings-field_description">'
2098
  . $params['description']
2099
  . '</div>';
2220
  . '</div>';
2221
  break;
2222
 
2223
+ // Text type
2224
+ case 'affiliate_shortcode':
2225
+ // Popup description
2226
+ $popup = '';
2227
+ if ( isset($params['long_description']) ) {
2228
+ $popup = '<i setting="' . $params['name'] . '" class="apbct_settings-long_description---show apbct-icon-help-circled"></i>';
2229
+ }
2230
+ //ESC NEED
2231
+ echo '<input
2232
+ type="text"
2233
+ id="apbct_setting_' . $params['name'] . '"
2234
+ name="cleantalk_settings[' . $params['name'] . ']"'
2235
+ . " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
2236
+ . ' value="[cleantalk_affiliate_link]" '
2237
+ . "readonly"
2238
+ . ($params['required'] ? ' required="required"' : '')
2239
+ . ($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
2240
+ . ' />'
2241
+ . '&nbsp;'
2242
+ . '<label for="apbct_setting_' . $params['name'] . '" class="apbct_setting-field_title--' . $params['type'] . '">'
2243
+ . $params['title'] . $popup
2244
+ . '</label>';
2245
+ echo '<div class="apbct_settings-field_description">'
2246
+ . $params['description']
2247
+ . '</div>';
2248
+ break;
2249
+
2250
  // Textarea type
2251
  case 'textarea':
2252
  //ESC NEED
2436
 
2437
  // Send connection reports
2438
  if ( Post::get('submit') === 'ct_send_connection_report' ) {
2439
+ $apbct->getConnectionReports()->sendUnsentReports();
 
2440
  return $settings;
2441
  }
2442
 
2474
  'auto_update' => $apbct->data['auto_update'],
2475
  'user_token' => $apbct->data['user_token'],
2476
  'service_id' => $apbct->data['service_id'],
2477
+ 'user_id' => $apbct->data['user_id'],
2478
  );
2479
  $apbct->saveNetworkData();
2480
  if ( isset($settings['multisite__use_settings_template_apply_for_current_list_sites'])
2580
  'auto_update' => $apbct->data['auto_update'],
2581
  'user_token' => $apbct->data['user_token'],
2582
  'service_id' => $apbct->data['service_id'],
2583
+ 'user_id' => $apbct->data['user_id'],
2584
  );
2585
 
2586
  if ( $apbct->network_settings['multisite__work_mode'] == 1 ) {
2609
 
2610
  // Other
2611
  $apbct->data['service_id'] = 0;
2612
+ $apbct->data['user_id'] = 0;
2613
  $apbct->data['valid'] = 0;
2614
  $apbct->data['moderate'] = 0;
2615
  $apbct->data['ip_license'] = 0;
3118
  </div>
3119
  </div>
3120
  <?php
3121
+ }
3122
+
3123
+ function apbct_render_links_to_tag($value)
3124
+ {
3125
+ $pattern = "/(https?:\/\/[^\s]+)/";
3126
+ $value = preg_replace($pattern, '<a target="_blank" href="$1">$1</a>', $value);
3127
+ return Escape::escKsesPreset($value, 'apbct_settings__display__notifications');
3128
  }
inc/cleantalk-updater.php CHANGED
@@ -1174,3 +1174,23 @@ function apbct_update_to_5_184_2()
1174
  $apbct->saveSettings();
1175
  }
1176
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1174
  $apbct->saveSettings();
1175
  }
1176
  }
1177
+
1178
+ function apbct_update_to_6_0_0()
1179
+ {
1180
+ global $apbct;
1181
+ if ( isset($apbct->data['connection_reports']) ) {
1182
+ unset($apbct->data['connection_reports']);
1183
+ $apbct->save('data');
1184
+ }
1185
+
1186
+ delete_option('cleantalk_connection_reports');
1187
+
1188
+ $cron = new Cron();
1189
+ $cron->removeTask('send_connection_report');
1190
+ $cron->addTask(
1191
+ 'send_connection_report',
1192
+ 'ct_cron_send_connection_report_email',
1193
+ 86400,
1194
+ time() + 3500
1195
+ );
1196
+ }
js/apbct-public--3--cleantalk-modal.min.js CHANGED
@@ -1,2 +1,2 @@
1
- let 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,t="";for(e in this.styles)t+=e+":"+this.styles[e]+";";return t}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},n={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},a={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},o={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},l={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},d={styles:{overflow:"hidden"},toString:e},i=document.createElement("style"),d=(i.setAttribute("id","cleantalk-modal-styles"),i.innerHTML="body.cleantalk-modal-opened{"+d+"}",i.innerHTML+="#cleantalk-modal-overlay{"+t+"}",i.innerHTML+="#cleantalk-modal-close{"+a+"}",i.innerHTML+="#cleantalk-modal-close:before{"+o+"}",i.innerHTML+="#cleantalk-modal-close:after{"+l+"}",document.body.append(i),document.createElement("div")),t=(d.setAttribute("id","cleantalk-modal-overlay"),document.body.append(d),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),a=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",n),d.append(t),document.createElement("div")),o=(a.setAttribute("id","cleantalk-modal-close"),t.append(a),document.createElement("div"));this.loaded?o.innerHTML=this.loaded:(o.innerHTML="Loading...",this.load("get_options_template")),o.setAttribute("id","cleantalk-modal-content"),t.append(o),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}};document.addEventListener("click",function(e){(e.target&&"cleantalk-modal-overlay"===e.target.id||"cleantalk-modal-close"===e.target.id)&&cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
  //# sourceMappingURL=apbct-public--3--cleantalk-modal.min.js.map
1
+ let cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){var t;this.loaded||(this.loading=!0,t=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:t,notJson:!0}))},open:function(){function e(){var e,t="";for(e in this.styles)t+=e+":"+this.styles[e]+";";return t}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?/.*\/inc/g.test(this.loaded)?o.innerHTML=this.loaded:(l=this.loaded.replace(/(https?:\/\/[^\s]+)/g,'<a href="$1" target="_blank">$1</a>'),o.innerHTML=l):(o.innerHTML="Loading...",this.load("get_options_template")),o.setAttribute("id","cleantalk-modal-content"),t.append(o),this.opened=!0},close:function(){document.body.classList.remove("cleantalk-modal-opened"),document.getElementById("cleantalk-modal-overlay").remove(),document.getElementById("cleantalk-modal-styles").remove(),document.dispatchEvent(new CustomEvent("cleantalkModalClosed",{bubbles:!0}))}};document.addEventListener("click",function(e){!e.target||"cleantalk-modal-overlay"!==e.target.id&&"cleantalk-modal-close"!==e.target.id||cleantalkModal.close()}),document.addEventListener("cleantalkModalContentLoaded",function(e){cleantalkModal.opened&&cleantalkModal.loaded&&(document.getElementById("cleantalk-modal-content").innerHTML=cleantalkModal.loaded)});
2
  //# sourceMappingURL=apbct-public--3--cleantalk-modal.min.js.map
js/apbct-public--3--cleantalk-modal.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public--3--cleantalk-modal.min.js","sources":["apbct-public--3--cleantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\nlet cleantalkModal = {\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 ( let 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":["let","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","key","cssStr","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,IAAIC,eAAiB,CAGjBC,OAAQ,CAAA,EACRC,QAAS,CAAA,EACTC,OAAQ,CAAA,EACRC,QAAS,CAAA,EAGTC,KAAM,SAAUC,GACNC,KAAKN,SACPM,KAAKL,QAAU,CAAA,EACfM,SAAW,SAAUC,EAAQC,EAAMC,EAAQC,GACvCZ,eAAeE,QAAU,CAAA,EACzBF,eAAeC,OAASQ,EACxBI,SAASC,cACL,IAAIC,YAAa,8BAA+B,CAC5CC,QAAS,CAAA,CACb,CAAE,CACN,CACJ,GACoC,YAAhC,OAAOC,qBACPA,qBAEAC,uBAFsB,CAAEZ,OAAWA,CAAO,EAAG,CAAEE,SAAYA,SAAUW,QAAW,CAAA,CAAK,CAAE,EAMnG,EAEAC,KAAM,WAEc,SAAZC,IACA,IACUC,EADNC,EAAS,GACb,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,OAExF,CAAC"}
1
+ {"version":3,"file":"apbct-public--3--cleantalk-modal.min.js","sources":["apbct-public--3--cleantalk-modal.js"],"sourcesContent":["/* Cleantalk Modal object */\nlet cleantalkModal = {\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 let 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 ( let 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 var urlRegex = /(https?:\\/\\/[^\\s]+)/g;\n var service_content_regex = /.*\\/inc/g;\n if (service_content_regex.test(this.loaded)){\n content.innerHTML = this.loaded\n } else {\n var renderedMsg = this.loaded.replace(urlRegex, '<a href=\"$1\" target=\"_blank\">$1</a>');\n content.innerHTML = renderedMsg;\n }\n\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":["let","cleantalkModal","loaded","loading","opened","opening","load","action","callback","this","result","data","params","obj","document","dispatchEvent","CustomEvent","bubbles","apbct_admin_sendAJAX","apbct_public_sendAJAX","notJson","open","renderCss","key","cssStr","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","test","renderedMsg","replace","remove","getElementById","addEventListener","e","target","id"],"mappings":"AACAA,IAAIC,eAAiB,CA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AuB,GAEtC0C,EAAQQ,aAAc,KAAM,yBAA0B,EACtDI,EAAMD,OAAQX,CAAQ,EAEtBvC,KAAKL,OAAS,CAAA,CAClB,EAEA2D,MAAO,WACHjD,SAAS4C,KAAKG,UAAUM,OAAQ,wBAAyB,EACzDrD,SAASsD,eAAgB,yBAA0B,EAAED,OAAO,EAC5DrD,SAASsD,eAAgB,wBAAyB,EAAED,OAAO,EAC3DrD,SAASC,cACL,IAAIC,YAAa,uBAAwB,CACrCC,QAAS,CAAA,CACb,CAAE,CACN,CACJ,CAEJ,EAGAH,SAASuD,iBAAiB,QAAQ,SAAUC,GACpCA,CAAAA,EAAEC,QAA2B,4BAAhBD,EAAEC,OAAOC,IAAoD,0BAAhBF,EAAEC,OAAOC,IACnEvE,eAAe8D,MAAM,CAE7B,CAAC,EACDjD,SAASuD,iBAAiB,8BAA+B,SAAUC,GAC3DrE,eAAeG,QAAUH,eAAeC,SACxCY,SAASsD,eAAgB,yBAA0B,EAAEX,UAAYxD,eAAeC,OAExF,CAAC"}
js/apbct-public-bundle.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,i,r=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(r.push(n.value),!t||r.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw i}}return r}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(o){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(o);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var o,n,i,r,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(o=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){n=!0,i=e},f:function(){try{o||null==a.return||a.return()}finally{if(n)throw i}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,o){return t&&_defineProperties(e.prototype,t),o&&_defineProperties(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var ApbctCore=function(){function t(e){_classCallCheck(this,t),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"rest_parameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(e)}return _createClass(t,[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t|=!1,"object"===_typeof(e)){for(var o in e)for(var n=o.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),i=0;i<this.elements.length;i++)this.elements[i].style[n]=e[o];return this}var r;if("string"==typeof e)return void 0!==(r=getComputedStyle(this.elements[0])[e])&&!t&&(r=r.replace(/(\d)(em|pt|%|px){1,2}$/,"$1"),Number(r)==r)?Number(r):r}},{key:"hide",value:function(){this.prop("prev-display",this.css("display")),this.css({display:"none"})}},{key:"show",value:function(){this.css({display:this.prop("prev-display")})}},{key:"addClass",value:function(){for(var e=0;e<this.elements.length;e++)this.elements[e].classList.add(className)}},{key:"removeClass",value:function(){for(var e=0;e<this.elements.length;e++)this.elements[e].classList.remove(className)}},{key:"toggleClass",value:function(e){for(var t=0;t<this.elements.length;t++)this.elements[t].classList.toggle(e)}},{key:"ajax",value:function(e){return this.ajax_parameters=e,new ApbctAjax(e)}},{key:"rest",value:function(e){return this.rest_parameters=e,new ApbctRest(e)}},{key:"on",value:function(){this.event=arguments.length<=0?void 0:arguments[0],this.eventCallback=(arguments.length<=2?void 0:arguments[2])||(arguments.length<=1?void 0:arguments[1]),this.eventSelector="string"==typeof(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:null;for(var e=0;e<this.elements.length;e++)this.elements[e].addEventListener(this.event,null!==this.eventSelector?this.onChecker.bind(this):this.eventCallback)}},{key:"onChecker",value:function(e){if(e.target===document.querySelector(this.eventSelector))return e.stopPropagation(),this.eventCallback(e)}},{key:"ready",value:function(e){document.addEventListener("DOMContentLoaded",e)}},{key:"change",value:function(e){this.on("change",e)}},{key:"attr",value:function(e){for(var t=[],o=0;o<this.elements.length;o++)void 0!==_typeof(this.elements[o][e])?t.push(this.elements[o][e]):t.push(this.elements[o].getAttribute(e));return 1===t.length?t[0]:t}},{key:"prop",value:function(e,t){if(void 0!==t){for(var o=0;o<this.elements.length;o++)this.elements[o][e]=t;return this}for(var n=[],i=0;i<this.elements.length;i++)n.push(this.elements[i][e]);return 1===n.length?n[0]:n}},{key:"html",value:function(e){return void 0!==e?this.prop("innerHTML",e):this.prop("innerHTML")}},{key:"val",value:function(e){return void 0!==e?this.prop("value",e):this.prop("value")}},{key:"data",value:function(e,t){return void 0!==t?this.prop("apbct-data",e,t):this.prop("apbct-data")}},{key:"is",value:function(e){var t,o=!1,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)var i=t.value,o=o||this.isElem(i,e)}catch(e){n.e(e)}finally{n.f()}return o}},{key:"isElem",value:function(e,t){var o=!1;return"function"==typeof t&&(o=o||t.call(this,e)),o="string"==typeof t?t.match(/^[a-z]/)&&function(e){e=document.createElement(e).constructor;return!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))}(t)?o||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||Boolean(e[t]):o||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):o}},{key:"isWithoutSelector",value:function(e,t){var o,n=!1,i=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(i.s();!(o=i.n()).done;)var r=o.value,n=n||e===r}catch(e){i.e(e)}finally{i.f()}return n}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.after(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"append",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.append(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"fadeIn",value:function(n){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)!function(){var t=e.value,o=(t.style.opacity=0,t.style.display="block",+new Date);(function e(){t.style.opacity=+t.style.opacity+(new Date-o)/n,o=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))})()}()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(n){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)!function(){var t=e.value,o=(t.style.opacity=1,+new Date);(function e(){t.style.opacity=+t.style.opacity-(new Date-o)/n,o=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"})()}()}catch(e){t.e(e)}finally{t.f()}}}]),t}();function apbct(e){return(new ApbctCore).select(e)}var ApbctXhr=function(){function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),console.log("%cXHR%c started","color: red; font-weight: bold;","color: grey; font-weight: normal;"),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"error",value:function(e,t,o){var n="";"timeout"===t?n+="Server response timeout":200===e?"parsererror"===t?n+="Unexpected response from server. See console for details.":(n+="Unexpected error. Status: "+t+".",void 0!==o&&(n+=" Additional error info: "+o)):n+=500===e?"Internal server error.":"Unexpected response code:"+e,this.errorOutput(n)}},{key:"errorOutput",value:function(e){console.log("%c ctXHR error: %c"+e,"color: red;","color: grey;")}},{key:"setHeaders",value:function(){for(var e in this.headers)void 0!==this.headers[e]&&this.xhr.setRequestHeader(e,this.headers[e])}},{key:"convertData",value:function(){return~this.methods_to_convert_data_to_URL.indexOf(this.method)?this.convertDataToURL():this.convertDataToBody()}},{key:"convertDataToURL",value:function(){var e=new URLSearchParams(this.data).toString(),t=this.url.match(/^(https?:\/{2})?[a-z0-9.]+\?/)?"&":"?";return this.url+=t+e,this.url}},{key:"convertDataToBody",value:function(){for(var e in this.body=new FormData,this.data)this.body.append(e,"object"===_typeof(this.data[e])?JSON.stringify(this.data[e]):this.data[e]);return this.body}},{key:"deleteDoubleJSONEncoding",value:function(e){if("object"===_typeof(e))for(var t in e){var o;"object"===_typeof(e[t])&&(e[t]=this.deleteDoubleJSONEncoding(e[t])),"string"==typeof e[t]&&null!==e[t].match(/^[\[{].*?[\]}]$/)&&"object"===_typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}}]),o}(),ApbctAjax=function(){_inherits(t,ApbctXhr);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.call(this,arguments.length<=0?void 0:arguments[0])}return _createClass(t)}(),ApbctRest=function(){_inherits(r,ApbctXhr);var i=_createSuper(r);function r(){for(var e,t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return _classCallCheck(this,r),(o=o[0]).url=r.default_route+o.route,o.headers={"X-WP-Nonce":ctPublicFunctions._rest_nonce},_defineProperty(_assertThisInitialized(e=i.call(this,o)),"route",""),e}return _createClass(r)}();function ctSetCookie(e,t,o){var n,i,r=["ct_sfw_pass_key","ct_sfw_passed","wordpress_apbct_antibot","apbct_anticrawler_passed","apbct_antiflood_passed"];("string"==typeof e&&"string"==typeof t||"number"==typeof t)&&(n="ct_pointer_data"===e,e=[[e,t,o]]),"none"===ctPublicFunctions.data__cookies_type?(i=[],e.forEach(function(e,t,o){-1!==r.indexOf(e[0])?i.push(e):apbctLocalStorage.set(e[0],encodeURIComponent(e[1]))}),0<i.length&&ctSetAlternativeCookie(i),ctNoCookieAttachHiddenFieldsToForms()):"native"===ctPublicFunctions.data__cookies_type?e.forEach(function(e,t,o){var n=void 0!==e[2]?"expires="+n+"; ":"",i="https:"===location.protocol?"; secure":"";document.cookie=ctPublicFunctions.cookiePrefix+e[0]+"="+encodeURIComponent(e[1])+"; "+n+"path=/; samesite=lax"+i}):"alternative"!==ctPublicFunctions.data__cookies_type||n||ctSetAlternativeCookie(e)}function ctSetAlternativeCookie(e){"function"==typeof getJavascriptClientData?e=getJavascriptClientData(e):console.log("APBCT ERROR: getJavascriptClientData() is not loaded");try{JSON.parse(e)}catch(e){return void console.log("APBCT ERROR: JSON parse error:"+e)}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:e}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:e},{notJson:1})}function ctGetCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ctDeleteCookie(e){var t;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(t="https:"===location.protocol?"; secure":"",document.cookie=e+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+t):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(e,t,o){var n=[];n.callback=t.callback||null,n.onErrorCallback=t.onErrorCallback||null,n.callback_context=t.callback_context||null,n.callback_params=t.callback_params||null,n.async=t.async||!0,n.notJson=t.notJson||null,n.timeout=t.timeout||15e3,n.obj=o||null,n.button=t.button||null,n.progressbar=t.progressbar||null,n.silent=t.silent||null,n.no_nonce=t.no_nonce||null,n.data=e,n.url=ctPublicFunctions._ajax_url,"string"==typeof e?(n.no_nonce||(n.data=n.data+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce),n.data=n.data+"&no_cache="+Math.random()):(n.no_nonce||(n.data._ajax_nonce=ctPublicFunctions._ajax_nonce),n.data.no_cache=Math.random()),(new ApbctCore).ajax(n)}function apbct_public_sendREST(e,t){var o=[];o.route=e,o.callback=t.callback||null,o.onErrorCallback=t.onErrorCallback||null,o.data=t.data||[],o.method=t.method||"POST",(new ApbctCore).rest(o)}_defineProperty(ApbctRest,"default_route",ctPublicFunctions._rest_url+"cleantalk-antispam/v1/");var apbctLocalStorage={get:function(t,e){void 0===e&&(e="value");t=localStorage.getItem(t);if(null!==t)try{var o=JSON.parse(t);return o.hasOwnProperty(e)?JSON.parse(o[e]):o}catch(e){return t}return!1},set:function(e,t){var o;!(2<arguments.length&&void 0!==arguments[2])||arguments[2]?(o={value:JSON.stringify(t),timestamp:Math.floor((new Date).getTime()/1e3)},localStorage.setItem(e,JSON.stringify(o))):localStorage.setItem(e,t)},isAlive:function(e,t){return void 0===t&&(t=86400),this.get(e,"timestamp")+t>Math.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t<localStorage.length;t++){var o=localStorage.key(t);-1===o.indexOf("ct_")&&-1===o.indexOf("apbct_")||(e[o.toString()]=apbctLocalStorage.get(o))}return e}},ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0,ctCheckedEmails={};function apbct_attach_event_handler(e,t,o){"function"==typeof window.addEventListener?e.addEventListener(t,o):e.attachEvent(t,o)}function apbct_remove_event_handler(e,t,o){"function"==typeof window.removeEventListener?e.removeEventListener(t,o):e.detachEvent(t,o)}var ctMouseReadInterval,ctMouseWriteDataInterval,ctFunctionFirstKey=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctFunctionMouseMove=(ctPublic.data__key_is_ok&&(ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(ctMouseData))},1200)),function(e){ctSetMouseMoved(),!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter)&&ctMouseStopData()});function ctMouseStopData(){apbct_remove_event_handler(document,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(document,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(document,"keydown",ctFunctionFirstKey)}function checkEmail(e){var t=e.target.value;!t||t in ctCheckedEmails||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}))}function ctSetPixelImg(e){var t;ctSetCookie("apbct_pixel_url",e),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")&&((t=document.createElement("img")).setAttribute("alt","CleanTalk Pixel"),t.setAttribute("id","apbct_pixel"),t.setAttribute("style","display: none; left: 99999px;"),t.setAttribute("src",e),apbct("body").append(t))}function ctGetPixelUrl(){var e=apbctLocalStorage.get("apbct_pixel_url");if(!1!==e){if(!apbctLocalStorage.isAlive("apbct_pixel_url",10800))return void ctSetPixelImg(e);apbctLocalStorage.delete("apbct_pixel_url")}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(e){e&&(apbctLocalStorage.get("apbct_pixel_url")||(apbctLocalStorage.set("apbct_pixel_url",e),ctNoCookieAttachHiddenFieldsToForms()),ctSetPixelImg(e))}}):apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{notJson:!0,callback:function(e){e&&(apbctLocalStorage.get("apbct_pixel_url")||(apbctLocalStorage.set("apbct_pixel_url",e),ctNoCookieAttachHiddenFieldsToForms()),ctSetPixelImg(e))}})}function ctSetHasScrolled(){apbctLocalStorage.isSet("ct_has_scrolled")&&apbctLocalStorage.get("ct_has_scrolled")||(ctSetCookie("ct_has_scrolled","true"),apbctLocalStorage.set("ct_has_scrolled",!0))}function ctSetMouseMoved(){apbctLocalStorage.isSet("ct_mouse_moved")&&apbctLocalStorage.get("ct_mouse_moved")||(ctSetCookie("ct_mouse_moved","true"),apbctLocalStorage.set("ct_mouse_moved",!0))}function ctPreloadLocalStorage(){ctPublic.data__to_local_storage&&Object.entries(ctPublic.data__to_local_storage).forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];apbctLocalStorage.set(t,e)})}function apbct_ready(){ctPreloadLocalStorage();var e=apbctLocalStorage.get("ct_cookies_type"),e=(e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled")),[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",ct_date.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["apbct_headless",navigator.webdriver]]);if(apbctLocalStorage.set("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),apbctLocalStorage.set("ct_fkp_timestamp","0"),apbctLocalStorage.set("ct_pointer_data","0"),apbctLocalStorage.set("ct_timezone",ct_date.getTimezoneOffset()/60*-1),apbctLocalStorage.set("ct_screen_info",apbctGetScreenInfo()),apbctLocalStorage.set("apbct_headless",navigator.webdriver),"native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var o=0;o<t.length;o++){var n=t[o].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?ctGetPixelUrl():e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),apbct("input[type = 'email'], #email").on("blur",checkEmail)),apbctLocalStorage.isSet("ct_checkjs")?e.push(["ct_checkjs",apbctLocalStorage.get("ct_checkjs")]):e.push(["ct_checkjs",0]),ctSetCookie(e),setTimeout(function(){ctNoCookieAttachHiddenFieldsToForms();for(var e=0;e<document.forms.length;e++){var t,o,n=document.forms[e];0==+ctPublic.data__visible_fields_required||"get"===n.method.toString().toLowerCase()||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("sac-form")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||n.name&&-1!==n.name.toString().indexOf("tribe-bar-form")||((t=document.createElement("input")).setAttribute("type","hidden"),t.setAttribute("id","apbct_visible_fields_"+e),t.setAttribute("name","apbct_visible_fields"),(o={})[0]=apbct_collect_visible_fields(n),t.value=btoa(JSON.stringify(o)),n.append(t),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=e,n.onsubmit=function(e){var t;"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&((t={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t,e.target.ctFormIndex)),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}},1e3);var i=document.querySelectorAll("[data-original-string]");if(i.length)for(var r=0;r<i.length;++r)i[r].parentElement.href||i[r].parentElement.parentElement.href||i[r].addEventListener("click",ctFillDecodedEmailHandler)}function ctFillDecodedEmailHandler(e){this.removeEventListener("click",ctFillDecodedEmailHandler),apbctAjaxEmailDecode(e,this)}function apbctAjaxEmailDecode(e,t){var o=e.target,n={event_javascript_data:getJavascriptClientData(),post_url:document.location.href,referrer:document.referrer},i=(void 0!==t.href&&0===t.href.indexOf("mailto:")&&e.preventDefault(),o.setAttribute("title",ctPublicFunctions.text__wait_for_decoding),o.style.cursor="progress",document.createElement("div")),r=(i.setAttribute("class","apbct-tooltip"),document.createElement("div")),a=(r.setAttribute("class","apbct-tooltip--text"),document.createElement("div")),r=(a.setAttribute("class","apbct-tooltip--arrow"),apbct(o).append(i),apbct(i).append(r),apbct(i).append(a),ctShowDecodeComment(o,ctPublicFunctions.text__wait_for_decoding),e.target.dataset.originalString);void 0!==t.href&&0===t.href.indexOf("mailto:")&&(r=t.dataset.originalString),n.encodedEmail=r,"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_decode_email",{data:n,method:"POST",callback:function(e){apbctEmailEncoderCallback(e,t,o)},onErrorCallback:function(e){o.addEventListener("click",ctFillDecodedEmailHandler),o.removeAttribute("style"),ctShowDecodeComment(o,"Error occurred: "+e)}}):(n.action="apbct_decode_email",apbct_public_sendAJAX(n,{notJson:!0,callback:function(e){apbctEmailEncoderCallback(e,t,o)},onErrorCallback:function(e){o.addEventListener("click",ctFillDecodedEmailHandler),o.removeAttribute("style"),ctShowDecodeComment(o,"Error occurred: "+e)}}))}function apbctEmailEncoderCallback(e,t,o){var n,i;e.success?void 0!==t.href&&0===t.href.indexOf("mailto:")?(n=t.href.replace("mailto:",""),i=t.innerHTML,t.innerHTML=i.replace(n,e.data.decoded_email),t.href="mailto:"+e.data.decoded_email,t.click()):setTimeout(function(){ctProcessDecodedDataResult(e.data,o)},3e3):(o.removeAttribute("style"),ctShowDecodeComment(o,e.data.comment))}function getJavascriptClientData(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t={},o=(t.apbct_headless=!!ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_headless"),t.apbct_pixel_url=ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_pixel_url"),t.ct_checked_emails=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checked_emails"),t.ct_checkjs=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checkjs"),t.ct_fkp_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_fkp_timestamp"),t.ct_pointer_data=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_pointer_data"),t.ct_ps_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_ps_timestamp"),t.ct_screen_info=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_screen_info"),t.ct_timezone=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_timezone"),apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_mouse_moved")),n=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),i=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_cookies_type"),r=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_mouse_moved"),a=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),c=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_cookies_type");if(t.ct_mouse_moved=void 0!==o?o:r,t.ct_has_scrolled=void 0!==n?n:a,t.ct_cookies_type=void 0!==i?i:c,"object"===_typeof(e)&&e!==[])for(var l=0;l<e.length;++l)"object"===_typeof(e[l][1])?t[e[l][1][0]]=e[l][1][1]:t[e[l][0]]=e[l][1];else console.log("APBCT JS ERROR: Collecting data type mismatch");return t=removeDoubleJsonEncoding(t),JSON.stringify(t)}function removeDoubleJsonEncoding(e){if("object"===_typeof(e))for(var t in e){var o;"object"===_typeof(e[t])&&(e[t]=removeDoubleJsonEncoding(e[t])),"string"==typeof e[t]&&null!==e[t].match(/^[\[{].*?[\]}]$/)&&"object"===_typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),e.is_allowed&&ctFillDecodedEmail(t,e.decoded_email),e.show_comment&&ctShowDecodeComment(t,e.comment)}function ctFillDecodedEmail(e,t){apbct(e).html(apbct(e).html().replace(/.+?(<div class=["']apbct-tooltip["'].+?<\/div>)/,t+"$1"))}function ctShowDecodeComment(e,t){t&&(apbct(e.getElementsByClassName("apbct-tooltip")).fadeIn(300),apbct(e.getElementsByClassName("apbct-tooltip--text")).html(t),setTimeout(function(){apbct(e.getElementsByClassName("apbct-tooltip")).fadeOut(700)},5e3))}function apbct_collect_visible_fields(e){var t,o=[],n="",i=0,r="",a=0,c=[];for(t in e.elements)isNaN(+t)||(o[t]=e.elements[t]);return(o=o.filter(function(e){return-1===c.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(c.push(e.getAttribute("name")),!1))})).forEach(function(e,t,o){"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&"ct_checkjs"!==e.getAttribute("name")&&("none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")||e.classList.contains("wp-editor-area")?(n+=" "+e.getAttribute("name"),i++):(r+=" "+e.getAttribute("name"),a++))}),r=r.trim(),{visible_fields:n=n.trim(),visible_fields_count:i,invisible_fields:r,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(e,t){var o="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(o[n]))}else"none"===ctPublic.data__cookies_type?ctSetCookie("apbct_visible_fields",JSON.stringify(o[0])):ctSetCookie("apbct_visible_fields",JSON.stringify(o))}function apbct_js_keys__set_input_value(e,t,o,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var i=document.querySelectorAll("[name^=ct_checkjs]"),r=0;r<i.length;r++)i[r].value=e.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}function ctParseBlockMessage(e){void 0!==e.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()}function ctSetPixelUrlLocalstorage(e){ctSetCookie("apbct_pixel_url",e)}function ctNoCookieConstructHiddenField(){var e="",t=apbctLocalStorage.getCleanTalkData(),t=JSON.stringify(t);return t=btoa(t),(e=document.createElement("input")).setAttribute("id","ct_no_cookie_hidden_field"),e.setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",t),e.setAttribute("type","hidden"),e}function ctNoCookieGetForms(){var e=document.forms;return e||!1}function ctNoCookieAttachHiddenFieldsToForms(){if("none"===ctPublic.data__cookies_type){var e=ctNoCookieGetForms();if(e){var t=document.getElementsByName("ct_no_cookie_hidden_field");if(t)for(var o=0;o<t.length;o++)t[o].parentNode.removeChild(t[o]);for(var n=0;n<e.length;n++)null!==document.forms[n].getAttribute("method")&&"post"!==document.forms[n].getAttribute("method").toLowerCase()||document.forms[n].append(ctNoCookieConstructHiddenField())}}}ctPublic.data__key_is_ok&&(apbct_attach_event_handler(document,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(document,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(document,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(document,"scroll",ctSetHasScrolled)),ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbct_ready():apbct_attach_event_handler(document,"DOMContentLoaded",apbct_ready)),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,o){if(t.responseText&&-1!==t.responseText.indexOf('"apbct')){try{var n=JSON.parse(t.responseText)}catch(e){return void console.log(e.toString())}ctParseBlockMessage(n)}});var cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){this.loaded||(this.loading=!0,callback=function(e,t,o,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:callback,notJson:!0}))},open:function(){function e(){var e,t="";for(e in this.styles)t+=e+":"+this.styles[e]+";";return t}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},o={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},i={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},r={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},a={styles:{overflow:"hidden"},toString:e},c=document.createElement("style"),a=(c.setAttribute("id","cleantalk-modal-styles"),c.innerHTML="body.cleantalk-modal-opened{"+a+"}",c.innerHTML+="#cleantalk-modal-overlay{"+t+"}",c.innerHTML+="#cleantalk-modal-close{"+n+"}",c.innerHTML+="#cleantalk-modal-close:before{"+i+"}",c.innerHTML+="#cleantalk-modal-close:after{"+r+"}",document.body.append(c),document.createElement("div")),t=(a.setAttribute("id","cleantalk-modal-overlay"),document.body.append(a),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),n=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",o),a.append(t),document.createElement("div")),i=(n.setAttribute("id","cleantalk-modal-close"),t.append(n),document.createElement("div"));this.loaded?i.innerHTML=this.loaded:(i.innerHTML="Loading...",this.load("get_options_template")),i.setAttribute("id","cleantalk-modal-content"),t.append(i),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}))}},buttons_to_handle=(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)}),[]);function apbct_gdpr_handle_buttons(){try{buttons_to_handle!==[]&&buttons_to_handle.forEach(function(e){var t='[id="apbct_gdpr_'+e.index+'"]',t=jQuery(t);jQuery(t).prop("checked")?(e.button.disabled=!1,jQuery(e.button).prop("title",e.old_notice)):(e.button.disabled=!0,jQuery(e.button).prop("title",gdpr_notice_for_button))})}catch(e){console.info("APBCT GDPR JS ERROR: Can not handle form buttons "+e)}}function ct_protect_external(){for(var e,t,o=0;o<document.forms.length;o++)void 0===document.forms[o].cleantalk_hidden_action&&void 0===document.forms[o].cleantalk_hidden_method&&"string"==typeof(e=document.forms[o]).action&&(isIntegratedForm(e)?apbctProcessExternalForm(e,o,document):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((t=document.createElement("input")).name="cleantalk_hidden_action",t.value=e.action,t.type="hidden",e.appendChild(t),(t=document.createElement("input")).name="cleantalk_hidden_method",t.value=e.method,t.type="hidden",e.method="POST",e.appendChild(t),e.action=document.location));apbctProcessIframes()}function formIsExclusion(t){var o=!1;return t.parentElement&&0<t.parentElement.classList.length&&-1!==t.parentElement.classList[0].indexOf("mewtwo")&&(o=!0),["give-form"].forEach(function(e){void 0!==t.id&&-1!==t.id.indexOf(e)&&(o=!0)}),o}function apbctProcessIframes(){var e=document.getElementsByTagName("iframe");if(0<e.length)for(var t=0;t<e.length;t++)if(null!=e[t].contentDocument){var o=e[t].contentDocument.forms;if(0===o.length)return;for(var n=0;n<o.length;n++)apbctProcessExternalForm(o[n],n,e[t].contentDocument)}}function apbctProcessExternalForm(e,n,i){var t,o,r,a,c;formIsExclusion(e)||((t=document.createElement("i")).className="cleantalk_placeholder",t.style="display: none",e.parentElement.insertBefore(t,e),t=e.previousSibling,r=e.outerHTML,(o=e).parentElement.removeChild(e),(e=document.createElement("div")).innerHTML=r,t.after(e.firstElementChild),(r=document.createElement("input")).name="action",r.value="cleantalk_force_ajax_check",r.type="hidden",(a=i.forms[n]).appendChild(r),a.apbctPrev=t,a.apbctFormOriginal=o,c=!1,void 0!==a.classList&&["newsletterform","ml-block-form"].forEach(function(e){a.classList.contains(e)&&(c=e)}),c?void 0!==(e=jQuery("form."+c).find('button[type="submit"]'))&&e.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(e.currentTarget)}):i.forms[n].onsubmit=function(e){var t,o;e.preventDefault(),-1!==i.forms[n].id.indexOf("mauticform")&&0<(t=jQuery(i.forms[n]).find('input[id*="checkbox_rgpd"]')).length&&!0===t.prop("checked")&&0<(o=jQuery(".cleantalk_placeholder")).length&&o[0].setAttribute("mautic_hidden_gdpr_id",t.prop("id")),jQuery(e.currentTarget).prev(),jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget)})}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),o=jQuery(t).find("button, input, textarea, select");e.each(function(e,n){var i=jQuery(n);o.each(function(e,t){var o=jQuery(t);n.outerHTML===t.outerHTML&&o.val(i.val())})})}function isIntegratedForm(e){var t=e.action,o=e.id;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com")||-1!==t.indexOf("sendfox.com")||-1!==t.indexOf("aweber.com")||-1!==t.indexOf("secure.payu.com")||-1!==t.indexOf("mautic")||-1!==o.indexOf("mauticform_"))}function sendAjaxCheckingFormData(d,e,t){var o={},n=(o[0]=apbct_collect_visible_fields(d),apbct_visible_fields_set_cookie(o),{}),o=d.elements;(o=Array.prototype.slice.call(o)).forEach(function(e,t){""===e.name?n["input_"+t]=e.value:n[e.name]=e.value}),apbct_public_sendAJAX(n,{async:!1,callback:function(e,t,o,n){if(void 0===e.apbct||!+e.apbct.blocked){var i=jQuery(d).detach(),r=d.apbctPrev,a=d.apbctFormOriginal,c=!1,l=(apbct_replace_inputs_values_from_other_form(i,a),-1!==a.id.indexOf("mautic")&&(c=!0),document.getElementsByClassName("cleantalk_placeholder"));if(l)for(var s=0;s<l.length;s++){var u=l[s].getAttribute("mautic_hidden_gdpr_id");void 0!==u&&void 0!==(u=jQuery(a).find("#"+u))&&u.prop("checked",!0)}r.after(a),jQuery(a).find('input[name="apbct_visible_fields"]').remove(),jQuery(a).find('input[value="cleantalk_force_ajax_check"]').remove();i=jQuery(a).find("button[type=submit]");if(0!==i.length)return i[0].click(),void(c&&setTimeout(function(){ct_protect_external()},1500));if(0!==(i=jQuery(a).find("input[type=submit]")).length)return void i[0].click();if(0!==(i=jQuery(a).find('button[data-element="submit"]')).length)return void i[0].click();0!==(i=jQuery(a).find('input[type="image"][name="submit"]')).length&&i[0].click()}void 0!==e.apbct&&+e.apbct.blocked&&ctParseBlockMessage(e)}})}function ct_check_internal(t){var e,o={},n=t.elements;for(e in n)"submit"!=n[e].type&&null!=n[e].value&&""!=n[e].value&&(o[n[e].name]=t.elements[e].value);o.action="ct_check_internal",apbct_public_sendAJAX(o,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.submit()}})}function ct_check_internal__is_exclude_form(t){return["wp-login.php","wp-comments-post.php"].some(function(e){return null!==t.match(new RegExp(ctPublic.blog_home+".*"+e))})}document.addEventListener("DOMContentLoaded",function(){if("undefined"!=typeof ctPublicGDPR&&ctPublicGDPR.gdpr_forms.length){var i=ctPublicGDPR.gdpr_title;if("undefined"!=typeof jQuery)try{ctPublicGDPR.gdpr_forms.forEach(function(e,t){var o=jQuery("#"+e+", ."+e),e=(o.is("form")||(o.find("form")[0]?o=o.children("form").first():jQuery(".wpcf7[role=form]")[0]&&-1!==jQuery(".wpcf7[role=form]").attr("id").indexOf("wpcf7-f"+e)?o=jQuery(".wpcf7[role=form]").children("form"):jQuery(".frm_forms")[0]&&-1!==jQuery(".frm_forms").first().attr("id").indexOf("frm_form_"+e)?o=jQuery(".frm_forms").first().children("form"):jQuery(".wpforms-form")[0]&&-1!==jQuery(".wpforms-form").first().attr("id").indexOf("wpforms-form-"+e)&&(o=jQuery(".wpforms-form"))),!1),n=o.find('input[type|="submit"],button[type|="submit"]');n.length&&(!1!==(e=n[0])&&(e.disabled=!0,n=jQuery(e).prop("title")?jQuery(e).prop("title"):"",buttons_to_handle.push({index:t,button:e,old_notice:n}),jQuery(e).prop("title",i)),!o.is("form")&&"form"!==o.attr("role")||o.append('<input id="apbct_gdpr_'+t+'" type="checkbox" required="required" style=" margin-right: 10px;" onchange="apbct_gdpr_handle_buttons()">').append('<label style="display: inline;" for="apbct_gdpr_'+t+'">'+ctPublicGDPR.gdpr_text+"</label>"))})}catch(e){console.info("APBCT GDPR JS ERROR: Can not add GDPR notice"+e)}}}),window.onload=function(){+ctPublic.settings__forms__check_external&&"undefined"!=typeof jQuery&&setTimeout(function(){ct_protect_external()},1500)},document.addEventListener("DOMContentLoaded",function(){var e,t="";if(+ctPublic.settings__forms__check_internal)for(var o=0;o<document.forms.length;o++)"string"!=typeof document.forms[o].action||null===(t=(e=document.forms[o]).action).indexOf("https?://")||null===t.match(ctPublic.blog_home+".*?.php")||ct_check_internal__is_exclude_form(t)||(e.click,"undefined"!=typeof jQuery&&(jQuery(e).off("**"),jQuery(e).off(),jQuery(e).on("submit",function(e){return ct_check_internal(e.target),!1})))});
1
+ "use strict";function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,i,a=[],r=!0,c=!1;try{for(o=o.call(e);!(r=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);r=!0);}catch(e){c=!0,i=e}finally{try{r||null==o.return||o.return()}finally{if(c)throw i}}return a}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(o){var n=_isNativeReflectConstruct();return function(){var e,t=_getPrototypeOf(o);return _possibleConstructorReturn(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var o,n,i,a,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return n=!(o=!0),{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){n=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(n)throw i}}};if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,o){return t&&_defineProperties(e.prototype,t),o&&_defineProperties(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var ApbctCore=function(){function t(e){_classCallCheck(this,t),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"rest_parameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(e)}return _createClass(t,[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t|=!1,"object"===_typeof(e)){for(var o in e)for(var n=o.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),i=0;i<this.elements.length;i++)this.elements[i].style[n]=e[o];return this}var a;if("string"==typeof e)return void 0!==(a=getComputedStyle(this.elements[0])[e])&&!t&&(a=a.replace(/(\d)(em|pt|%|px){1,2}$/,"$1"),Number(a)==a)?Number(a):a}},{key:"hide",value:function(){this.prop("prev-display",this.css("display")),this.css({display:"none"})}},{key:"show",value:function(){this.css({display:this.prop("prev-display")})}},{key:"addClass",value:function(){for(var e=0;e<this.elements.length;e++)this.elements[e].classList.add(className)}},{key:"removeClass",value:function(){for(var e=0;e<this.elements.length;e++)this.elements[e].classList.remove(className)}},{key:"toggleClass",value:function(e){for(var t=0;t<this.elements.length;t++)this.elements[t].classList.toggle(e)}},{key:"ajax",value:function(e){return this.ajax_parameters=e,new ApbctAjax(e)}},{key:"rest",value:function(e){return this.rest_parameters=e,new ApbctRest(e)}},{key:"on",value:function(){this.event=arguments.length<=0?void 0:arguments[0],this.eventCallback=(arguments.length<=2?void 0:arguments[2])||(arguments.length<=1?void 0:arguments[1]),this.eventSelector="string"==typeof(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:null;for(var e=0;e<this.elements.length;e++)this.elements[e].addEventListener(this.event,null!==this.eventSelector?this.onChecker.bind(this):this.eventCallback)}},{key:"onChecker",value:function(e){if(e.target===document.querySelector(this.eventSelector))return e.stopPropagation(),this.eventCallback(e)}},{key:"ready",value:function(e){document.addEventListener("DOMContentLoaded",e)}},{key:"change",value:function(e){this.on("change",e)}},{key:"attr",value:function(e){for(var t=[],o=0;o<this.elements.length;o++)void 0!==_typeof(this.elements[o][e])?t.push(this.elements[o][e]):t.push(this.elements[o].getAttribute(e));return 1===t.length?t[0]:t}},{key:"prop",value:function(e,t){if(void 0!==t){for(var o=0;o<this.elements.length;o++)this.elements[o][e]=t;return this}for(var n=[],i=0;i<this.elements.length;i++)n.push(this.elements[i][e]);return 1===n.length?n[0]:n}},{key:"html",value:function(e){return void 0!==e?this.prop("innerHTML",e):this.prop("innerHTML")}},{key:"val",value:function(e){return void 0!==e?this.prop("value",e):this.prop("value")}},{key:"data",value:function(e,t){return void 0!==t?this.prop("apbct-data",e,t):this.prop("apbct-data")}},{key:"is",value:function(e){var t,o=!1,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)var i=t.value,o=o||this.isElem(i,e)}catch(e){n.e(e)}finally{n.f()}return o}},{key:"isElem",value:function(e,t){var o=!1;return"function"==typeof t&&(o=o||t.call(this,e)),o="string"==typeof t?t.match(/^[a-z]/)&&function(e){e=document.createElement(e).constructor;return!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))}(t)?o||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||Boolean(e[t]):o||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):o}},{key:"isWithoutSelector",value:function(e,t){var o,n=!1,i=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(i.s();!(o=i.n()).done;)var a=o.value,n=n||e===a}catch(e){i.e(e)}finally{i.f()}return n}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.after(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"append",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.append(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"fadeIn",value:function(n){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)!function(){var t=e.value,o=(t.style.opacity=0,t.style.display="block",+new Date);(function e(){t.style.opacity=+t.style.opacity+(new Date-o)/n,o=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))})()}()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(n){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)!function(){var t=e.value,o=(t.style.opacity=1,+new Date);(function e(){t.style.opacity=+t.style.opacity-(new Date-o)/n,o=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"})()}()}catch(e){t.e(e)}finally{t.f()}}}]),t}();function apbct(e){return(new ApbctCore).select(e)}var ApbctXhr=function(){function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),console.log("%cXHR%c started","color: red; font-weight: bold;","color: grey; font-weight: normal;"),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"error",value:function(e,t,o){var n="";"timeout"===t?n+="Server response timeout":200===e?"parsererror"===t?n+="Unexpected response from server. See console for details.":(n+="Unexpected error. Status: "+t+".",void 0!==o&&(n+=" Additional error info: "+o)):n+=500===e?"Internal server error.":"Unexpected response code:"+e,this.errorOutput(n)}},{key:"errorOutput",value:function(e){console.log("%c ctXHR error: %c"+e,"color: red;","color: grey;")}},{key:"setHeaders",value:function(){for(var e in this.headers)void 0!==this.headers[e]&&this.xhr.setRequestHeader(e,this.headers[e])}},{key:"convertData",value:function(){return~this.methods_to_convert_data_to_URL.indexOf(this.method)?this.convertDataToURL():this.convertDataToBody()}},{key:"convertDataToURL",value:function(){var e=new URLSearchParams(this.data).toString(),t=this.url.match(/^(https?:\/{2})?[a-z0-9.]+\?/)?"&":"?";return this.url+=t+e,this.url}},{key:"convertDataToBody",value:function(){for(var e in this.body=new FormData,this.data)this.body.append(e,"object"===_typeof(this.data[e])?JSON.stringify(this.data[e]):this.data[e]);return this.body}},{key:"deleteDoubleJSONEncoding",value:function(e){if("object"===_typeof(e))for(var t in e){var o;"object"===_typeof(e[t])&&(e[t]=this.deleteDoubleJSONEncoding(e[t])),"string"==typeof e[t]&&null!==e[t].match(/^[\[{].*?[\]}]$/)&&"object"===_typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}}]),o}(),ApbctAjax=function(){_inherits(t,ApbctXhr);var e=_createSuper(t);function t(){return _classCallCheck(this,t),e.call(this,arguments.length<=0?void 0:arguments[0])}return _createClass(t)}(),ApbctRest=function(){_inherits(a,ApbctXhr);var i=_createSuper(a);function a(){for(var e,t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return _classCallCheck(this,a),(o=o[0]).url=a.default_route+o.route,o.headers={"X-WP-Nonce":ctPublicFunctions._rest_nonce},_defineProperty(_assertThisInitialized(e=i.call(this,o)),"route",""),e}return _createClass(a)}();function ctSetCookie(e,t,o){var n,i,a=["ct_sfw_pass_key","ct_sfw_passed","wordpress_apbct_antibot","apbct_anticrawler_passed","apbct_antiflood_passed","apbct_email_encoder_passed"];("string"==typeof e&&"string"==typeof t||"number"==typeof t)&&(n="ct_pointer_data"===e,e=[[e,t,o]]),"none"===ctPublicFunctions.data__cookies_type?(i=[],e.forEach(function(e,t,o){-1!==a.indexOf(e[0])?i.push(e):apbctLocalStorage.set(e[0],encodeURIComponent(e[1]))}),0<i.length&&ctSetAlternativeCookie(i),ctNoCookieAttachHiddenFieldsToForms()):"native"===ctPublicFunctions.data__cookies_type?e.forEach(function(e,t,o){var n=void 0!==e[2]?"expires="+n+"; ":"",i="https:"===location.protocol?"; secure":"";document.cookie=ctPublicFunctions.cookiePrefix+e[0]+"="+encodeURIComponent(e[1])+"; "+n+"path=/; samesite=lax"+i}):"alternative"!==ctPublicFunctions.data__cookies_type||n||ctSetAlternativeCookie(e)}function ctSetAlternativeCookie(e){"function"==typeof getJavascriptClientData?e=getJavascriptClientData(e):console.log("APBCT ERROR: getJavascriptClientData() is not loaded");try{JSON.parse(e)}catch(e){return void console.log("APBCT ERROR: JSON parse error:"+e)}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:e}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:e},{notJson:1})}function ctGetCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}function ctDeleteCookie(e){var t;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(t="https:"===location.protocol?"; secure":"",document.cookie=e+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+t):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(e,t,o){var n=[];n.callback=t.callback||null,n.onErrorCallback=t.onErrorCallback||null,n.callback_context=t.callback_context||null,n.callback_params=t.callback_params||null,n.async=t.async||!0,n.notJson=t.notJson||null,n.timeout=t.timeout||15e3,n.obj=o||null,n.button=t.button||null,n.progressbar=t.progressbar||null,n.silent=t.silent||null,n.no_nonce=t.no_nonce||null,n.data=e,n.url=ctPublicFunctions._ajax_url,"string"==typeof e?(n.no_nonce||(n.data=n.data+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce),n.data=n.data+"&no_cache="+Math.random()):(n.no_nonce||(n.data._ajax_nonce=ctPublicFunctions._ajax_nonce),n.data.no_cache=Math.random()),(new ApbctCore).ajax(n)}function apbct_public_sendREST(e,t){var o=[];o.route=e,o.callback=t.callback||null,o.onErrorCallback=t.onErrorCallback||null,o.data=t.data||[],o.method=t.method||"POST",(new ApbctCore).rest(o)}_defineProperty(ApbctRest,"default_route",ctPublicFunctions._rest_url+"cleantalk-antispam/v1/");var apbctLocalStorage={get:function(t,e){void 0===e&&(e="value");t=localStorage.getItem(t);if(null!==t)try{var o=JSON.parse(t);return o.hasOwnProperty(e)?JSON.parse(o[e]):o}catch(e){return t}return!1},set:function(e,t){var o;!(2<arguments.length&&void 0!==arguments[2])||arguments[2]?(o={value:JSON.stringify(t),timestamp:Math.floor((new Date).getTime()/1e3)},localStorage.setItem(e,JSON.stringify(o))):localStorage.setItem(e,t)},isAlive:function(e,t){return void 0===t&&(t=86400),this.get(e,"timestamp")+t>Math.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t<localStorage.length;t++){var o=localStorage.key(t);-1===o.indexOf("ct_")&&-1===o.indexOf("apbct_")||(e[o.toString()]=apbctLocalStorage.get(o))}return e}},ct_date=new Date,ctTimeMs=(new Date).getTime(),ctMouseEventTimerFlag=!0,ctMouseData=[],ctMouseDataCounter=0,ctCheckedEmails={};function apbct_attach_event_handler(e,t,o){"function"==typeof window.addEventListener?e.addEventListener(t,o):e.attachEvent(t,o)}function apbct_remove_event_handler(e,t,o){"function"==typeof window.removeEventListener?e.removeEventListener(t,o):e.detachEvent(t,o)}var ctMouseReadInterval,ctMouseWriteDataInterval,ctFunctionFirstKey=function(e){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),ctKeyStopStopListening()},ctFunctionMouseMove=(ctPublic.data__key_is_ok&&(ctMouseReadInterval=setInterval(function(){ctMouseEventTimerFlag=!0},150),ctMouseWriteDataInterval=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(ctMouseData))},1200)),function(e){ctSetMouseMoved(),!0===ctMouseEventTimerFlag&&(ctMouseData.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-ctTimeMs)]),ctMouseEventTimerFlag=!1,50<=++ctMouseDataCounter)&&ctMouseStopData()});function ctMouseStopData(){apbct_remove_event_handler(document,"mousemove",ctFunctionMouseMove),clearInterval(ctMouseReadInterval),clearInterval(ctMouseWriteDataInterval)}function ctKeyStopStopListening(){apbct_remove_event_handler(document,"mousedown",ctFunctionFirstKey),apbct_remove_event_handler(document,"keydown",ctFunctionFirstKey)}function checkEmail(e){var t=e.target.value;!t||t in ctCheckedEmails||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:t},callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:t},{callback:function(e){e.result&&(ctCheckedEmails[t]={result:e.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(ctCheckedEmails)))}}))}function ctSetPixelImg(e){var t;ctSetCookie("apbct_pixel_url",e),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")&&((t=document.createElement("img")).setAttribute("alt","CleanTalk Pixel"),t.setAttribute("id","apbct_pixel"),t.setAttribute("style","display: none; left: 99999px;"),t.setAttribute("src",e),apbct("body").append(t))}function ctGetPixelUrl(){var e=apbctLocalStorage.get("apbct_pixel_url");if(!1!==e){if(!apbctLocalStorage.isAlive("apbct_pixel_url",10800))return void ctSetPixelImg(e);apbctLocalStorage.delete("apbct_pixel_url")}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(e){e&&(apbctLocalStorage.get("apbct_pixel_url")||(apbctLocalStorage.set("apbct_pixel_url",e),ctNoCookieAttachHiddenFieldsToForms()),ctSetPixelImg(e))}}):apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{notJson:!0,callback:function(e){e&&(apbctLocalStorage.get("apbct_pixel_url")||(apbctLocalStorage.set("apbct_pixel_url",e),ctNoCookieAttachHiddenFieldsToForms()),ctSetPixelImg(e))}})}function ctSetHasScrolled(){apbctLocalStorage.isSet("ct_has_scrolled")&&apbctLocalStorage.get("ct_has_scrolled")||(ctSetCookie("ct_has_scrolled","true"),apbctLocalStorage.set("ct_has_scrolled",!0))}function ctSetMouseMoved(){apbctLocalStorage.isSet("ct_mouse_moved")&&apbctLocalStorage.get("ct_mouse_moved")||(ctSetCookie("ct_mouse_moved","true"),apbctLocalStorage.set("ct_mouse_moved",!0))}function ctPreloadLocalStorage(){ctPublic.data__to_local_storage&&Object.entries(ctPublic.data__to_local_storage).forEach(function(e){var e=_slicedToArray(e,2),t=e[0],e=e[1];apbctLocalStorage.set(t,e)})}function apbct_ready(){ctPreloadLocalStorage();var e=apbctLocalStorage.get("ct_cookies_type"),e=(e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled")),[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",ct_date.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["apbct_headless",navigator.webdriver]]);if(apbctLocalStorage.set("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),apbctLocalStorage.set("ct_fkp_timestamp","0"),apbctLocalStorage.set("ct_pointer_data","0"),apbctLocalStorage.set("ct_timezone",ct_date.getTimezoneOffset()/60*-1),apbctLocalStorage.set("ct_screen_info",apbctGetScreenInfo()),apbctLocalStorage.set("apbct_headless",navigator.webdriver),"native"!==ctPublic.data__cookies_type)e.push(["apbct_visible_fields","0"]);else{var t=document.cookie.split(";");if(0!==t.length)for(var o=0;o<t.length;o++){var n=t[o].trim().split("=")[0];0===n.indexOf("apbct_visible_fields_")&&ctDeleteCookie(n)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?ctGetPixelUrl():e.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(e.push(["ct_checked_emails","0"]),apbct("input[type = 'email'], #email").on("blur",checkEmail)),apbctLocalStorage.isSet("ct_checkjs")?e.push(["ct_checkjs",apbctLocalStorage.get("ct_checkjs")]):e.push(["ct_checkjs",0]),ctSetCookie(e),setTimeout(function(){ctNoCookieAttachHiddenFieldsToForms();for(var e=0;e<document.forms.length;e++){var t,o,n=document.forms[e];0==+ctPublic.data__visible_fields_required||"get"===n.method.toString().toLowerCase()&&0===n.querySelectorAll(".nf-form-content").length||n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"===n.id||n.classList&&n.classList.contains("tinkoffPayRow")||n.classList&&n.classList.contains("give-form")||n.id&&"ult-forgot-password-form"===n.id||n.id&&-1!==n.id.toString().indexOf("calculatedfields")||n.id&&-1!==n.id.toString().indexOf("sac-form")||n.id&&-1!==n.id.toString().indexOf("cp_tslotsbooking_pform")||n.name&&-1!==n.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===n.action.toString()||n.name&&-1!==n.name.toString().indexOf("tribe-bar-form")||((t=document.createElement("input")).setAttribute("type","hidden"),t.setAttribute("id","apbct_visible_fields_"+e),t.setAttribute("name","apbct_visible_fields"),(o={})[0]=apbct_collect_visible_fields(n),t.value=btoa(JSON.stringify(o)),n.append(t),n.onsubmit_prev=n.onsubmit,n.ctFormIndex=e,n.onsubmit=function(e){var t;"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&((t={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t,e.target.ctFormIndex)),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}},1e3);var i=document.querySelectorAll("[data-original-string]");if((ctPublic.encodedEmailNodes=i).length)for(var a=0;a<i.length;++a)i[a].parentElement.href||i[a].parentElement.parentElement.href||i[a].addEventListener("click",ctFillDecodedEmailHandler)}function ctFillDecodedEmailHandler(e){this.removeEventListener("click",ctFillDecodedEmailHandler);ctPublic.encodedEmailNodesIsMixed=!1,document.body.classList.add("apbct-popup-fade");var t,o=document.getElementById("apbct_popup");o?(o.setAttribute("style","display: inherit"),document.getElementById("apbct_popup_text").innerHTML="Please wait while CleanTalk decoding email addresses.."):((o=document.createElement("div")).setAttribute("class","apbct-popup"),o.setAttribute("id","apbct_popup"),(t=document.createElement("p")).setAttribute("id","apbct_popup_text"),t.innerText="Please wait while CleanTalk decoding email addresses..",o.append(t),document.body.append(o)),apbctAjaxEmailDecodeBulk(e,ctPublic.encodedEmailNodes,this)}function apbctAjaxEmailDecodeBulk(e,t,o){for(var n={event_javascript_data:getJavascriptClientData(),post_url:document.location.href,referrer:document.referrer,encodedEmails:""},i={},a=0;a<t.length;a++){void 0!==t[a].href&&0===t[a].href.indexOf("mailto:")&&(e.preventDefault(),ctPublic.encodedEmailNodesIsMixed=!0);var r=document.createElement("div");r.setAttribute("class","apbct-tooltip"),apbct(t[a]).append(r),i[a]=t[a].dataset.originalString}n.encodedEmails=JSON.stringify(i),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_decode_email",{data:n,method:"POST",callback:function(e){ctSetCookie("apbct_email_encoder_passed","1"),apbctEmailEncoderCallbackBulk(e,t,o)},onErrorCallback:function(e){resetEncodedNodes(),ctShowDecodeComment(e)}}):(n.action="apbct_decode_email",apbct_public_sendAJAX(n,{notJson:!1,callback:function(e){ctSetCookie("apbct_email_encoder_passed","1"),apbctEmailEncoderCallbackBulk(e,t,o)},onErrorCallback:function(e){resetEncodedNodes(),ctShowDecodeComment(e)}}))}function apbctEmailEncoderCallbackBulk(i,a,o){i.success&&!0===i.data[0].is_allowed?setTimeout(function(){for(var e=0;e<a.length&&"break"!==function(t){var e,o,n=void 0;if(i.data.forEach(function(e){e.encoded_email===a[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return"break";void 0!==a[t].href&&0===a[t].href.indexOf("mailto:")&&(e=a[t].href.replace("mailto:",""),o=a[t].innerHTML,a[t].innerHTML=o.replace(e,n.decoded_email),a[t].href="mailto:"+n.decoded_email),ctProcessDecodedDataResult(n,a[t]),a[t].removeEventListener("click",ctFillDecodedEmailHandler)}(e);e++);var t=document.getElementById("apbct_popup");null!==t&&(document.body.classList.remove("apbct-popup-fade"),t.setAttribute("style","display:none"),ctPublic.encodedEmailNodesIsMixed)&&o.click()},3e3):i.success?(resetEncodedNodes(),ctShowDecodeComment("Blocked: "+i.data[0].comment)):(resetEncodedNodes(),ctShowDecodeComment("Cannot connect with CleanTalk server: "+i.data[0].comment))}function resetEncodedNodes(){void 0!==ctPublic.encodedEmailNodes&&ctPublic.encodedEmailNodes.forEach(function(e){e.addEventListener("click",ctFillDecodedEmailHandler)})}function getJavascriptClientData(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t={},o=(t.apbct_headless=!!ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_headless"),t.apbct_pixel_url=ctGetCookie(ctPublicFunctions.cookiePrefix+"apbct_pixel_url"),t.ct_checked_emails=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checked_emails"),t.ct_checkjs=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_checkjs"),t.ct_fkp_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_fkp_timestamp"),t.ct_pointer_data=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_pointer_data"),t.ct_ps_timestamp=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_ps_timestamp"),t.ct_screen_info=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_screen_info"),t.ct_timezone=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_timezone"),apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_mouse_moved")),n=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),i=apbctLocalStorage.get(ctPublicFunctions.cookiePrefix+"ct_cookies_type"),a=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_mouse_moved"),r=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_has_scrolled"),c=ctGetCookie(ctPublicFunctions.cookiePrefix+"ct_cookies_type");if(t.ct_mouse_moved=void 0!==o?o:a,t.ct_has_scrolled=void 0!==n?n:r,t.ct_cookies_type=void 0!==i?i:c,"object"===_typeof(e)&&e!==[])for(var l=0;l<e.length;++l)"object"===_typeof(e[l][1])?t[e[l][1][0]]=e[l][1][1]:t[e[l][0]]=e[l][1];else console.log("APBCT JS ERROR: Collecting data type mismatch");return t=removeDoubleJsonEncoding(t),JSON.stringify(t)}function removeDoubleJsonEncoding(e){if("object"===_typeof(e))for(var t in e){var o;"object"===_typeof(e[t])&&(e[t]=removeDoubleJsonEncoding(e[t])),"string"==typeof e[t]&&null!==e[t].match(/^[\[{].*?[\]}]$/)&&"object"===_typeof(o=JSON.parse(e[t]))&&(e[t]=o)}return e}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){apbct(e).html(apbct(e).html().replace(/.+?(<div class=["']apbct-tooltip["'].+?<\/div>)/,t+"$1"))}function ctShowDecodeComment(e){e=e||"Can not decode email. Unknown reason";var t=document.getElementById("apbct_popup"),o=document.getElementById("apbct_popup_text");null!==t&&(document.body.classList.remove("apbct-popup-fade"),o.innerText="CleanTalk email decoder: "+e,setTimeout(function(){t.setAttribute("style","display:none")},3e3))}function apbct_collect_visible_fields(e){var t,o=[],n="",i=0,a="",r=0,c=[];for(t in e.elements)isNaN(+t)||(o[t]=e.elements[t]);return(o=o.filter(function(e){return-1===c.indexOf(e.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(c.push(e.getAttribute("name")),!1))})).forEach(function(e,t,o){"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&"ct_checkjs"!==e.getAttribute("name")&&("none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")||e.classList.contains("wp-editor-area")?(n+=" "+e.getAttribute("name"),i++):(a+=" "+e.getAttribute("name"),r++))}),a=a.trim(),{visible_fields:n=n.trim(),visible_fields_count:i,invisible_fields:a,invisible_fields_count:r}}function apbct_visible_fields_set_cookie(e,t){var o="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10<n)return;ctSetCookie("apbct_visible_fields_"+(void 0!==t?t:n),JSON.stringify(o[n]))}else"none"===ctPublic.data__cookies_type?ctSetCookie("apbct_visible_fields",JSON.stringify(o[0])):ctSetCookie("apbct_visible_fields",JSON.stringify(o))}function apbct_js_keys__set_input_value(e,t,o,n){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var i=document.querySelectorAll("[name^=ct_checkjs]"),a=0;a<i.length;a++)i[a].value=e.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}function ctParseBlockMessage(e){void 0!==e.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()}function ctSetPixelUrlLocalstorage(e){ctSetCookie("apbct_pixel_url",e)}function ctNoCookieConstructHiddenField(){var e="",t=apbctLocalStorage.getCleanTalkData(),t=JSON.stringify(t);return t=btoa(t),(e=document.createElement("input")).setAttribute("id","ct_no_cookie_hidden_field"),e.setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",t),e.setAttribute("type","hidden"),e}function ctNoCookieGetForms(){var e=document.forms;return e||!1}function ctNoCookieAttachHiddenFieldsToForms(){if("none"===ctPublic.data__cookies_type){var e=ctNoCookieGetForms();if(e){var t=document.getElementsByName("ct_no_cookie_hidden_field");if(t)for(var o=0;o<t.length;o++)t[o].parentNode.removeChild(t[o]);for(var n=0;n<e.length;n++)null!==document.forms[n].getAttribute("method")&&"post"!==document.forms[n].getAttribute("method").toLowerCase()||document.forms[n].append(ctNoCookieConstructHiddenField())}}}ctPublic.data__key_is_ok&&(apbct_attach_event_handler(document,"mousemove",ctFunctionMouseMove),apbct_attach_event_handler(document,"mousedown",ctFunctionFirstKey),apbct_attach_event_handler(document,"keydown",ctFunctionFirstKey),apbct_attach_event_handler(document,"scroll",ctSetHasScrolled)),ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbct_ready():apbct_attach_event_handler(document,"DOMContentLoaded",apbct_ready)),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(e,t,o){if(t.responseText&&-1!==t.responseText.indexOf('"apbct')){try{var n=JSON.parse(t.responseText)}catch(e){return void console.log(e.toString())}ctParseBlockMessage(n)}});var cleantalkModal={loaded:!1,loading:!1,opened:!1,opening:!1,load:function(e){var t;this.loaded||(this.loading=!0,t=function(e,t,o,n){cleantalkModal.loading=!1,cleantalkModal.loaded=e,document.dispatchEvent(new CustomEvent("cleantalkModalContentLoaded",{bubbles:!0}))},("function"==typeof apbct_admin_sendAJAX?apbct_admin_sendAJAX:apbct_public_sendAJAX)({action:e},{callback:t,notJson:!0}))},open:function(){function e(){var e,t="";for(e in this.styles)t+=e+":"+this.styles[e]+";";return t}var t={styles:{"z-index":"9999",position:"fixed",top:"0",left:"0",width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",display:"flex","justify-content":"center","align-items":"center"},toString:e},o={styles:{position:"relative",padding:"30px",background:"#FFF",border:"1px solid rgba(0,0,0,0.75)","border-radius":"4px","box-shadow":"7px 7px 5px 0px rgba(50,50,50,0.75)"},toString:e},n={styles:{position:"absolute",background:"#FFF",width:"20px",height:"20px",border:"2px solid rgba(0,0,0,0.75)","border-radius":"15px",cursor:"pointer",top:"-8px",right:"-8px","box-sizing":"content-box"},toString:e},i={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(45deg)"},toString:e},a={styles:{content:'""',display:"block",position:"absolute",background:"#000","border-radius":"1px",width:"2px",height:"16px",top:"2px",left:"9px",transform:"rotate(-45deg)"},toString:e},r={styles:{overflow:"hidden"},toString:e},c=document.createElement("style"),r=(c.setAttribute("id","cleantalk-modal-styles"),c.innerHTML="body.cleantalk-modal-opened{"+r+"}",c.innerHTML+="#cleantalk-modal-overlay{"+t+"}",c.innerHTML+="#cleantalk-modal-close{"+n+"}",c.innerHTML+="#cleantalk-modal-close:before{"+i+"}",c.innerHTML+="#cleantalk-modal-close:after{"+a+"}",document.body.append(c),document.createElement("div")),t=(r.setAttribute("id","cleantalk-modal-overlay"),document.body.append(r),document.body.classList.add("cleantalk-modal-opened"),document.createElement("div")),n=(t.setAttribute("id","cleantalk-modal-inner"),t.setAttribute("style",o),r.append(t),document.createElement("div")),i=(n.setAttribute("id","cleantalk-modal-close"),t.append(n),document.createElement("div"));this.loaded?/.*\/inc/g.test(this.loaded)?i.innerHTML=this.loaded:(a=this.loaded.replace(/(https?:\/\/[^\s]+)/g,'<a href="$1" target="_blank">$1</a>'),i.innerHTML=a):(i.innerHTML="Loading...",this.load("get_options_template")),i.setAttribute("id","cleantalk-modal-content"),t.append(i),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}))}},buttons_to_handle=(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)}),[]);function apbct_gdpr_handle_buttons(){try{buttons_to_handle!==[]&&buttons_to_handle.forEach(function(e){var t='[id="apbct_gdpr_'+e.index+'"]',t=jQuery(t);jQuery(t).prop("checked")?(e.button.disabled=!1,jQuery(e.button).prop("title",e.old_notice)):(e.button.disabled=!0,jQuery(e.button).prop("title",gdpr_notice_for_button))})}catch(e){console.info("APBCT GDPR JS ERROR: Can not handle form buttons "+e)}}function ct_protect_external(){for(var e,t,o=0;o<document.forms.length;o++)void 0===document.forms[o].cleantalk_hidden_action&&void 0===document.forms[o].cleantalk_hidden_method&&"string"==typeof(e=document.forms[o]).action&&(isIntegratedForm(e)?apbctProcessExternalForm(e,o,document):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((t=document.createElement("input")).name="cleantalk_hidden_action",t.value=e.action,t.type="hidden",e.appendChild(t),(t=document.createElement("input")).name="cleantalk_hidden_method",t.value=e.method,t.type="hidden",e.method="POST",e.appendChild(t),e.action=document.location));apbctProcessIframes()}function formIsExclusion(t){var o=!1;return t.parentElement&&0<t.parentElement.classList.length&&-1!==t.parentElement.classList[0].indexOf("mewtwo")&&(o=!0),["give-form"].forEach(function(e){void 0!==t.id&&-1!==t.id.indexOf(e)&&(o=!0)}),o}function apbctProcessIframes(){var e=document.getElementsByTagName("iframe");if(0<e.length)for(var t=0;t<e.length;t++)if(null!=e[t].contentDocument){var o=e[t].contentDocument.forms;if(0===o.length)return;for(var n=0;n<o.length;n++)apbctProcessExternalForm(o[n],n,e[t].contentDocument)}}function apbctProcessExternalForm(e,n,i){var t,o,a,r,c;formIsExclusion(e)||((t=document.createElement("i")).className="cleantalk_placeholder",t.style="display: none",e.parentElement.insertBefore(t,e),t=e.previousSibling,a=e.outerHTML,(o=e).parentElement.removeChild(e),(e=document.createElement("div")).innerHTML=a,t.after(e.firstElementChild),(a=document.createElement("input")).name="action",a.value="cleantalk_force_ajax_check",a.type="hidden",(r=i.forms[n]).appendChild(a),r.apbctPrev=t,r.apbctFormOriginal=o,c=!1,void 0!==r.classList&&["newsletterform","ml-block-form"].forEach(function(e){r.classList.contains(e)&&(c=e)}),c?void 0!==(e=jQuery("form."+c).find('button[type="submit"]'))&&e.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(e.currentTarget)}):i.forms[n].onsubmit=function(e){var t,o;e.preventDefault(),-1!==i.forms[n].id.indexOf("mauticform")&&0<(t=jQuery(i.forms[n]).find('input[id*="checkbox_rgpd"]')).length&&!0===t.prop("checked")&&0<(o=jQuery(".cleantalk_placeholder")).length&&o[0].setAttribute("mautic_hidden_gdpr_id",t.prop("id")),jQuery(e.currentTarget).prev(),jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget)})}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),o=jQuery(t).find("button, input, textarea, select");e.each(function(e,n){var i=jQuery(n);o.each(function(e,t){var o=jQuery(t);n.outerHTML===t.outerHTML&&o.val(i.val())})})}function isIntegratedForm(e){var t=e.action,o=e.id;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com")||-1!==t.indexOf("sendfox.com")||-1!==t.indexOf("aweber.com")||-1!==t.indexOf("secure.payu.com")||-1!==t.indexOf("mautic")||-1!==o.indexOf("mauticform_"))}function sendAjaxCheckingFormData(d,e,t){var o={},n=(o[0]=apbct_collect_visible_fields(d),apbct_visible_fields_set_cookie(o),{}),o=d.elements;(o=Array.prototype.slice.call(o)).forEach(function(e,t){""===e.name?n["input_"+t]=e.value:n[e.name]=e.value}),apbct_public_sendAJAX(n,{async:!1,callback:function(e,t,o,n){if(void 0===e.apbct||!+e.apbct.blocked){var i=jQuery(d).detach(),a=d.apbctPrev,r=d.apbctFormOriginal,c=!1,l=(apbct_replace_inputs_values_from_other_form(i,r),-1!==r.id.indexOf("mautic")&&(c=!0),document.getElementsByClassName("cleantalk_placeholder"));if(l)for(var s=0;s<l.length;s++){var u=l[s].getAttribute("mautic_hidden_gdpr_id");void 0!==u&&void 0!==(u=jQuery(r).find("#"+u))&&u.prop("checked",!0)}a.after(r),jQuery(r).find('input[name="apbct_visible_fields"]').remove(),jQuery(r).find('input[value="cleantalk_force_ajax_check"]').remove();i=jQuery(r).find("button[type=submit]");if(0!==i.length)return i[0].click(),void(c&&setTimeout(function(){ct_protect_external()},1500));if(0!==(i=jQuery(r).find("input[type=submit]")).length)return void i[0].click();if(0!==(i=jQuery(r).find('button[data-element="submit"]')).length)return void i[0].click();0!==(i=jQuery(r).find('input[type="image"][name="submit"]')).length&&i[0].click()}void 0!==e.apbct&&+e.apbct.blocked&&ctParseBlockMessage(e)}})}function ct_check_internal(t){var e,o={},n=t.elements;for(e in n)"submit"!=n[e].type&&null!=n[e].value&&""!=n[e].value&&(o[n[e].name]=t.elements[e].value);o.action="ct_check_internal",apbct_public_sendAJAX(o,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.submit()}})}function ct_check_internal__is_exclude_form(t){return["wp-login.php","wp-comments-post.php"].some(function(e){return null!==t.match(new RegExp(ctPublic.blog_home+".*"+e))})}document.addEventListener("DOMContentLoaded",function(){if("undefined"!=typeof ctPublicGDPR&&ctPublicGDPR.gdpr_forms.length){var i=ctPublicGDPR.gdpr_title;if("undefined"!=typeof jQuery)try{ctPublicGDPR.gdpr_forms.forEach(function(e,t){var o=jQuery("#"+e+", ."+e),e=(o.is("form")||(o.find("form")[0]?o=o.children("form").first():jQuery(".wpcf7[role=form]")[0]&&-1!==jQuery(".wpcf7[role=form]").attr("id").indexOf("wpcf7-f"+e)?o=jQuery(".wpcf7[role=form]").children("form"):jQuery(".frm_forms")[0]&&-1!==jQuery(".frm_forms").first().attr("id").indexOf("frm_form_"+e)?o=jQuery(".frm_forms").first().children("form"):jQuery(".wpforms-form")[0]&&-1!==jQuery(".wpforms-form").first().attr("id").indexOf("wpforms-form-"+e)&&(o=jQuery(".wpforms-form"))),!1),n=o.find('input[type|="submit"],button[type|="submit"]');n.length&&(!1!==(e=n[0])&&(e.disabled=!0,n=jQuery(e).prop("title")?jQuery(e).prop("title"):"",buttons_to_handle.push({index:t,button:e,old_notice:n}),jQuery(e).prop("title",i)),!o.is("form")&&"form"!==o.attr("role")||o.append('<input id="apbct_gdpr_'+t+'" type="checkbox" required="required" style=" margin-right: 10px;" onchange="apbct_gdpr_handle_buttons()">').append('<label style="display: inline;" for="apbct_gdpr_'+t+'">'+ctPublicGDPR.gdpr_text+"</label>"))})}catch(e){console.info("APBCT GDPR JS ERROR: Can not add GDPR notice"+e)}}}),window.onload=function(){+ctPublic.settings__forms__check_external&&"undefined"!=typeof jQuery&&setTimeout(function(){ct_protect_external()},1500)},document.addEventListener("DOMContentLoaded",function(){var e,t="";if(+ctPublic.settings__forms__check_internal)for(var o=0;o<document.forms.length;o++)"string"!=typeof document.forms[o].action||null===(t=(e=document.forms[o]).action).indexOf("https?://")||null===t.match(ctPublic.blog_home+".*?.php")||ct_check_internal__is_exclude_form(t)||(e.click,"undefined"!=typeof jQuery&&(jQuery(e).off("**"),jQuery(e).off(),jQuery(e).on("submit",function(e){return ct_check_internal(e.target),!1})))});
js/apbct-public-bundle.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public-bundle.min.js","sources":["apbct-public-bundle.js"],"sourcesContent":["class ApbctCore{\n\n ajax_parameters = {};\n rest_parameters = {};\n\n selector = null;\n elements = [];\n\n // Event properties\n eventCallback;\n eventSelector;\n event;\n\n /**\n * Default constructor\n */\n constructor(selector){\n this.select(selector);\n }\n\n /**\n * Get elements by CSS selector\n *\n * @param selector\n * @returns {*}\n */\n select(selector) {\n\n if(selector instanceof HTMLCollection){\n this.selector = null;\n this.elements = [];\n this.elements = Array.prototype.slice.call(selector);\n }else if( typeof selector === 'object' ){\n this.selector = null;\n this.elements = [];\n this.elements[0] = selector;\n }else if( typeof selector === 'string' ){\n this.selector = selector;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(selector));\n // this.elements = document.querySelectorAll(selector)[0];\n }else{\n this.deselect();\n }\n\n return this;\n }\n\n addElement(elemToAdd){\n if( typeof elemToAdd === 'object' ){\n this.elements.push(elemToAdd);\n }else if( typeof elemToAdd === 'string' ){\n this.selector = elemToAdd;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(elemToAdd));\n }else{\n this.deselect();\n }\n }\n\n push(elem){\n this.elements.push(elem);\n }\n\n reduce(){\n this.elements = this.elements.slice(0,-1);\n }\n\n deselect(){\n this.elements = [];\n }\n\n /**\n * Set or get CSS for/of currently selected element\n *\n * @param style\n * @param getRaw\n *\n * @returns {boolean|*}\n */\n css(style, getRaw){\n\n getRaw = getRaw | false;\n\n // Set style\n if(typeof style === \"object\"){\n\n const stringToCamelCase = str =>\n str.replace(/([-_][a-z])/g, group =>\n group\n .toUpperCase()\n .replace('-', '')\n .replace('_', '')\n );\n\n // Apply multiple styles\n for(let style_name in style){\n let DOM_style_name = stringToCamelCase(style_name);\n\n // Apply to multiple elements (currently selected)\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].style[DOM_style_name] = style[style_name];\n }\n }\n\n return this;\n }\n\n // Get style of first currently selected element\n if(typeof style === 'string'){\n\n let computedStyle = getComputedStyle(this.elements[0])[style];\n\n // Process\n if( typeof computedStyle !== 'undefined' && ! getRaw){\n computedStyle = computedStyle.replace(/(\\d)(em|pt|%|px){1,2}$/, '$1'); // Cut of units\n computedStyle = Number(computedStyle) == computedStyle ? Number(computedStyle) : computedStyle; // Cast to INT\n return computedStyle;\n }\n\n // Return unprocessed\n return computedStyle;\n }\n }\n\n hide(){\n this.prop('prev-display', this.css('display'));\n this.css({'display': 'none'});\n }\n\n show(){\n this.css({'display': this.prop('prev-display')});\n }\n\n addClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.add(className);\n }\n }\n\n removeClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.remove(className);\n }\n }\n\n toggleClass(className){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.toggle(className);\n }\n }\n\n /**\n * Wrapper for apbctAJAX class\n *\n * @param ajax_parameters\n * @returns {ApbctAjax}\n */\n ajax(ajax_parameters){\n this.ajax_parameters = ajax_parameters;\n return new ApbctAjax(ajax_parameters);\n }\n\n /**\n * Wrapper for apbctREST class\n *\n * @param rest_parameters\n * @returns {ApbctRest}\n */\n rest(rest_parameters){\n this.rest_parameters = rest_parameters;\n return new ApbctRest(rest_parameters);\n }\n\n /************** EVENTS **************/\n\n /**\n *\n * Why the mess with arguments?\n *\n * Because we need to support the following function signatures:\n * on('click', function(){ alert('some'); });\n * on('click', 'inner_selector', function(){ alert('some'); });\n *\n * @param args\n */\n on(...args){\n\n this.event = args[0];\n this.eventCallback = args[2] || args[1];\n this.eventSelector = typeof args[1] === \"string\" ? args[1] : null;\n\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].addEventListener(\n this.event,\n this.eventSelector !== null\n ? this.onChecker.bind(this)\n : this.eventCallback\n );\n }\n }\n\n /**\n * Check if a selector of an event matches current target\n *\n * @param event\n * @returns {*}\n */\n onChecker(event){\n if(event.target === document.querySelector(this.eventSelector)){\n event.stopPropagation();\n return this.eventCallback(event);\n }\n }\n\n ready(callback){\n document.addEventListener('DOMContentLoaded', callback);\n }\n\n change(callback){\n this.on('change', callback);\n }\n\n /************** ATTRIBUTES **************/\n\n /**\n * Get an attribute or property of an element\n *\n * @param attrName\n * @returns {*|*[]}\n */\n attr(attrName){\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n\n // Use property instead of attribute if possible\n if(typeof this.elements[i][attrName] !== undefined){\n outputValue.push(this.elements[i][attrName]);\n }else{\n outputValue.push(this.elements[i].getAttribute(attrName));\n }\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n\n prop(propName, value){\n\n // Setting values\n if(typeof value !== \"undefined\"){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i][propName] = value;\n }\n\n return this;\n\n // Getting values\n }else{\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n outputValue.push(this.elements[i][propName]);\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n }\n\n /**\n * Set or get inner HTML\n *\n * @param value\n * @returns {*|*[]}\n */\n html(value){\n return typeof value !== 'undefined'\n ? this.prop('innerHTML', value)\n : this.prop('innerHTML');\n }\n\n /**\n * Set or get value of input tags\n *\n * @param value\n * @returns {*|*[]|undefined}\n */\n val(value){\n return typeof value !== 'undefined'\n ? this.prop('value', value)\n : this.prop('value');\n }\n\n data(name, value){\n return typeof value !== 'undefined'\n ? this.prop('apbct-data', name, value)\n : this.prop('apbct-data');\n }\n\n /************** END OF ATTRIBUTES **************/\n\n /************** FILTERS **************/\n\n /**\n * Check if the current elements are corresponding to filter\n *\n * @param filter\n * @returns {boolean}\n */\n is(filter){\n\n let outputValue = false;\n\n for(let elem of this.elements){\n outputValue ||= this.isElem(elem, filter);\n }\n\n return outputValue;\n }\n\n isElem(elemToCheck, filter){\n\n let is = false;\n let isRegisteredTagName = function(name){\n let newlyCreatedElement = document.createElement(name).constructor;\n return ! Boolean( ~[HTMLElement, HTMLUnknownElement].indexOf(newlyCreatedElement) );\n };\n\n // Check for filter function\n if(typeof filter === 'function') {\n is ||= filter.call(this, elemToCheck);\n }\n\n // Check for filter function\n if(typeof filter === 'string') {\n\n // Filter is tag name\n if( filter.match(/^[a-z]/) && isRegisteredTagName(filter) ){\n is ||= elemToCheck.tagName.toLowerCase() === filter.toLowerCase();\n\n // Filter is property\n }else if( filter.match(/^[a-z]/) ){\n is ||= Boolean(elemToCheck[filter]);\n\n // Filter is CSS selector\n }else {\n is ||= this.selector !== null\n ? document.querySelector(this.selector + filter) !== null // If possible\n : this.isWithoutSelector(elemToCheck, filter); // Search through all elems with such selector\n }\n }\n\n return is;\n }\n\n isWithoutSelector(elemToCheck, filter){\n\n let elems = document.querySelectorAll(filter);\n let outputValue = false;\n\n for(let elem of elems){\n outputValue ||= elemToCheck === elem;\n }\n\n return outputValue;\n }\n\n filter(filter){\n\n this.selector = null;\n\n for( let i = this.elements.length - 1; i >= 0; i-- ){\n if( ! this.isElem(this.elements[i], filter) ){\n this.elements.splice(Number(i), 1);\n }\n }\n\n return this;\n }\n\n /************** NODES **************/\n\n parent(filter){\n\n this.select(this.elements[0].parentElement);\n\n if( typeof filter !== 'undefined' && ! this.is(filter) ){\n this.deselect();\n }\n\n return this;\n }\n\n parents(filter){\n\n this.select(this.elements[0]);\n\n for ( ; this.elements[ this.elements.length - 1].parentElement !== null ; ) {\n this.push(this.elements[ this.elements.length - 1].parentElement);\n }\n\n this.elements.splice(0,1); // Deleting initial element from the set\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n children(filter){\n\n this.select(this.elements[0].children);\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n siblings(filter){\n\n let current = this.elements[0]; // Remember current to delete it later\n\n this.parent();\n this.children(filter);\n this.elements.splice(this.elements.indexOf(current), 1); // Remove current element\n\n return this;\n }\n\n /************** DOM MANIPULATIONS **************/\n remove(){\n for(let elem of this.elements){\n elem.remove();\n }\n }\n\n after(content){\n for(let elem of this.elements){\n elem.after(content);\n }\n }\n\n append(content){\n for(let elem of this.elements){\n elem.append(content);\n }\n }\n\n /************** ANIMATION **************/\n fadeIn(time) {\n for(let elem of this.elements){\n elem.style.opacity = 0;\n elem.style.display = 'block';\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity + (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity < 1) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n }\n };\n\n tick();\n }\n }\n\n fadeOut(time) {\n for(let elem of this.elements){\n elem.style.opacity = 1;\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity - (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity > 0) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n } else {\n elem.style.display = 'none';\n }\n };\n\n tick();\n }\n }\n}\n\n/**\n * Hack\n *\n * Make a proxy to keep both properties and methods from:\n * - the native object and\n * - the new one from ApbctCore for selected element.\n *\n * For example:\n * apbct('#id).innerHTML = 'some';\n * apbct('#id).css({'backgorund-color': 'black'});\n */\n// apbct = new Proxy(\n// apbct,\n// {\n// get(target, prop) {\n// if (target.elements.length) {\n// return target.elements[0][prop];\n// } else {\n// return null;\n// }\n// },\n// set(target, prop, value){\n// if (target.elements.length) {\n// target.elements[0][prop] = value;\n// return true;\n// } else {\n// return false;\n// }\n// },\n// apply(target, thisArg, argArray) {\n//\n// }\n// }\n// );\n\n/**\n * Enter point to ApbctCore class\n *\n * @param params\n * @returns {*}\n */\nfunction apbct(params){\n return new ApbctCore()\n .select(params);\n}\nclass ApbctXhr{\n\n xhr = new XMLHttpRequest();\n\n // Base parameters\n method = 'POST'; // HTTP-request type\n url = ''; // URL to send the request\n async = true;\n user = null; // HTTP-authorization username\n password = null; // HTTP-authorization password\n data = {}; // Data to send\n\n\n // Optional params\n button = null; // Button that should be disabled when request is performing\n spinner = null; // Spinner that should appear when request is in process\n progressbar = null; // Progress bar for the current request\n context = this; // Context\n callback = null;\n onErrorCallback = null;\n\n responseType = 'json'; // Expected data type from server\n headers = {};\n timeout = 15000; // Request timeout in milliseconds\n\n methods_to_convert_data_to_URL = [\n 'GET',\n 'HEAD',\n ];\n\n body = null;\n http_code = 0;\n status_text = '';\n\n constructor(parameters){\n\n console.log('%cXHR%c started', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;');\n\n // Set class properties\n for( let key in parameters ){\n if( typeof this[key] !== 'undefined' ){\n this[key] = parameters[key];\n }\n }\n\n // Modifying DOM-elements\n this.prepare();\n\n // Modify URL with data for GET and HEAD requests\n if ( Object.keys(this.data).length ) {\n this.deleteDoubleJSONEncoding(this.data);\n this.convertData();\n }\n\n if( ! this.url ){\n console.log('%cXHR%c not URL provided', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;')\n return false;\n }\n\n // Configure the request\n this.xhr.open(this.method, this.url, this.async, this.user, this.password);\n this.setHeaders();\n\n this.xhr.responseType = this.responseType;\n this.xhr.timeout = this.timeout;\n\n /* EVENTS */\n // Monitoring status\n this.xhr.onreadystatechange = function(){\n this.onReadyStateChange();\n }.bind(this);\n\n // Run callback\n this.xhr.onload = function(){\n this.onLoad();\n }.bind(this);\n\n // On progress\n this.xhr.onprogress = function(event){\n this.onProgress(event);\n }.bind(this);\n\n // On error\n this.xhr.onerror = function(){\n this.onError();\n }.bind(this);\n\n this.xhr.ontimeout = function(){\n this.onTimeout();\n }.bind(this);\n\n // Send the request\n this.xhr.send(this.body);\n }\n\n prepare(){\n\n // Disable button\n if(this.button){\n this.button.setAttribute('disabled', 'disabled');\n this.button.style.cursor = 'not-allowed';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'inline';\n }\n }\n\n complete(){\n\n this.http_code = this.xhr.status;\n this.status_text = this.xhr.statusText;\n\n // Disable button\n if(this.button){\n this.button.removeAttribute('disabled');\n this.button.style.cursor = 'auto';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'none';\n }\n\n if( this.progressbar ) {\n this.progressbar.fadeOut('slow');\n }\n }\n\n onReadyStateChange(){\n if (this.on_ready_state_change !== null && typeof this.on_ready_state_change === 'function'){\n this.on_ready_state_change();\n }\n }\n\n onProgress(event) {\n if (this.on_progress !== null && typeof this.on_progress === 'function'){\n this.on_progress();\n }\n }\n\n onError(){\n\n console.log('error');\n\n this.complete();\n this.error(\n this.http_code,\n this.status_text\n );\n\n if (this.onErrorCallback !== null && typeof this.onErrorCallback === 'function'){\n this.onErrorCallback(this.status_text);\n }\n }\n\n onTimeout(){\n this.complete();\n this.error(\n 0,\n 'timeout'\n );\n\n if (this.onErrorCallback !== null && typeof this.onErrorCallback === 'function'){\n this.onErrorCallback('Timeout');\n }\n }\n\n onLoad(){\n\n this.complete();\n\n if (this.responseType === 'json' ){\n if(this.xhr.response === null){\n this.error(this.http_code, this.status_text, 'No response');\n return false;\n }else if( typeof this.xhr.response.error !== 'undefined') {\n this.error(this.http_code, this.status_text, this.xhr.response.error);\n return false;\n }\n }\n\n if (this.callback !== null && typeof this.callback === 'function') {\n this.callback.call(this.context, this.xhr.response, this.data);\n }\n }\n\n error(http_code, status_text, additional_msg){\n\n let error_string = '';\n\n if( status_text === 'timeout' ){\n error_string += 'Server response timeout'\n\n }else if( http_code === 200 ){\n\n if( status_text === 'parsererror' ){\n error_string += 'Unexpected response from server. See console for details.';\n }else {\n error_string += 'Unexpected error. Status: ' + status_text + '.';\n if( typeof additional_msg !== 'undefined' )\n error_string += ' Additional error info: ' + additional_msg;\n }\n\n }else if(http_code === 500){\n error_string += 'Internal server error.';\n\n }else {\n error_string += 'Unexpected response code:' + http_code;\n }\n\n this.errorOutput( error_string );\n }\n\n errorOutput(error_msg){\n console.log( '%c ctXHR error: %c' + error_msg, 'color: red;', 'color: grey;' );\n }\n\n setHeaders(){\n // Set headers if passed\n for( let header_name in this.headers ){\n if( typeof this.headers[header_name] !== 'undefined' ){\n this.xhr.setRequestHeader(header_name, this.headers[header_name]);\n }\n }\n }\n\n convertData()\n {\n // GET, HEAD request-type\n if( ~this.methods_to_convert_data_to_URL.indexOf( this.method ) ){\n return this.convertDataToURL();\n\n // POST request-type\n }else{\n return this.convertDataToBody()\n }\n }\n\n convertDataToURL(){\n let params_appendix = new URLSearchParams(this.data).toString();\n let params_prefix = this.url.match(/^(https?:\\/{2})?[a-z0-9.]+\\?/) ? '&' : '?';\n this.url += params_prefix + params_appendix;\n\n return this.url;\n }\n\n /**\n *\n * @returns {null}\n */\n convertDataToBody()\n {\n this.body = new FormData();\n\n for (let dataKey in this.data) {\n this.body.append(\n dataKey,\n typeof this.data[dataKey] === 'object'\n ? JSON.stringify(this.data[dataKey])\n : this.data[dataKey]\n );\n }\n\n return this.body;\n }\n\n /**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\n deleteDoubleJSONEncoding(object){\n\n if( typeof object === 'object'){\n\n for (let objectKey in object) {\n\n // Recursion\n if( typeof object[objectKey] === 'object'){\n object[objectKey] = this.deleteDoubleJSONEncoding(object[objectKey]);\n }\n\n // Common case (out)\n if(\n typeof object[objectKey] === 'string' &&\n object[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n ){\n let parsedValue = JSON.parse(object[objectKey]);\n if( typeof parsedValue === 'object' ){\n object[objectKey] = parsedValue;\n }\n }\n }\n }\n\n return object;\n }\n}\nclass ApbctAjax extends ApbctXhr{\n\n constructor(...args) {\n super(args[0]);\n }\n}\nclass ApbctRest extends ApbctXhr{\n\n static default_route = ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/';\n route = '';\n\n constructor(...args) {\n args = args[0];\n args.url = ApbctRest.default_route + args.route;\n args.headers = {\n \"X-WP-Nonce\": ctPublicFunctions._rest_nonce\n };\n super(args);\n }\n}\n\nfunction ctSetCookie( cookies, value, expires ){\n\n let force_alternative_method_for_cookies = [\n 'ct_sfw_pass_key',\n 'ct_sfw_passed',\n 'wordpress_apbct_antibot',\n 'apbct_anticrawler_passed',\n 'apbct_antiflood_passed'\n ]\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 let forced_alt_cookies_set = []\n cookies.forEach( function (item, i, arr\t) {\n if (force_alternative_method_for_cookies.indexOf(item[0]) !== -1) {\n forced_alt_cookies_set.push(item)\n } else {\n apbctLocalStorage.set(item[0], encodeURIComponent(item[1]))\n }\n });\n if ( forced_alt_cookies_set.length > 0 ){\n ctSetAlternativeCookie(forced_alt_cookies_set)\n }\n ctNoCookieAttachHiddenFieldsToForms()\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 = ctPublicFunctions.cookiePrefix + 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 ctSetAlternativeCookie(cookies)\n }\n}\n\nfunction ctSetAlternativeCookie(cookies){\n if (typeof (getJavascriptClientData) === \"function\"){\n //reprocess already gained cookies data\n cookies = getJavascriptClientData(cookies);\n } else {\n console.log('APBCT ERROR: getJavascriptClientData() is not loaded')\n }\n\n try {\n JSON.parse(cookies)\n } catch (e){\n console.log('APBCT ERROR: JSON parse error:' + e)\n return\n }\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 === '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/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\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 let _params = [];\n _params[\"callback\"] = params.callback || null;\n _params[\"onErrorCallback\"] = params.onErrorCallback || null;\n _params[\"callback_context\"] = params.callback_context || null;\n _params[\"callback_params\"] = params.callback_params || null;\n _params[\"async\"] = params.async || true;\n _params[\"notJson\"] = params.notJson || null;\n _params[\"timeout\"] = params.timeout || 15000;\n _params[\"obj\"] = obj || null;\n _params[\"button\"] = params.button || null;\n _params[\"progressbar\"] = params.progressbar || null;\n _params[\"silent\"] = params.silent || null;\n _params[\"no_nonce\"] = params.no_nonce || null;\n _params[\"data\"] = data;\n _params[\"url\"] = ctPublicFunctions._ajax_url;\n\n if(typeof (data) === 'string') {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"] = _params[\"data\"] + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"] = _params[\"data\"] + '&no_cache=' + Math.random()\n } else {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"]._ajax_nonce = ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"].no_cache = Math.random();\n }\n\n new ApbctCore().ajax(_params);\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n let _params = [];\n _params[\"route\"] = route;\n _params[\"callback\"] = params.callback || null;\n _params[\"onErrorCallback\"] = params.onErrorCallback || null;\n _params[\"data\"] = params.data || [];\n _params[\"method\"] = params.method || 'POST';\n\n new ApbctCore().rest(_params);\n}\n\nlet apbctLocalStorage = {\n get : function(key, property) {\n if ( typeof property === 'undefined' ) {\n property = 'value';\n }\n const storageValue = localStorage.getItem(key);\n if ( storageValue !== null ) {\n try {\n const json = JSON.parse(storageValue);\n return json.hasOwnProperty(property) ? JSON.parse(json[property]) : json;\n } catch (e) {\n return storageValue;\n }\n }\n return false;\n },\n set : function(key, value, is_json = true) {\n if (is_json){\n let objToSave = {'value': JSON.stringify(value), 'timestamp': Math.floor(new Date().getTime() / 1000)};\n localStorage.setItem(key, JSON.stringify(objToSave));\n } else {\n localStorage.setItem(key, value);\n }\n },\n isAlive : function(key, maxLifetime) {\n if ( typeof maxLifetime === 'undefined' ) {\n maxLifetime = 86400;\n }\n const keyTimestamp = this.get(key, 'timestamp');\n return keyTimestamp + maxLifetime > Math.floor(new Date().getTime() / 1000);\n },\n isSet : function(key) {\n return localStorage.getItem(key) !== null;\n },\n delete : function (key) {\n localStorage.removeItem(key);\n },\n getCleanTalkData : function () {\n let data = {}\n for(let i=0; i<localStorage.length; i++) {\n let key = localStorage.key(i);\n if (key.indexOf('ct_') !==-1 || key.indexOf('apbct_') !==-1){\n data[key.toString()] = apbctLocalStorage.get(key)\n }\n }\n return data\n },\n\n}\nvar ct_date = new Date(),\n\tctTimeMs = new Date().getTime(),\n\tctMouseEventTimerFlag = true, //Reading interval flag\n\tctMouseData = [],\n\tctMouseDataCounter = 0,\n\tctCheckedEmails = {};\n\nfunction apbct_attach_event_handler(elem, event, callback){\n\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\telse elem.attachEvent(event, callback);\n}\n\nfunction apbct_remove_event_handler(elem, event, callback){\n\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\telse elem.detachEvent(event, callback);\n}\n\n//Writing first key press timestamp\nvar ctFunctionFirstKey = function output(event){\n\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\tctKeyStopStopListening();\n};\n\nif (ctPublic.data__key_is_ok) {\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\n\n//Logging mouse position each 150 ms\nvar ctFunctionMouseMove = function output(event){\n\tctSetMouseMoved();\n\tif(ctMouseEventTimerFlag === true){\n\n\t\tctMouseData.push([\n\t\t\tMath.round(event.clientY),\n\t\t\tMath.round(event.clientX),\n\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t]);\n\n\t\tctMouseDataCounter++;\n\t\tctMouseEventTimerFlag = false;\n\t\tif(ctMouseDataCounter >= 50){\n\t\t\tctMouseStopData();\n\t\t}\n\t}\n};\n\n//Stop mouse observing function\nfunction ctMouseStopData(){\n\tapbct_remove_event_handler(document, \"mousemove\", ctFunctionMouseMove);\n\tclearInterval(ctMouseReadInterval);\n\tclearInterval(ctMouseWriteDataInterval);\n}\n\n//Stop key listening function\nfunction ctKeyStopStopListening(){\n\tapbct_remove_event_handler(document, \"mousedown\", ctFunctionFirstKey);\n\tapbct_remove_event_handler(document, \"keydown\", ctFunctionFirstKey);\n}\n\nfunction checkEmail(e) {\n\tvar current_email = e.target.value;\n\tif (current_email && !(current_email in ctCheckedEmails)) {\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'check_email_before_post',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\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\t// Using AJAX request and handler\n\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\temail : current_email,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\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\nfunction ctSetPixelImg(pixelUrl) {\n\tctSetCookie('apbct_pixel_url', pixelUrl);\n\tif( +ctPublic.pixel__enabled ){\n\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\tlet insertedImg = document.createElement('img');\n\t\t\tinsertedImg.setAttribute('alt', 'CleanTalk Pixel');\n\t\t\tinsertedImg.setAttribute('id', 'apbct_pixel');\n\t\t\tinsertedImg.setAttribute('style', 'display: none; left: 99999px;');\n\t\t\tinsertedImg.setAttribute('src', pixelUrl);\n\t\t\tapbct('body').append(insertedImg);\n\t\t}\n\t}\n}\n\nfunction ctGetPixelUrl() {\n\t// Check if pixel is already in localstorage and is not outdated\n\tlet local_storage_pixel_url = apbctLocalStorage.get('apbct_pixel_url');\n\tif ( local_storage_pixel_url !== false ) {\n\t\tif ( apbctLocalStorage.isAlive('apbct_pixel_url', 3600 * 3) ) {\n\t\t\tapbctLocalStorage.delete('apbct_pixel_url')\n\t\t} else {\n\t\t\t//if so - load pixel from localstorage and draw it skipping AJAX\n\t\t\tctSetPixelImg(local_storage_pixel_url);\n\t\t\treturn;\n\t\t}\n\t}\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_get_pixel_url',\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! apbctLocalStorage.get('apbct_pixel_url') ){\n\t\t\t\t\t\t\t//set pixel to the storage\n\t\t\t\t\t\t\tapbctLocalStorage.set('apbct_pixel_url', result)\n\t\t\t\t\t\t\t//update pixel data in the hidden fields\n\t\t\t\t\t\t\tctNoCookieAttachHiddenFieldsToForms()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tapbct_public_sendAJAX(\n\t\t\t{\n\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! apbctLocalStorage.get('apbct_pixel_url') ){\n\t\t\t\t\t\t\t//set pixel to the storage\n\t\t\t\t\t\t\tapbctLocalStorage.set('apbct_pixel_url', result)\n\t\t\t\t\t\t\t//update pixel data in the hidden fields\n\t\t\t\t\t\t\tctNoCookieAttachHiddenFieldsToForms()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction ctSetHasScrolled() {\n\tif( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\tapbctLocalStorage.set('ct_has_scrolled', true);\n\t}\n}\n\nfunction ctSetMouseMoved() {\n\tif( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\tapbctLocalStorage.set('ct_mouse_moved', true);\n\t}\n}\n\nfunction ctPreloadLocalStorage(){\n\tif (ctPublic.data__to_local_storage){\n\t\tlet data = Object.entries(ctPublic.data__to_local_storage)\n\t\tdata.forEach(([key, value]) => {\n\t\t\tapbctLocalStorage.set(key,value)\n\t\t});\n\t}\n}\n\nif (ctPublic.data__key_is_ok) {\n\tapbct_attach_event_handler(document, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(document, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(document, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(document, \"scroll\", ctSetHasScrolled);\n}\n\n// Ready function\nfunction apbct_ready(){\n\n\tctPreloadLocalStorage()\n\n\tlet cookiesType = apbctLocalStorage.get('ct_cookies_type');\n\tif ( ! cookiesType || cookiesType !== ctPublic.data__cookies_type ) {\n\t\tapbctLocalStorage.set('ct_cookies_type', ctPublic.data__cookies_type);\n\t\tapbctLocalStorage.delete('ct_mouse_moved');\n\t\tapbctLocalStorage.delete('ct_has_scrolled');\n\t}\n\n\t// Collect scrolling info\n\tvar initCookies = [\n\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t[\"ct_pointer_data\", \"0\"],\n\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t[\"apbct_headless\", navigator.webdriver],\n\t];\n\n\tapbctLocalStorage.set('ct_ps_timestamp', Math.floor(new Date().getTime() / 1000));\n\tapbctLocalStorage.set('ct_fkp_timestamp', \"0\");\n\tapbctLocalStorage.set('ct_pointer_data', \"0\");\n\tapbctLocalStorage.set('ct_timezone', ct_date.getTimezoneOffset()/60*(-1) );\n\tapbctLocalStorage.set('ct_screen_info', apbctGetScreenInfo());\n\tapbctLocalStorage.set('apbct_headless', navigator.webdriver);\n\n\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t} else {\n\t\t// Delete all visible fields cookies on load the page\n\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\tif( cookiesArray.length !== 0 ) {\n\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif( +ctPublic.pixel__setting ){\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tctGetPixelUrl()\n\t\t} else {\n\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t}\n\t}\n\n\tif ( +ctPublic.data__email_check_before_post) {\n\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\tapbct(\"input[type = 'email'], #email\").on('blur', checkEmail);\n\t}\n\n\tif (apbctLocalStorage.isSet('ct_checkjs')) {\n\t\tinitCookies.push(['ct_checkjs', apbctLocalStorage.get('ct_checkjs')]);\n\t} else {\n\t\tinitCookies.push(['ct_checkjs', 0]);\n\t}\n\n\tctSetCookie(initCookies);\n\n\tsetTimeout(function(){\n\n\t\tctNoCookieAttachHiddenFieldsToForms()\n\n\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\tvar form = document.forms[i];\n\n\t\t\t//Exclusion for forms\n\t\t\tif (\n\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' || // Custom form\n\t\t\t\t(form.name && form.name.toString().indexOf('tribe-bar-form') !== -1) // The Events Calendar\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\tvar visibleFieldsToInput = {};\n\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\thiddenInput.value = btoa(JSON.stringify(visibleFieldsToInput));\n\t\t\tform.append( hiddenInput );\n\n\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\tform.ctFormIndex = i;\n\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t}\n\n\t\t\t\t// Call previous submit action\n\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t}, 500);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t}, 1000);\n\n\t// Listen clicks on encoded emails\n\tlet decodedEmailNodes = document.querySelectorAll(\"[data-original-string]\");\n\tif (decodedEmailNodes.length) {\n\t\tfor (let i = 0; i < decodedEmailNodes.length; ++i) {\n\t\t\tif (\n\t\t\t\tdecodedEmailNodes[i].parentElement.href ||\n\t\t\t\tdecodedEmailNodes[i].parentElement.parentElement.href\n\t\t\t) {\n\t\t\t\t// Skip listening click on hyperlinks\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdecodedEmailNodes[i].addEventListener('click', ctFillDecodedEmailHandler);\n\t\t}\n\t}\n}\nif (ctPublic.data__key_is_ok) {\n\tif (document.readyState !== 'loading') {\n\t\tapbct_ready();\n\t} else {\n\t\tapbct_attach_event_handler(document, \"DOMContentLoaded\", apbct_ready);\n\t}\n}\n\nfunction ctFillDecodedEmailHandler(event) {\n\tthis.removeEventListener('click', ctFillDecodedEmailHandler);\n\tapbctAjaxEmailDecode(event, this);\n}\n\nfunction apbctAjaxEmailDecode(event, baseElement){\n\tconst element = event.target;\n\tconst javascriptClientData = getJavascriptClientData();\n\tlet data = {\n\t\tevent_javascript_data: javascriptClientData,\n\t\tpost_url: document.location.href,\n\t\treferrer: document.referrer,\n\t};\n\n\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\tevent.preventDefault();\n\t}\n\n\telement.setAttribute('title', ctPublicFunctions.text__wait_for_decoding);\n\telement.style.cursor = 'progress';\n\n\t// Adding a tooltip\n\tlet apbctTooltip = document.createElement('div');\n\tapbctTooltip.setAttribute('class', 'apbct-tooltip');\n\tlet apbctTooltipText = document.createElement('div');\n\tapbctTooltipText.setAttribute('class', 'apbct-tooltip--text');\n\tlet apbctTooltipArrow = document.createElement('div');\n\tapbctTooltipArrow.setAttribute('class', 'apbct-tooltip--arrow');\n\tapbct(element).append(apbctTooltip);\n\tapbct(apbctTooltip).append(apbctTooltipText);\n\tapbct(apbctTooltip).append(apbctTooltipArrow);\n\tctShowDecodeComment(element, ctPublicFunctions.text__wait_for_decoding);\n\n\tlet encodedEmail = event.target.dataset.originalString;\n\n\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\tencodedEmail = baseElement.dataset.originalString;\n\t}\n\n\tdata.encodedEmail = encodedEmail;\n\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_decode_email',\n\t\t\t{\n\t\t\t\tdata: data,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function(result) {\n\t\t\t\t\tapbctEmailEncoderCallback(result, baseElement, element);\n\t\t\t\t},\n\t\t\t\tonErrorCallback: function (res) {\n\t\t\t\t\telement.addEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\tctShowDecodeComment(element, 'Error occurred: ' + res);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\n\t// Using AJAX request and handler\n\t}else{\n\t\tdata.action = 'apbct_decode_email';\n\t\tapbct_public_sendAJAX(\n\t\t\tdata,\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result) {\n\t\t\t\t\tapbctEmailEncoderCallback(result, baseElement, element);\n\t\t\t\t},\n\t\t\t\tonErrorCallback: function (res) {\n\t\t\t\t\telement.addEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\tctShowDecodeComment(element, 'Error occurred: ' + res);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction apbctEmailEncoderCallback(result, baseElement, element) {\n\tif (result.success) {\n\t\tif (typeof baseElement.href !== 'undefined' && baseElement.href.indexOf('mailto:') === 0) {\n\t\t\tlet encodedEmail = baseElement.href.replace('mailto:', '');\n\t\t\tlet baseElementContent = baseElement.innerHTML;\n\t\t\tbaseElement.innerHTML = baseElementContent.replace(encodedEmail, result.data.decoded_email);\n\t\t\tbaseElement.href = 'mailto:' + result.data.decoded_email;\n\t\t\tbaseElement.click();\n\t\t} else {\n\t\t\tsetTimeout(function(){\n\t\t\t\tctProcessDecodedDataResult(result.data, element);\n\t\t\t}, 3000);\n\t\t}\n\t} else {\n\t\telement.removeAttribute('style');\n\t\tctShowDecodeComment(element, result.data.comment);\n\t}\n}\n\nfunction getJavascriptClientData(common_cookies = []) {\n\tlet resultDataJson = {};\n\n\tresultDataJson.apbct_headless = !!ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n\tresultDataJson.apbct_pixel_url = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n\tresultDataJson.ct_checked_emails = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails');\n\tresultDataJson.ct_checkjs = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checkjs');\n\tresultDataJson.ct_fkp_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_fkp_timestamp');\n\tresultDataJson.ct_pointer_data = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_pointer_data');\n\tresultDataJson.ct_ps_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_ps_timestamp');\n\tresultDataJson.ct_screen_info = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_screen_info');\n\tresultDataJson.ct_timezone = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_timezone');\n\n\t// collecting data from localstorage\n\tconst ctMouseMovedLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\t// collecting data from cookies\n\tconst ctMouseMovedCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\tresultDataJson.ct_mouse_moved = ctMouseMovedLocalStorage !== undefined ? ctMouseMovedLocalStorage : ctMouseMovedCookie;\n\tresultDataJson.ct_has_scrolled = ctHasScrolledLocalStorage !== undefined ? ctHasScrolledLocalStorage : ctHasScrolledCookie;\n\tresultDataJson.ct_cookies_type = ctCookiesTypeLocalStorage !== undefined ? ctCookiesTypeLocalStorage : ctCookiesTypeCookie;\n\n\tif (\n\t\ttypeof (common_cookies) === \"object\"\n\t\t&& common_cookies !== []\n\t){\n\t\tfor (let i = 0; i < common_cookies.length; ++i){\n\t\t\tif ( typeof (common_cookies[i][1]) === \"object\" ){\n\t\t\t\t//this is for handle SFW cookies\n\t\t\t\tresultDataJson[common_cookies[i][1][0]] = common_cookies[i][1][1]\n\t\t\t} else {\n\t\t\t\tresultDataJson[common_cookies[i][0]] = common_cookies[i][1]\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconsole.log('APBCT JS ERROR: Collecting data type mismatch')\n\t}\n\n\t// Parse JSON properties to prevent double JSON encoding\n\tresultDataJson = removeDoubleJsonEncoding(resultDataJson);\n\n\treturn JSON.stringify(resultDataJson);\n}\n\n/**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\nfunction removeDoubleJsonEncoding(object){\n\n\tif( typeof object === 'object'){\n\n\t\tfor (let objectKey in object) {\n\n\t\t\t// Recursion\n\t\t\tif( typeof object[objectKey] === 'object'){\n\t\t\t\tobject[objectKey] = removeDoubleJsonEncoding(object[objectKey]);\n\t\t\t}\n\n\t\t\t// Common case (out)\n\t\t\tif(\n\t\t\t\ttypeof object[objectKey] === 'string' &&\n\t\t\t\tobject[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n\t\t\t){\n\t\t\t\tlet parsedValue = JSON.parse(object[objectKey]);\n\t\t\t\tif( typeof parsedValue === 'object' ){\n\t\t\t\t\tobject[objectKey] = parsedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn object;\n}\n\nfunction ctProcessDecodedDataResult(response, targetElement) {\n\n\ttargetElement.setAttribute('title', '');\n\ttargetElement.removeAttribute('style');\n\n\tif( !! response.is_allowed) {\n\t\tctFillDecodedEmail(targetElement, response.decoded_email);\n\t}\n\n\tif( !! response.show_comment ){\n\t\tctShowDecodeComment(targetElement, response.comment);\n\t}\n}\n\nfunction ctFillDecodedEmail(target, email){\n\tapbct(target).html(\n\t\tapbct(target)\n\t\t\t.html()\n\t\t\t.replace(/.+?(<div class=[\"']apbct-tooltip[\"'].+?<\\/div>)/, email + \"$1\")\n\t);\n}\n\nfunction ctShowDecodeComment(target, comment){\n\n\tif( ! comment ){\n\t\treturn;\n\t}\n\n\tapbct(target.getElementsByClassName('apbct-tooltip')).fadeIn(300);\n\tapbct(target.getElementsByClassName('apbct-tooltip--text')).html(comment);\n\tsetTimeout(function(){\n\t\tapbct(target.getElementsByClassName('apbct-tooltip')).fadeOut(700);\n\t}, 5000);\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\tif (ctPublic.data__cookies_type === 'none'){\n\t\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection[0] ) );\n\t\t} else {\n\t\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t\t}\n\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\ttry {\n\t\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e.toString());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tctParseBlockMessage(response);\n\t\t}\n\t});\n}\n\nfunction ctParseBlockMessage(response) {\n\n\tif (typeof response.apbct !== 'undefined') {\n\t\tresponse = response.apbct;\n\t\tif (response.blocked) {\n\t\t\tdocument.dispatchEvent(\n\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\t// Show the result by modal\n\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\tcleantalkModal.open();\n\n\t\t\tif(+response.stop_script == 1)\n\t\t\t\twindow.stop();\n\t\t}\n\t}\n}\n\nfunction ctSetPixelUrlLocalstorage(ajax_pixel_url) {\n\t//set pixel to the storage\n\tctSetCookie('apbct_pixel_url', ajax_pixel_url)\n}\n\nfunction ctNoCookieConstructHiddenField(){\n\tlet field = ''\n\tlet no_cookie_data = apbctLocalStorage.getCleanTalkData()\n\tno_cookie_data = JSON.stringify(no_cookie_data)\n\tno_cookie_data = btoa(no_cookie_data)\n\tfield = document.createElement('input')\n\tfield.setAttribute('id','ct_no_cookie_hidden_field')\n\tfield.setAttribute('name','ct_no_cookie_hidden_field')\n\tfield.setAttribute('value', no_cookie_data)\n\tfield.setAttribute('type', 'hidden')\n\treturn field\n}\n\nfunction ctNoCookieGetForms(){\n\tlet forms = document.forms\n\tif (forms) {\n\t\treturn forms\n\t}\n\treturn false\n}\n\nfunction ctNoCookieAttachHiddenFieldsToForms(){\n\n\tif (ctPublic.data__cookies_type !== 'none'){\n\t\treturn\n\t}\n\n\tlet forms = ctNoCookieGetForms()\n\n\tif (forms){\n\t\t//clear previous hidden set\n\t\tlet elements = document.getElementsByName('ct_no_cookie_hidden_field')\n\t\tif (elements){\n\t\t\tfor (let j = 0; j < elements.length; j++) {\n\t\t\t\telements[j].parentNode.removeChild(elements[j])\n\t\t\t}\n\t\t}\n\t\tfor ( let i = 0; i < forms.length; i++ ){\n\t\t\t//ignore forms with get method @todo We need to think about this\n\t\t\tif (document.forms[i].getAttribute('method') === null ||\n\t\t\t\tdocument.forms[i].getAttribute('method').toLowerCase() === 'post'){\n\t\t\t\t// add new set\n\t\t\t\tdocument.forms[i].append(ctNoCookieConstructHiddenField())\n\t\t\t}\n\t\t}\n\t}\n\n}\n/* Cleantalk Modal object */\nlet cleantalkModal = {\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 ( let 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});\nlet buttons_to_handle = [];\n\ndocument.addEventListener('DOMContentLoaded', function(){\n\n\tif(\n\t\ttypeof ctPublicGDPR === 'undefined' ||\n\t\t! ctPublicGDPR.gdpr_forms.length\n\t) {\n\t\treturn;\n\t}\n\n\tlet gdpr_notice_for_button = ctPublicGDPR.gdpr_title;\n\n\tif ( typeof jQuery === 'undefined' ) {\n\t\treturn;\n\t}\n\ttry {\n\t\tctPublicGDPR.gdpr_forms.forEach(function(item, i){\n\n\t\t\tlet elem = jQuery('#'+item+', .'+item);\n\n\t\t\t// Filter forms\n\t\t\tif (!elem.is('form')){\n\t\t\t\t// Caldera\n\t\t\t\tif (elem.find('form')[0])\n\t\t\t\t\telem = elem.children('form').first();\n\t\t\t\t// Contact Form 7\n\t\t\t\telse if(\n\t\t\t\t\tjQuery('.wpcf7[role=form]')[0] && jQuery('.wpcf7[role=form]')\n\t\t\t\t\t\t.attr('id')\n\t\t\t\t\t\t.indexOf('wpcf7-f'+item) !== -1\n\t\t\t\t) {\n\t\t\t\t\telem = jQuery('.wpcf7[role=form]').children('form');\n\t\t\t\t}\n\n\t\t\t\t// Formidable\n\t\t\t\telse if(jQuery('.frm_forms')[0] && jQuery('.frm_forms').first().attr('id').indexOf('frm_form_'+item) !== -1)\n\t\t\t\t\telem = jQuery('.frm_forms').first().children('form');\n\t\t\t\t// WPForms\n\t\t\t\telse if(jQuery('.wpforms-form')[0] && jQuery('.wpforms-form').first().attr('id').indexOf('wpforms-form-'+item) !== -1)\n\t\t\t\t\telem = jQuery('.wpforms-form');\n\t\t\t}\n\n\t\t\t//disable forms buttons\n\t\t\tlet button = false\n\t\t\tlet buttons_collection= elem.find('input[type|=\"submit\"],button[type|=\"submit\"]')\n\n\t\t\tif (!buttons_collection.length) {\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tbutton = buttons_collection[0]\n\t\t\t}\n\n\t\t\tif (button !== false){\n\t\t\t\tbutton.disabled = true\n\t\t\t\tlet old_notice = jQuery(button).prop('title') ? jQuery(button).prop('title') : ''\n\t\t\t\tbuttons_to_handle.push({index:i,button:button,old_notice:old_notice})\n\t\t\t\tjQuery(button).prop('title', gdpr_notice_for_button)\n\t\t\t}\n\n\t\t\t// Adding notice and checkbox\n\t\t\tif(elem.is('form') || elem.attr('role') === 'form'){\n\t\t\t\telem.append('<input id=\"apbct_gdpr_'+i+'\" type=\"checkbox\" required=\"required\" style=\" margin-right: 10px;\" onchange=\"apbct_gdpr_handle_buttons()\">')\n\t\t\t\t\t.append('<label style=\"display: inline;\" for=\"apbct_gdpr_'+i+'\">'+ctPublicGDPR.gdpr_text+'</label>');\n\t\t\t}\n\t\t});\n\t} catch (e) {\n\t\tconsole.info('APBCT GDPR JS ERROR: Can not add GDPR notice' + e)\n\t}\n});\n\nfunction apbct_gdpr_handle_buttons(){\n\n\ttry {\n\n\t\tif (buttons_to_handle === []){\n\t\t\treturn\n\t\t}\n\n\t\tbuttons_to_handle.forEach((button) => {\n\t\t\tlet selector = '[id=\"apbct_gdpr_' + button.index + '\"]'\n\t\t\tlet apbct_gdpr_item = jQuery(selector)\n\t\t\t//chek if apbct_gdpr checkbox is set\n\t\t\tif (jQuery(apbct_gdpr_item).prop(\"checked\")){\n\t\t\t\tbutton.button.disabled = false\n\t\t\t\tjQuery(button.button).prop('title', button.old_notice)\n\t\t\t} else {\n\t\t\t\tbutton.button.disabled = true\n\t\t\t\tjQuery(button.button).prop('title', gdpr_notice_for_button)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.info('APBCT GDPR JS ERROR: Can not handle form buttons ' + e)\n\t}\n}\n/**\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 // Ajax checking for the integrated forms\n if(isIntegratedForm(currentForm)) {\n\n apbctProcessExternalForm(currentForm, i, document);\n\n // Common flow - modify form's action\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST'\n\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n // Trying to process external form into an iframe\n apbctProcessIframes()\n}\n\nfunction formIsExclusion(currentForm)\n{\n let exclusions_by_id = [\n 'give-form' //give form exclusion because of direct integration\n ]\n\n let result = false\n\n //mewto forms exclusion\n if (currentForm.parentElement\n && currentForm.parentElement.classList.length > 0\n && currentForm.parentElement.classList[0].indexOf('mewtwo') !== -1) {\n result = true\n }\n\n exclusions_by_id.forEach(function (id) {\n if ( typeof (currentForm.id) !== 'undefined' && currentForm.id.indexOf(id) !== -1 ) {\n result = true\n }\n })\n\n return result\n}\n\nfunction apbctProcessIframes()\n{\n const frames = document.getElementsByTagName('iframe');\n\n if ( frames.length > 0 ) {\n for ( let j = 0; j < frames.length; j++ ) {\n if ( frames[j].contentDocument == null ) {\n continue;\n }\n\n const iframeForms = frames[j].contentDocument.forms;\n\n if ( iframeForms.length === 0 ) {\n return;\n }\n\n for ( let y = 0; y < iframeForms.length; y++ ) {\n let currentForm = iframeForms[y];\n\n apbctProcessExternalForm(currentForm, y, frames[j].contentDocument);\n }\n }\n }\n}\n\nfunction apbctProcessExternalForm(currentForm, iterator, documentObject) {\n\n //process forms exclusions\n if ( formIsExclusion(currentForm)) {\n return\n }\n\n const cleantalk_placeholder = document.createElement(\"i\");\n cleantalk_placeholder.className = 'cleantalk_placeholder';\n cleantalk_placeholder.style = 'display: none';\n\n currentForm.parentElement.insertBefore(cleantalk_placeholder, currentForm);\n\n // Deleting form to prevent submit event\n let prev = currentForm.previousSibling,\n form_html = currentForm.outerHTML,\n form_original = currentForm;\n\n // Remove the original form\n currentForm.parentElement.removeChild(currentForm);\n\n // Insert a clone\n const placeholder = document.createElement(\"div\");\n placeholder.innerHTML = form_html;\n prev.after(placeholder.firstElementChild);\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 let reUseCurrentForm = documentObject.forms[iterator];\n\n reUseCurrentForm.appendChild(force_action);\n reUseCurrentForm.apbctPrev = prev;\n reUseCurrentForm.apbctFormOriginal = form_original;\n\n // mailerlite integration - disable click on submit button\n let mailerlite_detected_class = false\n if (reUseCurrentForm.classList !== undefined) {\n //list there all the mailerlite classes\n let mailerlite_classes = ['newsletterform', 'ml-block-form']\n mailerlite_classes.forEach(function(mailerlite_class) {\n if (reUseCurrentForm.classList.contains(mailerlite_class)){\n mailerlite_detected_class = mailerlite_class\n }\n });\n }\n if ( mailerlite_detected_class ) {\n let mailerliteSubmitButton = jQuery('form.' + mailerlite_detected_class).find('button[type=\"submit\"]');\n if ( mailerliteSubmitButton !== undefined ) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(event.currentTarget);\n });\n }\n } else {\n documentObject.forms[iterator].onsubmit = function ( event ){\n event.preventDefault();\n\n //mautic integration\n if (documentObject.forms[iterator].id.indexOf('mauticform') !== -1) {\n let checkbox = jQuery(documentObject.forms[iterator]).find('input[id*=\"checkbox_rgpd\"]')\n if (checkbox.length > 0){\n if (checkbox.prop(\"checked\") === true){\n let placeholder = jQuery('.cleantalk_placeholder')\n if (placeholder.length > 0) {\n placeholder[0].setAttribute('mautic_hidden_gdpr_id', checkbox.prop(\"id\"))\n }\n }\n }\n }\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget);\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\n if( ! +ctPublic.settings__forms__check_external ) {\n return;\n }\n\n if ( typeof jQuery === 'undefined' ) {\n return;\n }\n\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 let formId = formObj.id;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 || // Mailerlite integration\n formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1 ||\n formAction.indexOf('sendfox.com') !== -1 ||\n formAction.indexOf('aweber.com') !== -1 ||\n formAction.indexOf('secure.payu.com') !== -1 ||\n formAction.indexOf('mautic') !== -1 || formId.indexOf('mauticform_') !== -1\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( result, data, params, obj ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n let form_new = jQuery(form).detach();\n let prev = form.apbctPrev;\n let formOriginal = form.apbctFormOriginal;\n let mautic_integration = false;\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n //mautic forms integration\n if (formOriginal.id.indexOf('mautic') !== -1) {\n mautic_integration = true\n }\n let placeholders = document.getElementsByClassName('cleantalk_placeholder')\n if (placeholders) {\n for (let i = 0; i < placeholders.length; i++) {\n let mautic_hidden_gdpr_id = placeholders[i].getAttribute(\"mautic_hidden_gdpr_id\")\n if (typeof(mautic_hidden_gdpr_id) !== 'undefined') {\n let mautic_gdpr_radio = jQuery(formOriginal).find('#' + mautic_hidden_gdpr_id)\n if (typeof(mautic_gdpr_radio) !== 'undefined') {\n mautic_gdpr_radio.prop(\"checked\", true);\n }\n }\n }\n }\n\n prev.after( formOriginal );\n\n // Clear visible_fields input\n jQuery(formOriginal).find('input[name=\"apbct_visible_fields\"]').remove();\n jQuery(formOriginal).find('input[value=\"cleantalk_force_ajax_check\"]').remove();\n\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 if (mautic_integration) {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n }\n return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n if (result.apbct !== undefined && +result.apbct.blocked) {\n ctParseBlockMessage(result);\n }\n }\n }\n );\n}\n\nfunction 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 apbct_public_sendAJAX(\n ct_data,\n {\n url: ctPublicFunctions._ajax_url,\n callback: function (data) {\n if(data.success === true){\n currForm.submit();\n }else{\n alert(data.data);\n return false;\n }\n }\n }\n );\n}\n\ndocument.addEventListener('DOMContentLoaded',function(){\n let ct_currAction = '',\n ct_currForm = '';\n\n if( ! +ctPublic.settings__forms__check_internal ) {\n return;\n }\n\n let ctPrevHandler;\n\tfor( let i=0; i<document.forms.length; i++ ){\n\t\tif ( typeof(document.forms[i].action) == 'string' ){\n ct_currForm = document.forms[i];\n\t\t\tct_currAction = ct_currForm.action;\n if (\n ct_currAction.indexOf('https?://') !== null && // The protocol is obligatory\n ct_currAction.match(ctPublic.blog_home + '.*?\\.php') !== null && // Main check\n ! ct_check_internal__is_exclude_form(ct_currAction) // Exclude WordPress native scripts from processing\n ) {\n ctPrevHandler = ct_currForm.click;\n if ( typeof jQuery !== 'undefined' ) {\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(event){\n ct_check_internal(event.target);\n return false;\n });\n }\n }\n\t\t}\n\t}\n});\n\n/**\n * Check by action to exclude the form checking\n * @param action string\n * @return boolean\n */\nfunction ct_check_internal__is_exclude_form(action) {\n // An array contains forms action need to be excluded.\n let ct_internal_script_exclusions = [\n 'wp-login.php', // WordPress login page\n 'wp-comments-post.php', // WordPress Comments Form\n ];\n\n return ct_internal_script_exclusions.some((item) => {\n return action.match(new RegExp(ctPublic.blog_home + '.*' + item)) !== null;\n });\n}"],"names":["ApbctCore","ajax_parameters","rest_parameters","selector","elements","eventCallback","eventSelector","event","constructor","this","select","HTMLCollection","Array","prototype","slice","call","document","querySelectorAll","deselect","addElement","elemToAdd","push","elem","reduce","css","style","getRaw","let","style_name","DOM_style_name","replace","group","toUpperCase","i","length","computedStyle","getComputedStyle","Number","hide","prop","display","show","addClass","classList","add","className","removeClass","remove","toggleClass","toggle","ajax","ApbctAjax","rest","ApbctRest","on","args","addEventListener","onChecker","bind","target","querySelector","stopPropagation","ready","callback","change","attr","attrName","outputValue","propName","value","html","val","data","name","is","filter","isElem","elemToCheck","match","newlyCreatedElement","createElement","Boolean","HTMLElement","HTMLUnknownElement","indexOf","tagName","toLowerCase","isWithoutSelector","splice","parent","parentElement","parents","children","siblings","current","after","content","append","fadeIn","time","opacity","last","Date","tick","window","requestAnimationFrame","setTimeout","fadeOut","apbct","params","ApbctXhr","xhr","XMLHttpRequest","method","url","async","user","password","button","spinner","progressbar","context","onErrorCallback","responseType","headers","timeout","methods_to_convert_data_to_URL","body","http_code","status_text","parameters","key","console","log","prepare","Object","keys","deleteDoubleJSONEncoding","convertData","open","setHeaders","onreadystatechange","onReadyStateChange","onload","onLoad","onprogress","onProgress","onerror","onError","ontimeout","onTimeout","send","setAttribute","cursor","complete","status","statusText","removeAttribute","on_ready_state_change","on_progress","error","response","additional_msg","error_string","errorOutput","error_msg","header_name","setRequestHeader","convertDataToURL","convertDataToBody","params_appendix","URLSearchParams","toString","params_prefix","dataKey","FormData","JSON","stringify","object","objectKey","parsedValue","parse","super","default_route","ctPublicFunctions","_rest_url","route","X-WP-Nonce","_rest_nonce","ctSetCookie","cookies","expires","force_alternative_method_for_cookies","skip_alt","data__cookies_type","forced_alt_cookies_set","forEach","item","arr","apbctLocalStorage","set","encodeURIComponent","ctSetAlternativeCookie","ctNoCookieAttachHiddenFieldsToForms","ctSecure","location","protocol","cookie","cookiePrefix","getJavascriptClientData","e","data__ajax_type","apbct_public_sendREST","apbct_public_sendAJAX","action","notJson","ctGetCookie","matches","RegExp","decodeURIComponent","undefined","ctDeleteCookie","cookieName","obj","_params","callback_context","callback_params","silent","no_nonce","_ajax_url","_ajax_nonce","Math","random","no_cache","get","property","storageValue","localStorage","getItem","json","hasOwnProperty","is_json","objToSave","timestamp","floor","getTime","setItem","isAlive","maxLifetime","isSet","delete","removeItem","getCleanTalkData","ct_date","ctTimeMs","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","apbct_attach_event_handler","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctMouseReadInterval","ctMouseWriteDataInterval","ctFunctionFirstKey","ctKeyStopStopListening","ctFunctionMouseMove","ctPublic","data__key_is_ok","setInterval","ctSetMouseMoved","round","clientY","clientX","ctMouseStopData","clearInterval","checkEmail","current_email","email","result","now","ctSetPixelImg","pixelUrl","insertedImg","pixel__enabled","getElementById","ctGetPixelUrl","local_storage_pixel_url","ctSetHasScrolled","ctPreloadLocalStorage","data__to_local_storage","entries","apbct_ready","cookiesType","initCookies","getTimezoneOffset","apbctGetScreenInfo","navigator","webdriver","cookiesArray","split","trim","pixel__setting","pixel__url","data__email_check_before_post","forms","hiddenInput","visibleFieldsToInput","form","data__visible_fields_required","contains","id","apbct_collect_visible_fields","btoa","onsubmit_prev","onsubmit","ctFormIndex","visible_fields","apbct_visible_fields_set_cookie","Function","decodedEmailNodes","href","ctFillDecodedEmailHandler","apbctAjaxEmailDecode","baseElement","element","event_javascript_data","post_url","referrer","apbctTooltip","preventDefault","text__wait_for_decoding","apbctTooltipText","apbctTooltipArrow","ctShowDecodeComment","encodedEmail","dataset","originalString","apbctEmailEncoderCallback","res","baseElementContent","success","innerHTML","decoded_email","click","ctProcessDecodedDataResult","comment","common_cookies","resultDataJson","apbct_headless","apbct_pixel_url","ct_checked_emails","ct_checkjs","ct_fkp_timestamp","ct_pointer_data","ct_ps_timestamp","ct_screen_info","ct_timezone","ctMouseMovedLocalStorage","ctHasScrolledLocalStorage","ctCookiesTypeLocalStorage","ctMouseMovedCookie","ctHasScrolledCookie","ctCookiesTypeCookie","ct_mouse_moved","ct_has_scrolled","ct_cookies_type","removeDoubleJsonEncoding","targetElement","is_allowed","ctFillDecodedEmail","show_comment","getElementsByClassName","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","isNaN","getAttribute","visibility","visible_fields_count","invisible_fields","invisible_fields_count","visible_fields_collection","form_id","collection","apbct_js_keys__set_input_value","js_key","fullWidth","documentElement","scrollWidth","fullHeight","max","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ctParseBlockMessage","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","cleantalkModal","loaded","stop_script","stop","ctSetPixelUrlLocalstorage","ajax_pixel_url","ctNoCookieConstructHiddenField","field","no_cookie_data","ctNoCookieGetForms","getElementsByName","j","parentNode","removeChild","readyState","jQuery","ajaxComplete","settings","responseText","loading","opened","opening","load","apbct_admin_sendAJAX","renderCss","cssStr","styles","overlayCss","z-index","position","top","left","width","height","background","justify-content","align-items","innerCss","padding","border","border-radius","box-shadow","closeCss","right","box-sizing","closeCssBefore","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","overlay","inner","close","buttons_to_handle","apbct_gdpr_handle_buttons","index","apbct_gdpr_item","disabled","old_notice","gdpr_notice_for_button","info","ct_protect_external","currentForm","ct_method","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","apbctProcessExternalForm","hostname","ct_action","type","appendChild","apbctProcessIframes","formIsExclusion","frames","getElementsByTagName","contentDocument","iframeForms","y","iterator","documentObject","cleantalk_placeholder","prev","insertBefore","previousSibling","form_html","outerHTML","form_original","placeholder","force_action","firstElementChild","reUseCurrentForm","mailerlite_detected_class","apbctPrev","apbctFormOriginal","mailerlite_class","mailerliteSubmitButton","find","sendAjaxCheckingFormData","currentTarget","checkbox","clone","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","elem_source","source","index2","elem_target","formObj","formAction","formId","firstChild","formOriginal","elems","form_new","detach","mautic_integration","placeholders","mautic_hidden_gdpr_id","mautic_gdpr_radio","subm_button","ct_check_internal","currForm","ct_data","alert","submit","ct_check_internal__is_exclude_form","some","blog_home","ctPublicGDPR","gdpr_forms","gdpr_title","first","buttons_collection","gdpr_text","settings__forms__check_external","ct_currForm","ct_currAction","settings__forms__check_internal","off"],"mappings":"MAAMA,UAEFC,gBAAkB,GAClBC,gBAAkB,GAElBC,SAAW,KACXC,SAAW,GAGXC,cACAC,cACAC,MAKAC,YAAYL,GACRM,KAAKC,OAAOP,CAAQ,CACxB,CAQAO,OAAOP,GAkBH,OAhBGA,aAAoBQ,gBACnBF,KAAKN,SAAc,KACnBM,KAAKL,SAAc,GACnBK,KAAKL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mS,MAAMjR,OAAQD,CAAC,GACE,UAApC,OAAOjB,SAASmS,MAAMlR,GAAS,QAIiB,QAFpDugB,GADSD,EAAcvhB,SAASmS,MAAMlR,IACVqL,QAEDlI,QAAQ,WAAW,GACwB,OAAzDod,EAAc1d,MAAM+L,SAASkR,UAAY,SAAU,GACjDF,mCAAmCW,CAAa,IAElCD,EAAY7M,MACL,aAAlB,OAAO+E,SACRA,OAAO8H,CAAW,EAAEG,IAAI,IAAI,EAC5BjI,OAAO8H,CAAW,EAAEG,IAAI,EACxBjI,OAAO8H,CAAW,EAAEjf,GAAG,SAAU,SAAS/C,GAEtC,OADAihB,kBAAkBjhB,EAAMoD,MAAM,EACvB,CAAA,CACX,CAAC,GAKrB,CAAC"}
1
+ {"version":3,"file":"apbct-public-bundle.min.js","sources":["apbct-public-bundle.js"],"sourcesContent":["class ApbctCore{\n\n ajax_parameters = {};\n rest_parameters = {};\n\n selector = null;\n elements = [];\n\n // Event properties\n eventCallback;\n eventSelector;\n event;\n\n /**\n * Default constructor\n */\n constructor(selector){\n this.select(selector);\n }\n\n /**\n * Get elements by CSS selector\n *\n * @param selector\n * @returns {*}\n */\n select(selector) {\n\n if(selector instanceof HTMLCollection){\n this.selector = null;\n this.elements = [];\n this.elements = Array.prototype.slice.call(selector);\n }else if( typeof selector === 'object' ){\n this.selector = null;\n this.elements = [];\n this.elements[0] = selector;\n }else if( typeof selector === 'string' ){\n this.selector = selector;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(selector));\n // this.elements = document.querySelectorAll(selector)[0];\n }else{\n this.deselect();\n }\n\n return this;\n }\n\n addElement(elemToAdd){\n if( typeof elemToAdd === 'object' ){\n this.elements.push(elemToAdd);\n }else if( typeof elemToAdd === 'string' ){\n this.selector = elemToAdd;\n this.elements = Array.prototype.slice.call(document.querySelectorAll(elemToAdd));\n }else{\n this.deselect();\n }\n }\n\n push(elem){\n this.elements.push(elem);\n }\n\n reduce(){\n this.elements = this.elements.slice(0,-1);\n }\n\n deselect(){\n this.elements = [];\n }\n\n /**\n * Set or get CSS for/of currently selected element\n *\n * @param style\n * @param getRaw\n *\n * @returns {boolean|*}\n */\n css(style, getRaw){\n\n getRaw = getRaw | false;\n\n // Set style\n if(typeof style === \"object\"){\n\n const stringToCamelCase = str =>\n str.replace(/([-_][a-z])/g, group =>\n group\n .toUpperCase()\n .replace('-', '')\n .replace('_', '')\n );\n\n // Apply multiple styles\n for(let style_name in style){\n let DOM_style_name = stringToCamelCase(style_name);\n\n // Apply to multiple elements (currently selected)\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].style[DOM_style_name] = style[style_name];\n }\n }\n\n return this;\n }\n\n // Get style of first currently selected element\n if(typeof style === 'string'){\n\n let computedStyle = getComputedStyle(this.elements[0])[style];\n\n // Process\n if( typeof computedStyle !== 'undefined' && ! getRaw){\n computedStyle = computedStyle.replace(/(\\d)(em|pt|%|px){1,2}$/, '$1'); // Cut of units\n computedStyle = Number(computedStyle) == computedStyle ? Number(computedStyle) : computedStyle; // Cast to INT\n return computedStyle;\n }\n\n // Return unprocessed\n return computedStyle;\n }\n }\n\n hide(){\n this.prop('prev-display', this.css('display'));\n this.css({'display': 'none'});\n }\n\n show(){\n this.css({'display': this.prop('prev-display')});\n }\n\n addClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.add(className);\n }\n }\n\n removeClass(){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.remove(className);\n }\n }\n\n toggleClass(className){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].classList.toggle(className);\n }\n }\n\n /**\n * Wrapper for apbctAJAX class\n *\n * @param ajax_parameters\n * @returns {ApbctAjax}\n */\n ajax(ajax_parameters){\n this.ajax_parameters = ajax_parameters;\n return new ApbctAjax(ajax_parameters);\n }\n\n /**\n * Wrapper for apbctREST class\n *\n * @param rest_parameters\n * @returns {ApbctRest}\n */\n rest(rest_parameters){\n this.rest_parameters = rest_parameters;\n return new ApbctRest(rest_parameters);\n }\n\n /************** EVENTS **************/\n\n /**\n *\n * Why the mess with arguments?\n *\n * Because we need to support the following function signatures:\n * on('click', function(){ alert('some'); });\n * on('click', 'inner_selector', function(){ alert('some'); });\n *\n * @param args\n */\n on(...args){\n\n this.event = args[0];\n this.eventCallback = args[2] || args[1];\n this.eventSelector = typeof args[1] === \"string\" ? args[1] : null;\n\n for(let i=0; i<this.elements.length; i++){\n this.elements[i].addEventListener(\n this.event,\n this.eventSelector !== null\n ? this.onChecker.bind(this)\n : this.eventCallback\n );\n }\n }\n\n /**\n * Check if a selector of an event matches current target\n *\n * @param event\n * @returns {*}\n */\n onChecker(event){\n if(event.target === document.querySelector(this.eventSelector)){\n event.stopPropagation();\n return this.eventCallback(event);\n }\n }\n\n ready(callback){\n document.addEventListener('DOMContentLoaded', callback);\n }\n\n change(callback){\n this.on('change', callback);\n }\n\n /************** ATTRIBUTES **************/\n\n /**\n * Get an attribute or property of an element\n *\n * @param attrName\n * @returns {*|*[]}\n */\n attr(attrName){\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n\n // Use property instead of attribute if possible\n if(typeof this.elements[i][attrName] !== undefined){\n outputValue.push(this.elements[i][attrName]);\n }else{\n outputValue.push(this.elements[i].getAttribute(attrName));\n }\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n\n prop(propName, value){\n\n // Setting values\n if(typeof value !== \"undefined\"){\n for(let i=0; i<this.elements.length; i++){\n this.elements[i][propName] = value;\n }\n\n return this;\n\n // Getting values\n }else{\n\n let outputValue = [];\n\n for(let i=0; i<this.elements.length; i++){\n outputValue.push(this.elements[i][propName]);\n }\n\n // Return a single value instead of array if only one value is present\n return outputValue.length === 1 ? outputValue[0] : outputValue;\n }\n }\n\n /**\n * Set or get inner HTML\n *\n * @param value\n * @returns {*|*[]}\n */\n html(value){\n return typeof value !== 'undefined'\n ? this.prop('innerHTML', value)\n : this.prop('innerHTML');\n }\n\n /**\n * Set or get value of input tags\n *\n * @param value\n * @returns {*|*[]|undefined}\n */\n val(value){\n return typeof value !== 'undefined'\n ? this.prop('value', value)\n : this.prop('value');\n }\n\n data(name, value){\n return typeof value !== 'undefined'\n ? this.prop('apbct-data', name, value)\n : this.prop('apbct-data');\n }\n\n /************** END OF ATTRIBUTES **************/\n\n /************** FILTERS **************/\n\n /**\n * Check if the current elements are corresponding to filter\n *\n * @param filter\n * @returns {boolean}\n */\n is(filter){\n\n let outputValue = false;\n\n for(let elem of this.elements){\n outputValue ||= this.isElem(elem, filter);\n }\n\n return outputValue;\n }\n\n isElem(elemToCheck, filter){\n\n let is = false;\n let isRegisteredTagName = function(name){\n let newlyCreatedElement = document.createElement(name).constructor;\n return ! Boolean( ~[HTMLElement, HTMLUnknownElement].indexOf(newlyCreatedElement) );\n };\n\n // Check for filter function\n if(typeof filter === 'function') {\n is ||= filter.call(this, elemToCheck);\n }\n\n // Check for filter function\n if(typeof filter === 'string') {\n\n // Filter is tag name\n if( filter.match(/^[a-z]/) && isRegisteredTagName(filter) ){\n is ||= elemToCheck.tagName.toLowerCase() === filter.toLowerCase();\n\n // Filter is property\n }else if( filter.match(/^[a-z]/) ){\n is ||= Boolean(elemToCheck[filter]);\n\n // Filter is CSS selector\n }else {\n is ||= this.selector !== null\n ? document.querySelector(this.selector + filter) !== null // If possible\n : this.isWithoutSelector(elemToCheck, filter); // Search through all elems with such selector\n }\n }\n\n return is;\n }\n\n isWithoutSelector(elemToCheck, filter){\n\n let elems = document.querySelectorAll(filter);\n let outputValue = false;\n\n for(let elem of elems){\n outputValue ||= elemToCheck === elem;\n }\n\n return outputValue;\n }\n\n filter(filter){\n\n this.selector = null;\n\n for( let i = this.elements.length - 1; i >= 0; i-- ){\n if( ! this.isElem(this.elements[i], filter) ){\n this.elements.splice(Number(i), 1);\n }\n }\n\n return this;\n }\n\n /************** NODES **************/\n\n parent(filter){\n\n this.select(this.elements[0].parentElement);\n\n if( typeof filter !== 'undefined' && ! this.is(filter) ){\n this.deselect();\n }\n\n return this;\n }\n\n parents(filter){\n\n this.select(this.elements[0]);\n\n for ( ; this.elements[ this.elements.length - 1].parentElement !== null ; ) {\n this.push(this.elements[ this.elements.length - 1].parentElement);\n }\n\n this.elements.splice(0,1); // Deleting initial element from the set\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n children(filter){\n\n this.select(this.elements[0].children);\n\n if( typeof filter !== 'undefined' ){\n this.filter(filter);\n }\n\n return this;\n }\n\n siblings(filter){\n\n let current = this.elements[0]; // Remember current to delete it later\n\n this.parent();\n this.children(filter);\n this.elements.splice(this.elements.indexOf(current), 1); // Remove current element\n\n return this;\n }\n\n /************** DOM MANIPULATIONS **************/\n remove(){\n for(let elem of this.elements){\n elem.remove();\n }\n }\n\n after(content){\n for(let elem of this.elements){\n elem.after(content);\n }\n }\n\n append(content){\n for(let elem of this.elements){\n elem.append(content);\n }\n }\n\n /************** ANIMATION **************/\n fadeIn(time) {\n for(let elem of this.elements){\n elem.style.opacity = 0;\n elem.style.display = 'block';\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity + (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity < 1) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n }\n };\n\n tick();\n }\n }\n\n fadeOut(time) {\n for(let elem of this.elements){\n elem.style.opacity = 1;\n\n let last = +new Date();\n const tick = function () {\n elem.style.opacity = +elem.style.opacity - (new Date() - last) / time;\n last = +new Date();\n\n if (+elem.style.opacity > 0) {\n (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);\n } else {\n elem.style.display = 'none';\n }\n };\n\n tick();\n }\n }\n}\n\n/**\n * Hack\n *\n * Make a proxy to keep both properties and methods from:\n * - the native object and\n * - the new one from ApbctCore for selected element.\n *\n * For example:\n * apbct('#id).innerHTML = 'some';\n * apbct('#id).css({'backgorund-color': 'black'});\n */\n// apbct = new Proxy(\n// apbct,\n// {\n// get(target, prop) {\n// if (target.elements.length) {\n// return target.elements[0][prop];\n// } else {\n// return null;\n// }\n// },\n// set(target, prop, value){\n// if (target.elements.length) {\n// target.elements[0][prop] = value;\n// return true;\n// } else {\n// return false;\n// }\n// },\n// apply(target, thisArg, argArray) {\n//\n// }\n// }\n// );\n\n/**\n * Enter point to ApbctCore class\n *\n * @param params\n * @returns {*}\n */\nfunction apbct(params){\n return new ApbctCore()\n .select(params);\n}\nclass ApbctXhr{\n\n xhr = new XMLHttpRequest();\n\n // Base parameters\n method = 'POST'; // HTTP-request type\n url = ''; // URL to send the request\n async = true;\n user = null; // HTTP-authorization username\n password = null; // HTTP-authorization password\n data = {}; // Data to send\n\n\n // Optional params\n button = null; // Button that should be disabled when request is performing\n spinner = null; // Spinner that should appear when request is in process\n progressbar = null; // Progress bar for the current request\n context = this; // Context\n callback = null;\n onErrorCallback = null;\n\n responseType = 'json'; // Expected data type from server\n headers = {};\n timeout = 15000; // Request timeout in milliseconds\n\n methods_to_convert_data_to_URL = [\n 'GET',\n 'HEAD',\n ];\n\n body = null;\n http_code = 0;\n status_text = '';\n\n constructor(parameters){\n\n console.log('%cXHR%c started', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;');\n\n // Set class properties\n for( let key in parameters ){\n if( typeof this[key] !== 'undefined' ){\n this[key] = parameters[key];\n }\n }\n\n // Modifying DOM-elements\n this.prepare();\n\n // Modify URL with data for GET and HEAD requests\n if ( Object.keys(this.data).length ) {\n this.deleteDoubleJSONEncoding(this.data);\n this.convertData();\n }\n\n if( ! this.url ){\n console.log('%cXHR%c not URL provided', 'color: red; font-weight: bold;', 'color: grey; font-weight: normal;')\n return false;\n }\n\n // Configure the request\n this.xhr.open(this.method, this.url, this.async, this.user, this.password);\n this.setHeaders();\n\n this.xhr.responseType = this.responseType;\n this.xhr.timeout = this.timeout;\n\n /* EVENTS */\n // Monitoring status\n this.xhr.onreadystatechange = function(){\n this.onReadyStateChange();\n }.bind(this);\n\n // Run callback\n this.xhr.onload = function(){\n this.onLoad();\n }.bind(this);\n\n // On progress\n this.xhr.onprogress = function(event){\n this.onProgress(event);\n }.bind(this);\n\n // On error\n this.xhr.onerror = function(){\n this.onError();\n }.bind(this);\n\n this.xhr.ontimeout = function(){\n this.onTimeout();\n }.bind(this);\n\n // Send the request\n this.xhr.send(this.body);\n }\n\n prepare(){\n\n // Disable button\n if(this.button){\n this.button.setAttribute('disabled', 'disabled');\n this.button.style.cursor = 'not-allowed';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'inline';\n }\n }\n\n complete(){\n\n this.http_code = this.xhr.status;\n this.status_text = this.xhr.statusText;\n\n // Disable button\n if(this.button){\n this.button.removeAttribute('disabled');\n this.button.style.cursor = 'auto';\n }\n\n // Enable spinner\n if(this.spinner) {\n this.spinner.style.display = 'none';\n }\n\n if( this.progressbar ) {\n this.progressbar.fadeOut('slow');\n }\n }\n\n onReadyStateChange(){\n if (this.on_ready_state_change !== null && typeof this.on_ready_state_change === 'function'){\n this.on_ready_state_change();\n }\n }\n\n onProgress(event) {\n if (this.on_progress !== null && typeof this.on_progress === 'function'){\n this.on_progress();\n }\n }\n\n onError(){\n\n console.log('error');\n\n this.complete();\n this.error(\n this.http_code,\n this.status_text\n );\n\n if (this.onErrorCallback !== null && typeof this.onErrorCallback === 'function'){\n this.onErrorCallback(this.status_text);\n }\n }\n\n onTimeout(){\n this.complete();\n this.error(\n 0,\n 'timeout'\n );\n\n if (this.onErrorCallback !== null && typeof this.onErrorCallback === 'function'){\n this.onErrorCallback('Timeout');\n }\n }\n\n onLoad(){\n\n this.complete();\n\n if (this.responseType === 'json' ){\n if(this.xhr.response === null){\n this.error(this.http_code, this.status_text, 'No response');\n return false;\n }else if( typeof this.xhr.response.error !== 'undefined') {\n this.error(this.http_code, this.status_text, this.xhr.response.error);\n return false;\n }\n }\n\n if (this.callback !== null && typeof this.callback === 'function') {\n this.callback.call(this.context, this.xhr.response, this.data);\n }\n }\n\n error(http_code, status_text, additional_msg){\n\n let error_string = '';\n\n if( status_text === 'timeout' ){\n error_string += 'Server response timeout'\n\n }else if( http_code === 200 ){\n\n if( status_text === 'parsererror' ){\n error_string += 'Unexpected response from server. See console for details.';\n }else {\n error_string += 'Unexpected error. Status: ' + status_text + '.';\n if( typeof additional_msg !== 'undefined' )\n error_string += ' Additional error info: ' + additional_msg;\n }\n\n }else if(http_code === 500){\n error_string += 'Internal server error.';\n\n }else {\n error_string += 'Unexpected response code:' + http_code;\n }\n\n this.errorOutput( error_string );\n }\n\n errorOutput(error_msg){\n console.log( '%c ctXHR error: %c' + error_msg, 'color: red;', 'color: grey;' );\n }\n\n setHeaders(){\n // Set headers if passed\n for( let header_name in this.headers ){\n if( typeof this.headers[header_name] !== 'undefined' ){\n this.xhr.setRequestHeader(header_name, this.headers[header_name]);\n }\n }\n }\n\n convertData()\n {\n // GET, HEAD request-type\n if( ~this.methods_to_convert_data_to_URL.indexOf( this.method ) ){\n return this.convertDataToURL();\n\n // POST request-type\n }else{\n return this.convertDataToBody()\n }\n }\n\n convertDataToURL(){\n let params_appendix = new URLSearchParams(this.data).toString();\n let params_prefix = this.url.match(/^(https?:\\/{2})?[a-z0-9.]+\\?/) ? '&' : '?';\n this.url += params_prefix + params_appendix;\n\n return this.url;\n }\n\n /**\n *\n * @returns {null}\n */\n convertDataToBody()\n {\n this.body = new FormData();\n\n for (let dataKey in this.data) {\n this.body.append(\n dataKey,\n typeof this.data[dataKey] === 'object'\n ? JSON.stringify(this.data[dataKey])\n : this.data[dataKey]\n );\n }\n\n return this.body;\n }\n\n /**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\n deleteDoubleJSONEncoding(object){\n\n if( typeof object === 'object'){\n\n for (let objectKey in object) {\n\n // Recursion\n if( typeof object[objectKey] === 'object'){\n object[objectKey] = this.deleteDoubleJSONEncoding(object[objectKey]);\n }\n\n // Common case (out)\n if(\n typeof object[objectKey] === 'string' &&\n object[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n ){\n let parsedValue = JSON.parse(object[objectKey]);\n if( typeof parsedValue === 'object' ){\n object[objectKey] = parsedValue;\n }\n }\n }\n }\n\n return object;\n }\n}\nclass ApbctAjax extends ApbctXhr{\n\n constructor(...args) {\n super(args[0]);\n }\n}\nclass ApbctRest extends ApbctXhr{\n\n static default_route = ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/';\n route = '';\n\n constructor(...args) {\n args = args[0];\n args.url = ApbctRest.default_route + args.route;\n args.headers = {\n \"X-WP-Nonce\": ctPublicFunctions._rest_nonce\n };\n super(args);\n }\n}\n\nfunction ctSetCookie( cookies, value, expires ){\n\n let force_alternative_method_for_cookies = [\n 'ct_sfw_pass_key',\n 'ct_sfw_passed',\n 'wordpress_apbct_antibot',\n 'apbct_anticrawler_passed',\n 'apbct_antiflood_passed',\n 'apbct_email_encoder_passed'\n ]\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 let forced_alt_cookies_set = []\n cookies.forEach( function (item, i, arr\t) {\n if (force_alternative_method_for_cookies.indexOf(item[0]) !== -1) {\n forced_alt_cookies_set.push(item)\n } else {\n apbctLocalStorage.set(item[0], encodeURIComponent(item[1]))\n }\n });\n if ( forced_alt_cookies_set.length > 0 ){\n ctSetAlternativeCookie(forced_alt_cookies_set)\n }\n ctNoCookieAttachHiddenFieldsToForms()\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 = ctPublicFunctions.cookiePrefix + 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 ctSetAlternativeCookie(cookies)\n }\n}\n\nfunction ctSetAlternativeCookie(cookies){\n if (typeof (getJavascriptClientData) === \"function\"){\n //reprocess already gained cookies data\n cookies = getJavascriptClientData(cookies);\n } else {\n console.log('APBCT ERROR: getJavascriptClientData() is not loaded')\n }\n\n try {\n JSON.parse(cookies)\n } catch (e){\n console.log('APBCT ERROR: JSON parse error:' + e)\n return\n }\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 === '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/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction ctGetCookie(name) {\n var matches = document.cookie.match(new RegExp(\n \"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n ));\n return matches ? decodeURIComponent(matches[1]) : undefined;\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 let _params = [];\n _params[\"callback\"] = params.callback || null;\n _params[\"onErrorCallback\"] = params.onErrorCallback || null;\n _params[\"callback_context\"] = params.callback_context || null;\n _params[\"callback_params\"] = params.callback_params || null;\n _params[\"async\"] = params.async || true;\n _params[\"notJson\"] = params.notJson || null;\n _params[\"timeout\"] = params.timeout || 15000;\n _params[\"obj\"] = obj || null;\n _params[\"button\"] = params.button || null;\n _params[\"progressbar\"] = params.progressbar || null;\n _params[\"silent\"] = params.silent || null;\n _params[\"no_nonce\"] = params.no_nonce || null;\n _params[\"data\"] = data;\n _params[\"url\"] = ctPublicFunctions._ajax_url;\n\n if(typeof (data) === 'string') {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"] = _params[\"data\"] + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"] = _params[\"data\"] + '&no_cache=' + Math.random()\n } else {\n if( ! _params[\"no_nonce\"] ) {\n _params[\"data\"]._ajax_nonce = ctPublicFunctions._ajax_nonce;\n }\n _params[\"data\"].no_cache = Math.random();\n }\n\n new ApbctCore().ajax(_params);\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n let _params = [];\n _params[\"route\"] = route;\n _params[\"callback\"] = params.callback || null;\n _params[\"onErrorCallback\"] = params.onErrorCallback || null;\n _params[\"data\"] = params.data || [];\n _params[\"method\"] = params.method || 'POST';\n\n new ApbctCore().rest(_params);\n}\n\nlet apbctLocalStorage = {\n get : function(key, property) {\n if ( typeof property === 'undefined' ) {\n property = 'value';\n }\n const storageValue = localStorage.getItem(key);\n if ( storageValue !== null ) {\n try {\n const json = JSON.parse(storageValue);\n return json.hasOwnProperty(property) ? JSON.parse(json[property]) : json;\n } catch (e) {\n return storageValue;\n }\n }\n return false;\n },\n set : function(key, value, is_json = true) {\n if (is_json){\n let objToSave = {'value': JSON.stringify(value), 'timestamp': Math.floor(new Date().getTime() / 1000)};\n localStorage.setItem(key, JSON.stringify(objToSave));\n } else {\n localStorage.setItem(key, value);\n }\n },\n isAlive : function(key, maxLifetime) {\n if ( typeof maxLifetime === 'undefined' ) {\n maxLifetime = 86400;\n }\n const keyTimestamp = this.get(key, 'timestamp');\n return keyTimestamp + maxLifetime > Math.floor(new Date().getTime() / 1000);\n },\n isSet : function(key) {\n return localStorage.getItem(key) !== null;\n },\n delete : function (key) {\n localStorage.removeItem(key);\n },\n getCleanTalkData : function () {\n let data = {}\n for(let i=0; i<localStorage.length; i++) {\n let key = localStorage.key(i);\n if (key.indexOf('ct_') !==-1 || key.indexOf('apbct_') !==-1){\n data[key.toString()] = apbctLocalStorage.get(key)\n }\n }\n return data\n },\n\n}\nvar ct_date = new Date(),\n\tctTimeMs = new Date().getTime(),\n\tctMouseEventTimerFlag = true, //Reading interval flag\n\tctMouseData = [],\n\tctMouseDataCounter = 0,\n\tctCheckedEmails = {};\n\nfunction apbct_attach_event_handler(elem, event, callback){\n\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\telse elem.attachEvent(event, callback);\n}\n\nfunction apbct_remove_event_handler(elem, event, callback){\n\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\telse elem.detachEvent(event, callback);\n}\n\n//Writing first key press timestamp\nvar ctFunctionFirstKey = function output(event){\n\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\tctKeyStopStopListening();\n};\n\nif (ctPublic.data__key_is_ok) {\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\n\n//Logging mouse position each 150 ms\nvar ctFunctionMouseMove = function output(event){\n\tctSetMouseMoved();\n\tif(ctMouseEventTimerFlag === true){\n\n\t\tctMouseData.push([\n\t\t\tMath.round(event.clientY),\n\t\t\tMath.round(event.clientX),\n\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t]);\n\n\t\tctMouseDataCounter++;\n\t\tctMouseEventTimerFlag = false;\n\t\tif(ctMouseDataCounter >= 50){\n\t\t\tctMouseStopData();\n\t\t}\n\t}\n};\n\n//Stop mouse observing function\nfunction ctMouseStopData(){\n\tapbct_remove_event_handler(document, \"mousemove\", ctFunctionMouseMove);\n\tclearInterval(ctMouseReadInterval);\n\tclearInterval(ctMouseWriteDataInterval);\n}\n\n//Stop key listening function\nfunction ctKeyStopStopListening(){\n\tapbct_remove_event_handler(document, \"mousedown\", ctFunctionFirstKey);\n\tapbct_remove_event_handler(document, \"keydown\", ctFunctionFirstKey);\n}\n\nfunction checkEmail(e) {\n\tvar current_email = e.target.value;\n\tif (current_email && !(current_email in ctCheckedEmails)) {\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'check_email_before_post',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\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\t// Using AJAX request and handler\n\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\temail : current_email,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\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\nfunction ctSetPixelImg(pixelUrl) {\n\tctSetCookie('apbct_pixel_url', pixelUrl);\n\tif( +ctPublic.pixel__enabled ){\n\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\tlet insertedImg = document.createElement('img');\n\t\t\tinsertedImg.setAttribute('alt', 'CleanTalk Pixel');\n\t\t\tinsertedImg.setAttribute('id', 'apbct_pixel');\n\t\t\tinsertedImg.setAttribute('style', 'display: none; left: 99999px;');\n\t\t\tinsertedImg.setAttribute('src', pixelUrl);\n\t\t\tapbct('body').append(insertedImg);\n\t\t}\n\t}\n}\n\nfunction ctGetPixelUrl() {\n\t// Check if pixel is already in localstorage and is not outdated\n\tlet local_storage_pixel_url = apbctLocalStorage.get('apbct_pixel_url');\n\tif ( local_storage_pixel_url !== false ) {\n\t\tif ( apbctLocalStorage.isAlive('apbct_pixel_url', 3600 * 3) ) {\n\t\t\tapbctLocalStorage.delete('apbct_pixel_url')\n\t\t} else {\n\t\t\t//if so - load pixel from localstorage and draw it skipping AJAX\n\t\t\tctSetPixelImg(local_storage_pixel_url);\n\t\t\treturn;\n\t\t}\n\t}\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_get_pixel_url',\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! apbctLocalStorage.get('apbct_pixel_url') ){\n\t\t\t\t\t\t\t//set pixel to the storage\n\t\t\t\t\t\t\tapbctLocalStorage.set('apbct_pixel_url', result)\n\t\t\t\t\t\t\t//update pixel data in the hidden fields\n\t\t\t\t\t\t\tctNoCookieAttachHiddenFieldsToForms()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tapbct_public_sendAJAX(\n\t\t\t{\n\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\tif ( ! apbctLocalStorage.get('apbct_pixel_url') ){\n\t\t\t\t\t\t\t//set pixel to the storage\n\t\t\t\t\t\t\tapbctLocalStorage.set('apbct_pixel_url', result)\n\t\t\t\t\t\t\t//update pixel data in the hidden fields\n\t\t\t\t\t\t\tctNoCookieAttachHiddenFieldsToForms()\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction ctSetHasScrolled() {\n\tif( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\tapbctLocalStorage.set('ct_has_scrolled', true);\n\t}\n}\n\nfunction ctSetMouseMoved() {\n\tif( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\tapbctLocalStorage.set('ct_mouse_moved', true);\n\t}\n}\n\nfunction ctPreloadLocalStorage(){\n\tif (ctPublic.data__to_local_storage){\n\t\tlet data = Object.entries(ctPublic.data__to_local_storage)\n\t\tdata.forEach(([key, value]) => {\n\t\t\tapbctLocalStorage.set(key,value)\n\t\t});\n\t}\n}\n\nif (ctPublic.data__key_is_ok) {\n\tapbct_attach_event_handler(document, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(document, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(document, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(document, \"scroll\", ctSetHasScrolled);\n}\n\n// Ready function\nfunction apbct_ready(){\n\n\tctPreloadLocalStorage()\n\n\tlet cookiesType = apbctLocalStorage.get('ct_cookies_type');\n\tif ( ! cookiesType || cookiesType !== ctPublic.data__cookies_type ) {\n\t\tapbctLocalStorage.set('ct_cookies_type', ctPublic.data__cookies_type);\n\t\tapbctLocalStorage.delete('ct_mouse_moved');\n\t\tapbctLocalStorage.delete('ct_has_scrolled');\n\t}\n\n\t// Collect scrolling info\n\tvar initCookies = [\n\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t[\"ct_pointer_data\", \"0\"],\n\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t[\"apbct_headless\", navigator.webdriver],\n\t];\n\n\tapbctLocalStorage.set('ct_ps_timestamp', Math.floor(new Date().getTime() / 1000));\n\tapbctLocalStorage.set('ct_fkp_timestamp', \"0\");\n\tapbctLocalStorage.set('ct_pointer_data', \"0\");\n\tapbctLocalStorage.set('ct_timezone', ct_date.getTimezoneOffset()/60*(-1) );\n\tapbctLocalStorage.set('ct_screen_info', apbctGetScreenInfo());\n\tapbctLocalStorage.set('apbct_headless', navigator.webdriver);\n\n\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t} else {\n\t\t// Delete all visible fields cookies on load the page\n\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\tif( cookiesArray.length !== 0 ) {\n\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif( +ctPublic.pixel__setting ){\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tctGetPixelUrl()\n\t\t} else {\n\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t}\n\t}\n\n\tif ( +ctPublic.data__email_check_before_post) {\n\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\tapbct(\"input[type = 'email'], #email\").on('blur', checkEmail);\n\t}\n\n\tif (apbctLocalStorage.isSet('ct_checkjs')) {\n\t\tinitCookies.push(['ct_checkjs', apbctLocalStorage.get('ct_checkjs')]);\n\t} else {\n\t\tinitCookies.push(['ct_checkjs', 0]);\n\t}\n\n\tctSetCookie(initCookies);\n\n\tsetTimeout(function(){\n\n\t\tctNoCookieAttachHiddenFieldsToForms()\n\n\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\tvar form = document.forms[i];\n\n\t\t\t//Exclusion for forms\n\t\t\tif (\n\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\t(form.method.toString().toLowerCase() === 'get' && form.querySelectorAll('.nf-form-content').length === 0) ||\n\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' || // Custom form\n\t\t\t\t(form.name && form.name.toString().indexOf('tribe-bar-form') !== -1) // The Events Calendar\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\tvar visibleFieldsToInput = {};\n\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\thiddenInput.value = btoa(JSON.stringify(visibleFieldsToInput));\n\t\t\tform.append( hiddenInput );\n\n\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\tform.ctFormIndex = i;\n\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t}\n\n\t\t\t\t// Call previous submit action\n\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t}, 500);\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t}, 1000);\n\n\t// Listen clicks on encoded emails\n\tlet encodedEmailNodes = document.querySelectorAll(\"[data-original-string]\");\n\tctPublic.encodedEmailNodes = encodedEmailNodes\n\tif (encodedEmailNodes.length) {\n\t\tfor (let i = 0; i < encodedEmailNodes.length; ++i) {\n\t\t\tif (\n\t\t\t\tencodedEmailNodes[i].parentElement.href ||\n\t\t\t\tencodedEmailNodes[i].parentElement.parentElement.href\n\t\t\t) {\n\t\t\t\t// Skip listening click on hyperlinks\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tencodedEmailNodes[i].addEventListener('click', ctFillDecodedEmailHandler);\n\t\t}\n\t}\n}\nif (ctPublic.data__key_is_ok) {\n\tif (document.readyState !== 'loading') {\n\t\tapbct_ready();\n\t} else {\n\t\tapbct_attach_event_handler(document, \"DOMContentLoaded\", apbct_ready);\n\t}\n}\n\nfunction ctFillDecodedEmailHandler(event) {\n\tthis.removeEventListener('click', ctFillDecodedEmailHandler);\n\t//remember click_source\n\tlet click_source = this\n\t//globally remember if emails is mixed with mailto\n\tctPublic.encodedEmailNodesIsMixed = false\n\t//get fade\n\tdocument.body.classList.add('apbct-popup-fade')\n\t//popup show\n\tlet encoder_popup = document.getElementById('apbct_popup')\n\tif (!encoder_popup){\n\t\tlet waiting_popup = document.createElement('div')\n\t\twaiting_popup.setAttribute('class', 'apbct-popup')\n\t\twaiting_popup.setAttribute('id', 'apbct_popup')\n\t\tlet popup_text = document.createElement('p')\n\t\tpopup_text.setAttribute('id', 'apbct_popup_text')\n\t\tpopup_text.innerText = \"Please wait while CleanTalk decoding email addresses..\"\n\t\twaiting_popup.append(popup_text)\n\t\tdocument.body.append(waiting_popup)\n\t} else {\n\t\tencoder_popup.setAttribute('style','display: inherit')\n\t\tdocument.getElementById('apbct_popup_text').innerHTML = \"Please wait while CleanTalk decoding email addresses..\"\n\t}\n\n\tapbctAjaxEmailDecodeBulk(event,ctPublic.encodedEmailNodes,click_source)\n}\n\nfunction apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, click_source){\n\t//collect data\n\tconst javascriptClientData = getJavascriptClientData();\n\tlet data = {\n\t\tevent_javascript_data: javascriptClientData,\n\t\tpost_url: document.location.href,\n\t\treferrer: document.referrer,\n\t\tencodedEmails: ''\n\t};\n\tlet encoded_emails_collection = {}\n\tfor (let i = 0; i < encodedEmailNodes.length; i++){\n\t\t//disable click for mailto\n\t\tif (typeof encodedEmailNodes[i].href !== 'undefined' && encodedEmailNodes[i].href.indexOf('mailto:') === 0) {\n\t\t\tevent.preventDefault()\n\t\t\tctPublic.encodedEmailNodesIsMixed = true;\n\t\t}\n\n\t\t// Adding a tooltip\n\t\tlet apbctTooltip = document.createElement('div');\n\t\tapbctTooltip.setAttribute('class', 'apbct-tooltip');\n\t\tapbct(encodedEmailNodes[i]).append(apbctTooltip);\n\n\t\t//collect encoded email strings\n\t\tencoded_emails_collection[i] = encodedEmailNodes[i].dataset.originalString;\n\t}\n\n\t//JSONify encoded email strings\n\tdata.encodedEmails = JSON.stringify(encoded_emails_collection)\n\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_decode_email',\n\t\t\t{\n\t\t\t\tdata: data,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function(result) {\n\t\t\t\t\t//set alternative cookie to skip next pages encoding\n\t\t\t\t\tctSetCookie('apbct_email_encoder_passed','1')\n\t\t\t\t\tapbctEmailEncoderCallbackBulk(result, encodedEmailNodes, click_source);\n\t\t\t\t},\n\t\t\t\tonErrorCallback: function (res) {\n\t\t\t\t\tresetEncodedNodes()\n\t\t\t\t\tctShowDecodeComment(res);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tdata.action = 'apbct_decode_email';\n\t\tapbct_public_sendAJAX(\n\t\t\tdata,\n\t\t\t{\n\t\t\t\tnotJson: false,\n\t\t\t\tcallback: function(result) {\n\t\t\t\t\t//set alternative cookie to skip next pages encoding\n\t\t\t\t\tctSetCookie('apbct_email_encoder_passed','1')\n\t\t\t\t\tapbctEmailEncoderCallbackBulk(result, encodedEmailNodes, click_source);\n\t\t\t\t},\n\t\t\t\tonErrorCallback: function (res) {\n\t\t\t\t\tresetEncodedNodes()\n\t\t\t\t\tctShowDecodeComment(res);\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, click_source){\n\n\tif (result.success && result.data[0].is_allowed === true){\n\t\t//start process of visual decoding\n\t\tsetTimeout(function(){\n\t\t\tfor (let i = 0; i < encodedEmailNodes.length; i++) {\n\t\t\t\t//chek what is what\n\t\t\t\tlet current_result_data\n\t\t\t\tresult.data.forEach((row) => {\n\t\t\t\t\tif (row.encoded_email === encodedEmailNodes[i].dataset.originalString){\n\t\t\t\t\t\tcurrent_result_data = row\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t//quit case on cloud block\n\t\t\t\tif (current_result_data.is_allowed === false){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t//handler for mailto\n\t\t\t\tif (typeof encodedEmailNodes[i].href !== 'undefined' && encodedEmailNodes[i].href.indexOf('mailto:') === 0) {\n\t\t\t\t\tlet encodedEmail = encodedEmailNodes[i].href.replace('mailto:', '');\n\t\t\t\t\tlet baseElementContent = encodedEmailNodes[i].innerHTML;\n\t\t\t\t\tencodedEmailNodes[i].innerHTML = baseElementContent.replace(encodedEmail, current_result_data.decoded_email);\n\t\t\t\t\tencodedEmailNodes[i].href = 'mailto:' + current_result_data.decoded_email;\n\t\t\t\t}\n\t\t\t\t// fill the nodes\n\t\t\t\tctProcessDecodedDataResult(current_result_data, encodedEmailNodes[i]);\n\t\t\t\t//remove listeners\n\t\t\t\tencodedEmailNodes[i].removeEventListener('click', ctFillDecodedEmailHandler)\n\t\t\t}\n\t\t\t//popup remove\n\t\t\tlet popup = document.getElementById('apbct_popup')\n\t\t\tif (popup !== null){\n\t\t\t\tdocument.body.classList.remove('apbct-popup-fade')\n\t\t\t\tpopup.setAttribute('style','display:none')\n\t\t\t\t//click on mailto if so\n\t\t\t\tif (ctPublic.encodedEmailNodesIsMixed){\n\t\t\t\t\tclick_source.click();\n\t\t\t\t}\n\t\t\t}\n\t\t}, 3000);\n\t} else {\n\t\tif (result.success){\n\t\t\tresetEncodedNodes()\n\t\t\tctShowDecodeComment('Blocked: ' + result.data[0].comment)\n\t\t} else {\n\t\t\tresetEncodedNodes()\n\t\t\tctShowDecodeComment('Cannot connect with CleanTalk server: ' + result.data[0].comment)\n\t\t}\n\t}\n}\n\nfunction resetEncodedNodes(){\n\tif (typeof ctPublic.encodedEmailNodes !== 'undefined'){\n\t\tctPublic.encodedEmailNodes.forEach(function (element){\n\t\t\telement.addEventListener('click', ctFillDecodedEmailHandler);\n\t\t})\n\t}\n}\n\nfunction getJavascriptClientData(common_cookies = []) {\n\tlet resultDataJson = {};\n\n\tresultDataJson.apbct_headless = !!ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n\tresultDataJson.apbct_pixel_url = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n\tresultDataJson.ct_checked_emails = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails');\n\tresultDataJson.ct_checkjs = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checkjs');\n\tresultDataJson.ct_fkp_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_fkp_timestamp');\n\tresultDataJson.ct_pointer_data = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_pointer_data');\n\tresultDataJson.ct_ps_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_ps_timestamp');\n\tresultDataJson.ct_screen_info = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_screen_info');\n\tresultDataJson.ct_timezone = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_timezone');\n\n\t// collecting data from localstorage\n\tconst ctMouseMovedLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\t// collecting data from cookies\n\tconst ctMouseMovedCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n\tconst ctHasScrolledCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n\tconst ctCookiesTypeCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n\n\tresultDataJson.ct_mouse_moved = ctMouseMovedLocalStorage !== undefined ? ctMouseMovedLocalStorage : ctMouseMovedCookie;\n\tresultDataJson.ct_has_scrolled = ctHasScrolledLocalStorage !== undefined ? ctHasScrolledLocalStorage : ctHasScrolledCookie;\n\tresultDataJson.ct_cookies_type = ctCookiesTypeLocalStorage !== undefined ? ctCookiesTypeLocalStorage : ctCookiesTypeCookie;\n\n\tif (\n\t\ttypeof (common_cookies) === \"object\"\n\t\t&& common_cookies !== []\n\t){\n\t\tfor (let i = 0; i < common_cookies.length; ++i){\n\t\t\tif ( typeof (common_cookies[i][1]) === \"object\" ){\n\t\t\t\t//this is for handle SFW cookies\n\t\t\t\tresultDataJson[common_cookies[i][1][0]] = common_cookies[i][1][1]\n\t\t\t} else {\n\t\t\t\tresultDataJson[common_cookies[i][0]] = common_cookies[i][1]\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconsole.log('APBCT JS ERROR: Collecting data type mismatch')\n\t}\n\n\t// Parse JSON properties to prevent double JSON encoding\n\tresultDataJson = removeDoubleJsonEncoding(resultDataJson);\n\n\treturn JSON.stringify(resultDataJson);\n}\n\n/**\n * Recursive\n *\n * Recursively decode JSON-encoded properties\n *\n * @param object\n * @returns {*}\n */\nfunction removeDoubleJsonEncoding(object){\n\n\tif( typeof object === 'object'){\n\n\t\tfor (let objectKey in object) {\n\n\t\t\t// Recursion\n\t\t\tif( typeof object[objectKey] === 'object'){\n\t\t\t\tobject[objectKey] = removeDoubleJsonEncoding(object[objectKey]);\n\t\t\t}\n\n\t\t\t// Common case (out)\n\t\t\tif(\n\t\t\t\ttypeof object[objectKey] === 'string' &&\n\t\t\t\tobject[objectKey].match(/^[\\[{].*?[\\]}]$/) !== null // is like JSON\n\t\t\t){\n\t\t\t\tlet parsedValue = JSON.parse(object[objectKey]);\n\t\t\t\tif( typeof parsedValue === 'object' ){\n\t\t\t\t\tobject[objectKey] = parsedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn object;\n}\n\nfunction ctProcessDecodedDataResult(response, targetElement) {\n\n\ttargetElement.setAttribute('title', '');\n\ttargetElement.removeAttribute('style');\n\tctFillDecodedEmail(targetElement, response.decoded_email);\n}\n\nfunction ctFillDecodedEmail(target, email){\n\n\tapbct(target).html(\n\t\tapbct(target)\n\t\t\t.html()\n\t\t\t.replace(/.+?(<div class=[\"']apbct-tooltip[\"'].+?<\\/div>)/, email + \"$1\")\n\t);\n}\n\nfunction ctShowDecodeComment(comment){\n\n\tif( ! comment ){\n\t\tcomment = 'Can not decode email. Unknown reason'\n\t}\n\n\tlet popup = document.getElementById('apbct_popup')\n\tlet popup_text = document.getElementById('apbct_popup_text')\n\tif (popup !== null){\n\t\tdocument.body.classList.remove('apbct-popup-fade')\n\t\tpopup_text.innerText = \"CleanTalk email decoder: \" + comment\n\t\tsetTimeout(function(){\n\t\t\tpopup.setAttribute('style','display:none')\n\t\t},3000)\n\t}\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\tif (ctPublic.data__cookies_type === 'none'){\n\t\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection[0] ) );\n\t\t} else {\n\t\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t\t}\n\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\ttry {\n\t\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.log(e.toString());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tctParseBlockMessage(response);\n\t\t}\n\t});\n}\n\nfunction ctParseBlockMessage(response) {\n\n\tif (typeof response.apbct !== 'undefined') {\n\t\tresponse = response.apbct;\n\t\tif (response.blocked) {\n\t\t\tdocument.dispatchEvent(\n\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t} )\n\t\t\t);\n\n\t\t\t// Show the result by modal\n\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\tcleantalkModal.open();\n\n\t\t\tif(+response.stop_script == 1)\n\t\t\t\twindow.stop();\n\t\t}\n\t}\n}\n\nfunction ctSetPixelUrlLocalstorage(ajax_pixel_url) {\n\t//set pixel to the storage\n\tctSetCookie('apbct_pixel_url', ajax_pixel_url)\n}\n\nfunction ctNoCookieConstructHiddenField(){\n\tlet field = ''\n\tlet no_cookie_data = apbctLocalStorage.getCleanTalkData()\n\tno_cookie_data = JSON.stringify(no_cookie_data)\n\tno_cookie_data = btoa(no_cookie_data)\n\tfield = document.createElement('input')\n\tfield.setAttribute('id','ct_no_cookie_hidden_field')\n\tfield.setAttribute('name','ct_no_cookie_hidden_field')\n\tfield.setAttribute('value', no_cookie_data)\n\tfield.setAttribute('type', 'hidden')\n\treturn field\n}\n\nfunction ctNoCookieGetForms(){\n\tlet forms = document.forms\n\tif (forms) {\n\t\treturn forms\n\t}\n\treturn false\n}\n\nfunction ctNoCookieAttachHiddenFieldsToForms(){\n\n\tif (ctPublic.data__cookies_type !== 'none'){\n\t\treturn\n\t}\n\n\tlet forms = ctNoCookieGetForms()\n\n\tif (forms){\n\t\t//clear previous hidden set\n\t\tlet elements = document.getElementsByName('ct_no_cookie_hidden_field')\n\t\tif (elements){\n\t\t\tfor (let j = 0; j < elements.length; j++) {\n\t\t\t\telements[j].parentNode.removeChild(elements[j])\n\t\t\t}\n\t\t}\n\t\tfor ( let i = 0; i < forms.length; i++ ){\n\t\t\t//ignore forms with get method @todo We need to think about this\n\t\t\tif (document.forms[i].getAttribute('method') === null ||\n\t\t\t\tdocument.forms[i].getAttribute('method').toLowerCase() === 'post'){\n\t\t\t\t// add new set\n\t\t\t\tdocument.forms[i].append(ctNoCookieConstructHiddenField())\n\t\t\t}\n\t\t}\n\t}\n\n}\n/* Cleantalk Modal object */\nlet cleantalkModal = {\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 let 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 ( let 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 var urlRegex = /(https?:\\/\\/[^\\s]+)/g;\n var service_content_regex = /.*\\/inc/g;\n if (service_content_regex.test(this.loaded)){\n content.innerHTML = this.loaded\n } else {\n var renderedMsg = this.loaded.replace(urlRegex, '<a href=\"$1\" target=\"_blank\">$1</a>');\n content.innerHTML = renderedMsg;\n }\n\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});\nlet buttons_to_handle = [];\n\ndocument.addEventListener('DOMContentLoaded', function(){\n\n\tif(\n\t\ttypeof ctPublicGDPR === 'undefined' ||\n\t\t! ctPublicGDPR.gdpr_forms.length\n\t) {\n\t\treturn;\n\t}\n\n\tlet gdpr_notice_for_button = ctPublicGDPR.gdpr_title;\n\n\tif ( typeof jQuery === 'undefined' ) {\n\t\treturn;\n\t}\n\ttry {\n\t\tctPublicGDPR.gdpr_forms.forEach(function(item, i){\n\n\t\t\tlet elem = jQuery('#'+item+', .'+item);\n\n\t\t\t// Filter forms\n\t\t\tif (!elem.is('form')){\n\t\t\t\t// Caldera\n\t\t\t\tif (elem.find('form')[0])\n\t\t\t\t\telem = elem.children('form').first();\n\t\t\t\t// Contact Form 7\n\t\t\t\telse if(\n\t\t\t\t\tjQuery('.wpcf7[role=form]')[0] && jQuery('.wpcf7[role=form]')\n\t\t\t\t\t\t.attr('id')\n\t\t\t\t\t\t.indexOf('wpcf7-f'+item) !== -1\n\t\t\t\t) {\n\t\t\t\t\telem = jQuery('.wpcf7[role=form]').children('form');\n\t\t\t\t}\n\n\t\t\t\t// Formidable\n\t\t\t\telse if(jQuery('.frm_forms')[0] && jQuery('.frm_forms').first().attr('id').indexOf('frm_form_'+item) !== -1)\n\t\t\t\t\telem = jQuery('.frm_forms').first().children('form');\n\t\t\t\t// WPForms\n\t\t\t\telse if(jQuery('.wpforms-form')[0] && jQuery('.wpforms-form').first().attr('id').indexOf('wpforms-form-'+item) !== -1)\n\t\t\t\t\telem = jQuery('.wpforms-form');\n\t\t\t}\n\n\t\t\t//disable forms buttons\n\t\t\tlet button = false\n\t\t\tlet buttons_collection= elem.find('input[type|=\"submit\"],button[type|=\"submit\"]')\n\n\t\t\tif (!buttons_collection.length) {\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tbutton = buttons_collection[0]\n\t\t\t}\n\n\t\t\tif (button !== false){\n\t\t\t\tbutton.disabled = true\n\t\t\t\tlet old_notice = jQuery(button).prop('title') ? jQuery(button).prop('title') : ''\n\t\t\t\tbuttons_to_handle.push({index:i,button:button,old_notice:old_notice})\n\t\t\t\tjQuery(button).prop('title', gdpr_notice_for_button)\n\t\t\t}\n\n\t\t\t// Adding notice and checkbox\n\t\t\tif(elem.is('form') || elem.attr('role') === 'form'){\n\t\t\t\telem.append('<input id=\"apbct_gdpr_'+i+'\" type=\"checkbox\" required=\"required\" style=\" margin-right: 10px;\" onchange=\"apbct_gdpr_handle_buttons()\">')\n\t\t\t\t\t.append('<label style=\"display: inline;\" for=\"apbct_gdpr_'+i+'\">'+ctPublicGDPR.gdpr_text+'</label>');\n\t\t\t}\n\t\t});\n\t} catch (e) {\n\t\tconsole.info('APBCT GDPR JS ERROR: Can not add GDPR notice' + e)\n\t}\n});\n\nfunction apbct_gdpr_handle_buttons(){\n\n\ttry {\n\n\t\tif (buttons_to_handle === []){\n\t\t\treturn\n\t\t}\n\n\t\tbuttons_to_handle.forEach((button) => {\n\t\t\tlet selector = '[id=\"apbct_gdpr_' + button.index + '\"]'\n\t\t\tlet apbct_gdpr_item = jQuery(selector)\n\t\t\t//chek if apbct_gdpr checkbox is set\n\t\t\tif (jQuery(apbct_gdpr_item).prop(\"checked\")){\n\t\t\t\tbutton.button.disabled = false\n\t\t\t\tjQuery(button.button).prop('title', button.old_notice)\n\t\t\t} else {\n\t\t\t\tbutton.button.disabled = true\n\t\t\t\tjQuery(button.button).prop('title', gdpr_notice_for_button)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.info('APBCT GDPR JS ERROR: Can not handle form buttons ' + e)\n\t}\n}\n/**\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 // Ajax checking for the integrated forms\n if(isIntegratedForm(currentForm)) {\n\n apbctProcessExternalForm(currentForm, i, document);\n\n // Common flow - modify form's action\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST'\n\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n // Trying to process external form into an iframe\n apbctProcessIframes()\n}\n\nfunction formIsExclusion(currentForm)\n{\n let exclusions_by_id = [\n 'give-form' //give form exclusion because of direct integration\n ]\n\n let result = false\n\n //mewto forms exclusion\n if (currentForm.parentElement\n && currentForm.parentElement.classList.length > 0\n && currentForm.parentElement.classList[0].indexOf('mewtwo') !== -1) {\n result = true\n }\n\n exclusions_by_id.forEach(function (id) {\n if ( typeof (currentForm.id) !== 'undefined' && currentForm.id.indexOf(id) !== -1 ) {\n result = true\n }\n })\n\n return result\n}\n\nfunction apbctProcessIframes()\n{\n const frames = document.getElementsByTagName('iframe');\n\n if ( frames.length > 0 ) {\n for ( let j = 0; j < frames.length; j++ ) {\n if ( frames[j].contentDocument == null ) {\n continue;\n }\n\n const iframeForms = frames[j].contentDocument.forms;\n\n if ( iframeForms.length === 0 ) {\n return;\n }\n\n for ( let y = 0; y < iframeForms.length; y++ ) {\n let currentForm = iframeForms[y];\n\n apbctProcessExternalForm(currentForm, y, frames[j].contentDocument);\n }\n }\n }\n}\n\nfunction apbctProcessExternalForm(currentForm, iterator, documentObject) {\n\n //process forms exclusions\n if ( formIsExclusion(currentForm)) {\n return\n }\n\n const cleantalk_placeholder = document.createElement(\"i\");\n cleantalk_placeholder.className = 'cleantalk_placeholder';\n cleantalk_placeholder.style = 'display: none';\n\n currentForm.parentElement.insertBefore(cleantalk_placeholder, currentForm);\n\n // Deleting form to prevent submit event\n let prev = currentForm.previousSibling,\n form_html = currentForm.outerHTML,\n form_original = currentForm;\n\n // Remove the original form\n currentForm.parentElement.removeChild(currentForm);\n\n // Insert a clone\n const placeholder = document.createElement(\"div\");\n placeholder.innerHTML = form_html;\n prev.after(placeholder.firstElementChild);\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 let reUseCurrentForm = documentObject.forms[iterator];\n\n reUseCurrentForm.appendChild(force_action);\n reUseCurrentForm.apbctPrev = prev;\n reUseCurrentForm.apbctFormOriginal = form_original;\n\n // mailerlite integration - disable click on submit button\n let mailerlite_detected_class = false\n if (reUseCurrentForm.classList !== undefined) {\n //list there all the mailerlite classes\n let mailerlite_classes = ['newsletterform', 'ml-block-form']\n mailerlite_classes.forEach(function(mailerlite_class) {\n if (reUseCurrentForm.classList.contains(mailerlite_class)){\n mailerlite_detected_class = mailerlite_class\n }\n });\n }\n if ( mailerlite_detected_class ) {\n let mailerliteSubmitButton = jQuery('form.' + mailerlite_detected_class).find('button[type=\"submit\"]');\n if ( mailerliteSubmitButton !== undefined ) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(event.currentTarget);\n });\n }\n } else {\n documentObject.forms[iterator].onsubmit = function ( event ){\n event.preventDefault();\n\n //mautic integration\n if (documentObject.forms[iterator].id.indexOf('mauticform') !== -1) {\n let checkbox = jQuery(documentObject.forms[iterator]).find('input[id*=\"checkbox_rgpd\"]')\n if (checkbox.length > 0){\n if (checkbox.prop(\"checked\") === true){\n let placeholder = jQuery('.cleantalk_placeholder')\n if (placeholder.length > 0) {\n placeholder[0].setAttribute('mautic_hidden_gdpr_id', checkbox.prop(\"id\"))\n }\n }\n }\n }\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget);\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\n if( ! +ctPublic.settings__forms__check_external ) {\n return;\n }\n\n if ( typeof jQuery === 'undefined' ) {\n return;\n }\n\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 let formId = formObj.id;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 || // Mailerlite integration\n formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1 ||\n formAction.indexOf('sendfox.com') !== -1 ||\n formAction.indexOf('aweber.com') !== -1 ||\n formAction.indexOf('secure.payu.com') !== -1 ||\n formAction.indexOf('mautic') !== -1 || formId.indexOf('mauticform_') !== -1\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( result, data, params, obj ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n let form_new = jQuery(form).detach();\n let prev = form.apbctPrev;\n let formOriginal = form.apbctFormOriginal;\n let mautic_integration = false;\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n //mautic forms integration\n if (formOriginal.id.indexOf('mautic') !== -1) {\n mautic_integration = true\n }\n let placeholders = document.getElementsByClassName('cleantalk_placeholder')\n if (placeholders) {\n for (let i = 0; i < placeholders.length; i++) {\n let mautic_hidden_gdpr_id = placeholders[i].getAttribute(\"mautic_hidden_gdpr_id\")\n if (typeof(mautic_hidden_gdpr_id) !== 'undefined') {\n let mautic_gdpr_radio = jQuery(formOriginal).find('#' + mautic_hidden_gdpr_id)\n if (typeof(mautic_gdpr_radio) !== 'undefined') {\n mautic_gdpr_radio.prop(\"checked\", true);\n }\n }\n }\n }\n\n prev.after( formOriginal );\n\n // Clear visible_fields input\n jQuery(formOriginal).find('input[name=\"apbct_visible_fields\"]').remove();\n jQuery(formOriginal).find('input[value=\"cleantalk_force_ajax_check\"]').remove();\n\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 if (mautic_integration) {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n }\n return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n if (result.apbct !== undefined && +result.apbct.blocked) {\n ctParseBlockMessage(result);\n }\n }\n }\n );\n}\n\nfunction 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 apbct_public_sendAJAX(\n ct_data,\n {\n url: ctPublicFunctions._ajax_url,\n callback: function (data) {\n if(data.success === true){\n currForm.submit();\n }else{\n alert(data.data);\n return false;\n }\n }\n }\n );\n}\n\ndocument.addEventListener('DOMContentLoaded',function(){\n let ct_currAction = '',\n ct_currForm = '';\n\n if( ! +ctPublic.settings__forms__check_internal ) {\n return;\n }\n\n let ctPrevHandler;\n\tfor( let i=0; i<document.forms.length; i++ ){\n\t\tif ( typeof(document.forms[i].action) == 'string' ){\n ct_currForm = document.forms[i];\n\t\t\tct_currAction = ct_currForm.action;\n if (\n ct_currAction.indexOf('https?://') !== null && // The protocol is obligatory\n ct_currAction.match(ctPublic.blog_home + '.*?\\.php') !== null && // Main check\n ! ct_check_internal__is_exclude_form(ct_currAction) // Exclude WordPress native scripts from processing\n ) {\n ctPrevHandler = ct_currForm.click;\n if ( typeof jQuery !== 'undefined' ) {\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(event){\n ct_check_internal(event.target);\n return false;\n });\n }\n }\n\t\t}\n\t}\n});\n\n/**\n * Check by action to exclude the form checking\n * @param action string\n * @return boolean\n */\nfunction ct_check_internal__is_exclude_form(action) {\n // An array contains forms action need to be excluded.\n let ct_internal_script_exclusions = [\n 'wp-login.php', // WordPress login page\n 'wp-comments-post.php', // WordPress Comments Form\n ];\n\n return ct_internal_script_exclusions.some((item) => {\n return action.match(new RegExp(ctPublic.blog_home + '.*' + item)) !== null;\n });\n}"],"names":["ApbctCore","ajax_parameters","rest_parameters","selector","elements","eventCallback","eventSelector","event","constructor","this","select","HTMLCollection","Array","prototype","slice","call","document","querySelectorAll","deselect","addElement","elemToAdd","push","elem","reduce","css","style","getRaw","let","style_name","DOM_style_name","replace","group","toUpperCase","i","length","computedStyle","getComputedStyle","Number","hide","prop","display","show","addClass","classList","add","className","removeClass","remove","toggleClass","toggle","ajax","ApbctAjax","rest","ApbctRest","on","args","addEventListener","onChecker","bind","target","querySelector","stopPropagation","ready","callback","change","attr","attrName","outputValue","propName","value","html","val","data","name","is","filter","isElem","elemToCheck","match","newlyCreatedElement","createElement","Boolean","HTMLElement","HTMLUnknownElement","indexOf","tagName","toLowerCase","isWithoutSelector","splice","parent","parentElement","parents","children","siblings","current","after","content","append","fadeIn","time","opacity","last","Date","tick","window","requestAnimationFrame","setTimeout","fadeOut","apbct","params","ApbctXhr","xhr","XMLHttpRequest","method","url","async","user","password","button","spinner","progressbar","context","onErrorCallback","responseType","headers","timeout","methods_to_convert_data_to_URL","body","http_code","status_text","parameters","key","console","log","prepare","Object","keys","deleteDoubleJSONEncoding","convertData","open","setHeaders","onreadystatechange","onReadyStateChange","onload","onLoad","onprogress","onProgress","onerror","onError","ontimeout","onTimeout","send","setAttribute","cursor","complete","status","statusText","removeAttribute","on_ready_state_change","on_progress","error","response","additional_msg","error_string","errorOutput","error_msg","header_name","setRequestHeader","convertDataToURL","convertDataToBody","params_appendix","URLSearchParams","toString","params_prefix","dataKey","FormData","JSON","stringify","object","objectKey","parsedValue","parse","super","default_route","ctPublicFunctions","_rest_url","route","X-WP-Nonce","_rest_nonce","ctSetCookie","cookies","expires","force_alternative_method_for_cookies","skip_alt","data__cookies_type","forced_alt_cookies_set","forEach","item","arr","apbctLocalStorage","set","encodeURIComponent","ctSetAlternativeCookie","ctNoCookieAttachHiddenFieldsToForms","ctSecure","location","protocol","cookie","cookiePrefix","getJavascriptClientData","e","data__ajax_type","apbct_public_sendREST","apbct_public_sendAJAX","action","notJson","ctGetCookie","matches","RegExp","decodeURIComponent","undefined","ctDeleteCookie","cookieName","obj","_params","callback_context","callback_params","silent","no_nonce","_ajax_url","_ajax_nonce","Math","random","no_cache","get","property","storageValue","localStorage","getItem","json","hasOwnProperty","is_json","objToSave","timestamp","floor","getTime","setItem","isAlive","maxLifetime","isSet","delete","removeItem","getCleanTalkData","ct_date","ctTimeMs","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","apbct_attach_event_handler","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctMouseReadInterval","ctMouseWriteDataInterval","ctFunctionFirstKey","ctKeyStopStopListening","ctFunctionMouseMove","ctPublic","data__key_is_ok","setInterval","ctSetMouseMoved","round","clientY","clientX","ctMouseStopData","clearInterval","checkEmail","current_email","email","result","now","ctSetPixelImg","pixelUrl","insertedImg","pixel__enabled","getElementById","ctGetPixelUrl","local_storage_pixel_url","ctSetHasScrolled","ctPreloadLocalStorage","data__to_local_storage","entries","apbct_ready","cookiesType","initCookies","getTimezoneOffset","apbctGetScreenInfo","navigator","webdriver","cookiesArray","split","trim","pixel__setting","pixel__url","data__email_check_before_post","forms","hiddenInput","visibleFieldsToInput","form","data__visible_fields_required","contains","id","apbct_collect_visible_fields","btoa","onsubmit_prev","onsubmit","ctFormIndex","visible_fields","apbct_visible_fields_set_cookie","Function","encodedEmailNodes","href","ctFillDecodedEmailHandler","encodedEmailNodesIsMixed","popup_text","encoder_popup","innerHTML","waiting_popup","innerText","apbctAjaxEmailDecodeBulk","click_source","event_javascript_data","post_url","referrer","encodedEmails","encoded_emails_collection","preventDefault","apbctTooltip","dataset","originalString","apbctEmailEncoderCallbackBulk","res","resetEncodedNodes","ctShowDecodeComment","success","is_allowed","current_result_data","row","encoded_email","encodedEmail","baseElementContent","decoded_email","ctProcessDecodedDataResult","popup","click","comment","element","common_cookies","resultDataJson","apbct_headless","apbct_pixel_url","ct_checked_emails","ct_checkjs","ct_fkp_timestamp","ct_pointer_data","ct_ps_timestamp","ct_screen_info","ct_timezone","ctMouseMovedLocalStorage","ctHasScrolledLocalStorage","ctCookiesTypeLocalStorage","ctMouseMovedCookie","ctHasScrolledCookie","ctCookiesTypeCookie","ct_mouse_moved","ct_has_scrolled","ct_cookies_type","removeDoubleJsonEncoding","targetElement","ctFillDecodedEmail","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","isNaN","getAttribute","visibility","visible_fields_count","invisible_fields","invisible_fields_count","visible_fields_collection","form_id","collection","apbct_js_keys__set_input_value","js_key","fullWidth","documentElement","scrollWidth","fullHeight","max","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ctParseBlockMessage","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","cleantalkModal","loaded","stop_script","stop","ctSetPixelUrlLocalstorage","ajax_pixel_url","ctNoCookieConstructHiddenField","field","no_cookie_data","ctNoCookieGetForms","getElementsByName","j","parentNode","removeChild","readyState","jQuery","ajaxComplete","settings","responseText","loading","opened","opening","load","apbct_admin_sendAJAX","renderCss","cssStr","styles","overlayCss","z-index","position","top","left","width","height","background","justify-content","align-items","innerCss","padding","border","border-radius","box-shadow","closeCss","right","box-sizing","closeCssBefore","transform","closeCssAfter","bodyCss","overflow","cleantalkModalStyle","overlay","inner","close","test","renderedMsg","buttons_to_handle","apbct_gdpr_handle_buttons","index","apbct_gdpr_item","disabled","old_notice","gdpr_notice_for_button","info","ct_protect_external","currentForm","ct_method","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","apbctProcessExternalForm","hostname","ct_action","type","appendChild","apbctProcessIframes","formIsExclusion","frames","getElementsByTagName","contentDocument","iframeForms","y","iterator","documentObject","cleantalk_placeholder","prev","insertBefore","previousSibling","form_html","outerHTML","form_original","placeholder","force_action","firstElementChild","reUseCurrentForm","mailerlite_detected_class","apbctPrev","apbctFormOriginal","mailerlite_class","mailerliteSubmitButton","find","sendAjaxCheckingFormData","currentTarget","checkbox","clone","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","elem_source","source","index2","elem_target","formObj","formAction","formId","firstChild","formOriginal","elems","form_new","detach","mautic_integration","placeholders","getElementsByClassName","mautic_hidden_gdpr_id","mautic_gdpr_radio","subm_button","ct_check_internal","currForm","ct_data","alert","submit","ct_check_internal__is_exclude_form","some","blog_home","ctPublicGDPR","gdpr_forms","gdpr_title","first","buttons_collection","gdpr_text","settings__forms__check_external","ct_currForm","ct_currAction","settings__forms__check_internal","off"],"mappings":"MAAMA,UAEFC,gBAAkB,GAClBC,gBAAkB,GAElBC,SAAW,KACXC,SAAW,GAGXC,cACAC,cACAC,MAKAC,YAAYL,GACRM,KAAKC,OAAOP,CAAQ,CACxB,CAQAO,OAAOP,GAkBH,OAhBGA,aAAoBQ,gBACnBF,KAAKN,SAAc,KACnBM,KAAKL,SAAc,GACnBK,KAAKL,SAAWQ,MAAMC,UAAUC,MAAMC,KAAKZ,CAAQ,GACzB,UAApB,OAAOA,GACbM,KAAKN,SAAc,KACnBM,KAAKL,SAAc,GACnBK,KAAKL,SAAS,GAAKD,GACO,UAApB,OAAOA,GACbM,KAAKN,SAAWA,EAChBM,KAAKL,SAAWQ,MAAMC,UAAUC,MAAMC,KAAKC,SAASC,iBAAiBd,CAAQ,CAAC,GAG9EM,KAAKS,SAAS,EAGXT,IACX,CAEAU,WAAWC,GACkB,UAArB,OAAOA,EACPX,KAAKL,SAASiB,KAAKD,CAAS,EACD,UAArB,OAAOA,GACbX,KAAKN,SAAWiB,EAChBX,KAAKL,SAAWQ,MAAMC,UAAUC,MAAMC,KAAKC,SAASC,iBAAiBG,CAAS,CAAC,GAE/EX,KAAKS,SAAS,CAEtB,CAEAG,KAAKC,GACDb,KAAKL,SAASiB,KAAKC,CAAI,CAC3B,CAEAC,SACId,KAAKL,SAAWK,KAAKL,SAASU,MAAM,EAAE,CAAC,CAAC,CAC5C,CAEAI,WACIT,KAAKL,SAAW,EACpB,CAUAoB,IAAIC,EAAOC,GAKP,GAHAA,GAAkB,CAAA,EAGE,UAAjB,OAAOD,EAAmB,CAWzB,IAAIE,IAAIC,KAAcH,EAAM,CACxBE,IAAIE,EAAmCD,EATnCE,QAAQ,eAAgBC,GACxBA,EACKC,YAAY,EACZF,QAAQ,IAAK,EAAE,EACfA,QAAQ,IAA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ASmS,iCAIO,aAAlB,OAAOhI,QAIZtU,WAAW,WACPuX,oBAAoB,CACxB,EAAG,IAAI,CACX,EAoKAjd,SAASwC,iBAAiB,mBAAmB,WACzC7B,IACIshB,EADAC,EAAgB,GAGpB,GAAM,CAACrS,SAASsS,gCAKnB,IAAKxhB,IAAIM,EAAE,EAAGA,EAAEjB,SAASmS,MAAMjR,OAAQD,CAAC,GACE,UAApC,OAAOjB,SAASmS,MAAMlR,GAAS,QAIiB,QAFpDihB,GADSD,EAAcjiB,SAASmS,MAAMlR,IACVqL,QAEDlI,QAAQ,WAAW,GACwB,OAAzD8d,EAAcpe,MAAM+L,SAAS4R,UAAY,SAAU,GACjDF,mCAAmCW,CAAa,IAElCD,EAAY7M,MACL,aAAlB,OAAO4E,SACRA,OAAOiI,CAAW,EAAEG,IAAI,IAAI,EAC5BpI,OAAOiI,CAAW,EAAEG,IAAI,EACxBpI,OAAOiI,CAAW,EAAE3f,GAAG,SAAU,SAAS/C,GAEtC,OADA2hB,kBAAkB3hB,EAAMoD,MAAM,EACvB,CAAA,CACX,CAAC,GAKrB,CAAC"}
js/cleantalk-admin-settings-page.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function apbct_banner_check(){var c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null!==a)c.push(a[key]);else if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){function c(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))}c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class= 'apbct-icon-spin1 animate-spin'></i>").append("<div class='apbct_long_desc__angle'></div>").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){a.empty().append("<div class='apbct_long_desc__angle'></div>").append("<i class='apbct_long_desc__cancel apbct-icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}function apbct_save_button_position(){var t,e,n,a,c,s,i,o;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,i=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,o=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<i+o+c?(a.style.bottom="",a.style.top=i+o+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)}function apbct_highlight_element(t,e){e=e-1||0;let n=jQuery("#"+t);jQuery("html, body").animate({scrollTop:n.offset().top-100},"slow"),n.addClass("apbct_highlighted"),n.animate({opacity:0},400,"linear",function(){n.animate({opacity:1},400,"linear",function(){0<e?apbct_highlight_element(t,e):n.removeClass("apbct_highlighted")})})}jQuery(document).ready(function(){jQuery(".apbct_setting---data__email_decoder").on("click",t=>{var e;"checkbox"===t.target.type?(e=t.target.checked?"__On":"__Off",document.getElementById("apbct_setting_data__email_decoder"+e).checked=!0):document.getElementById("apbct_setting_data__email_decoder").checked=1===parseInt(t.target.value)}),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&&(ctSettingsPage.key_changed?(jQuery(".key_changed_sync").hide(300),jQuery(".key_changed_success").show(300),setTimeout(function(){document.location.reload()},3e3)):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();jQuery('button.cleantalk_link[value="save_changes"]').off("click"),""!==t&&null===t.match(/^[a-z\d]{3,30}\s*$/)&&(jQuery("#apbct_button__get_key_auto__wrapper").show(),jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#apbct_bad_key_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>Please, insert a correct access key before saving changes!</h4></div>").insertAfter(jQuery("#apbct_setting_apikey")),apbct_highlight_element("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>Synchronization process failed. Please, check the acces key and restart the synch.<h4></div>").insertAfter(jQuery("#apbct_button__sync")),apbct_highlight_element("apbct_setting_apikey",3),apbct_highlight_element("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()}),jQuery("#apbct-custom-logo-open-gallery").click(function(t){t.preventDefault();const e=jQuery(this),n=wp.media({library:{type:"image"},multiple:!1});n.on("select",function(){var t=n.state().get("selection").first().toJSON();e.parent().prev().attr("src",t.url),jQuery("#cleantalk_custom_logo").val(t.id)}),n.open()}),jQuery("#apbct-custom-logo-remove-image").click(function(t){t.preventDefault(),!0===confirm("Sure?")&&(t=jQuery(this).parent().prev().data("src"),jQuery(this).parent().prev().attr("src",t),jQuery(this).prev().prev().val(""))})});
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 apbct_excepted_show_hide(t){var e=["apbct_settings__dwpms_settings","apbct_settings__advanced_settings","trusted_and_affiliate__special_span"],n=e.indexOf(t);-1!==n&&e.splice(n,1),apbct_show_hide_elem(t),e.forEach(t=>{document.getElementById(t)&&"none"!==document.getElementById(t).style.display&&apbct_show_hide_elem(t)})}function apbct_show_required_groups(t,e){var n=document.getElementById("apbct_settings__dwpms_settings");n&&"none"===n.style.display&&((n=t).preventDefault(),apbct_show_hide_elem("apbct_settings__dwpms_settings"),document.getElementById(e).dispatchEvent(new n.constructor(n.type,n)))}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,i,o;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,i=(s=document.getElementById("apbct_hidden_section_nav")).getBoundingClientRect().top,o=s.getBoundingClientRect().height,"none"!==getComputedStyle(e).display?(jQuery("#apbct_settings__main_save_button").hide(),t<i+o+c?(a.style.bottom="",a.style.top=i+o+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)}function apbct_highlight_element(t,e){e=e-1||0;let n=jQuery("#"+t);jQuery("html, body").animate({scrollTop:n.offset().top-100},"slow"),n.addClass("apbct_highlighted"),n.animate({opacity:0},400,"linear",function(){n.animate({opacity:1},400,"linear",function(){0<e?apbct_highlight_element(t,e):n.removeClass("apbct_highlighted")})})}jQuery(document).ready(function(){jQuery(".apbct_setting---data__email_decoder").on("click",t=>{var e;"checkbox"===t.target.type?(e=t.target.checked?"__On":"__Off",document.getElementById("apbct_setting_data__email_decoder"+e).checked=!0):document.getElementById("apbct_setting_data__email_decoder").checked=1===parseInt(t.target.value)}),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&&(ctSettingsPage.key_changed?(jQuery(".key_changed_sync").hide(300),jQuery(".key_changed_success").show(300),setTimeout(function(){document.location.reload()},3e3)):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();jQuery('button.cleantalk_link[value="save_changes"]').off("click"),""!==t&&null===t.match(/^[a-z\d]{3,30}\s*$/)&&(jQuery("#apbct_button__get_key_auto__wrapper").show(),jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#apbct_bad_key_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>Please, insert a correct access key before saving changes!</h4></div>").insertAfter(jQuery("#apbct_setting_apikey")),apbct_highlight_element("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>Synchronization process failed. Please, check the acces key and restart the synch.<h4></div>").insertAfter(jQuery("#apbct_button__sync")),apbct_highlight_element("apbct_setting_apikey",3),apbct_highlight_element("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()}),jQuery("#apbct-custom-logo-open-gallery").click(function(t){t.preventDefault();const e=jQuery(this),n=wp.media({library:{type:"image"},multiple:!1});n.on("select",function(){var t=n.state().get("selection").first().toJSON();e.parent().prev().attr("src",t.url),jQuery("#cleantalk_custom_logo").val(t.id)}),n.open()}),jQuery("#apbct-custom-logo-remove-image").click(function(t){t.preventDefault(),!0===confirm("Sure?")&&(t=jQuery(this).parent().prev().data("src"),jQuery(this).parent().prev().attr("src",t),jQuery(this).prev().prev().val(""))})});
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// Top level settings\n\tjQuery('.apbct_setting---data__email_decoder').on('click', (event) => {\n\t\tif ( event.target.type === 'checkbox' ) {\n\t\t\tconst postFix = event.target.checked ? '__On' : '__Off';\n\t\t\tdocument.getElementById('apbct_setting_data__email_decoder' + postFix).checked = true;\n\t\t} else {\n\t\t\tdocument.getElementById('apbct_setting_data__email_decoder').checked = parseInt(event.target.value) === 1;\n\t\t}\n\t});\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\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\tif( ctSettingsPage.key_changed ) {\n\t\t\t\t\t\t\tjQuery('.key_changed_sync').hide(300);\n\t\t\t\t\t\t\tjQuery('.key_changed_success').show(300);\n\t\t\t\t\t\t\tsetTimeout(function(){document.location.reload();}, 3000);\n\t\t\t\t\t\t} else {\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\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\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').off('click')\n\t\tif (enteredValue !== '' && enteredValue.match(/^[a-z\\d]{3,30}\\s*$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\t\t\tfunction (e) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tif (!jQuery('#apbct_bad_key_notice').length){\n\t\t\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>\" +\n\t\t\t\t\t\t\t\t\"Please, insert a correct access key before saving changes!\" +\n\t\t\t\t\t\t\t\t\"</h4></div>\" ).insertAfter( jQuery('#apbct_setting_apikey') );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\treturn;\n\t\t}\n\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n\t/**\n\t * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n\t */\n\tif( !ctSettingsPage.key_is_ok ){\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\tfunction (e) {\n\t\t\t\te.preventDefault()\n\t\t\t\tif (!jQuery('#sync_required_notice').length){\n\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>\" +\n\t\t\t\t\t\t\"Synchronization process failed. Please, check the acces key and restart the synch.\" +\n\t\t\t\t\t\t\"<h4></div>\" ).insertAfter( jQuery('#apbct_button__sync') );\n\t\t\t\t}\n\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\t\t\t\tapbct_highlight_element('apbct_button__sync',3)\n\t\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\t}\n\t\t)\n\t}\n\n\t/**\n\t * Open WP gallery for adding custom logo\n\t */\n\tjQuery('#apbct-custom-logo-open-gallery').click(function (e) {\n\t\te.preventDefault();\n\n\t\tconst button = jQuery(this);\n\n\t\tconst customUploader = wp.media({\n\t\t\tlibrary : {\n\t\t\t\ttype : 'image'\n\t\t\t},\n\t\t\tmultiple: false\n\t\t});\n\n\t\tcustomUploader.on('select', function() {\n\t\t\tconst image = customUploader.state().get('selection').first().toJSON();\n\n\t\t\tbutton.parent().prev().attr( 'src', image.url );\n\t\t\tjQuery('#cleantalk_custom_logo').val( image.id );\n\t\t});\n\n\t\tcustomUploader.open();\n\t});\n\n\t/**\n\t * Remove selected logo\n\t */\n\tjQuery('#apbct-custom-logo-remove-image').click(function (e) {\n\t\te.preventDefault();\n\n\t\tif ( true === confirm( \"Sure?\" ) ) {\n\t\t\tconst src = jQuery(this).parent().prev().data('src');\n\t\t\tjQuery(this).parent().prev().attr('src', src);\n\t\t\tjQuery(this).prev().prev().val('');\n\t\t}\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}\n\n// Hightlights element\nfunction apbct_highlight_element(id, times){\n\ttimes = times-1 || 0;\n\tlet key_field = jQuery('#'+id)\n\tjQuery(\"html, body\").animate({ scrollTop: key_field.offset().top - 100 }, \"slow\");\n\tkey_field.addClass('apbct_highlighted');\n\tkey_field.animate({opacity: 0 }, 400, 'linear', function(){\n\t\tkey_field.animate({opacity: 1 }, 400, 'linear', function(){\n\t\t\tif(times>0){\n\t\t\t\tapbct_highlight_element(id, times);\n\t\t\t}else{\n\t\t\t\tkey_field.removeClass('apbct_highlighted');\n\t\t\t}\n\t\t});\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","apbct_highlight_element","id","times","let","key_field","animate","scrollTop","offset","addClass","opacity","removeClass","ready","postFix","event","type","parseInt","value","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","key_is_ok","customUploader","wp","media","library","multiple","image","get","first","toJSON","url","confirm","src"],"mappings":"AA4WA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,oCAAoC,EAC7C,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,yBAAyB,EAAEC,QACrCD,OAAO,yBAAyB,EAAEE,KAAK,MAAM,EAC1CF,OAAO,yBAAyB,EAAEC,QACrCD,OAAO,yBAAyB,EAAEE,KAAK,MAAM,EAC9CC,cAAcb,CAAa,EAE7B,CACD,CACD,CACD,EAAG,GAAM,CACV,CASA,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,GAAG,GACGR,OAAaM,EAAIC,EAAKD,CAAC,GAC7CD,EAAMN,OAAO,IAAIK,EAAME,EAAE,EACzBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,EAAE,EAAID,EAEzD,OAAOD,CACX,CASA,SAASK,wBAAwBL,GAGZ,UAAjB,OAAOA,IACTA,EAAQA,EAAMI,MAAM,GAAG,GAExB,IAAIE,EAAM,GAuBV,OArBAN,EAAMO,QAAQ,SAASC,EAAMN,EAAGO,GAG/B,IAAIR,EAAMS,SAASC,eAAeH,CAAI,EACtC,GAAY,OAARP,EACHK,EAAIM,KAAMX,EAAIY,IAAK,OA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AAU,WAC3B,IAAMyF,EAAQL,EAAe9G,MAAM,EAAEoH,IAAI,WAAW,EAAEC,MAAM,EAAEC,OAAO,EAErEhD,EAAO3D,OAAO,EAAElB,KAAK,EAAEsE,KAAM,MAAOoD,EAAMI,GAAI,EAC9CtJ,OAAO,wBAAwB,EAAE6F,IAAKqD,EAAMtE,EAAG,CAChD,CAAC,EAEDiE,EAAejC,KAAK,CACrB,CAAC,EAKD5G,OAAO,iCAAiC,EAAE4H,MAAM,SAAUpF,GACzDA,EAAEuF,eAAe,EAEZ,CAAA,IAASwB,QAAS,OAAQ,IACxBC,EAAMxJ,OAAO+F,IAAI,EAAErD,OAAO,EAAElB,KAAK,EAAE5B,KAAK,KAAK,EACnDI,OAAO+F,IAAI,EAAErD,OAAO,EAAElB,KAAK,EAAEsE,KAAK,MAAO0D,CAAG,EAC5CxJ,OAAO+F,IAAI,EAAEvE,KAAK,EAAEA,KAAK,EAAEqE,IAAI,EAAE,EAEnC,CAAC,CAEF,CAAC"}
1
+ {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Top level settings\n\tjQuery('.apbct_setting---data__email_decoder').on('click', (event) => {\n\t\tif ( event.target.type === 'checkbox' ) {\n\t\t\tconst postFix = event.target.checked ? '__On' : '__Off';\n\t\t\tdocument.getElementById('apbct_setting_data__email_decoder' + postFix).checked = true;\n\t\t} else {\n\t\t\tdocument.getElementById('apbct_setting_data__email_decoder').checked = parseInt(event.target.value) === 1;\n\t\t}\n\t});\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\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\tif( ctSettingsPage.key_changed ) {\n\t\t\t\t\t\t\tjQuery('.key_changed_sync').hide(300);\n\t\t\t\t\t\t\tjQuery('.key_changed_success').show(300);\n\t\t\t\t\t\t\tsetTimeout(function(){document.location.reload();}, 3000);\n\t\t\t\t\t\t} else {\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\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\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').off('click')\n\t\tif (enteredValue !== '' && enteredValue.match(/^[a-z\\d]{3,30}\\s*$/) === null) {\n\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\t\t\tfunction (e) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tif (!jQuery('#apbct_bad_key_notice').length){\n\t\t\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='apbct_bad_key_notice'>\" +\n\t\t\t\t\t\t\t\t\"Please, insert a correct access key before saving changes!\" +\n\t\t\t\t\t\t\t\t\"</h4></div>\" ).insertAfter( jQuery('#apbct_setting_apikey') );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\treturn;\n\t\t}\n\n\t});\n\n\tif ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n\t\tjQuery('#apbct_button__get_key_auto__wrapper').hide();\n\t}\n\n\t/**\n\t * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n\t */\n\tif( !ctSettingsPage.key_is_ok ){\n\t\tjQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n\t\t\tfunction (e) {\n\t\t\t\te.preventDefault()\n\t\t\t\tif (!jQuery('#sync_required_notice').length){\n\t\t\t\t\tjQuery( \"<div class='apbct_notice_inner error'><h4 id='sync_required_notice'>\" +\n\t\t\t\t\t\t\"Synchronization process failed. Please, check the acces key and restart the synch.\" +\n\t\t\t\t\t\t\"<h4></div>\" ).insertAfter( jQuery('#apbct_button__sync') );\n\t\t\t\t}\n\t\t\t\tapbct_highlight_element('apbct_setting_apikey',3)\n\t\t\t\tapbct_highlight_element('apbct_button__sync',3)\n\t\t\t\tjQuery('#apbct_button__get_key_auto__wrapper').show();\n\t\t\t}\n\t\t)\n\t}\n\n\t/**\n\t * Open WP gallery for adding custom logo\n\t */\n\tjQuery('#apbct-custom-logo-open-gallery').click(function (e) {\n\t\te.preventDefault();\n\n\t\tconst button = jQuery(this);\n\n\t\tconst customUploader = wp.media({\n\t\t\tlibrary : {\n\t\t\t\ttype : 'image'\n\t\t\t},\n\t\t\tmultiple: false\n\t\t});\n\n\t\tcustomUploader.on('select', function() {\n\t\t\tconst image = customUploader.state().get('selection').first().toJSON();\n\n\t\t\tbutton.parent().prev().attr( 'src', image.url );\n\t\t\tjQuery('#cleantalk_custom_logo').val( image.id );\n\t\t});\n\n\t\tcustomUploader.open();\n\t});\n\n\t/**\n\t * Remove selected logo\n\t */\n\tjQuery('#apbct-custom-logo-remove-image').click(function (e) {\n\t\te.preventDefault();\n\n\t\tif ( true === confirm( \"Sure?\" ) ) {\n\t\t\tconst src = jQuery(this).parent().prev().data('src');\n\t\t\tjQuery(this).parent().prev().attr('src', src);\n\t\t\tjQuery(this).prev().prev().val('');\n\t\t}\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\nfunction apbct_excepted_show_hide(element){\n\tvar to_hide = [\n\t\t'apbct_settings__dwpms_settings',\n\t\t'apbct_settings__advanced_settings',\n\t\t'trusted_and_affiliate__special_span'\n\t]\n\tvar index = to_hide.indexOf(element)\n\tif (index !== -1){\n\t\tto_hide.splice(index,1)\n\t}\n\tapbct_show_hide_elem(element)\n\tto_hide.forEach((to_hide_elem) => {\n\t\tif (document.getElementById(to_hide_elem) && document.getElementById(to_hide_elem).style.display !== 'none'){\n\t\t\tapbct_show_hide_elem(to_hide_elem)\n\t\t}\n\t})\n}\n\nfunction apbct_show_required_groups(event,id){\n\tvar required = document.getElementById('apbct_settings__dwpms_settings')\n\tif (required && required.style.display === 'none'){\n\t\tvar origin_event = event\n\t\tevent.preventDefault()\n\t\tapbct_show_hide_elem('apbct_settings__dwpms_settings')\n\t\tdocument.getElementById(id).dispatchEvent(new origin_event.constructor(origin_event.type, origin_event))\n\t}\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}\n\n// Hightlights element\nfunction apbct_highlight_element(id, times){\n\ttimes = times-1 || 0;\n\tlet key_field = jQuery('#'+id)\n\tjQuery(\"html, body\").animate({ scrollTop: key_field.offset().top - 100 }, \"slow\");\n\tkey_field.addClass('apbct_highlighted');\n\tkey_field.animate({opacity: 0 }, 400, 'linear', function(){\n\t\tkey_field.animate({opacity: 1 }, 400, 'linear', function(){\n\t\t\tif(times>0){\n\t\t\t\tapbct_highlight_element(id, times);\n\t\t\t}else{\n\t\t\t\tkey_field.removeClass('apbct_highlighted');\n\t\t\t}\n\t\t});\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","apbct_excepted_show_hide","element","to_hide","index","indexOf","splice","to_hide_elem","style","display","apbct_show_required_groups","event","id","required","origin_event","preventDefault","dispatchEvent","constructor","type","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","bottom","apbct_highlight_element","times","let","key_field","animate","scrollTop","offset","addClass","opacity","removeClass","ready","postFix","parseInt","value","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","$this","accountEmailField","accountEmail","text","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","match","key_is_ok","customUploader","wp","media","library","multiple","image","get","first","toJSON","url","confirm","src"],"mappings":"AA4WA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,oCAAoC,EAC7C,C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E,EAASlH,OAAO4G,IAAI,EAEpB6C,EAAiBC,GAAGC,MAAM,CAC/BC,QAAU,CACThH,KAAO,OACR,EACAiH,SAAU,CAAA,CACX,CAAC,EAEDJ,EAAe9E,GAAG,SAAU,WAC3B,IAAMmF,EAAQL,EAAexG,MAAM,EAAE8G,IAAI,WAAW,EAAEC,MAAM,EAAEC,OAAO,EAErE/C,EAAOtD,OAAO,EAAEpC,KAAK,EAAEmF,KAAM,MAAOmD,EAAMI,GAAI,EAC9ClK,OAAO,wBAAwB,EAAE0G,IAAKoD,EAAMxH,EAAG,CAChD,CAAC,EAEDmH,EAAehC,KAAK,CACrB,CAAC,EAKDzH,OAAO,iCAAiC,EAAEyI,MAAM,SAAU/E,GACzDA,EAAEjB,eAAe,EAEZ,CAAA,IAAS0H,QAAS,OAAQ,IACxBC,EAAMpK,OAAO4G,IAAI,EAAEhD,OAAO,EAAEpC,KAAK,EAAE5B,KAAK,KAAK,EACnDI,OAAO4G,IAAI,EAAEhD,OAAO,EAAEpC,KAAK,EAAEmF,KAAK,MAAOyD,CAAG,EAC5CpK,OAAO4G,IAAI,EAAEpF,KAAK,EAAEA,KAAK,EAAEkF,IAAI,EAAE,EAEnC,CAAC,CAEF,CAAC"}
js/cleantalk-comments-checkspam.min.js CHANGED
@@ -1,2 +1,2 @@
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(){var e;!0!==ct_cooling_down_flag&&(ct_max_requests<=ct_requests_counter?(setTimeout(ct_cooling_down_toggle,ct_cool_down_time),ct_cooling_down_flag=!(ct_requests_counter=0)):(ct_requests_counter++,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=/; samesite=lax"+ctSecure,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(){var e;ct_working&&(1==ct_cooling_down_flag?(jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),jQuery("#ct_cooling_notice").show()):(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_accurate_check").is(":checked")&&!jQuery("#ct_allow_date_range").is(":checked")?alert("Please, select a date range."):(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)}),jQuery("#ct_accurate_check").change(function(){this.checked&&(jQuery("#ct_allow_date_range").prop("checked",!0),jQuery(".ct_date").prop("checked",!0).attr("disabled",!1))})});
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(){var e;!0!==ct_cooling_down_flag&&(ct_max_requests<=ct_requests_counter?(setTimeout(ct_cooling_down_toggle,ct_cool_down_time),ct_cooling_down_flag=!(ct_requests_counter=0)):(ct_requests_counter++,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=/; samesite=lax"+ctSecure,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(){var e;ct_working&&(1==ct_cooling_down_flag?(jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)"),jQuery("#ct_cooling_notice").show()):(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_accurate_check").is(":checked")&&!jQuery("#ct_allow_date_range").is(":checked")?alert("Please, select a date range."):(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)}),jQuery("#ct_accurate_check").change(function(){this.checked&&(jQuery("#ct_allow_date_range").prop("checked",!0),jQuery(".ct_date").prop("checked",!0).attr("disabled",!1))})});
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=/; samesite=lax\" + ctSecure;\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\n\t\tif (\n\t\t\tjQuery('#ct_accurate_check').is(':checked') &&\n\t\t\t! jQuery('#ct_allow_date_range').is(':checked')\n\t\t) {\n\t\t\talert('Please, select a date range.');\n\t\t\treturn;\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\t/**\n\t * Checked ct_accurate_check\n\t */\n\tjQuery('#ct_accurate_check').change(function () {\n\t\tif(this.checked) {\n\t\t\tjQuery('#ct_allow_date_range').prop('checked', true);\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t}\n\t});\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","change"],"mappings":"AAYA,IAAIA,WAAa,EAXjBC,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAU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E,CAEjB,CAAC,EAGD5D,OAAO,cAAc,EAAEiG,MAAM,SAAUrC,GAEtC,GAAI,CAAC1B,QAAQnD,gBAAgB2H,mBAAmB,EAC/C,MAAO,CAAA,EAERzC,YAAaL,CAAE,CAEhB,CAAC,EAKD5D,OAAO,oBAAoB,EAAE2G,OAAO,WAChCzI,KAAKsE,UACPxC,OAAO,sBAAsB,EAAEyD,KAAK,UAAW,CAAA,CAAI,EACnDzD,OAAO,UAAU,EAAEyD,KAAK,UAAW,CAAA,CAAI,EAAEkB,KAAK,WAAW,CAAA,CAAK,EAEhE,CAAC,CACF,CAAC"}
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\tstatus_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=/; samesite=lax\" + ctSecure;\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\n\t\tif (\n\t\t\tjQuery('#ct_accurate_check').is(':checked') &&\n\t\t\t! jQuery('#ct_allow_date_range').is(':checked')\n\t\t) {\n\t\t\talert('Please, select a date range.');\n\t\t\treturn;\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\t/**\n\t * Checked ct_accurate_check\n\t */\n\tjQuery('#ct_accurate_check').change(function () {\n\t\tif(this.checked) {\n\t\t\tjQuery('#ct_allow_date_range').prop('checked', true);\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t}\n\t});\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","change"],"mappings":"AAYA,IAAIA,WAAa,EAXjBC,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,QAAQ,KAAM,CAAC,CAAC,EACpEC,EAAmBN,EAAUI,UAAUJ,EAAUK,QAAQ,KAAM,CAAC,EAAE,EAAGL,EAAUO,MAAM,EACzFP,EAAYG,EAAmBD,UAAUH,GAAOO,EAE9C,OAAON,CACX,GAICQ,aAAe,CAAA,EACfC,qBAAuB,CAAA,EACvBC,iBAAmB,CAAA,EACnBC,kBAAoB,CAAA,EACpBC,SAAW,CAAA,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,CAAE,EAAEE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,EAAEE,CAAE,CACrB,CAAC,EAEDC,OAAO,YAAYD,CAAE,EAAEE,OAAO,IAAIH,EAAG,WACpCD,gBAAgB,GAAIE,CAAE,CACvB,CAAC,EAGFpB,iBAAiB,CAAA,CAEnB,CAEA,SAASuB,oBAER,IAAIC,EAAO,EAAGC,EAAO,EAKjBC,GAJDL,OAAO,sBAAsB,EAAEM,G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B,KAAYR,aACZS,KAAYR,YACb,EACAc,SAASC,OAAS,wBAA0ByF,KAAKC,UAAUH,CAAQ,EAAI,wBACxE,CAAC,EAG4B,MAA1BnH,gBAAgBuH,QAClB5F,SAASC,OAAS,sCAAwC,IAAI4F,KAAK,CAAC,EAAEC,YAAY,EAAI,yBACtFxG,OAAO,uBAAuB,EAAEiG,MAAM,GAIvCjG,OAAO,eAAe,EAAEiG,MAAM,SAAUrC,GAEvC,GAAI,CAAC1B,QAAQnD,gBAAgB0H,oBAAoB,EAChD,MAAO,CAAA,EAER9C,aAAcC,CAAE,CAEjB,CAAC,EAGD5D,OAAO,cAAc,EAAEiG,MAAM,SAAUrC,GAEtC,GAAI,CAAC1B,QAAQnD,gBAAgB2H,mBAAmB,EAC/C,MAAO,CAAA,EAERzC,YAAaL,CAAE,CAEhB,CAAC,EAKD5D,OAAO,oBAAoB,EAAE2G,OAAO,WAChCzI,KAAKsE,UACPxC,OAAO,sBAAsB,EAAEyD,KAAK,UAAW,CAAA,CAAI,EACnDzD,OAAO,UAAU,EAAEyD,KAAK,UAAW,CAAA,CAAI,EAAEkB,KAAK,WAAW,CAAA,CAAK,EAEhE,CAAC,CACF,CAAC"}
lib/Cleantalk/Antispam/Cleantalk.php CHANGED
@@ -174,6 +174,10 @@ class Cleantalk
174
  $request->feedback = implode(';', $request->feedback);
175
  }
176
  break;
 
 
 
 
177
  }
178
 
179
  // Removing non UTF8 characters from request, because non UTF8 or malformed characters break json_encode().
@@ -237,6 +241,7 @@ class Cleantalk
237
  */
238
  private function httpRequest($msg)
239
  {
 
240
  // Using current server without changing it
241
  $result = ! empty($this->work_url) && $this->server_changed + 86400 > time()
242
  ? $this->sendRequest($msg, $this->work_url, $this->server_timeout)
@@ -244,6 +249,7 @@ class Cleantalk
244
 
245
  // Changing server if no work_url or request has an error
246
  if ( $result === false || (is_object($result) && $result->errno != 0) ) {
 
247
  if ( ! empty($this->work_url) ) {
248
  $this->downServers[] = $this->work_url;
249
  }
@@ -252,8 +258,11 @@ class Cleantalk
252
  if ( $result !== false && $result->errno === 0 ) {
253
  $this->server_change = true;
254
  }
 
 
 
255
  }
256
- $response = new CleantalkResponse($result);
257
 
258
  if ( ! empty($this->data_codepage) && $this->data_codepage !== 'UTF-8' ) {
259
  if ( ! empty($response->comment) ) {
174
  $request->feedback = implode(';', $request->feedback);
175
  }
176
  break;
177
+
178
+ case 'check_bot':
179
+ $request->message_to_log = $this->compressData($request->message_to_log);
180
+ break;
181
  }
182
 
183
  // Removing non UTF8 characters from request, because non UTF8 or malformed characters break json_encode().
241
  */
242
  private function httpRequest($msg)
243
  {
244
+ $failed_urls = null;
245
  // Using current server without changing it
246
  $result = ! empty($this->work_url) && $this->server_changed + 86400 > time()
247
  ? $this->sendRequest($msg, $this->work_url, $this->server_timeout)
249
 
250
  // Changing server if no work_url or request has an error
251
  if ( $result === false || (is_object($result) && $result->errno != 0) ) {
252
+ $failed_urls = $this->work_url;
253
  if ( ! empty($this->work_url) ) {
254
  $this->downServers[] = $this->work_url;
255
  }
258
  if ( $result !== false && $result->errno === 0 ) {
259
  $this->server_change = true;
260
  }
261
+ if ( $result === false || (is_object($result) && $result->errno != 0) ) {
262
+ $failed_urls .= ', ' . $this->work_url;
263
+ }
264
  }
265
+ $response = new CleantalkResponse($result, $failed_urls);
266
 
267
  if ( ! empty($this->data_codepage) && $this->data_codepage !== 'UTF-8' ) {
268
  if ( ! empty($response->comment) ) {
lib/Cleantalk/Antispam/CleantalkResponse.php CHANGED
@@ -126,12 +126,18 @@ class CleantalkResponse
126
  */
127
  public $error = null;
128
 
 
 
 
 
 
129
  /**
130
  * Create server response
131
  *
132
  * @param object $obj
 
133
  */
134
- public function __construct($obj = null)
135
  {
136
  $this->errno = isset($obj->errno) ? $obj->errno : 0;
137
  $this->errstr = isset($obj->errstr) ? preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", htmlspecialchars($obj->errstr)) : null;
@@ -157,5 +163,7 @@ class CleantalkResponse
157
  if ( $this->errno !== 0 && $this->errstr !== null && $this->comment === null ) {
158
  $this->comment = '*** ' . $this->errstr . ' Anti-Spam service cleantalk.org ***';
159
  }
 
 
160
  }
161
  }
126
  */
127
  public $error = null;
128
 
129
+ /**
130
+ * @var string Failed connections array data
131
+ */
132
+ public $failed_connections_urls_string = '';
133
+
134
  /**
135
  * Create server response
136
  *
137
  * @param object $obj
138
+ * @param null|string $failed_urls
139
  */
140
+ public function __construct($obj = null, $failed_urls = null)
141
  {
142
  $this->errno = isset($obj->errno) ? $obj->errno : 0;
143
  $this->errstr = isset($obj->errstr) ? preg_replace("/.+(\*\*\*.+\*\*\*).+/", "$1", htmlspecialchars($obj->errstr)) : null;
163
  if ( $this->errno !== 0 && $this->errstr !== null && $this->comment === null ) {
164
  $this->comment = '*** ' . $this->errstr . ' Anti-Spam service cleantalk.org ***';
165
  }
166
+
167
+ $this->failed_connections_urls_string = !empty($failed_urls) ? $failed_urls : '';
168
  }
169
  }
lib/Cleantalk/Antispam/EmailEncoder.php CHANGED
@@ -2,6 +2,7 @@
2
 
3
  namespace Cleantalk\Antispam;
4
 
 
5
  use Cleantalk\Templates\Singleton;
6
  use Cleantalk\ApbctWP\Variables\Post;
7
 
@@ -35,16 +36,14 @@ class EmailEncoder
35
  private $attribute_exclusions_signs = array(
36
  'input' => array('placeholder', 'value'),
37
  );
38
-
39
  /**
40
- * @var string
41
  */
42
- protected $decoded_email;
43
-
44
  /**
45
- * @var string
46
  */
47
- protected $encoded_email;
48
 
49
  /**
50
  * @var string
@@ -56,6 +55,7 @@ class EmailEncoder
56
  * @var string
57
  */
58
  private $temp_content;
 
59
 
60
  /**
61
  * @inheritDoc
@@ -151,27 +151,39 @@ class EmailEncoder
151
  if (! defined('REST_REQUEST')) {
152
  check_ajax_referer('ct_secret_stuff');
153
  }
154
-
155
  if ( $this->checkRequest() ) {
156
- $this->decoded_email = $this->decodeEmailFromPost();
157
- $this->response = $this->compileResponse($this->decoded_email, true);
 
 
 
 
 
158
  wp_send_json_success($this->response);
159
  }
160
- $this->response = $this->compileResponse('', false);
161
- wp_send_json_error($this->response);
 
 
162
  }
163
 
164
  /**
165
  * Main logic of the decoding the encoded data.
166
  *
167
- * @return string encoded email
168
  */
169
  public function decodeEmailFromPost()
170
  {
171
- $this->encoded_email = trim(Post::get('encodedEmail'));
172
- $this->decoded_email = $this->decodeString($this->encoded_email, $this->secret_key);
 
 
 
 
 
173
 
174
- return $this->decoded_email;
175
  }
176
 
177
  /**
@@ -184,9 +196,18 @@ class EmailEncoder
184
  return true;
185
  }
186
 
187
- protected function compileResponse($decoded_email, $is_allowed)
188
  {
189
- return strip_tags($decoded_email, '<a>');
 
 
 
 
 
 
 
 
 
190
  }
191
 
192
  /**
@@ -347,6 +368,13 @@ class EmailEncoder
347
  */
348
  private function isExcludedRequest()
349
  {
 
 
 
 
 
 
 
350
  if (
351
  apbct_is_plugin_active('ultimate-member/ultimate-member.php') &&
352
  isset($_POST['um_request']) &&
2
 
3
  namespace Cleantalk\Antispam;
4
 
5
+ use Cleantalk\ApbctWP\Variables\Cookie;
6
  use Cleantalk\Templates\Singleton;
7
  use Cleantalk\ApbctWP\Variables\Post;
8
 
36
  private $attribute_exclusions_signs = array(
37
  'input' => array('placeholder', 'value'),
38
  );
 
39
  /**
40
+ * @var string[]
41
  */
42
+ protected $decoded_emails_array;
 
43
  /**
44
+ * @var string[]
45
  */
46
+ protected $encoded_emails_array;
47
 
48
  /**
49
  * @var string
55
  * @var string
56
  */
57
  private $temp_content;
58
+ protected $has_connection_error;
59
 
60
  /**
61
  * @inheritDoc
151
  if (! defined('REST_REQUEST')) {
152
  check_ajax_referer('ct_secret_stuff');
153
  }
154
+ $this->decoded_emails_array = $this->decodeEmailFromPost();
155
  if ( $this->checkRequest() ) {
156
+ //has error response from cloud
157
+ if ( $this->has_connection_error ) {
158
+ $this->response = $this->compileResponse($this->decoded_emails_array, false);
159
+ wp_send_json_error($this->response);
160
+ }
161
+ //decoding is allowed by cloud
162
+ $this->response = $this->compileResponse($this->decoded_emails_array, true);
163
  wp_send_json_success($this->response);
164
  }
165
+ //decoding is not allowed by cloud
166
+ $this->response = $this->compileResponse($this->decoded_emails_array, false);
167
+ //important - frontend waits success true to handle response
168
+ wp_send_json_success($this->response);
169
  }
170
 
171
  /**
172
  * Main logic of the decoding the encoded data.
173
  *
174
+ * @return string[] array of decoded email
175
  */
176
  public function decodeEmailFromPost()
177
  {
178
+ $encoded_emails_array = Post::get('encodedEmails');
179
+ $encoded_emails_array = str_replace('\\', '', $encoded_emails_array);
180
+ $this->encoded_emails_array = json_decode($encoded_emails_array, true);
181
+
182
+ foreach ( $this->encoded_emails_array as $_key => $encoded_email) {
183
+ $this->decoded_emails_array[$encoded_email] = $this->decodeString($encoded_email, $this->secret_key);
184
+ }
185
 
186
+ return $this->decoded_emails_array;
187
  }
188
 
189
  /**
196
  return true;
197
  }
198
 
199
+ protected function compileResponse($decoded_emails_array, $is_allowed)
200
  {
201
+ $result = array();
202
+
203
+ if ( empty($decoded_emails_array) ) {
204
+ return false;
205
+ }
206
+
207
+ foreach ( $decoded_emails_array as $_encoded_email => $decoded_email ) {
208
+ $result[] = strip_tags($decoded_email, '<a>');
209
+ }
210
+ return $result;
211
  }
212
 
213
  /**
368
  */
369
  private function isExcludedRequest()
370
  {
371
+
372
+ // Excluded request by alt cookie
373
+ $apbct_email_encoder_passed = Cookie::get('apbct_email_encoder_passed');
374
+ if ( $apbct_email_encoder_passed === '1' ) {
375
+ return true;
376
+ }
377
+
378
  if (
379
  apbct_is_plugin_active('ultimate-member/ultimate-member.php') &&
380
  isset($_POST['um_request']) &&
lib/Cleantalk/ApbctWP/Activator.php CHANGED
@@ -103,7 +103,7 @@ class Activator
103
  ); // Get data for dashboard widget
104
  $ct_cron->addTask(
105
  'send_connection_report',
106
- 'ct_mail_send_connection_report',
107
  86400,
108
  time() + 3500
109
  ); // Send connection report to welcome@cleantalk.org
103
  ); // Get data for dashboard widget
104
  $ct_cron->addTask(
105
  'send_connection_report',
106
+ 'ct_cron_send_connection_report_email',
107
  86400,
108
  time() + 3500
109
  ); // Send connection report to welcome@cleantalk.org
lib/Cleantalk/ApbctWP/Antispam/EmailEncoder.php CHANGED
@@ -41,7 +41,7 @@ class EmailEncoder extends \Cleantalk\Antispam\EmailEncoder
41
  'browser_sign' => $browser_sign, // Browser ID
42
  'sender_ip' => Helper::ipGet(), // IP address
43
  'event_type' => 'CONTACT_DECODING', // 'GENERAL_BOT_CHECK' || 'CONTACT_DECODING'
44
- 'message_to_log' => $this->decoded_email, // Custom message
45
  'page_url' => Post::get('post_url'),
46
  'sender_info' => array(
47
  'site_referrer' => Post::get('referrer'),
@@ -51,6 +51,7 @@ class EmailEncoder extends \Cleantalk\Antispam\EmailEncoder
51
  $ct_request = new CleantalkRequest($params);
52
 
53
  $ct = new Cleantalk();
 
54
 
55
  // Options store url without scheme because of DB error with ''://'
56
  $config = ct_get_server();
@@ -64,7 +65,7 @@ class EmailEncoder extends \Cleantalk\Antispam\EmailEncoder
64
  // Send error as comment in this case
65
  if ( ! empty($api_response->errstr)) {
66
  $this->comment = $api_response->errstr;
67
-
68
  return true;
69
  }
70
 
@@ -80,18 +81,23 @@ class EmailEncoder extends \Cleantalk\Antispam\EmailEncoder
80
  /**
81
  * Compile the response to pass it further
82
  *
83
- * @param $decoded_email
84
  * @param $is_allowed
85
  *
86
  * @return array
87
  */
88
- protected function compileResponse($decoded_email, $is_allowed)
89
  {
90
- return [
91
- 'is_allowed' => $is_allowed,
92
- 'show_comment' => ! $is_allowed,
93
- 'comment' => $this->comment,
94
- 'decoded_email' => strip_tags($decoded_email, '<a>'),
95
- ];
 
 
 
 
 
96
  }
97
  }
41
  'browser_sign' => $browser_sign, // Browser ID
42
  'sender_ip' => Helper::ipGet(), // IP address
43
  'event_type' => 'CONTACT_DECODING', // 'GENERAL_BOT_CHECK' || 'CONTACT_DECODING'
44
+ 'message_to_log' => json_encode($this->decoded_emails_array), // Custom message
45
  'page_url' => Post::get('post_url'),
46
  'sender_info' => array(
47
  'site_referrer' => Post::get('referrer'),
51
  $ct_request = new CleantalkRequest($params);
52
 
53
  $ct = new Cleantalk();
54
+ $this->has_connection_error = false;
55
 
56
  // Options store url without scheme because of DB error with ''://'
57
  $config = ct_get_server();
65
  // Send error as comment in this case
66
  if ( ! empty($api_response->errstr)) {
67
  $this->comment = $api_response->errstr;
68
+ $this->has_connection_error = true;
69
  return true;
70
  }
71
 
81
  /**
82
  * Compile the response to pass it further
83
  *
84
+ * @param $decoded_emails_array
85
  * @param $is_allowed
86
  *
87
  * @return array
88
  */
89
+ protected function compileResponse($decoded_emails_array, $is_allowed)
90
  {
91
+ $result = array();
92
+ foreach ( $decoded_emails_array as $encoded_email => $decoded_email ) {
93
+ $result[] = array(
94
+ 'is_allowed' => $is_allowed,
95
+ 'show_comment' => !$is_allowed,
96
+ 'comment' => $this->comment,
97
+ 'encoded_email' => strip_tags($encoded_email, '<a>'),
98
+ 'decoded_email' => $is_allowed ? strip_tags($decoded_email, '<a>') : '',
99
+ );
100
+ }
101
+ return $result;
102
  }
103
  }
lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php CHANGED
@@ -18,27 +18,12 @@ class CleantalkSettingsTemplates
18
  public function __construct($api_key)
19
  {
20
  $this->api_key = $api_key;
21
- add_filter('apbct_settings_action_buttons', array($this, 'addActionButton'), 10, 1);
22
  add_action('wp_ajax_get_options_template', array($this, 'getOptionsTemplateAjax'));
23
  add_action('wp_ajax_settings_templates_export', array($this, 'settingsTemplatesExportAjax'));
24
  add_action('wp_ajax_settings_templates_import', array($this, 'settingsTemplatesImportAjax'));
25
  add_action('wp_ajax_settings_templates_reset', array($this, 'settingsTemplatesResetAjax'));
26
  }
27
 
28
- public function addActionButton($links)
29
- {
30
- if ( is_array($links) ) {
31
- $last_link = array_slice($links, -1, 1);
32
- unset($links[count($links) - 1]);
33
- $link = '<a href="#" class="ct_support_link" onclick="cleantalkModal.open()">' .
34
- __('Import/Export settings', 'cleantalk-spam-protect') . '</a>';
35
- $links[] = $link;
36
- $links[] = $last_link[0];
37
- }
38
-
39
- return $links;
40
- }
41
-
42
  public function getOptionsTemplateAjax()
43
  {
44
  check_ajax_referer('ct_secret_nonce', 'security');
18
  public function __construct($api_key)
19
  {
20
  $this->api_key = $api_key;
 
21
  add_action('wp_ajax_get_options_template', array($this, 'getOptionsTemplateAjax'));
22
  add_action('wp_ajax_settings_templates_export', array($this, 'settingsTemplatesExportAjax'));
23
  add_action('wp_ajax_settings_templates_import', array($this, 'settingsTemplatesImportAjax'));
24
  add_action('wp_ajax_settings_templates_reset', array($this, 'settingsTemplatesResetAjax'));
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  public function getOptionsTemplateAjax()
28
  {
29
  check_ajax_referer('ct_secret_nonce', 'security');
lib/Cleantalk/ApbctWP/ConnectionReports.php ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ use Cleantalk\Antispam\CleantalkRequest;
6
+ use Cleantalk\Antispam\CleantalkResponse;
7
+ use Cleantalk\ApbctWP\Variables\Server;
8
+
9
+ class ConnectionReports
10
+ {
11
+ /**
12
+ * Statistics of state
13
+ * @var int[]
14
+ */
15
+ public $reports_count = array(
16
+ 'positive' => 0,
17
+ 'negative' => 0,
18
+ 'total' => 0,
19
+ 'stat_since' => 0
20
+ );
21
+
22
+ /**
23
+ * Instance of DB object
24
+ * @var DB
25
+ */
26
+ private $db;
27
+ /**
28
+ * DB table name
29
+ * @var
30
+ */
31
+ private $cr_table_name;
32
+ /**
33
+ * Limit of reports to keep
34
+ * @var int
35
+ */
36
+ private $reports_limit = 20;
37
+ /**
38
+ * @var array Current reports data from DB
39
+ */
40
+ private $reports_data;
41
+
42
+ /**
43
+ * ConnectionReports constructor.
44
+ * @param DB $db
45
+ * @param $cr_table_name
46
+ */
47
+ public function __construct(DB $db, $cr_table_name)
48
+ {
49
+ global $apbct;
50
+ $this->db = $db;
51
+ $this->cr_table_name = $cr_table_name;
52
+ $this->reports_count['positive'] = isset($apbct->data['connection_reports_count']['positive'])
53
+ ? $apbct->data['connection_reports_count']['positive']
54
+ : $this->reports_count['positive'];
55
+ $this->reports_count['negative'] = isset($apbct->data['connection_reports_count']['negative'])
56
+ ? $apbct->data['connection_reports_count']['negative']
57
+ : $this->reports_count['positive'];
58
+ $this->reports_count['total'] = isset($apbct->data['connection_reports_count']['total'])
59
+ ? $apbct->data['connection_reports_count']['total']
60
+ : $this->reports_count['positive'];
61
+ $this->reports_count['stat_since'] = isset($apbct->data['connection_reports_count']['stat_since'])
62
+ ? $apbct->data['connection_reports_count']['stat_since']
63
+ : date('d M');
64
+ $this->getReportsDataFromDb();
65
+ }
66
+
67
+ /**
68
+ * Initialize once all the reports data from Db to class
69
+ * @return array|null|object of reports data. Used in testcases only.
70
+ * @psalm-suppress PossiblyUnusedMethod
71
+ * @psalm-suppress PossiblyUnusedReturnValue
72
+ */
73
+ public function getReportsDataFromDb()
74
+ {
75
+ $table_exist = $this->db->fetchAll(
76
+ 'SHOW TABLES LIKE "' . $this->cr_table_name . '";'
77
+ );
78
+
79
+ if ( empty($table_exist) ) {
80
+ $this->reports_data = array();
81
+ return;
82
+ }
83
+
84
+ $sql =
85
+ "SELECT * FROM " . $this->cr_table_name .
86
+ " ORDER BY date;";
87
+
88
+ $this->reports_data = $this->db->fetchAll($sql);
89
+
90
+ return $this->reports_data;
91
+ }
92
+
93
+ /**
94
+ * Update global stats in state
95
+ */
96
+ private function updateStats()
97
+ {
98
+ global $apbct;
99
+ $this->reports_count['total'] = (int)$this->reports_count['positive'] + (int)$this->reports_count['negative'];
100
+ $apbct->data['connection_reports_count'] = $this->reports_count;
101
+ $apbct->saveData();
102
+ }
103
+
104
+ /**
105
+ * Array of report's IDs that has null on on_sent field
106
+ * @return array
107
+ */
108
+ private function getUnsentReportsIds()
109
+ {
110
+ $result = array();
111
+
112
+ if ( !empty($this->reports_data) ) {
113
+ foreach ( $this->reports_data as $row ) {
114
+ if ( empty($row['sent_on']) || $row['sent_on'] === 'NULL' ) {
115
+ $result[] = $row['id'];
116
+ }
117
+ }
118
+ }
119
+
120
+ return $result;
121
+ }
122
+
123
+ /**
124
+ * Set a report as sent
125
+ * @param string $id id of report
126
+ */
127
+ private function setReportAsSent($id = '')
128
+ {
129
+ if ( !empty($id) ) {
130
+ $this->db->execute(
131
+ "INSERT INTO " . $this->cr_table_name . " SET
132
+ id = " . $id . ",
133
+ date = date,
134
+ page_url = page_url,
135
+ lib_report = lib_report,
136
+ failed_work_urls = failed_work_urls,
137
+ request_content = request_content
138
+ ON DUPLICATE KEY UPDATE
139
+ sent_on = " . time() . ";"
140
+ );
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Rotates reports in DB, remove oldest one.
146
+ */
147
+ private function rotateReports()
148
+ {
149
+ /**
150
+ * keep 20 newest records
151
+ */
152
+ $this->getReportsDataFromDb();
153
+
154
+ if ( count($this->reports_data) === $this->reports_limit + 1 ) {
155
+ $overlimit = count($this->reports_data) - $this->reports_limit + 1 ;
156
+ $reports_to_del = array_slice($this->reports_data, 0, $overlimit);
157
+
158
+ $ids = array_column($reports_to_del, 'id');
159
+
160
+ $ids = '(' . implode(',', $ids) . ')';
161
+
162
+ $this->db->execute(
163
+ "DELETE FROM " . $this->cr_table_name . " WHERE id IN " . $ids . ";"
164
+ );
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Return reports data by their Ids
170
+ * @param array $ids
171
+ * @return array
172
+ */
173
+ private function getReportsDataByIds(array $ids)
174
+ {
175
+
176
+ $reports = array();
177
+
178
+ foreach ( $this->reports_data as $report ) {
179
+ if ( in_array($report['id'], $ids, false) ) {
180
+ $reports[] = $report;
181
+ }
182
+ }
183
+
184
+ return $reports;
185
+ }
186
+
187
+ /**
188
+ * Add report data to DB
189
+ * @param string $lib_report HTTP lib report text
190
+ * @param string $failed_work_urls Current work URLs of CT server that failed
191
+ * @param array $request_content CleanTalk request content
192
+ * @param bool $post_blocked_via_js_check Flag if JS check passed request or not
193
+ */
194
+ private function addReportToDb(
195
+ $lib_report = '',
196
+ $failed_work_urls = '',
197
+ $request_content = array(),
198
+ $post_blocked_via_js_check = false
199
+ ) {
200
+ $cr_data = array(
201
+ 'date' => time(),
202
+ 'page_url' => get_site_url() . Server::get('REQUEST_URI'),
203
+ 'lib_report' => $lib_report,
204
+ 'failed_work_urls' => $failed_work_urls,
205
+ 'request_content' => json_encode(esc_sql($request_content)),
206
+ 'js_block' => $post_blocked_via_js_check ? '1' : '0'
207
+ );
208
+
209
+ $this->db->prepare(
210
+ "INSERT INTO " . $this->cr_table_name . "
211
+ SET
212
+ date = %s,
213
+ page_url = %s,
214
+ lib_report = %s,
215
+ failed_work_urls = %s,
216
+ request_content = %s,
217
+ js_block = %s",
218
+ array(
219
+ $cr_data['date'],
220
+ $cr_data['page_url'],
221
+ $cr_data['lib_report'],
222
+ $cr_data['failed_work_urls'],
223
+ $cr_data['request_content'],
224
+ $cr_data['js_block'],
225
+ )
226
+ );
227
+
228
+ $this->db->execute($this->db->getQuery());
229
+ }
230
+
231
+ /**
232
+ * Return HTML of negative reports table
233
+ * @return string
234
+ * @psalm-suppress PossiblyUnusedMethod
235
+ */
236
+ public function prepareNegativeReportsHtmlForSettingsPage()
237
+ {
238
+ if ( empty($this->reports_data) ) {
239
+ return '';
240
+ }
241
+
242
+ $rows = '';
243
+
244
+ $reports_html = '<div><p>From '
245
+ . $this->reports_count['stat_since']
246
+ . ' to ' . date('d M') . ' has been made '
247
+ . $this->reports_count['total']
248
+ . ' calls, where ' . $this->reports_count['positive'] . ' were success and '
249
+ . $this->reports_count['negative'] . ' were negative
250
+ </p></div>';
251
+
252
+ foreach ( $this->reports_data as $key => $report ) {
253
+ //colorize
254
+ if ( isset($report['sent_on']) && $report['sent_on'] ) {
255
+ $status = 'Sent';
256
+ $color = 'gray';
257
+ } else {
258
+ $status = 'New';
259
+ $color = 'black';
260
+ }
261
+ //draw reports rows
262
+ $rows .= '<tr style="color:' . $color . '">'
263
+ . '<td>' . Escape::escHtml((int)$key + 1) . '.</td>'
264
+ . '<td>' . Escape::escHtml(date('m-d-y H:i:s', $report['date'])) . '</td>'
265
+ . '<td>' . Escape::escUrl($report['page_url']) . '</td>'
266
+ . '<td>' . Escape::escHtml($report['lib_report']) . '</td>'
267
+ . '<td>' . Escape::escHtml($report['failed_work_urls']) . '</td>'
268
+ . '<td>' . Escape::escHtml($report['js_block'] === '1' ? 'Yes' : 'No') . '</td>'
269
+ . '<td>' . Escape::escHtml($status) . '</td>'
270
+ . '</tr>';
271
+ }
272
+ //draw main report table
273
+ $reports_html .= "
274
+ <table id='negative_reports_table'>
275
+ <th colspan='7'>Failed connection reports</th>
276
+ <tr>
277
+ <td>#</td>
278
+ <td><b>Date</b></td>
279
+ <td><b>Page URL</b></td>
280
+ <td><b>Report</b></td>
281
+ <td><b>Server IP</b></td>
282
+ <td><b>Blocked via JS</b></td>
283
+ <td><b>Status</b></td>
284
+ </tr>"
285
+ //attach reports rows
286
+ . $rows
287
+ . "</table>"
288
+ . "<br/>";
289
+
290
+ return $reports_html;
291
+ }
292
+
293
+ /**
294
+ * Check if there are reports kept
295
+ * @return bool
296
+ * @psalm-suppress PossiblyUnusedMethod
297
+ */
298
+ public function hasNegativeReports()
299
+ {
300
+ return count($this->reports_data) > 0;
301
+ }
302
+
303
+ /**
304
+ * Init connection reports handling
305
+ * @param CleantalkRequest $request
306
+ * @param CleantalkResponse $request_response
307
+ * @param bool $post_blocked_via_js_check
308
+ * @psalm-suppress PossiblyUnusedMethod
309
+ */
310
+ public function handleRequest(
311
+ CleantalkRequest $request,
312
+ CleantalkResponse $request_response,
313
+ $post_blocked_via_js_check
314
+ ) {
315
+
316
+ // Succeeded connection
317
+ if ( $request_response->errno === 0 && empty($request_response->errstr) ) {
318
+ $this->reports_count['positive']++;
319
+
320
+ // Failed to connect. Add a negative report
321
+ } else {
322
+ $this->rotateReports();
323
+ $this->reports_count['negative']++;
324
+ $this->addReportToDb(
325
+ $request_response->errstr,
326
+ $request_response->failed_connections_urls_string,
327
+ Helper::arrayObjectToArray($request),
328
+ $post_blocked_via_js_check
329
+ );
330
+ $this->getReportsDataFromDb();
331
+ }
332
+ $this->updateStats();
333
+ }
334
+
335
+ /**
336
+ * Send email to welcome@cleantlk.org about failed connection reports
337
+ * @param array $unsent_reports_ids IDs of reports that still not sent
338
+ * @param bool $is_cron_task Set if this is a cron task
339
+ * @return bool
340
+ * @psalm-suppress PossiblyUnusedMethod
341
+ */
342
+ private function sendEmail(array $unsent_reports_ids, $is_cron_task = false)
343
+ {
344
+ global $apbct;
345
+
346
+ $selection = $this->getReportsDataByIds($unsent_reports_ids);
347
+
348
+ if ( empty($selection) ) {
349
+ return false;
350
+ }
351
+
352
+ $to = "support@cleantalk.org";
353
+ $subject = "Connection report for " . Server::get('HTTP_HOST');
354
+ $message = '
355
+ <html lang="en">
356
+ <head>
357
+ <title></title>
358
+ </head>
359
+ <body>
360
+ <p>From '
361
+ . $this->reports_count['stat_since']
362
+ . ' to ' . date('d M') . ' has been made '
363
+ . $this->reports_count['total']
364
+ . ' calls, where ' . $this->reports_count['positive'] . ' were success and '
365
+ . $this->reports_count['negative'] . ' were negative
366
+ </p>
367
+ <p>Negative report:</p>
368
+ <table> <tr>
369
+ <td>&nbsp;</td>
370
+ <td><b>Date</b></td>
371
+ <td><b>Page URL</b></td>
372
+ <td><b>Library report</b></td>
373
+ <td><b>Server IP</b></td>
374
+ <td><b>Blocked via JS</b></td>
375
+ </tr>
376
+ ';
377
+ $counter = 0;
378
+
379
+ foreach ( $selection as $_key => $report ) {
380
+ $message .= '<tr>'
381
+ . '<td>' . (++$counter) . '.</td>'
382
+ . '<td>' . date('m-d-y H:i:s', $report['date']) . '</td>'
383
+ . '<td>' . $report['page_url'] . '</td>'
384
+ . '<td>' . $report['lib_report'] . '</td>'
385
+ . '<td>' . $report['failed_work_urls'] . '</td>'
386
+ . '<td>' . ($report['js_block'] === '1' ? 'Yes' : 'No') . '</td>'
387
+ . '</tr>';
388
+ }
389
+
390
+ $message .= '</table>';
391
+ $message .= '<br>';
392
+
393
+ $show_connection_reports_link =
394
+ substr(get_option('home'), -1) === '/' ? get_option('home') : get_option('home') . '/'
395
+ . '?'
396
+ . http_build_query([
397
+ 'plugin_name' => 'apbct',
398
+ 'spbc_remote_call_token' => md5($apbct->api_key),
399
+ 'spbc_remote_call_action' => 'debug',
400
+ 'show_only' => 'connection_reports',
401
+ ]);
402
+
403
+ $message .= '<a href="' . $show_connection_reports_link . '" target="_blank">Show connection reports with remote call</a>';
404
+ $message .= '<br>';
405
+
406
+ $message .= $is_cron_task ? 'This is a cron task.' : 'This is a manual task.';
407
+ $message .= '<br>';
408
+
409
+ $message .= '</body></html>';
410
+
411
+ $headers = "Content-type: text/html; charset=utf-8 \r\n";
412
+ $headers .= 'From: ' . ct_get_admin_email();
413
+
414
+ /** @psalm-suppress UnusedFunctionCall */
415
+ if ( wp_mail($to, $subject, $message, $headers) ) {
416
+ return true;
417
+ }
418
+ return false;
419
+ }
420
+
421
+ /**
422
+ * Init reports sending
423
+ * @param bool $is_cron_task Set if this is a cron task
424
+ * @return string Used just to debug CRON task
425
+ * @psalm-suppress PossiblyUnusedMethod
426
+ */
427
+ public function sendUnsentReports($is_cron_task = false)
428
+ {
429
+ $this->getReportsDataFromDb();
430
+ $unsent_reports_ids = $this->getUnsentReportsIds();
431
+ if ( !empty($unsent_reports_ids) ) {
432
+ /**
433
+ * collect email data by IDs here
434
+ **/
435
+ if ( $this->sendEmail($unsent_reports_ids, $is_cron_task) ) {
436
+ foreach ( $unsent_reports_ids as $report_id ) {
437
+ $this->setReportAsSent($report_id);
438
+ }
439
+ return count($unsent_reports_ids) . ' reports were sent.';
440
+ }
441
+ }
442
+ return 'Nothing to sent.';
443
+ }
444
+
445
+ /**
446
+ * Check if there are unsent reports
447
+ * @return bool
448
+ * @psalm-suppress PossiblyUnusedMethod
449
+ */
450
+ public function hasUnsentReports()
451
+ {
452
+ return (bool)$this->getUnsentReportsIds();
453
+ }
454
+
455
+ /**
456
+ * Prepare data for remote call answer
457
+ * @return array
458
+ * @psalm-suppress PossiblyUnusedMethod
459
+ */
460
+ public function remoteCallOutput()
461
+ {
462
+ /*
463
+ * We can beatyfy it there if needed
464
+ */
465
+ return $this->reports_data;
466
+ }
467
+ /**
468
+ * Truncate connection reports DB
469
+ * @psalm-suppress PossiblyUnusedMethod
470
+ */
471
+ public function wipeReportsData()
472
+ {
473
+ $this->db->execute("TRUNCATE TABLE " . $this->cr_table_name);
474
+ }
475
+ }
lib/Cleantalk/ApbctWP/Deactivator.php CHANGED
@@ -89,6 +89,7 @@ class Deactivator
89
  ); // Deleting user/comments scan result table
90
  $wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_ua_bl`;'); // Deleting AC UA black lists
91
  $wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_sfw_temp`;'); // Deleting temporary SFW data
 
92
  }
93
 
94
  /**
89
  ); // Deleting user/comments scan result table
90
  $wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_ua_bl`;'); // Deleting AC UA black lists
91
  $wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_sfw_temp`;'); // Deleting temporary SFW data
92
+ $wpdb->query('DROP TABLE IF EXISTS `' . $prefix . 'cleantalk_connection_reports`;'); // Deleting connection_reports
93
  }
94
 
95
  /**
lib/Cleantalk/ApbctWP/Escape.php CHANGED
@@ -144,6 +144,8 @@ class Escape extends \Cleantalk\Common\Escape
144
  'ul' => array(),
145
  'span' => array(
146
  'id' => true,
 
 
147
  ),
148
  'button' => array(
149
  'name' => true,
@@ -162,6 +164,38 @@ class Escape extends \Cleantalk\Common\Escape
162
  'href' => true,
163
  ),
164
  'p' => array(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  )
166
  );
167
 
144
  'ul' => array(),
145
  'span' => array(
146
  'id' => true,
147
+ 'class' => true,
148
+ 'style' => true
149
  ),
150
  'button' => array(
151
  'name' => true,
164
  'href' => true,
165
  ),
166
  'p' => array(),
167
+ ),
168
+
169
+ 'apbct_public__trusted_text' => array(
170
+ 'div' => array(
171
+ 'class' => true,
172
+ 'id' => true,
173
+ ),
174
+ 'label' => array(
175
+ 'class' => true,
176
+ 'id' => true,
177
+ 'for' => true,
178
+ 'name' => true,
179
+ ),
180
+ 'input' => array(
181
+ 'class' => true,
182
+ 'id' => true,
183
+ 'for' => true,
184
+ 'name' => true,
185
+ 'type' => true,
186
+ ),
187
+ 'a' => array(
188
+ 'target' => true,
189
+ 'href' => true,
190
+ 'rel' => true,
191
+ ),
192
+ ),
193
+ 'apbct_settings__display__notifications' => array(
194
+ 'a' => array(
195
+ 'target' => true,
196
+ 'href' => true,
197
+ ),
198
+ 'p' => array(),
199
  )
200
  );
201
 
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -72,21 +72,22 @@ class CommentsChecker extends Checker
72
  $amount = $commentsScanParameters->getAmount();
73
  $skip_roles = $commentsScanParameters->getSkipRoles();
74
  $offset = $commentsScanParameters->getOffset();
75
- $between_dates_sql = '';
76
  $date_from = $commentsScanParameters->getFrom();
77
  $date_till = $commentsScanParameters->getTill();
 
 
78
  if ($date_from && $date_till) {
79
  $date_from = date('Y-m-d', (int) strtotime($date_from)) . ' 00:00:00';
80
  $date_till = date('Y-m-d', (int) strtotime($date_till)) . ' 23:59:59';
81
 
82
- $between_dates_sql = "WHERE $wpdb->comments.comment_date_gmt >= '$date_from' AND $wpdb->comments.comment_date_gmt <= '$date_till'";
83
  }
84
 
85
  $comments = $wpdb->get_results(
86
  "
87
  SELECT {$wpdb->comments}.comment_ID, {$wpdb->comments}.comment_date_gmt, {$wpdb->comments}.comment_author_IP, {$wpdb->comments}.comment_author_email, {$wpdb->comments}.user_id
88
  FROM {$wpdb->comments}
89
- {$between_dates_sql}
90
  ORDER BY {$wpdb->comments}.comment_ID ASC
91
  LIMIT $amount OFFSET $offset;"
92
  );
@@ -264,7 +265,7 @@ class CommentsChecker extends Checker
264
  /**
265
  * Total comments
266
  */
267
- $total_comments = wp_count_comments()->total_comments;
268
 
269
  $return = array(
270
  'message' => '',
@@ -521,7 +522,7 @@ class CommentsChecker extends Checker
521
  }
522
 
523
  // Count spam
524
- CommentsScanResponse::getInstance()->setSpam(count($marked_comment_ids));
525
  }
526
 
527
  // Count bad comments
72
  $amount = $commentsScanParameters->getAmount();
73
  $skip_roles = $commentsScanParameters->getSkipRoles();
74
  $offset = $commentsScanParameters->getOffset();
 
75
  $date_from = $commentsScanParameters->getFrom();
76
  $date_till = $commentsScanParameters->getTill();
77
+ $sql_where = "WHERE NOT comment_approved = 'spam' AND NOT comment_approved = 'trash'";
78
+ $sql_where .= " AND ( comment_type = 'comment' OR comment_type = 'trackback' OR comment_type = 'pings' )";
79
  if ($date_from && $date_till) {
80
  $date_from = date('Y-m-d', (int) strtotime($date_from)) . ' 00:00:00';
81
  $date_till = date('Y-m-d', (int) strtotime($date_till)) . ' 23:59:59';
82
 
83
+ $sql_where .= " AND $wpdb->comments.comment_date_gmt >= '$date_from' AND $wpdb->comments.comment_date_gmt <= '$date_till'";
84
  }
85
 
86
  $comments = $wpdb->get_results(
87
  "
88
  SELECT {$wpdb->comments}.comment_ID, {$wpdb->comments}.comment_date_gmt, {$wpdb->comments}.comment_author_IP, {$wpdb->comments}.comment_author_email, {$wpdb->comments}.user_id
89
  FROM {$wpdb->comments}
90
+ {$sql_where}
91
  ORDER BY {$wpdb->comments}.comment_ID ASC
92
  LIMIT $amount OFFSET $offset;"
93
  );
265
  /**
266
  * Total comments
267
  */
268
+ $total_comments = wp_count_comments()->all;
269
 
270
  $return = array(
271
  'message' => '',
522
  }
523
 
524
  // Count spam
525
+ CommentsScanResponse::getInstance()->updateSpam(count($marked_comment_ids));
526
  }
527
 
528
  // Count bad comments
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -161,7 +161,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
161
  WHERE network IN (" . implode(',', $needles) . ")
162
  AND network = " . $current_ip_v4 . " & mask
163
  AND " . rand(1, 100000) . "
164
- ORDER BY status DESC LIMIT 1"
165
  );
166
 
167
  $test_status = 1;
@@ -832,4 +832,111 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule
832
 
833
  return true;
834
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
835
  }
161
  WHERE network IN (" . implode(',', $needles) . ")
162
  AND network = " . $current_ip_v4 . " & mask
163
  AND " . rand(1, 100000) . "
164
+ ORDER BY source DESC, status LIMIT 1"
165
  );
166
 
167
  $test_status = 1;
832
 
833
  return true;
834
  }
835
+
836
+ /**
837
+ * Add a new records to the SFW table. Duplicates will be updated on "status" field.
838
+ * @param DB $db
839
+ * @param $db__table__data
840
+ * @param $metadata
841
+ * @return array
842
+ * @throws \Exception
843
+ */
844
+ public static function privateRecordsAdd(DB $db, $db__table__data, $metadata)
845
+ {
846
+ $added_count = 0;
847
+ $updated_count = 0;
848
+ $ignored_count = 0;
849
+
850
+
851
+ foreach ( $metadata as $_key => $row ) {
852
+ //find duplicate to use it on updating
853
+ $has_duplicate = false;
854
+ $query = "SELECT id,status FROM " . $db__table__data . " WHERE
855
+ network = '" . $row['network'] . "' AND
856
+ mask = '" . $row['mask'] . "' AND
857
+ source = '1';";
858
+
859
+ $db_result = $db->fetch($query);
860
+ if ( $db_result === false ) {
861
+ throw new \RuntimeException($db->getLastError());
862
+ }
863
+
864
+ //if the record is same - pass
865
+ if ( isset($db_result['status']) && $db_result['status'] == $row['status'] ) {
866
+ $ignored_count++;
867
+ continue;
868
+ }
869
+
870
+ //if duplicate found create a chunk
871
+ if ( isset($db_result['id']) ) {
872
+ $id_chunk = "id ='" . $db_result['id'] . "',";
873
+ $has_duplicate = true;
874
+ } else {
875
+ $id_chunk = '';
876
+ }
877
+
878
+ //insertion
879
+ $query = "INSERT INTO " . $db__table__data . " SET
880
+ " . $id_chunk . "
881
+ network = '" . $row['network'] . "',
882
+ mask = '" . $row['mask'] . "',
883
+ status = '" . $row['status'] . "',
884
+ source = '1'
885
+ ON DUPLICATE KEY UPDATE
886
+ id = id,
887
+ network = network,
888
+ mask = mask,
889
+ status = '" . $row['status'] . "',
890
+ source = source;";
891
+
892
+ $db_result = $db->execute($query);
893
+ if ( $db_result === false ) {
894
+ throw new \RuntimeException($db->getLastError());
895
+ }
896
+
897
+ $added_count = $has_duplicate ? $added_count : $added_count + 1;
898
+ $updated_count = $has_duplicate ? $updated_count + 1 : $updated_count;
899
+ }
900
+
901
+ return array(
902
+ 'total' => $added_count + $updated_count + $ignored_count,
903
+ 'added' => $added_count,
904
+ 'updated' => $updated_count,
905
+ 'ignored' => $ignored_count
906
+ );
907
+ }
908
+
909
+ /**
910
+ * Delete private records from SFW table.
911
+ * @param DB $db
912
+ * @param $db__table__data
913
+ * @param $metadata
914
+ * @return array|int[]
915
+ * @throws \Exception
916
+ */
917
+ public static function privateRecordsDelete(DB $db, $db__table__data, $metadata)
918
+ {
919
+ $success_count = 0;
920
+ $ignored_count = 0;
921
+
922
+ foreach ( $metadata as $_key => $row ) {
923
+ $query = "DELETE FROM " . $db__table__data . " WHERE
924
+ network = '" . $row['network'] . "' AND
925
+ mask = '" . $row['mask'] . "' AND
926
+ source = '1';";
927
+ $db_result = $db->execute($query);
928
+ if ( $db_result === false ) {
929
+ throw new \Exception($db->getLastError());
930
+ }
931
+
932
+ $success_count = $db_result === 1 ? $success_count + 1 : $success_count;
933
+ $ignored_count = $db_result === 0 ? $ignored_count + 1 : $ignored_count;
934
+ }
935
+
936
+ return array(
937
+ 'total' => $success_count + $ignored_count,
938
+ 'deleted' => $success_count,
939
+ 'ignored' => $ignored_count
940
+ );
941
+ }
942
  }
lib/Cleantalk/ApbctWP/Firewall/die_page_anticrawler.html CHANGED
@@ -185,12 +185,6 @@
185
  <script>
186
  var ct_date = new Date;
187
 
188
- function set_spamFireWallCookie(cookie_name, cookie_value) {
189
- var date = new Date;
190
- date.setDate(date.getDate() + 30);
191
- ctSetCookie( cookie_name, escape(cookie_value), date.toUTCString() );
192
- }
193
-
194
  function get_current_url() {
195
  document.write(window.location.href);
196
  return null;
@@ -237,8 +231,14 @@
237
  document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
238
 
239
  setTimeout( function(){
240
- set_spamFireWallCookie('wordpress_apbct_antibot', '{COOKIE_ANTICRAWLER}');
241
- set_spamFireWallCookie('apbct_anticrawler_passed','{COOKIE_ANTICRAWLER_PASSED}');
 
 
 
 
 
 
242
  }, 1000 );
243
 
244
  if(location.search.search('debug=1') === -1) {
185
  <script>
186
  var ct_date = new Date;
187
 
 
 
 
 
 
 
188
  function get_current_url() {
189
  document.write(window.location.href);
190
  return null;
231
  document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
232
 
233
  setTimeout( function(){
234
+ var date = new Date;
235
+ date.setDate(date.getDate() + 30);
236
+ ctSetCookie(
237
+ [
238
+ ['wordpress_apbct_antibot', escape('{COOKIE_ANTICRAWLER}'), date.toUTCString()],
239
+ ['apbct_anticrawler_passed', escape('{COOKIE_ANTICRAWLER_PASSED}'), date.toUTCString()]
240
+ ]
241
+ );
242
  }, 1000 );
243
 
244
  if(location.search.search('debug=1') === -1) {
lib/Cleantalk/ApbctWP/Firewall/die_page_antiflood.html CHANGED
@@ -185,12 +185,6 @@
185
  <script>
186
  var ct_date = new Date;
187
 
188
- function set_spamFireWallCookie(cookie_name, cookie_value) {
189
- var date = new Date;
190
- date.setDate(date.getDate() + 30);
191
- ctSetCookie( cookie_name, escape(cookie_value), date.toUTCString() );
192
- }
193
-
194
  function get_current_url() {
195
  document.write(window.location.href);
196
  return null;
@@ -236,7 +230,13 @@
236
  document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
237
 
238
  setTimeout( function(){
239
- set_spamFireWallCookie('apbct_antiflood_passed', '{COOKIE_ANTIFLOOD_PASSED}');
 
 
 
 
 
 
240
  }, 5000 );
241
 
242
  if(location.search.search('debug=1') === -1) {
185
  <script>
186
  var ct_date = new Date;
187
 
 
 
 
 
 
 
188
  function get_current_url() {
189
  document.write(window.location.href);
190
  return null;
230
  document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
231
 
232
  setTimeout( function(){
233
+ var date = new Date;
234
+ date.setDate(date.getDate() + 30);
235
+ ctSetCookie(
236
+ [
237
+ ['apbct_antiflood_passed', escape('{COOKIE_ANTIFLOOD_PASSED}'), date.toUTCString()]
238
+ ]
239
+ );
240
  }, 5000 );
241
 
242
  if(location.search.search('debug=1') === -1) {
lib/Cleantalk/ApbctWP/Firewall/die_page_sfw.html CHANGED
@@ -185,12 +185,6 @@
185
  <script>
186
  var ct_date = new Date;
187
 
188
- function set_spamFireWallCookie(cookie_name, cookie_value) {
189
- var date = new Date;
190
- date.setDate(date.getDate() + 30);
191
- ctSetCookie( cookie_name, escape(cookie_value), date.toUTCString() );
192
- }
193
-
194
  function get_current_url() {
195
  var apbctSfwRandomGet = '';
196
  if( +ctPublicFunctions.sfw__random_get ) {
@@ -246,9 +240,16 @@
246
  document.getElementById('js_info').style.display = 'none';
247
  document.getElementById('js_passed').style.display = 'block';
248
  document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
249
- set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_pass_key','{COOKIE_SFW}');
250
- set_spamFireWallCookie('{COOKIE_PREFIX}wordpress_apbct_antibot','{COOKIE_ANTICRAWLER}');
251
- set_spamFireWallCookie('{COOKIE_PREFIX}ct_sfw_passed','1');
 
 
 
 
 
 
 
252
 
253
  if(location.search.search('debug=1') === -1) {
254
  var apbctSfwRandomGet = '';
185
  <script>
186
  var ct_date = new Date;
187
 
 
 
 
 
 
 
188
  function get_current_url() {
189
  var apbctSfwRandomGet = '';
190
  if( +ctPublicFunctions.sfw__random_get ) {
240
  document.getElementById('js_info').style.display = 'none';
241
  document.getElementById('js_passed').style.display = 'block';
242
  document.getElementById('curr_date').innerHTML = ct_date.toGMTString();
243
+
244
+ var date = new Date;
245
+ date.setDate(date.getDate() + 30);
246
+ ctSetCookie(
247
+ [
248
+ ['{COOKIE_PREFIX}ct_sfw_pass_key', escape('{COOKIE_SFW}'), date.toUTCString()],
249
+ ['{COOKIE_PREFIX}wordpress_apbct_antibot', escape('{COOKIE_ANTICRAWLER}'), date.toUTCString()],
250
+ ['{COOKIE_PREFIX}ct_sfw_passed', '1', date.toUTCString()]
251
+ ]
252
+ );
253
 
254
  if(location.search.search('debug=1') === -1) {
255
  var apbctSfwRandomGet = '';
lib/Cleantalk/ApbctWP/RemoteCalls.php CHANGED
@@ -173,6 +173,16 @@ class RemoteCalls
173
  return ct_sfw_send_logs();
174
  }
175
 
 
 
 
 
 
 
 
 
 
 
176
  /**
177
  * Install plugin
178
  */
@@ -226,7 +236,7 @@ class RemoteCalls
226
  $out['errors'] = $apbct->errors;
227
  $out['debug'] = $apbct->debug;
228
  $out['queue'] = get_option('cleantalk_sfw_update_queue');
229
- $out['connection_reports'] = get_option('cleantalk_connection_reports');
230
  $out['servers_connection'] = apbct_test_connection();
231
 
232
  if ( APBCT_WPMS ) {
173
  return ct_sfw_send_logs();
174
  }
175
 
176
+ public static function action__private_record_add() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
177
+ {
178
+ return apbct_sfw_private_records_handler('add');
179
+ }
180
+
181
+ public static function action__private_record_delete() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
182
+ {
183
+ return apbct_sfw_private_records_handler('delete');
184
+ }
185
+
186
  /**
187
  * Install plugin
188
  */
236
  $out['errors'] = $apbct->errors;
237
  $out['debug'] = $apbct->debug;
238
  $out['queue'] = get_option('cleantalk_sfw_update_queue');
239
+ $out['connection_reports'] = $apbct->getConnectionReports()->remoteCallOutput();
240
  $out['servers_connection'] = apbct_test_connection();
241
 
242
  if ( APBCT_WPMS ) {
lib/Cleantalk/ApbctWP/RestController.php CHANGED
@@ -81,8 +81,8 @@ class RestController extends \WP_REST_Controller
81
  return wp_verify_nonce($request->get_header('x_wp_nonce'), 'wp_rest');
82
  },
83
  'args' => array(
84
- 'encodedEmail' => array(
85
- 'type' => 'string',
86
  'required' => true,
87
  ),
88
  ),
81
  return wp_verify_nonce($request->get_header('x_wp_nonce'), 'wp_rest');
82
  },
83
  'args' => array(
84
+ 'encodedEmails' => array(
85
+ 'type' => 'array',
86
  'required' => true,
87
  ),
88
  ),
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -72,7 +72,7 @@ class State extends \Cleantalk\Common\State
72
  'data__use_ajax' => 0,
73
  'data__use_static_js_key' => -1,
74
  'data__general_postdata_test' => 0, //CAPD
75
- 'data__set_cookies' => 3, // Cookies type: 0 - Off / 1 - Native cookies / 2 - Alt cookies / 3 - Auto
76
  'data__ssl_on' => 0, // Secure connection to servers
77
  'data__pixel' => '3',
78
  'data__email_check_before_post' => 1,
@@ -109,6 +109,13 @@ class State extends \Cleantalk\Common\State
109
  'wp__comment_notify__roles' => array('administrator'),
110
  'wp__dashboard_widget__show' => 1,
111
 
 
 
 
 
 
 
 
112
  );
113
 
114
  public $def_data = array(
@@ -132,6 +139,7 @@ class State extends \Cleantalk\Common\State
132
  // Account data
133
  'account_email' => '',
134
  'service_id' => 0,
 
135
  'moderate' => 0,
136
  'moderate_ip' => 0,
137
  'ip_license' => 0,
@@ -216,6 +224,7 @@ class State extends \Cleantalk\Common\State
216
  'valid' => 0,
217
  'user_token' => '',
218
  'service_id' => 0,
 
219
  'auto_update' => 0,
220
  );
221
 
@@ -227,9 +236,11 @@ class State extends \Cleantalk\Common\State
227
  'update_settings' => array('last_call' => 0, 'cooldown' => 0),
228
 
229
  // Firewall
230
- 'sfw_update' => array('last_call' => 0, 'cooldown' => 0),
231
- 'sfw_update__worker' => array('last_call' => 0, 'cooldown' => 0),
232
- 'sfw_send_logs' => array('last_call' => 0, 'cooldown' => 0),
 
 
233
 
234
  // Installation
235
  'install_plugin' => array('last_call' => 0, 'cooldown' => 0),
@@ -295,12 +306,10 @@ class State extends \Cleantalk\Common\State
295
  'update_mode' => 0,
296
  );
297
 
298
- private $default_connection_reports = array(
299
- 'success' => 0,
300
- 'negative' => 0,
301
- 'negative_report' => array(),
302
- 'since' => '',
303
- );
304
 
305
  public $errors;
306
 
@@ -347,6 +356,10 @@ class State extends \Cleantalk\Common\State
347
  // Table with session data.
348
  define('APBCT_TBL_NO_COOKIE', $db_prefix . 'cleantalk_no_cookie_data');
349
  }
 
 
 
 
350
  if ( ! defined('APBCT_SPAMSCAN_LOGS')) {
351
  // Table with session data.
352
  define('APBCT_SPAMSCAN_LOGS', $db_prefix . 'cleantalk_spamscan_logs');
@@ -418,11 +431,6 @@ class State extends \Cleantalk\Common\State
418
  $option = is_array($option) ? array_merge($this->default_fw_stats, $option) : $this->default_fw_stats;
419
  }
420
 
421
- // Default connection reports
422
- if ($this->option_prefix . '_' . $option_name === 'cleantalk_connection_reports') {
423
- $option = is_array($option) ? array_merge($this->default_connection_reports, $option) : $this->default_connection_reports;
424
- }
425
-
426
  $this->$option_name = is_array($option) ? new ArrayObject($option) : $option;
427
  }
428
  }
@@ -548,41 +556,6 @@ class State extends \Cleantalk\Common\State
548
  }
549
  }
550
 
551
- /**
552
- * Drop option to default value
553
- *
554
- * @param $option_name
555
- *
556
- * @return bool
557
- */
558
- public function drop($option_name)
559
- {
560
- $default_option_name = 'default_' . $option_name;
561
-
562
- if ( isset($this->$default_option_name) ) {
563
- $this->$option_name = new ArrayObject($this->$default_option_name);
564
-
565
- // Additional initialization for special cases
566
- switch ($option_name) {
567
- // Connection report
568
- case 'connection_reports':
569
- $this->connection_reports['since'] = date('d M');
570
- $this->save($option_name, true, false);
571
-
572
- return true;
573
- //break;
574
-
575
- // Special treat for other options here
576
- }
577
-
578
- // Save dropped option
579
- $this->save($option_name);
580
-
581
- return true;
582
- }
583
-
584
- return false;
585
- }
586
  /**
587
  * Prepares an adds an error to the plugin's data
588
  *
@@ -812,4 +785,25 @@ class State extends \Cleantalk\Common\State
812
  isset($headers['X-Varnish']) || //Set alt cookies if varnish is installed
813
  defined('SiteGround_Optimizer\VERSION'); //Set alt cookies if sg optimizer is installed
814
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
815
  }
72
  'data__use_ajax' => 0,
73
  'data__use_static_js_key' => -1,
74
  'data__general_postdata_test' => 0, //CAPD
75
+ 'data__set_cookies' => 0, // Cookies type: 0 - Off / 1 - Native cookies / 2 - Alt cookies / 3 - Auto
76
  'data__ssl_on' => 0, // Secure connection to servers
77
  'data__pixel' => '3',
78
  'data__email_check_before_post' => 1,
109
  'wp__comment_notify__roles' => array('administrator'),
110
  'wp__dashboard_widget__show' => 1,
111
 
112
+ // Trusted and affiliate settings
113
+ 'trusted_and_affiliate__shortcode' => 0,
114
+ 'trusted_and_affiliate__shortcode_tag' => '',
115
+ 'trusted_and_affiliate__footer' => 0,
116
+ 'trusted_and_affiliate__under_forms' => 0,
117
+ 'trusted_and_affiliate__add_id' => 0,
118
+
119
  );
120
 
121
  public $def_data = array(
139
  // Account data
140
  'account_email' => '',
141
  'service_id' => 0,
142
+ 'user_id' => 0,
143
  'moderate' => 0,
144
  'moderate_ip' => 0,
145
  'ip_license' => 0,
224
  'valid' => 0,
225
  'user_token' => '',
226
  'service_id' => 0,
227
+ 'user_id' => 0,
228
  'auto_update' => 0,
229
  );
230
 
236
  'update_settings' => array('last_call' => 0, 'cooldown' => 0),
237
 
238
  // Firewall
239
+ 'sfw_update' => array('last_call' => 0, 'cooldown' => 0),
240
+ 'sfw_update__worker' => array('last_call' => 0, 'cooldown' => 0),
241
+ 'sfw_send_logs' => array('last_call' => 0, 'cooldown' => 0),
242
+ 'private_record_add' => array('last_call' => 0, 'cooldown' => 0),
243
+ 'private_record_delete' => array('last_call' => 0, 'cooldown' => 0),
244
 
245
  // Installation
246
  'install_plugin' => array('last_call' => 0, 'cooldown' => 0),
306
  'update_mode' => 0,
307
  );
308
 
309
+ /**
310
+ * @var ConnectionReports
311
+ */
312
+ private $connection_reports;
 
 
313
 
314
  public $errors;
315
 
356
  // Table with session data.
357
  define('APBCT_TBL_NO_COOKIE', $db_prefix . 'cleantalk_no_cookie_data');
358
  }
359
+ if ( ! defined('APBCT_TBL_CONNECTION_REPORTS')) {
360
+ // Table with connection reports data.
361
+ define('APBCT_TBL_CONNECTION_REPORTS', $db_prefix . 'cleantalk_connection_reports');
362
+ }
363
  if ( ! defined('APBCT_SPAMSCAN_LOGS')) {
364
  // Table with session data.
365
  define('APBCT_SPAMSCAN_LOGS', $db_prefix . 'cleantalk_spamscan_logs');
431
  $option = is_array($option) ? array_merge($this->default_fw_stats, $option) : $this->default_fw_stats;
432
  }
433
 
 
 
 
 
 
434
  $this->$option_name = is_array($option) ? new ArrayObject($option) : $option;
435
  }
436
  }
556
  }
557
  }
558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  /**
560
  * Prepares an adds an error to the plugin's data
561
  *
785
  isset($headers['X-Varnish']) || //Set alt cookies if varnish is installed
786
  defined('SiteGround_Optimizer\VERSION'); //Set alt cookies if sg optimizer is installed
787
  }
788
+
789
+ /**
790
+ * Init ConnectionReports object to the connection_reports attribute
791
+ */
792
+ public function setConnectionReports()
793
+ {
794
+ $this->connection_reports = new ConnectionReports(DB::getInstance(), APBCT_TBL_CONNECTION_REPORTS);
795
+ }
796
+
797
+ /**
798
+ * Get connection reports object. Init one if the connection_reports attribute
799
+ * is empty or not an object of ConnectionReports
800
+ * @return ConnectionReports
801
+ */
802
+ public function getConnectionReports()
803
+ {
804
+ if ( empty($this->connection_reports) || !$this->connection_reports instanceof ConnectionReports ) {
805
+ $this->setConnectionReports();
806
+ }
807
+ return $this->connection_reports;
808
+ }
809
  }
lib/Cleantalk/ApbctWP/Variables/Cookie.php CHANGED
@@ -6,12 +6,13 @@ class Cookie extends \Cleantalk\Variables\Cookie
6
  {
7
  protected static $instance;
8
 
9
- public static $firewall_force_alternative_cookies = array(
10
  'ct_sfw_pass_key',
11
  'ct_sfw_passed',
12
  'wordpress_apbct_antibot',
13
  'apbct_anticrawler_passed',
14
- 'apbct_antiflood_passed'
 
15
  );
16
 
17
  /**
@@ -37,7 +38,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
37
  $value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
38
  //NoCookies
39
  } else if ( $apbct->data['cookies_type'] === 'none' ) {
40
- if ( in_array($name, static::$firewall_force_alternative_cookies, true) ) {
41
  $value = AltSessions::get($name);
42
  if ( empty($value) && isset($_COOKIE[$name]) ) {
43
  $value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
@@ -91,7 +92,7 @@ class Cookie extends \Cleantalk\Variables\Cookie
91
  if ( $apbct->data['key_is_ok'] ) {
92
  //select handling way to set cookie data in dependence of cookie type in the settings
93
  if ( $apbct->data['cookies_type'] === 'none' ) {
94
- if ( in_array($name, static::$firewall_force_alternative_cookies, true) ) {
95
  AltSessions::set($name, $value);
96
  } else {
97
  return NoCookie::set($name, $value, $no_cookie_to_db);
6
  {
7
  protected static $instance;
8
 
9
+ public static $force_to_use_alternative_cookies = array(
10
  'ct_sfw_pass_key',
11
  'ct_sfw_passed',
12
  'wordpress_apbct_antibot',
13
  'apbct_anticrawler_passed',
14
+ 'apbct_antiflood_passed',
15
+ 'apbct_email_encoder_passed'
16
  );
17
 
18
  /**
38
  $value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
39
  //NoCookies
40
  } else if ( $apbct->data['cookies_type'] === 'none' ) {
41
+ if ( in_array($name, static::$force_to_use_alternative_cookies, true) ) {
42
  $value = AltSessions::get($name);
43
  if ( empty($value) && isset($_COOKIE[$name]) ) {
44
  $value = $this->getAndSanitize(urldecode($_COOKIE[$name]));
92
  if ( $apbct->data['key_is_ok'] ) {
93
  //select handling way to set cookie data in dependence of cookie type in the settings
94
  if ( $apbct->data['cookies_type'] === 'none' ) {
95
+ if ( in_array($name, static::$force_to_use_alternative_cookies, true) ) {
96
  AltSessions::set($name, $value);
97
  } else {
98
  return NoCookie::set($name, $value, $no_cookie_to_db);
lib/Cleantalk/Common/Schema.php CHANGED
@@ -86,6 +86,18 @@ class Schema
86
  '__indexes' => 'PRIMARY KEY (`id`)',
87
  '__createkey' => 'INT unsigned primary KEY AUTO_INCREMENT FIRST'
88
  ),
 
 
 
 
 
 
 
 
 
 
 
 
89
  );
90
 
91
  /**
86
  '__indexes' => 'PRIMARY KEY (`id`)',
87
  '__createkey' => 'INT unsigned primary KEY AUTO_INCREMENT FIRST'
88
  ),
89
+ 'connection_reports' => array(
90
+ 'id' => 'INT NOT NULL AUTO_INCREMENT',
91
+ 'date' => 'INT NOT NULL', //timestamp
92
+ 'page_url' => 'VARCHAR(255) NULL DEFAULT NULL',
93
+ 'lib_report' => 'TEXT NULL DEFAULT NULL',
94
+ 'failed_work_urls' => 'VARCHAR(255) NULL DEFAULT NULL',
95
+ 'request_content' => 'TEXT NULL DEFAULT NULL',
96
+ 'sent_on' => 'INT NULL DEFAULT NULL', //timestamp
97
+ 'js_block' => 'VARCHAR(1) NULL DEFAULT NULL',
98
+ '__indexes' => 'PRIMARY KEY (`id`)',
99
+ '__createkey' => 'INT unsigned primary KEY AUTO_INCREMENT FIRST'
100
+ ),
101
  );
102
 
103
  /**
lib/Cleantalk/Common/State.php CHANGED
@@ -9,7 +9,6 @@ namespace Cleantalk\Common;
9
  * @property mixed network_data
10
  * @property mixed errors
11
  * @property mixed fw_stats
12
- * @property mixed connection_reports
13
  */
14
 
15
  abstract class State
9
  * @property mixed network_data
10
  * @property mixed errors
11
  * @property mixed fw_stats
 
12
  */
13
 
14
  abstract class State
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 4.7
5
  Tested up to: 6.1
6
  Requires PHP: 5.6
7
- Stable tag: 5.189.1
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -451,6 +451,22 @@ Yes, it is. Please read this article,
451
 
452
  == Changelog ==
453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  = 5.189.1 Nov 23 2022 =
455
  * Fix. Woocommerce. Marking orders as spam fixed.
456
  * Fix. Settings. Some text has been localized-ready.
4
  Requires at least: 4.7
5
  Tested up to: 6.1
6
  Requires PHP: 5.6
7
+ Stable tag: 6.0
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
451
 
452
  == Changelog ==
453
 
454
+ = 6.0 Dec 1 2022 =
455
+ #### No cookie mode by default🔥, EmailEncoder user-friendly enhancements 💣, trusted text and affiliate settings 🎈, prepare SpamFireWall for incremental updating, and some minor issues fixed 💪🏼
456
+ * New. Major version updated.
457
+ * New. Cookies. The plugin does not use browser cookies by default.
458
+ * New. Settings. Trusted text and affiliate links management added.
459
+ * New. SpamFireWall. Now can handle incremental update.
460
+ * New. WooCommerce integration. Spam\no spam feedback now sends to CleanTalk cloud.
461
+ * New. Settings. Some URLs became active links.
462
+ * Mod. Ninja forms integration. Improvements.
463
+ * Mod. Email encoder. Decode all the emails on the page if cloud allowed and remember the state for session.
464
+ * Mod. Connection reports. Totally refactored.
465
+ * Mod. SpamFireWall, Anti-Crawler, Anti-Flood die pages. Settings cookie data via single AJAX.
466
+ * Fix. Comments scanner. Comments counting fixed.
467
+ * Fix. MailChimp for WordPress integration. Fixed.
468
+ * Fix. MC4WP integration. Request catching without JS fixed.
469
+
470
  = 5.189.1 Nov 23 2022 =
471
  * Fix. Woocommerce. Marking orders as spam fixed.
472
  * Fix. Settings. Some text has been localized-ready.