Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.155

Version Description

Mar 31 2021 = * New: Debug. Check connection to API servers. * New: Integration. Avada Form Builder. * New: Integration. Forminator integration implemented. * New: Users checker. Non-checked users tab added. * New: SFW. Admin IP will be whitelisted automatically. * Mod: Replace "bad" users/comments to "non-checkable". * Mod: DisableComments. Disable all comments means disable all comments for any post type. * Udp: Setting templates. Product ID support implemented. * Udp: Settings. Reorder links actions buttons. * Upd: Common. Getting check_js updated. * Upd: SFW. Description updated. * Fix: Reversed URL exclusions. * Fix: Settings. Sync button success ico fixed. * Fix: Show response for all AJAX forms #3. * Fix: GDPR. Warning text output. * Fix: Integration class consider settings. * Fix: Exclusions. URL exclusions fixed. * Fix: Services Templates. Getting templates optimized. * Fix: Services Templates. Possible XSS fixed. * Fix: Services Templates. Design layout fixed. * Fix: Family of settings comments_disable_comments* dependencies. * Fix: DisableComments class. Media post type includes 'attachment' type. * Fix: Exclusion for Thrive Ultimatum. * Fix: Common/Helper::httpget_headers() ignores empty header name parts. * Fix: Exclusion for GiveWP plugin in apbct-public.js. * Fix: Do not consider 501 as correct HTTP response code when getting FW data files. * Fix: AntiCrawler::update(). Correct error codes. * Fix: ApbctWP\Firewall\SFW::update(). Correct URLs for FILE with protocol. * Fix: PHP 8 deprecated notices. * Fix: Settings. Reversed dependencies. Applies to WooCommerce and Disable Comments settings. * Fix: DisableComments::template_check() returns the correct number of comments for enabled types of posts. * Fix: DisableComments class. Visibility of some methods. * Exception: Paid Memberships Pro - Login Form. * Fix: Exception the SFW check for queries with '/favicon.ico' string.

Download this release

Release Info

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

Code changes from version 5.154 to 5.155

Files changed (46) hide show
  1. cleantalk.php +21 -12
  2. css/cleantalk-admin-settings-page.min.css +1 -1
  3. inc/cleantalk-admin.php +24 -1
  4. inc/cleantalk-common.php +82 -28
  5. inc/cleantalk-find-spam.php +4 -2
  6. inc/cleantalk-pluggable.php +18 -44
  7. inc/cleantalk-public.php +48 -21
  8. inc/cleantalk-settings.php +29 -12
  9. js/apbct-disable-comments.min.js.map +1 -1
  10. js/apbct-fingerprint.min.js +1 -1
  11. js/apbct-fingerprint.min.js.map +1 -1
  12. js/apbct-public--alt.min.js.map +1 -1
  13. js/apbct-public--gdpr.min.js.map +1 -1
  14. js/apbct-public.min.js +1 -1
  15. js/apbct-public.min.js.map +1 -1
  16. js/cleantalk-admin-settings-page.min.js +1 -1
  17. js/cleantalk-admin-settings-page.min.js.map +1 -1
  18. js/cleantalk-admin.min.js +2 -1
  19. js/cleantalk-admin.min.js.map +1 -1
  20. js/cleantalk-comments-editscreen.min.js.map +1 -1
  21. js/cleantalk-dashboard-widget.min.js +1 -1
  22. js/cleantalk-dashboard-widget.min.js.map +1 -1
  23. js/cleantalk-debug-ajax.min.js.map +1 -1
  24. js/cleantalk-public-admin.min.js +1 -1
  25. js/cleantalk-public-admin.min.js.map +1 -1
  26. js/cleantalk-users-editscreen.min.js.map +1 -1
  27. js/cleantalk_internal.min.js.map +1 -1
  28. js/cleantalk_nocache.min.js +2 -1
  29. js/cleantalk_nocache.min.js.map +1 -1
  30. lib/Cleantalk/Antispam/Cleantalk.php +1 -1
  31. lib/Cleantalk/Antispam/DisableComments.php +27 -25
  32. lib/Cleantalk/Antispam/Integrations.php +112 -102
  33. lib/Cleantalk/Antispam/Integrations/Forminator.php +26 -0
  34. lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php +82 -30
  35. lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php +3 -3
  36. lib/Cleantalk/ApbctWP/FindSpam/ListTable/BadUsers.php +106 -0
  37. lib/Cleantalk/ApbctWP/FindSpam/Page.php +134 -126
  38. lib/Cleantalk/ApbctWP/FindSpam/UsersChecker.php +14 -3
  39. lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php +6 -6
  40. lib/Cleantalk/ApbctWP/Firewall/SFW.php +8 -6
  41. lib/Cleantalk/ApbctWP/RestController.php +22 -0
  42. lib/Cleantalk/ApbctWP/State.php +1 -0
  43. lib/Cleantalk/Common/API.php +52 -25
  44. lib/Cleantalk/Common/Firewall.php +6 -0
  45. lib/Cleantalk/Common/Helper.php +14 -6
  46. readme.txt +40 -4
cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://cleantalk.org
5
  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.
6
- Version: 5.154
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
@@ -18,6 +18,7 @@ use Cleantalk\ApbctWP\DB;
18
  use Cleantalk\ApbctWP\Firewall\SFW;
19
  use Cleantalk\ApbctWP\Helper;
20
  use Cleantalk\ApbctWP\RemoteCalls;
 
21
  use Cleantalk\Common\Schema;
22
  use Cleantalk\Variables\Get;
23
 
@@ -108,6 +109,12 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
108
  // Passing JS key to frontend
109
  add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
110
  add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
 
 
 
 
 
 
111
 
112
  // Database prefix
113
  global $wpdb;
@@ -186,17 +193,18 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
186
  }
187
 
188
  $apbct_active_integrations = array(
189
- 'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ),
190
- 'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'ajax' => false ),
191
- 'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ),
192
- 'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false ),
193
- 'EstimationForm' => array( 'hook' => 'send_email', 'ajax' => true ),
194
- 'LandingPageBuilder' => array( 'hook' => 'ulpb_formBuilderEmail_ajax', 'ajax' => true ),
195
- 'WpMembers' => array( 'hook' => 'wpmem_pre_register_data', 'ajax' => false ),
196
- 'Rafflepress' => array( 'hook' => 'rafflepress_lite_giveaway_api', 'ajax' => true ),
197
- 'Wpdiscuz' => array( 'hook' => array( 'wpdAddComment', 'wpdAddInlineComment' ), 'ajax' => true ),
 
198
  );
199
- new \Cleantalk\Antispam\Integrations( $apbct_active_integrations );
200
 
201
  // Ninja Forms. Making GET action to POST action
202
  if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
@@ -257,7 +265,8 @@ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
257
  if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
258
  $apbct->settings['sfw__enabled'] == 1 &&
259
  apbct_is_get() &&
260
- ! apbct_wp_doing_cron()
 
261
  ){
262
  apbct_sfw__check();
263
  }
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: https://cleantalk.org
5
  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.
6
+ Version: 5.155
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: https://cleantalk.org
9
  Text Domain: cleantalk-spam-protect
18
  use Cleantalk\ApbctWP\Firewall\SFW;
19
  use Cleantalk\ApbctWP\Helper;
20
  use Cleantalk\ApbctWP\RemoteCalls;
21
+ use Cleantalk\ApbctWP\RestController;
22
  use Cleantalk\Common\Schema;
23
  use Cleantalk\Variables\Get;
24
 
109
  // Passing JS key to frontend
110
  add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
111
  add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
112
+
113
+ add_action( 'rest_api_init', 'prefix_register_my_rest_routes' );
114
+ function prefix_register_my_rest_routes() {
115
+ $controller = new RestController();
116
+ $controller->register_routes();
117
+ }
118
 
119
  // Database prefix
120
  global $wpdb;
193
  }
194
 
195
  $apbct_active_integrations = array(
196
+ 'ContactBank' => array( 'hook' => 'contact_bank_frontend_ajax_call', 'setting' => 'forms__contact_forms_test', 'ajax' => true ),
197
+ 'FluentForm' => array( 'hook' => 'fluentform_before_insert_submission', 'setting' => 'forms__contact_forms_test', 'ajax' => false ),
198
+ 'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'setting' => 'forms__contact_forms_test', 'ajax' => true ),
199
+ 'EstimationForm' => array( 'hook' => 'send_email', 'setting' => 'forms__contact_forms_test', 'ajax' => true ),
200
+ 'LandingPageBuilder' => array( 'hook' => 'ulpb_formBuilderEmail_ajax', 'setting' => 'forms__contact_forms_test', 'ajax' => true ),
201
+ 'Rafflepress' => array( 'hook' => 'rafflepress_lite_giveaway_api', 'setting' => 'forms__contact_forms_test', 'ajax' => true ),
202
+ 'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'setting' => 'forms__registrations_test', 'ajax' => false ),
203
+ 'WpMembers' => array( 'hook' => 'wpmem_pre_register_data', 'setting' => 'forms__registrations_test', 'ajax' => false ),
204
+ 'Wpdiscuz' => array( 'hook' => array( 'wpdAddComment', 'wpdAddInlineComment' ), 'setting' => 'forms__comments_test', 'ajax' => true ),
205
+ 'Forminator' => array( 'hook' => 'forminator_submit_form_custom-forms', 'setting' => 'forms__contact_forms_test', 'ajax' => true ),
206
  );
207
+ new \Cleantalk\Antispam\Integrations( $apbct_active_integrations, (array) $apbct->settings );
208
 
209
  // Ninja Forms. Making GET action to POST action
210
  if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
265
  if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
266
  $apbct->settings['sfw__enabled'] == 1 &&
267
  apbct_is_get() &&
268
+ ! apbct_wp_doing_cron() &&
269
+ ! \Cleantalk\Variables\Server::in_uri( '/favicon.ico' )
270
  ){
271
  apbct_sfw__check();
272
  }
css/cleantalk-admin-settings-page.min.css CHANGED
@@ -1 +1 @@
1
- .apbct_settings-field_content,.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{width:70%}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#cleantalk-modal-content,.ct_rate_block{text-align:center}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}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;color:rgba(120,200,230,1);margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}#cleantalk-modal-content>*{display:block;width:100%}
1
+ .apbct_settings-field_content,.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{width:70%}.apbct_settings-field_title--radio{display:inline-block;margin:0;width:210px;padding-right:10px;font-size:14px;vertical-align:top}.apbct_input_text{min-width:255px;width:400px}.apbct_settings-field--api_key{font-size:14pt}.apbct_settings-long_description---show:hover{color:#aaa;cursor:pointer}.apbct_setting_textarea{min-width:300px}.cleantalk_link{text-decoration:none;font-size:13px;line-height:26px;margin:0;padding:0 10px 1px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.cleantalk_link-auto{background:#ccc;border-color:#999;-webkit-box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(200,200,200,.5),0 1px 0 rgba(0,0,0,.15);color:#000;height:28px;-webkit-border-radius:2px;border-radius:2px}.cleantalk_link-auto:hover{color:#fff}.cleantalk_link-manual{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff;-webkit-border-radius:3px;border-radius:3px;text-align:center}.cleantalk_link-manual:hover{color:#000}.cleantalk_link[disabled=disabled]{background:#5d9db5;color:#000}.apbct_status_icon{vertical-align:text-bottom;margin:0 5px 0 8px}a.ct_support_link{color:#666;margin-right:.5em;font-size:10pt;font-weight:400}.ct-warning-test-failed{position:relative;padding:5px;margin:4px;border:3px solid rgba(240,50,50,1);border-radius:5px;background-color:rgba(255,200,200,1)}.ct_settings_banner{text-align:right;width:100%;margin:1em 0;vertical-align:top}#cleantalk-modal-content,.ct_rate_block{text-align:center}#ct_translate_plugin{margin-left:0}.ct_rate_block{width:370px;margin-right:3em;padding:.8em .8em 15px;border:1px dashed #666}#ct_translate_plugin .apbct_button_rate{margin-bottom:10px}.apbct_long_desc{position:absolute;background:#5a5a5a;min-width:80px;min-height:80px;max-width:500px;padding:10px;color:#fff;z-index:10}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;color:rgba(120,200,230,1);margin:25px}@keyframes spin{to{transform:rotate(359deg)}}.apbct_long_desc__cancel{position:absolute;top:5px;right:5px;color:rgba(255,255,255,.5)}.apbct_long_desc__cancel:hover{color:#fff}.apbct_long_desc__angle{position:absolute;top:5px;left:-17px;width:10px;height:10px;background:#5a5a5a;-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg);-webkit-transform-origin:100% 100%;-ms-transform-origin:100% 100%;transform-origin:100% 100%}.apbct_long_desc__title{color:rgba(120,200,230,1);margin:0}.--hide{display:none}.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none}#cleantalk-modal-content>*{display:block;width:100%}button.ct_support_link{border:none;background:0 0;color:#666;text-decoration:underline;cursor:pointer}
inc/cleantalk-admin.php CHANGED
@@ -712,4 +712,27 @@ function apbct_user__delete__hook($user_id, $reassign = null){
712
  if ($hash !== '') {
713
  ct_feedback($hash, 0);
714
  }
715
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
  if ($hash !== '') {
713
  ct_feedback($hash, 0);
714
  }
715
+ }
716
+
717
+ function apbct_test_connection(){
718
+
719
+ $url_to_test = array(
720
+ 'https://apix1.cleantalk.org',
721
+ 'https://apix2.cleantalk.org',
722
+ 'https://apix3.cleantalk.org',
723
+ 'https://apix4.cleantalk.org',
724
+ 'https://apix5.cleantalk.org',
725
+ );
726
+
727
+ foreach($url_to_test as $url){
728
+ $start = microtime(true);
729
+ $result = \Cleantalk\ApbctWP\Helper::http__request__get_content($url);
730
+ $exec_time = microtime(true) - $start;
731
+ $out[$url] = array(
732
+ 'result' => $result,
733
+ 'exec_time' => $exec_time,
734
+ 'error' => !empty($result['error']) ? $result['error'] : 'OK',
735
+ ) ;
736
+ }
737
+ return $out;
738
+ }
inc/cleantalk-common.php CHANGED
@@ -3,7 +3,10 @@
3
  use Cleantalk\Antispam\Cleantalk;
4
  use Cleantalk\Antispam\CleantalkRequest;
5
  use Cleantalk\Antispam\CleantalkResponse;
 
 
6
  use Cleantalk\Variables\Cookie;
 
7
 
8
  function apbct_array( $array ){
9
  return new \Cleantalk\Common\Arr( $array );
@@ -63,6 +66,8 @@ $ct_negative_comment = null;
63
  $ct_server = NULL;
64
  $admin_email = NULL;
65
 
 
 
66
  /**
67
  * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
68
  */
@@ -289,8 +294,8 @@ function apbct_exclusions_check($func = null){
289
  * @return bool
290
  */
291
  function apbct_exclusions_check__url__reversed(){
292
- return defined( 'APBCT_URL_EXCLUSIONS__REVERSED' ) &&
293
- ! \Cleantalk\Variables\Server::has_string( 'URI', APBCT_URL_EXCLUSIONS__REVERSED );
294
  }
295
 
296
  /**
@@ -312,10 +317,11 @@ function apbct_exclusions_check__url() {
312
  $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
313
  }
314
 
315
- // Fix for AJAX forms
316
- $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
317
- ? apbct_get_server_variable( 'HTTP_REFERER' )
318
- : \Cleantalk\Variables\Server::get('HTTP_HOST') . apbct_get_server_variable( 'REQUEST_URI' );
 
319
 
320
  foreach ( $exclusions as $exclusion ) {
321
  if (
@@ -835,27 +841,35 @@ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = ar
835
  if(count($arr)){
836
 
837
  foreach($arr as $key => $value){
838
-
839
- if(gettype($value) == 'string'){
840
-
841
- $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
842
- $decoded_json_value = json_decode($tmp, true);
843
-
844
- // Decoding JSON
845
- if($decoded_json_value !== null){
846
- $value = $decoded_json_value;
847
-
848
- // Ajax Contact Forms. Get data from such strings:
849
- // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
850
- // acfw30_textarea %% msg
851
- }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
852
- $value = explode('~', $value);
853
- foreach ($value as &$val){
854
- $tmp = explode(' %% ', $val);
855
- $val = array($tmp[0] => $tmp[1]);
856
- }
857
- }
858
- }
 
 
 
 
 
 
 
 
859
 
860
  if(!is_array($value) && !is_object($value)){
861
 
@@ -1080,4 +1094,44 @@ function apbct_add_async_attribute($tag, $handle, $src) {
1080
  }
1081
 
1082
  return $tag;
1083
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  use Cleantalk\Antispam\Cleantalk;
4
  use Cleantalk\Antispam\CleantalkRequest;
5
  use Cleantalk\Antispam\CleantalkResponse;
6
+ use Cleantalk\ApbctWP\API;
7
+ use Cleantalk\ApbctWP\Helper;
8
  use Cleantalk\Variables\Cookie;
9
+ use Cleantalk\Variables\Server;
10
 
11
  function apbct_array( $array ){
12
  return new \Cleantalk\Common\Arr( $array );
66
  $ct_server = NULL;
67
  $admin_email = NULL;
68
 
69
+ add_action( 'wp_login', 'apbct_wp_login', 10, 2 );
70
+
71
  /**
72
  * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
73
  */
294
  * @return bool
295
  */
296
  function apbct_exclusions_check__url__reversed(){
297
+ return defined( 'APBCT_URL_EXCLUSIONS__REVERSED' ) &&
298
+ ! Server::has_string( 'REQUEST_URI', APBCT_URL_EXCLUSIONS__REVERSED );
299
  }
300
 
301
  /**
317
  $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
318
  }
319
 
320
+ // Fix for AJAX and WP REST API forms
321
+ $haystack = ( apbct_get_server_variable( 'REQUEST_URI' ) === '/wp-admin/admin-ajax.php' || stripos( apbct_get_server_variable( 'REQUEST_URI' ), '/wp-json/' ) === 0 )
322
+ && apbct_get_server_variable( 'HTTP_REFERER' )
323
+ ? str_ireplace( array( 'http://', 'https://', Server::get('HTTP_HOST') ), '', apbct_get_server_variable( 'HTTP_REFERER' ) )
324
+ : apbct_get_server_variable( 'REQUEST_URI' );
325
 
326
  foreach ( $exclusions as $exclusion ) {
327
  if (
841
  if(count($arr)){
842
 
843
  foreach($arr as $key => $value){
844
+
845
+ if( is_string( $value ) ){
846
+
847
+ $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
848
+
849
+ $decoded_json_value = json_decode($tmp, true); // Try parse JSON from the string
850
+ parse_str( urldecode( $tmp ), $decoded_url_value ); // Try parse URL from the string
851
+
852
+ // If there is "JSON data" set is it as a value
853
+ if($decoded_json_value !== null){
854
+ $value = $decoded_json_value;
855
+
856
+ // If there is "URL data" set is it as a value
857
+ }elseif( ! ( count( $decoded_url_value ) === 1 && reset( $decoded_url_value ) === '' ) ){
858
+ $value = $decoded_url_value;
859
+
860
+ // Ajax Contact Forms. Get data from such strings:
861
+ // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
862
+ // acfw30_textarea %% msg
863
+ }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
864
+
865
+ $value = explode('~', $value);
866
+ foreach ($value as &$val){
867
+ $tmp = explode(' %% ', $val);
868
+ $val = array($tmp[0] => $tmp[1]);
869
+ }unset( $val );
870
+
871
+ }
872
+ }
873
 
874
  if(!is_array($value) && !is_object($value)){
875
 
1094
  }
1095
 
1096
  return $tag;
1097
+ }
1098
+
1099
+ function apbct_wp_login( $user_login, $user ) {
1100
+
1101
+ global $apbct;
1102
+
1103
+ // Break if the SpamFireWall is inactive
1104
+ if( $apbct->settings['sfw__enabled'] != 1 &&
1105
+ ! apbct_is_get() &&
1106
+ apbct_wp_doing_cron()
1107
+ ){
1108
+ return;
1109
+ }
1110
+
1111
+ $ip = Helper::ip__get( 'real', true );
1112
+
1113
+ if( Cookie::get( 'ct_sfw_ip_wl' ) && Cookie::get( 'ct_sfw_ip_wl' ) === md5( $ip . $apbct->api_key ) ) {
1114
+ return;
1115
+ }
1116
+
1117
+ if( in_array( 'administrator', (array) $user->roles ) ) {
1118
+ $res = apbct_private_list_add( $ip );
1119
+ if( $res ) {
1120
+ if( ! headers_sent() ) {
1121
+ $cookie_val = md5( $ip . $apbct->api_key );
1122
+ \Cleantalk\Common\Helper::apbct_cookie__set( 'ct_sfw_ip_wl', $cookie_val, time() + 86400 * 30, '/', null, false, true, 'Lax' );
1123
+ }
1124
+ ct_sfw_update();
1125
+ }
1126
+ }
1127
+
1128
+ }
1129
+
1130
+ function apbct_private_list_add( $ip ) {
1131
+ global $apbct;
1132
+ if( Helper::ip__validate( $ip ) !== false ) {
1133
+ $res = API::method__private_list_add__sfw_wl( $apbct->data['user_token'], $ip, $apbct->data['service_id'] );
1134
+ return isset( $res['records'][0]['operation_status'] ) && $res['records'][0]['operation_status'] === 'SUCCESS';
1135
+ }
1136
+ return false;
1137
+ }
inc/cleantalk-find-spam.php CHANGED
@@ -7,8 +7,9 @@ function ct_add_find_spam_pages(){
7
  // Check users pages
8
  $ct_check_users = add_users_page( __( "Check for spam", 'cleantalk-spam-protect'), __( "Find spam users", 'cleantalk-spam-protect'), 'activate_plugins', 'ct_check_users', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
9
  $ct_check_users_logs = add_users_page( __( "Scan logs", 'cleantalk-spam-protect'), '', 'activate_plugins', 'ct_check_users_logs', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
 
10
 
11
- // Cheack comments pages
12
  $ct_check_spam = add_comments_page( __( "Check for spam", 'cleantalk-spam-protect'), __( "Find spam comments", 'cleantalk-spam-protect'), 'activate_plugins', 'ct_check_spam', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
13
  $ct_check_spam_logs = add_comments_page( __( "Scan logs", 'cleantalk-spam-protect'), '', 'activate_plugins', 'ct_check_spam_logs', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
14
 
@@ -21,6 +22,7 @@ function ct_add_find_spam_pages(){
21
  add_action( "load-$ct_check_users_logs", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
22
  add_action( "load-$ct_check_spam", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
23
  add_action( "load-$ct_check_spam_logs", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
 
24
 
25
  }
26
 
@@ -46,7 +48,7 @@ function ct_save_screen_option() {
46
 
47
  // Saving screen option for the pagination (per page option)
48
  add_filter( 'set-screen-option', function( $status, $option, $value ){
49
- return ( $option == 'spam_per_page' ) ? (int) $value : $status;
50
  }, 10, 3 );
51
 
52
  }
7
  // Check users pages
8
  $ct_check_users = add_users_page( __( "Check for spam", 'cleantalk-spam-protect'), __( "Find spam users", 'cleantalk-spam-protect'), 'activate_plugins', 'ct_check_users', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
9
  $ct_check_users_logs = add_users_page( __( "Scan logs", 'cleantalk-spam-protect'), '', 'activate_plugins', 'ct_check_users_logs', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
10
+ $ct_bad_users = add_users_page( __( "Non-checkable users", 'cleantalk-spam-protect'), '', 'activate_plugins', 'ct_check_users_bad', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
11
 
12
+ // Check comments pages
13
  $ct_check_spam = add_comments_page( __( "Check for spam", 'cleantalk-spam-protect'), __( "Find spam comments", 'cleantalk-spam-protect'), 'activate_plugins', 'ct_check_spam', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
14
  $ct_check_spam_logs = add_comments_page( __( "Scan logs", 'cleantalk-spam-protect'), '', 'activate_plugins', 'ct_check_spam_logs', array( '\Cleantalk\ApbctWP\FindSpam\Page', 'showFindSpamPage' ) );
15
 
22
  add_action( "load-$ct_check_users_logs", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
23
  add_action( "load-$ct_check_spam", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
24
  add_action( "load-$ct_check_spam_logs", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
25
+ add_action( "load-$ct_bad_users", array( '\Cleantalk\ApbctWP\FindSpam\Page', 'setScreenOption' ) );
26
 
27
  }
28
 
48
 
49
  // Saving screen option for the pagination (per page option)
50
  add_filter( 'set-screen-option', function( $status, $option, $value ){
51
+ return ( $option === 'spam_per_page' ) ? (int) $value : $status;
52
  }, 10, 3 );
53
 
54
  }
inc/cleantalk-pluggable.php CHANGED
@@ -355,7 +355,24 @@ function apbct_is_skip_request( $ajax = false ) {
355
  /*****************************************/
356
  /* Here is ajax requests skipping */
357
  /*****************************************/
358
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  // wpDiscuz - Online Users Addon for wpDiscuz
360
  if(
361
  apbct_is_plugin_active( 'wpdiscuz-online-users/wpdiscuz-ou.php' ) &&
@@ -481,46 +498,3 @@ function apbct_is_skip_request( $ajax = false ) {
481
  return false;
482
  }
483
 
484
- function apbct_get_plugin_options() {
485
- global $apbct;
486
- $settings = (array) $apbct->settings;
487
- // Remove apikey from export
488
- if( isset( $settings['apikey'] ) ) {
489
- unset( $settings['apikey'] );
490
- }
491
- // Remove misc__debug_ajax from export
492
- if( isset( $settings['misc__debug_ajax'] ) ) {
493
- unset( $settings['misc__debug_ajax'] );
494
- }
495
- // Remove multisite__white_label__hoster_key from export
496
- if( isset( $settings['multisite__white_label__hoster_key'] ) ) {
497
- unset( $settings['multisite__white_label__hoster_key'] );
498
- }
499
- // Remove all WPMS from export
500
- $settings = array_filter( $settings, function( $key ){
501
- return strpos( $key, 'multisite__' ) === false;
502
- }, ARRAY_FILTER_USE_KEY );
503
- return json_encode( $settings, JSON_FORCE_OBJECT );
504
- }
505
-
506
- function apbct_set_plugin_options( $template_id, $template_name, $settings ) {
507
- global $apbct;
508
- $settings = array_replace( (array) $apbct->settings, $settings );
509
- $settings = apbct_settings__validate($settings);
510
- $apbct->settings = $settings;
511
- $apbct->data['current_settings_template_id'] = $template_id;
512
- $apbct->data['current_settings_template_name'] = $template_name;
513
- return $apbct->saveSettings() && $apbct->saveData();
514
- }
515
-
516
- function apbct_reset_plugin_options() {
517
- global $apbct;
518
- $def_settings = $apbct->def_settings;
519
- if( isset( $def_settings['apikey'] ) ) {
520
- unset( $def_settings['apikey'] );
521
- }
522
- $settings = array_replace( (array) $apbct->settings, $def_settings );
523
- $settings = apbct_settings__validate($settings);
524
- $apbct->settings = $settings;
525
- return $apbct->saveSettings();
526
- }
355
  /*****************************************/
356
  /* Here is ajax requests skipping */
357
  /*****************************************/
358
+
359
+ // Paid Memberships Pro - Login Form
360
+ if(
361
+ apbct_is_plugin_active( 'paid-memberships-pro/paid-memberships-pro.php' ) &&
362
+ Post::get( 'rm_slug' ) === 'rm_login_form' &&
363
+ Post::get( 'rm_form_sub_id' )
364
+ ){
365
+ return 'paid_memberships_pro__login_form';
366
+ }
367
+
368
+ // Thrive Ultimatum
369
+ if(
370
+ apbct_is_plugin_active( 'thrive-ultimatum/thrive-ultimatum.php' ) &&
371
+ Post::get( 'action' ) === 'tve_dash_front_ajax'
372
+ ){
373
+ return 'thrive-ultimatum__links_from_email';
374
+ }
375
+
376
  // wpDiscuz - Online Users Addon for wpDiscuz
377
  if(
378
  apbct_is_plugin_active( 'wpdiscuz-online-users/wpdiscuz-ou.php' ) &&
498
  return false;
499
  }
500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/cleantalk-public.php CHANGED
@@ -925,13 +925,39 @@ function apbct_hook__wp_head__set_cookie__ct_checkjs() {
925
  }
926
 
927
  /**
928
- * Adds cookie script filed to footer
929
  */
930
  function apbct_hook__wp_footer() {
931
 
932
- //ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
933
 
934
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935
  }
936
 
937
  /**
@@ -964,15 +990,7 @@ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false
964
 
965
  $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
966
  $field_id = $field_name . '_' . $field_id_hash;
967
- $html = "<input type=\"hidden\" id=\"{$field_id}\" name=\"{$field_name}\" value=\"{$ct_checkjs_def}\" />
968
- <script type=\"text/javascript\" " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
969
- window.addEventListener(\"DOMContentLoaded\", function () {
970
- apbct_public_sendAJAX(
971
- {action: \"apbct_js_keys__get\"},
972
- {callback: apbct_js_keys__set_input_value, input_name: \"{$field_id}\",silent: true, no_nonce: true}
973
- );
974
- });
975
- </script>";
976
 
977
  // Set KEY from backend
978
  }else{
@@ -1646,7 +1664,7 @@ function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
1646
  * @param int $comment_post_id
1647
  * @return string|bool
1648
  */
1649
- function ct_post_url($comment_id = null, $comment_post_id) {
1650
 
1651
  if (empty($comment_post_id))
1652
  return null;
@@ -1781,7 +1799,9 @@ function apbct_login__scripts(){
1781
 
1782
  wp_localize_script('ct_public', 'ctPublic', array(
1783
  '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
 
1784
  '_ajax_url' => admin_url('admin-ajax.php'),
 
1785
  ));
1786
 
1787
  $apbct->public_script_loaded = true;
@@ -1858,10 +1878,15 @@ function ct_registration_errors_wpmu($errors) {
1858
  }
1859
 
1860
  /**
1861
- * Shell for action register_post
1862
- * @return array with errors
 
 
 
 
 
1863
  */
1864
- function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1865
  return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1866
  }
1867
 
@@ -1934,7 +1959,7 @@ function ct_test_registration($nickname, $email, $ip = null){
1934
  * @param null $sanitized_user_login
1935
  * @param null $user_email
1936
  *
1937
- * @return void with errors
1938
  */
1939
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1940
 
@@ -2684,7 +2709,7 @@ function apbct_form__WPForms__addField($form_data, $some, $title, $description,
2684
  global $apbct;
2685
 
2686
  if($apbct->settings['forms__contact_forms_test'] == 1)
2687
- ct_add_hidden_fields('checkjs_wpforms', false);
2688
 
2689
  }
2690
 
@@ -2761,7 +2786,7 @@ function apbct_form__WPForms__testSpam() {
2761
  return;
2762
  }
2763
 
2764
- $checkjs = apbct_js_test('checkjs_wpforms', $_POST);
2765
 
2766
  $params = ct_get_fields_any($apbct->form_data);
2767
 
@@ -3771,10 +3796,12 @@ function ct_enqueue_scripts_public($hook){
3771
  // Differnt JS params
3772
  wp_enqueue_script( 'ct_public', APBCT_URL_PATH . '/js/apbct-public.min.js', array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
3773
  wp_enqueue_script('cleantalk-modal', plugins_url( '/cleantalk-spam-protect/js/cleantalk-modal.min.js' ), array(), APBCT_VERSION, false );
3774
-
3775
  wp_localize_script('ct_public', 'ctPublic', array(
3776
  '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
 
3777
  '_ajax_url' => admin_url('admin-ajax.php'),
 
3778
  ));
3779
  }
3780
 
@@ -3785,7 +3812,7 @@ function ct_enqueue_scripts_public($hook){
3785
 
3786
  wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
3787
  'gdpr_forms' => array(),
3788
- 'gdpr__text' => $apbct->settings['gdpr__text'] ? $apbct->settings['gdpr__text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk-spam-protect'),
3789
  ));
3790
  }
3791
 
925
  }
926
 
927
  /**
928
+ * Adds check_js script to the footer
929
  */
930
  function apbct_hook__wp_footer() {
931
 
932
+ global $apbct;
933
 
934
+ if( $apbct->settings['data__use_ajax'] ){
935
+
936
+ if( $apbct->use_rest_api ) {
937
+ $html = "<script type=\"text/javascript\" " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
938
+ if( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {
939
+ window.addEventListener('DOMContentLoaded', function () {
940
+ apbct_public_sendREST(
941
+ 'js_keys__get',
942
+ { callback: apbct_js_keys__set_input_value }
943
+ )
944
+ });
945
+ }
946
+ </script>";
947
+ } else {
948
+ $html = "<script type=\"text/javascript\" " . ( class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '' ) . ">
949
+ window.addEventListener('DOMContentLoaded', function () {
950
+ apbct_public_sendAJAX(
951
+ { action: 'apbct_js_keys__get' },
952
+ { callback: apbct_js_keys__set_input_value, no_nonce: true }
953
+ );
954
+ });
955
+ </script>";
956
+ }
957
+
958
+ echo $html;
959
+
960
+ }
961
  }
962
 
963
  /**
990
 
991
  $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
992
  $field_id = $field_name . '_' . $field_id_hash;
993
+ $html = "<input type=\"hidden\" id=\"{$field_id}\" name=\"{$field_name}\" value=\"{$ct_checkjs_def}\" />";
 
 
 
 
 
 
 
 
994
 
995
  // Set KEY from backend
996
  }else{
1664
  * @param int $comment_post_id
1665
  * @return string|bool
1666
  */
1667
+ function ct_post_url( $comment_id, $comment_post_id ){
1668
 
1669
  if (empty($comment_post_id))
1670
  return null;
1799
 
1800
  wp_localize_script('ct_public', 'ctPublic', array(
1801
  '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
1802
+ '_rest_nonce' => wp_create_nonce('wp_rest'),
1803
  '_ajax_url' => admin_url('admin-ajax.php'),
1804
+ '_rest_url' => esc_url( get_rest_url() ),
1805
  ));
1806
 
1807
  $apbct->public_script_loaded = true;
1878
  }
1879
 
1880
  /**
1881
+ * Shell for action register_post
1882
+ *
1883
+ * @param $sanitized_user_login
1884
+ * @param $user_email
1885
+ * @param $errors
1886
+ *
1887
+ * @return void|WP_Error
1888
  */
1889
+ function ct_register_post($sanitized_user_login, $user_email, $errors) {
1890
  return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1891
  }
1892
 
1959
  * @param null $sanitized_user_login
1960
  * @param null $user_email
1961
  *
1962
+ * @return void|WP_Error
1963
  */
1964
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1965
 
2709
  global $apbct;
2710
 
2711
  if($apbct->settings['forms__contact_forms_test'] == 1)
2712
+ ct_add_hidden_fields('ct_checkjs_wpforms', false);
2713
 
2714
  }
2715
 
2786
  return;
2787
  }
2788
 
2789
+ $checkjs = apbct_js_test('ct_checkjs_wpforms', $_POST);
2790
 
2791
  $params = ct_get_fields_any($apbct->form_data);
2792
 
3796
  // Differnt JS params
3797
  wp_enqueue_script( 'ct_public', APBCT_URL_PATH . '/js/apbct-public.min.js', array( 'jquery' ), APBCT_VERSION, false /*in header*/ );
3798
  wp_enqueue_script('cleantalk-modal', plugins_url( '/cleantalk-spam-protect/js/cleantalk-modal.min.js' ), array(), APBCT_VERSION, false );
3799
+
3800
  wp_localize_script('ct_public', 'ctPublic', array(
3801
  '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
3802
+ '_rest_nonce' => wp_create_nonce('wp_rest'),
3803
  '_ajax_url' => admin_url('admin-ajax.php'),
3804
+ '_rest_url' => esc_url( get_rest_url() ),
3805
  ));
3806
  }
3807
 
3812
 
3813
  wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
3814
  'gdpr_forms' => array(),
3815
+ 'gdpr_text' => $apbct->settings['gdpr__text'] ? $apbct->settings['gdpr__text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk-spam-protect'),
3816
  ));
3817
  }
3818
 
inc/cleantalk-settings.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  /**
4
  * Admin action 'admin_menu' - Add the admin options page
5
  */
@@ -101,7 +103,7 @@ function apbct_settings__set_fileds( $fields ){
101
  'sfw__enabled' => array(
102
  'type' => 'checkbox',
103
  'title' => __('SpamFireWall', 'cleantalk-spam-protect'),
104
- 'description' => __("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk-spam-protect'),
105
  'childrens' => array('sfw__anti_flood', 'sfw__anti_crawler', 'sfw__use_delete_to_clear_table'),
106
  ),
107
  'sfw__anti_crawler' => array(
@@ -182,14 +184,19 @@ function apbct_settings__set_fileds( $fields ){
182
  'forms__wc_checkout_test' => array(
183
  'title' => __('WooCommerce checkout form', 'cleantalk-spam-protect'),
184
  'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk-spam-protect'),
185
- 'childrens' => array('forms__wc_register_from_order')
 
 
 
 
 
186
  ),
187
  'forms__wc_register_from_order' => array(
188
  'title' => __('Spam test for registration during checkout', 'cleantalk-spam-protect'),
189
  'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk-spam-protect'),
190
  'parent' => 'forms__wc_checkout_test',
191
  'class' => 'apbct_settings-field_wrapper--sub',
192
- 'reverse_trigger' => true
193
  ),
194
  ),
195
  ),
@@ -214,19 +221,19 @@ function apbct_settings__set_fileds( $fields ){
214
  'comments__disable_comments__posts' => array(
215
  'title' => __( 'Disable comments for all posts', 'cleantalk-spam-protect'),
216
  'class' => 'apbct_settings-field_wrapper--sub',
217
- 'parent' => 'comments__disable_comments__all',
218
  'reverse_trigger' => true,
219
  ),
220
  'comments__disable_comments__pages' => array(
221
  'title' => __( 'Disable comments for all pages', 'cleantalk-spam-protect'),
222
  'class' => 'apbct_settings-field_wrapper--sub',
223
- 'parent' => 'comments__disable_comments__all',
224
  'reverse_trigger' => true,
225
  ),
226
  'comments__disable_comments__media' => array(
227
  'title' => __( 'Disable comments for all media', 'cleantalk-spam-protect'),
228
  'class' => 'apbct_settings-field_wrapper--sub',
229
- 'parent' => 'comments__disable_comments__all',
230
  'reverse_trigger' => true,
231
  ),
232
  'comments__bp_private_messages' => array(
@@ -859,7 +866,8 @@ function apbct_settings__field__debug(){
859
  echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
860
  echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
861
  echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
862
-
 
863
  echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
864
  echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
865
 
@@ -1198,7 +1206,7 @@ function apbct_settings__field__draw($params = array()){
1198
 
1199
  // Is element is disabled
1200
  $disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : ''; // Strait
1201
- $disabled = $params['parent'] && $params['reverse_trigger'] && !$value_parent ? ' disabled="disabled"' : $disabled; // Reverse logic
1202
  $disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled; // Direct disable from params
1203
  $disabled = ! is_main_site() && $apbct->network_settings && ! $apbct->network_settings['multisite__allow_custom_settings'] ? ' disabled="disabled"' : $disabled; // Disabled by super admin on sub-sites
1204
 
@@ -1460,6 +1468,12 @@ function apbct_settings__validate($settings) {
1460
  delete_option('cleantalk_debug');
1461
  return $settings;
1462
  }
 
 
 
 
 
 
1463
 
1464
  // Send connection reports
1465
  if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
@@ -1489,7 +1503,7 @@ function apbct_settings__validate($settings) {
1489
  );
1490
  $apbct->saveNetworkData();
1491
  if (isset($settings['multisite__use_settings_template_apply_for_current_list_sites']) && !empty($settings['multisite__use_settings_template_apply_for_current_list_sites'])) {
1492
- apbct_update_blogs_options($settings['multisite__use_settings_template_apply_for_current_list_sites'], $settings);
1493
  }
1494
  }
1495
  if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
@@ -1581,7 +1595,7 @@ function apbct_settings__sync( $direct_call = false ){
1581
  );
1582
  $apbct->saveNetworkData();
1583
  if (isset($settings['multisite__use_settings_template_apply_for_current_list_sites']) && !empty($settings['multisite__use_settings_template_apply_for_current_list_sites'])) {
1584
- apbct_update_blogs_options($settings['multisite__use_settings_template_apply_for_current_list_sites'], $settings);
1585
  }
1586
  }
1587
  if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
@@ -1707,9 +1721,12 @@ function apbct_settings__get_key_auto( $direct_call = false ) {
1707
  }
1708
  }
1709
 
1710
- function apbct_update_blogs_options ($blog_names = array(), $settings) {
 
1711
  global $wpdb;
1712
-
 
 
1713
  $wp_blogs = $wpdb->get_results('SELECT blog_id, site_id FROM '. $wpdb->blogs, OBJECT_K);
1714
 
1715
  foreach ($wp_blogs as $blog) {
1
  <?php
2
 
3
+ use Cleantalk\Variables\Post;
4
+
5
  /**
6
  * Admin action 'admin_menu' - Add the admin options page
7
  */
103
  'sfw__enabled' => array(
104
  'type' => 'checkbox',
105
  'title' => __('SpamFireWall', 'cleantalk-spam-protect'),
106
+ 'description' => __("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk-spam-protect') . '<br>' .esc_html__( 'If the setting is turned on, plugin will automatically add IP address for each session with administration rights to Personal list in the cloud.', 'cleantalk-spam-protect' ),
107
  'childrens' => array('sfw__anti_flood', 'sfw__anti_crawler', 'sfw__use_delete_to_clear_table'),
108
  ),
109
  'sfw__anti_crawler' => array(
184
  'forms__wc_checkout_test' => array(
185
  'title' => __('WooCommerce checkout form', 'cleantalk-spam-protect'),
186
  'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk-spam-protect'),
187
+ 'childrens' => array('forms__wc_register_from_order'),
188
+ 'reverse_trigger' => true,
189
+ 'options' => array(
190
+ array( 'val' => 1, 'label' => __( 'On' ), 'childrens_enable' => 0, ),
191
+ array( 'val' => 0, 'label' => __( 'Off' ), 'childrens_enable' => 1, ),
192
+ ),
193
  ),
194
  'forms__wc_register_from_order' => array(
195
  'title' => __('Spam test for registration during checkout', 'cleantalk-spam-protect'),
196
  'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk-spam-protect'),
197
  'parent' => 'forms__wc_checkout_test',
198
  'class' => 'apbct_settings-field_wrapper--sub',
199
+ 'reverse_trigger' => true,
200
  ),
201
  ),
202
  ),
221
  'comments__disable_comments__posts' => array(
222
  'title' => __( 'Disable comments for all posts', 'cleantalk-spam-protect'),
223
  'class' => 'apbct_settings-field_wrapper--sub',
224
+ // 'parent' => 'comments__disable_comments__all',
225
  'reverse_trigger' => true,
226
  ),
227
  'comments__disable_comments__pages' => array(
228
  'title' => __( 'Disable comments for all pages', 'cleantalk-spam-protect'),
229
  'class' => 'apbct_settings-field_wrapper--sub',
230
+ // 'parent' => 'comments__disable_comments__all',
231
  'reverse_trigger' => true,
232
  ),
233
  'comments__disable_comments__media' => array(
234
  'title' => __( 'Disable comments for all media', 'cleantalk-spam-protect'),
235
  'class' => 'apbct_settings-field_wrapper--sub',
236
+ // 'parent' => 'comments__disable_comments__all',
237
  'reverse_trigger' => true,
238
  ),
239
  'comments__bp_private_messages' => array(
866
  echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
867
  echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
868
  echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
869
+
870
+ echo '<h4><button type="submit" name="apbct_debug__check_connection" value="1">Check connection to API servers</button></h4>';
871
  echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
872
  echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
873
 
1206
 
1207
  // Is element is disabled
1208
  $disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : ''; // Strait
1209
+ $disabled = $params['parent'] && $params['reverse_trigger'] && !$value_parent ? '' : $disabled; // Reverse logic
1210
  $disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled; // Direct disable from params
1211
  $disabled = ! is_main_site() && $apbct->network_settings && ! $apbct->network_settings['multisite__allow_custom_settings'] ? ' disabled="disabled"' : $disabled; // Disabled by super admin on sub-sites
1212
 
1468
  delete_option('cleantalk_debug');
1469
  return $settings;
1470
  }
1471
+
1472
+ // Drop debug data
1473
+ if( Post::get('apbct_debug__check_connection') ){
1474
+ $result = apbct_test_connection();
1475
+ apbct_log($result);
1476
+ }
1477
 
1478
  // Send connection reports
1479
  if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
1503
  );
1504
  $apbct->saveNetworkData();
1505
  if (isset($settings['multisite__use_settings_template_apply_for_current_list_sites']) && !empty($settings['multisite__use_settings_template_apply_for_current_list_sites'])) {
1506
+ apbct_update_blogs_options( $settings );
1507
  }
1508
  }
1509
  if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
1595
  );
1596
  $apbct->saveNetworkData();
1597
  if (isset($settings['multisite__use_settings_template_apply_for_current_list_sites']) && !empty($settings['multisite__use_settings_template_apply_for_current_list_sites'])) {
1598
+ apbct_update_blogs_options( $settings );
1599
  }
1600
  }
1601
  if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
1721
  }
1722
  }
1723
 
1724
+ function apbct_update_blogs_options( $settings ){
1725
+
1726
  global $wpdb;
1727
+
1728
+ $blog_names = $settings['multisite__use_settings_template_apply_for_current_list_sites'] ?: array();
1729
+
1730
  $wp_blogs = $wpdb->get_results('SELECT blog_id, site_id FROM '. $wpdb->blogs, OBJECT_K);
1731
 
1732
  foreach ($wp_blogs as $blog) {
js/apbct-disable-comments.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["apbct-disable-comments.js"],"names":["wp","domReady","blocks","getBlockTypes","forEach","block","apbctDisableComments","disabled_blocks","includes","name","unregisterBlockType"],"mappings":"AAAA,aACAA,GAAGC,SAAS,WACPD,GAAGE,QACNF,GAAGE,OAAOC,gBAAgBC,QAAQ,SAAUC,GACvCC,qBAAqBC,gBAAgBC,SAASH,EAAMI,OACvDT,GAAGE,OAAOQ,oBAAoBL,EAAMI","file":"apbct-disable-comments.min.js","sourcesContent":["\"use strict\";\r\nwp.domReady(function () {\r\n\tif (wp.blocks) {\r\n\t\twp.blocks.getBlockTypes().forEach(function (block) {\r\n\t\t\tif (apbctDisableComments.disabled_blocks.includes(block.name)) {\r\n\t\t\t\twp.blocks.unregisterBlockType(block.name);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n});\r\n"]}
1
+ {"version":3,"file":"apbct-disable-comments.min.js","sources":["apbct-disable-comments.js"],"sourcesContent":["\"use strict\";\nwp.domReady(function () {\n\tif (wp.blocks) {\n\t\twp.blocks.getBlockTypes().forEach(function (block) {\n\t\t\tif (apbctDisableComments.disabled_blocks.includes(block.name)) {\n\t\t\t\twp.blocks.unregisterBlockType(block.name);\n\t\t\t}\n\t\t});\n\t}\n});\n"],"names":["wp","domReady","blocks","getBlockTypes","forEach","block","apbctDisableComments","disabled_blocks","includes","name","unregisterBlockType"],"mappings":"aACAA,GAAGC,SAAS,WACPD,GAAGE,QACNF,GAAGE,OAAOC,gBAAgBC,QAAQ,SAAUC,GACvCC,qBAAqBC,gBAAgBC,SAASH,EAAMI,OACvDT,GAAGE,OAAOQ,oBAAoBL,EAAMI"}
js/apbct-fingerprint.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e,n){"undefined"!=typeof module&&module.exports?module.exports=n():"function"==typeof define&&define.amd?define(n):e.Fingerprint=n()}(0,this,function(){"use strict";function t(t){var o,e;o=Array.prototype.forEach,e=Array.prototype.map,this.each=function(t,e,n){if(null!==t)if(o&&t.forEach===o)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(e.call(n,t[r],r,t)==={})return}else for(var a in t)if(t.hasOwnProperty(a)&&e.call(n,t[a],a,t)==={})return},this.map=function(t,r,i){var a=[];return null==t?a:e&&t.map===e?t.map(r,i):(this.each(t,function(t,e,n){a[a.length]=r.call(i,t,e,n)}),a)},"object"==typeof t?(this.hasher=t.hasher,this.screen_resolution=t.screen_resolution,this.screen_orientation=t.screen_orientation,this.canvas=t.canvas,this.ie_activex=t.ie_activex):"function"==typeof t&&(this.hasher=t)}return t.prototype={get:function(){var t=[];if(t.push(navigator.userAgent),t.push(navigator.language),t.push(screen.colorDepth),this.screen_resolution){var e=this.getScreenResolution();void 0!==e&&t.push(e.join("x"))}return t.push((new Date).getTimezoneOffset()),t.push(this.hasSessionStorage()),t.push(this.hasLocalStorage()),t.push(this.hasIndexDb()),document.body?t.push(typeof document.body.addBehavior):t.push("undefined"),t.push(typeof window.openDatabase),t.push(navigator.cpuClass),t.push(navigator.platform),t.push(navigator.doNotTrack),t.push(this.getPluginsString()),this.canvas&&this.isCanvasSupported()&&t.push(this.getCanvasFingerprint()),this.hasher?this.hasher(t.join("###"),31):this.murmurhash3_32_gc(t.join("###"),31)},murmurhash3_32_gc:function(t,e){var n,r,i,a,o,s,h,c;for(n=3&t.length,r=t.length-n,i=e,o=3432918353,s=461845907,c=0;c<r;)h=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,i=27492+(65535&(a=5*(65535&(i=(i^=h=(65535&(h=(h=(65535&h)*o+(((h>>>16)*o&65535)<<16)&4294967295)<<15|h>>>17))*s+(((h>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(h=0,n){case 3:h^=(255&t.charCodeAt(c+2))<<16;case 2:h^=(255&t.charCodeAt(c+1))<<8;case 1:i^=h=(65535&(h=(h=(65535&(h^=255&t.charCodeAt(c)))*o+(((h>>>16)*o&65535)<<16)&4294967295)<<15|h>>>17))*s+(((h>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0},hasLocalStorage:function(){try{return!!window.localStorage}catch(t){return!0}},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},hasIndexDb:function(){try{return!!window.indexedDB}catch(t){return!0}},isCanvasSupported:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},getPluginsString:function(){return this.isIE()&&this.ie_activex?this.getIEPluginsString():this.getRegularPluginsString()},getRegularPluginsString:function(){return this.map(navigator.plugins,function(t){var e=this.map(t,function(t){return[t.type,t.suffixes].join("~")}).join(",");return[t.name,t.description,e].join("::")},this).join(";")},getIEPluginsString:function(){if(window.ActiveXObject){return this.map(["ShockwaveFlash.ShockwaveFlash","AcroPDF.PDF","PDF.PdfCtrl","QuickTime.QuickTime","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","RealPlayer","SWCtl.SWCtl","WMPlayer.OCX","AgControl.AgControl","Skype.Detection"],function(t){try{return new ActiveXObject(t),t}catch(t){return null}}).join(";")}return""},getScreenResolution:function(){return this.screen_orientation?screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height]:[screen.height,screen.width]},getCanvasFingerprint:function(){var t=document.createElement("canvas"),e=t.getContext("2d"),n="http://valve.github.io";return e.textBaseline="top",e.font="14px 'Arial'",e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText(n,4,17),t.toDataURL()}},t});
2
  //# sourceMappingURL=apbct-fingerprint.min.js.map
1
+ !function(t,e){"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Fingerprint=e()}(this,function(){"use strict";function t(t){var o=Array.prototype.forEach,e=Array.prototype.map;this.each=function(t,e,n){if(null!==t)if(o&&t.forEach===o)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(e.call(n,t[r],r,t)==={})return}else for(var a in t)if(t.hasOwnProperty(a)&&e.call(n,t[a],a,t)==={})return},this.map=function(t,r,i){var a=[];return null==t?a:e&&t.map===e?t.map(r,i):(this.each(t,function(t,e,n){a[a.length]=r.call(i,t,e,n)}),a)},"object"==typeof t?(this.hasher=t.hasher,this.screen_resolution=t.screen_resolution,this.screen_orientation=t.screen_orientation,this.canvas=t.canvas,this.ie_activex=t.ie_activex):"function"==typeof t&&(this.hasher=t)}return t.prototype={get:function(){var t,e=[];return e.push(navigator.userAgent),e.push(navigator.language),e.push(screen.colorDepth),!this.screen_resolution||void 0!==(t=this.getScreenResolution())&&e.push(t.join("x")),e.push((new Date).getTimezoneOffset()),e.push(this.hasSessionStorage()),e.push(this.hasLocalStorage()),e.push(this.hasIndexDb()),document.body?e.push(typeof document.body.addBehavior):e.push("undefined"),e.push(typeof window.openDatabase),e.push(navigator.cpuClass),e.push(navigator.platform),e.push(navigator.doNotTrack),e.push(this.getPluginsString()),this.canvas&&this.isCanvasSupported()&&e.push(this.getCanvasFingerprint()),this.hasher?this.hasher(e.join("###"),31):this.murmurhash3_32_gc(e.join("###"),31)},murmurhash3_32_gc:function(t,e){for(var n,r,i=3&t.length,a=t.length-i,o=e,s=3432918353,h=461845907,c=0;c<a;)r=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,o=27492+(65535&(n=5*(65535&(o=(o^=r=(65535&(r=(r=(65535&r)*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*h+(((r>>>16)*h&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(r=0,i){case 3:r^=(255&t.charCodeAt(c+2))<<16;case 2:r^=(255&t.charCodeAt(c+1))<<8;case 1:o^=r=(65535&(r=(r=(65535&(r^=255&t.charCodeAt(c)))*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*h+(((r>>>16)*h&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0},hasLocalStorage:function(){try{return!!window.localStorage}catch(t){return!0}},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},hasIndexDb:function(){try{return!!window.indexedDB}catch(t){return!0}},isCanvasSupported:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},getPluginsString:function(){return this.isIE()&&this.ie_activex?this.getIEPluginsString():this.getRegularPluginsString()},getRegularPluginsString:function(){return this.map(navigator.plugins,function(t){var e=this.map(t,function(t){return[t.type,t.suffixes].join("~")}).join(",");return[t.name,t.description,e].join("::")},this).join(";")},getIEPluginsString:function(){if(window.ActiveXObject){return this.map(["ShockwaveFlash.ShockwaveFlash","AcroPDF.PDF","PDF.PdfCtrl","QuickTime.QuickTime","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","RealPlayer","SWCtl.SWCtl","WMPlayer.OCX","AgControl.AgControl","Skype.Detection"],function(t){try{return new ActiveXObject(t),t}catch(t){return null}}).join(";")}return""},getScreenResolution:function(){var t=!this.screen_orientation||screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height];return t},getCanvasFingerprint:function(){var t=document.createElement("canvas"),e=t.getContext("2d"),n="http://valve.github.io";return e.textBaseline="top",e.font="14px 'Arial'",e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText(n,4,17),t.toDataURL()}},t});
2
  //# sourceMappingURL=apbct-fingerprint.min.js.map
js/apbct-fingerprint.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["apbct-fingerprint.js"],"names":["name","context","definition","module","exports","define","amd","this","Fingerprint","options","nativeForEach","nativeMap","Array","prototype","forEach","map","each","obj","iterator","length","i","l","call","key","hasOwnProperty","results","value","index","list","hasher","screen_resolution","screen_orientation","canvas","ie_activex","get","keys","push","navigator","userAgent","language","screen","colorDepth","resolution","getScreenResolution","join","Date","getTimezoneOffset","hasSessionStorage","hasLocalStorage","hasIndexDb","document","body","window","cpuClass","platform","doNotTrack","getPluginsString","isCanvasSupported","getCanvasFingerprint","murmurhash3_32_gc","seed","remainder","bytes","h1","h1b","c1","c2","k1","charCodeAt","localStorage","e","sessionStorage","indexedDB","elem","createElement","getContext","isIE","appName","test","getIEPluginsString","getRegularPluginsString","plugins","p","mimeTypes","mt","type","suffixes","description","ActiveXObject","height","width","ctx","txt","textBaseline","font","fillStyle","fillRect","fillText","toDataURL"],"mappings":"CAkBC,SAAWA,EAAMC,EAASC,GACH,oBAAXC,QAA0BA,OAAOC,QAAWD,OAAOC,QAAUF,IAC7C,mBAAXG,QAAyBA,OAAOC,IAAOD,OAAOH,GACvDD,EAAY,YAAIC,IAHxB,CAIE,EAAeK,KAAM,WACtB,aAEkB,SAAdC,EAAwBC,GAC1B,IAAIC,EAAeC,EACnBD,EAAgBE,MAAMC,UAAUC,QAChCH,EAAYC,MAAMC,UAAUE,IAE5BR,KAAKS,KAAO,SAAUC,EAAKC,EAAUjB,GACnC,GAAY,OAARgB,EAGJ,GAAIP,GAAiBO,EAAIH,UAAYJ,EACnCO,EAAIH,QAAQI,EAAUjB,QACjB,GAAIgB,EAAIE,UAAYF,EAAIE,QAC7B,IAAK,IAAIC,EAAI,EAAGC,EAAIJ,EAAIE,OAAQC,EAAIC,EAAGD,IACrC,GAAIF,EAASI,KAAKrB,EAASgB,EAAIG,GAAIA,EAAGH,KAAS,GAAI,YAGrD,IAAK,IAAIM,KAAON,EACd,GAAIA,EAAIO,eAAeD,IACjBL,EAASI,KAAKrB,EAASgB,EAAIM,GAAMA,EAAKN,KAAS,GAAI,QAM/DV,KAAKQ,IAAM,SAASE,EAAKC,EAAUjB,GACjC,IAAIwB,EAAU,GAGd,OAAW,MAAPR,EAAoBQ,EACpBd,GAAaM,EAAIF,MAAQJ,EAAkBM,EAAIF,IAAIG,EAAUjB,IACjEM,KAAKS,KAAKC,EAAK,SAASS,EAAOC,EAAOC,GACpCH,EAAQA,EAAQN,QAAUD,EAASI,KAAKrB,EAASyB,EAAOC,EAAOC,KAE1DH,IAGa,iBAAXhB,GACTF,KAAKsB,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,OAChBJ,EAAIM,SAASL,EAAK,EAAG,IACrBD,EAAII,UAAY,yBAChBJ,EAAIM,SAASL,EAAK,EAAG,IACd5D,EAAOkE,cAKX1F","file":"apbct-fingerprint.min.js","sourcesContent":["/*\r\n* fingerprintJS 0.5.5 - Fast browser fingerprint library\r\n* https://github.com/Valve/fingerprintjs\r\n* Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com)\r\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\r\n*\r\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\r\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n*/\r\n\r\n;(function (name, context, definition) {\r\n if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }\r\n else if (typeof define === 'function' && define.amd) { define(definition); }\r\n else { context[name] = definition(); }\r\n})('Fingerprint', this, function () {\r\n 'use strict';\r\n\r\n var Fingerprint = function (options) {\r\n var nativeForEach, nativeMap;\r\n nativeForEach = Array.prototype.forEach;\r\n nativeMap = Array.prototype.map;\r\n\r\n this.each = function (obj, iterator, context) {\r\n if (obj === null) {\r\n return;\r\n }\r\n if (nativeForEach && obj.forEach === nativeForEach) {\r\n obj.forEach(iterator, context);\r\n } else if (obj.length === +obj.length) {\r\n for (var i = 0, l = obj.length; i < l; i++) {\r\n if (iterator.call(context, obj[i], i, obj) === {}) return;\r\n }\r\n } else {\r\n for (var key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n if (iterator.call(context, obj[key], key, obj) === {}) return;\r\n }\r\n }\r\n }\r\n };\r\n\r\n this.map = function(obj, iterator, context) {\r\n var results = [];\r\n // Not using strict equality so that this acts as a\r\n // shortcut to checking for `null` and `undefined`.\r\n if (obj == null) return results;\r\n if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\r\n this.each(obj, function(value, index, list) {\r\n results[results.length] = iterator.call(context, value, index, list);\r\n });\r\n return results;\r\n };\r\n\r\n if (typeof options == 'object'){\r\n this.hasher = options.hasher;\r\n this.screen_resolution = options.screen_resolution;\r\n this.screen_orientation = options.screen_orientation;\r\n this.canvas = options.canvas;\r\n this.ie_activex = options.ie_activex;\r\n } else if(typeof options == 'function'){\r\n this.hasher = options;\r\n }\r\n };\r\n\r\n Fingerprint.prototype = {\r\n get: function(){\r\n var keys = [];\r\n keys.push(navigator.userAgent);\r\n keys.push(navigator.language);\r\n keys.push(screen.colorDepth);\r\n if (this.screen_resolution) {\r\n var resolution = this.getScreenResolution();\r\n if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs\r\n keys.push(resolution.join('x'));\r\n }\r\n }\r\n keys.push(new Date().getTimezoneOffset());\r\n keys.push(this.hasSessionStorage());\r\n keys.push(this.hasLocalStorage());\r\n keys.push(this.hasIndexDb());\r\n //body might not be defined at this point or removed programmatically\r\n if(document.body){\r\n keys.push(typeof(document.body.addBehavior));\r\n } else {\r\n keys.push(typeof undefined);\r\n }\r\n keys.push(typeof(window.openDatabase));\r\n keys.push(navigator.cpuClass);\r\n keys.push(navigator.platform);\r\n keys.push(navigator.doNotTrack);\r\n keys.push(this.getPluginsString());\r\n if(this.canvas && this.isCanvasSupported()){\r\n keys.push(this.getCanvasFingerprint());\r\n }\r\n if(this.hasher){\r\n return this.hasher(keys.join('###'), 31);\r\n } else {\r\n return this.murmurhash3_32_gc(keys.join('###'), 31);\r\n }\r\n },\r\n\r\n /**\r\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\r\n *\r\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\r\n * @see http://github.com/garycourt/murmurhash-js\r\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\r\n * @see http://sites.google.com/site/murmurhash/\r\n *\r\n * @param {string} key ASCII only\r\n * @param {number} seed Positive integer only\r\n * @return {number} 32-bit positive integer hash\r\n */\r\n\r\n murmurhash3_32_gc: function(key, seed) {\r\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\r\n\r\n remainder = key.length & 3; // key.length % 4\r\n bytes = key.length - remainder;\r\n h1 = seed;\r\n c1 = 0xcc9e2d51;\r\n c2 = 0x1b873593;\r\n i = 0;\r\n\r\n while (i < bytes) {\r\n k1 =\r\n ((key.charCodeAt(i) & 0xff)) |\r\n ((key.charCodeAt(++i) & 0xff) << 8) |\r\n ((key.charCodeAt(++i) & 0xff) << 16) |\r\n ((key.charCodeAt(++i) & 0xff) << 24);\r\n ++i;\r\n\r\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\r\n k1 = (k1 << 15) | (k1 >>> 17);\r\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\r\n\r\n h1 ^= k1;\r\n h1 = (h1 << 13) | (h1 >>> 19);\r\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\r\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\r\n }\r\n\r\n k1 = 0;\r\n\r\n switch (remainder) {\r\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\r\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\r\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\r\n\r\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\r\n k1 = (k1 << 15) | (k1 >>> 17);\r\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\r\n h1 ^= k1;\r\n }\r\n\r\n h1 ^= key.length;\r\n\r\n h1 ^= h1 >>> 16;\r\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\r\n h1 ^= h1 >>> 13;\r\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\r\n h1 ^= h1 >>> 16;\r\n\r\n return h1 >>> 0;\r\n },\r\n\r\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\r\n hasLocalStorage: function () {\r\n try{\r\n return !!window.localStorage;\r\n } catch(e) {\r\n return true; // SecurityError when referencing it means it exists\r\n }\r\n },\r\n\r\n hasSessionStorage: function () {\r\n try{\r\n return !!window.sessionStorage;\r\n } catch(e) {\r\n return true; // SecurityError when referencing it means it exists\r\n }\r\n },\r\n\r\n hasIndexDb: function () {\r\n try{\r\n return !!window.indexedDB;\r\n } catch(e) {\r\n return true; // SecurityError when referencing it means it exists\r\n }\r\n },\r\n\r\n isCanvasSupported: function () {\r\n var elem = document.createElement('canvas');\r\n return !!(elem.getContext && elem.getContext('2d'));\r\n },\r\n\r\n isIE: function () {\r\n if(navigator.appName === 'Microsoft Internet Explorer') {\r\n return true;\r\n } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11\r\n return true;\r\n }\r\n return false;\r\n },\r\n\r\n getPluginsString: function () {\r\n if(this.isIE() && this.ie_activex){\r\n return this.getIEPluginsString();\r\n } else {\r\n return this.getRegularPluginsString();\r\n }\r\n },\r\n\r\n getRegularPluginsString: function () {\r\n return this.map(navigator.plugins, function (p) {\r\n var mimeTypes = this.map(p, function(mt){\r\n return [mt.type, mt.suffixes].join('~');\r\n }).join(',');\r\n return [p.name, p.description, mimeTypes].join('::');\r\n }, this).join(';');\r\n },\r\n\r\n getIEPluginsString: function () {\r\n if(window.ActiveXObject){\r\n var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin\r\n 'AcroPDF.PDF', // Adobe PDF reader 7+\r\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\r\n 'QuickTime.QuickTime', // QuickTime\r\n // 5 versions of real players\r\n 'rmocx.RealPlayer G2 Control',\r\n 'rmocx.RealPlayer G2 Control.1',\r\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\r\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\r\n 'RealPlayer',\r\n 'SWCtl.SWCtl', // ShockWave player\r\n 'WMPlayer.OCX', // Windows media player\r\n 'AgControl.AgControl', // Silverlight\r\n 'Skype.Detection'];\r\n\r\n // starting to detect plugins in IE\r\n return this.map(names, function(name){\r\n try{\r\n new ActiveXObject(name);\r\n return name;\r\n } catch(e){\r\n return null;\r\n }\r\n }).join(';');\r\n } else {\r\n return \"\"; // behavior prior version 0.5.0, not breaking backwards compat.\r\n }\r\n },\r\n\r\n getScreenResolution: function () {\r\n var resolution;\r\n if(this.screen_orientation){\r\n resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height];\r\n }else{\r\n resolution = [screen.height, screen.width];\r\n }\r\n return resolution;\r\n },\r\n\r\n getCanvasFingerprint: function () {\r\n var canvas = document.createElement('canvas');\r\n var ctx = canvas.getContext('2d');\r\n // https://www.browserleaks.com/canvas#how-does-it-work\r\n var txt = 'http://valve.github.io';\r\n ctx.textBaseline = \"top\";\r\n ctx.font = \"14px 'Arial'\";\r\n ctx.textBaseline = \"alphabetic\";\r\n ctx.fillStyle = \"#f60\";\r\n ctx.fillRect(125,1,62,20);\r\n ctx.fillStyle = \"#069\";\r\n ctx.fillText(txt, 2, 15);\r\n ctx.fillStyle = \"rgba(102, 204, 0, 0.7)\";\r\n ctx.fillText(txt, 4, 17);\r\n return canvas.toDataURL();\r\n }\r\n };\r\n\r\n\r\n return Fingerprint;\r\n\r\n});"]}
1
+ {"version":3,"file":"apbct-fingerprint.min.js","sources":["apbct-fingerprint.js"],"sourcesContent":["/*\n* fingerprintJS 0.5.5 - Fast browser fingerprint library\n* https://github.com/Valve/fingerprintjs\n* Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com)\n* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n;(function (name, context, definition) {\n if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); }\n else if (typeof define === 'function' && define.amd) { define(definition); }\n else { context[name] = definition(); }\n})('Fingerprint', this, function () {\n 'use strict';\n\n var Fingerprint = function (options) {\n var nativeForEach, nativeMap;\n nativeForEach = Array.prototype.forEach;\n nativeMap = Array.prototype.map;\n\n this.each = function (obj, iterator, context) {\n if (obj === null) {\n return;\n }\n if (nativeForEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n } else if (obj.length === +obj.length) {\n for (var i = 0, l = obj.length; i < l; i++) {\n if (iterator.call(context, obj[i], i, obj) === {}) return;\n }\n } else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n if (iterator.call(context, obj[key], key, obj) === {}) return;\n }\n }\n }\n };\n\n this.map = function(obj, iterator, context) {\n var results = [];\n // Not using strict equality so that this acts as a\n // shortcut to checking for `null` and `undefined`.\n if (obj == null) return results;\n if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n this.each(obj, function(value, index, list) {\n results[results.length] = iterator.call(context, value, index, list);\n });\n return results;\n };\n\n if (typeof options == 'object'){\n this.hasher = options.hasher;\n this.screen_resolution = options.screen_resolution;\n this.screen_orientation = options.screen_orientation;\n this.canvas = options.canvas;\n this.ie_activex = options.ie_activex;\n } else if(typeof options == 'function'){\n this.hasher = options;\n }\n };\n\n Fingerprint.prototype = {\n get: function(){\n var keys = [];\n keys.push(navigator.userAgent);\n keys.push(navigator.language);\n keys.push(screen.colorDepth);\n if (this.screen_resolution) {\n var resolution = this.getScreenResolution();\n if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs\n keys.push(resolution.join('x'));\n }\n }\n keys.push(new Date().getTimezoneOffset());\n keys.push(this.hasSessionStorage());\n keys.push(this.hasLocalStorage());\n keys.push(this.hasIndexDb());\n //body might not be defined at this point or removed programmatically\n if(document.body){\n keys.push(typeof(document.body.addBehavior));\n } else {\n keys.push(typeof undefined);\n }\n keys.push(typeof(window.openDatabase));\n keys.push(navigator.cpuClass);\n keys.push(navigator.platform);\n keys.push(navigator.doNotTrack);\n keys.push(this.getPluginsString());\n if(this.canvas && this.isCanvasSupported()){\n keys.push(this.getCanvasFingerprint());\n }\n if(this.hasher){\n return this.hasher(keys.join('###'), 31);\n } else {\n return this.murmurhash3_32_gc(keys.join('###'), 31);\n }\n },\n\n /**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\n murmurhash3_32_gc: function(key, seed) {\n var remainder, bytes, h1, h1b, c1, c2, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key.charCodeAt(i) & 0xff)) |\n ((key.charCodeAt(++i) & 0xff) << 8) |\n ((key.charCodeAt(++i) & 0xff) << 16) |\n ((key.charCodeAt(++i) & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n },\n\n // https://bugzilla.mozilla.org/show_bug.cgi?id=781447\n hasLocalStorage: function () {\n try{\n return !!window.localStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasSessionStorage: function () {\n try{\n return !!window.sessionStorage;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n hasIndexDb: function () {\n try{\n return !!window.indexedDB;\n } catch(e) {\n return true; // SecurityError when referencing it means it exists\n }\n },\n\n isCanvasSupported: function () {\n var elem = document.createElement('canvas');\n return !!(elem.getContext && elem.getContext('2d'));\n },\n\n isIE: function () {\n if(navigator.appName === 'Microsoft Internet Explorer') {\n return true;\n } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11\n return true;\n }\n return false;\n },\n\n getPluginsString: function () {\n if(this.isIE() && this.ie_activex){\n return this.getIEPluginsString();\n } else {\n return this.getRegularPluginsString();\n }\n },\n\n getRegularPluginsString: function () {\n return this.map(navigator.plugins, function (p) {\n var mimeTypes = this.map(p, function(mt){\n return [mt.type, mt.suffixes].join('~');\n }).join(',');\n return [p.name, p.description, mimeTypes].join('::');\n }, this).join(';');\n },\n\n getIEPluginsString: function () {\n if(window.ActiveXObject){\n var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin\n 'AcroPDF.PDF', // Adobe PDF reader 7+\n 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr\n 'QuickTime.QuickTime', // QuickTime\n // 5 versions of real players\n 'rmocx.RealPlayer G2 Control',\n 'rmocx.RealPlayer G2 Control.1',\n 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)',\n 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)',\n 'RealPlayer',\n 'SWCtl.SWCtl', // ShockWave player\n 'WMPlayer.OCX', // Windows media player\n 'AgControl.AgControl', // Silverlight\n 'Skype.Detection'];\n\n // starting to detect plugins in IE\n return this.map(names, function(name){\n try{\n new ActiveXObject(name);\n return name;\n } catch(e){\n return null;\n }\n }).join(';');\n } else {\n return \"\"; // behavior prior version 0.5.0, not breaking backwards compat.\n }\n },\n\n getScreenResolution: function () {\n var resolution;\n if(this.screen_orientation){\n resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height];\n }else{\n resolution = [screen.height, screen.width];\n }\n return resolution;\n },\n\n getCanvasFingerprint: function () {\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n // https://www.browserleaks.com/canvas#how-does-it-work\n var txt = 'http://valve.github.io';\n ctx.textBaseline = \"top\";\n ctx.font = \"14px 'Arial'\";\n ctx.textBaseline = \"alphabetic\";\n ctx.fillStyle = \"#f60\";\n ctx.fillRect(125,1,62,20);\n ctx.fillStyle = \"#069\";\n ctx.fillText(txt, 2, 15);\n ctx.fillStyle = \"rgba(102, 204, 0, 0.7)\";\n ctx.fillText(txt, 4, 17);\n return canvas.toDataURL();\n }\n };\n\n\n return Fingerprint;\n\n});"],"names":["context","definition","module","exports","define","amd","this","Fingerprint","options","nativeForEach","Array","prototype","forEach","nativeMap","map","each","obj","iterator","length","i","l","call","key","hasOwnProperty","results","value","index","list","hasher","screen_resolution","screen_orientation","canvas","ie_activex","get","resolution","keys","push","navigator","userAgent","language","screen","colorDepth","getScreenResolution","join","Date","getTimezoneOffset","hasSessionStorage","hasLocalStorage","hasIndexDb","document","body","window","cpuClass","platform","doNotTrack","getPluginsString","isCanvasSupported","getCanvasFingerprint","murmurhash3_32_gc","seed","h1b","k1","remainder","bytes","h1","c1","c2","charCodeAt","localStorage","e","sessionStorage","indexedDB","elem","createElement","getContext","isIE","appName","test","getIEPluginsString","getRegularPluginsString","plugins","p","mimeTypes","mt","type","suffixes","name","description","ActiveXObject","height","width","ctx","txt","textBaseline","font","fillStyle","fillRect","fillText","toDataURL"],"mappings":"CAkBC,SAAiBA,EAASC,GACH,oBAAXC,QAA0BA,OAAOC,QAAWD,OAAOC,QAAUF,IAC7C,mBAAXG,QAAyBA,OAAOC,IAAOD,OAAOH,GACvDD,EAAY,YAAIC,IAHxB,CAIiBK,KAAM,wBAGJ,SAAdC,EAAwBC,GAC1B,IACAC,EAAgBC,MAAMC,UAAUC,QAChCC,EAAYH,MAAMC,UAAUG,IAE5BR,KAAKS,KAAO,SAAUC,EAAKC,EAAUjB,GACnC,GAAY,OAARgB,EAGJ,GAAIP,GAAiBO,EAAIJ,UAAYH,EACnCO,EAAIJ,QAAQK,EAAUjB,QACjB,GAAIgB,EAAIE,UAAYF,EAAIE,QAC7B,IAAK,IAAIC,EAAI,EAAGC,EAAIJ,EAAIE,OAAQC,EAAIC,EAAGD,IACrC,GAAIF,EAASI,KAAKrB,EAASgB,EAAIG,GAAIA,EAAGH,KAAS,GAAI,YAGrD,IAAK,IAAIM,KAAON,EACd,GAAIA,EAAIO,eAAeD,IACjBL,EAASI,KAAKrB,EAASgB,EAAIM,GAAMA,EAAKN,KAAS,GAAI,QAM/DV,KAAKQ,IAAM,SAASE,EAAKC,EAAUjB,GACjC,IAAIwB,EAAU,GAGd,OAAW,MAAPR,EAAoBQ,EACpBX,GAAaG,EAAIF,MAAQD,E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IG,KAAO,eACXH,EAAIE,aAAe,aACnBF,EAAII,UAAY,OAChBJ,EAAIK,SAAS,IAAI,EAAE,GAAG,IACtBL,EAAII,UAAY,OAChBJ,EAAIM,SAASL,EAAK,EAAG,IACrBD,EAAII,UAAY,yBAChBJ,EAAIM,SAASL,EAAK,EAAG,IACd7D,EAAOmE,cAKX3F"}
js/apbct-public--alt.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public--alt.min.js","sources":["apbct-public--alt.js"],"sourcesContent":["// Fingerprint\r\nvar apbct_fingerprint = new Fingerprint({canvas: true, ie_activex: true, hasher: apbct_md5}).get();\r\n\r\n/* Function: Reuturns cookie with prefix */\r\nfunction apbct_cookie__get(names, prefixes){\r\n\tvar cookie = {};\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes == 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\treturn cookie;\r\n}\r\n\r\n/* Function: Deletes cookie with prefix */\r\nfunction apbct_cookie__delete(names, prefixes){\r\n\tvar date = new Date(0);\r\n\tnames = names || null;\r\n\tif(typeof names == 'string') names = names.split();\r\n\tprefixes = prefixes || ['apbct_', 'ct_'];\r\n\tif(prefixes == 'none') prefixes = null;\r\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\t\r\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\r\n\t\tvar curr = item.trim().split('=');\r\n\t\t// Detect by full cookie name\r\n\t\tif(names){\r\n\t\t\tnames.forEach(function(name, i, all){\r\n\t\t\t\tif(curr[0] === name)\r\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\r\n\t\t\t});\r\n\t\t}\r\n\t\t// Detect by name prefix\r\n\t\tif(prefixes){\r\n\t\t\tprefixes.forEach(function(prefix, i, all){\r\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\r\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t jQuery.ajax({\r\n\t\t type: \"POST\",\r\n\t\t url: apbctPublicAlt.ajax_url,\r\n\t\t data: {\r\n\t\t\t apbct_action: 'get_sessions',\r\n\t\t\t apbct_secret: apbctPublicAlt.nonce,\r\n\t\t\t session_id: apbct_fingerprint,\r\n\t\t },\r\n\t\t async: true,\r\n\t\t success: function(msg){\r\n\t\t\t console.log('success');\r\n\t\t\t msg = JSON.parse(msg);\r\n\t\t\t\r\n\t\t\t if(msg.result){\r\n\t\t\t\t console.log(msg);\r\n\t\t\t\t for(cookie in msg.cookies){\r\n\t\t\t\t\t console.log(cookie);\r\n//\t\t\t\t\t console.log(msg.cookies[cookie]);\r\n\t\t\t\t\t document.cookie = cookie + \"=\" + msg.cookies[cookie] + \"; path=/; samesite=lax\";\r\n\t\t\t\t };\r\n\t\t\t }else{\r\n\t\t\t\t console.log(msg);\r\n\t\t\t\t console.log('APBCT SESSIONS GET ERROR');\r\n\t\t\t }\r\n\t\t },\r\n\t\t error: function(err){\r\n\t\t\t console.log('err');\r\n\t\t\t console.log(err);\r\n\t\t }\r\n\t });\r\n\t\r\n\twindow.onunload = function(){\r\n\t\t\r\n\t\t// Getting ct_ and apbct_ cookies\r\n\t\t cookies = apbct_cookie__get();\r\n\t\t\r\n\t\tconsole.log('leave');\r\n\t\t\r\n\t\t jQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: apbctPublicAlt.ajax_url,\r\n\t\t\tdata: {\r\n\t\t\t\tapbct_action: 'set_sessions',\r\n\t\t\t\tapbct_secret: apbctPublicAlt.nonce,\r\n\t\t\t\tsession_id: apbct_fingerprint,\r\n\t\t\t\tdata: cookies,\r\n\t\t\t},\r\n\t\t\tasync: false,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tmsg = JSON.parse(msg);\r\n\t\t\t\tif(msg.result){\r\n\t\t\t\t\tconsole.log('success');\r\n\t\t\t\t\tconsole.log(msg);\r\n\t\t\t\t\t// Deleting ct_ and apbct_ cookies on success\r\n\t\t\t\t\tapbct_cookie__delete();\r\n\t\t\t\t\tconsole.log('cookie DELETED');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tconsole.log('APBCT SESSIONS GET ERROR');\r\n\t\t\t\t\tconsole.log(msg);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: function(err){\r\n\t\t\t\tconsole.log('err');\r\n\t\t\t\tconsole.log(err);\r\n\t\t\t}\r\n\t\t}); \r\n\t}\r\n});"],"names":["apbct_fingerprint","Fingerprint","canvas","ie_activex","hasher","apbct_md5","get","apbct_cookie__get","names","prefixes","cookie","split","document","forEach","item","i","arr","curr","trim","name","all","prefix","indexOf","apbct_cookie__delete","date","Date","toUTCString","jQuery","ready","ajax","type","url","apbctPublicAlt","ajax_url","data","apbct_action","apbct_secret","nonce","session_id","async","success","msg","console","log","JSON","parse","result","cookies","error","err","window","onunload"],"mappings":"AACA,IAAIA,kBAAoB,IAAIC,YAAY,CAACC,QAAQ,EAAMC,YAAY,EAAMC,OAAQC,YAAYC,MAG7F,SAASC,kBAAkBC,EAAOC,GACjC,IAAIC,EAAS,G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AC,QAAQC,IAAI,YACZF,EAAMG,KAAKC,MAAMJ,IAEVK,OAEN,IAAIpC,UADJgC,QAAQC,IAAIF,GACEA,EAAIM,QACjBL,QAAQC,IAAIjC,QAEZE,SAASF,OAASA,OAAS,IAAM+B,EAAIM,QAAQrC,QAAU,8BAGxDgC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,6BAGdK,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM,MAIfC,OAAOC,SAAW,WAGhBJ,QAAUxC,oBAEXmC,QAAQC,IAAI,SAEXhB,OAAOE,KAAK,CACZC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,kBACZkC,KAAMa,SAEPR,OAAO,EACPC,QAAS,SAASC,IACjBA,EAAMG,KAAKC,MAAMJ,IACVK,QACNJ,QAAQC,IAAI,WACZD,QAAQC,IAAIF,GAEZlB,uBACAmB,QAAQC,IAAI,oBAEZD,QAAQC,IAAI,4BACZD,QAAQC,IAAIF,KAGdO,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM"}
1
+ {"version":3,"file":"apbct-public--alt.min.js","sources":["apbct-public--alt.js"],"sourcesContent":["// Fingerprint\nvar apbct_fingerprint = new Fingerprint({canvas: true, ie_activex: true, hasher: apbct_md5}).get();\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\n/* Function: Deletes cookie with prefix */\nfunction apbct_cookie__delete(names, prefixes){\n\tvar date = new Date(0);\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes == 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\t\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tdocument.cookie = curr[0] + \"=; path=/; expires=\" + date.toUTCString() + '; samesite=lax';\n\t\t\t});\n\t\t}\n\t});\n}\n\njQuery(document).ready(function(){\n\t\n\t jQuery.ajax({\n\t\t type: \"POST\",\n\t\t url: apbctPublicAlt.ajax_url,\n\t\t data: {\n\t\t\t apbct_action: 'get_sessions',\n\t\t\t apbct_secret: apbctPublicAlt.nonce,\n\t\t\t session_id: apbct_fingerprint,\n\t\t },\n\t\t async: true,\n\t\t success: function(msg){\n\t\t\t console.log('success');\n\t\t\t msg = JSON.parse(msg);\n\t\t\t\n\t\t\t if(msg.result){\n\t\t\t\t console.log(msg);\n\t\t\t\t for(cookie in msg.cookies){\n\t\t\t\t\t console.log(cookie);\n//\t\t\t\t\t console.log(msg.cookies[cookie]);\n\t\t\t\t\t document.cookie = cookie + \"=\" + msg.cookies[cookie] + \"; path=/; samesite=lax\";\n\t\t\t\t };\n\t\t\t }else{\n\t\t\t\t console.log(msg);\n\t\t\t\t console.log('APBCT SESSIONS GET ERROR');\n\t\t\t }\n\t\t },\n\t\t error: function(err){\n\t\t\t console.log('err');\n\t\t\t console.log(err);\n\t\t }\n\t });\n\t\n\twindow.onunload = function(){\n\t\t\n\t\t// Getting ct_ and apbct_ cookies\n\t\t cookies = apbct_cookie__get();\n\t\t\n\t\tconsole.log('leave');\n\t\t\n\t\t jQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: apbctPublicAlt.ajax_url,\n\t\t\tdata: {\n\t\t\t\tapbct_action: 'set_sessions',\n\t\t\t\tapbct_secret: apbctPublicAlt.nonce,\n\t\t\t\tsession_id: apbct_fingerprint,\n\t\t\t\tdata: cookies,\n\t\t\t},\n\t\t\tasync: false,\n\t\t\tsuccess: function(msg){\n\t\t\t\tmsg = JSON.parse(msg);\n\t\t\t\tif(msg.result){\n\t\t\t\t\tconsole.log('success');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t\t// Deleting ct_ and apbct_ cookies on success\n\t\t\t\t\tapbct_cookie__delete();\n\t\t\t\t\tconsole.log('cookie DELETED');\n\t\t\t\t}else{\n\t\t\t\t\tconsole.log('APBCT SESSIONS GET ERROR');\n\t\t\t\t\tconsole.log(msg);\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(err){\n\t\t\t\tconsole.log('err');\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t}); \n\t}\n});"],"names":["apbct_fingerprint","Fingerprint","canvas","ie_activex","hasher","apbct_md5","get","apbct_cookie__get","names","prefixes","cookie","split","document","forEach","item","i","arr","curr","trim","name","all","prefix","indexOf","apbct_cookie__delete","date","Date","toUTCString","jQuery","ready","ajax","type","url","apbctPublicAlt","ajax_url","data","apbct_action","apbct_secret","nonce","session_id","async","success","msg","console","log","JSON","parse","result","c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D,OAAOE,KAAK,CACXC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,mBAEbuC,OAAO,EACPC,QAAS,SAASC,GAIjB,GAHAC,QAAQC,IAAI,YACZF,EAAMG,KAAKC,MAAMJ,IAEVK,OAEN,IAAIpC,UADJgC,QAAQC,IAAIF,GACEA,EAAIM,QACjBL,QAAQC,IAAIjC,QAEZE,SAASF,OAASA,OAAS,IAAM+B,EAAIM,QAAQrC,QAAU,8BAGxDgC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,6BAGdK,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM,MAIfC,OAAOC,SAAW,WAGhBJ,QAAUxC,oBAEXmC,QAAQC,IAAI,SAEXhB,OAAOE,KAAK,CACZC,KAAM,OACNC,IAAKC,eAAeC,SACpBC,KAAM,CACLC,aAAc,eACdC,aAAcJ,eAAeK,MAC7BC,WAAYtC,kBACZkC,KAAMa,SAEPR,OAAO,EACPC,QAAS,SAASC,IACjBA,EAAMG,KAAKC,MAAMJ,IACVK,QACNJ,QAAQC,IAAI,WACZD,QAAQC,IAAIF,GAEZlB,uBACAmB,QAAQC,IAAI,oBAEZD,QAAQC,IAAI,4BACZD,QAAQC,IAAIF,KAGdO,MAAO,SAASC,GACfP,QAAQC,IAAI,OACZD,QAAQC,IAAIM"}
js/apbct-public--gdpr.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["apbct-public--gdpr.js"],"names":["jQuery","document","ready","ctPublicGDPR","gdpr_forms","forEach","item","i","arr","elem","is","find","children","first","attr","indexOf","append","gdpr_text"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAElBC,aAAaC,YAEjBD,aAAaC,WAAWC,QAAQ,SAASC,EAAMC,EAAGC,GAEjD,IAAIC,EAAOT,OAAO,IAAIM,EAAK,MAAMA,GAG7BG,EAAKC,GAAG,UAERD,EAAKE,KAAK,QAAQ,GACpBF,EAAOA,EAAKG,SAAS,QAAQC,QAEtBb,OAAO,qBAAqB,KAA0E,IAApEA,OAAO,qBAAqBc,KAAK,MAAMC,QAAQ,UAAUT,GAClGG,EAAOT,OAAO,qBAEPA,OAAO,cAAc,KAA6E,IAAvEA,OAAO,cAAca,QAAQC,KAAK,MAAMC,QAAQ,YAAYT,GAC9FG,EAAOT,OAAO,cAAca,QAAQD,SAAS,QAEtCZ,OAAO,iBAAiB,KAAoF,IAA9EA,OAAO,iBAAiBa,QAAQC,KAAK,MAAMC,QAAQ,gBAAgBT,KACxGG,EAAOT,OAAO,oBAIbS,EAAKC,GAAG,SAAiC,SAAtBD,EAAKK,KAAK,SAC/BL,EAAKO,OAAO,yBAAyBT,EAAE,wFACrCS,OAAO,mDAAmDT,EAAE,KAAKJ,aAAac,UAAU","file":"apbct-public--gdpr.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\t\r\n\tif(!ctPublicGDPR.gdpr_forms) return;\r\n\t\r\n\tctPublicGDPR.gdpr_forms.forEach(function(item, i, arr){\r\n\t\t\r\n\t\tvar elem = jQuery('#'+item+', .'+item);\r\n\t\t\r\n\t\t// Filter forms\r\n\t\tif(!elem.is('form')){\r\n\t\t\t// Caldera\r\n\t\t\tif(elem.find('form')[0])\r\n\t\t\t\telem = elem.children('form').first();\r\n\t\t\t// Contact Form 7\r\n\t\t\telse if(jQuery('.wpcf7[role=form]')[0] && jQuery('.wpcf7[role=form]').attr('id').indexOf('wpcf7-f'+item) !== -1)\r\n\t\t\t\telem = jQuery('.wpcf7[role=form]');\r\n\t\t\t// Formidable\r\n\t\t\telse if(jQuery('.frm_forms')[0] && jQuery('.frm_forms').first().attr('id').indexOf('frm_form_'+item) !== -1)\r\n\t\t\t\telem = jQuery('.frm_forms').first().children('form');\r\n\t\t\t// WPForms\r\n\t\t\telse if(jQuery('.wpforms-form')[0] && jQuery('.wpforms-form').first().attr('id').indexOf('wpforms-form-'+item) !== -1)\r\n\t\t\t\telem = jQuery('.wpforms-form');\r\n\t\t}\r\n\t\t\r\n\t\t// Adding notice\r\n\t\tif(elem.is('form') || elem.attr('role') === 'form'){\r\n\t\t\telem.append('<input id=\"apbct_gdpr_'+i+'\" type=\"checkbox\" required=\"required \" style=\"display: inline; margin-right: 10px;\">')\r\n\t\t\t\t.append('<label style=\"display: inline;\" for=\"apbct_gdpr_'+i+'\">'+ctPublicGDPR.gdpr_text+'</label>');\r\n\t\t}\r\n\t});\r\n\t\r\n});"]}
1
+ {"version":3,"file":"apbct-public--gdpr.min.js","sources":["apbct-public--gdpr.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\tif(!ctPublicGDPR.gdpr_forms) return;\n\t\n\tctPublicGDPR.gdpr_forms.forEach(function(item, i, arr){\n\t\t\n\t\tvar elem = jQuery('#'+item+', .'+item);\n\t\t\n\t\t// Filter forms\n\t\tif(!elem.is('form')){\n\t\t\t// Caldera\n\t\t\tif(elem.find('form')[0])\n\t\t\t\telem = elem.children('form').first();\n\t\t\t// Contact Form 7\n\t\t\telse if(jQuery('.wpcf7[role=form]')[0] && jQuery('.wpcf7[role=form]').attr('id').indexOf('wpcf7-f'+item) !== -1)\n\t\t\t\telem = jQuery('.wpcf7[role=form]');\n\t\t\t// Formidable\n\t\t\telse if(jQuery('.frm_forms')[0] && jQuery('.frm_forms').first().attr('id').indexOf('frm_form_'+item) !== -1)\n\t\t\t\telem = jQuery('.frm_forms').first().children('form');\n\t\t\t// WPForms\n\t\t\telse if(jQuery('.wpforms-form')[0] && jQuery('.wpforms-form').first().attr('id').indexOf('wpforms-form-'+item) !== -1)\n\t\t\t\telem = jQuery('.wpforms-form');\n\t\t}\n\t\t\n\t\t// Adding notice\n\t\tif(elem.is('form') || elem.attr('role') === 'form'){\n\t\t\telem.append('<input id=\"apbct_gdpr_'+i+'\" type=\"checkbox\" required=\"required \" style=\"display: inline; margin-right: 10px;\">')\n\t\t\t\t.append('<label style=\"display: inline;\" for=\"apbct_gdpr_'+i+'\">'+ctPublicGDPR.gdpr_text+'</label>');\n\t\t}\n\t});\n\t\n});"],"names":["jQuery","document","ready","ctPublicGDPR","gdpr_forms","forEach","item","i","arr","elem","is","find","children","first","attr","indexOf","append","gdpr_text"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAElBC,aAAaC,YAEjBD,aAAaC,WAAWC,QAAQ,SAASC,EAAMC,EAAGC,GAEjD,IAAIC,EAAOT,OAAO,IAAIM,EAAK,MAAMA,GAG7BG,EAAKC,GAAG,UAERD,EAAKE,KAAK,QAAQ,GACpBF,EAAOA,EAAKG,SAAS,QAAQC,QAEtBb,OAAO,qBAAqB,KAA0E,IAApEA,OAAO,qBAAqBc,KAAK,MAAMC,QAAQ,UAAUT,GAClGG,EAAOT,OAAO,qBAEPA,OAAO,cAAc,KAA6E,IAAvEA,OAAO,cAAca,QAAQC,KAAK,MAAMC,QAAQ,YAAYT,GAC9FG,EAAOT,OAAO,cAAca,QAAQD,SAAS,QAEtCZ,OAAO,iBAAiB,KAAoF,IAA9EA,OAAO,iBAAiBa,QAAQC,KAAK,MAAMC,QAAQ,gBAAgBT,KACxGG,EAAOT,OAAO,oBAIbS,EAAKC,GAAG,SAAiC,SAAtBD,EAAKK,KAAK,SAC/BL,EAAKO,OAAO,yBAAyBT,EAAE,wFACrCS,OAAO,mDAAmDT,EAAE,KAAKJ,aAAac,UAAU"}
js/apbct-public.min.js CHANGED
@@ -1,2 +1,2 @@
1
- function ctSetCookie(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/; samesite=lax"}function apbct_collect_visible_fields(e){var t=[],o="",n=0,i=[];for(var a in e.elements)isNaN(+a)||(t[a]=e.elements[a]);return(t=t.filter(function(e){return"none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&-1===i.indexOf(e.getAttribute("name"))&&(n++,-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(i.push(e.getAttribute("name")),!1))})).forEach(function(e,t,n){o+=" "+e.getAttribute("name")}),{visible_fields:o=o.trim(),visible_fields_count:n}}function apbct_visible_fields_set_cookie(e){var t="object"==typeof e&&null!==e?e:{};ctSetCookie("apbct_visible_fields",JSON.stringify(t))}function apbct_js_keys__set_input_value(e,t,n,o){var i;null!==document.getElementById(n.input_name)&&(i=document.getElementById(n.input_name).value,document.getElementById(n.input_name).value=document.getElementById(n.input_name).value.replace(i,e.js_key))}function apbct_public_sendAJAX(t,n,o){var i=n.callback||null,a=n.callback_context||null,c=n.callback_params||null,e=n.async||!0,s=n.notJson||null,l=n.timeout||15e3,o=o||null,r=n.button||null,u=n.spinner||null,p=n.progressbar||null,d=n.silent||null,m=n.no_nonce||null;"string"==typeof t?(m||(t=t+"&_ajax_nonce="+ctPublic._ajax_nonce),t=t+"&no_cache="+Math.random()):(m||(t._ajax_nonce=ctPublic._ajax_nonce),t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),s||(e=JSON.parse(e)),e.error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):i&&(c?i.apply(a,c.concat(e,t,n,o)):i(e,t,n,o))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),n&&!d&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"),alert("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:l})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],i=0;function a(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function c(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookie("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookie("ct_fkp_timestamp","0"),ctSetCookie("ct_pointer_data","0"),ctSetCookie("ct_timezone","0"),setTimeout(function(){ctSetCookie("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var s=function(){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),c(window,"mousedown",s),c(window,"keydown",s)},l=setInterval(function(){n=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++i&&(c(window,"mousemove",u),clearInterval(l),clearInterval(r)))};a(window,"mousemove",u),a(window,"mousedown",s),a(window,"keydown",s),a(window,"DOMContentLoaded",function(){ctSetCookie("apbct_visible_fields",0),setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var n=document.forms[t];n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"==n.id||n.name.classList&&n.name.classList.contains("tinkoffPayRow")||(e[t]=apbct_collect_visible_fields(n),n.onsubmit_prev=n.onsubmit,n.onsubmit=function(e){var t={};t[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}();var accessor=Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype,"responseText");Object.defineProperty(XMLHttpRequest.prototype,"responseText",{get:function(){return apbct_showBlockedResponse(this.response),accessor.get.call(this)},configurable:!0}),apbct_parseJSON=function(e){try{var t=JSON.parse(e)}catch(e){return!1}return t},apbct_showBlockedResponse=function(e){return(e=apbct_parseJSON(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()),!0};
2
  //# sourceMappingURL=apbct-public.min.js.map
1
+ function ctSetCookie(e,t){document.cookie=e+"="+encodeURIComponent(t)+"; path=/; samesite=lax"}function apbct_collect_visible_fields(e){var t=[],o="",n=0,a=[];for(var s in e.elements)isNaN(+s)||(t[s]=e.elements[s]);return(t=t.filter(function(e){return"none"!==getComputedStyle(e).display&&"hidden"!==getComputedStyle(e).visibility&&"0"!==getComputedStyle(e).opacity&&"hidden"!==e.getAttribute("type")&&"submit"!==e.getAttribute("type")&&null!==e.getAttribute("name")&&-1===a.indexOf(e.getAttribute("name"))&&(n++,-1===["radio","checkbox"].indexOf(e.getAttribute("type"))||(a.push(e.getAttribute("name")),!1))})).forEach(function(e,t,n){o+=" "+e.getAttribute("name")}),{visible_fields:o=o.trim(),visible_fields_count:n}}function apbct_visible_fields_set_cookie(e){var t="object"==typeof e&&null!==e?e:{};ctSetCookie("apbct_visible_fields",JSON.stringify(t))}function apbct_js_keys__set_input_value(e,t,n,o){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var a=document.querySelectorAll("[name^=ct_checkjs]"),s=0;s<a.length;s++)a[s].value=e.js_key}function apbct_public_sendAJAX(t,n,o){var a=n.callback||null,s=n.callback_context||null,i=n.callback_params||null,e=n.async||!0,c=n.notJson||null,l=n.timeout||15e3,o=o||null,r=n.button||null,u=n.spinner||null,p=n.progressbar||null,d=n.silent||null,m=n.no_nonce||null;"string"==typeof t?(m||(t=t+"&_ajax_nonce="+ctPublic._ajax_nonce),t=t+"&no_cache="+Math.random()):(m||(t._ajax_nonce=ctPublic._ajax_nonce),t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublic._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),c||(e=JSON.parse(e)),e.error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):a&&(i?a.apply(s,i.concat(e,t,n,o)):a(e,t,n,o))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),u&&jQuery(u).css("display","none"),n&&!d&&(console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"),alert("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:l})}function apbct_public_sendREST(t,n){var o=n.callback||null;jQuery.ajax({type:"POST",url:ctPublic._rest_url+"cleantalk-antispam/v1/"+t,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",ctPublic._rest_nonce)},success:function(e){e.error?alert("Error happens: "+(e.error||"Unknown")):o&&o(e,t,n,null)},error:function(e,t,n){n&&(console.log("APBCT_REST_ERROR"),console.log(e),console.log(t),console.log("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"),alert("Anti-spam by Cleantalk plugin error: "+n+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}!function(){var e=new Date,t=(new Date).getTime(),n=!0,o=[],a=0;function s(e,t,n){"function"==typeof window.addEventListener?e.addEventListener(t,n):e.attachEvent(t,n)}function i(e,t,n){"function"==typeof window.removeEventListener?e.removeEventListener(t,n):e.detachEvent(t,n)}ctSetCookie("ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)),ctSetCookie("ct_fkp_timestamp","0"),ctSetCookie("ct_pointer_data","0"),ctSetCookie("ct_timezone","0"),setTimeout(function(){ctSetCookie("ct_timezone",e.getTimezoneOffset()/60*-1)},1e3);var c=function(){ctSetCookie("ct_fkp_timestamp",Math.floor((new Date).getTime()/1e3)),i(window,"mousedown",c),i(window,"keydown",c)},l=setInterval(function(){n=!0},150),r=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(e){!0===n&&(o.push([Math.round(e.clientY),Math.round(e.clientX),Math.round((new Date).getTime()-t)]),n=!1,50<=++a&&(i(window,"mousemove",u),clearInterval(l),clearInterval(r)))};s(window,"mousemove",u),s(window,"mousedown",c),s(window,"keydown",c),s(window,"DOMContentLoaded",function(){ctSetCookie("apbct_visible_fields",0),setTimeout(function(){for(var e={},t=0;t<document.forms.length;t++){var n=document.forms[t];n.classList.contains("slp_search_form")||n.parentElement.classList.contains("mec-booking")||-1!==n.action.toString().indexOf("activehosted.com")||n.id&&"caspioform"==n.id||n.name.classList&&n.name.classList.contains("tinkoffPayRow")||n.name.classList&&n.name.classList.contains("give-form ")||(e[t]=apbct_collect_visible_fields(n),n.onsubmit_prev=n.onsubmit,n.onsubmit=function(e){var t={};t[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(t),e.target.onsubmit_prev instanceof Function&&setTimeout(function(){e.target.onsubmit_prev.call(e.target,e)},500)})}apbct_visible_fields_set_cookie(e)},1e3)})}();var send=window.XMLHttpRequest.prototype.send;function sendReplacement(e){return this.onreadystatechange&&(this._onreadystatechange=this.onreadystatechange),this.onreadystatechange=onReadyStateChangeReplacement,send.apply(this,arguments)}function onReadyStateChangeReplacement(){if(4===this.readyState&&apbct_showBlockedResponse(this.responseText),this._onreadystatechange)return this._onreadystatechange.apply(this,arguments)}function apbct_parseJSON(e){try{var t=JSON.parse(e)}catch(e){return!1}return t}function apbct_showBlockedResponse(e){return(e=apbct_parseJSON(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()),!0}window.XMLHttpRequest.prototype.send=sendReplacement;
2
  //# sourceMappingURL=apbct-public.min.js.map
js/apbct-public.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\tctSetCookie(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\n\tctSetCookie(\"ct_fkp_timestamp\", \"0\");\n\tctSetCookie(\"ct_pointer_data\", \"0\");\n\tctSetCookie(\"ct_timezone\", \"0\");\n\n\tsetTimeout(function(){\n\t\tctSetCookie(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\n\t},1000);\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\tctSetCookie(\"apbct_visible_fields\", 0);\n\n\t\tsetTimeout(function(){\n\n\t\t\tvar visible_fields_collection = {};\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id == 'caspioform') || //Caspio Form\n\t\t\t\t\tform.name.classList && form.name.classList.contains('tinkoffPayRow') //TinkoffPayForm\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\t\t\t\tform.onsubmit = function (event) {\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 );\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction ctSetCookie(c_name, value) {\n\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";\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_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 fields\n\t\tif( getComputedStyle(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\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\t//elem.value === \"\" || // empty value\n\t\t\telem.getAttribute('name') === null ||\n\t\t\tinputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added\n\t\t){\n\t\t\treturn false;\n\t\t}\n\n\t\t// Visible fields count\n\t\tinputs_visible_count++;\n\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\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t});\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}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif (document.getElementById(params.input_name) !== null) {\n\t\tvar ct_input_value = document.getElementById(params.input_name).value;\n\t\tdocument.getElementById(params.input_name).value = document.getElementById(params.input_name).value.replace(ct_input_value, result.js_key);\n\t}\n}\nfunction apbct_public_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\tvar silent = params.silent || null;\n\tvar no_nonce = params.no_nonce || null;\n\n\tif(typeof (data) === 'string') {\n\t\tif( ! no_nonce )\n\t\t\tdata = data + '&_ajax_nonce=' + ctPublic._ajax_nonce;\n\t\tdata = data + '&no_cache=' + Math.random()\n\t} else {\n\t\tif( ! no_nonce )\n\t\t\tdata._ajax_nonce = ctPublic._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctPublic._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif( errorThrown && ! silent ) {\n\t\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t\talert('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}\n\n// Capturing responses and output block message for unknown AJAX forms\nvar accessor = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, 'responseText');\nObject.defineProperty(XMLHttpRequest.prototype, 'responseText', {\n\n\tget: function(){\n\t\tapbct_showBlockedResponse( this.response );\n\t\treturn accessor.get.call(this);\n\t},\n\tconfigurable: true\n\n});\n\napbct_parseJSON = function( string ){\n\ttry{\n\t\tvar result = JSON.parse( string );\n\t}catch( e ){\n\t\treturn false;\n\t}\n\treturn result;\n};\n\napbct_showBlockedResponse = function( response ){\n\n\tvar response = apbct_parseJSON( response );\n\n\tif ( response && 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\treturn true;\n\n};"],"names":["ctSetCookie","c_name","value","document","cookie","encodeURIComponent","apbct_collect_visible_fields","form","inputs","inputs_visible","inputs_visible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","getComputedStyle","display","visibility","opacity","getAttribute","indexOf","push","forEach","i","visible_fields","trim","visible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","collection","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","ct_input_value","getElementById","input_name","replace","js_key","apbct_public_sendAJAX","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","silent","no_nonce","ctPublic","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","removeAttribute","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","apbct_attach_event_handler","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","floor","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","forms","length","classList","contains","parentElement","action","toString","id","name","onsubmit_prev","onsubmit","this","target","Function","call","accessor","Object","getOwnPropertyDescriptor","XMLHttpRequest","prototype","defineProperty","get","apbct_showBlockedResponse","response","configurable","apbct_parseJSON","string","e","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AA+HA,SAASA,YAAYC,EAAQC,GAC5BC,SAASC,OAASH,EAAS,IAAMI,mBAAmBH,GAAS,yBAG9D,SAASI,6BAA8BC,GAGtC,IAAIC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAA8B,GAE/B,IAAI,IAAIC,KAAOL,EAAKM,SACfC,OAAOF,KACVJ,EAAOI,GAAOL,EAAKM,SAASD,IAqC9B,OAjCAJ,EAASA,EAAOO,OAAO,SAASC,GAG/B,MAA0C,SAAtCC,iBAAiBD,GAAME,SACY,WAAtCD,iBAAiBD,GAAMG,YACe,MAAtCF,iBAAiBD,GAAMI,SACe,WAAtCJ,EAAKK,aAAa,SACoB,WAAtCL,EAAKK,aAAa,SAEoB,OAAtCL,EAAKK,aAAa,UACoD,IAAtEV,EAA4BW,QAASN,EAAKK,aAAa,WAMxDX,KAGK,IAAM,CAAC,QAAS,YAAYY,QAASN,EAAKK,aAAa,WAC3DV,EAA4BY,KAAMP,EAAKK,aAAa,UAC7C,OAOFG,QAAQ,SAASR,EAAMS,EAAGZ,GAChCJ,GAAkB,IAAMO,EAAKK,aAAa,UAIpC,CACNK,eAHDjB,EAAiBA,EAAekB,OAI/BC,qBAAuBlB,GAKzB,SAASmB,gCAAiCC,GAEzC,IAAIC,EAAkD,iBAA9BD,GAAwE,OAA9BA,EAAsCA,EAA4B,GAEpI9B,YAAY,uBAAwBgC,KAAKC,UAAWF,IAIrD,S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OADAC,0BAA2BX,KAAKY,UACzBR,SAASM,IAAIP,KAAKH,OAE1Ba,cAAc,IAIfC,gBAAkB,SAAUC,GAC3B,IACC,IAAIrG,EAASH,KAAKwC,MAAOgE,GACzB,MAAOC,GACP,OAAO,EAER,OAAOtG,GAGRiG,0BAA4B,SAAUC,GAuBrC,OArBIA,EAAWE,gBAAiBF,UAEW,IAAnBA,EAASK,QAChCL,EAAWA,EAASK,OACPC,UACZxI,SAASyI,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAASX,EAASY,YAK9BC,eAAeC,OAASd,EAASY,QACjCC,eAAeE,OAEa,IAAxBf,EAASgB,aACZxD,OAAOyD,SAIH"}
1
+ {"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\tctSetCookie(\"ct_ps_timestamp\", Math.floor(new Date().getTime()/1000));\n\tctSetCookie(\"ct_fkp_timestamp\", \"0\");\n\tctSetCookie(\"ct_pointer_data\", \"0\");\n\tctSetCookie(\"ct_timezone\", \"0\");\n\n\tsetTimeout(function(){\n\t\tctSetCookie(\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1));\n\t},1000);\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\tctSetCookie(\"apbct_visible_fields\", 0);\n\n\t\tsetTimeout(function(){\n\n\t\t\tvar visible_fields_collection = {};\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id == 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.name.classList && form.name.classList.contains('give-form ')) // GiveWP\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tvisible_fields_collection[i] = apbct_collect_visible_fields( form );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\t\t\t\tform.onsubmit = function (event) {\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 );\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tapbct_visible_fields_set_cookie( visible_fields_collection );\n\n\t\t}, 1000);\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction ctSetCookie(c_name, value) {\n\tdocument.cookie = c_name + \"=\" + encodeURIComponent(value) + \"; path=/; samesite=lax\";\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_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 fields\n\t\tif( getComputedStyle(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\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\t//elem.value === \"\" || // empty value\n\t\t\telem.getAttribute('name') === null ||\n\t\t\tinputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 // name already added\n\t\t){\n\t\t\treturn false;\n\t\t}\n\n\t\t// Visible fields count\n\t\tinputs_visible_count++;\n\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\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t});\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}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\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}\nfunction apbct_public_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\tvar silent = params.silent || null;\n\tvar no_nonce = params.no_nonce || null;\n\n\tif(typeof (data) === 'string') {\n\t\tif( ! no_nonce )\n\t\t\tdata = data + '&_ajax_nonce=' + ctPublic._ajax_nonce;\n\t\tdata = data + '&no_cache=' + Math.random()\n\t} else {\n\t\tif( ! no_nonce )\n\t\t\tdata._ajax_nonce = ctPublic._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctPublic._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif( errorThrown && ! silent ) {\n\t\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t\talert('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n\tvar callback = params.callback || null;\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctPublic._rest_url + 'cleantalk-antispam/v1/' + route,\n\t\tbeforeSend : function ( xhr ) {\n\t\t\txhr.setRequestHeader( 'X-WP-Nonce', ctPublic._rest_nonce );\n\t\t},\n\t\tsuccess: function(result){\n\t\t\tif(result.error){\n\t\t\t\talert('Error happens: ' + (result.error || 'Unknown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tvar obj = null;\n\t\t\t\t\tcallback(result, route, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif( errorThrown ) {\n\t\t\t\tconsole.log('APBCT_REST_ERROR');\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t\talert('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n\t\t\t}\n\t\t},\n\t});\n\n}\n\n// Capturing responses and output block message for unknown AJAX forms\nvar send = window.XMLHttpRequest.prototype.send;\nfunction sendReplacement(data) {\n\tif(this.onreadystatechange) {\n\t\tthis._onreadystatechange = this.onreadystatechange;\n\t}\n\tthis.onreadystatechange = onReadyStateChangeReplacement;\n\treturn send.apply(this, arguments);\n}\n\nfunction onReadyStateChangeReplacement() {\n\tif( this.readyState === 4 ){\n\t\tapbct_showBlockedResponse( this.responseText );\n\t}\n\tif(this._onreadystatechange) {\n\t\treturn this._onreadystatechange.apply(this, arguments);\n\t}\n}\n\nwindow.XMLHttpRequest.prototype.send = sendReplacement;\n\nfunction apbct_parseJSON( string ){\n\ttry{\n\t\tvar result = JSON.parse( string );\n\t}catch( e ){\n\t\treturn false;\n\t}\n\treturn result;\n}\n\nfunction apbct_showBlockedResponse( response ){\n\n\tvar response = apbct_parseJSON( response );\n\n\tif ( response && 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\treturn true;\n\n};"],"names":["ctSetCookie","c_name","value","document","cookie","encodeURIComponent","apbct_collect_visible_fields","form","inputs","inputs_visible","inputs_visible_count","inputs_with_duplicate_names","key","elements","isNaN","filter","elem","getComputedStyle","display","visibility","opacity","getAttribute","indexOf","push","forEach","i","visible_fields","trim","visible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","collection","JSON","stringify","apbct_js_keys__set_input_value","result","data","params","obj","querySelectorAll","length","js_key","apbct_public_sendAJAX","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","silent","no_nonce","ctPublic","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","removeAttribute","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","apbct_public_sendREST","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","ct_date","Date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","apbct_attach_event_handler","event","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","floor","getTimezoneOffset","ctFunctionFirstKey","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","forms","classList","contains","parentElement","action","toString","id","name","onsubmit_prev","onsubmit","this","target","Function","call","send","XMLHttpRequest","prototype","sendReplacement","onreadystatechange","_onreadystatechange","onReadyStateChangeReplacement","arguments","readyState","apbct_showBlockedResponse","responseText","apbct_parseJSON","string","e","response","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAgIA,SAASA,YAAYC,EAAQC,GAC5BC,SAASC,OAASH,EAAS,IAAMI,mBAAmBH,GAAS,yBAG9D,SAASI,6BAA8BC,GAGtC,IAAIC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAA8B,GAE/B,IAAI,IAAIC,KAAOL,EAAKM,SACfC,OAAOF,KACVJ,EAAOI,GAAOL,EAAKM,SAASD,IAqC9B,OAjCAJ,EAASA,EAAOO,OAAO,SAASC,GAG/B,MAA0C,SAAtCC,iBAAiBD,GAAME,SACY,WAAtCD,iBAAiBD,GAAMG,YACe,MAAtCF,iBAAiBD,GAAMI,SACe,WAAtCJ,EAAKK,aAAa,SACoB,WAAtCL,EAAKK,aAAa,SAEoB,OAAtCL,EAAKK,aAAa,UACoD,IAAtEV,EAA4BW,QAASN,EAAKK,aAAa,WAMxDX,KAGK,IAAM,CAAC,QAAS,YAAYY,QAASN,EAAKK,aAAa,WAC3DV,EAA4BY,KAAMP,EAAKK,aAAa,UAC7C,OAOFG,QAAQ,SAASR,EAAMS,EAAGZ,GAChCJ,GAAkB,IAAMO,EAAKK,aAAa,UAIpC,CACNK,eAHDjB,EAAiBA,EAAekB,OAI/BC,qBAAuBlB,GAKzB,SAASmB,gCAA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C,UAAUF,KAAOG"}
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("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null===a){if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}else c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){console.log(t.getAttribute("id"));var a;null===c&&(c=null===t.getAttribute("disabled")?0:1),1===c?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null===t.getAttribute("apbct_children")||null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){var c=function(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))};c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class='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_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 icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var t,c,e=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0!==e.data("id")?(t={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})):console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0!==t.data("id")){if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");var a={template_name:n}}else a={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:a},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}else console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery(".apbct_success").show(300),setTimeout(function(){jQuery(".apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").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()})});
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("#apbct_renew_notice").length&&jQuery("#apbct_renew_notice").hide("slow"),jQuery("#apbct_trial_notice").length&&jQuery("#apbct_trial_notice").hide("slow"),clearInterval(c))}})},9e5)}function apbct_get_elems(t){for(var e,n=0,a=(t=t.split(",")).length;n<a;n++)e=jQuery("#"+t[n]),t[n]=0===e.length?jQuery("."+t[n]):e;return t}function apbct_get_elems__native(t){"string"==typeof t&&(t=t.split(","));var c=[];return t.forEach(function(t,e,n){var a=document.getElementById(t);if(null===a){if(null!==(a=document.getElementsByClassName(t))&&0!==a.length)for(key in a)0<=+key&&c.push(a[key])}else c.push(a[key])}),c}function apbct_show_hide_elem(t){for(var e=0,n=(t=apbct_get_elems(t)).length;e<n;e++)t[e].each(function(t,e){var n=(e=jQuery(e)).next("label")||e.prev("label")||null;e.is(":visible")?(e.hide(),n&&n.hide()):(e.show(),n&&n.show())})}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbct_get_elems__native(t).forEach(function(t,e,n){console.log(t.getAttribute("id"));var a;null===c&&(c=null===t.getAttribute("disabled")?0:1),1===c?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null===t.getAttribute("apbct_children")||null!==(a=apbctSettingsDependencies_getState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependencies_getState(t){var e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbct_settings__showDescription(t,e){var c=function(t){void 0!==t&&(0!=jQuery(t.target).parent(".apbct_long_desc").length&&!jQuery(t.target).hasClass("apbct_long_desc__cancel")||jQuery(t.target).hasClass("apbct_long_description__show"))||(jQuery(".apbct_long_desc").remove(),jQuery(document).off("click",c))};c(),t.after("<div id='apbct_long_desc__"+e+"' class='apbct_long_desc'></div>");var n=jQuery("#apbct_long_desc__"+e);n.append("<i class='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_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 icon-cancel'></i>").append("<h3 class='apbct_long_desc__title'>"+t.title+"</h3>").append("<p>"+t.desc+"</p>"),jQuery(document).on("click",c)}},n)}jQuery(document).ready(function(){document.getElementsByClassName("apbct_settings-title")[0]&&"rtl"===getComputedStyle(document.getElementsByClassName("apbct_settings-title")[0]).direction&&jQuery(".apbct_switchers").css("text-align","right"),jQuery("#apbct_showApiKey").on("click",function(){jQuery(".apbct_setting---apikey").val(jQuery(".apbct_setting---apikey").attr("key")),jQuery(".apbct_setting---apikey+div").show(),jQuery(this).fadeOut(300)});var t=new Date;jQuery("#ct_admin_timezone").val(t.getTimezoneOffset()/60*-1),jQuery("#apbct_gdpr_open_modal").on("click",function(){jQuery("#gdpr_dialog").dialog({modal:!0,show:!0,position:{my:"center",at:"center",of:window},width:+jQuery("#wpbody").width()/100*70,height:"auto",title:"GDPR compliance",draggable:!1,resizable:!1,closeText:"Close"})}),jQuery("#apbct_button__get_key_auto").on("click",function(){apbct_admin_sendAJAX({action:"apbct_get_key_auto"},{timeout:25e3,button:document.getElementById("apbct_button__get_key_auto"),spinner:jQuery("#apbct_button__get_key_auto .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__get_key_auto .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__get_key_auto .apbct_success").hide(300)},2e3),t.reload&&document.location.reload(),t.getTemplates&&(cleantalkModal.loaded=t.getTemplates,cleantalkModal.open(),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}))}})}),jQuery(document).on("click","#apbct_settings_templates_import_button",function(){jQuery("#apbct-ajax-result").remove();var t,c,e=jQuery("option:selected",jQuery("#apbct_settings_templates_import"));jQuery("#apbct_settings_templates_import_name").css("border-color","inherit"),void 0!==e.data("id")?(t={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")},c=this,apbct_admin_sendAJAX({action:"settings_templates_import",data:t},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_import_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})):console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");if(e.css("border-color","inherit"),void 0!==t.data("id")){if("new_template"===t.data("id")){var n=e.val();if(""===n)return void e.css("border-color","red");var a={template_name:n}}else a={template_id:t.data("id")};var c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:a},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}else console.log('Attribute "data-id" not set for the option.')}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){var c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("<p id='apbct-ajax-result' class='success'>"+t.data+"</p>").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("<p id='apbct-ajax-result' class='error'>"+t.data+"</p>").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&document.location.reload()}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){self=jQuery(this),apbct_settings__showDescription(self,self.attr("setting"))}),(jQuery("#apbct_renew_notice").length||jQuery("#apbct_trial_notice").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()})});
2
  //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map
js/cleantalk-admin-settings-page.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('.apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('.apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#apbct_renew_notice').length || jQuery('#apbct_trial_notice').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\t\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('#apbct_renew_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_renew_notice').hide('slow');\n\t\t\t\t\t\tif (jQuery('#apbct_trial_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_trial_notice').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\tconsole.log( elem.getAttribute('id') );\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='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_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 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}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","console","log","getAttribute","state","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","ready","getComputedStyle","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find"],"mappings":"AA0NA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QAChCF,OAAO,uBAAuBC,QACjCD,OAAO,uBAAuBE,KAAK,QACpCC,cAAcb,QAKhB,KAUJ,SAASc,gBAAgBC,GAErB,IAAK,IAA6BC,EAAzBC,EAAE,EAAGC,GADdH,EAAQA,EAAMI,MAAM,MACMR,OAAaM,EAAIC,EAAKD,IAC5CD,EAAMN,OAAO,IAAIK,EAAME,IACvBF,EAAME,GAAoB,IAAfD,EAAIL,OAAeD,OAAO,IAAIK,EAAME,IAAMD,EAEzD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cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\t// Crunch for Right to Left direction languages\n\tif(document.getElementsByClassName('apbct_settings-title')[0]) {\n\t\tif(getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl'){\n\t\t\tjQuery('.apbct_switchers').css('text-align', 'right');\n\t\t}\n\t}\n\n\t// Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(){\n jQuery('.apbct_setting---apikey').val(jQuery('.apbct_setting---apikey').attr('key'));\n jQuery('.apbct_setting---apikey+div').show();\n jQuery(this).fadeOut(300);\n });\n\n\tvar d = new Date();\n\tjQuery('#ct_admin_timezone').val(d.getTimezoneOffset()/60*(-1));\n\t\n\t// GDPR modal window\n\tjQuery('#apbct_gdpr_open_modal').on('click', function(){\n\t\tjQuery('#gdpr_dialog').dialog({\n\t\t\tmodal:true, \n\t\t\tshow: true,\n\t\t\tposition: { my: \"center\", at: \"center\", of: window },\n\t\t\twidth: +(jQuery('#wpbody').width() / 100 * 70), // 70% of #wpbody\n\t\t\theight: 'auto',\n\t\t\ttitle: 'GDPR compliance',\n\t\t\tdraggable: false,\n\t\t\tresizable: false,\n\t\t\tcloseText: \"Close\",\n\t\t});\n\t});\n\n\t// Key KEY automatically\n\tjQuery('#apbct_button__get_key_auto').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_get_key_auto'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__get_key_auto' ),\n\t\t\t\tspinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\tif(result.getTemplates) {\n\t\t\t\t\t\tcleantalkModal.loaded = result.getTemplates;\n\t\t\t\t\t\tcleantalkModal.open();\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Import settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_import_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_import_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tvar data = {\n\t\t\t'template_id' : optionSelected.data('id'),\n\t\t\t'template_name' : optionSelected.data('name'),\n\t\t\t'settings' : optionSelected.data('settings')\n\t\t};\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_import', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Export settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_export_button', function(){\n\t\tjQuery('#apbct-ajax-result').remove();\n\t\tvar optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n\t\tvar templateNameInput = jQuery('#apbct_settings_templates_export_name');\n\t\ttemplateNameInput.css('border-color', 'inherit');\n\t\tif( typeof optionSelected.data('id') === \"undefined\" ) {\n\t\t\tconsole.log( 'Attribute \"data-id\" not set for the option.' );\n\t\t\treturn;\n\t\t}\n\t\tif( optionSelected.data('id') === 'new_template' ) {\n\t\t\tvar templateName = templateNameInput.val();\n\t\t\tif( templateName === '' ) {\n\t\t\t\ttemplateNameInput.css('border-color', 'red');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar data = {\n\t\t\t\t'template_name' : templateName\n\t\t\t}\n\t\t} else {\n\t\t\tvar data = {\n\t\t\t\t'template_id' : optionSelected.data('id')\n\t\t\t}\n\t\t}\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_export', data: data},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Reset settings\n\tjQuery( document ).on('click', '#apbct_settings_templates_reset_button', function(){\n\t\tvar button = this;\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'settings_templates_reset'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: button,\n\t\t\t\tspinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tif(result.success) {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='success'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t\tjQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n\t\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);}, 2000);\n\t\t\t\t\t\tdocument.addEventListener(\"cleantalkModalClosed\", function( e ) {\n\t\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tsetTimeout(function(){cleantalkModal.close()}, 2000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery( \"<p id='apbct-ajax-result' class='error'>\" + result.data + \"</p>\" ).insertAfter( jQuery(button) );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\t// Sync button\n\tjQuery('#apbct_button__sync').on('click', function(){\n\t\tapbct_admin_sendAJAX(\n\t\t\t{action: 'apbct_sync'},\n\t\t\t{\n\t\t\t\ttimeout: 25000,\n\t\t\t\tbutton: document.getElementById('apbct_button__sync' ),\n\t\t\t\tspinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n\t\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\t\tjQuery('#apbct_button__sync .apbct_success').show(300);\n\t\t\t\t\tsetTimeout(function(){jQuery('#apbct_button__sync .apbct_success').hide(300);}, 2000);\n\t\t\t\t\tif(result.reload)\n\t\t\t\t\t\tdocument.location.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t});\n\n\tif( ctSettingsPage.key_changed )\n\t\tjQuery('#apbct_button__sync').click();\n\n\tjQuery(document).on('click', '.apbct_settings-long_description---show', function(){\n\t\tself = jQuery(this);\n\t\tapbct_settings__showDescription(self, self.attr('setting'));\n\t});\n\n\tif (jQuery('#apbct_renew_notice').length || jQuery('#apbct_trial_notice').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\t\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('#apbct_renew_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_renew_notice').hide('slow');\n\t\t\t\t\t\tif (jQuery('#apbct_trial_notice').length)\n\t\t\t\t\t\t\tjQuery('#apbct_trial_notice').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\tconsole.log( elem.getAttribute('id') );\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='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_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 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}"],"names":["apbct_banner_check","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbct_get_elems","elems","tmp","i","len","split","apbct_get_elems__native","out","forEach","elem","arr","document","getElementById","getElementsByClassName","key","push","apbct_show_hide_elem","each","label","next","prev","is","show","apbctSettingsDependencies","ids","enable","isNaN","console","log","getAttribute","state","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","ready","getComputedStyle","direction","val","attr","this","fadeOut","d","Date","getTimezoneOffset","dialog","modal","my","at","of","window","width","height","draggable","resizable","closeText","timeout","button","setTimeout","reload","location","getTemplates","cleantalkModal","loaded","open","addEventListener","optionSelected","template_id","template_name","settings","notJson","success","insertAfter","close","templateNameInput","templateName","ctSettingsPage","key_changed","click","self","find"],"mappings":"AA0NA,SAASA,qBACR,IAAIC,EAAgBC,YAAa,WAChCC,qBACC,CAACC,OAAQ,sCACT,CACCC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACpCH,EAAOI,qBACNC,OAAO,uBAAuBC,QACjCD,OAAO,uB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,gCAAgCiE,KAAMA,KAAKxC,KAAK,eAG7ChE,OAAO,uBAAuBC,QAAUD,OAAO,uBAAuBC,SACzEZ,qBAEDW,OAAOe,UAAU4C,GAAG,SAAU,mCAAmC,WAE7B,iBADd3D,OAAO,kBAAmBiE,MAC3BrE,KAAK,MACxBI,OAAOiE,MAAMrB,SAASA,SAAS6D,KAAK,yCAAyC/E,OAE7E1B,OAAOiE,MAAMrB,SAASA,SAAS6D,KAAK,yCAAyCvG"}
js/cleantalk-admin.min.js CHANGED
@@ -1 +1,2 @@
1
- function apbct_admin_sendAJAX(n,o,a){var t=o.callback||null,l=o.callback_context||null,r=o.callback_params||null,e=o.async||!0,c=o.notJson||null,s=o.timeout||15e3,u=(a=a||null,o.button||null),i=o.spinner||null,p=o.progressbar||null;"string"==typeof n?n=n+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(n._ajax_nonce=ctAdminCommon._ajax_nonce,n.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),i&&jQuery(i).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,async:e,success:function(e){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),c||(e=JSON.parse(e)),e.error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):t&&(r?t.apply(l,r.concat(e,n,o,a)):t(e,n,o,a))},error:function(e,n,o){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o),o&&alert(o)},timeout:s})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6);document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap")});
 
1
+ function apbct_admin_sendAJAX(n,o,a){var t=o.callback||null,l=o.callback_context||null,r=o.callback_params||null,e=o.async||!0,c=o.notJson||null,s=o.timeout||15e3,a=a||null,u=o.button||null,i=o.spinner||null,p=o.progressbar||null;"string"==typeof n?n=n+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(n._ajax_nonce=ctAdminCommon._ajax_nonce,n.no_cache=Math.random()),u&&(u.setAttribute("disabled","disabled"),u.style.cursor="not-allowed"),i&&jQuery(i).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:n,async:e,success:function(e){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),c||(e=JSON.parse(e)),e.error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),alert("Error happens: "+(e.error||"Unkown"))):t&&(r?t.apply(l,r.concat(e,n,o,a)):t(e,n,o,a))},error:function(e,n,o){u&&(u.removeAttribute("disabled"),u.style.cursor="pointer"),i&&jQuery(i).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(n),console.log(o),o&&alert(o)},timeout:s})}jQuery(document).ready(function(){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6);document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap")});
2
+ //# sourceMappingURL=cleantalk-admin.min.js.map
js/cleantalk-admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-admin.js"],"names":["apbct_admin_sendAJAX","data","params","obj","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","cookie","toU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,GACZE,QAAQC,IAAIF,GACTA,GACFL,MAAMK,IAER/B,QAASA,IAlEXY,OAAOsB,UAAUC,MAAM,WAGtBvB,OAAO,wBAAwBwB,GAAG,QAAS,SAAU,WACpD,IAAIC,EAAU,IAAIC,MAAK,IAAIA,MAAOC,UAAY,QAC9CL,SAASM,OAAS,iDAAmDH,EAAQI,cAAgB,mBAG9F7B,OAAO,mDAAmDC,IAAI,cAAc"}
1
+ {"version":3,"file":"cleantalk-admin.min.js","sources":["cleantalk-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Auto update banner close handler\n\tjQuery('.apbct_update_notice').on('click', 'button', function(){\n\t\tvar ct_date = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n\t\tdocument.cookie = \"apbct_update_banner_closed=1; path=/; expires=\" + ct_date.toUTCString() + \"; samesite=lax\";\n\t});\n\t\n\tjQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space','nowrap');\n\t\n});\nfunction apbct_admin_sendAJAX(data, params, obj){\n\n\t// Default params\n\tvar callback = params.callback || null;\n\tvar callback_context = params.callback_context || null;\n\tvar callback_params = params.callback_params || null;\n\tvar async = params.async || true;\n\tvar notJson = params.notJson || null;\n\tvar timeout = params.timeout || 15000;\n\tvar obj = obj || null;\n\tvar button = params.button || null;\n\tvar spinner = params.spinner || null;\n\tvar progressbar = params.progressbar || null;\n\n\tif(typeof (data) === 'string') {\n\t\tdata = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n\t} else {\n\t\tdata._ajax_nonce = ctAdminCommon._ajax_nonce;\n\t\tdata.no_cache = Math.random();\n\t}\n\t// Button and spinner\n\tif(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n\tif(spinner) jQuery(spinner).css('display', 'inline');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ctAdminCommon._ajax_url,\n\t\tdata: data,\n\t\tasync: async,\n\t\tsuccess: function(result){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tif(!notJson) result = JSON.parse(result);\n\t\t\tif(result.error){\n\t\t\t\tsetTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n\t\t\t\talert('Error happens: ' + (result.error || 'Unkown'));\n\t\t\t}else{\n\t\t\t\tif(callback) {\n\t\t\t\t\tif (callback_params)\n\t\t\t\t\t\tcallback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n\t\t\t\t\telse\n\t\t\t\t\t\tcallback(result, data, params, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown){\n\t\t\tif(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n\t\t\tif(spinner) jQuery(spinner).css('display', 'none');\n\t\t\tconsole.log('APBCT_AJAX_ERROR');\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t\tif(errorThrown)\n\t\t\t\talert(errorThrown);\n\t\t},\n\t\ttimeout: timeout,\n\t});\n}"],"names":["apbct_admin_sendAJAX","data","params","obj","callback","callback_context","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","document","ready","on","ct_date","Date","getTime","cookie","toUTCString"],"mappings":"AAWA,SAASA,qBAAqBC,EAAMC,EAAQC,GAG3C,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,QAAS,EACxBC,EAAcN,EAAOM,SAAe,KACpCC,EAAcP,EAAOO,SAAe,KACpCN,EAAcA,GA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C,IAAI,cAAc"}
js/cleantalk-comments-editscreen.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-comments-editscreen.min.js","sources":["cleantalk-comments-editscreen.js"],"sourcesContent":["function ct_is_email(str){\r\n\treturn str.search(/.*@.*\\..*/);\r\n}\r\nfunction ct_is_ip(str){\r\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\r\n\t/* Shows link to blacklists near every email and IP address */\r\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\r\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\r\n\t\t\tvar ct_curr_str = jQuery(this).html();\r\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\r\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t/* Feedback for comments */\r\n\tvar ct_comment_id;\r\n\t\r\n\t// For approved\r\n\tjQuery('span.approve').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\r\n\t\r\n\t// For unapprove\r\n\tjQuery('span.unapprove').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\r\n\t});\r\n\t\r\n\t// For spammed\r\n\tjQuery('span.spam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tundo_comment_id = ct_comment_id;\r\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\r\n\t\t\r\n\t\tsetTimeout(function(){\r\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\r\n\t\t\t\tvar result = jQuery(this).attr('href');\r\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\r\n\t\t\t\tct_comment_id = result[1];\r\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\r\n\t\t\t});\r\n\t\t}, 202);\r\n\t\t\r\n\t});\r\n\t\r\n\t// For unspammed\r\n\tjQuery('span.unspam').on('click', function(){\r\n\t\tvar result = jQuery(this).children('a').attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\r\n\t});\r\n\t\r\n\t// For untrashed\r\n\tjQuery('span.untrash a').on('click', function(){\r\n\t\tvar result = jQuery(this).attr('href');\r\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\r\n\t\tct_comment_id = result[1];\r\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\r\n\t});\t\r\n});\r\n\r\n// Send feedback to backend\r\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\r\n\t\r\n\tvar data = {\r\n\t\t'action': 'ct_feedback_comment',\r\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\r\n\t\t'comment_id': ct_comment_id,\r\n\t\t'comment_status': ct_comment_status\r\n\t};\r\n\t\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(msg){\r\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\r\n\t\t},\r\n error: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\tconsole.log(jqXHR);\r\n\t\t\tconsole.log(textStatus);\r\n\t\t\tconsole.log(errorThrown);\r\n\t\t},\r\n timeout: 5000\r\n\t});\r\n}\r\n\r\n// Outputs CT message about feedback\r\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\r\n\tif(ct_result == 1){\r\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\r\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\r\n\t\t}\r\n\t\tif(ct_comment_status == 'spam'){\r\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\r\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\r\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\r\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg);\r\n\t\t\t}else{\r\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\r\n\t\t\t\t.html('')\r\n\t\t\t\t.show()\r\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\r\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\r\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif(ct_result == 0){\r\n\t\t// Error occurred\r\n\t}if(ct_result == 'no_hash'){\r\n\t\t// No hash for this comment\r\n\t}\r\n}\r\n"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg","is","document","ready","parseInt","ct_show_check_links","each","ct_curr_str","this","after","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAwEnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,UAErD,QAArB9B,IACCS,OAAO,MAAMsB,GAAG,SAAShC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiByB,kBAE9BrB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,O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AIpDjC,OAAO,kBAAkBgC,GAAG,QAAS,WACpC,IACAC,GADIA,EAASjC,OAAO6B,MAAMK,KAAK,SACfC,MAAM,8BACtB7C,EAAgB2C,EAAO,GACvBM,gBAAkBlD,yBAAyBC,EAAe,UAAW"}
1
+ {"version":3,"file":"cleantalk-comments-editscreen.min.js","sources":["cleantalk-comments-editscreen.js"],"sourcesContent":["function ct_is_email(str){\n\treturn str.search(/.*@.*\\..*/);\n}\nfunction ct_is_ip(str){\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\n}\n\njQuery(document).ready(function(){\n\n\t/* Shows link to blacklists near every email and IP address */\n\tif(parseInt(ctCommentsScreen.ct_show_check_links))\n\t\tjQuery('.column-author a, .comment-author a').each(function(){\n\t\t\tvar ct_curr_str = jQuery(this).html();\n\t\t\tif(ct_is_email(ct_curr_str) != -1 || ct_is_ip(ct_curr_str) != -1){\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctCommentsScreen.ct_img_src_new_tab+'\"></a>');\n\t\t\t}\n\t\t});\n\t\t\n\t/* Feedback for comments */\n\tvar ct_comment_id;\n\t\n\t// For approved\n\tjQuery('span.approve').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\n\t\n\t// For unapprove\n\tjQuery('span.unapprove').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\t\t\n\t});\n\t\n\t// For spammed\n\tjQuery('span.spam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tundo_comment_id = ct_comment_id;\n\t\tct_send_feedback_request(ct_comment_id, 'spam', 0);\n\t\t\n\t\tsetTimeout(function(){\n\t\t\tjQuery('tr#undo-'+ct_comment_id+' span.unspam a').click(function(){\n\t\t\t\tvar result = jQuery(this).attr('href');\n\t\t\t\tresult = result.match(/^comment\\.php\\?.*&c=(\\d*).*/);\n\t\t\t\tct_comment_id = result[1];\n\t\t\t\tct_send_feedback_request(ct_comment_id, 'approve', 1);\n\t\t\t});\n\t\t}, 202);\n\t\t\n\t});\n\t\n\t// For unspammed\n\tjQuery('span.unspam').on('click', function(){\n\t\tvar result = jQuery(this).children('a').attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tct_send_feedback_request(ct_comment_id, 'approve', 0);\n\t});\n\t\n\t// For untrashed\n\tjQuery('span.untrash a').on('click', function(){\n\t\tvar result = jQuery(this).attr('href');\n\t\tresult = result.match(/^comment\\.php\\?.*c=(\\d*).*/);\n\t\tct_comment_id = result[1];\n\t\tfeedback_result = ct_send_feedback_request(ct_comment_id, 'approve', 0);\t\t\n\t});\t\n});\n\n// Send feedback to backend\nfunction ct_send_feedback_request(ct_comment_id, ct_comment_status, ct_undo){\n\t\n\tvar data = {\n\t\t'action': 'ct_feedback_comment',\n\t\t'security': ctCommentsScreen.ct_ajax_nonce,\n\t\t'comment_id': ct_comment_id,\n\t\t'comment_status': ct_comment_status\n\t};\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_feedback_message_output(ct_comment_id, ct_comment_status, msg, ct_undo);\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tconsole.log(jqXHR);\n\t\t\tconsole.log(textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t},\n timeout: 5000\n\t});\n}\n\n// Outputs CT message about feedback\nfunction ct_feedback_message_output(ct_comment_id, ct_comment_status, ct_result, ct_undo){\n\tif(ct_result == 1){\n\t\tif(ct_comment_status == 'approve' && !ct_undo){\n\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.css('background', 'rgba(110,240,110,0.7)')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\n\t\t}\n\t\tif(ct_comment_status == 'spam'){\n\t\t\tif(jQuery('tr').is('#undo-'+ct_comment_id)){\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id)\n\t\t\t\t\t.css('background', 'rgba(240,110,110,0.7)');\n\t\t\t\tjQuery('tr#undo-'+ct_comment_id+' div.spam-undo-inside')\n\t\t\t\t\t.append(\" \"+ctCommentsScreen.ct_feedback_msg);\n\t\t\t}else{\n\t\t\t\tjQuery('tr#comment-'+ct_comment_id)\n\t\t\t\t.html('')\n\t\t\t\t.show()\n\t\t\t\t.css('background', 'rgba(240,110,110,0.7)')\n\t\t\t\t.append(\"<td colspan='5'></td>\").children('td')\n\t\t\t\t\t.append(\"<div class='spam-undo-inside'>\"+ctCommentsScreen.ct_feedback_msg+\"</div>\");\n\t\t\t}\n\t\t}\n\t}\n\tif(ct_result == 0){\n\t\t// Error occurred\n\t}if(ct_result == 'no_hash'){\n\t\t// No hash for this comment\n\t}\n}\n"],"names":["ct_is_email","str","search","ct_is_ip","ct_send_feedback_request","ct_comment_id","ct_comment_status","ct_undo","data","action","security","ctCommentsScreen","ct_ajax_nonce","comment_id","comment_status","jQuery","ajax","type","url","ajaxurl","success","msg","ct_feedback_message_output","error","jqXHR","textStatus","errorThrown","console","log","timeout","ct_result","html","show","append","children","css","ct_feedback_msg","is","document","ready","parseInt","ct_show_check_links","each","ct_curr_str","this","after","ct_img_src_new_tab","on","result","attr","match","undo_comment_id","setTimeout","click","feedback_result"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAwEnB,SAASE,yBAAyBC,EAAeC,EAAmBC,GAEnE,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,iBAAiBC,cAC7BC,WAAcR,EACdS,eAAkBR,GAGnBS,OAAOC,KAAK,CACXC,KAAM,OACNC,IAAKC,QACLX,KAAMA,EACNY,QAAS,SAASC,GACjBC,2BAA2BjB,EAAeC,EAAmBe,EAAKd,IAE7DgB,MAAO,SAASC,EAAOC,EAAYC,GACxCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEPG,QAAS,MAKjB,SAASP,2BAA2BjB,EAAeC,EAAmBwB,EAAWvB,GAChE,GAAbuB,IACsB,WAArBxB,GAAmCC,GACrCQ,OAAO,cAAcV,GACnB0B,KAAK,IACLC,OACAC,OAAO,yBAAyBC,SAAS,MACxCC,IAAI,aAAc,yBAClBF,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,UAErD,QAArB9B,IACCS,OAAO,MAAMsB,GAAG,SAAShC,IAC3BU,OAAO,WAAWV,GAChB8B,IAAI,aAAc,yBACpBpB,OAAO,WAAWV,EAAc,yBAC9B4B,OAAO,IAAItB,iBAAiByB,kBAE9BrB,OAAO,cAAcV,GACpB0B,KAAK,IACLC,OACAG,IAAI,aAAc,yBAClBF,OAAO,yBAAyBC,SAAS,MACxCD,OAAO,iCAAiCtB,iBAAiByB,gBAAgB,YArH/ErB,OAAOuB,UAAUC,MAAM,WAYtB,IAAIlC,EATDmC,SAAS7B,iBAAiB8B,sBAC5B1B,OAAO,uCAAuC2B,KAAK,WAClD,IAAIC,EAAc5B,OAA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(document).ready(function(){jQuery(".ct_widget_refresh_link").on("click",function(){jQuery(".ct_preloader").show(),setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),setTimeout(function(){jQuery("#ct_refresh_form").submit()},2500)}),"#ct_widget"==location.hash&&setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),jQuery("#ct_widget_wrapper").parent().css("padding",0);var a=document.getElementById("ct_widget_chart"),o=navigator.language||navigator.userLanguage;google.charts.load("current",{packages:["corechart","bar"]}),google.charts.setOnLoadCallback(function(){var t=new google.visualization.DataTable;t.addColumn("string","Spam Blocked"),t.addColumn("number","Frequency"),function(t){var e=new Intl.DateTimeFormat(o,{month:"short",day:"numeric"});t.sort(function(t,e){return new Date(t[0])-new Date(e[0])}),t.forEach(function(t){t[0]=Date.parse(t[0]),t[0]=e.format(t[0])})}(apbctDashboardWidget.data),t.addRows(apbctDashboardWidget.data);var e={width:jQuery(".ct_widget_block").first().width(),height:300,colors:["steelblue"],legend:"none",bar:{groupWidth:"95%"},chartArea:{left:30,top:20,width:"93%",height:"80%"},vAxis:{gridlines:{count:5}}};if(a){new google.visualization.ColumnChart(a).draw(t,e)}})});
2
  //# sourceMappingURL=cleantalk-dashboard-widget.min.js.map
1
+ jQuery(document).ready(function(){jQuery(".ct_widget_refresh_link").on("click",function(){jQuery(".ct_preloader").show(),setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),setTimeout(function(){jQuery("#ct_refresh_form").submit()},2500)}),"#ct_widget"==location.hash&&setTimeout(function(){window.scrollTo(0,jQuery("#ct_widget_wrapper").offset().top-130)},1),jQuery("#ct_widget_wrapper").parent().css("padding",0);var a=document.getElementById("ct_widget_chart"),o=navigator.language||navigator.userLanguage;google.charts.load("current",{packages:["corechart","bar"]}),google.charts.setOnLoadCallback(function(){var t=new google.visualization.DataTable;t.addColumn("string","Spam Blocked"),t.addColumn("number","Frequency"),function(t){var e=new Intl.DateTimeFormat(o,{month:"short",day:"numeric"});t.sort(function(t,e){return new Date(t[0])-new Date(e[0])}),t.forEach(function(t){t[0]=Date.parse(t[0]),t[0]=e.format(t[0])})}(apbctDashboardWidget.data),t.addRows(apbctDashboardWidget.data);var e={width:jQuery(".ct_widget_block").first().width(),height:300,colors:["steelblue"],legend:"none",bar:{groupWidth:"95%"},chartArea:{left:30,top:20,width:"93%",height:"80%"},vAxis:{gridlines:{count:5}}};{a&&new google.visualization.ColumnChart(a).draw(t,e)}})});
2
  //# sourceMappingURL=cleantalk-dashboard-widget.min.js.map
js/cleantalk-dashboard-widget.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-dashboard-widget.js"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","ct_chart","getElementById","locale","navigator","language","userLanguage","google","charts","load","packages","setOnLoadCallback","data","visualization","DataTable","addColumn","date","date_formatter","Intl","DateTimeFormat","month","day","sort","a","b","Date","forEach","d","parse","format","ctParseData","apbctDashboardWidget","addRows","options","width","first","height","colors","legend","bar","groupWidth","chartArea","left","vAxis","gridlines","count","ColumnChart","draw"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,2BAA2BG,GAAG,QAAS,WAC7CH,OAAO,iBAAiBI,OACxBC,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAC7FJ,WAAW,WAAWL,OAAO,oBAAoBU,UAAY,QAG1C,cAAjBC,SAASC,MACXP,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAG9FT,OAAO,sBAAsBa,SAASC,IAAI,UAAW,GAGrD,IAAIC,EAAWd,SAASe,eAAe,mBACtCC,EAASC,UAAUC,UAAYD,UAAUE,aAgB1CC,OAAOC,OAAOC,KAAK,UAAW,CAACC,SAAS,CAAC,YAAa,SACtDH,OAAOC,OAAOG,kBAEd,WACC,IAAIC,EAAO,IAAIL,OAAOM,cAAcC,UACpCF,EAAKG,UAAU,SAAU,gBACzBH,EAAKG,UAAU,SAAU,aApB1B,SAAqBC,GACpB,IAAIC,EAAiB,IAAIC,KAAKC,eAAehB,EAAQ,CACpDiB,MAAO,QACPC,IAAK,YAENL,EAAKM,KAAK,SAASC,EAAEC,GACpB,OAAO,IAAIC,KAAKF,EAAE,IAAM,IAAIE,KAAKD,EAAE,MAEpCR,EAAKU,QAAQ,SAASC,GACrBA,EAAE,GAAKF,KAAKG,MAAMD,EAAE,IACpBA,EAAE,GAAKV,EAAeY,OAAOF,EAAE,MAYhCG,CAAYC,qBAAqBnB,MACjCA,EAAKoB,QAAQD,qBAAqBnB,MAElC,IAAIqB,EAAU,CACbC,MAAOhD,OAAO,oBAAoBiD,QAAQD,QAC1CE,OAAQ,IACRC,OAAQ,CAAC,aACTC,OAAQ,OACRC,IAAK,CAACC,WAAY,OAClBC,UAAU,CAACC,KAAK,GAAG/C,IAAI,GAAGuC,MAAM,MAAME,OAAO,OAC7CO,MAAO,CAAEC,UAAW,CAAEC,MAAO,KAG9B,GAAG5C,EAAS,CACC,IAAIM,OAAOM,cAAciC,YAAY7C,GAC3C8C,KAAKnC,EAAMqB","file":"cleantalk-dashboard-widget.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\t\r\n\t// Set \"refresh\" link handler\r\n\tjQuery(\".ct_widget_refresh_link\").on('click', function(){\r\n\t\tjQuery('.ct_preloader').show();\r\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\t\t\r\n\t\tsetTimeout(function(){jQuery(\"#ct_refresh_form\").submit();}, 2500);\r\n\t});\r\n\t\r\n\tif(location.hash == '#ct_widget')\r\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\r\n\t\r\n\t// Fixing default wrapper style\r\n\tjQuery(\"#ct_widget_wrapper\").parent().css('padding', 0);\r\n\t\r\n\t// Chart \r\n\tvar ct_chart = document.getElementById('ct_widget_chart'),\r\n\t\tlocale = navigator.language || navigator.userLanguage;\r\n\t\t\r\n\tfunction ctParseData(date){\r\n\t\tvar date_formatter = new Intl.DateTimeFormat(locale, {\r\n\t\t\tmonth: \"short\",\r\n\t\t\tday: \"numeric\"\r\n\t\t});\t\r\n\t\tdate.sort(function(a,b){\r\n\t\t\treturn new Date(a[0]) - new Date(b[0]) \r\n\t\t});\t\t\t\r\n\t\tdate.forEach(function(d){\t\r\n\t\t\td[0] = Date.parse(d[0]);\r\n\t\t\td[0] = date_formatter.format(d[0]);\r\n\t\t});\t\t\r\n\t}\r\n\t\t\r\n\tgoogle.charts.load('current', {packages:['corechart', 'bar']});\r\n\tgoogle.charts.setOnLoadCallback(drawStuff);\r\n\r\n\tfunction drawStuff() {\r\n\t\tvar data = new google.visualization.DataTable();\r\n\t\tdata.addColumn('string', 'Spam Blocked');\r\n\t\tdata.addColumn('number', 'Frequency');\r\n\t\t\r\n\t\tctParseData(apbctDashboardWidget.data);\r\n\t\tdata.addRows(apbctDashboardWidget.data);\r\n\t\r\n\t\tvar options = {\r\n\t\t\twidth: jQuery(\".ct_widget_block\").first().width(),\r\n\t\t\theight: 300,\r\n\t\t\tcolors: ['steelblue'],\r\n\t\t\tlegend: 'none',\r\n\t\t\tbar: {groupWidth: '95%'},\r\n\t\t\tchartArea:{left:30,top:20,width:'93%',height:'80%'},\r\n\t\t\tvAxis: { gridlines: { count: 5 } }\r\n\t\t};\r\n\r\n\t\tif(ct_chart){\r\n\t\t\tvar chart = new google.visualization.ColumnChart(ct_chart);\r\n\t\t\tchart.draw(data, options);\r\n\t\t}\r\n\t};\t\r\n});"]}
1
+ {"version":3,"file":"cleantalk-dashboard-widget.min.js","sources":["cleantalk-dashboard-widget.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set \"refresh\" link handler\n\tjQuery(\".ct_widget_refresh_link\").on('click', function(){\n\t\tjQuery('.ct_preloader').show();\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\t\t\n\t\tsetTimeout(function(){jQuery(\"#ct_refresh_form\").submit();}, 2500);\n\t});\n\t\n\tif(location.hash == '#ct_widget')\n\t\tsetTimeout(function(){window.scrollTo(0, jQuery('#ct_widget_wrapper').offset().top - 130);}, 1);\n\t\n\t// Fixing default wrapper style\n\tjQuery(\"#ct_widget_wrapper\").parent().css('padding', 0);\n\t\n\t// Chart \n\tvar ct_chart = document.getElementById('ct_widget_chart'),\n\t\tlocale = navigator.language || navigator.userLanguage;\n\t\t\n\tfunction ctParseData(date){\n\t\tvar date_formatter = new Intl.DateTimeFormat(locale, {\n\t\t\tmonth: \"short\",\n\t\t\tday: \"numeric\"\n\t\t});\t\n\t\tdate.sort(function(a,b){\n\t\t\treturn new Date(a[0]) - new Date(b[0]) \n\t\t});\t\t\t\n\t\tdate.forEach(function(d){\t\n\t\t\td[0] = Date.parse(d[0]);\n\t\t\td[0] = date_formatter.format(d[0]);\n\t\t});\t\t\n\t}\n\t\t\n\tgoogle.charts.load('current', {packages:['corechart', 'bar']});\n\tgoogle.charts.setOnLoadCallback(drawStuff);\n\n\tfunction drawStuff() {\n\t\tvar data = new google.visualization.DataTable();\n\t\tdata.addColumn('string', 'Spam Blocked');\n\t\tdata.addColumn('number', 'Frequency');\n\t\t\n\t\tctParseData(apbctDashboardWidget.data);\n\t\tdata.addRows(apbctDashboardWidget.data);\n\t\n\t\tvar options = {\n\t\t\twidth: jQuery(\".ct_widget_block\").first().width(),\n\t\t\theight: 300,\n\t\t\tcolors: ['steelblue'],\n\t\t\tlegend: 'none',\n\t\t\tbar: {groupWidth: '95%'},\n\t\t\tchartArea:{left:30,top:20,width:'93%',height:'80%'},\n\t\t\tvAxis: { gridlines: { count: 5 } }\n\t\t};\n\n\t\tif(ct_chart){\n\t\t\tvar chart = new google.visualization.ColumnChart(ct_chart);\n\t\t\tchart.draw(data, options);\n\t\t}\n\t};\t\n});"],"names":["jQuery","document","ready","on","show","setTimeout","window","scrollTo","offset","top","submit","location","hash","parent","css","ct_chart","getElementById","locale","navigator","language","userLanguage","google","charts","load","packages","setOnLoadCallback","data","visualization","DataTable","addColumn","date","date_formatter","Intl","DateTimeFormat","month","day","sort","a","b","Date","forEach","d","parse","format","ctParseData","apbctDashboardWidget","addRows","options","width","first","height","colors","legend","bar","groupWidth","chartArea","left","vAxis","gridlines","count","ColumnChart","draw"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGtBF,OAAO,2BAA2BG,GAAG,QAAS,WAC7CH,OAAO,iBAAiBI,OACxBC,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAC7FJ,WAAW,WAAWL,OAAO,oBAAoBU,UAAY,QAG1C,cAAjBC,SAASC,MACXP,WAAW,WAAWC,OAAOC,SAAS,EAAGP,OAAO,sBAAsBQ,SAASC,IAAM,MAAQ,GAG9FT,OAAO,sBAAsBa,SAASC,IAAI,UAAW,GAGrD,IAAIC,EAAWd,SAASe,eAAe,mBACtCC,EAASC,UAAUC,UAAYD,UAAUE,aAgB1CC,OAAOC,OAAOC,KAAK,UAAW,CAACC,SAAS,CAAC,YAAa,SACtDH,OAAOC,OAAOG,kBAEd,WACC,IAAIC,EAAO,IAAIL,OAAOM,cAAcC,UACpCF,EAAKG,UAAU,SAAU,gBACzBH,EAAKG,UAAU,SAAU,aApB1B,SAAqBC,GACpB,IAAIC,EAAiB,IAAIC,KAAKC,eAAehB,EAAQ,CACpDiB,MAAO,QACPC,IAAK,YAENL,EAAKM,KAAK,SAASC,EAAEC,GACpB,OAAO,IAAIC,KAAKF,EAAE,IAAM,IAAIE,KAAKD,EAAE,MAEpCR,EAAKU,QAAQ,SAASC,GACrBA,EAAE,GAAKF,KAAKG,MAAMD,EAAE,IACpBA,EAAE,GAAKV,EAAeY,OAAOF,EAAE,MAYhCG,CAAYC,qBAAqBnB,MACjCA,EAAKoB,QAAQD,qBAAqBnB,MAElC,IAAIqB,EAAU,CACbC,MAAOhD,OAAO,oBAAoBiD,QAAQD,QAC1CE,OAAQ,IACRC,OAAQ,CAAC,aACTC,OAAQ,OACRC,IAAK,CAACC,WAAY,OAClBC,UAAU,CAACC,KAAK,GAAG/C,IAAI,GAAGuC,MAAM,MAAME,OAAO,OAC7CO,MAAO,CAAEC,UAAW,CAAEC,MAAO,KAG9B,CAAG5C,GACU,IAAIM,OAAOM,cAAciC,YAAY7C,GAC3C8C,KAAKnC,EAAMqB"}
js/cleantalk-debug-ajax.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-debug-ajax.js"],"names":["jQuery","document","ready","console","log","ajaxComplete","event","xhr","settings","data"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAEtBC,QAAQC,IAAI,YAGZJ,OAAOC,UAAUI,aAAa,SAASC,EAAOC,EAAKC,EAAUC,GAC5DN,QAAQC,IAAI,YACZD,QAAQC,IAAI,YACZD,QAAQC,IAAIE,GACZH,QAAQC,IAAI,eACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAI,uBACZD,QAAQC,IAAII,GACZL,QAAQC,IAAI,WACZD,QAAQC,IAAIK","file":"cleantalk-debug-ajax.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\r\n\tconsole.log('CT debug');\r\n\r\n\t// Debug. Console all AJAX requests.\r\n\tjQuery(document).ajaxComplete(function(event, xhr, settings, data) {\r\n\t\tconsole.log(\"Success!\")\r\n\t\tconsole.log('Event:\\n');\r\n\t\tconsole.log(event);\r\n\t\tconsole.log('Response:\\n');\r\n\t\tconsole.log(xhr);\r\n\t\tconsole.log('Request settings:\\n');\r\n\t\tconsole.log(settings);\r\n\t\tconsole.log('Data:\\n');\r\n\t\tconsole.log(data);\r\n\t});\r\n\t\t\r\n});"]}
1
+ {"version":3,"file":"cleantalk-debug-ajax.min.js","sources":["cleantalk-debug-ajax.js"],"sourcesContent":["jQuery(document).ready(function(){\n\n\tconsole.log('CT debug');\n\n\t// Debug. Console all AJAX requests.\n\tjQuery(document).ajaxComplete(function(event, xhr, settings, data) {\n\t\tconsole.log(\"Success!\")\n\t\tconsole.log('Event:\\n');\n\t\tconsole.log(event);\n\t\tconsole.log('Response:\\n');\n\t\tconsole.log(xhr);\n\t\tconsole.log('Request settings:\\n');\n\t\tconsole.log(settings);\n\t\tconsole.log('Data:\\n');\n\t\tconsole.log(data);\n\t});\n\t\t\n});"],"names":["jQuery","document","ready","console","log","ajaxComplete","event","xhr","settings","data"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAEtBC,QAAQC,IAAI,YAGZJ,OAAOC,UAAUI,aAAa,SAASC,EAAOC,EAAKC,EAAUC,GAC5DN,QAAQC,IAAI,YACZD,QAAQC,IAAI,YACZD,QAAQC,IAAIE,GACZH,QAAQC,IAAI,eACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAI,uBACZD,QAAQC,IAAII,GACZL,QAAQC,IAAI,WACZD,QAAQC,IAAIK"}
js/cleantalk-public-admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- jQuery(document).ready(function(){jQuery(".ct_comment_info").parents().each(function(){if(0<(e=jQuery(this).css("background-color")).length&&"rgba(0, 0, 0, 0)"!=e)return jQuery(".ct_comment_info").css("background",e),!1});var c=jQuery(".ct_comment_info").prev().last().css("float");jQuery(".ct_comment_info").css("float",c);var t=jQuery(".ct_comment_info");jQuery(t).each(function(e,c){curr_elem=jQuery(c),curr_elem.parent().prepend(curr_elem)}),jQuery(".ct_this_is").on("click",function(){var t,a=jQuery(this),s=jQuery(this).siblings(".ct_feedback_wrap"),r=jQuery(".ct_feedback_msg");t=a.hasClass("ct_this_is_spam")?"spam":"approve";var e={action:"ct_feedback_comment",security:ctPublicAdmin.ct_ajax_nonce,comment_id:a.attr("commentid"),comment_status:t,change_status:1};jQuery.ajax({type:"POST",url:ctPublicAdmin.ajaxurl,data:e,success:function(e){a.hide(),a.siblings("span.ct_this_is").show(),jQuery(".ct_feedback_result").hide(),"approve"==t?jQuery(".ct_feedback_result_not_spam").show():jQuery(".ct_feedback_result_spam").show(),1==e?(r.addClass("ct_feedback_success"),r.html(ctPublicAdmin.ct_feedback_msg)):0==e?(r.addClass("ct_feedback_error"),r.html(ctPublicAdmin.ct_feedback_error)):"no_hash"==e&&(r.addClass("ct_feedback_no_hash"),r.html(ctPublicAdmin.ct_feedback_no_hash)),s.show(),s.css("display","inline-block");var c=s.data("interval_id");clearInterval(c),c=setTimeout(function(){s.fadeOut(1e3)},5e3),s.data("interval_id",c)},error:function(e,c,t){console.log(e),console.log(c),console.log(t)},timeout:5e3})})});
2
  //# sourceMappingURL=cleantalk-public-admin.min.js.map
1
+ jQuery(document).ready(function(){jQuery(".ct_comment_info").parents().each(function(){if(0<(e=jQuery(this).css("background-color")).length&&"rgba(0, 0, 0, 0)"!=e)return jQuery(".ct_comment_info").css("background",e),!1});var c=jQuery(".ct_comment_info").prev().last().css("float");jQuery(".ct_comment_info").css("float",c);var t=jQuery(".ct_comment_info");jQuery(t).each(function(e,c){curr_elem=jQuery(c),curr_elem.parent().prepend(curr_elem)}),jQuery(".ct_this_is").on("click",function(){var t=jQuery(this),a=jQuery(this).siblings(".ct_feedback_wrap"),s=jQuery(".ct_feedback_msg"),n=t.hasClass("ct_this_is_spam")?"spam":"approve",e={action:"ct_feedback_comment",security:ctPublicAdmin.ct_ajax_nonce,comment_id:t.attr("commentid"),comment_status:n,change_status:1};jQuery.ajax({type:"POST",url:ctPublicAdmin.ajaxurl,data:e,success:function(e){t.hide(),t.siblings("span.ct_this_is").show(),jQuery(".ct_feedback_result").hide(),"approve"==n?jQuery(".ct_feedback_result_not_spam").show():jQuery(".ct_feedback_result_spam").show(),1==e?(s.addClass("ct_feedback_success"),s.html(ctPublicAdmin.ct_feedback_msg)):0==e?(s.addClass("ct_feedback_error"),s.html(ctPublicAdmin.ct_feedback_error)):"no_hash"==e&&(s.addClass("ct_feedback_no_hash"),s.html(ctPublicAdmin.ct_feedback_no_hash)),a.show(),a.css("display","inline-block");var c=a.data("interval_id");clearInterval(c),c=setTimeout(function(){a.fadeOut(1e3)},5e3),a.data("interval_id",c)},error:function(e,c,t){console.log(e),console.log(c),console.log(t)},timeout:5e3})})});
2
  //# sourceMappingURL=cleantalk-public-admin.min.js.map
js/cleantalk-public-admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk-public-admin.js"],"names":["jQuery","document","ready","parents","each","e","this","css","length","ct_post_float","prev","last","ct_posts","indx","elem","curr_elem","parent","prepend","on","ct_comment_status","ct_current_button","ct_feedback_wrap","siblings","ct_feedback_msg","hasClass","data","action","security","ctPublicAdmin","ct_ajax_nonce","comment_id","attr","comment_status","change_status","ajax","type","url","ajaxurl","success","msg","hide","show","addClass","html","ct_feedback_error","ct_feedback_no_hash","ct_timeout_id","clearInterval","setTimeout","fadeOut","error","jqXHR","textStatus","errorThrown","console","log","timeout"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGvBF,OAAO,oBAAoBG,UAAUC,KAAK,WACxC,GAAwD,GAAnDC,EAAIL,OAAOM,MAAMC,IAAI,qBAAqBC,QAAmB,oBAALH,EAE5D,OADAL,OAAO,oBAAoBO,IAAI,aAAcF,IACtC,IAKT,IAAII,EAAgBT,OAAO,oBAAoBU,OAAOC,OAAOJ,IAAI,SACjEP,OAAO,oBAAoBO,IAAI,QAASE,GAExC,IAAIG,EAAWZ,OAAO,oBAEtBA,OAAOY,GAAUR,KAAK,SAASS,EAAMC,GACpCC,UAAYf,OAAOc,GACnBC,UAAUC,SAASC,QAAQF,aAI5Bf,OAAO,eAAekB,GAAG,QAAS,WAEjC,IAGCC,EAHGC,EAAoBpB,OAAOM,MAC9Be,EAAmBrB,OAAOM,MAAMgB,SAAS,qBACzCC,EAAkBvB,OAAO,oBAIzBmB,EADEC,EAAkBI,SAAS,mBACT,OAEA,UAErB,IAAIC,EAAO,CACVC,OAAU,sBACVC,SAAYC,cAAcC,cAC1BC,WAAcV,EAAkBW,KAAK,aACrCC,eAAkBb,EAClBc,cAAiB,GAGlBjC,OAAOkC,KAAK,CACXC,KAAM,OACNC,IAAKR,cAAcS,QACnBZ,KAAMA,EACNa,QAAS,SAASC,GACjBnB,EAAkBoB,OAClBpB,EAAkBE,SAAS,mBAAmBmB,OAE9CzC,OAAO,uBAAuBwC,OACN,WAArBrB,EACFnB,OAAO,gCAAgCyC,OAEvCzC,OAAO,4BAA4ByC,OAE1B,GAAPF,GACFhB,EAAgBmB,SAAS,uBACzBnB,EAAgBoB,KAAKf,cAAcL,kBACpB,GAAPgB,GAERhB,EAAgBmB,SAAS,qBACzBnB,EAAgBoB,KAAKf,cAAcgB,oBACpB,WAAPL,IAERhB,EAAgBmB,SAAS,uBACzBnB,EAAgBoB,KAAKf,cAAciB,sBAGpCxB,EAAiBoB,OACjBpB,EAAiBd,IAAI,UAAW,gBAEhC,IAAIuC,EAAgBzB,EAAiBI,KAAK,eAC1CsB,cAAcD,GACdA,EAAgBE,WAAW,WAC1B3B,EAAiB4B,QAAQ,MACvB,KACH5B,EAAiBI,KAAK,cAAeqB,IAEtCI,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbG,QAAS","file":"cleantalk-public-admin.min.js","sourcesContent":["jQuery(document).ready(function(){\r\n\t\r\n\t// Set background-color similar to parents\r\njQuery('.ct_comment_info').parents().each(function() {\r\n if ((e = jQuery(this).css('background-color')).length > 0 && e != 'rgba(0, 0, 0, 0)'){ \r\n \tjQuery('.ct_comment_info').css('background', e);\r\n \treturn false;\r\n }\r\n});\r\n\t\r\n\t// Set same float style with article\r\n\tvar ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');\r\n\tjQuery('.ct_comment_info').css('float', ct_post_float);\r\n\t\r\n\tvar ct_posts = jQuery('.ct_comment_info');\r\n\t\r\n\tjQuery(ct_posts).each(function(indx, elem){\r\n\t\tcurr_elem = jQuery(elem);\r\n\t\tcurr_elem.parent().prepend(curr_elem);\r\n\t});\r\n\t\r\n\t// Handler for buttons\r\n\tjQuery('.ct_this_is').on('click', function(){\r\n\t\t\r\n\t\tvar ct_current_button = jQuery(this),\r\n\t\t\tct_feedback_wrap = jQuery(this).siblings('.ct_feedback_wrap'),\r\n\t\t\tct_feedback_msg = jQuery('.ct_feedback_msg'),\r\n\t\t\tct_comment_status;\r\n\t\t\t\r\n\t\tif(ct_current_button.hasClass('ct_this_is_spam'))\r\n\t\t\tct_comment_status = 'spam';\r\n\t\telse\r\n\t\t\tct_comment_status = 'approve';\r\n\t\t\r\n\t\tvar data = {\r\n\t\t\t'action': 'ct_feedback_comment',\r\n\t\t\t'security': ctPublicAdmin.ct_ajax_nonce,\r\n\t\t\t'comment_id': ct_current_button.attr('commentid'),\r\n\t\t\t'comment_status': ct_comment_status,\r\n\t\t\t'change_status': 1\r\n\t\t};\r\n\t\t\r\n\t\tjQuery.ajax({\r\n\t\t\ttype: \"POST\",\r\n\t\t\turl: ctPublicAdmin.ajaxurl,\r\n\t\t\tdata: data,\r\n\t\t\tsuccess: function(msg){\r\n\t\t\t\tct_current_button.hide();\r\n\t\t\t\tct_current_button.siblings('span.ct_this_is').show();\r\n\t\t\t\t\r\n\t\t\t\tjQuery('.ct_feedback_result').hide();\r\n\t\t\t\tif(ct_comment_status == 'approve')\r\n\t\t\t\t\tjQuery('.ct_feedback_result_not_spam').show();\r\n\t\t\t\telse\r\n\t\t\t\t\tjQuery('.ct_feedback_result_spam').show();\r\n\t\t\t\t\r\n\t\t\t\tif(msg == 1){\r\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_success');\r\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_msg);\r\n\t\t\t\t}else if(msg == 0){\r\n\t\t\t\t\t// Error occurred\r\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_error');\r\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_error);\r\n\t\t\t\t}else if(msg == 'no_hash'){\r\n\t\t\t\t\t// No hash for this comment\r\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_no_hash');\r\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_no_hash);\r\n\t\t\t\t}\r\n\t\t\t\t// Hidding feedback message for every message type\r\n\t\t\t\tct_feedback_wrap.show();\r\n\t\t\t\tct_feedback_wrap.css('display', 'inline-block');\r\n\t\t\t\t\r\n\t\t\t\tvar ct_timeout_id = ct_feedback_wrap.data('interval_id');\r\n\t\t\t\tclearInterval(ct_timeout_id);\r\n\t\t\t\tct_timeout_id = setTimeout(function(){\r\n\t\t\t\t\tct_feedback_wrap.fadeOut(1000);\r\n\t\t\t\t}, 5000);\r\n\t\t\t\tct_feedback_wrap.data('interval_id', ct_timeout_id);\r\n\t\t\t},\r\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\r\n\t\t\t\tconsole.log(jqXHR);\r\n\t\t\t\tconsole.log(textStatus);\r\n\t\t\t\tconsole.log(errorThrown);\r\n\t\t\t},\r\n\t\t\ttimeout: 5000\r\n\t\t});\r\n\t});\r\n\t\r\n});"]}
1
+ {"version":3,"file":"cleantalk-public-admin.min.js","sources":["cleantalk-public-admin.js"],"sourcesContent":["jQuery(document).ready(function(){\n\t\n\t// Set background-color similar to parents\njQuery('.ct_comment_info').parents().each(function() {\n if ((e = jQuery(this).css('background-color')).length > 0 && e != 'rgba(0, 0, 0, 0)'){ \n \tjQuery('.ct_comment_info').css('background', e);\n \treturn false;\n }\n});\n\t\n\t// Set same float style with article\n\tvar ct_post_float = jQuery('.ct_comment_info').prev().last().css('float');\n\tjQuery('.ct_comment_info').css('float', ct_post_float);\n\t\n\tvar ct_posts = jQuery('.ct_comment_info');\n\t\n\tjQuery(ct_posts).each(function(indx, elem){\n\t\tcurr_elem = jQuery(elem);\n\t\tcurr_elem.parent().prepend(curr_elem);\n\t});\n\t\n\t// Handler for buttons\n\tjQuery('.ct_this_is').on('click', function(){\n\t\t\n\t\tvar ct_current_button = jQuery(this),\n\t\t\tct_feedback_wrap = jQuery(this).siblings('.ct_feedback_wrap'),\n\t\t\tct_feedback_msg = jQuery('.ct_feedback_msg'),\n\t\t\tct_comment_status;\n\t\t\t\n\t\tif(ct_current_button.hasClass('ct_this_is_spam'))\n\t\t\tct_comment_status = 'spam';\n\t\telse\n\t\t\tct_comment_status = 'approve';\n\t\t\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_comment',\n\t\t\t'security': ctPublicAdmin.ct_ajax_nonce,\n\t\t\t'comment_id': ct_current_button.attr('commentid'),\n\t\t\t'comment_status': ct_comment_status,\n\t\t\t'change_status': 1\n\t\t};\n\t\t\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ctPublicAdmin.ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tct_current_button.hide();\n\t\t\t\tct_current_button.siblings('span.ct_this_is').show();\n\t\t\t\t\n\t\t\t\tjQuery('.ct_feedback_result').hide();\n\t\t\t\tif(ct_comment_status == 'approve')\n\t\t\t\t\tjQuery('.ct_feedback_result_not_spam').show();\n\t\t\t\telse\n\t\t\t\t\tjQuery('.ct_feedback_result_spam').show();\n\t\t\t\t\n\t\t\t\tif(msg == 1){\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_success');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_msg);\n\t\t\t\t}else if(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_error');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_error);\n\t\t\t\t}else if(msg == 'no_hash'){\n\t\t\t\t\t// No hash for this comment\n\t\t\t\t\tct_feedback_msg.addClass('ct_feedback_no_hash');\n\t\t\t\t\tct_feedback_msg.html(ctPublicAdmin.ct_feedback_no_hash);\n\t\t\t\t}\n\t\t\t\t// Hidding feedback message for every message type\n\t\t\t\tct_feedback_wrap.show();\n\t\t\t\tct_feedback_wrap.css('display', 'inline-block');\n\t\t\t\t\n\t\t\t\tvar ct_timeout_id = ct_feedback_wrap.data('interval_id');\n\t\t\t\tclearInterval(ct_timeout_id);\n\t\t\t\tct_timeout_id = setTimeout(function(){\n\t\t\t\t\tct_feedback_wrap.fadeOut(1000);\n\t\t\t\t}, 5000);\n\t\t\t\tct_feedback_wrap.data('interval_id', ct_timeout_id);\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\tconsole.log(jqXHR);\n\t\t\t\tconsole.log(textStatus);\n\t\t\t\tconsole.log(errorThrown);\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t});\n\t\n});"],"names":["jQuery","document","ready","parents","each","e","this","css","length","ct_post_float","prev","last","ct_posts","indx","elem","curr_elem","parent","prepend","on","ct_current_button","ct_feedback_wrap","siblings","ct_feedback_msg","ct_comment_status","hasClass","data","action","security","ctPublicAdmin","ct_ajax_nonce","comment_id","attr","comment_status","change_status","ajax","type","url","ajaxurl","success","msg","hide","show","addClass","html","ct_feedback_error","ct_feedback_no_hash","ct_timeout_id","clearInterval","setTimeout","fadeOut","error","jqXHR","textStatus","errorThrown","console","log","timeout"],"mappings":"AAAAA,OAAOC,UAAUC,MAAM,WAGvBF,OAAO,oBAAoBG,UAAUC,KAAK,WACxC,GAAwD,GAAnDC,EAAIL,OAAOM,MAAMC,IAAI,qBAAqBC,QAAmB,oBAALH,EAE5D,OADAL,OAAO,oBAAoBO,IAAI,aAAcF,IACtC,IAKT,IAAII,EAAgBT,OAAO,oBAAoBU,OAAOC,OAAOJ,IAAI,SACjEP,OAAO,oBAAoBO,IAAI,QAASE,GAExC,IAAIG,EAAWZ,OAAO,oBAEtBA,OAAOY,GAAUR,KAAK,SAASS,EAAMC,GACpCC,UAAYf,OAAOc,GACnBC,UAAUC,SAASC,QAAQF,aAI5Bf,OAAO,eAAekB,GAAG,QAAS,WAEjC,IAAIC,EAAoBnB,OAAOM,MAC9Bc,EAAmBpB,OAAOM,MAAMe,SAAS,qBACzCC,EAAkBtB,OAAO,oBAIzBuB,EADEJ,EAAkBK,SAAS,mBACT,OAEA,UAEjBC,EAAO,CACVC,OAAU,sBACVC,SAAYC,cAAcC,cAC1BC,WAAcX,EAAkBY,KAAK,aACrCC,eAAkBT,EAClBU,cAAiB,GAGlBjC,OAAOkC,KAAK,CACXC,KAAM,OACNC,IAAKR,cAAcS,QACnBZ,KAAMA,EACNa,QAAS,SAASC,GACjBpB,EAAkBqB,OAClBrB,EAAkBE,SAAS,mBAAmBoB,OAE9CzC,OAAO,uBAAuBwC,OACN,WAArBjB,EACFvB,OAAO,gCAAgCyC,OAEvCzC,OAAO,4BAA4ByC,OAE1B,GAAPF,GACFjB,EAAgBoB,SAAS,uBACzBpB,EAAgBqB,KAAKf,cAAcN,kBACpB,GAAPiB,GAERjB,EAAgBoB,SAAS,qBACzBpB,EAAgBqB,KAAKf,cAAcgB,oBACpB,WAAPL,IAERjB,EAAgBoB,SAAS,uBACzBpB,EAAgBqB,KAAKf,cAAciB,sBAGpCzB,EAAiBqB,OACjBrB,EAAiBb,IAAI,UAAW,gBAEhC,IAAIuC,EAAgB1B,EAAiBK,KAAK,eAC1CsB,cAAcD,GACdA,EAAgBE,WAAW,WAC1B5B,EAAiB6B,QAAQ,MACvB,KACH7B,EAAiBK,KAAK,cAAeqB,IAEtCI,MAAO,SAASC,EAAOC,EAAYC,GAClCC,QAAQC,IAAIJ,GACZG,QAAQC,IAAIH,GACZE,QAAQC,IAAIF,IAEbG,QAAS"}
js/cleantalk-users-editscreen.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cleantalk-users-editscreen.min.js","sources":["cleantalk-users-editscreen.js"],"sourcesContent":["function ct_is_email(str){\r\n\treturn str.search(/.*@.*\\..*/);\r\n}\r\nfunction ct_is_ip(str){\r\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\r\n\r\n\tif(parseInt(ctUsersScreen.ct_show_check_links)) {\r\n\r\n\t\t/* Shows link to blacklists near every email and IP address */\r\n\t\tjQuery('.column-email a').each(function(){\r\n\t\t\tvar ct_curr_str = jQuery(this).html();\r\n\t\t\tif( ct_is_email(ct_curr_str) !== -1 ){\r\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctUsersScreen.ct_img_src_new_tab+'\"></a>');\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t/* Show checked ico near avatar */\r\n\t\tjQuery('.username.column-username').each(function(){\r\n\r\n\t\t\tvar apbct_checking_el = jQuery(this).siblings('.apbct_status').children('span');\r\n\t\t\tvar apbct_checking_status = apbct_checking_el.attr('id');\r\n\t\t\tvar apbct_checking_status_text = apbct_checking_el.text();\r\n\r\n\t\t\tvar apbct_add_text_element = jQuery('<span>', {\r\n\t\t\t\ttext : apbct_checking_status_text\r\n\t\t\t});\r\n\t\t\tvar apbct_add_ico_ok = jQuery('<i>', {\r\n\t\t\t\tclass : 'icon-ok'\r\n\t\t\t});\r\n\t\t\tvar apbct_add_ico_cancel = jQuery('<i>', {\r\n\t\t\t\tclass : 'icon-cancel',\r\n\t\t\t\tcss : {\r\n\t\t\t\t\tcolor : 'red'\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tif( apbct_checking_status ==='apbct_not_checked' ) {\r\n\t\t\t\tjQuery(this).children('.row-actions').before(apbct_add_ico_ok).before(apbct_add_text_element);\r\n\t\t\t}\r\n\t\t\tif( apbct_checking_status ==='apbct_checked_not_spam' ) {\r\n\t\t\t\tapbct_add_ico_ok.attr('style', 'color:green;');\r\n\t\t\t\tjQuery(this).children('.row-actions').before(apbct_add_ico_ok).before(apbct_add_text_element);\r\n\t\t\t}\r\n\t\t\tif( apbct_checking_status ==='apbct_checked_spam' ) {\r\n\t\t\t\tjQuery(this).children('.row-actions').before(apbct_add_ico_cancel).before(apbct_add_text_element);\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t}\r\n\r\n});"],"names":["ct_is_email","str","search","ct_is_ip","jQuery","document","ready","parseInt","ctUsersScreen","ct_show_check_links","each","ct_curr_str","this","html","after","ct_img_src_new_tab","apbct_checking_el","siblings","children","apbct_checking_status","attr","apbct_checking_status_text","text","apbct_add_text_element","apbct_add_ico_ok","class","apbct_add_ico_cancel","css","color","before"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAGnBE,OAAOC,UAAUC,MAAM,WAGnBC,SAASC,cAAcC,uBAGzBL,OAAO,mBAAmBM,KAAK,WAC9B,IAAIC,EAAcP,OAAOQ,MAAMC,QACG,IAA9Bb,YAAYW,IACfP,OAAOQ,MAAME,MAAM,mDAAmDH,EAAY,6DAA6DA,EAAY,uCAAuCH,cAAcO,mBAAmB,YAKrOX,OAAO,6BAA6BM,KAAK,WAExC,IAAIM,EAAoBZ,OAAOQ,MAAMK,SAAS,iBAAiBC,SAAS,QACpEC,EAAwBH,EAAkBI,KAAK,MAC/CC,EAA6BL,EAAkBM,OAE/CC,EAAyBnB,OAAO,SAAU,CAC7CkB,KAAOD,IAEJG,EAAmBpB,OAAO,MAAO,CACpCqB,MAAQ,YAELC,EAAuBtB,OAAO,MAAO,CACxCqB,MAAQ,cACRE,IAAM,CACLC,MAAQ,SAImB,sBAAzBT,GACHf,OAAOQ,MAAMM,SAAS,gBAAgBW,OAAOL,GAAkBK,OAAON,GAE1C,2BAAzBJ,IACHK,EAAiBJ,KAAK,QAAS,gBAC/BhB,OAAOQ,MAAMM,SAAS,gBAAgBW,OAAOL,GAAkBK,OAAON,IAE1C,uBAAzBJ,GACHf,OAAOQ,MAAMM,SAAS,gBAAgBW,OAAOH,GAAsBG,OAAON"}
1
+ {"version":3,"file":"cleantalk-users-editscreen.min.js","sources":["cleantalk-users-editscreen.js"],"sourcesContent":["function ct_is_email(str){\n\treturn str.search(/.*@.*\\..*/);\n}\nfunction ct_is_ip(str){\n\treturn str.search(/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/);\n}\n\njQuery(document).ready(function(){\n\n\n\tif(parseInt(ctUsersScreen.ct_show_check_links)) {\n\n\t\t/* Shows link to blacklists near every email and IP address */\n\t\tjQuery('.column-email a').each(function(){\n\t\t\tvar ct_curr_str = jQuery(this).html();\n\t\t\tif( ct_is_email(ct_curr_str) !== -1 ){\n\t\t\t\tjQuery(this).after('&nbsp;<a href=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" target=\"_blank\" title=\"https://cleantalk.org/blacklists/'+ct_curr_str+'\" class=\"ct_link_new_tab\"><img src=\"'+ctUsersScreen.ct_img_src_new_tab+'\"></a>');\n\t\t\t}\n\t\t});\n\n\t\t/* Show checked ico near avatar */\n\t\tjQuery('.username.column-username').each(function(){\n\n\t\t\tvar apbct_checking_el = jQuery(this).siblings('.apbct_status').children('span');\n\t\t\tvar apbct_checking_status = apbct_checking_el.attr('id');\n\t\t\tvar apbct_checking_status_text = apbct_checking_el.text();\n\n\t\t\tvar apbct_add_text_element = jQuery('<span>', {\n\t\t\t\ttext : apbct_checking_status_text\n\t\t\t});\n\t\t\tvar apbct_add_ico_ok = jQuery('<i>', {\n\t\t\t\tclass : 'icon-ok'\n\t\t\t});\n\t\t\tvar apbct_add_ico_cancel = jQuery('<i>', {\n\t\t\t\tclass : 'icon-cancel',\n\t\t\t\tcss : {\n\t\t\t\t\tcolor : 'red'\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif( apbct_checking_status ==='apbct_not_checked' ) {\n\t\t\t\tjQuery(this).children('.row-actions').before(apbct_add_ico_ok).before(apbct_add_text_element);\n\t\t\t}\n\t\t\tif( apbct_checking_status ==='apbct_checked_not_spam' ) {\n\t\t\t\tapbct_add_ico_ok.attr('style', 'color:green;');\n\t\t\t\tjQuery(this).children('.row-actions').before(apbct_add_ico_ok).before(apbct_add_text_element);\n\t\t\t}\n\t\t\tif( apbct_checking_status ==='apbct_checked_spam' ) {\n\t\t\t\tjQuery(this).children('.row-actions').before(apbct_add_ico_cancel).before(apbct_add_text_element);\n\t\t\t}\n\n\t\t});\n\n\t}\n\n});"],"names":["ct_is_email","str","search","ct_is_ip","jQuery","document","ready","parseInt","ctUsersScreen","ct_show_check_links","each","ct_curr_str","this","html","after","ct_img_src_new_tab","apbct_checking_el","siblings","children","apbct_checking_status","attr","apbct_checking_status_text","text","apbct_add_text_element","apbct_add_ico_ok","class","apbct_add_ico_cancel","css","color","before"],"mappings":"AAAA,SAASA,YAAYC,GACpB,OAAOA,EAAIC,OAAO,aAEnB,SAASC,SAASF,GACjB,OAAOA,EAAIC,OAAO,wCAGnBE,OAAOC,UAAUC,MAAM,WAGnBC,SAASC,cAAcC,uBAGzBL,OAAO,mBAAmBM,KAAK,WAC9B,IAAIC,EAAcP,OAAOQ,MAAMC,QACG,IAA9Bb,YAAYW,IACfP,OAAOQ,MAAME,MAAM,mDAAmDH,EAAY,6DAA6DA,EAAY,uCAAuCH,cAAcO,mBAAmB,YAKrOX,OAAO,6BAA6BM,KAAK,WAExC,IAAIM,EAAoBZ,OAAOQ,MAAMK,SAAS,iBAAiBC,SAAS,QACpEC,EAAwBH,EAAkBI,KAAK,MAC/CC,EAA6BL,EAAkBM,OAE/CC,EAAyBnB,OAAO,SAAU,CAC7CkB,KAAOD,IAEJG,EAAmBpB,OAAO,MAAO,CACpCqB,MAAQ,YAELC,EAAuBtB,OAAO,MAAO,CACxCqB,MAAQ,cACRE,IAAM,CACLC,MAAQ,SAImB,sBAAzBT,GACHf,OAAOQ,MAAMM,SAAS,gBAAgBW,OAAOL,GAAkBK,OAAON,GAE1C,2BAAzBJ,IACHK,EAAiBJ,KAAK,QAAS,gBAC/BhB,OAAOQ,MAAMM,SAAS,gBAAgBW,OAAOL,GAAkBK,OAAON,IAE1C,uBAAzBJ,GACHf,OAAOQ,MAAMM,SAAS,gBAAgBW,OAAOH,GAAsBG,OAAON"}
js/cleantalk_internal.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk_internal.js"],"names":["ct_check_internal","currForm","ct_data","elems","elements","key","type","undefined","value","name","jQuery","ajax","url","ctNocache","blog_home","datatype","data","success","alert","submit","error","document","ready","ct_currAction","ct_currForm","i","forms","length","action","indexOf","search","ctPrevHandler","click","off","on"],"mappings":"AAAA,SAASA,kBAAkBC,GAGvB,IAAIC,EAAU,GACVC,EAAQF,EAASG,SAErB,IAAK,IAAIC,KAAOF,EACU,UAAnBA,EAAME,GAAKC,MAAwCC,MAApBJ,EAAME,GAAKG,OAA0C,IAApBL,EAAME,GAAKG,QAE9EN,EAAQC,EAAME,GAAKI,MAAQR,EAASG,SAASC,GAAKG,OAEtDN,EAAgB,OAAI,oBAGpBQ,OAAOC,KAAK,CACRL,KAAM,OACNM,IAAKC,UAAUC,UACfC,SAAW,OACXC,KAAMd,EACNe,QAAS,SAASD,GACd,GAAW,QAARA,EAIC,OADAE,MAAMF,IACC,EAHPf,EAASkB,UAMjBC,MAAO,WACHnB,EAASkB,YAKrBT,OAAOW,UAAUC,MAAO,WACpB,IAAIC,EAAgB,GAChBC,EAAc,GACrB,IAAIC,EAAE,EAAEA,EAAEJ,SAASK,MAAMC,OAAOF,IACM,iBAA3BJ,SAASK,MAAMD,GAAS,UAGK,IADtCF,GADSC,EAAcH,SAASK,MAAMD,IACVG,QACXC,QAAQ,aAAoD,GAApCN,EAAcM,QAAQ,cACW,GAA1DN,EAAcO,OAAO,kCAA2F,GAAhDP,EAAcM,QAAQhB,UAAUC,aAC/FiB,cAAgBP,EAAYQ,MAC5BtB,OAAOc,GAAaS,IAAI,MACxBvB,OAAOc,GAAaS,MACpBvB,OAAOc,GAAaU,GAAG,SAAU,WAE7B,OADAlC,kBAAkBwB,IACX","file":"cleantalk_internal.min.js","sourcesContent":["function ct_check_internal(currForm){\r\n \r\n//Gathering data\r\n var ct_data = {},\r\n elems = currForm.elements;\r\n\r\n for (var key in elems) {\r\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\r\n continue;\r\n ct_data[elems[key].name] = currForm.elements[key].value;\r\n }\r\n ct_data['action'] = 'ct_check_internal';\r\n\r\n//AJAX Request\r\n jQuery.ajax({\r\n type: 'POST',\r\n url: ctNocache.blog_home,\r\n datatype : 'text',\r\n data: ct_data,\r\n success: function(data){\r\n if(data == 'true'){\r\n currForm.submit();\r\n }else{\r\n alert(data);\r\n return false;\r\n }\r\n },\r\n error: function(){\r\n currForm.submit();\r\n }\r\n }); \r\n}\r\n \r\njQuery(document).ready( function(){\r\n var ct_currAction = '',\r\n ct_currForm = '';\r\n\tfor(i=0;i<document.forms.length;i++){\r\n\t\tif(typeof(document.forms[i].action)=='string'){\r\n ct_currForm = document.forms[i];\r\n\t\t\tct_currAction = ct_currForm.action;\r\n\t\t\tif(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){\r\n if(ct_currAction.search(/\\/wp-content\\/themes.*\\.php$/) != (-1) && ct_currAction.indexOf(ctNocache.blog_home) != (-1)){\r\n ctPrevHandler = ct_currForm.click;\r\n jQuery(ct_currForm).off('**');\r\n jQuery(ct_currForm).off();\r\n jQuery(ct_currForm).on('submit', function(){\r\n ct_check_internal(ct_currForm);\r\n return false;\r\n });\r\n }\r\n }\r\n\t\t}\r\n\t}\r\n});"]}
1
+ {"version":3,"file":"cleantalk_internal.min.js","sources":["cleantalk_internal.js"],"sourcesContent":["function ct_check_internal(currForm){\n \n//Gathering data\n var ct_data = {},\n elems = currForm.elements;\n\n for (var key in elems) {\n if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')\n continue;\n ct_data[elems[key].name] = currForm.elements[key].value;\n }\n ct_data['action'] = 'ct_check_internal';\n\n//AJAX Request\n jQuery.ajax({\n type: 'POST',\n url: ctNocache.blog_home,\n datatype : 'text',\n data: ct_data,\n success: function(data){\n if(data == 'true'){\n currForm.submit();\n }else{\n alert(data);\n return false;\n }\n },\n error: function(){\n currForm.submit();\n }\n }); \n}\n \njQuery(document).ready( function(){\n var ct_currAction = '',\n ct_currForm = '';\n\tfor(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\t\t\tif(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){\n if(ct_currAction.search(/\\/wp-content\\/themes.*\\.php$/) != (-1) && ct_currAction.indexOf(ctNocache.blog_home) != (-1)){\n ctPrevHandler = ct_currForm.click;\n jQuery(ct_currForm).off('**');\n jQuery(ct_currForm).off();\n jQuery(ct_currForm).on('submit', function(){\n ct_check_internal(ct_currForm);\n return false;\n });\n }\n }\n\t\t}\n\t}\n});"],"names":["ct_check_internal","currForm","ct_data","elems","elements","key","type","undefined","value","name","jQuery","ajax","url","ctNocache","blog_home","datatype","data","success","alert","submit","error","document","ready","ct_currAction","ct_currForm","i","forms","length","action","indexOf","search","ctPrevHandler","click","off","on"],"mappings":"AAAA,SAASA,kBAAkBC,GAGvB,IAAIC,EAAU,GACVC,EAAQF,EAASG,SAErB,IAAK,IAAIC,KAAOF,EACU,UAAnBA,EAAME,GAAKC,MAAwCC,MAApBJ,EAAME,GAAKG,OAA0C,IAApBL,EAAME,GAAKG,QAE9EN,EAAQC,EAAME,GAAKI,MAAQR,EAASG,SAASC,GAAKG,OAEtDN,EAAgB,OAAI,oBAGpBQ,OAAOC,KAAK,CACRL,KAAM,OACNM,IAAKC,UAAUC,UACfC,SAAW,OACXC,KAAMd,EACNe,QAAS,SAASD,GACd,GAAW,QAARA,EAIC,OADAE,MAAMF,IACC,EAHPf,EAASkB,UAMjBC,MAAO,WACHnB,EAASkB,YAKrBT,OAAOW,UAAUC,MAAO,WACpB,IAAIC,EAAgB,GAChBC,EAAc,GACrB,IAAIC,EAAE,EAAEA,EAAEJ,SAASK,MAAMC,OAAOF,IACM,iBAA3BJ,SAASK,MAAMD,GAAS,UAGK,IADtCF,GADSC,EAAcH,SAASK,MAAMD,IACVG,QACXC,QAAQ,aAAoD,GAApCN,EAAcM,QAAQ,cACW,GAA1DN,EAAcO,OAAO,kCAA2F,GAAhDP,EAAcM,QAAQhB,UAAUC,aAC/FiB,cAAgBP,EAAYQ,MAC5BtB,OAAOc,GAAaS,IAAI,MACxBvB,OAAOc,GAAaS,MACpBvB,OAAOc,GAAaU,GAAG,SAAU,WAE7B,OADAlC,kBAAkBwB,IACX"}
js/cleantalk_nocache.min.js CHANGED
@@ -1 +1,2 @@
1
- if(void 0===ctNocache)var ctNocache={set_cookies_flag:!0,ajaxurl:"/wp-admin/admin-ajax.php"};function sendRequest(e,t,n){var c=createXMLHTTPObject();if(c){var i=n?"POST":"GET";e="https:"===location.protocol?e.replace("http:","https:"):e.replace("https:","http:"),c.open(i,e,!0),n&&c.setRequestHeader("Content-type","application/x-www-form-urlencoded"),c.onreadystatechange=function(){4==c.readyState&&(200!=c.status&&304!=c.status||t(c))},4!=c.readyState&&c.send(n)}}var XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];function createXMLHTTPObject(){for(var e=!1,t=0;t<XMLHttpFactories.length;t++){try{e=XMLHttpFactories[t]()}catch(e){continue}break}return e}function ct_getCookie(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}function ct_setCookie(e,t){if(ctNocache.set_cookies_flag){document.cookie=e+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax",document.cookie=e+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax";var n=new Date;n.setDate(n.getDate()+1),setTimeout(function(){document.cookie=e+"="+t+"; expires="+n.toUTCString()+"; path = /; samesite=lax"},500)}return null}function ct_callback(t){for(ct_cookie=t.responseText.trim(),ct_setCookie("ct_checkjs",ct_cookie),i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=ct_cookie)}if(Date.now||(Date.now=function(){return(new Date).getTime()}),null==ct_nocache_executed){var ct_nocache_executed=!0,checkjs_cookie=ct_getCookie("ct_checkjs");if(null!=checkjs_cookie)for(i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=checkjs_cookie);if(null==checkjs_cookie&&sendRequest(ctNocache.ajaxurl+"?"+Math.random(),ct_callback,"action=ct_get_cookie"),void 0!==ctNocache.info_flag&&ctNocache.info_flag){var cleantalk_user_info={},cleantalk_screen_info={};for(var prop in screen)navigator[prop]instanceof Object||""===screen[prop]||(cleantalk_screen_info[prop]=screen[prop]);cleantalk_user_info.screen=cleantalk_screen_info;for(var prev,cleantalk_plugins=Array(),cnt=0,i=0;i<navigator.plugins.length;i++){var plugin;prev!=(plugin=(plugin=navigator.plugins[i]).name+" "+(plugin.version||""))&&(cleantalk_plugins[cnt]=plugin,cnt++,prev=plugin)}cleantalk_user_info.plugins=cleantalk_plugins,cleantalk_user_info.timezone_offset=-(new Date).getTimezoneOffset()/60,cleantalk_user_info.datetime=Math.round((new Date).getTime()/1e3),cleantalk_user_info.browser_x=document.documentElement.clientWidth,cleantalk_user_info.browser_y=document.documentElement.clientHeight;var ua=navigator.userAgent.toLowerCase(),flashInstalled=0;if(void 0!==navigator.plugins&&"object"==typeof navigator.plugins["Shockwave Flash"])flashInstalled=1;else if(void 0!==window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(flashInstalled=1)}catch(e){}cleantalk_user_info.is_flash=flashInstalled,isVisitedMain=-1,location.href!="http://"+location.hostname+"/"&&location.href!="https://"+location.hostname+"/"||(isVisitedMain=1,setTimeout(function(){document.cookie="ct_visited_main = 1; path = /; samesite=lax"},1500)),ct_visited_main=ct_getCookie("ct_visited_main"),isVisitedMain=null==ct_visited_main&&-1==isVisitedMain?0:1,cleantalk_user_info.is_main=isVisitedMain,setTimeout(function(){document.cookie="ct_user_info = "+escape(JSON.stringify(cleantalk_user_info))+"; path = /; samesite=lax"},1500)}}
 
1
+ var ctNocache;function sendRequest(e,t,n){var c,i=createXMLHTTPObject();i&&(c=n?"POST":"GET",e="https:"===location.protocol?e.replace("http:","https:"):e.replace("https:","http:"),i.open(c,e,!0),n&&i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){4==i.readyState&&(200!=i.status&&304!=i.status||t(i))},4!=i.readyState&&i.send(n))}void 0===ctNocache&&(ctNocache={set_cookies_flag:!0,ajaxurl:"/wp-admin/admin-ajax.php"});var XMLHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];function createXMLHTTPObject(){for(var e=!1,t=0;t<XMLHttpFactories.length;t++){try{e=XMLHttpFactories[t]()}catch(e){continue}break}return e}function ct_getCookie(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}function ct_setCookie(e,t){var n;return ctNocache.set_cookies_flag&&(document.cookie=e+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax",document.cookie=e+" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax",(n=new Date).setDate(n.getDate()+1),setTimeout(function(){document.cookie=e+"="+t+"; expires="+n.toUTCString()+"; path = /; samesite=lax"},500)),null}function ct_callback(t){for(ct_cookie=t.responseText.trim(),ct_setCookie("ct_checkjs",ct_cookie),i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=ct_cookie)}if(Date.now||(Date.now=function(){return(new Date).getTime()}),null==ct_nocache_executed){var ct_nocache_executed=!0,checkjs_cookie=ct_getCookie("ct_checkjs");if(null!=checkjs_cookie)for(i=0;i<document.forms.length;i++)for(f=document.forms[i],j=0;j<f.elements.length;j++)e=f.elements[j],void 0!==e.name&&-1!=e.name.indexOf("ct_checkjs")&&(e.value=checkjs_cookie);if(null==checkjs_cookie&&sendRequest(ctNocache.ajaxurl+"?"+Math.random(),ct_callback,"action=ct_get_cookie"),void 0!==ctNocache.info_flag&&ctNocache.info_flag){var cleantalk_user_info={},cleantalk_screen_info={};for(var prop in screen)navigator[prop]instanceof Object||""===screen[prop]||(cleantalk_screen_info[prop]=screen[prop]);cleantalk_user_info.screen=cleantalk_screen_info;for(var prev,cleantalk_plugins=Array(),cnt=0,i=0;i<navigator.plugins.length;i++){var plugin=navigator.plugins[i];prev!=(plugin=plugin.name+" "+(plugin.version||""))&&(cleantalk_plugins[cnt]=plugin,cnt++,prev=plugin)}cleantalk_user_info.plugins=cleantalk_plugins,cleantalk_user_info.timezone_offset=-(new Date).getTimezoneOffset()/60,cleantalk_user_info.datetime=Math.round((new Date).getTime()/1e3),cleantalk_user_info.browser_x=document.documentElement.clientWidth,cleantalk_user_info.browser_y=document.documentElement.clientHeight;var ua=navigator.userAgent.toLowerCase(),flashInstalled=0;if(void 0!==navigator.plugins&&"object"==typeof navigator.plugins["Shockwave Flash"])flashInstalled=1;else if(void 0!==window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(flashInstalled=1)}catch(e){}cleantalk_user_info.is_flash=flashInstalled,isVisitedMain=-1,location.href!="http://"+location.hostname+"/"&&location.href!="https://"+location.hostname+"/"||(isVisitedMain=1,setTimeout(function(){document.cookie="ct_visited_main = 1; path = /; samesite=lax"},1500)),ct_visited_main=ct_getCookie("ct_visited_main"),isVisitedMain=null==ct_visited_main&&-1==isVisitedMain?0:1,cleantalk_user_info.is_main=isVisitedMain,setTimeout(function(){document.cookie="ct_user_info = "+escape(JSON.stringify(cleantalk_user_info))+"; path = /; samesite=lax"},1500)}}
2
+ //# sourceMappingURL=cleantalk_nocache.min.js.map
js/cleantalk_nocache.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["cleantalk_nocache.js"],"names":["ctNocache","set_cookies_flag","ajaxurl","sendRequest","url","callback","postData","req","createXMLHTTPObject","method","location","protocol","replace","open","setRequestHeader","onreadystatechange","readyState","status","send","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xmlhttp","i","length","e","ct_getCookie","name","matches","document","cookie","match","RegExp","decodeURIComponent","undefined","ct_setCookie","value","date","Date","setDate","getDate","setTimeout","toUTCString","ct_callback","ct_cookie","responseText","trim","forms","f","j","elements","indexOf","now","getTime","ct_nocache_executed","checkjs_cookie","Math","random","info_flag","cleantalk_user_info","cleantalk_screen_info","prop","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","plugins","plugin","version","timezone_offset","getTimezoneOffset","datetime","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","is_flash","isVisitedMain","href","hostname","ct_visited_main","is_main","escape","JSON","stringify"],"mappings":"AAGA,QAAyB,IAAdA,UACV,IAAIA,UAAY,CAChBC,kBAA6B,EAC1BC,QAAoB,4BAGxB,SAASC,YAAYC,EAAIC,EAASC,GAC9B,IAAIC,EAAMC,sBACV,GAAKD,EAAL,CACA,IAAIE,EAAS,EAAa,OAAS,MAI/BL,EADa,WADFM,SAASC,SAEdP,EAAIQ,QAAQ,QAAS,UAErBR,EAAIQ,QAAQ,SAAU,SAGhCL,EAA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BG,aAEvD,IAAIC,GAAKlB,UAAUmB,UAAUC,cACzBC,eAAiB,EACrB,QAA+B,IAApBrB,UAAiB,SAA8D,iBAAvCA,UAAUM,QAAQ,mBAEpEe,eAAiB,OAEb,QAAmC,IAAxBC,OAAOhE,cAEtB,IAEK,IAAIA,cAAc,mCAErB+D,eAAiB,GAEjB,MAAM3D,IAGTkC,oBAAoB2B,SAASF,eAE7BG,eAAe,EACZ7E,SAAS8E,MAAM,UAAU9E,SAAS+E,SAAS,KAAO/E,SAAS8E,MAAM,WAAW9E,SAAS+E,SAAS,MAEhGF,cAAc,EACd9C,WAAW,WAAaZ,SAASC,OAAS,+CAAgD,OAI3F4D,gBAAkBhE,aAAa,mBAG9B6D,cAFmBrD,MAAjBwD,kBAA8C,GAAhBH,cAElB,EAIA,EAGf5B,oBAAoBgC,QAAQJ,cAE5B9C,WAAW,WAAaZ,SAASC,OAAS,kBAAkB8D,OAAOC,KAAKC,UAAUnC,sBAAsB,4BAA6B"}
1
+ {"version":3,"file":"cleantalk_nocache.min.js","sources":["cleantalk_nocache.js"],"sourcesContent":["/*\n Assign default values for backend variables.\n*/\nif (typeof ctNocache === 'undefined') {\n\tvar ctNocache = {};\n\tctNocache.set_cookies_flag = true;\n ctNocache.ajaxurl = '/wp-admin/admin-ajax.php';\n}\n\nfunction sendRequest(url,callback,postData) {\n var req = createXMLHTTPObject();\n if (!req) return;\n var method = (postData) ? \"POST\" : \"GET\";\n \n var protocol = location.protocol;\n if (protocol === 'https:') {\n url = url.replace('http:', 'https:');\n } else {\n url = url.replace('https:', 'http:');\n }\n \n req.open(method,url,true);\n if (postData)\n req.setRequestHeader('Content-type','application/x-www-form-urlencoded');\n req.onreadystatechange = function () {\n if (req.readyState != 4) return;\n if (req.status != 200 && req.status != 304) {\n// alert('HTTP error ' + req.status);\n return;\n }\n callback(req);\n };\n if (req.readyState == 4) return;\n req.send(postData);\n}\n\nvar XMLHttpFactories = [\n function () {return new XMLHttpRequest()},\n function () {return new ActiveXObject(\"Msxml2.XMLHTTP\")},\n function () {return new ActiveXObject(\"Msxml3.XMLHTTP\")},\n function () {return new ActiveXObject(\"Microsoft.XMLHTTP\")}\n];\n\nfunction createXMLHTTPObject() {\n var xmlhttp = false;\n for (var i=0;i<XMLHttpFactories.length;i++) {\n try {\n xmlhttp = XMLHttpFactories[i]();\n }\n catch (e) {\n continue;\n }\n break;\n }\n return xmlhttp;\n}\n\nfunction ct_getCookie(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 ct_setCookie(name, value)\n{\n if (ctNocache.set_cookies_flag) {\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; path = /; samesite=lax\";\n document.cookie = name+\" =; expires=Thu, 01 Jan 1970 00:00:01 GMT; samesite=lax\";\n \n var date = new Date;\n date.setDate(date.getDate() + 1);\n setTimeout(function() { document.cookie = name+\"=\" + value + \"; expires=\" + date.toUTCString() + \"; path = /; samesite=lax\"}, 500);\n }\n\n return null;\n}\n\nfunction ct_callback(req)\n{\n\tct_cookie = req.responseText.trim();\n\t//alert('Key value: ' + ct_cookie);\n\t\n\tct_setCookie('ct_checkjs', ct_cookie);\n\t\n\tfor(i=0;i<document.forms.length;i++)\n\t{\n\t\tf=document.forms[i];\n\t\tfor(j=0;j<f.elements.length;j++)\n\t\t{\n\t\t\te=f.elements[j];\n\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t{\n\t\t\t\te.value=ct_cookie;\n\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t}\n\t\t}\n\t}\n\n\t//alert('Set cookie: \\n' + document.cookie);\n}\n\nif (!Date.now) {\n\tDate.now = function() { return new Date().getTime(); }\n}\n\nif(ct_nocache_executed==undefined)\n{\n\tvar ct_nocache_executed=true;\n\t\n\tvar checkjs_cookie=ct_getCookie('ct_checkjs');\n\t\n\tif(checkjs_cookie!=undefined)\n\t{\n\t\tfor(i=0;i<document.forms.length;i++)\n\t\t{\n\t\t\tf=document.forms[i];\n\t\t\tfor(j=0;j<f.elements.length;j++)\n\t\t\t{\n\t\t\t\te=f.elements[j];\n\t\t\t\tif(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)\n\t\t\t\t{\n\t\t\t\t\te.value=checkjs_cookie;\n\t\t\t\t\t//alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t\n\t\n\tif(checkjs_cookie==undefined) //86400 is 24 hours\n\t{\n\t\tsendRequest(ctNocache.ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');\n\t}\n\t\n\tif(typeof ctNocache.info_flag !== 'undefined' && ctNocache.info_flag)\n\t{\n\t\n\t\tvar cleantalk_user_info={};\n\t\t\n\t\tvar cleantalk_screen_info={};\n\t\tfor(var prop in screen)\n\t\t{\n\t\t\tif (navigator[prop] instanceof Object || screen[prop]==='')\n\t\t\t\tcontinue;\n\t\t\tcleantalk_screen_info[prop]=screen[prop];\n\t\t}\n\t\t\n\t\tcleantalk_user_info.screen=cleantalk_screen_info;\n\t\t\n\t\tvar cleantalk_plugins=Array();\n\t\tvar prev;\n\t\tvar cnt=0;\n\t\tfor(var i=0;i<navigator.plugins.length;i++)\n\t\t{\n\t\t\tvar plugin = navigator.plugins[i];\n\t\t\tvar plugin = plugin.name+\" \"+(plugin.version || '')\n\t\t\tif (prev == plugin ) continue;\n\t\t\tcleantalk_plugins[cnt]=plugin;\n\t\t\tcnt++;\n\t\t\tprev = plugin;\n\t\t}\n\t\tcleantalk_user_info.plugins=cleantalk_plugins;\n\t\t\n\t\tcleantalk_user_info.timezone_offset = -new Date().getTimezoneOffset()/60;\n\t\tcleantalk_user_info.datetime = Math.round((new Date().getTime())/1000);\n\t\t\n\t\tcleantalk_user_info.browser_x=document.documentElement.clientWidth;\n\t\tcleantalk_user_info.browser_y=document.documentElement.clientHeight;\n\t\t\n\t\tvar ua = navigator.userAgent.toLowerCase();\n\t\tvar flashInstalled = 0;\n\t\tif (typeof(navigator.plugins)!=\"undefined\"&&typeof(navigator.plugins[\"Shockwave Flash\"])==\"object\")\n\t\t{\n\t\t\tflashInstalled = 1;\n\t\t}\n\t\telse if (typeof window.ActiveXObject != \"undefined\")\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif (new ActiveXObject(\"ShockwaveFlash.ShockwaveFlash\"))\n\t\t\t\t{\n\t\t\t\t\tflashInstalled = 1;\n\t\t\t\t}\n\t\t\t} catch(e) {};\n\t\t};\n\t\t\n\t\tcleantalk_user_info.is_flash=flashInstalled;\n\t\t\n\t\tisVisitedMain=-1;\n\t\tif(location.href=='http://'+location.hostname+'/' || location.href=='https://'+location.hostname+'/')\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t\tsetTimeout(function() { document.cookie = \"ct_visited_main = 1; path = /; samesite=lax\"}, 1500);\n\t\t}\n\t\t\n\t\t\n\t\tct_visited_main = ct_getCookie('ct_visited_main');\n\t\tif(ct_visited_main==undefined && isVisitedMain==-1)\n\t\t{\n\t\t\tisVisitedMain=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tisVisitedMain=1;\n\t\t}\n\t\t\n\t\tcleantalk_user_info.is_main=isVisitedMain;\n\t\t\n\t\tsetTimeout(function() { document.cookie = \"ct_user_info = \"+escape(JSON.stringify(cleantalk_user_info))+\"; path = /; samesite=lax\"}, 1500);\n\t}\n}"],"names":["ctNocache","sendRequest","url","callback","postData","method","req","createXMLHTTPObject","location","protocol","replace","open","setRequestHeader","onreadystatechange","readyState","status","send","set_cookies_flag","ajaxurl","XMLHttpFactories","XMLHttpRequest","ActiveXObject","xmlhttp","i","length","e","ct_getCookie","name","matches","document","cookie","match","RegExp","decodeURIComponent","undefined","ct_setCookie","value","date","Date","setDate","getDate","setTimeout","toUTCString","ct_callback","ct_cookie","responseText","trim","forms","f","j","elements","indexOf","now","getTime","ct_nocache_executed","checkjs_cookie","Math","random","info_flag","cleantalk_user_info","cleantalk_screen_info","prop","screen","navigator","Object","prev","cleantalk_plugins","Array","cnt","plugins","plugin","version","timezone_offset","getTimezoneOffset","datetime","round","browser_x","documentElement","clientWidth","browser_y","clientHeight","ua","userAgent","toLowerCase","flashInstalled","window","is_flash","isVisitedMain","href","hostname","ct_visited_main","is_main","escape","JSON","stringify"],"mappings":"AAGA,IACKA,UAKL,SAASC,YAAYC,EAAIC,EAASC,GAC9B,IAEIC,EAFAC,EAAMC,sBACLD,IACDD,EAAS,EAAa,OAAS,MAI/BH,EADa,WADFM,SAASC,SAEdP,EAAIQ,QAAQ,QAAS,UAErBR,EAAIQ,QAAQ,SAAU,SAGhCJ,EAAIK,KAAKN,EAAOH,GAAI,GAChBE,GACAE,EAAIM,iBAAiB,eAAe,qCACxCN,EAAIO,mBAAqB,WACC,GAAlBP,EAAIQ,aACU,KAAdR,EAAIS,QAA+B,KAAdT,EAAIS,QAI7BZ,EAASG,KAES,GAAlBA,EAAIQ,YACRR,EAAIU,KAAKZ,SA9BY,IAAdJ,YACNA,UAAY,CAChBiB,kBAA6B,EAC1BC,QAAoB,6BA8BxB,IAAIC,iBAAmB,CACnB,WAAa,OAAO,IAAIC,gBACxB,WAAa,OAAO,IAAIC,cAAc,mBACtC,WAAa,OAAO,IAAIA,cAAc,mBACtC,WAAa,OAAO,IAAIA,cAAc,uBAG1C,SAASd,sBAEL,IADA,IAAIe,GAAU,EACLC,EAAE,EAAEA,EAAEJ,iBAAiBK,OAAOD,IAAK,CACxC,IACID,EAAUH,iBAAiBI,KAE/B,MAAOE,GACH,SAEJ,MAEJ,OAAOH,EAGX,SAASI,aAAaC,GACpB,IAAIC,EAAUC,SAASC,OAAOC,MAAM,IAAIC,OACtC,WAAaL,EAAKjB,QAAQ,+BAAgC,QAAU,aAEtE,OA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php CHANGED
@@ -409,7 +409,7 @@ class Cleantalk {
409
  * @param $msg
410
  * @return boolean|\CleantalkResponse
411
  */
412
- private function sendRequest($data = null, $url, $server_timeout = 3)
413
  {
414
  $original_args = func_get_args();
415
  // Convert to array
409
  * @param $msg
410
  * @return boolean|\CleantalkResponse
411
  */
412
+ private function sendRequest($data, $url, $server_timeout = 3)
413
  {
414
  $original_args = func_get_args();
415
  // Convert to array
lib/Cleantalk/Antispam/DisableComments.php CHANGED
@@ -38,7 +38,7 @@ class DisableComments{
38
  /**
39
  * Singleton constructor.
40
  */
41
- function init(){
42
 
43
  global $apbct;
44
 
@@ -47,14 +47,16 @@ class DisableComments{
47
  $types_to_disable = array();
48
 
49
  if( $this->apbct->settings['comments__disable_comments__all'] ){
50
- $types_to_disable = array( 'page', 'post', 'media' );
51
  }else{
52
  if( $this->apbct->settings['comments__disable_comments__posts'] )
53
  $types_to_disable[] = 'post';
54
  if( $this->apbct->settings['comments__disable_comments__pages'] )
55
  $types_to_disable[] = 'page';
56
- if( $this->apbct->settings['comments__disable_comments__media'] )
57
- $types_to_disable[] = 'media';
 
 
58
  }
59
 
60
  $this->is_wpms = APBCT_WPMS;
@@ -70,7 +72,7 @@ class DisableComments{
70
 
71
  }
72
 
73
- function is_current_type_to_disable( $type = '' ){
74
  $type = $type ? $type : get_post_type();
75
  return in_array( $type, $this->types_to_disable );
76
  }
@@ -111,8 +113,8 @@ class DisableComments{
111
  }
112
  }
113
  }
114
-
115
- function disable_rc_widget(){
116
  unregister_widget( 'WP_Widget_Recent_Comments' );
117
  }
118
 
@@ -128,11 +130,11 @@ class DisableComments{
128
  </style>';
129
  }
130
 
131
- function admin__filter_dashboard(){
132
  remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
133
  }
134
 
135
- function admin__filter_menu(){
136
  global $pagenow;
137
 
138
  if( in_array( $pagenow, array( 'comment.php', 'edit-comments.php', 'options-discussion.php' ) ) )
@@ -141,30 +143,30 @@ class DisableComments{
141
  remove_menu_page( 'edit-comments.php' );
142
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
143
  }
144
-
145
- function template__check(){
146
- if( is_singular() && $this->is_current_type_to_disable() ){
147
- add_filter( 'comments_template', array( $this, 'template__replace' ), 20 );
148
- wp_deregister_script( 'comment-reply' );
149
- remove_action( 'wp_head', 'feed_links_extra', 3 );
150
- }
151
- }
152
-
153
- function template__replace(){
154
  return APBCT_DIR_PATH . 'templates/empty_comments.php';
155
  }
156
 
157
- function filter__headers( $headers ){
158
  unset( $headers['X-Pingback'] );
159
  return $headers;
160
  }
161
 
162
- function filter__query( $headers ){
163
  if( is_comment_feed() )
164
  wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) );
165
  }
166
-
167
- function filter__admin_bar(){
168
  if( is_admin_bar_showing() ){
169
  remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
170
  if( $this->is_wpms ){
@@ -206,8 +208,8 @@ class DisableComments{
206
  public function filter__comments_number( $count, $post_id ){
207
  return $this->is_current_type_to_disable() ? 0 : $count;
208
  }
209
-
210
- function remove__comment_links__wpms( $wp_admin_bar ){
211
  if( is_user_logged_in() ){
212
 
213
  foreach ( (array) $wp_admin_bar->user->blogs as $blog ){
38
  /**
39
  * Singleton constructor.
40
  */
41
+ public function init(){
42
 
43
  global $apbct;
44
 
47
  $types_to_disable = array();
48
 
49
  if( $this->apbct->settings['comments__disable_comments__all'] ){
50
+ $types_to_disable = array( 'page', 'post', 'media', 'attachment' );
51
  }else{
52
  if( $this->apbct->settings['comments__disable_comments__posts'] )
53
  $types_to_disable[] = 'post';
54
  if( $this->apbct->settings['comments__disable_comments__pages'] )
55
  $types_to_disable[] = 'page';
56
+ if( $this->apbct->settings['comments__disable_comments__media'] ){
57
+ $types_to_disable[] = 'media';
58
+ $types_to_disable[] = 'attachment';
59
+ }
60
  }
61
 
62
  $this->is_wpms = APBCT_WPMS;
72
 
73
  }
74
 
75
+ public function is_current_type_to_disable( $type = '' ){
76
  $type = $type ? $type : get_post_type();
77
  return in_array( $type, $this->types_to_disable );
78
  }
113
  }
114
  }
115
  }
116
+
117
+ public function disable_rc_widget(){
118
  unregister_widget( 'WP_Widget_Recent_Comments' );
119
  }
120
 
130
  </style>';
131
  }
132
 
133
+ public function admin__filter_dashboard(){
134
  remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
135
  }
136
 
137
+ public function admin__filter_menu(){
138
  global $pagenow;
139
 
140
  if( in_array( $pagenow, array( 'comment.php', 'edit-comments.php', 'options-discussion.php' ) ) )
143
  remove_menu_page( 'edit-comments.php' );
144
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
145
  }
146
+
147
+ public function template__check( $count, $post_id ){
148
+ if( is_singular() && $this->is_current_type_to_disable() ){
149
+ add_filter( 'comments_template', array( $this, 'template__replace' ), 20 );
150
+ wp_deregister_script( 'comment-reply' );
151
+ remove_action( 'wp_head', 'feed_links_extra', 3 );
152
+ }
153
+ return $count;
154
+ }
155
+ public function template__replace(){
156
  return APBCT_DIR_PATH . 'templates/empty_comments.php';
157
  }
158
 
159
+ public function filter__headers( $headers ){
160
  unset( $headers['X-Pingback'] );
161
  return $headers;
162
  }
163
 
164
+ public function filter__query( $headers ){
165
  if( is_comment_feed() )
166
  wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) );
167
  }
168
+
169
+ public function filter__admin_bar(){
170
  if( is_admin_bar_showing() ){
171
  remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
172
  if( $this->is_wpms ){
208
  public function filter__comments_number( $count, $post_id ){
209
  return $this->is_current_type_to_disable() ? 0 : $count;
210
  }
211
+
212
+ public function remove__comment_links__wpms( $wp_admin_bar ){
213
  if( is_user_logged_in() ){
214
 
215
  foreach ( (array) $wp_admin_bar->user->blogs as $blog ){
lib/Cleantalk/Antispam/Integrations.php CHANGED
@@ -1,103 +1,113 @@
1
- <?php
2
-
3
-
4
- namespace Cleantalk\Antispam;
5
-
6
-
7
- class Integrations
8
- {
9
-
10
- private $integrations = array();
11
-
12
- private $integration;
13
-
14
- public function __construct( $integrations )
15
- {
16
- $this->integrations = $integrations;
17
-
18
- foreach( $this->integrations as $integration_name => $integration_info ) {
19
- if( $integration_info['ajax'] ) {
20
- if( is_array( $integration_info['hook'] ) ) {
21
- foreach( $integration_info['hook'] as $hook ) {
22
- add_action( 'wp_ajax_' . $hook, array( $this, 'checkSpam' ), 1 );
23
- add_action( 'wp_ajax_nopriv_' . $hook, array( $this, 'checkSpam' ), 1 );
24
- }
25
- } else {
26
- add_action( 'wp_ajax_' . $integration_info['hook'], array( $this, 'checkSpam' ), 1 );
27
- add_action( 'wp_ajax_nopriv_' . $integration_info['hook'], array( $this, 'checkSpam' ), 1 );
28
- }
29
- } else {
30
- add_action( $integration_info['hook'], array( $this, 'checkSpam' ) );
31
- }
32
- }
33
- }
34
-
35
- public function checkSpam( $argument )
36
- {
37
- global $cleantalk_executed;
38
-
39
- // Getting current integration name
40
- $current_integration = $this->get_current_integration_triggered( current_filter() );
41
- if( $current_integration ) {
42
- // Instantiate the integration object
43
- $class = '\\Cleantalk\\Antispam\\Integrations\\' . $current_integration;
44
- if( class_exists( $class )) {
45
- $this->integration = new $class();
46
- if( ! ( $this->integration instanceof \Cleantalk\Antispam\Integrations\IntegrationBase ) ) {
47
- // @ToDo have to handle an error
48
- do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, array('Integration is not instanse of IntegrationBase class.') );
49
- return;
50
- }
51
- // Run data collecting for spam checking
52
- $data = $this->integration->getDataForChecking( $argument );
53
- if( ! is_null( $data ) ) {
54
- // Go spam checking
55
- $base_call_result = apbct_base_call(
56
- array(
57
- 'message' => !empty( $data['message'] ) ? json_encode( $data['message'] ) : '',
58
- 'sender_email' => !empty( $data['email'] ) ? $data['email'] : '',
59
- 'sender_nickname' => !empty( $data['nickname'] ) ? $data['nickname'] : '',
60
- 'post_info' => array(
61
- 'comment_type' => 'contact_form_wordpress_' . strtolower($current_integration),
62
- 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
63
- ),
64
- ),
65
- isset( $data['register'] ) ? true : false
66
- );
67
-
68
- $ct_result = $base_call_result['ct_result'];
69
-
70
- $cleantalk_executed = true;
71
-
72
- if ($ct_result->allow == 0) {
73
- // Do blocking if it is a spam
74
- $this->integration->doBlock( $ct_result->comment );
75
- }
76
- } else {
77
- // @ToDo have to handle an error
78
- return;
79
- }
80
- }
81
- }
82
- }
83
-
84
- private function get_current_integration_triggered( $hook )
85
- {
86
- if( $hook !== false ) {
87
- foreach( $this->integrations as $integration_name => $integration_info ) {
88
- if( is_array( $integration_info['hook'] ) ) {
89
- foreach( $integration_info['hook'] as $integration_hook ) {
90
- if( strpos( $hook, $integration_hook ) !== false ) {
91
- return $integration_name;
92
- }
93
- }
94
- } else {
95
- if( strpos( $hook, $integration_info['hook'] ) !== false ) {
96
- return $integration_name;
97
- }
98
- }
99
- }
100
- }
101
- return false;
102
- }
 
 
 
 
 
 
 
 
 
 
103
  }
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam;
5
+
6
+
7
+ class Integrations
8
+ {
9
+
10
+ private $integrations = array();
11
+
12
+ private $integration;
13
+
14
+ /**
15
+ * Integrations constructor.
16
+ *
17
+ * @param array $integrations
18
+ * @param array $settings
19
+ */
20
+ public function __construct( $integrations, $settings )
21
+ {
22
+ $this->integrations = $integrations;
23
+
24
+ foreach( $this->integrations as $integration_name => $integration_info ){
25
+
26
+ if( empty( $settings[ $integration_info['setting'] ] ) )
27
+ continue;
28
+
29
+ if( $integration_info['ajax'] ) {
30
+ if( is_array( $integration_info['hook'] ) ) {
31
+ foreach( $integration_info['hook'] as $hook ) {
32
+ add_action( 'wp_ajax_' . $hook, array( $this, 'checkSpam' ), 1 );
33
+ add_action( 'wp_ajax_nopriv_' . $hook, array( $this, 'checkSpam' ), 1 );
34
+ }
35
+ } else {
36
+ add_action( 'wp_ajax_' . $integration_info['hook'], array( $this, 'checkSpam' ), 1 );
37
+ add_action( 'wp_ajax_nopriv_' . $integration_info['hook'], array( $this, 'checkSpam' ), 1 );
38
+ }
39
+ } else {
40
+ add_action( $integration_info['hook'], array( $this, 'checkSpam' ) );
41
+ }
42
+ }
43
+ }
44
+
45
+ public function checkSpam( $argument )
46
+ {
47
+ global $cleantalk_executed;
48
+
49
+ // Getting current integration name
50
+ $current_integration = $this->get_current_integration_triggered( current_filter() );
51
+ if( $current_integration ) {
52
+ // Instantiate the integration object
53
+ $class = '\\Cleantalk\\Antispam\\Integrations\\' . $current_integration;
54
+ if( class_exists( $class )) {
55
+ $this->integration = new $class();
56
+ if( ! ( $this->integration instanceof \Cleantalk\Antispam\Integrations\IntegrationBase ) ) {
57
+ // @ToDo have to handle an error
58
+ do_action( 'apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, array('Integration is not instanse of IntegrationBase class.') );
59
+ return;
60
+ }
61
+ // Run data collecting for spam checking
62
+ $data = $this->integration->getDataForChecking( $argument );
63
+ if( ! is_null( $data ) ) {
64
+ // Go spam checking
65
+ $base_call_result = apbct_base_call(
66
+ array(
67
+ 'message' => !empty( $data['message'] ) ? json_encode( $data['message'] ) : '',
68
+ 'sender_email' => !empty( $data['email'] ) ? $data['email'] : '',
69
+ 'sender_nickname' => !empty( $data['nickname'] ) ? $data['nickname'] : '',
70
+ 'post_info' => array(
71
+ 'comment_type' => 'contact_form_wordpress_' . strtolower($current_integration),
72
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ), // Page URL must be an previous page
73
+ ),
74
+ ),
75
+ isset( $data['register'] ) ? true : false
76
+ );
77
+
78
+ $ct_result = $base_call_result['ct_result'];
79
+
80
+ $cleantalk_executed = true;
81
+
82
+ if ($ct_result->allow == 0) {
83
+ // Do blocking if it is a spam
84
+ $this->integration->doBlock( $ct_result->comment );
85
+ }
86
+ } else {
87
+ // @ToDo have to handle an error
88
+ return;
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ private function get_current_integration_triggered( $hook )
95
+ {
96
+ if( $hook !== false ) {
97
+ foreach( $this->integrations as $integration_name => $integration_info ) {
98
+ if( is_array( $integration_info['hook'] ) ) {
99
+ foreach( $integration_info['hook'] as $integration_hook ) {
100
+ if( strpos( $hook, $integration_hook ) !== false ) {
101
+ return $integration_name;
102
+ }
103
+ }
104
+ } else {
105
+ if( strpos( $hook, $integration_info['hook'] ) !== false ) {
106
+ return $integration_name;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ return false;
112
+ }
113
  }
lib/Cleantalk/Antispam/Integrations/Forminator.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\Antispam\Integrations;
5
+
6
+
7
+ class Forminator extends IntegrationBase {
8
+
9
+ function getDataForChecking( $argument ) {
10
+ if( isset( $_POST ) ) {
11
+ return ct_get_fields_any( $_POST );
12
+ }
13
+ return null;
14
+ }
15
+
16
+ function doBlock( $message ) {
17
+ wp_send_json_error(
18
+ array(
19
+ 'message' => $message,
20
+ 'success' => false,
21
+ 'errors' => array(),
22
+ 'behav' => 'behaviour-thankyou',
23
+ )
24
+ );
25
+ }
26
+ }
lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php CHANGED
@@ -28,8 +28,13 @@ class CleantalkSettingsTemplates {
28
 
29
  public function add_action_button( $links )
30
  {
31
- $link = '<a href="#" class="ct_support_link" onclick="cleantalkModal.open()" data-content-action="get_options_template">' . __('Import/Export settings', 'cleantalk-spam-protect') . '</a>';
32
- $links[] = $link;
 
 
 
 
 
33
  return $links;
34
  }
35
 
@@ -48,7 +53,7 @@ class CleantalkSettingsTemplates {
48
  $template_info = $_POST['data'];
49
  if( isset( $template_info['template_id'] ) ) {
50
  $template_id = sanitize_text_field( $template_info['template_id'] );
51
- $res = \Cleantalk\Common\API::method__services_templates_update( $this->api_key, $template_id );
52
  if( is_array( $res ) && array_key_exists( 'operation_status', $res ) ) {
53
  if( $res['operation_status'] === 'SUCCESS' ) {
54
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
@@ -61,7 +66,7 @@ class CleantalkSettingsTemplates {
61
  }
62
  if( isset( $template_info['template_name'] ) ) {
63
  $template_name = sanitize_text_field( $template_info['template_name'] );
64
- $res = \Cleantalk\Common\API::method__services_templates_add( $this->api_key, $template_name );
65
  if( is_array( $res ) && array_key_exists( 'operation_status', $res ) ) {
66
  if( $res['operation_status'] === 'SUCCESS' ) {
67
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
@@ -82,7 +87,7 @@ class CleantalkSettingsTemplates {
82
  if( isset( $_POST['data'] ) && is_array( $_POST['data'] ) ) {
83
  $template_info = $_POST['data'];
84
  if( isset( $template_info['template_id'], $template_info['template_name'], $template_info['settings'] ) ) {
85
- $res = apbct_set_plugin_options( $template_info['template_id'], $template_info['template_name'], $template_info['settings'] );
86
  if( empty( $res['error'] ) ) {
87
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
88
  } else {
@@ -96,7 +101,7 @@ class CleantalkSettingsTemplates {
96
  public function settings_templates_reset_ajax()
97
  {
98
  check_ajax_referer('ct_secret_nonce', 'security');
99
- $res = apbct_reset_plugin_options();
100
  if( empty( $res['error'] ) ) {
101
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
102
  } else {
@@ -106,19 +111,23 @@ class CleantalkSettingsTemplates {
106
 
107
  public static function get_options_template( $api_key )
108
  {
109
- $res = \Cleantalk\Common\API::method__services_templates_get( $api_key );
110
- if( is_array( $res ) ) {
111
- if( array_key_exists( 'error', $res ) ) {
112
- $templates = array();
 
 
 
 
 
113
  } else {
114
- $templates = $res;
115
  }
116
- } else {
117
- $templates = array();
118
- }
119
- if( ! self::$templates ) {
120
  self::$templates = $templates;
 
121
  }
 
122
  return self::$templates;
123
  }
124
 
@@ -131,12 +140,12 @@ class CleantalkSettingsTemplates {
131
  $out .= $this->getHtmlContentExport( $templates );
132
  $out .= $this->getHtmlContentReset();
133
  }
134
- return $title . '<br>' . $out;
135
  }
136
 
137
  private function getHtmlContentImport( $templates )
138
  {
139
- $templatesSet = '<h3>' . esc_html__( 'Import settings.', 'cleantalk-spam-protect' ) . '</h3>';
140
 
141
  //Check available option_site parameter
142
  if( count( $templates ) > 0 ) {
@@ -148,7 +157,7 @@ class CleantalkSettingsTemplates {
148
  }
149
 
150
  if( count( $templates ) === 0 ) {
151
- $templatesSet .= esc_html__( 'There are no settings templates.', 'cleantalk-spam-protect' );
152
  return $templatesSet . '<br><hr>';
153
  }
154
 
@@ -156,9 +165,9 @@ class CleantalkSettingsTemplates {
156
  foreach( $templates as $template ) {
157
  $templatesSet .= "<option
158
  data-id='" . $template['template_id'] . "'
159
- data-name='" . $template['name'] . "''
160
  data-settings='" . $template['options_site'] . "'>"
161
- . $template['name']
162
  . "</option>";
163
  }
164
  $templatesSet .= '</select></p>';
@@ -169,22 +178,21 @@ class CleantalkSettingsTemplates {
169
 
170
  public function getHtmlContentExport( $templates )
171
  {
172
- $templatesSet = '<h3>' . esc_html__( 'Export settings.', 'cleantalk-spam-protect' ) . '</h3>';
173
  $templatesSet .= '<p><select id="apbct_settings_templates_export" >';
174
  $templatesSet .= '<option data-id="new_template" checked="true">New template</option>';
175
  foreach( $templates as $template ) {
176
- $templatesSet .= '<option data-id="' . $template['template_id'] . '">' . $template['name'] . '</option>';
177
  }
178
  $templatesSet .= '</select></p>';
179
- $templatesSet .= '<p><input type="text" id="apbct_settings_templates_export_name" name="apbct_settings_template_name" placeholder="' . esc_html__( 'Enter a template name.', 'cleantalk-spam-protect' ) . '" required /></p>';
180
  $button = $this->getExportButton();
181
  return $templatesSet . '<br>' . $button . '<br>';
182
  }
183
 
184
  public function getHtmlContentReset()
185
  {
186
- $content = '<h3>' . esc_html__( 'Reset settings.', 'cleantalk-spam-protect' ) . '</h3>';
187
- return '<br><br><hr><br>' . $content . '<br>' . $this->getResetButton() . '<br>';
188
  }
189
 
190
  private function getTitle()
@@ -195,7 +203,7 @@ class CleantalkSettingsTemplates {
195
  } else {
196
  $current_template_name = 'default';
197
  }
198
- $content = '<h2>' . esc_html__( 'CleanTalk settings templates.', 'cleantalk-spam-protect' ) . '</h2>';
199
  $content .= '<p>' . esc_html__( 'You are currently using:', 'cleantalk-spam-protect' ) . ' ' . $current_template_name . '</p>';
200
  return $content;
201
  }
@@ -203,7 +211,7 @@ class CleantalkSettingsTemplates {
203
  private function getExportButton()
204
  {
205
  return '<button id="apbct_settings_templates_export_button" class="cleantalk_link cleantalk_link-manual">'
206
- . esc_html__( 'Export settings to selected template.', 'cleantalk-spam-protect' )
207
  . '<img alt="Preloader ico" style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
208
  . '<img alt="Success ico" style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
209
  . '</button>';
@@ -211,18 +219,62 @@ class CleantalkSettingsTemplates {
211
 
212
  private function getImportButton(){
213
  return '<button id="apbct_settings_templates_import_button" class="cleantalk_link cleantalk_link-manual">'
214
- . esc_html__( 'Import settings from selected template.', 'cleantalk-spam-protect' )
215
  . '<img alt="Preloader ico" style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
216
  . '<img alt="Success ico" style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
217
  . '</button>';
218
  }
219
 
220
  private function getResetButton(){
221
- return '<button id="apbct_settings_templates_reset_button" class="cleantalk_link cleantalk_link-auto">'
222
- . esc_html__( 'Reset settings to defaults.', 'cleantalk-spam-protect' )
223
  . '<img alt="Preloader ico" style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
224
  . '<img alt="Success ico" style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
225
  . '</button>';
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
28
 
29
  public function add_action_button( $links )
30
  {
31
+ if( is_array( $links ) ) {
32
+ $last_link = array_slice( $links, -1, 1 );
33
+ unset( $links[ count($links) - 1 ] );
34
+ $link = '<a href="#" class="ct_support_link" onclick="cleantalkModal.open()">' . __('Import/Export settings', 'cleantalk-spam-protect') . '</a>';
35
+ $links[] = $link;
36
+ $links[] = $last_link[0];
37
+ }
38
  return $links;
39
  }
40
 
53
  $template_info = $_POST['data'];
54
  if( isset( $template_info['template_id'] ) ) {
55
  $template_id = sanitize_text_field( $template_info['template_id'] );
56
+ $res = \Cleantalk\Common\API::method__services_templates_update( $this->api_key, $template_id, $this->get_plugin_options() );
57
  if( is_array( $res ) && array_key_exists( 'operation_status', $res ) ) {
58
  if( $res['operation_status'] === 'SUCCESS' ) {
59
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
66
  }
67
  if( isset( $template_info['template_name'] ) ) {
68
  $template_name = sanitize_text_field( $template_info['template_name'] );
69
+ $res = \Cleantalk\Common\API::method__services_templates_add( $this->api_key, $template_name, $this->get_plugin_options() );
70
  if( is_array( $res ) && array_key_exists( 'operation_status', $res ) ) {
71
  if( $res['operation_status'] === 'SUCCESS' ) {
72
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
87
  if( isset( $_POST['data'] ) && is_array( $_POST['data'] ) ) {
88
  $template_info = $_POST['data'];
89
  if( isset( $template_info['template_id'], $template_info['template_name'], $template_info['settings'] ) ) {
90
+ $res = $this->set_plugin_options( $template_info['template_id'], $template_info['template_name'], $template_info['settings'] );
91
  if( empty( $res['error'] ) ) {
92
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
93
  } else {
101
  public function settings_templates_reset_ajax()
102
  {
103
  check_ajax_referer('ct_secret_nonce', 'security');
104
+ $res = $this->reset_plugin_options();
105
  if( empty( $res['error'] ) ) {
106
  wp_send_json_success( esc_html__('Success. Reloading...', 'cleantalk-spam-protect' ) );
107
  } else {
111
 
112
  public static function get_options_template( $api_key )
113
  {
114
+ if( ! self::$templates ) {
115
+
116
+ $res = \Cleantalk\Common\API::method__services_templates_get( $api_key );
117
+ if( is_array( $res ) ) {
118
+ if( array_key_exists( 'error', $res ) ) {
119
+ $templates = array();
120
+ } else {
121
+ $templates = $res;
122
+ }
123
  } else {
124
+ $templates = array();
125
  }
126
+
 
 
 
127
  self::$templates = $templates;
128
+
129
  }
130
+
131
  return self::$templates;
132
  }
133
 
140
  $out .= $this->getHtmlContentExport( $templates );
141
  $out .= $this->getHtmlContentReset();
142
  }
143
+ return $title . $out;
144
  }
145
 
146
  private function getHtmlContentImport( $templates )
147
  {
148
+ $templatesSet = '<h3>' . esc_html__( 'Import settings', 'cleantalk-spam-protect' ) . '</h3>';
149
 
150
  //Check available option_site parameter
151
  if( count( $templates ) > 0 ) {
157
  }
158
 
159
  if( count( $templates ) === 0 ) {
160
+ $templatesSet .= esc_html__( 'There are no settings templates', 'cleantalk-spam-protect' );
161
  return $templatesSet . '<br><hr>';
162
  }
163
 
165
  foreach( $templates as $template ) {
166
  $templatesSet .= "<option
167
  data-id='" . $template['template_id'] . "'
168
+ data-name='" . htmlspecialchars( $template['name'] ) . "''
169
  data-settings='" . $template['options_site'] . "'>"
170
+ . htmlspecialchars( $template['name'] )
171
  . "</option>";
172
  }
173
  $templatesSet .= '</select></p>';
178
 
179
  public function getHtmlContentExport( $templates )
180
  {
181
+ $templatesSet = '<h3>' . esc_html__( 'Export settings', 'cleantalk-spam-protect' ) . '</h3>';
182
  $templatesSet .= '<p><select id="apbct_settings_templates_export" >';
183
  $templatesSet .= '<option data-id="new_template" checked="true">New template</option>';
184
  foreach( $templates as $template ) {
185
+ $templatesSet .= '<option data-id="' . $template['template_id'] . '">' . htmlspecialchars( $template['name'] ) . '</option>';
186
  }
187
  $templatesSet .= '</select></p>';
188
+ $templatesSet .= '<p><input type="text" id="apbct_settings_templates_export_name" name="apbct_settings_template_name" placeholder="' . esc_html__( 'Enter a template name', 'cleantalk-spam-protect' ) . '" required /></p>';
189
  $button = $this->getExportButton();
190
  return $templatesSet . '<br>' . $button . '<br>';
191
  }
192
 
193
  public function getHtmlContentReset()
194
  {
195
+ return '<hr><br>' . $this->getResetButton() . '<br>';
 
196
  }
197
 
198
  private function getTitle()
203
  } else {
204
  $current_template_name = 'default';
205
  }
206
+ $content = '<h2>' . esc_html__( 'CleanTalk settings templates', 'cleantalk-spam-protect' ) . '</h2>';
207
  $content .= '<p>' . esc_html__( 'You are currently using:', 'cleantalk-spam-protect' ) . ' ' . $current_template_name . '</p>';
208
  return $content;
209
  }
211
  private function getExportButton()
212
  {
213
  return '<button id="apbct_settings_templates_export_button" class="cleantalk_link cleantalk_link-manual">'
214
+ . esc_html__( 'Export settings to selected template', 'cleantalk-spam-protect' )
215
  . '<img alt="Preloader ico" style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
216
  . '<img alt="Success ico" style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
217
  . '</button>';
219
 
220
  private function getImportButton(){
221
  return '<button id="apbct_settings_templates_import_button" class="cleantalk_link cleantalk_link-manual">'
222
+ . esc_html__( 'Import settings from selected template', 'cleantalk-spam-protect' )
223
  . '<img alt="Preloader ico" style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
224
  . '<img alt="Success ico" style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
225
  . '</button>';
226
  }
227
 
228
  private function getResetButton(){
229
+ return '<button id="apbct_settings_templates_reset_button" class="ct_support_link">'
230
+ . esc_html__( 'Reset settings to defaults', 'cleantalk-spam-protect' )
231
  . '<img alt="Preloader ico" style="margin-left: 10px;" class="apbct_preloader_button" src="' . APBCT_URL_PATH . '/inc/images/preloader2.gif" />'
232
  . '<img alt="Success ico" style="margin-left: 10px;" class="apbct_success --hide" src="' . APBCT_URL_PATH . '/inc/images/yes.png" />'
233
  . '</button>';
234
  }
235
 
236
+ private function get_plugin_options() {
237
+ global $apbct;
238
+ $settings = (array) $apbct->settings;
239
+ // Remove apikey from export
240
+ if( isset( $settings['apikey'] ) ) {
241
+ unset( $settings['apikey'] );
242
+ }
243
+ // Remove misc__debug_ajax from export
244
+ if( isset( $settings['misc__debug_ajax'] ) ) {
245
+ unset( $settings['misc__debug_ajax'] );
246
+ }
247
+ // Remove multisite__white_label__hoster_key from export
248
+ if( isset( $settings['multisite__white_label__hoster_key'] ) ) {
249
+ unset( $settings['multisite__white_label__hoster_key'] );
250
+ }
251
+ // Remove all WPMS from export
252
+ $settings = array_filter( $settings, function( $key ){
253
+ return strpos( $key, 'multisite__' ) === false;
254
+ }, ARRAY_FILTER_USE_KEY );
255
+ return json_encode( $settings, JSON_FORCE_OBJECT );
256
+ }
257
+
258
+ private function set_plugin_options( $template_id, $template_name, $settings ) {
259
+ global $apbct;
260
+ $settings = array_replace( (array) $apbct->settings, $settings );
261
+ $settings = apbct_settings__validate($settings);
262
+ $apbct->settings = $settings;
263
+ $apbct->data['current_settings_template_id'] = $template_id;
264
+ $apbct->data['current_settings_template_name'] = $template_name;
265
+ return $apbct->saveSettings() && $apbct->saveData();
266
+ }
267
+
268
+ private function reset_plugin_options() {
269
+ global $apbct;
270
+ $def_settings = $apbct->def_settings;
271
+ if( isset( $def_settings['apikey'] ) ) {
272
+ unset( $def_settings['apikey'] );
273
+ }
274
+ $settings = array_replace( (array) $apbct->settings, $def_settings );
275
+ $settings = apbct_settings__validate($settings);
276
+ $apbct->settings = $settings;
277
+ return $apbct->saveSettings();
278
+ }
279
+
280
  }
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -27,7 +27,7 @@ class CommentsChecker extends Checker
27
  'ct_confirm_trash_all' => __('Trash all spam comments from the list?', 'cleantalk-spam-protect'),
28
  'ct_confirm_spam_all' => __('Mark as spam all comments from the list?', 'cleantalk-spam-protect'),
29
  'ct_comments_added_after' => __('comments', 'cleantalk-spam-protect'),
30
- 'ct_status_string' => __('Checked %s, found %s spam comments and %s bad comments (without IP or email).', 'cleantalk-spam-protect'),
31
  'ct_status_string_warning' => '<p>'.__('Please do backup of WordPress database before delete any accounts!', 'cleantalk-spam-protect').'</p>',
32
  'start' => !empty($_COOKIE['ct_comments_start_check']) ? true : false,
33
  ));
@@ -340,7 +340,7 @@ class CommentsChecker extends Checker
340
 
341
  if( ! $direct_call ) {
342
  $return['message'] .= sprintf (
343
- esc_html__('Checked %s, found %s spam comments and %s bad comments (without IP or email)', 'cleantalk-spam-protect'),
344
  $cnt_checked,
345
  $cnt_spam,
346
  $cnt_bad
@@ -355,7 +355,7 @@ class CommentsChecker extends Checker
355
  if ( $res ) {
356
 
357
  $return['message'] .= sprintf (
358
- __("Last check %s: checked %s comments, found %s spam comments and %s bad comments (without IP or email).", 'cleantalk-spam-protect'),
359
  self::lastCheckDate(),
360
  $cnt_checked,
361
  $cnt_spam,
27
  'ct_confirm_trash_all' => __('Trash all spam comments from the list?', 'cleantalk-spam-protect'),
28
  'ct_confirm_spam_all' => __('Mark as spam all comments from the list?', 'cleantalk-spam-protect'),
29
  'ct_comments_added_after' => __('comments', 'cleantalk-spam-protect'),
30
+ 'ct_status_string' => __('Checked %s, found %s spam comments and %s non-checkable comments (without IP or email).', 'cleantalk-spam-protect'),
31
  'ct_status_string_warning' => '<p>'.__('Please do backup of WordPress database before delete any accounts!', 'cleantalk-spam-protect').'</p>',
32
  'start' => !empty($_COOKIE['ct_comments_start_check']) ? true : false,
33
  ));
340
 
341
  if( ! $direct_call ) {
342
  $return['message'] .= sprintf (
343
+ esc_html__('Checked %s, found %s spam comments and %s non-checkable comments (without IP or email)', 'cleantalk-spam-protect'),
344
  $cnt_checked,
345
  $cnt_spam,
346
  $cnt_bad
355
  if ( $res ) {
356
 
357
  $return['message'] .= sprintf (
358
+ __("Last check %s: checked %s comments, found %s spam comments and %s non-checkable comments (without IP or email).", 'cleantalk-spam-protect'),
359
  self::lastCheckDate(),
360
  $cnt_checked,
361
  $cnt_spam,
lib/Cleantalk/ApbctWP/FindSpam/ListTable/BadUsers.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace Cleantalk\ApbctWP\FindSpam\ListTable;
5
+
6
+
7
+ class BadUsers extends Users {
8
+
9
+ function prepare_items() {
10
+
11
+ $columns = $this->get_columns();
12
+ $this->_column_headers = array( $columns, array(), array() );
13
+
14
+ $per_page_option = ! is_null( get_current_screen() ) ? get_current_screen()->get_option( 'per_page', 'option' ) : 10;
15
+ $per_page = get_user_meta( get_current_user_id(), $per_page_option, true );
16
+ if( ! $per_page ) {
17
+ $per_page = 10;
18
+ }
19
+
20
+ $scanned_users = $this->getBadUsers();
21
+
22
+ $this->set_pagination_args( array(
23
+ 'total_items' => $scanned_users->get_total(),
24
+ 'per_page' => $per_page,
25
+ ) );
26
+
27
+ $current_page = (int) $this->get_pagenum();
28
+
29
+ $scanned_users_to_show = array_slice( $scanned_users->get_results(), ( ( $current_page - 1 ) * $per_page ), $per_page );
30
+
31
+ foreach( $scanned_users_to_show as $user_id ) {
32
+
33
+ $user_obj = get_userdata( $user_id );
34
+
35
+ $this->items[] = array(
36
+ 'ct_id' => $user_obj->ID,
37
+ 'ct_username' => $user_obj,
38
+ 'ct_name' => $user_obj->display_name,
39
+ 'ct_email' => $user_obj->user_email,
40
+ 'ct_signed_up' => $user_obj->user_registered,
41
+ 'ct_role' => implode( ', ', $user_obj->roles ),
42
+ 'ct_posts' => count_user_posts( $user_id ),
43
+ );
44
+
45
+ }
46
+
47
+ }
48
+
49
+ // Username (first) column
50
+ function column_ct_username( $item ) {
51
+ $user_obj = $item['ct_username'];
52
+ $email = $user_obj->user_email;
53
+ $column_content = '';
54
+
55
+ // Avatar, nickname
56
+ $column_content .= '<strong>' . get_avatar( $user_obj->ID , 32) . '&nbsp;' . $user_obj->user_login . '</strong>';
57
+ $column_content .= '<br /><br />';
58
+
59
+ // Email
60
+ if( ! empty( $email ) ){
61
+ $column_content .= "<a href='mailto:$email'>$email</a>"
62
+ .( ! $this->apbct->white_label
63
+ ? "<a href='https://cleantalk.org/blacklists/$email' target='_blank'>"
64
+ ."&nbsp;<img src='" . APBCT_URL_PATH . "/inc/images/new_window.gif' alt='Ico: open in new window' border='0' style='float:none' />"
65
+ ."</a>"
66
+ : '');
67
+ } else {
68
+ $column_content .= esc_html__( 'No email', 'cleantalk-spam-protect');
69
+ }
70
+ $column_content .= '<br/>';
71
+
72
+ // IP
73
+ $user_meta = get_user_meta( $user_obj->ID, 'session_tokens', true );
74
+ if( ! empty( $user_meta ) && is_array( $user_meta ) ){
75
+ $user_meta = array_values( $user_meta );
76
+ if( ! empty( $user_meta[0]['ip'] ) ) {
77
+ $ip = $user_meta[0]['ip'];
78
+ $column_content .= "<a href='user-edit.php?user_id=$user_obj->ID'>$ip</a>"
79
+ .( ! $this->apbct->white_label
80
+ ?"<a href='https://cleantalk.org/blacklists/$ip ' target='_blank'>"
81
+ ."&nbsp;<img src='" . APBCT_URL_PATH . "/inc/images/new_window.gif' alt='Ico: open in new window' border='0' style='float:none' />"
82
+ ."</a>"
83
+ : '');
84
+ }else
85
+ $column_content .= esc_html__( 'No IP adress', 'cleantalk-spam-protect');
86
+ }else
87
+ $column_content .= esc_html__( 'No IP adress', 'cleantalk-spam-protect');
88
+
89
+ return $column_content;
90
+
91
+ }
92
+
93
+ public function getBadUsers() {
94
+
95
+ return $this->getBad();
96
+
97
+ }
98
+
99
+ function get_bulk_actions() {
100
+ return null;
101
+ }
102
+
103
+ function no_items() {
104
+ esc_html_e( 'No non-checkable users found.', 'cleantalk-spam-protect');
105
+ }
106
+ }
lib/Cleantalk/ApbctWP/FindSpam/Page.php CHANGED
@@ -1,127 +1,135 @@
1
- <?php
2
-
3
- namespace Cleantalk\ApbctWP\FindSpam;
4
-
5
- class Page
6
- {
7
-
8
- private $spam_checker;
9
-
10
- private $current_tab;
11
-
12
- public function __construct( Checker $apbct_spam_checker ) {
13
-
14
- $this->spam_checker = $apbct_spam_checker;
15
-
16
- switch ( current_action() ) {
17
-
18
- case 'users_page_ct_check_users' :
19
- case 'comments_page_ct_check_spam' :
20
- $this->current_tab = 1;
21
- $this->generatePageHeader();
22
- $this->spam_checker->getCurrentScanPage();
23
- break;
24
-
25
- case 'users_page_ct_check_users_logs' :
26
- case 'comments_page_ct_check_spam_logs' :
27
- $this->current_tab = 3;
28
- $this->generatePageHeader();
29
- $this->spam_checker->getSpamLogsPage();
30
- break;
31
-
32
- }
33
-
34
- }
35
-
36
- /**
37
- * Output header section of the FindSpam pages
38
- *
39
- * @return void (HTML layout output)
40
- */
41
- public static function showFindSpamPage() {
42
- switch ( current_action() ) {
43
-
44
- case 'users_page_ct_check_users' :
45
- case 'users_page_ct_check_users_logs' :
46
- self::generateCheckUsersPage();
47
- break;
48
-
49
- case 'comments_page_ct_check_spam' :
50
- case 'comments_page_ct_check_spam_logs' :
51
- self::generateCheckSpamPage();
52
- break;
53
-
54
- }
55
-
56
- }
57
-
58
- private static function generateCheckUsersPage() {
59
-
60
- new self( new UsersChecker() );
61
-
62
- self::closeTags();
63
-
64
- }
65
-
66
- private static function generateCheckSpamPage() {
67
-
68
- new self( new CommentsChecker() );
69
-
70
- self::closeTags();
71
-
72
- }
73
-
74
- private function generatePageHeader() {
75
-
76
- // If access key is unset in
77
- if( ! apbct_api_key__is_correct() ){
78
- if( 1 == $this->spam_checker->getApbct()->moderate_ip ){
79
- echo '<h3>'
80
- .sprintf(
81
- __('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk-spam-protect'),
82
- '<a href="' . ( is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk' ).'">',
83
- '</a>'
84
- )
85
- .'</h3>';
86
- }
87
- return;
88
- }
89
-
90
- ?>
91
- <div class="wrap">
92
- <h2><img src="<?php echo $this->spam_checker->getApbct()->logo__small__colored; ?>" alt="CleanTalk logo" /> <?php echo $this->spam_checker->getApbct()->plugin_name; ?></h2>
93
- <a style="color: gray; margin-left: 23px;" href="<?php echo $this->spam_checker->getApbct()->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk-spam-protect'); ?></a>
94
- <br />
95
- <h3><?php echo $this->spam_checker->getPageTitle(); ?></h3>
96
- <div id="ct_check_tabs">
97
- <ul>
98
- <li <?php echo (1 == $this->current_tab) ? 'class="active"' : ''; ?>><a href="<?php echo $this->spam_checker->getPageScriptName(); ?>?page=ct_check_<?php echo $this->spam_checker->getPageSlug(); ?>"><?php esc_html_e( 'Scan and new results', 'cleantalk-spam-protect') ?></a></li>
99
- <li <?php echo (3 == $this->current_tab) ? 'class="active"' : ''; ?>><a href="<?php echo $this->spam_checker->getPageScriptName(); ?>?page=ct_check_<?php echo $this->spam_checker->getPageSlug(); ?>_logs"><?php esc_html_e( 'Scan logs', 'cleantalk-spam-protect') ?></a></li>
100
- </ul>
101
- <div id="ct_check_content">
102
- <?php
103
-
104
- }
105
-
106
- public static function setScreenOption() {
107
-
108
- $option = 'per_page';
109
- $args = array(
110
- 'label' => esc_html__( 'Show per page', 'cleantalk-spam-protect'),
111
- 'default' => 10,
112
- 'option' => 'spam_per_page',
113
- );
114
- add_screen_option( $option, $args );
115
-
116
- }
117
-
118
- private static function closeTags() {
119
-
120
- ?>
121
- </div>
122
- </div>
123
- <?php
124
-
125
- }
126
-
 
 
 
 
 
 
 
 
127
  }
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP\FindSpam;
4
+
5
+ class Page
6
+ {
7
+
8
+ private $spam_checker;
9
+
10
+ private $current_tab;
11
+
12
+ public function __construct( Checker $apbct_spam_checker ) {
13
+
14
+ $this->spam_checker = $apbct_spam_checker;
15
+
16
+ switch ( current_action() ) {
17
+
18
+ case 'users_page_ct_check_users' :
19
+ case 'comments_page_ct_check_spam' :
20
+ $this->current_tab = 1;
21
+ $this->generatePageHeader();
22
+ $this->spam_checker->getCurrentScanPage();
23
+ break;
24
+
25
+ case 'users_page_ct_check_users_logs' :
26
+ case 'comments_page_ct_check_spam_logs' :
27
+ $this->current_tab = 3;
28
+ $this->generatePageHeader();
29
+ $this->spam_checker->getSpamLogsPage();
30
+ break;
31
+
32
+ case 'users_page_ct_check_users_bad' :
33
+ $this->current_tab = 2;
34
+ $this->generatePageHeader();
35
+ $this->spam_checker->getBadUsersPage();
36
+ break;
37
+
38
+ }
39
+
40
+ }
41
+
42
+ /**
43
+ * Output header section of the FindSpam pages
44
+ *
45
+ * @return void (HTML layout output)
46
+ */
47
+ public static function showFindSpamPage() {
48
+ switch ( current_action() ) {
49
+
50
+ case 'users_page_ct_check_users' :
51
+ case 'users_page_ct_check_users_logs' :
52
+ case 'users_page_ct_check_users_bad' :
53
+ self::generateCheckUsersPage();
54
+ break;
55
+
56
+ case 'comments_page_ct_check_spam' :
57
+ case 'comments_page_ct_check_spam_logs' :
58
+ self::generateCheckSpamPage();
59
+ break;
60
+
61
+ }
62
+
63
+ }
64
+
65
+ private static function generateCheckUsersPage() {
66
+
67
+ new self( new UsersChecker() );
68
+
69
+ self::closeTags();
70
+
71
+ }
72
+
73
+ private static function generateCheckSpamPage() {
74
+
75
+ new self( new CommentsChecker() );
76
+
77
+ self::closeTags();
78
+
79
+ }
80
+
81
+ private function generatePageHeader() {
82
+
83
+ // If access key is unset in
84
+ if( ! apbct_api_key__is_correct() ){
85
+ if( 1 == $this->spam_checker->getApbct()->moderate_ip ){
86
+ echo '<h3>'
87
+ .sprintf(
88
+ __('Antispam hosting tariff does not allow you to use this feature. To do so, you need to enter an Access Key in the %splugin settings%s.', 'cleantalk-spam-protect'),
89
+ '<a href="' . ( is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk' ).'">',
90
+ '</a>'
91
+ )
92
+ .'</h3>';
93
+ }
94
+ return;
95
+ }
96
+
97
+ ?>
98
+ <div class="wrap">
99
+ <h2><img src="<?php echo $this->spam_checker->getApbct()->logo__small__colored; ?>" alt="CleanTalk logo" /> <?php echo $this->spam_checker->getApbct()->plugin_name; ?></h2>
100
+ <a style="color: gray; margin-left: 23px;" href="<?php echo $this->spam_checker->getApbct()->settings_link; ?>"><?php _e('Plugin Settings', 'cleantalk-spam-protect'); ?></a>
101
+ <br />
102
+ <h3><?php echo $this->spam_checker->getPageTitle(); ?></h3>
103
+ <div id="ct_check_tabs">
104
+ <ul>
105
+ <li <?php echo (1 == $this->current_tab) ? 'class="active"' : ''; ?>><a href="<?php echo $this->spam_checker->getPageScriptName(); ?>?page=ct_check_<?php echo $this->spam_checker->getPageSlug(); ?>"><?php esc_html_e( 'Scan and new results', 'cleantalk-spam-protect') ?></a></li>
106
+ <li <?php echo (2 == $this->current_tab) ? 'class="active"' : ''; ?>><a href="<?php echo $this->spam_checker->getPageScriptName(); ?>?page=ct_check_<?php echo $this->spam_checker->getPageSlug(); ?>_bad"><?php esc_html_e( 'Non-checkable users', 'cleantalk-spam-protect') ?></a></li>
107
+ <li <?php echo (3 == $this->current_tab) ? 'class="active"' : ''; ?>><a href="<?php echo $this->spam_checker->getPageScriptName(); ?>?page=ct_check_<?php echo $this->spam_checker->getPageSlug(); ?>_logs"><?php esc_html_e( 'Scan logs', 'cleantalk-spam-protect') ?></a></li>
108
+ </ul>
109
+ <div id="ct_check_content">
110
+ <?php
111
+
112
+ }
113
+
114
+ public static function setScreenOption() {
115
+
116
+ $option = 'per_page';
117
+ $args = array(
118
+ 'label' => esc_html__( 'Show per page', 'cleantalk-spam-protect'),
119
+ 'default' => 10,
120
+ 'option' => 'spam_per_page',
121
+ );
122
+ add_screen_option( $option, $args );
123
+
124
+ }
125
+
126
+ private static function closeTags() {
127
+
128
+ ?>
129
+ </div>
130
+ </div>
131
+ <?php
132
+
133
+ }
134
+
135
  }
lib/Cleantalk/ApbctWP/FindSpam/UsersChecker.php CHANGED
@@ -29,7 +29,7 @@ class UsersChecker extends Checker
29
  'ct_confirm_deletion_all' => __('Do you confirm deletion selected accounts and all content owned by the accounts? Please do backup of the site before deletion!', 'cleantalk-spam-protect'),
30
  'ct_iusers' => __('users.', 'cleantalk-spam-protect'),
31
  'ct_csv_filename' => "user_check_by_".$current_user->user_login,
32
- 'ct_status_string' => __("Checked %s, found %s spam users and %s bad users (without IP or email)", 'cleantalk-spam-protect'),
33
  'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk-spam-protect')."</p>"
34
  ));
35
 
@@ -59,6 +59,17 @@ class UsersChecker extends Checker
59
 
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
62
  /**
63
  * Getting a count of total users of the website and return formatted string about this.
64
  *
@@ -384,7 +395,7 @@ class UsersChecker extends Checker
384
 
385
  if( ! $direct_call ) {
386
  $return['message'] .= sprintf (
387
- esc_html__('Checked %s, found %s spam users and %s bad users (without IP or email)', 'cleantalk-spam-protect'),
388
  $cnt_checked,
389
  $cnt_spam,
390
  $cnt_bad
@@ -398,7 +409,7 @@ class UsersChecker extends Checker
398
 
399
  if ( $res ) {
400
  $return['message'] .= sprintf (
401
- __("Last check %s: checked %s users, found %s spam users and %s bad users (without IP or email).", 'cleantalk-spam-protect'),
402
  self::lastCheckDate(),
403
  $cnt_checked,
404
  $cnt_spam,
29
  'ct_confirm_deletion_all' => __('Do you confirm deletion selected accounts and all content owned by the accounts? Please do backup of the site before deletion!', 'cleantalk-spam-protect'),
30
  'ct_iusers' => __('users.', 'cleantalk-spam-protect'),
31
  'ct_csv_filename' => "user_check_by_".$current_user->user_login,
32
+ 'ct_status_string' => __("Checked %s, found %s spam users and %s non-checkable users (without IP or email)", 'cleantalk-spam-protect'),
33
  'ct_status_string_warning' => "<p>".__("Please do backup of WordPress database before delete any accounts!", 'cleantalk-spam-protect')."</p>"
34
  ));
35
 
59
 
60
  }
61
 
62
+ public function getBadUsersPage(){
63
+
64
+ $this->list_table = new \Cleantalk\ApbctWP\FindSpam\ListTable\BadUsers();
65
+
66
+ echo '<h3>' . esc_html__( "These users can't be checked because they haven't IP or e-mail", 'cleantalk-spam-protect' ) . '</h3>';
67
+ echo '<form action="" method="POST">';
68
+ $this->list_table->display();
69
+ echo '</form>';
70
+
71
+ }
72
+
73
  /**
74
  * Getting a count of total users of the website and return formatted string about this.
75
  *
395
 
396
  if( ! $direct_call ) {
397
  $return['message'] .= sprintf (
398
+ esc_html__('Checked %s, found %s spam users and %s non-checkable users (without IP or email)', 'cleantalk-spam-protect'),
399
  $cnt_checked,
400
  $cnt_spam,
401
  $cnt_bad
409
 
410
  if ( $res ) {
411
  $return['message'] .= sprintf (
412
+ __("Last check %s: checked %s users, found %s spam users and %s non-checkable users (without IP or email).", 'cleantalk-spam-protect'),
413
  self::lastCheckDate(),
414
  $cnt_checked,
415
  $cnt_spam,
lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php CHANGED
@@ -52,7 +52,7 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
52
 
53
  if( empty( $response_code['error'] ) ){
54
 
55
- if( $response_code == 200 || $response_code == 501 ){
56
 
57
  $gz_data = \Cleantalk\ApbctWP\Helper::http__request__get_content( $file_url_ua );
58
 
@@ -109,17 +109,17 @@ class AntiCrawler extends \Cleantalk\Common\Firewall\FirewallModule{
109
  }else
110
  return $result__clear_db;
111
  }else
112
- return array('error' => 'COULD_DECODE_MULTIFILE');
113
  }else
114
  return array('error' => 'FUNCTION_GZ_DECODE_DOES_NOT_EXIST');
115
  }else
116
- return array('error' => 'WRONG_MULTIFILE_MIME_TYPE');
117
  }else
118
- return array('error' => 'COULD_NOT_GET_MULTIFILE: ' . $gz_data['error'] );
119
  }else
120
- return array('error' => 'MULTIFILE_BAD_RESPONSE_CODE: '. (int) $response_code );
121
  }else
122
- return array('error' => 'MULTIFILE_COULD_NOT_GET_RESPONSE_CODE: '. $response_code['error'] );
123
 
124
  }
125
 
52
 
53
  if( empty( $response_code['error'] ) ){
54
 
55
+ if( $response_code == 200 ){
56
 
57
  $gz_data = \Cleantalk\ApbctWP\Helper::http__request__get_content( $file_url_ua );
58
 
109
  }else
110
  return $result__clear_db;
111
  }else
112
+ return array('error' => 'COULD_DECODE_UAL_FILE');
113
  }else
114
  return array('error' => 'FUNCTION_GZ_DECODE_DOES_NOT_EXIST');
115
  }else
116
+ return array('error' => 'WRONG_UAL_MIME_TYPE');
117
  }else
118
+ return array('error' => 'COULD_NOT_GET_UAL: ' . $gz_data['error'] );
119
  }else
120
+ return array('error' => 'UAL_BAD_RESPONSE_CODE: '. (int) $response_code );
121
  }else
122
+ return array('error' => 'UAL_COULD_NOT_GET_RESPONSE_CODE: '. $response_code['error'] );
123
 
124
  }
125
 
lib/Cleantalk/ApbctWP/Firewall/SFW.php CHANGED
@@ -416,7 +416,7 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
416
 
417
  if( empty( $response_code['error'] ) ){
418
 
419
- if( $response_code == 200 || $response_code == 501 ){
420
 
421
  $gz_data = Helper::http__request__get_content( $file_url );
422
 
@@ -471,12 +471,14 @@ class SFW extends \Cleantalk\Common\Firewall\FirewallModule {
471
  }else
472
  return $result;
473
  }else{
 
 
 
 
 
 
474
 
475
- $response_code = Helper::http__request( 'https://' . $file_url, array(), 'get_code' );
476
-
477
- if( empty( $response_code['error'] ) ){
478
-
479
- if( $response_code == 200 || $response_code == 501 ){ // Check if it's there
480
 
481
  $gz_data = Helper::http__request__get_content( $file_url );
482
 
416
 
417
  if( empty( $response_code['error'] ) ){
418
 
419
+ if( $response_code == 200 ){
420
 
421
  $gz_data = Helper::http__request__get_content( $file_url );
422
 
471
  }else
472
  return $result;
473
  }else{
474
+
475
+ $file_url = 'https://' . $file_url;
476
+
477
+ $response_code = Helper::http__request__get_response_code( $file_url );
478
+
479
+ if( empty( $response_code['error'] ) ){
480
 
481
+ if( $response_code == 200 ){ // Check if it's there
 
 
 
 
482
 
483
  $gz_data = Helper::http__request__get_content( $file_url );
484
 
lib/Cleantalk/ApbctWP/RestController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\ApbctWP;
4
+
5
+ class RestController extends \WP_REST_Controller {
6
+
7
+ public function __construct()
8
+ {
9
+ $this->namespace = 'cleantalk-antispam/v1';
10
+ }
11
+
12
+ public function register_routes()
13
+ {
14
+ register_rest_route( $this->namespace, "/js_keys__get", array(
15
+ array(
16
+ 'methods' => 'POST',
17
+ 'callback' => 'apbct_js_keys__get__ajax',
18
+ )
19
+ ) );
20
+ }
21
+
22
+ }
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -52,6 +52,7 @@ use ArrayObject;
52
  class State
53
  {
54
  public $user = null;
 
55
  public $option_prefix = 'cleantalk';
56
  public $storage = array();
57
  public $integrations = array();
52
  class State
53
  {
54
  public $user = null;
55
+ public $use_rest_api = 0;
56
  public $option_prefix = 'cleantalk';
57
  public $storage = array();
58
  public $integrations = array();
lib/Cleantalk/Common/API.php CHANGED
@@ -149,13 +149,9 @@ class API
149
  'path_to_cms' => $path_to_cms,
150
  'auth_key' => $api_key,
151
  );
152
-
153
- $product_id = null;
154
- $product_id = $product_name == 'antispam' ? 1 : $product_id;
155
- $product_id = $product_name == 'anti-spam-hosting' ? 3 : $product_id;
156
- $product_id = $product_name == 'security' ? 4 : $product_id;
157
- if($product_id)
158
- $request['product_id'] = $product_id;
159
 
160
  $result = static::send_request($request);
161
  $result = $do_check ? static::check_response($result, 'notice_paid_till') : $result;
@@ -598,19 +594,19 @@ class API
598
  }
599
 
600
  /**
601
- * Settings tempaltes get API method wrapper
602
  *
603
  * @param string $api_key
604
  * @param bool $do_check
605
  *
606
  * @return array|bool|mixed
607
  */
608
- static public function method__services_templates_get( $api_key, $do_check = true)
609
  {
610
  $request = array(
611
- 'method_name' => 'services_templates_get',
612
- 'auth_key' => $api_key,
613
- 'mode' => 'site',
614
  );
615
 
616
  $result = static::send_request( $request );
@@ -620,7 +616,7 @@ class API
620
  }
621
 
622
  /**
623
- * Settings tempaltes add API method wrapper
624
  *
625
  * @param string $api_key
626
  * @param null $template_name
@@ -628,13 +624,14 @@ class API
628
  *
629
  * @return array|bool|mixed
630
  */
631
- static public function method__services_templates_add( $api_key, $template_name = null, $do_check = true)
632
  {
633
  $request = array(
634
- 'method_name' => 'services_templates_add',
635
- 'auth_key' => $api_key,
636
- 'name' => $template_name,
637
- 'options_site'=> apbct_get_plugin_options(),
 
638
  );
639
 
640
  $result = static::send_request( $request );
@@ -644,7 +641,7 @@ class API
644
  }
645
 
646
  /**
647
- * Settings tempaltes add API method wrapper
648
  *
649
  * @param string $api_key
650
  * @param int $template_id
@@ -653,14 +650,15 @@ class API
653
  *
654
  * @return array|bool|mixed
655
  */
656
- static public function method__services_templates_update( $api_key, $template_id, $template_name = null, $do_check = true)
657
  {
658
  $request = array(
659
- 'method_name' => 'services_templates_update',
660
- 'auth_key' => $api_key,
661
- 'template_id' => $template_id,
662
- 'name' => $template_name,
663
- 'options_site'=> apbct_get_plugin_options(),
 
664
  );
665
 
666
  $result = static::send_request( $request );
@@ -668,6 +666,35 @@ class API
668
 
669
  return $result;
670
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
 
672
  /**
673
  * Function sends raw request to API server
149
  'path_to_cms' => $path_to_cms,
150
  'auth_key' => $api_key,
151
  );
152
+
153
+ if( self::get_product_id( $product_name ) )
154
+ $request['product_id'] = self::get_product_id( $product_name );
 
 
 
 
155
 
156
  $result = static::send_request($request);
157
  $result = $do_check ? static::check_response($result, 'notice_paid_till') : $result;
594
  }
595
 
596
  /**
597
+ * Settings templates get API method wrapper
598
  *
599
  * @param string $api_key
600
  * @param bool $do_check
601
  *
602
  * @return array|bool|mixed
603
  */
604
+ static public function method__services_templates_get( $api_key, $product_name = 'antispam', $do_check = true)
605
  {
606
  $request = array(
607
+ 'method_name' => 'services_templates_get',
608
+ 'auth_key' => $api_key,
609
+ 'search[product_id]' => self::get_product_id( $product_name ),
610
  );
611
 
612
  $result = static::send_request( $request );
616
  }
617
 
618
  /**
619
+ * Settings templates add API method wrapper
620
  *
621
  * @param string $api_key
622
  * @param null $template_name
624
  *
625
  * @return array|bool|mixed
626
  */
627
+ static public function method__services_templates_add( $api_key, $template_name = null, $options = '', $product_name = 'antispam', $do_check = true)
628
  {
629
  $request = array(
630
+ 'method_name' => 'services_templates_add',
631
+ 'auth_key' => $api_key,
632
+ 'name' => $template_name,
633
+ 'options_site' => $options,
634
+ 'search[product_id]' => self::get_product_id( $product_name ),
635
  );
636
 
637
  $result = static::send_request( $request );
641
  }
642
 
643
  /**
644
+ * Settings templates add API method wrapper
645
  *
646
  * @param string $api_key
647
  * @param int $template_id
650
  *
651
  * @return array|bool|mixed
652
  */
653
+ static public function method__services_templates_update( $api_key, $template_id, $options = '', $product_name = 'antispam', $do_check = true)
654
  {
655
  $request = array(
656
+ 'method_name' => 'services_templates_update',
657
+ 'auth_key' => $api_key,
658
+ 'template_id' => $template_id,
659
+ 'name' => null,
660
+ 'options_site' => $options,
661
+ 'search[product_id]' => self::get_product_id( $product_name ),
662
  );
663
 
664
  $result = static::send_request( $request );
666
 
667
  return $result;
668
  }
669
+
670
+ public static function method__private_list_add__sfw_wl( $user_token, $ip, $service_id, $do_check = true ) {
671
+
672
+ $request = array(
673
+ 'method_name' => 'private_list_add',
674
+ 'user_token' => $user_token,
675
+ 'service_id' => $service_id,
676
+ 'records' => $ip,
677
+ 'service_type' => 'spamfirewall',
678
+ 'product_id' => 1,
679
+ 'record_type' => 6,
680
+ 'note' => 'Website admin IP. Added automatically.',
681
+ 'status' => 'allow',
682
+ 'expired' => date( 'Y-m-d H:i:s', time() + 86400 * 30 ),
683
+ );
684
+
685
+ $result = static::send_request( $request );
686
+ $result = $do_check ? static::check_response($result) : $result;
687
+
688
+ return $result;
689
+
690
+ }
691
+
692
+ private static function get_product_id( $product_name ) {
693
+ $product_id = null;
694
+ $product_id = $product_name === 'antispam' ? 1 : $product_id;
695
+ $product_id = $product_name === 'security' ? 4 : $product_id;
696
+ return $product_id;
697
+ }
698
 
699
  /**
700
  * Function sends raw request to API server
lib/Cleantalk/Common/Firewall.php CHANGED
@@ -206,6 +206,8 @@ class Firewall
206
  */
207
  private function is_whitelisted( $results ) {
208
 
 
 
209
  foreach ( $this->fw_modules as $module ) {
210
  if( array_key_exists( $module->module_name, $results ) ){
211
  foreach ( $results[$module->module_name] as $fw_result ) {
@@ -214,6 +216,10 @@ class Firewall
214
  strpos( $fw_result['status'], 'PASS_BY_WHITELIST' ) !== false ||
215
  strpos( $fw_result['status'], 'PASS_SFW__BY_WHITELIST' ) !== false
216
  ) {
 
 
 
 
217
  return true;
218
  }
219
  }
206
  */
207
  private function is_whitelisted( $results ) {
208
 
209
+ global $apbct;
210
+
211
  foreach ( $this->fw_modules as $module ) {
212
  if( array_key_exists( $module->module_name, $results ) ){
213
  foreach ( $results[$module->module_name] as $fw_result ) {
216
  strpos( $fw_result['status'], 'PASS_BY_WHITELIST' ) !== false ||
217
  strpos( $fw_result['status'], 'PASS_SFW__BY_WHITELIST' ) !== false
218
  ) {
219
+ if( ! headers_sent() ) {
220
+ $cookie_val = md5( $fw_result['ip'] . $apbct->api_key );
221
+ \Cleantalk\Common\Helper::apbct_cookie__set( 'ct_sfw_ip_wl', $cookie_val, time() + 86400 * 30, '/', null, false, true, 'Lax' );
222
+ }
223
  return true;
224
  }
225
  }
lib/Cleantalk/Common/Helper.php CHANGED
@@ -792,14 +792,17 @@ class Helper
792
 
793
  /**
794
  * Universal method to adding cookies
 
795
  *
796
- * @param $name
797
- * @param string $value
798
- * @param int $expires
 
 
799
  * @param string $path
800
- * @param null $domain
801
- * @param bool $secure
802
- * @param bool $httponly
803
  * @param string $samesite
804
  *
805
  * @return void
@@ -965,6 +968,11 @@ class Helper
965
  $key_parts = explode('_', $server_key);
966
  if(count($key_parts) > 0 and strlen($server_key) > 2){
967
  foreach($key_parts as $part_index => $part){
 
 
 
 
 
968
  $key_parts[$part_index] = function_exists('mb_strtolower') ? mb_strtolower($part) : strtolower($part);
969
  $key_parts[$part_index][0] = strtoupper($key_parts[$part_index][0]);
970
  }
792
 
793
  /**
794
  * Universal method to adding cookies
795
+ * Wrapper for setcookie() Conisdering PHP version
796
  *
797
+ * @see https://www.php.net/manual/ru/function.setcookie.php
798
+ *
799
+ * @param string $name Cookie name
800
+ * @param string $value Cookie value
801
+ * @param int $expires Expiration timestamp. 0 - expiration with session
802
  * @param string $path
803
+ * @param null $domain
804
+ * @param bool $secure
805
+ * @param bool $httponly
806
  * @param string $samesite
807
  *
808
  * @return void
968
  $key_parts = explode('_', $server_key);
969
  if(count($key_parts) > 0 and strlen($server_key) > 2){
970
  foreach($key_parts as $part_index => $part){
971
+
972
+ if( $part_index === '' ){
973
+ continue;
974
+ }
975
+
976
  $key_parts[$part_index] = function_exists('mb_strtolower') ? mb_strtolower($part) : strtolower($part);
977
  $key_parts[$part_index][0] = strtoupper($key_parts[$part_index][0]);
978
  }
readme.txt CHANGED
@@ -4,14 +4,14 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.4
7
- Stable tag: 5.154
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
11
 
12
  == Description ==
13
 
14
- **Supports: Contact Form 7, Contact Form by WPForms, Ninja Forms, Gravity Forms, MailChimp, Formidable forms, WooCommerce, JetPack comments and contact form, BuddyPress, bbPress, S2Member, MailPoet, wpDiscuz, ConvertKit, ActiveCampaign, Events Manager, Avada Theme Form Builder, any WordPress registrations & contact forms and themes. Just set up and forget the spam!**
15
 
16
  No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal AntiSpam plugin.
17
 
@@ -39,7 +39,7 @@ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bo
39
 
40
  = Public reviews =
41
  > CleanTalk - Cloud-Based Anti-Spam Service to Keep Your Site Bot-Free.
42
- > <a href="https://newswatchtv.com/2018/07/18/cleantalk-newswatch-review/" rarget="_blank">NewsWatch Review</a>.
43
 
44
  > Using CleanTalk on WPLift was a great test as we receive huge amounts of spam.
45
  > *Oliver Dale, <a href="http://wplift.com/wordpress-anti-spam-plugin" target="_blank">WPLift.com</a>.*
@@ -60,7 +60,7 @@ Native spam protection for WordPress, JetPack comments and any other comment plu
60
  Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
61
 
62
  = Spam filter for contact forms =
63
- The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing Page Builder, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Contact Us Form, WCP Contact Form, WPForms Lite, Custom Contact, Forms, Caldera Forms, Visual Form Builder, Contact Form Clean and Simple, Divi by Elegant Themes, The7 theme and any other themes or custom contact forms, amoForms, Ultimate Form Builder, Contact Bank - Contact Forms Builder, Forms easily built with Smart Forms, Usernoise contact form, Contact Form by Web-Settler, HubSpot Marketing Free, QuForm, Form Maker by 10Web, WP User Frontend, NEX-Forms, Avada Theme Form Builder.
64
 
65
  = WooCommerce spam filter =
66
  Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
@@ -580,6 +580,42 @@ If your website has forms that send data to external sources, you can enable opt
580
 
581
  == Changelog ==
582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  = 5.154 Mar 17 2021 =
584
  * New: Settings Templates functionality implemented.
585
  * New: SFW. Anti-flood protection uses UA lists for filtration.
4
  Requires at least: 3.0
5
  Tested up to: 5.7
6
  Requires PHP: 5.4
7
+ Stable tag: 5.155
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
11
 
12
  == Description ==
13
 
14
+ **Supports: Contact Form 7, Contact Form by WPForms, Ninja Forms, Gravity Forms, MailChimp, Formidable forms, Forminator, WooCommerce, JetPack comments and contact form, BuddyPress, bbPress, S2Member, MailPoet, wpDiscuz, ConvertKit, ActiveCampaign, Events Manager, Avada Theme Form Builder, any WordPress registrations & contact forms and themes. Just set up and forget the spam!**
15
 
16
  No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal AntiSpam plugin.
17
 
39
 
40
  = Public reviews =
41
  > CleanTalk - Cloud-Based Anti-Spam Service to Keep Your Site Bot-Free.
42
+ > <a href="https://newswatchtv.com/2018/07/18/cleantalk-newswatch-review/" target="_blank">NewsWatch Review</a>.
43
 
44
  > Using CleanTalk on WPLift was a great test as we receive huge amounts of spam.
45
  > *Oliver Dale, <a href="http://wplift.com/wordpress-anti-spam-plugin" target="_blank">WPLift.com</a>.*
60
  Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
61
 
62
  = Spam filter for contact forms =
63
+ The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing Page Builder, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Contact Us Form, WCP Contact Form, WPForms Lite, Custom Contact, Forms, Caldera Forms, Visual Form Builder, Contact Form Clean and Simple, Divi by Elegant Themes, The7 theme and any other themes or custom contact forms, amoForms, Ultimate Form Builder, Contact Bank - Contact Forms Builder, Forms easily built with Smart Forms, Usernoise contact form, Contact Form by Web-Settler, HubSpot Marketing Free, QuForm, Form Maker by 10Web, WP User Frontend, NEX-Forms.
64
 
65
  = WooCommerce spam filter =
66
  Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
580
 
581
  == Changelog ==
582
 
583
+ = 5.155 Mar 31 2021 =
584
+ * New: Debug. Check connection to API servers.
585
+ * New: Integration. Avada Form Builder.
586
+ * New: Integration. Forminator integration implemented.
587
+ * New: Users checker. Non-checked users tab added.
588
+ * New: SFW. Admin IP will be whitelisted automatically.
589
+ * Mod: Replace "bad" users/comments to "non-checkable".
590
+ * Mod: DisableComments. Disable all comments means disable all comments for any post type.
591
+ * Udp: Setting templates. Product ID support implemented.
592
+ * Udp: Settings. Reorder links actions buttons.
593
+ * Upd: Common. Getting check_js updated.
594
+ * Upd: SFW. Description updated.
595
+ * Fix: Reversed URL exclusions.
596
+ * Fix: Settings. Sync button success ico fixed.
597
+ * Fix: Show response for all AJAX forms #3.
598
+ * Fix: GDPR. Warning text output.
599
+ * Fix: Integration class consider settings.
600
+ * Fix: Exclusions. URL exclusions fixed.
601
+ * Fix: Services Templates. Getting templates optimized.
602
+ * Fix: Services Templates. Possible XSS fixed.
603
+ * Fix: Services Templates. Design layout fixed.
604
+ * Fix: Family of settings comments__disable_comments__* dependencies.
605
+ * Fix: DisableComments class. Media post type includes 'attachment' type.
606
+ * Fix: Exclusion for Thrive Ultimatum.
607
+ * Fix: Common/Helper::http__get_headers() ignores empty header name parts.
608
+ * Fix: Exclusion for GiveWP plugin in apbct-public.js.
609
+ * Fix: Do not consider 501 as correct HTTP response code when getting FW data files.
610
+ * Fix: AntiCrawler::update(). Correct error codes.
611
+ * Fix: ApbctWP\Firewall\SFW::update(). Correct URLs for FILE with protocol.
612
+ * Fix: PHP 8 deprecated notices.
613
+ * Fix: Settings. Reversed dependencies. Applies to WooCommerce and Disable Comments settings.
614
+ * Fix: DisableComments::template__check() returns the correct number of comments for enabled types of posts.
615
+ * Fix: DisableComments class. Visibility of some methods.
616
+ * Exception: Paid Memberships Pro - Login Form.
617
+ * Fix: Exception the SFW check for queries with '/favicon.ico' string.
618
+
619
  = 5.154 Mar 17 2021 =
620
  * New: Settings Templates functionality implemented.
621
  * New: SFW. Anti-flood protection uses UA lists for filtration.