Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.163

Version Description

Oct 07 2021 = * New: State. errorExists method implemented. * New: SFW. Disabling SFW when the database was outdated. * New: Settings templates. Saving template to the several blogs implemented. * New: Settings. WPMS settings always show now. * New: WPMS. No show any sub-sites errors on wpms mode 2. * New: WPMS. Plugin settings are disabled on sub-sites on wpms mode 2. * Mod: Remote Calls using POST instead of GET request type. * Mod: Helper. No cache GET parameter renamed. * Mod: Cron. Transactions implemented #2. * Mod: Settings. "URL Exclusions" description updated. * Upd: Getting JS. AJAX handler type selecting updated. * Fix: Added lost info about total comments in CommentChecker::ctAjaxInfo * Fix: add subscriber to skip list. * Fix: Changed the plugin name in the list of plugins when enabling White Label * Fix: Changed the plugin name in the admin bar when enabling White Label * Fix: Feedback. Comments feedback description fixed. * Fix: Hide information about Security in admin bar if it is not main site. * Fix: SFW. Error toggle used instead of error add/delete. * Fix: Alt cookies. Selecting type of alt cookies bug fixed. * Fix: protect logged users in gravity. * Fix: Updated the condition for showing a link to the security installation in the admin bar. * Fix: reverse condition for WL security link. * Fix: WPMS. Addition WL info link fixed. * Changed plugin name in plugin settings multisite_white_labelplugin_name. * Fix: rename plugin name after search plugins if WL is on. * Fix: Renamed Antispam by Cleantalk to Anti-spam by Cleantalk * Fix: add elementor-pro to skip save action. * Fix: WPMS. Sanitize api key during getting key fixed. * Fix: Cron. Cron results errors handling fixed. * Fix: WPMS. Migrate old WPMS to the new wpms mode. * Fix: WPMS. Using main site data on wpmsmode=2. * Fix: Helper. Hard use https for the curl requests. * Fix: WPMS. Sanitize network settings fixed. * Fix: WPMS. Applying settings for selected blogs fixed. * Fix: Getting key. Sync after getting key fixed.

Download this release

Release Info

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

Code changes from version 5.162 to 5.163

cleantalk.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Anti-Spam by CleanTalk
5
  Plugin URI: https://cleantalk.org
6
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
7
- Version: 5.162
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
@@ -31,7 +31,7 @@ use Cleantalk\ApbctWP\Variables\Cookie;
31
  use Cleantalk\Common\DNS;
32
  use Cleantalk\Common\Firewall;
33
  use Cleantalk\Common\Schema;
34
- use Cleantalk\Variables\Get;
35
  use Cleantalk\Variables\Server;
36
 
37
  global $apbct, $wpdb, $pagenow;
@@ -149,19 +149,19 @@ function apbct_alt_session__save__WP_AJAX()
149
  Cleantalk\ApbctWP\Variables\AltSessions::setFromRemote();
150
  }
151
 
 
 
 
 
152
  // Database prefix
153
  global $wpdb;
154
  $apbct->db_prefix = ! APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
155
  $apbct->db_prefix = ! $apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
156
 
157
- // Set some defines
158
- State::setDefinitions();
159
-
160
  /** @todo HARDCODE FIX */
161
  if ( $apbct->plugin_version === '1.0.0' ) {
162
  $apbct->plugin_version = '5.100';
163
  }
164
-
165
  // Do update actions if version is changed
166
  apbct_update_actions();
167
 
@@ -180,11 +180,11 @@ add_action('init', function () {
180
  ) {
181
  $cron_res = $ct_cron->runTasks($tasks_to_run);
182
  if ( is_array($cron_res) ) {
183
- foreach ( $cron_res as $task => $res ) {
184
  if ( $res === true ) {
185
- $apbct->errorDelete($task, 'save_data', 'cron');
186
  } else {
187
- $apbct->errorAdd($task, $res, 'cron');
188
  }
189
  }
190
  }
@@ -533,7 +533,7 @@ if ( is_admin() || is_network_admin() ) {
533
  2
534
  );
535
 
536
- add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
537
  }
538
  // Public pages actions
539
  } else {
@@ -638,6 +638,22 @@ function apbct_sfw__check()
638
  return;
639
  }
640
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
641
  $firewall = new Firewall(
642
  DB::getInstance()
643
  );
@@ -820,6 +836,15 @@ function apbct_sfw_update__init($delay = 0)
820
  return array('error' => 'SFW UPDATE INIT: KEY_IS_NOT_VALID');
821
  }
822
 
 
 
 
 
 
 
 
 
 
823
  $apbct->fw_stats['updating_folder'] = APBCT_DIR_PATH . DIRECTORY_SEPARATOR . 'fw_files_for_blog_' . get_current_blog_id() . DIRECTORY_SEPARATOR;
824
 
825
  $prepare_dir__result = apbct_prepare_upd_dir();
@@ -879,8 +904,8 @@ function apbct_sfw_update__worker($checker_work = false)
879
 
880
  if ( ! $checker_work ) {
881
  if (
882
- Get::equal('firewall_updating_id', '') ||
883
- ! Get::equal('firewall_updating_id', $apbct->fw_stats['firewall_updating_id'])
884
  ) {
885
  return array('error' => 'Worker: WRONG_UPDATE_ID');
886
  }
@@ -930,7 +955,7 @@ function apbct_sfw_update__worker($checker_work = false)
930
  }
931
 
932
  // This is the repeat stage request, do not generate any new RC
933
- if ( stripos(Get::get('stage'), 'Repeat') !== false ) {
934
  return true;
935
  }
936
 
@@ -1296,12 +1321,8 @@ function apbct_sfw_update__end_of_update($is_direct_update = false)
1296
  // Delete update errors
1297
  $apbct->errorDelete('sfw_update', 'save_settings');
1298
 
1299
- // Get update period for server
1300
- $update_period = DNS::getRecord('spamfirewall-ttl-txt.cleantalk.org', true, DNS_TXT);
1301
- $update_period = isset($update_period['txt']) ? $update_period['txt'] : 0;
1302
- $update_period = (int)$update_period > 14400 ? (int)$update_period : 14400;
1303
- $cron = new Cron();
1304
- $cron->updateTask('sfw_update', 'apbct_sfw_update__init', $update_period);
1305
  $cron->removeTask('sfw_update_checker');
1306
 
1307
  /**
4
  Plugin Name: Anti-Spam by CleanTalk
5
  Plugin URI: https://cleantalk.org
6
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
7
+ Version: 5.163
8
  Author: СleanTalk <welcome@cleantalk.org>
9
  Author URI: https://cleantalk.org
10
  Text Domain: cleantalk-spam-protect
31
  use Cleantalk\Common\DNS;
32
  use Cleantalk\Common\Firewall;
33
  use Cleantalk\Common\Schema;
34
+ use Cleantalk\Variables\Request;
35
  use Cleantalk\Variables\Server;
36
 
37
  global $apbct, $wpdb, $pagenow;
149
  Cleantalk\ApbctWP\Variables\AltSessions::setFromRemote();
150
  }
151
 
152
+ // Get JS via WP ajax handler
153
+ add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
154
+ add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
155
+
156
  // Database prefix
157
  global $wpdb;
158
  $apbct->db_prefix = ! APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
159
  $apbct->db_prefix = ! $apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
160
 
 
 
 
161
  /** @todo HARDCODE FIX */
162
  if ( $apbct->plugin_version === '1.0.0' ) {
163
  $apbct->plugin_version = '5.100';
164
  }
 
165
  // Do update actions if version is changed
166
  apbct_update_actions();
167
 
180
  ) {
181
  $cron_res = $ct_cron->runTasks($tasks_to_run);
182
  if ( is_array($cron_res) ) {
183
+ foreach ( $cron_res as $_task => $res ) {
184
  if ( $res === true ) {
185
+ $apbct->errorDelete('cron', 'save_data');
186
  } else {
187
+ $apbct->errorAdd('cron', $res);
188
  }
189
  }
190
  }
533
  2
534
  );
535
 
536
+ add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 3);
537
  }
538
  // Public pages actions
539
  } else {
638
  return;
639
  }
640
 
641
+ // Checking if database was outdated
642
+ $is_sfw_outdated = $apbct->stats['sfw']['last_update_time'] + $apbct->stats['sfw']['update_period'] * 3 < time();
643
+
644
+ $apbct->errorToggle(
645
+ $is_sfw_outdated,
646
+ 'sfw_outdated',
647
+ esc_html__(
648
+ 'SpamFireWall database is outdated. Please, try to synchronize with the cloud.',
649
+ 'cleantalk-spam-protect'
650
+ )
651
+ );
652
+
653
+ if ( $is_sfw_outdated ) {
654
+ return;
655
+ }
656
+
657
  $firewall = new Firewall(
658
  DB::getInstance()
659
  );
836
  return array('error' => 'SFW UPDATE INIT: KEY_IS_NOT_VALID');
837
  }
838
 
839
+ // Get update period for server
840
+ $update_period = DNS::getRecord('spamfirewall-ttl-txt.cleantalk.org', true, DNS_TXT);
841
+ $update_period = isset($update_period['txt']) ? $update_period['txt'] : 0;
842
+ $update_period = (int)$update_period > 14400 ? (int)$update_period : 14400;
843
+ if ( $apbct->stats['sfw']['update_period'] != $update_period ) {
844
+ $apbct->stats['sfw']['update_period'] = $update_period;
845
+ $apbct->save('stats');
846
+ }
847
+
848
  $apbct->fw_stats['updating_folder'] = APBCT_DIR_PATH . DIRECTORY_SEPARATOR . 'fw_files_for_blog_' . get_current_blog_id() . DIRECTORY_SEPARATOR;
849
 
850
  $prepare_dir__result = apbct_prepare_upd_dir();
904
 
905
  if ( ! $checker_work ) {
906
  if (
907
+ Request::equal('firewall_updating_id', '') ||
908
+ ! Request::equal('firewall_updating_id', $apbct->fw_stats['firewall_updating_id'])
909
  ) {
910
  return array('error' => 'Worker: WRONG_UPDATE_ID');
911
  }
955
  }
956
 
957
  // This is the repeat stage request, do not generate any new RC
958
+ if ( stripos(Request::get('stage'), 'Repeat') !== false ) {
959
  return true;
960
  }
961
 
1321
  // Delete update errors
1322
  $apbct->errorDelete('sfw_update', 'save_settings');
1323
 
1324
+ $cron = new Cron();
1325
+ $cron->updateTask('sfw_update', 'apbct_sfw_update__init', $apbct->stats['sfw']['update_period']);
 
 
 
 
1326
  $cron->removeTask('sfw_update_checker');
1327
 
1328
  /**
inc/cleantalk-admin.php CHANGED
@@ -339,12 +339,14 @@ function apbct_admin__plugin_action_links($links, $_file)
339
  *
340
  * @param $links
341
  * @param $file
 
342
  *
343
  * @return array
344
  */
345
- function apbct_admin__register_plugin_links($links, $file)
346
  {
347
  global $apbct;
 
348
 
349
  //Return if it's not our plugin
350
  if ( $file != $apbct->base_name ) {
@@ -353,10 +355,18 @@ function apbct_admin__register_plugin_links($links, $file)
353
 
354
  if ( $apbct->white_label ) {
355
  $links = array_slice($links, 0, 1);
356
- $links[] = "<script " . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '') . ">jQuery('.plugin-title strong').each(function(i, item){
357
- if(jQuery(item).html() == 'Anti-Spam by CleanTalk')
358
- jQuery(item).html('{$apbct->plugin_name}');
359
- });</script>";
 
 
 
 
 
 
 
 
360
 
361
  return $links;
362
  }
@@ -539,7 +549,8 @@ function apbct_admin__enqueue_scripts($hook)
539
  __("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk-spam-protect'),
540
  $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my?user_token={$apbct->user_token}&cp_mode=antispam>" : '',
541
  $apbct->user_token ? "</a>" : ''
542
- ),
 
543
  'ct_show_check_links' => (bool)$apbct->settings['comments__show_check_links'],
544
  'ct_img_src_new_tab' => plugin_dir_url(__FILE__) . "images/new_window.gif",
545
  ));
@@ -606,6 +617,11 @@ function apbct_admin__badge__get_premium($print = true, $out = '')
606
  function apbct_admin__admin_bar__add_structure($wp_admin_bar)
607
  {
608
  global $spbc, $apbct;
 
 
 
 
 
609
 
610
  do_action('cleantalk_admin_bar__prepare_counters');
611
 
@@ -615,13 +631,13 @@ function apbct_admin__admin_bar__add_structure($wp_admin_bar)
615
  'title' =>
616
  apply_filters('cleantalk_admin_bar__add_icon_to_parent_node', '') . // @deprecated
617
  apply_filters('cleantalk_admin_bar__parent_node__before', '') .
618
- '<span class="cleantalk_admin_bar__title">' . __('CleanTalk', 'cleantalk-spam-protect') . '</span>' .
619
  apply_filters('cleantalk_admin_bar__parent_node__after', ''),
620
  'meta' => array('class' => 'cleantalk-admin_bar--list_wrapper'),
621
  ));
622
 
623
  // Security
624
- $title = $apbct->notice_trial
625
  ? "<span><a href='https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial&user_token={$apbct->user_token}&cp_mode=antispam' target='_blank'>" . __(
626
  'Renew Anti-Spam',
627
  'cleantalk-spam-protect'
@@ -652,7 +668,8 @@ function apbct_admin__admin_bar__add_structure($wp_admin_bar)
652
  : '<a>' . __('Security', 'security-malware-firewall') . '</a>';
653
  }
654
 
655
- if ( isset($spbc_title) ) {
 
656
  $wp_admin_bar->add_node(array(
657
  'parent' => 'cleantalk_admin_bar__parent_node',
658
  'id' => 'spbc__parent_node',
339
  *
340
  * @param $links
341
  * @param $file
342
+ * @param $plugin_data
343
  *
344
  * @return array
345
  */
346
+ function apbct_admin__register_plugin_links($links, $file, $plugin_data)
347
  {
348
  global $apbct;
349
+ $plugin_name = $plugin_data['Name'] ?: 'Antispam by Cleantalk';
350
 
351
  //Return if it's not our plugin
352
  if ( $file != $apbct->base_name ) {
355
 
356
  if ( $apbct->white_label ) {
357
  $links = array_slice($links, 0, 1);
358
+ $links[] = "<script " . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '') . ">
359
+ function changedPluginName(){
360
+ jQuery('.plugin-title strong').each(function(i, item){
361
+ if(jQuery(item).html() == '{$plugin_name}')
362
+ jQuery(item).html('{$apbct->plugin_name}');
363
+ });
364
+ }
365
+ changedPluginName();
366
+ jQuery( document ).ajaxComplete(function() {
367
+ changedPluginName();
368
+ });
369
+ </script>";
370
 
371
  return $links;
372
  }
549
  __("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk-spam-protect'),
550
  $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my?user_token={$apbct->user_token}&cp_mode=antispam>" : '',
551
  $apbct->user_token ? "</a>" : ''
552
+ ) . ' ' . esc_html__('The service accepts feedback only for requests made no more than 7 or 45 days
553
+ (if the Additional package is activated) ago.', 'cleantalk-spam-protect'),
554
  'ct_show_check_links' => (bool)$apbct->settings['comments__show_check_links'],
555
  'ct_img_src_new_tab' => plugin_dir_url(__FILE__) . "images/new_window.gif",
556
  ));
617
  function apbct_admin__admin_bar__add_structure($wp_admin_bar)
618
  {
619
  global $spbc, $apbct;
620
+ $plugin_name = __('CleanTalk', 'cleantalk-spam-protect');
621
+
622
+ if ($apbct->white_label) {
623
+ $plugin_name = $apbct->plugin_name;
624
+ }
625
 
626
  do_action('cleantalk_admin_bar__prepare_counters');
627
 
631
  'title' =>
632
  apply_filters('cleantalk_admin_bar__add_icon_to_parent_node', '') . // @deprecated
633
  apply_filters('cleantalk_admin_bar__parent_node__before', '') .
634
+ '<span class="cleantalk_admin_bar__title">' . $plugin_name . '</span>' .
635
  apply_filters('cleantalk_admin_bar__parent_node__after', ''),
636
  'meta' => array('class' => 'cleantalk-admin_bar--list_wrapper'),
637
  ));
638
 
639
  // Security
640
+ $title = $apbct->notice_trial && ( is_main_site() && $apbct->network_settings['multisite__work_mode'] == 2 )
641
  ? "<span><a href='https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial&user_token={$apbct->user_token}&cp_mode=antispam' target='_blank'>" . __(
642
  'Renew Anti-Spam',
643
  'cleantalk-spam-protect'
668
  : '<a>' . __('Security', 'security-malware-firewall') . '</a>';
669
  }
670
 
671
+ if ( isset($spbc_title) &&
672
+ (is_main_site() || !$apbct->white_label) ) {
673
  $wp_admin_bar->add_node(array(
674
  'parent' => 'cleantalk_admin_bar__parent_node',
675
  'id' => 'spbc__parent_node',
inc/cleantalk-ajax-handlers.php CHANGED
@@ -24,7 +24,6 @@ $apbct->white_label = $apbct->network_settings['multisite__white_label'];
24
  $apbct->allow_custom_key = $apbct->network_settings['multisite__work_mode'] != 2;
25
  $apbct->api_key = ! is_multisite(
26
  ) || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
27
- \Cleantalk\ApbctWP\State::setDefinitions();
28
 
29
  /*******************************************************************/
30
  /******************* H A N D L E R S H E R E *******************/
24
  $apbct->allow_custom_key = $apbct->network_settings['multisite__work_mode'] != 2;
25
  $apbct->api_key = ! is_multisite(
26
  ) || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
 
27
 
28
  /*******************************************************************/
29
  /******************* H A N D L E R S H E R E *******************/
inc/cleantalk-ajax.php CHANGED
@@ -512,9 +512,14 @@ function ct_ajax_hook($message_obj = null)
512
  }
513
  }
514
 
 
 
 
 
 
515
  $ct_temp_msg_data = isset($ct_post_temp)
516
  ? ct_get_fields_any($ct_post_temp)
517
- : ct_get_fields_any($_POST);
518
 
519
  $sender_email = $ct_temp_msg_data['email'] ?: '';
520
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
512
  }
513
  }
514
 
515
+ /**
516
+ * Filter for POST
517
+ */
518
+ $input_array = apply_filters('apbct__filter_post', $_POST);
519
+
520
  $ct_temp_msg_data = isset($ct_post_temp)
521
  ? ct_get_fields_any($ct_post_temp)
522
+ : ct_get_fields_any($input_array);
523
 
524
  $sender_email = $ct_temp_msg_data['email'] ?: '';
525
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
inc/cleantalk-common.php CHANGED
@@ -120,14 +120,6 @@ function apbct_base_call($params = array(), $reg_flag = false)
120
 
121
  global $apbct;
122
 
123
- // Fields exclusions
124
- if ( ! empty($params['message']) && is_array($params['message']) ) {
125
- $params['message'] = apbct_array($params['message'])
126
- ->getKeys($apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'])
127
- ->delete();
128
- }
129
- /* End of Exclusions */
130
-
131
  $cleantalk_executed = true;
132
 
133
  /* Request ID rotation */
@@ -611,7 +603,7 @@ function ct_get_checkjs_value()
611
  } elseif (
612
  $apbct->settings['data__use_static_js_key'] == -1 &&
613
  (apbct_is_cache_plugins_exists() ||
614
- (apbct_is_post() && $apbct->data['cache_detected'] == 1)
615
  )
616
  ) {
617
  $key = hash('sha256', $apbct->api_key . ct_get_admin_email() . $apbct->salt);
120
 
121
  global $apbct;
122
 
 
 
 
 
 
 
 
 
123
  $cleantalk_executed = true;
124
 
125
  /* Request ID rotation */
603
  } elseif (
604
  $apbct->settings['data__use_static_js_key'] == -1 &&
605
  (apbct_is_cache_plugins_exists() ||
606
+ (apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1)
607
  )
608
  ) {
609
  $key = hash('sha256', $apbct->api_key . ct_get_admin_email() . $apbct->salt);
inc/cleantalk-pluggable.php CHANGED
@@ -619,7 +619,7 @@ function apbct_is_skip_request($ajax = false)
619
  is_admin() ) {
620
  return 'w2dc_skipped';
621
  }
622
- if ( apbct_is_plugin_active('elementor/elementor.php') &&
623
  isset($_POST['actions_save_builder_action']) &&
624
  $_POST['actions_save_builder_action'] === 'save_builder' &&
625
  is_admin() ) {
619
  is_admin() ) {
620
  return 'w2dc_skipped';
621
  }
622
+ if ( (apbct_is_plugin_active('elementor/elementor.php') || apbct_is_plugin_active('elementor-pro/elementor-pro.php')) &&
623
  isset($_POST['actions_save_builder_action']) &&
624
  $_POST['actions_save_builder_action'] === 'save_builder' &&
625
  is_admin() ) {
inc/cleantalk-public-integrations.php CHANGED
@@ -74,8 +74,13 @@ function ct_validate_ccf_submission($value, $_field_id, $_required)
74
 
75
  unset($ct_global_temporary_data['count']);
76
 
 
 
 
 
 
77
  //Getting request params
78
- $ct_temp_msg_data = ct_get_fields_any($_POST);
79
 
80
  unset($ct_global_temporary_data);
81
 
@@ -449,8 +454,13 @@ function ct_woocommerce_checkout_check()
449
  {
450
  global $apbct, $cleantalk_executed;
451
 
 
 
 
 
 
452
  //Getting request params
453
- $ct_temp_msg_data = ct_get_fields_any($_POST);
454
 
455
  $sender_email = $ct_temp_msg_data['email'] ?: '';
456
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -584,8 +594,13 @@ function apbct_form__piratesForm__testSpam()
584
  return;
585
  }
586
 
 
 
 
 
 
587
  //Getting request params
588
- $ct_temp_msg_data = ct_get_fields_any($_POST);
589
 
590
  $sender_email = $ct_temp_msg_data['email'] ?: '';
591
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -707,8 +722,13 @@ function apbct_form__formidable__testSpam($errors, $_form)
707
  return $errors;
708
  }
709
 
 
 
 
 
 
710
  $form_data = array();
711
- foreach ( $_POST['item_meta'] as $key => $value ) {
712
  $form_data['item_meta[' . $key . ']'] = $value;
713
  }
714
 
@@ -1831,7 +1851,7 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null)
1831
  $apbct->settings['forms__contact_forms_test'] == 0 ||
1832
  ($spam === false && defined('WPCF7_VERSION') && WPCF7_VERSION < '3.0.0') ||
1833
  ($spam === true && defined('WPCF7_VERSION') && WPCF7_VERSION >= '3.0.0') ||
1834
- ($apbct->settings['data__protect_logged_in'] != 1 && is_user_logged_in()) || // Skip processing for logged in users.
1835
  apbct_exclusions_check__url() ||
1836
  apbct_exclusions_check__ip() ||
1837
  isset($apbct->cf7_checked)
@@ -1843,7 +1863,12 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null)
1843
 
1844
  $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST) ?: apbct_js_test('ct_checkjs', $_COOKIE, true);
1845
 
1846
- $ct_temp_msg_data = ct_get_fields_any($_POST);
 
 
 
 
 
1847
 
1848
  $sender_email = $ct_temp_msg_data['email'] ?: '';
1849
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -1968,9 +1993,14 @@ function apbct_form__ninjaForms__testSpam()
1968
 
1969
  $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
1970
 
 
 
 
 
 
1971
  // Choosing between POST and GET
1972
  $params = ct_get_fields_any(
1973
- isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST
1974
  );
1975
 
1976
  $sender_email = $params['email'] ?: '';
@@ -2096,7 +2126,12 @@ function apbct_form__seedprod_coming_soon__testSpam()
2096
  return;
2097
  }
2098
 
2099
- $ct_temp_msg_data = ct_get_fields_any($_REQUEST);
 
 
 
 
 
2100
 
2101
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2102
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -2191,7 +2226,12 @@ function apbct_from__WPForms__gatherData($entry, $form)
2191
  global $apbct;
2192
  $handled_result = array();
2193
 
2194
- $entry_fields_data = $entry['fields'] ?: array();
 
 
 
 
 
2195
  $form_fields_info = $form['fields'] ?: array();
2196
 
2197
  foreach ( $form_fields_info as $form_field ) {
@@ -2400,7 +2440,12 @@ function ct_quform_post_validate($result, $form)
2400
  $comment_type = 'contact_form_wordpress_quforms_singlepage';
2401
  }
2402
 
2403
- $ct_temp_msg_data = ct_get_fields_any($form->getValues());
 
 
 
 
 
2404
  // @ToDo If we have several emails at the form - will be used only the first detected!
2405
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2406
 
@@ -2463,8 +2508,13 @@ function ct_si_contact_form_validate($form_errors = array(), $_form_id_num = 0)
2463
  return $form_errors;
2464
  }
2465
 
 
 
 
 
 
2466
  //getting info from custom fields
2467
- $ct_temp_msg_data = ct_get_fields_any($_POST);
2468
 
2469
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2470
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -2621,6 +2671,9 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
2621
  if (
2622
  $is_spam ||
2623
  $apbct->settings['forms__contact_forms_test'] == 0 ||
 
 
 
2624
  $cleantalk_executed // Return unchanged result if the submission was already tested.
2625
  ) {
2626
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
@@ -2671,6 +2724,22 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
2671
 
2672
  # Search nickname and email
2673
  if ( $form_fields_intermediate ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2674
  foreach ( $form_fields_intermediate as $field ) {
2675
  if ( $field['f_type'] === 'email' ) {
2676
  $email = $field['f_data'];
@@ -2691,7 +2760,12 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
2691
  unset($key, $value);
2692
  }
2693
 
2694
- $ct_temp_msg_data = ct_get_fields_any($form_fields_for_ct, $email, array_shift($nickname));
 
 
 
 
 
2695
 
2696
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2697
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -2805,7 +2879,12 @@ function apbct_form__the7_contact_form()
2805
  if ( check_ajax_referer('dt_contact_form', 'nonce', false) && ! empty($_POST) ) {
2806
  $post_info['comment_type'] = 'contact_the7_theme_contact_form';
2807
 
2808
- $ct_temp_msg_data = ct_get_fields_any($_POST);
 
 
 
 
 
2809
 
2810
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2811
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
@@ -2869,7 +2948,12 @@ function apbct_form__elementor_pro__testSpam()
2869
  return;
2870
  }
2871
 
2872
- $ct_temp_msg_data = ct_get_fields_any($_POST);
 
 
 
 
 
2873
 
2874
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2875
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
74
 
75
  unset($ct_global_temporary_data['count']);
76
 
77
+ /**
78
+ * Filter for POST
79
+ */
80
+ $input_array = apply_filters('apbct__filter_post', $_POST);
81
+
82
  //Getting request params
83
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
84
 
85
  unset($ct_global_temporary_data);
86
 
454
  {
455
  global $apbct, $cleantalk_executed;
456
 
457
+ /**
458
+ * Filter for POST
459
+ */
460
+ $input_array = apply_filters('apbct__filter_post', $_POST);
461
+
462
  //Getting request params
463
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
464
 
465
  $sender_email = $ct_temp_msg_data['email'] ?: '';
466
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
594
  return;
595
  }
596
 
597
+ /**
598
+ * Filter for POST
599
+ */
600
+ $input_array = apply_filters('apbct__filter_post', $_POST);
601
+
602
  //Getting request params
603
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
604
 
605
  $sender_email = $ct_temp_msg_data['email'] ?: '';
606
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
722
  return $errors;
723
  }
724
 
725
+ /**
726
+ * Filter for POST
727
+ */
728
+ $input_array = apply_filters('apbct__filter_post', $_POST['item_meta']);
729
+
730
  $form_data = array();
731
+ foreach ( $input_array as $key => $value ) {
732
  $form_data['item_meta[' . $key . ']'] = $value;
733
  }
734
 
1851
  $apbct->settings['forms__contact_forms_test'] == 0 ||
1852
  ($spam === false && defined('WPCF7_VERSION') && WPCF7_VERSION < '3.0.0') ||
1853
  ($spam === true && defined('WPCF7_VERSION') && WPCF7_VERSION >= '3.0.0') ||
1854
+ ($apbct->settings['data__protect_logged_in'] != 1 && apbct_is_user_logged_in()) || // Skip processing for logged in users.
1855
  apbct_exclusions_check__url() ||
1856
  apbct_exclusions_check__ip() ||
1857
  isset($apbct->cf7_checked)
1863
 
1864
  $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST) ?: apbct_js_test('ct_checkjs', $_COOKIE, true);
1865
 
1866
+ /**
1867
+ * Filter for POST
1868
+ */
1869
+ $input_array = apply_filters('apbct__filter_post', $_POST);
1870
+
1871
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
1872
 
1873
  $sender_email = $ct_temp_msg_data['email'] ?: '';
1874
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
1993
 
1994
  $checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true);
1995
 
1996
+ /**
1997
+ * Filter for POST
1998
+ */
1999
+ $input_array = apply_filters('apbct__filter_post', $_POST);
2000
+
2001
  // Choosing between POST and GET
2002
  $params = ct_get_fields_any(
2003
+ isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $input_array
2004
  );
2005
 
2006
  $sender_email = $params['email'] ?: '';
2126
  return;
2127
  }
2128
 
2129
+ /**
2130
+ * Filter for POST
2131
+ */
2132
+ $input_array = apply_filters('apbct__filter_post', $_REQUEST);
2133
+
2134
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
2135
 
2136
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2137
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
2226
  global $apbct;
2227
  $handled_result = array();
2228
 
2229
+ /**
2230
+ * Filter for POST
2231
+ */
2232
+ $input_array = apply_filters('apbct__filter_post', $entry['fields']);
2233
+
2234
+ $entry_fields_data = $input_array ?: array();
2235
  $form_fields_info = $form['fields'] ?: array();
2236
 
2237
  foreach ( $form_fields_info as $form_field ) {
2440
  $comment_type = 'contact_form_wordpress_quforms_singlepage';
2441
  }
2442
 
2443
+ /**
2444
+ * Filter for POST
2445
+ */
2446
+ $input_array = apply_filters('apbct__filter_post', $form->getValues());
2447
+
2448
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
2449
  // @ToDo If we have several emails at the form - will be used only the first detected!
2450
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2451
 
2508
  return $form_errors;
2509
  }
2510
 
2511
+ /**
2512
+ * Filter for POST
2513
+ */
2514
+ $input_array = apply_filters('apbct__filter_post', $_POST);
2515
+
2516
  //getting info from custom fields
2517
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
2518
 
2519
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2520
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
2671
  if (
2672
  $is_spam ||
2673
  $apbct->settings['forms__contact_forms_test'] == 0 ||
2674
+ ($apbct->settings['data__protect_logged_in'] != 1 && apbct_is_user_logged_in()) || // Skip processing for logged in users.
2675
+ apbct_exclusions_check__url() ||
2676
+ apbct_exclusions_check__ip() ||
2677
  $cleantalk_executed // Return unchanged result if the submission was already tested.
2678
  ) {
2679
  do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
2724
 
2725
  # Search nickname and email
2726
  if ( $form_fields_intermediate ) {
2727
+ $form_fields_intermediate_keys = array();
2728
+ foreach ($form_fields_intermediate as $key => $field) {
2729
+ $form_fields_intermediate_keys[$field['f_name']] = $key;
2730
+ }
2731
+
2732
+ /**
2733
+ * Filter for POST
2734
+ */
2735
+ $input_data = apply_filters('apbct__filter_post', $form_fields_intermediate_keys);
2736
+
2737
+ foreach ($form_fields_intermediate as $key => $field) {
2738
+ if (!in_array($field['f_name'], array_keys($input_data))) {
2739
+ unset($form_fields_intermediate[$key]);
2740
+ }
2741
+ }
2742
+
2743
  foreach ( $form_fields_intermediate as $field ) {
2744
  if ( $field['f_type'] === 'email' ) {
2745
  $email = $field['f_data'];
2760
  unset($key, $value);
2761
  }
2762
 
2763
+ /**
2764
+ * Filter for POST
2765
+ */
2766
+ $input_data = apply_filters('apbct__filter_post', $form_fields_for_ct);
2767
+
2768
+ $ct_temp_msg_data = ct_get_fields_any($input_data, $email, array_shift($nickname));
2769
 
2770
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2771
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
2879
  if ( check_ajax_referer('dt_contact_form', 'nonce', false) && ! empty($_POST) ) {
2880
  $post_info['comment_type'] = 'contact_the7_theme_contact_form';
2881
 
2882
+ /**
2883
+ * Filter for POST
2884
+ */
2885
+ $input_array = apply_filters('apbct__filter_post', $_POST);
2886
+
2887
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
2888
 
2889
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2890
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
2948
  return;
2949
  }
2950
 
2951
+ /**
2952
+ * Filter for POST
2953
+ */
2954
+ $input_array = apply_filters('apbct__filter_post', $_POST);
2955
+
2956
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
2957
 
2958
  $sender_email = $ct_temp_msg_data['email'] ?: '';
2959
  $sender_nickname = $ct_temp_msg_data['nickname'] ?: '';
inc/cleantalk-public-validate.php CHANGED
@@ -175,7 +175,12 @@ function ct_contact_form_validate()
175
 
176
  $post_info['comment_type'] = 'feedback_general_contact_form';
177
 
178
- $ct_temp_msg_data = ct_get_fields_any($_POST);
 
 
 
 
 
179
 
180
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
181
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
@@ -366,7 +371,12 @@ function ct_contact_form_validate_postdata()
366
  return null;
367
  }
368
 
369
- $message = ct_get_fields_any_postdata($_POST);
 
 
 
 
 
370
 
371
  // ???
372
  if ( strlen(json_encode($message)) < 10 ) {
@@ -421,3 +431,34 @@ function ct_contact_form_validate_postdata()
421
 
422
  return null;
423
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
  $post_info['comment_type'] = 'feedback_general_contact_form';
177
 
178
+ /**
179
+ * Filter for POST
180
+ */
181
+ $input_array = apply_filters('apbct__filter_post', $_POST);
182
+
183
+ $ct_temp_msg_data = ct_get_fields_any($input_array);
184
 
185
  $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
186
  $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
371
  return null;
372
  }
373
 
374
+ /**
375
+ * Filter for POST
376
+ */
377
+ $input_array = apply_filters('apbct__filter_post', $_POST);
378
+
379
+ $message = ct_get_fields_any_postdata($input_array);
380
 
381
  // ???
382
  if ( strlen(json_encode($message)) < 10 ) {
431
 
432
  return null;
433
  }
434
+
435
+ add_filter('apbct__filter_post', 'apbct__filter_form_data', 10);
436
+ function apbct__filter_form_data($form_data)
437
+ {
438
+ global $apbct;
439
+
440
+ if ($apbct->settings['exclusions__fields']) {
441
+ // regular expression exception
442
+ if ($apbct->settings['exclusions__fields__use_regexp']) {
443
+ $exclusion_regexp = $apbct->settings['exclusions__fields'];
444
+
445
+ foreach (array_keys($form_data) as $key) {
446
+ if (preg_match('/' . $exclusion_regexp . '/', $key) === 1) {
447
+ unset($form_data[$key]);
448
+ }
449
+ }
450
+
451
+ return $form_data;
452
+ }
453
+
454
+ $exclusion_fields = explode(',', $apbct->settings['exclusions__fields']);
455
+
456
+ foreach (array_keys($form_data) as $key) {
457
+ if (in_array($key, $exclusion_fields)) {
458
+ unset($form_data[$key]);
459
+ }
460
+ }
461
+ }
462
+
463
+ return $form_data;
464
+ }
inc/cleantalk-public.php CHANGED
@@ -519,7 +519,7 @@ function apbct_hook__wp_footer()
519
  if ( $apbct->settings['data__use_ajax'] ) {
520
  $timeout = $apbct->settings['misc__async_js'] ? 1000 : 0;
521
 
522
- if ( $apbct->use_rest_api ) {
523
  $html =
524
  "<script type=\"text/javascript\" " . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '')
525
  . ">
@@ -535,6 +535,7 @@ function apbct_hook__wp_footer()
535
  });
536
  </script>";
537
  } else {
 
538
  $html =
539
  "<script type=\"text/javascript\" " . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '')
540
  . ">
@@ -543,8 +544,8 @@ function apbct_hook__wp_footer()
543
  if( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {
544
  apbct_public_sendAJAX(
545
  { action: 'apbct_js_keys__get' },
546
- { callback: apbct_js_keys__set_input_value, apbct_ajax: 1 }
547
- );
548
  }
549
  }," . $timeout . ")
550
  });
@@ -1251,7 +1252,8 @@ function ct_enqueue_scripts_public($_hook)
1251
  __("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk-spam-protect'),
1252
  $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '',
1253
  $apbct->user_token ? "</a>" : ''
1254
- ),
 
1255
  ));
1256
  }
1257
  }
519
  if ( $apbct->settings['data__use_ajax'] ) {
520
  $timeout = $apbct->settings['misc__async_js'] ? 1000 : 0;
521
 
522
+ if ( $apbct->settings['data__use_ajax__type'] == 0 ) {
523
  $html =
524
  "<script type=\"text/javascript\" " . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '')
525
  . ">
535
  });
536
  </script>";
537
  } else {
538
+ $use_cleantalk_ajax = $apbct->settings['data__use_ajax__type'] == 1 ? 1 : 0;
539
  $html =
540
  "<script type=\"text/javascript\" " . (class_exists('Cookiebot_WP') ? 'data-cookieconsent="ignore"' : '')
541
  . ">
544
  if( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {
545
  apbct_public_sendAJAX(
546
  { action: 'apbct_js_keys__get' },
547
+ { callback: apbct_js_keys__set_input_value, apbct_ajax: " . $use_cleantalk_ajax . " }
548
+ )
549
  }
550
  }," . $timeout . ")
551
  });
1252
  __("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk-spam-protect'),
1253
  $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '',
1254
  $apbct->user_token ? "</a>" : ''
1255
+ ) . ' ' . esc_html__('The service accepts feedback only for requests made no more than 7 or 45 days
1256
+ (if the Additional package is activated) ago.', 'cleantalk-spam-protect'),
1257
  ));
1258
  }
1259
  }
inc/cleantalk-settings.php CHANGED
@@ -506,7 +506,7 @@ function apbct_settings__set_fileds()
506
  'type' => 'textarea',
507
  'title' => __('URL exclusions', 'cleantalk-spam-protect'),
508
  'description' => __(
509
- 'You could type here URL you want to exclude. Use comma or new lines as separator.',
510
  'cleantalk-spam-protect'
511
  ),
512
  ),
@@ -530,7 +530,6 @@ function apbct_settings__set_fileds()
530
  'type' => 'select',
531
  'multiple' => true,
532
  'options_callback' => 'apbct_get_all_roles',
533
- 'options_callback_params' => array(true),
534
  'description' => __(
535
  'Roles which bypass spam test. Hold CTRL to select multiple roles.',
536
  'cleantalk-spam-protect'
@@ -729,7 +728,6 @@ function apbct_settings__set_fileds()
729
  'multiple' => true,
730
  'parent' => 'wp__comment_notify',
731
  'options_callback' => 'apbct_get_all_roles',
732
- 'options_callback_params' => array(true),
733
  'class' => 'apbct_settings-field_wrapper--sub',
734
  ),
735
  'wp__dashboard_widget__show' => array(
@@ -752,6 +750,7 @@ function apbct_settings__set_fileds()
752
  function apbct_settings__set_fileds__network($fields)
753
  {
754
  global $apbct;
 
755
  $additional_fields = array(
756
  'wpms_settings' => array(
757
  'default_params' => array(),
@@ -762,7 +761,7 @@ function apbct_settings__set_fileds__network($fields)
762
  . __('WordPress Multisite (WPMS) settings', 'cleantalk-spam-protect')
763
  . '</a>'
764
  . '</span>'
765
- . '<div id="apbct_settings__dwpms_settings" style="display: none;">',
766
  'html_after' => '</div><br>',
767
  'fields' => array(
768
  'multisite__work_mode' => array(
@@ -827,7 +826,7 @@ function apbct_settings__set_fileds__network($fields)
827
  'title' => __('Enable White Label Mode', 'cleantalk-spam-protect'),
828
  'description' => sprintf(
829
  __("Learn more information %shere%s.", 'cleantalk-spam-protect'),
830
- '<a target="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">',
831
  '</a>'
832
  ),
833
  'childrens' => array('multisite__white_label__plugin_name'),
@@ -842,7 +841,7 @@ function apbct_settings__set_fileds__network($fields)
842
  'title' => __('Plugin name', 'cleantalk-spam-protect'),
843
  'description' => sprintf(
844
  __(
845
- "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s",
846
  'cleantalk-spam-protect'
847
  ),
848
  '<b>',
@@ -858,6 +857,7 @@ function apbct_settings__set_fileds__network($fields)
858
  'title' => __('Allow users to manage plugin settings', 'cleantalk-spam-protect'),
859
  'description' => __('Allow to change settings on child sites.', 'cleantalk-spam-protect'),
860
  'display' => APBCT_WPMS && is_main_site(),
 
861
  'network' => true,
862
  ),
863
  'multisite__use_settings_template' => array(
@@ -1176,7 +1176,11 @@ function apbct_settings__error__output($return = false)
1176
  'Error occurred while checking account status. Error: ',
1177
  'cleantalk-spam-protect'
1178
  ),
1179
- 'api' => __('Error occurred while excuting API call. Error: ', 'cleantalk-spam-protect'),
 
 
 
 
1180
 
1181
  // Validating settings
1182
  'settings_validate' => 'Validate Settings',
@@ -1707,25 +1711,15 @@ function apbct_get_all_child_domains($except_main_site = false)
1707
  }
1708
 
1709
  /**
1710
- * Get all current Wordpress roles, could except 'subscriber' role
1711
- *
1712
- * @param bool $except_subscriber
1713
  *
1714
  * @return array
1715
  */
1716
- function apbct_get_all_roles($except_subscriber = false)
1717
  {
1718
  $wp_roles = new WP_Roles();
1719
- $roles = $wp_roles->get_names();
1720
-
1721
- if ( $except_subscriber ) {
1722
- $key = array_search('Subscriber', $roles);
1723
- if ( $key !== false ) {
1724
- unset($roles[$key]);
1725
- }
1726
- }
1727
 
1728
- return $roles;
1729
  }
1730
 
1731
  function apbct_settings__field__draw($params = array())
@@ -1741,8 +1735,12 @@ function apbct_settings__field__draw($params = array())
1741
  $disabled = $params['parent'] && ! $value_parent ? ' disabled="disabled"' : ''; // Strait
1742
  $disabled = $params['parent'] && $params['reverse_trigger'] && ! $value_parent ? '' : $disabled; // Reverse logic
1743
  $disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled; // Direct disable from params
1744
- $disabled = ! is_main_site(
1745
- ) && $apbct->network_settings && ! $apbct->network_settings['multisite__allow_custom_settings'] ? ' disabled="disabled"' : $disabled; // Disabled by super admin on sub-sites
 
 
 
 
1746
 
1747
  $childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---", $params['childrens']) : '';
1748
  $hide = $params['hide'] ? implode(",", $params['hide']) : '';
@@ -1919,7 +1917,11 @@ function apbct_settings__validate($settings)
1919
  global $apbct;
1920
 
1921
  // If user is not allowed to manage settings. Get settings from the storage
1922
- if ( ! is_main_site() && ! $apbct->network_settings['multisite__allow_custom_settings'] ) {
 
 
 
 
1923
  foreach ( $apbct->settings as $key => $setting ) {
1924
  // Do not reset apikey to default is allow_custom_key is active
1925
  if ( $key === 'apikey' && $apbct->allow_custom_key ) {
@@ -1941,7 +1943,7 @@ function apbct_settings__validate($settings)
1941
  // Set missing network settings.
1942
  foreach ( $apbct->def_network_settings as $setting => $value ) {
1943
  if ( ! isset($settings[$setting]) ) {
1944
- $settings[$setting] = null;
1945
  settype($settings[$setting], gettype($value));
1946
  }
1947
  }
@@ -2032,20 +2034,17 @@ function apbct_settings__validate($settings)
2032
 
2033
  if ( isset($settings['multisite__hoster_api_key']) ) {
2034
  $network_settings['multisite__hoster_api_key'] = $settings['multisite__hoster_api_key'];
2035
- unset($settings['multisite__hoster_api_key']);
2036
  }
2037
 
2038
  if ( isset($settings['multisite__work_mode']) ) {
2039
  $network_settings['multisite__work_mode'] = $settings['multisite__work_mode'];
2040
- unset($settings['multisite__work_mode']);
2041
  }
2042
  }
2043
 
2044
  // Drop debug data
2045
  if ( Post::get('submit') === 'debug_drop' ) {
2046
  $apbct->debug = false;
2047
- delete_option('cleantalk_debug');
2048
-
2049
  return $settings;
2050
  }
2051
 
@@ -2096,7 +2095,9 @@ function apbct_settings__validate($settings)
2096
  \Cleantalk\ApbctWP\Variables\AltSessions::wipe();
2097
  }
2098
 
 
2099
  // Set type of the alt cookies
 
2100
  if ( $apbct->settings['data__set_cookies'] != 2 && $settings['data__set_cookies'] == 2 ) {
2101
  $alt_cookies_type = apbct_settings__get_alt_cookies_type();
2102
  if ( $alt_cookies_type === false ) {
@@ -2107,6 +2108,19 @@ function apbct_settings__validate($settings)
2107
  }
2108
  }
2109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2110
  return $settings;
2111
  }
2112
 
@@ -2265,12 +2279,9 @@ function apbct_settings__get_key_auto($direct_call = false)
2265
  $apbct->data['user_token'] = $result['user_token'];
2266
  }
2267
 
2268
- if ( ! empty($result['auth_key']) ) {
2269
- // @ToDo we have to sanitize only api key. Not need to sanitize every settings here.
2270
- $settings = apbct_settings__validate(array(
2271
- 'apikey' => $result['auth_key'],
2272
- ));
2273
- $apbct->settings['apikey'] = $settings['apikey'];
2274
  }
2275
 
2276
  $templates = \Cleantalk\ApbctWP\CleantalkSettingsTemplates::getOptionsTemplate($result['auth_key']);
@@ -2317,13 +2328,11 @@ function apbct_update_blogs_options($settings)
2317
  {
2318
  global $wpdb;
2319
 
2320
- $blog_names = $settings['multisite__use_settings_template_apply_for_current_list_sites'] ?: array();
2321
-
2322
- $wp_blogs = $wpdb->get_results('SELECT blog_id, site_id FROM ' . $wpdb->blogs, OBJECT_K);
2323
 
 
2324
  foreach ( $wp_blogs as $blog ) {
2325
- $blog_name = get_blog_details(array('blog_id' => $blog->blog_id))->blogname;
2326
- if ( in_array($blog_name, $blog_names) ) {
2327
  update_blog_option($blog->blog_id, 'cleantalk_settings', $settings);
2328
  }
2329
  }
506
  'type' => 'textarea',
507
  'title' => __('URL exclusions', 'cleantalk-spam-protect'),
508
  'description' => __(
509
+ 'You could type here a part of the URL you want to exclude. No need to type whole URL with "www" and protocol. Use comma or new lines as separator.',
510
  'cleantalk-spam-protect'
511
  ),
512
  ),
530
  'type' => 'select',
531
  'multiple' => true,
532
  'options_callback' => 'apbct_get_all_roles',
 
533
  'description' => __(
534
  'Roles which bypass spam test. Hold CTRL to select multiple roles.',
535
  'cleantalk-spam-protect'
728
  'multiple' => true,
729
  'parent' => 'wp__comment_notify',
730
  'options_callback' => 'apbct_get_all_roles',
 
731
  'class' => 'apbct_settings-field_wrapper--sub',
732
  ),
733
  'wp__dashboard_widget__show' => array(
750
  function apbct_settings__set_fileds__network($fields)
751
  {
752
  global $apbct;
753
+
754
  $additional_fields = array(
755
  'wpms_settings' => array(
756
  'default_params' => array(),
761
  . __('WordPress Multisite (WPMS) settings', 'cleantalk-spam-protect')
762
  . '</a>'
763
  . '</span>'
764
+ . '<div id="apbct_settings__dwpms_settings" style="display: block;">',
765
  'html_after' => '</div><br>',
766
  'fields' => array(
767
  'multisite__work_mode' => array(
826
  'title' => __('Enable White Label Mode', 'cleantalk-spam-protect'),
827
  'description' => sprintf(
828
  __("Learn more information %shere%s.", 'cleantalk-spam-protect'),
829
+ '<a target="_blank" href="https://cleantalk.org/help/hosting-white-label">',
830
  '</a>'
831
  ),
832
  'childrens' => array('multisite__white_label__plugin_name'),
841
  'title' => __('Plugin name', 'cleantalk-spam-protect'),
842
  'description' => sprintf(
843
  __(
844
+ "Specify plugin name. Leave empty for deafult %sAnti-Spam by Cleantalk%s",
845
  'cleantalk-spam-protect'
846
  ),
847
  '<b>',
857
  'title' => __('Allow users to manage plugin settings', 'cleantalk-spam-protect'),
858
  'description' => __('Allow to change settings on child sites.', 'cleantalk-spam-protect'),
859
  'display' => APBCT_WPMS && is_main_site(),
860
+ 'disabled' => $apbct->network_settings['multisite__work_mode'] == 2,
861
  'network' => true,
862
  ),
863
  'multisite__use_settings_template' => array(
1176
  'Error occurred while checking account status. Error: ',
1177
  'cleantalk-spam-protect'
1178
  ),
1179
+ 'api' => __('Error occurred while executing API call. Error: ', 'cleantalk-spam-protect'),
1180
+ 'sfw_outdated' => __(
1181
+ 'Error occurred on last SpamFireWall check. Error: ',
1182
+ 'cleantalk-spam-protect'
1183
+ ),
1184
 
1185
  // Validating settings
1186
  'settings_validate' => 'Validate Settings',
1711
  }
1712
 
1713
  /**
1714
+ * Get all current Wordpress roles
 
 
1715
  *
1716
  * @return array
1717
  */
1718
+ function apbct_get_all_roles()
1719
  {
1720
  $wp_roles = new WP_Roles();
 
 
 
 
 
 
 
 
1721
 
1722
+ return $wp_roles->get_names();
1723
  }
1724
 
1725
  function apbct_settings__field__draw($params = array())
1735
  $disabled = $params['parent'] && ! $value_parent ? ' disabled="disabled"' : ''; // Strait
1736
  $disabled = $params['parent'] && $params['reverse_trigger'] && ! $value_parent ? '' : $disabled; // Reverse logic
1737
  $disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled; // Direct disable from params
1738
+ $disabled =
1739
+ ! is_main_site() &&
1740
+ $apbct->network_settings &&
1741
+ ( ! $apbct->network_settings['multisite__allow_custom_settings'] || $apbct->network_settings['multisite__work_mode'] == 2 )
1742
+ ? ' disabled="disabled"'
1743
+ : $disabled; // Disabled by super admin on sub-sites
1744
 
1745
  $childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---", $params['childrens']) : '';
1746
  $hide = $params['hide'] ? implode(",", $params['hide']) : '';
1917
  global $apbct;
1918
 
1919
  // If user is not allowed to manage settings. Get settings from the storage
1920
+ if (
1921
+ ! is_main_site() &&
1922
+ ! $apbct->network_settings['multisite__allow_custom_settings'] &&
1923
+ current_filter() === 'sanitize_option_cleantalk_settings' // Do in only if settings were saved
1924
+ ) {
1925
  foreach ( $apbct->settings as $key => $setting ) {
1926
  // Do not reset apikey to default is allow_custom_key is active
1927
  if ( $key === 'apikey' && $apbct->allow_custom_key ) {
1943
  // Set missing network settings.
1944
  foreach ( $apbct->def_network_settings as $setting => $value ) {
1945
  if ( ! isset($settings[$setting]) ) {
1946
+ $settings[$setting] = $value;
1947
  settype($settings[$setting], gettype($value));
1948
  }
1949
  }
2034
 
2035
  if ( isset($settings['multisite__hoster_api_key']) ) {
2036
  $network_settings['multisite__hoster_api_key'] = $settings['multisite__hoster_api_key'];
 
2037
  }
2038
 
2039
  if ( isset($settings['multisite__work_mode']) ) {
2040
  $network_settings['multisite__work_mode'] = $settings['multisite__work_mode'];
 
2041
  }
2042
  }
2043
 
2044
  // Drop debug data
2045
  if ( Post::get('submit') === 'debug_drop' ) {
2046
  $apbct->debug = false;
2047
+ $apbct->deleteOption('debug', true);
 
2048
  return $settings;
2049
  }
2050
 
2095
  \Cleantalk\ApbctWP\Variables\AltSessions::wipe();
2096
  }
2097
 
2098
+ // @ToDo combine selecting of the ajax handler type
2099
  // Set type of the alt cookies
2100
+ $settings['data__set_cookies__alt_sessions_type'] = $apbct->settings['data__set_cookies__alt_sessions_type'];
2101
  if ( $apbct->settings['data__set_cookies'] != 2 && $settings['data__set_cookies'] == 2 ) {
2102
  $alt_cookies_type = apbct_settings__get_alt_cookies_type();
2103
  if ( $alt_cookies_type === false ) {
2108
  }
2109
  }
2110
 
2111
+ // @ToDo combine selecting of the ajax handler type
2112
+ // Set type of the AJAX getting of js
2113
+ $settings['data__use_ajax__type'] = $apbct->settings['data__use_ajax__type'];
2114
+ if ( $apbct->settings['data__use_ajax'] != 1 && $settings['data__use_ajax'] == 1 ) {
2115
+ $ajax_type = apbct_settings__get_alt_cookies_type();
2116
+ if ( $ajax_type === false ) {
2117
+ // There is no available ajax types. AJAX js will be disabled.
2118
+ $settings['data__use_ajax'] = 0;
2119
+ } else {
2120
+ $settings['data__use_ajax__type'] = $ajax_type;
2121
+ }
2122
+ }
2123
+
2124
  return $settings;
2125
  }
2126
 
2279
  $apbct->data['user_token'] = $result['user_token'];
2280
  }
2281
 
2282
+ if ( ! empty($result['auth_key']) && apbct_api_key__is_correct($result['auth_key']) ) {
2283
+ $apbct->data['key_changed'] = trim($result['auth_key']) !== $apbct->settings['apikey'];
2284
+ $apbct->settings['apikey'] = trim($result['auth_key']);
 
 
 
2285
  }
2286
 
2287
  $templates = \Cleantalk\ApbctWP\CleantalkSettingsTemplates::getOptionsTemplate($result['auth_key']);
2328
  {
2329
  global $wpdb;
2330
 
2331
+ $blog_ids = $settings['multisite__use_settings_template_apply_for_current_list_sites'] ?: array();
 
 
2332
 
2333
+ $wp_blogs = $wpdb->get_results('SELECT blog_id FROM ' . $wpdb->blogs, OBJECT_K);
2334
  foreach ( $wp_blogs as $blog ) {
2335
+ if ( in_array($blog->blog_id, $blog_ids) ) {
 
2336
  update_blog_option($blog->blog_id, 'cleantalk_settings', $settings);
2337
  }
2338
  }
inc/cleantalk-updater.php CHANGED
@@ -1414,6 +1414,14 @@ function apbct_update_to_5_161_1()
1414
 
1415
  if ( $apbct->is_multisite ) {
1416
  $apbct->network_settings = array_merge((array)$apbct->network_settings, $apbct->default_network_settings);
 
 
 
 
 
 
 
 
1417
  $apbct->saveNetworkSettings();
1418
  }
1419
  }
@@ -1457,3 +1465,56 @@ function apbct_update_to_5_162_0()
1457
  $apbct->settings['forms__wc_honeypot'] = '1';
1458
  $apbct->saveSettings();
1459
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1414
 
1415
  if ( $apbct->is_multisite ) {
1416
  $apbct->network_settings = array_merge((array)$apbct->network_settings, $apbct->default_network_settings);
1417
+ // Migrate old WPMS to the new wpms mode
1418
+ if ( isset($apbct->network_settings['multisite__allow_custom_key']) ) {
1419
+ if ( $apbct->network_settings['multisite__allow_custom_key'] == 1 ) {
1420
+ $apbct->network_settings['multisite__work_mode'] = 1;
1421
+ } else {
1422
+ $apbct->network_settings['multisite__work_mode'] = 2;
1423
+ }
1424
+ }
1425
  $apbct->saveNetworkSettings();
1426
  }
1427
  }
1465
  $apbct->settings['forms__wc_honeypot'] = '1';
1466
  $apbct->saveSettings();
1467
  }
1468
+
1469
+ /**
1470
+ * 5.162.1
1471
+ */
1472
+ function apbct_update_to_5_162_1()
1473
+ {
1474
+ global $apbct;
1475
+
1476
+ if (
1477
+ ! isset($apbct->stats['sfw']['update_period']) ||
1478
+ (isset($apbct->stats['sfw']['update_period']) && $apbct->stats['sfw']['update_period'] == 0)
1479
+ ) {
1480
+ $apbct->stats['sfw']['update_period'] = 14400;
1481
+ $apbct->save('stats');
1482
+ }
1483
+
1484
+ // Set type of the AJAX handler for the ajax js
1485
+ if ( $apbct->settings['data__use_ajax'] == 1 ) {
1486
+ // Check custom ajax availability
1487
+ $res_custom_ajax = Helper::httpRequestGetResponseCode(
1488
+ esc_url(APBCT_URL_PATH . '/lib/Cleantalk/ApbctWP/Ajax.php')
1489
+ );
1490
+ if ( $res_custom_ajax != 400 ) {
1491
+ // Check rest availability
1492
+ $res_rest = Helper::httpRequestGetResponseCode(esc_url(apbct_get_rest_url()));
1493
+ if ( $res_rest != 200 ) {
1494
+ // Check WP ajax availability
1495
+ $res_ajax = Helper::httpRequestGetResponseCode(admin_url('admin-ajax.php'));
1496
+ if ( $res_ajax != 400 ) {
1497
+ // There is no available alt cookies types. Cookies will be disabled.
1498
+ $apbct->settings['data__use_ajax'] = 0;
1499
+ } else {
1500
+ $apbct->settings['data__use_ajax__type'] = 2;
1501
+ }
1502
+ } else {
1503
+ $apbct->settings['data__use_ajax__type'] = 0;
1504
+ }
1505
+ } else {
1506
+ $apbct->settings['data__use_ajax__type'] = 1;
1507
+ }
1508
+ $apbct->saveSettings();
1509
+ }
1510
+
1511
+ // Migrate old WPMS to the new wpms mode
1512
+ if ( isset($apbct->network_settings['multisite__allow_custom_key']) ) {
1513
+ if ( $apbct->network_settings['multisite__allow_custom_key'] == 1 ) {
1514
+ $apbct->network_settings['multisite__work_mode'] = 1;
1515
+ } else {
1516
+ $apbct->network_settings['multisite__work_mode'] = 2;
1517
+ }
1518
+ $apbct->saveNetworkSettings();
1519
+ }
1520
+ }
lib/Cleantalk/Antispam/Integrations.php CHANGED
@@ -1,129 +1,129 @@
1
- <?php
2
-
3
- namespace Cleantalk\Antispam;
4
-
5
- class Integrations
6
- {
7
- private $integrations;
8
-
9
- /**
10
- * Integrations constructor.
11
- *
12
- * @param array $integrations
13
- * @param array $settings
14
- */
15
- public function __construct($integrations, $settings)
16
- {
17
- $this->integrations = $integrations;
18
-
19
- foreach ( $this->integrations as $_integration_name => $integration_info ) {
20
- if ( empty($settings[$integration_info['setting']]) ) {
21
- continue;
22
- }
23
-
24
- if ( $integration_info['ajax'] ) {
25
- if ( is_array($integration_info['hook']) ) {
26
- foreach ( $integration_info['hook'] as $hook ) {
27
- add_action('wp_ajax_' . $hook, array($this, 'checkSpam'), 1);
28
- add_action('wp_ajax_nopriv_' . $hook, array($this, 'checkSpam'), 1);
29
- }
30
- } else {
31
- add_action('wp_ajax_' . $integration_info['hook'], array($this, 'checkSpam'), 1);
32
- add_action('wp_ajax_nopriv_' . $integration_info['hook'], array($this, 'checkSpam'), 1);
33
- }
34
- } else {
35
- if ( is_array($integration_info['hook']) ) {
36
- foreach ( $integration_info['hook'] as $hook ) {
37
- add_action($hook, array($this, 'checkSpam'));
38
- }
39
- } else {
40
- add_action($integration_info['hook'], array($this, 'checkSpam'));
41
- }
42
- }
43
- }
44
- }
45
-
46
- /**
47
- * @param $argument
48
- *
49
- * @psalm-suppress UnusedVariable
50
- */
51
- public function checkSpam($argument)
52
- {
53
- global $cleantalk_executed;
54
-
55
- // Getting current integration name
56
- $current_integration = $this->getCurrentIntegrationTriggered(current_filter());
57
- if ( $current_integration ) {
58
- // Instantiate the integration object
59
- $class = '\\Cleantalk\\Antispam\\Integrations\\' . $current_integration;
60
- if ( class_exists($class) ) {
61
- $integration = new $class();
62
- if ( ! ($integration instanceof \Cleantalk\Antispam\Integrations\IntegrationBase) ) {
63
- // @ToDo have to handle an error
64
- do_action(
65
- 'apbct_skipped_request',
66
- __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__,
67
- array('Integration is not instanse of IntegrationBase class.')
68
- );
69
-
70
- return;
71
- }
72
- // Run data collecting for spam checking
73
- $data = $integration->getDataForChecking($argument);
74
- if ( ! is_null($data) ) {
75
- // Go spam checking
76
- $base_call_result = apbct_base_call(
77
- array(
78
- 'message' => ! empty($data['message']) ? json_encode($data['message']) : '',
79
- 'sender_email' => ! empty($data['email']) ? $data['email'] : '',
80
- 'sender_nickname' => ! empty($data['nickname']) ? $data['nickname'] : '',
81
- 'post_info' => array(
82
- 'comment_type' => 'contact_form_wordpress_' . strtolower($current_integration),
83
- 'post_url' => apbct_get_server_variable('HTTP_REFERER'),
84
- // Page URL must be an previous page
85
- ),
86
- ),
87
- isset($data['register']) ? true : false
88
- );
89
-
90
- $ct_result = $base_call_result['ct_result'];
91
-
92
- $cleantalk_executed = true;
93
-
94
- if ( $ct_result->allow == 0 ) {
95
- // Do blocking if it is a spam
96
- return $integration->doBlock($ct_result->comment);
97
- }
98
-
99
- if ( $ct_result->allow != 0 && method_exists($integration, 'allow') ) {
100
- return $integration->allow();
101
- }
102
- } else {
103
- // @ToDo have to handle an error
104
- }
105
- }
106
- }
107
- }
108
-
109
- private function getCurrentIntegrationTriggered($hook)
110
- {
111
- if ( $hook !== false ) {
112
- foreach ( $this->integrations as $integration_name => $integration_info ) {
113
- if ( is_array($integration_info['hook']) ) {
114
- foreach ( $integration_info['hook'] as $integration_hook ) {
115
- if ( strpos($hook, $integration_hook) !== false ) {
116
- return $integration_name;
117
- }
118
- }
119
- } else {
120
- if ( strpos($hook, $integration_info['hook']) !== false ) {
121
- return $integration_name;
122
- }
123
- }
124
- }
125
- }
126
-
127
- return false;
128
- }
129
- }
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam;
4
+
5
+ class Integrations
6
+ {
7
+ private $integrations;
8
+
9
+ /**
10
+ * Integrations constructor.
11
+ *
12
+ * @param array $integrations
13
+ * @param array $settings
14
+ */
15
+ public function __construct($integrations, $settings)
16
+ {
17
+ $this->integrations = $integrations;
18
+
19
+ foreach ( $this->integrations as $_integration_name => $integration_info ) {
20
+ if ( empty($settings[$integration_info['setting']]) ) {
21
+ continue;
22
+ }
23
+
24
+ if ( $integration_info['ajax'] ) {
25
+ if ( is_array($integration_info['hook']) ) {
26
+ foreach ( $integration_info['hook'] as $hook ) {
27
+ add_action('wp_ajax_' . $hook, array($this, 'checkSpam'), 1);
28
+ add_action('wp_ajax_nopriv_' . $hook, array($this, 'checkSpam'), 1);
29
+ }
30
+ } else {
31
+ add_action('wp_ajax_' . $integration_info['hook'], array($this, 'checkSpam'), 1);
32
+ add_action('wp_ajax_nopriv_' . $integration_info['hook'], array($this, 'checkSpam'), 1);
33
+ }
34
+ } else {
35
+ if ( is_array($integration_info['hook']) ) {
36
+ foreach ( $integration_info['hook'] as $hook ) {
37
+ add_action($hook, array($this, 'checkSpam'));
38
+ }
39
+ } else {
40
+ add_action($integration_info['hook'], array($this, 'checkSpam'));
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * @param $argument
48
+ *
49
+ * @psalm-suppress UnusedVariable
50
+ */
51
+ public function checkSpam($argument)
52
+ {
53
+ global $cleantalk_executed;
54
+
55
+ // Getting current integration name
56
+ $current_integration = $this->getCurrentIntegrationTriggered(current_filter());
57
+ if ( $current_integration ) {
58
+ // Instantiate the integration object
59
+ $class = '\\Cleantalk\\Antispam\\Integrations\\' . $current_integration;
60
+ if ( class_exists($class) ) {
61
+ $integration = new $class();
62
+ if ( ! ($integration instanceof \Cleantalk\Antispam\Integrations\IntegrationBase) ) {
63
+ // @ToDo have to handle an error
64
+ do_action(
65
+ 'apbct_skipped_request',
66
+ __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__,
67
+ array('Integration is not instanse of IntegrationBase class.')
68
+ );
69
+
70
+ return;
71
+ }
72
+ // Run data collecting for spam checking
73
+ $data = $integration->getDataForChecking($argument);
74
+ if ( ! is_null($data) ) {
75
+ // Go spam checking
76
+ $base_call_result = apbct_base_call(
77
+ array(
78
+ 'message' => ! empty($data['message']) ? json_encode($data['message']) : '',
79
+ 'sender_email' => ! empty($data['email']) ? $data['email'] : '',
80
+ 'sender_nickname' => ! empty($data['nickname']) ? $data['nickname'] : '',
81
+ 'post_info' => array(
82
+ 'comment_type' => 'contact_form_wordpress_' . strtolower($current_integration),
83
+ 'post_url' => apbct_get_server_variable('HTTP_REFERER'),
84
+ // Page URL must be an previous page
85
+ ),
86
+ ),
87
+ isset($data['register']) ? true : false
88
+ );
89
+
90
+ $ct_result = $base_call_result['ct_result'];
91
+
92
+ $cleantalk_executed = true;
93
+
94
+ if ( $ct_result->allow == 0 ) {
95
+ // Do blocking if it is a spam
96
+ return $integration->doBlock($ct_result->comment);
97
+ }
98
+
99
+ if ( $ct_result->allow != 0 && method_exists($integration, 'allow') ) {
100
+ return $integration->allow();
101
+ }
102
+ } else {
103
+ // @ToDo have to handle an error
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ private function getCurrentIntegrationTriggered($hook)
110
+ {
111
+ if ( $hook !== false ) {
112
+ foreach ( $this->integrations as $integration_name => $integration_info ) {
113
+ if ( is_array($integration_info['hook']) ) {
114
+ foreach ( $integration_info['hook'] as $integration_hook ) {
115
+ if ( strpos($hook, $integration_hook) !== false ) {
116
+ return $integration_name;
117
+ }
118
+ }
119
+ } else {
120
+ if ( strpos($hook, $integration_info['hook']) !== false ) {
121
+ return $integration_name;
122
+ }
123
+ }
124
+ }
125
+ }
126
+
127
+ return false;
128
+ }
129
+ }
lib/Cleantalk/Antispam/Integrations/ContactBank.php CHANGED
@@ -1,27 +1,32 @@
1
- <?php
2
-
3
- namespace Cleantalk\Antispam\Integrations;
4
-
5
- class ContactBank extends IntegrationBase
6
- {
7
- public function getDataForChecking($argument)
8
- {
9
- if ( isset($_REQUEST['param']) ) {
10
- parse_str(isset($_REQUEST['data']) ? base64_decode($_REQUEST['data']) : '', $form_data);
11
-
12
- return ct_get_fields_any($form_data);
13
- }
14
-
15
- return null;
16
- }
17
-
18
- public function doBlock($message)
19
- {
20
- die(
21
- json_encode(
22
- array('apbct' => array('blocked' => true, 'comment' => $message,)),
23
- JSON_HEX_QUOT | JSON_HEX_TAG
24
- )
25
- );
26
- }
27
- }
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ class ContactBank extends IntegrationBase
6
+ {
7
+ public function getDataForChecking($argument)
8
+ {
9
+ if ( isset($_REQUEST['param']) ) {
10
+ parse_str(isset($_REQUEST['data']) ? base64_decode($_REQUEST['data']) : '', $form_data);
11
+
12
+ /**
13
+ * Filter for POST
14
+ */
15
+ $input_array = apply_filters('apbct__filter_post', $form_data);
16
+
17
+ return ct_get_fields_any($input_array);
18
+ }
19
+
20
+ return null;
21
+ }
22
+
23
+ public function doBlock($message)
24
+ {
25
+ die(
26
+ json_encode(
27
+ array('apbct' => array('blocked' => true, 'comment' => $message,)),
28
+ JSON_HEX_QUOT | JSON_HEX_TAG
29
+ )
30
+ );
31
+ }
32
+ }
lib/Cleantalk/Antispam/Integrations/EaelLoginRegister.php CHANGED
@@ -6,7 +6,12 @@ class EaelLoginRegister extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- $data = ct_get_fields_any($_POST);
 
 
 
 
 
10
  $data['register'] = true;
11
 
12
  return $data;
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
+ /**
10
+ * Filter for POST
11
+ */
12
+ $input_array = apply_filters('apbct__filter_post', $_POST);
13
+
14
+ $data = ct_get_fields_any($input_array);
15
  $data['register'] = true;
16
 
17
  return $data;
lib/Cleantalk/Antispam/Integrations/ElfsightContactForm.php CHANGED
@@ -7,7 +7,12 @@ class ElfsightContactForm extends IntegrationBase
7
  public function getDataForChecking($argument)
8
  {
9
  if ( isset($_POST['fields']) ) {
10
- return ct_get_fields_any($_POST['fields']);
 
 
 
 
 
11
  }
12
 
13
  return null;
7
  public function getDataForChecking($argument)
8
  {
9
  if ( isset($_POST['fields']) ) {
10
+ /**
11
+ * Filter for POST
12
+ */
13
+ $input_array = apply_filters('apbct__filter_post', $_POST['fields']);
14
+
15
+ return ct_get_fields_any($input_array);
16
  }
17
 
18
  return null;
lib/Cleantalk/Antispam/Integrations/EstimationForm.php CHANGED
@@ -7,7 +7,12 @@ class EstimationForm extends IntegrationBase
7
  public function getDataForChecking($argument)
8
  {
9
  if ( isset($_POST['customerInfos']) ) {
10
- return ct_get_fields_any($_POST['customerInfos']);
 
 
 
 
 
11
  }
12
 
13
  return null;
7
  public function getDataForChecking($argument)
8
  {
9
  if ( isset($_POST['customerInfos']) ) {
10
+ /**
11
+ * Filter for POST
12
+ */
13
+ $input_array = apply_filters('apbct__filter_post', $_POST['customerInfos']);
14
+
15
+ return ct_get_fields_any($input_array);
16
  }
17
 
18
  return null;
lib/Cleantalk/Antispam/Integrations/FluentForm.php CHANGED
@@ -1,31 +1,36 @@
1
- <?php
2
-
3
- namespace Cleantalk\Antispam\Integrations;
4
-
5
- class FluentForm extends IntegrationBase
6
- {
7
- public function getDataForChecking($argument)
8
- {
9
- if ( isset($_POST['data']) ) {
10
- parse_str($_POST['data'], $form_data);
11
-
12
- return ct_get_fields_any($form_data);
13
- }
14
-
15
- return null;
16
- }
17
-
18
- public function doBlock($message)
19
- {
20
- wp_send_json(
21
- array(
22
- 'errors' => array(
23
- 'restricted' => array(
24
- $message
25
- )
26
- )
27
- ),
28
- 422
29
- );
30
- }
31
- }
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ class FluentForm extends IntegrationBase
6
+ {
7
+ public function getDataForChecking($argument)
8
+ {
9
+ if ( isset($_POST['data']) ) {
10
+ parse_str($_POST['data'], $form_data);
11
+
12
+ /**
13
+ * Filter for POST
14
+ */
15
+ $input_array = apply_filters('apbct__filter_post', $form_data);
16
+
17
+ return ct_get_fields_any($input_array);
18
+ }
19
+
20
+ return null;
21
+ }
22
+
23
+ public function doBlock($message)
24
+ {
25
+ wp_send_json(
26
+ array(
27
+ 'errors' => array(
28
+ 'restricted' => array(
29
+ $message
30
+ )
31
+ )
32
+ ),
33
+ 422
34
+ );
35
+ }
36
+ }
lib/Cleantalk/Antispam/Integrations/Forminator.php CHANGED
@@ -7,7 +7,12 @@ class Forminator extends IntegrationBase
7
  public function getDataForChecking($argument)
8
  {
9
  if ( ! empty($_POST) ) {
10
- return ct_get_fields_any($_POST);
 
 
 
 
 
11
  }
12
 
13
  return null;
7
  public function getDataForChecking($argument)
8
  {
9
  if ( ! empty($_POST) ) {
10
+ /**
11
+ * Filter for POST
12
+ */
13
+ $input_array = apply_filters('apbct__filter_post', $_POST);
14
+
15
+ return ct_get_fields_any($input_array);
16
  }
17
 
18
  return null;
lib/Cleantalk/Antispam/Integrations/HappyForm.php CHANGED
@@ -8,7 +8,13 @@ class HappyForm extends IntegrationBase
8
  {
9
  if ( isset($_POST['happyforms_form_id']) ) {
10
  $data = array();
11
- foreach ( $_POST as $key => $value ) {
 
 
 
 
 
 
12
  if ( strpos($key, $_POST['happyforms_form_id']) !== false ) {
13
  $data[$key] = $value;
14
  }
8
  {
9
  if ( isset($_POST['happyforms_form_id']) ) {
10
  $data = array();
11
+
12
+ /**
13
+ * Filter for POST
14
+ */
15
+ $input_array = apply_filters('apbct__filter_post', $_POST);
16
+
17
+ foreach ( $input_array as $key => $value ) {
18
  if ( strpos($key, $_POST['happyforms_form_id']) !== false ) {
19
  $data[$key] = $value;
20
  }
lib/Cleantalk/Antispam/Integrations/IntegrationBase.php CHANGED
@@ -1,10 +1,10 @@
1
- <?php
2
-
3
- namespace Cleantalk\Antispam\Integrations;
4
-
5
- abstract class IntegrationBase
6
- {
7
- abstract public function getDataForChecking($argument);
8
-
9
- abstract public function doBlock($message);
10
- }
1
+ <?php
2
+
3
+ namespace Cleantalk\Antispam\Integrations;
4
+
5
+ abstract class IntegrationBase
6
+ {
7
+ abstract public function getDataForChecking($argument);
8
+
9
+ abstract public function doBlock($message);
10
+ }
lib/Cleantalk/Antispam/Integrations/LandingPageBuilder.php CHANGED
@@ -7,7 +7,12 @@ class LandingPageBuilder extends IntegrationBase
7
  public function getDataForChecking($argument)
8
  {
9
  if ( ! empty($_POST) ) {
10
- return ct_get_fields_any($_POST);
 
 
 
 
 
11
  }
12
 
13
  return null;
7
  public function getDataForChecking($argument)
8
  {
9
  if ( ! empty($_POST) ) {
10
+ /**
11
+ * Filter for POST
12
+ */
13
+ $input_array = apply_filters('apbct__filter_post', $_POST);
14
+
15
+ return ct_get_fields_any($input_array);
16
  }
17
 
18
  return null;
lib/Cleantalk/Antispam/Integrations/Rafflepress.php CHANGED
@@ -6,7 +6,12 @@ class Rafflepress extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- return ct_get_fields_any($_POST);
 
 
 
 
 
10
  }
11
 
12
  public function doBlock($message)
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
+ /**
10
+ * Filter for POST
11
+ */
12
+ $input_array = apply_filters('apbct__filter_post', $_POST);
13
+
14
+ return ct_get_fields_any($input_array);
15
  }
16
 
17
  public function doBlock($message)
lib/Cleantalk/Antispam/Integrations/Wpdiscuz.php CHANGED
@@ -6,7 +6,12 @@ class Wpdiscuz extends IntegrationBase
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
- return ct_get_fields_any($_POST);
 
 
 
 
 
10
  }
11
 
12
  public function doBlock($message)
6
  {
7
  public function getDataForChecking($argument)
8
  {
9
+ /**
10
+ * Filter for POST
11
+ */
12
+ $input_array = apply_filters('apbct__filter_post', $_POST);
13
+
14
+ return ct_get_fields_any($input_array);
15
  }
16
 
17
  public function doBlock($message)
lib/Cleantalk/ApbctWP/CleantalkSettingsTemplates.php CHANGED
@@ -95,8 +95,8 @@ class CleantalkSettingsTemplates
95
  $template_info = $_POST['data'];
96
  if ( isset($template_info['template_id'], $template_info['template_name'], $template_info['settings']) ) {
97
  $res = $this->setPluginOptions(
98
- $template_info['template_id'],
99
- $template_info['template_name'],
100
  $template_info['settings']
101
  );
102
  if ( empty($res['error']) ) {
@@ -273,15 +273,49 @@ class CleantalkSettingsTemplates
273
 
274
  private function setPluginOptions($template_id, $template_name, $settings)
275
  {
276
- global $apbct;
277
- $settings = array_replace((array)$apbct->settings, $settings);
278
- $settings = apbct_settings__validate($settings);
279
- $apbct->settings = $settings;
280
- $apbct->data['current_settings_template_id'] = $template_id;
281
- $apbct->data['current_settings_template_name'] = $template_name;
282
- $apbct->data['key_changed'] = 1;
283
-
284
- return $apbct->saveSettings() && $apbct->saveData();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  }
286
 
287
  private function resetPluginOptions()
95
  $template_info = $_POST['data'];
96
  if ( isset($template_info['template_id'], $template_info['template_name'], $template_info['settings']) ) {
97
  $res = $this->setPluginOptions(
98
+ (int)$template_info['template_id'],
99
+ htmlspecialchars($template_info['template_name']),
100
  $template_info['settings']
101
  );
102
  if ( empty($res['error']) ) {
273
 
274
  private function setPluginOptions($template_id, $template_name, $settings)
275
  {
276
+ global $apbct, $wpdb;
277
+
278
+ /**
279
+ * $blog_ids is an array of the IDs to apply settings for these blogs
280
+ */
281
+ $blogs_ids = apply_filters('apbct_template_save_to', array());
282
+
283
+ if ( is_multisite() && is_array($blogs_ids) && count($blogs_ids) ) {
284
+ $initial_blog = get_current_blog_id();
285
+ if ( ! in_array($initial_blog, $blogs_ids) ) {
286
+ $blogs_ids[] = $initial_blog;
287
+ }
288
+ $available_blogs = $wpdb->get_col('SELECT blog_id FROM ' . $wpdb->prefix . 'blogs;');
289
+ foreach ( $blogs_ids as $blog_id ) {
290
+ if ( ! in_array($blog_id, $available_blogs) ) {
291
+ continue;
292
+ }
293
+ switch_to_blog($blog_id);
294
+ $old_settings = get_option($apbct->option_prefix . '_settings');
295
+ $old_data = get_option($apbct->option_prefix . '_data');
296
+ if ( $old_settings !== false && $old_data !== false ) {
297
+ $new_settings = array_replace($old_settings, $settings);
298
+ $new_settings = apbct_settings__validate($new_settings);
299
+ $data['current_settings_template_id'] = $template_id;
300
+ $data['current_settings_template_name'] = $template_name;
301
+ $data['key_changed'] = 1;
302
+ $new_data = array_replace($old_data, $data);
303
+ update_option($apbct->option_prefix . '_settings', $new_settings);
304
+ update_option($apbct->option_prefix . '_data', $new_data);
305
+ }
306
+ restore_current_blog();
307
+ }
308
+ switch_to_blog($initial_blog);
309
+ } else {
310
+ $settings = array_replace((array)$apbct->settings, $settings);
311
+ $settings = apbct_settings__validate($settings);
312
+ $apbct->settings = $settings;
313
+ $apbct->data['current_settings_template_id'] = $template_id;
314
+ $apbct->data['current_settings_template_name'] = $template_name;
315
+ $apbct->data['key_changed'] = 1;
316
+
317
+ return $apbct->saveSettings() && $apbct->saveData();
318
+ }
319
  }
320
 
321
  private function resetPluginOptions()
lib/Cleantalk/ApbctWP/FindSpam/CommentsChecker.php CHANGED
@@ -350,11 +350,17 @@ class CommentsChecker extends Checker
350
  $bad_comments = new \WP_Comment_Query($params_bad);
351
  $cnt_bad = count($bad_comments->get_comments());
352
 
 
 
 
 
 
353
  $return = array(
354
  'message' => '',
355
  'spam' => $cnt_spam,
356
  'checked' => $cnt_checked,
357
  'bad' => $cnt_bad,
 
358
  );
359
 
360
  if ( ! $direct_call ) {
350
  $bad_comments = new \WP_Comment_Query($params_bad);
351
  $cnt_bad = count($bad_comments->get_comments());
352
 
353
+ /**
354
+ * Total comments
355
+ */
356
+ $total_comments = wp_count_comments()->total_comments;
357
+
358
  $return = array(
359
  'message' => '',
360
  'spam' => $cnt_spam,
361
  'checked' => $cnt_checked,
362
  'bad' => $cnt_bad,
363
+ 'total' => $total_comments
364
  );
365
 
366
  if ( ! $direct_call ) {
lib/Cleantalk/ApbctWP/Helper.php CHANGED
@@ -96,7 +96,6 @@ class Helper extends \Cleantalk\Common\Helper
96
  ), $request_params);
97
  $patterns = array_merge(
98
  array(
99
- 'get',
100
  'dont_split_to_array'
101
  ),
102
  $patterns
96
  ), $request_params);
97
  $patterns = array_merge(
98
  array(
 
99
  'dont_split_to_array'
100
  ),
101
  $patterns
lib/Cleantalk/ApbctWP/RemoteCalls.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace Cleantalk\ApbctWP;
4
 
5
- use Cleantalk\Variables\Get;
6
 
7
  class RemoteCalls
8
  {
@@ -16,9 +16,9 @@ class RemoteCalls
16
  public static function check()
17
  {
18
  return
19
- Get::get('spbc_remote_call_token') &&
20
- Get::get('spbc_remote_call_action') &&
21
- in_array(Get::get('plugin_name'), array('antispam', 'anti-spam', 'apbct'));
22
  }
23
 
24
  /**
@@ -30,20 +30,20 @@ class RemoteCalls
30
  {
31
  global $apbct;
32
 
33
- $action = strtolower(Get::get('spbc_remote_call_action'));
34
- $token = strtolower(Get::get('spbc_remote_call_token'));
35
 
36
  if (isset($apbct->remote_calls[$action])) {
37
  $cooldown = isset($apbct->remote_calls[$action]['cooldown']) ? $apbct->remote_calls[$action]['cooldown'] : self::COOLDOWN;
38
 
39
  // Return OK for test remote calls
40
- if (Get::get('test')) {
41
  die('OK');
42
  }
43
 
44
  if (
45
  time() - $apbct->remote_calls[$action]['last_call'] >= $cooldown ||
46
- ( $action === 'sfw_update' && isset($_GET['file_urls']) )
47
  ) {
48
  $apbct->remote_calls[$action]['last_call'] = time();
49
  $apbct->save('remote_calls');
@@ -57,13 +57,13 @@ class RemoteCalls
57
 
58
  if (method_exists(__CLASS__, $action)) {
59
  // Delay before perform action;
60
- if (Get::get('delay')) {
61
- sleep((int)Get::get('delay'));
62
- $params = $_GET;
63
  unset($params['delay']);
64
 
65
  return Helper::httpRequestRcToHost(
66
- Get::get('spbc_remote_action'),
67
  $params,
68
  array('async'),
69
  false
@@ -172,7 +172,7 @@ class RemoteCalls
172
  */
173
  public static function action__activate_plugin() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
174
  {
175
- return apbct_rc__activate_plugin($_GET['plugin']);
176
  }
177
 
178
  /**
@@ -180,7 +180,7 @@ class RemoteCalls
180
  */
181
  public static function action__insert_auth_key() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
182
  {
183
- return apbct_rc__insert_auth_key($_GET['auth_key'], $_GET['plugin']);
184
  }
185
 
186
  /**
@@ -188,7 +188,7 @@ class RemoteCalls
188
  */
189
  public static function action__update_settings() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
190
  {
191
- return apbct_rc__update_settings($_GET);
192
  }
193
 
194
  /**
@@ -226,7 +226,7 @@ class RemoteCalls
226
  $out['network_data'] = $apbct->network_data;
227
  }
228
 
229
- if (Get::equal('out', 'json')) {
230
  die(json_encode($out));
231
  }
232
  array_walk($out, function (&$val, $_key) {
2
 
3
  namespace Cleantalk\ApbctWP;
4
 
5
+ use Cleantalk\Variables\Request;
6
 
7
  class RemoteCalls
8
  {
16
  public static function check()
17
  {
18
  return
19
+ Request::get('spbc_remote_call_token') &&
20
+ Request::get('spbc_remote_call_action') &&
21
+ in_array(Request::get('plugin_name'), array('antispam', 'anti-spam', 'apbct'));
22
  }
23
 
24
  /**
30
  {
31
  global $apbct;
32
 
33
+ $action = strtolower(Request::get('spbc_remote_call_action'));
34
+ $token = strtolower(Request::get('spbc_remote_call_token'));
35
 
36
  if (isset($apbct->remote_calls[$action])) {
37
  $cooldown = isset($apbct->remote_calls[$action]['cooldown']) ? $apbct->remote_calls[$action]['cooldown'] : self::COOLDOWN;
38
 
39
  // Return OK for test remote calls
40
+ if (Request::get('test')) {
41
  die('OK');
42
  }
43
 
44
  if (
45
  time() - $apbct->remote_calls[$action]['last_call'] >= $cooldown ||
46
+ ( $action === 'sfw_update' && Request::get('file_urls') )
47
  ) {
48
  $apbct->remote_calls[$action]['last_call'] = time();
49
  $apbct->save('remote_calls');
57
 
58
  if (method_exists(__CLASS__, $action)) {
59
  // Delay before perform action;
60
+ if (Request::get('delay')) {
61
+ sleep((int)Request::get('delay'));
62
+ $params = $_REQUEST;
63
  unset($params['delay']);
64
 
65
  return Helper::httpRequestRcToHost(
66
+ Request::get('spbc_remote_action'),
67
  $params,
68
  array('async'),
69
  false
172
  */
173
  public static function action__activate_plugin() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
174
  {
175
+ return apbct_rc__activate_plugin(Request::get('plugin'));
176
  }
177
 
178
  /**
180
  */
181
  public static function action__insert_auth_key() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
182
  {
183
+ return apbct_rc__insert_auth_key(Request::get('auth_key'), Request::get('plugin'));
184
  }
185
 
186
  /**
188
  */
189
  public static function action__update_settings() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
190
  {
191
+ return apbct_rc__update_settings($_REQUEST);
192
  }
193
 
194
  /**
226
  $out['network_data'] = $apbct->network_data;
227
  }
228
 
229
+ if (Request::equal('out', 'json')) {
230
  die(json_encode($out));
231
  }
232
  array_walk($out, function (&$val, $_key) {
lib/Cleantalk/ApbctWP/State.php CHANGED
@@ -9,56 +9,26 @@ use ArrayObject;
9
  *
10
  * @package Antiospam Plugin by CleanTalk
11
  * @subpackage State
12
- * @Version 2.1
13
  * @author Cleantalk team (welcome@cleantalk.org)
14
- * @copyright (C) 2014 CleanTalk team (http://cleantalk.org)
15
  * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
16
- */
17
-
18
- /**
19
- * COMMON
20
- *
21
- * @property string api_key
22
- *
23
- * SETTINGS GROUPS
24
- * @property ArrayObject fw_stats
25
- * @property ArrayObject stats
26
- * @property ArrayObject settings
27
- * @property ArrayObject data
28
- *
29
- * STAND ALONE
30
- * @property ArrayObject plugin_request_ids
31
- *
32
- * @property mixed moderate_ip
33
- * @property mixed|string plugin_version
34
- * @property mixed|string db_prefix
35
- * @property string settings_link
36
- * @property int key_is_ok
37
- * @property string logo__small__colored
38
- * @property string logo__small
39
- * @property string logo
40
- * @property string plugin_name
41
- * @property string base_name
42
- * @property string plugin_request_id
43
- * @property array|mixed errors
44
- *
45
- * NETWORK
46
- * @property ArrayObject network_data
47
- * @property ArrayObject network_settings
48
- * @property mixed allow_custom_key
49
- * @property bool white_label
50
- * @property mixed moderate
51
- *
52
- * MISC
53
  *
54
  * @psalm-suppress PossiblyUnusedProperty
55
  */
56
- class State
 
57
  {
 
 
 
58
  public $user;
59
- public $use_rest_api = 0;
60
- public $option_prefix = 'cleantalk';
 
 
61
  public $storage = array();
 
62
  public $def_settings = array(
63
 
64
  'apikey' => '',
@@ -113,6 +83,8 @@ class State
113
  'data__protect_logged_in' => 1,
114
  // Do anti-spam tests to for logged in users.
115
  'data__use_ajax' => 1,
 
 
116
  'data__use_static_js_key' => -1,
117
  'data__general_postdata_test' => 0,
118
  //CAPD
@@ -294,7 +266,9 @@ class State
294
  'last_send_time' => 0,
295
  'last_send_amount' => 0,
296
  'last_update_time' => 0,
 
297
  'entries' => 0,
 
298
  ),
299
  'last_sfw_block' => array(
300
  'time' => 0,
@@ -333,31 +307,80 @@ class State
333
  'update_mode' => 0,
334
  );
335
 
336
- /**
337
- * @param string $option_prefix Database settings prefix
338
- * @param array $options Array of strings. Types of settings you want to get.
339
- */
340
- public function __construct($option_prefix, $options = array('settings'))
341
  {
342
- $this->option_prefix = $option_prefix;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
 
 
 
344
  // Network settings
345
- $option = get_site_option($this->option_prefix . '_network_settings');
346
- $option = is_array($option) ? array_merge(
347
- $this->def_network_settings,
348
- $option
349
- ) : $this->def_network_settings;
350
- $this->network_settings = new ArrayObject($option);
351
 
352
  // Network data
353
- $option = get_site_option($this->option_prefix . '_network_data');
354
- $option = is_array($option) ? array_merge(
355
- $this->def_network_data,
356
- $option
357
- ) : $this->def_network_data;
358
- $this->network_data = new ArrayObject($option);
359
-
360
- foreach ($options as $option_name) {
361
  $option = get_option($this->option_prefix . '_' . $option_name);
362
 
363
  // Setting default options
@@ -380,7 +403,7 @@ class State
380
 
381
  // Setting default errors
382
  if ($this->option_prefix . '_' . $option_name === 'cleantalk_errors') {
383
- $option = $option ? $option : array();
384
  }
385
 
386
  // Default remote calls
@@ -400,79 +423,28 @@ class State
400
 
401
  $this->$option_name = is_array($option) ? new ArrayObject($option) : $option;
402
  }
 
403
 
404
- /* Adding some dynamic properties */
405
-
406
  // Standalone or main site
407
  $this->api_key = $this->settings['apikey'];
408
  $this->dashboard_link = 'https://cleantalk.org/my/' . ($this->user_token ? '?user_token=' . $this->user_token : '');
409
  $this->notice_show = $this->data['notice_trial'] || $this->data['notice_renew'] || $this->isHaveErrors();
410
 
411
- // Network
412
- if ( ! is_main_site() ) {
413
- // Custom key allowed
414
- if ( $this->network_settings['multisite__work_mode'] != 2 ) {
415
- // Mutual key
416
- } elseif ( $this->network_settings['multisite__work_mode'] == 2 ) {
417
- $this->api_key = $this->network_settings['apikey'];
418
- $this->key_is_ok = $this->network_data['key_is_ok'];
419
- $this->user_token = $this->network_data['user_token'];
420
- $this->service_id = $this->network_data['service_id'];
421
- $this->moderate = $this->network_data['moderate'];
422
- $this->notice_show = false;
423
- }
424
- }
425
- }
426
-
427
- public static function setDefinitions()
428
- {
429
- global $wpdb;
430
-
431
- $db_prefix = is_multisite() && is_main_site() ? $wpdb->base_prefix : $wpdb->prefix;
432
-
433
- if ( ! defined('APBCT_SEESION__LIVE_TIME')) {
434
- define('APBCT_SEESION__LIVE_TIME', 86400);
435
- }
436
- if ( ! defined('APBCT_SEESION__CHANCE_TO_CLEAN')) {
437
- define('APBCT_SEESION__CHANCE_TO_CLEAN', 100);
438
- }
439
-
440
- // Database constants
441
- if ( ! defined('APBCT_TBL_FIREWALL_DATA')) {
442
- // Table with firewall data.
443
- define('APBCT_TBL_FIREWALL_DATA', $db_prefix . 'cleantalk_sfw');
444
- }
445
- if ( ! defined('APBCT_TBL_FIREWALL_LOG')) {
446
- // Table with firewall logs.
447
- define('APBCT_TBL_FIREWALL_LOG', $db_prefix . 'cleantalk_sfw_logs');
448
- }
449
- if ( ! defined('APBCT_TBL_AC_LOG')) {
450
- // Table with firewall logs.
451
- define('APBCT_TBL_AC_LOG', $db_prefix . 'cleantalk_ac_log');
452
- }
453
- if ( ! defined('APBCT_TBL_AC_UA_BL')) {
454
- // Table with User-Agents blacklist.
455
- define('APBCT_TBL_AC_UA_BL', $db_prefix . 'cleantalk_ua_bl');
456
- }
457
- if ( ! defined('APBCT_TBL_SESSIONS')) {
458
- // Table with session data.
459
- define('APBCT_TBL_SESSIONS', $db_prefix . 'cleantalk_sessions');
460
- }
461
- if ( ! defined('APBCT_SPAMSCAN_LOGS')) {
462
- // Table with session data.
463
- define('APBCT_SPAMSCAN_LOGS', $db_prefix . 'cleantalk_spamscan_logs');
464
- }
465
- if ( ! defined('APBCT_SELECT_LIMIT')) {
466
- // Select limit for logs.
467
- define('APBCT_SELECT_LIMIT', 5000);
468
- }
469
- if ( ! defined('APBCT_WRITE_LIMIT')) {
470
- // Write limit for firewall data.
471
- define('APBCT_WRITE_LIMIT', 5000);
472
- }
473
- if ( ! defined('APBCT_SFW_SEND_LOGS_LIMIT')) {
474
- // Limit for firewall logs sending.
475
- define('APBCT_SFW_SEND_LOGS_LIMIT', 1000);
476
  }
477
  }
478
 
@@ -481,9 +453,9 @@ class State
481
  *
482
  * @param string $option_name
483
  */
484
- private function getOption($option_name)
485
  {
486
- $option = get_option('cleantalk_' . $option_name, null);
487
 
488
  $this->$option_name = is_array($option)
489
  ? new ArrayObject($option)
@@ -662,13 +634,18 @@ class State
662
  */
663
  public function errorToggle($add_error, $type, $error, $major_type = null, $set_time = true, $save_flag = true)
664
  {
665
- if ($add_error) {
666
  $this->errorAdd($type, $error, $major_type, $set_time);
667
- } else {
668
  $this->errorDelete($type, $save_flag, $major_type);
669
  }
670
  }
671
 
 
 
 
 
 
672
  /**
673
  * Checking if errors are in the setting, and they are not empty.
674
  *
@@ -715,7 +692,7 @@ class State
715
  *
716
  * @return mixed
717
  */
718
- public function &__get($name)
719
  {
720
  // First check in storage
721
  if (isset($this->storage[$name])) {
@@ -729,7 +706,7 @@ class State
729
 
730
  return $option;
731
 
732
- // Otherwise try to get it from db settings table
733
  // it will be arrayObject || scalar || null
734
  } else {
735
  $option = $this->getOption($name);
@@ -747,29 +724,4 @@ class State
747
  {
748
  unset($this->storage[$name]);
749
  }
750
-
751
- public function server()
752
- {
753
- return \Cleantalk\Variables\Server::getInstance();
754
- }
755
-
756
- public function cookie()
757
- {
758
- return \Cleantalk\Variables\Cookie::getInstance();
759
- }
760
-
761
- public function request()
762
- {
763
- return \Cleantalk\Variables\Request::getInstance();
764
- }
765
-
766
- public function post()
767
- {
768
- return \Cleantalk\Variables\Post::getInstance();
769
- }
770
-
771
- public function get()
772
- {
773
- return \Cleantalk\Variables\Get::getInstance();
774
- }
775
  }
9
  *
10
  * @package Antiospam Plugin by CleanTalk
11
  * @subpackage State
12
+ * @Version 3.0
13
  * @author Cleantalk team (welcome@cleantalk.org)
14
+ * @copyright (C) 2021 CleanTalk team (http://cleantalk.org)
15
  * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  *
17
  * @psalm-suppress PossiblyUnusedProperty
18
  */
19
+
20
+ class State extends \Cleantalk\Common\State
21
  {
22
+ /**
23
+ * @var \WP_User
24
+ */
25
  public $user;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
  public $storage = array();
31
+
32
  public $def_settings = array(
33
 
34
  'apikey' => '',
83
  'data__protect_logged_in' => 1,
84
  // Do anti-spam tests to for logged in users.
85
  'data__use_ajax' => 1,
86
+ 'data__use_ajax__type' => 1,
87
+ // Ajax handler type: REST API - 0 / custom AJAX - 1 / WP AJAX - 2
88
  'data__use_static_js_key' => -1,
89
  'data__general_postdata_test' => 0,
90
  //CAPD
266
  'last_send_time' => 0,
267
  'last_send_amount' => 0,
268
  'last_update_time' => 0,
269
+ 'last_update_way' => '',
270
  'entries' => 0,
271
+ 'update_period' => 14400,
272
  ),
273
  'last_sfw_block' => array(
274
  'time' => 0,
307
  'update_mode' => 0,
308
  );
309
 
310
+ protected function setDefinitions()
 
 
 
 
311
  {
312
+ global $wpdb;
313
+
314
+ $db_prefix = is_multisite() && is_main_site() ? $wpdb->base_prefix : $wpdb->prefix;
315
+ // Use tables from main site on wpms_mode=2
316
+ $fw_db_prefix =
317
+ is_multisite() && ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2
318
+ ? $wpdb->base_prefix
319
+ : $db_prefix;
320
+
321
+ if ( ! defined('APBCT_SEESION__LIVE_TIME')) {
322
+ define('APBCT_SEESION__LIVE_TIME', 86400);
323
+ }
324
+ if ( ! defined('APBCT_SEESION__CHANCE_TO_CLEAN')) {
325
+ define('APBCT_SEESION__CHANCE_TO_CLEAN', 100);
326
+ }
327
+
328
+ // Database constants
329
+ if ( ! defined('APBCT_TBL_FIREWALL_DATA')) {
330
+ // Table with firewall data.
331
+ define('APBCT_TBL_FIREWALL_DATA', $fw_db_prefix . 'cleantalk_sfw');
332
+ }
333
+ if ( ! defined('APBCT_TBL_FIREWALL_LOG')) {
334
+ // Table with firewall logs.
335
+ define('APBCT_TBL_FIREWALL_LOG', $fw_db_prefix . 'cleantalk_sfw_logs');
336
+ }
337
+ if ( ! defined('APBCT_TBL_AC_LOG')) {
338
+ // Table with firewall logs.
339
+ define('APBCT_TBL_AC_LOG', $fw_db_prefix . 'cleantalk_ac_log');
340
+ }
341
+ if ( ! defined('APBCT_TBL_AC_UA_BL')) {
342
+ // Table with User-Agents blacklist.
343
+ define('APBCT_TBL_AC_UA_BL', $fw_db_prefix . 'cleantalk_ua_bl');
344
+ }
345
+ if ( ! defined('APBCT_TBL_SESSIONS')) {
346
+ // Table with session data.
347
+ define('APBCT_TBL_SESSIONS', $db_prefix . 'cleantalk_sessions');
348
+ }
349
+ if ( ! defined('APBCT_SPAMSCAN_LOGS')) {
350
+ // Table with session data.
351
+ define('APBCT_SPAMSCAN_LOGS', $db_prefix . 'cleantalk_spamscan_logs');
352
+ }
353
+ if ( ! defined('APBCT_SELECT_LIMIT')) {
354
+ // Select limit for logs.
355
+ define('APBCT_SELECT_LIMIT', 5000);
356
+ }
357
+ if ( ! defined('APBCT_WRITE_LIMIT')) {
358
+ // Write limit for firewall data.
359
+ define('APBCT_WRITE_LIMIT', 5000);
360
+ }
361
+ if ( ! defined('APBCT_SFW_SEND_LOGS_LIMIT')) {
362
+ // Limit for firewall logs sending.
363
+ define('APBCT_SFW_SEND_LOGS_LIMIT', 1000);
364
+ }
365
+ }
366
 
367
+ protected function setOptions()
368
+ {
369
  // Network settings
370
+ $net_option = get_site_option($this->option_prefix . '_network_settings');
371
+ $net_option = is_array($net_option)
372
+ ? array_merge($this->def_network_settings, $net_option)
373
+ : $this->def_network_settings;
374
+ $this->network_settings = new ArrayObject($net_option);
 
375
 
376
  // Network data
377
+ $net_data = get_site_option($this->option_prefix . '_network_data');
378
+ $net_data = is_array($net_data)
379
+ ? array_merge($this->def_network_data, $net_data)
380
+ : $this->def_network_data;
381
+ $this->network_data = new ArrayObject($net_data);
382
+
383
+ foreach ($this->options as $option_name) {
 
384
  $option = get_option($this->option_prefix . '_' . $option_name);
385
 
386
  // Setting default options
403
 
404
  // Setting default errors
405
  if ($this->option_prefix . '_' . $option_name === 'cleantalk_errors') {
406
+ $option = $option ?: array();
407
  }
408
 
409
  // Default remote calls
423
 
424
  $this->$option_name = is_array($option) ? new ArrayObject($option) : $option;
425
  }
426
+ }
427
 
428
+ protected function init()
429
+ {
430
  // Standalone or main site
431
  $this->api_key = $this->settings['apikey'];
432
  $this->dashboard_link = 'https://cleantalk.org/my/' . ($this->user_token ? '?user_token=' . $this->user_token : '');
433
  $this->notice_show = $this->data['notice_trial'] || $this->data['notice_renew'] || $this->isHaveErrors();
434
 
435
+ // Network with Mutual key
436
+ if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) {
437
+ // Get stats from main blog
438
+ switch_to_blog(get_main_site_id());
439
+ $main_blog_stats = get_option($this->option_prefix . '_stats');
440
+ restore_current_blog();
441
+ $this->stats = $main_blog_stats;
442
+ $this->api_key = $this->network_settings['apikey'];
443
+ $this->key_is_ok = $this->network_data['key_is_ok'];
444
+ $this->user_token = $this->network_data['user_token'];
445
+ $this->service_id = $this->network_data['service_id'];
446
+ $this->moderate = $this->network_data['moderate'];
447
+ $this->notice_show = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
448
  }
449
  }
450
 
453
  *
454
  * @param string $option_name
455
  */
456
+ protected function getOption($option_name)
457
  {
458
+ $option = get_option($this->option_prefix . '_' . $option_name, null);
459
 
460
  $this->$option_name = is_array($option)
461
  ? new ArrayObject($option)
634
  */
635
  public function errorToggle($add_error, $type, $error, $major_type = null, $set_time = true, $save_flag = true)
636
  {
637
+ if ( $add_error && ! $this->errorExists($type) ) {
638
  $this->errorAdd($type, $error, $major_type, $set_time);
639
+ } elseif ( $this->errorExists($type) ) {
640
  $this->errorDelete($type, $save_flag, $major_type);
641
  }
642
  }
643
 
644
+ public function errorExists($error_type)
645
+ {
646
+ return array_key_exists($error_type, (array)$this->errors);
647
+ }
648
+
649
  /**
650
  * Checking if errors are in the setting, and they are not empty.
651
  *
692
  *
693
  * @return mixed
694
  */
695
+ public function __get($name)
696
  {
697
  // First check in storage
698
  if (isset($this->storage[$name])) {
706
 
707
  return $option;
708
 
709
+ // Otherwise, try to get it from db settings table
710
  // it will be arrayObject || scalar || null
711
  } else {
712
  $option = $this->getOption($name);
724
  {
725
  unset($this->storage[$name]);
726
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
727
  }
lib/Cleantalk/Common/Cron.php CHANGED
@@ -28,6 +28,8 @@ abstract class Cron
28
  // Interval in seconds for cron work availability
29
  protected $cron_execution_min_interval;
30
 
 
 
31
  /**
32
  * Cron constructor.
33
  * Getting tasks option.
@@ -53,8 +55,17 @@ abstract class Cron
53
  $this->cron_option_name = $cron_option_name;
54
  $this->task_execution_min_interval = $task_execution_min_interval;
55
  $this->cron_execution_min_interval = $cron_execution_min_interval;
56
- if (time() - $this->getCronLastStart() > $this->cron_execution_min_interval) {
 
 
 
 
57
  $this->tasks = $this->getTasks();
 
 
 
 
 
58
  }
59
  }
60
 
@@ -168,7 +179,8 @@ abstract class Cron
168
  return $this->saveTasks($tasks);
169
  }
170
 
171
- return false;
 
172
  }
173
 
174
  /**
@@ -190,11 +202,7 @@ abstract class Cron
190
  public function checkTasks()
191
  {
192
  // No tasks to run
193
- if ( empty($this->tasks) ) {
194
- return false;
195
- }
196
-
197
- if ( ! $this->setCronLastStart() ) {
198
  return false;
199
  }
200
 
@@ -241,7 +249,7 @@ abstract class Cron
241
  */
242
  public function runTasks($tasks)
243
  {
244
- if (empty($tasks)) {
245
  return;
246
  }
247
 
@@ -284,4 +292,13 @@ abstract class Cron
284
 
285
  return $this->tasks_completed;
286
  }
 
 
 
 
 
 
 
 
 
287
  }
28
  // Interval in seconds for cron work availability
29
  protected $cron_execution_min_interval;
30
 
31
+ private $id;
32
+
33
  /**
34
  * Cron constructor.
35
  * Getting tasks option.
55
  $this->cron_option_name = $cron_option_name;
56
  $this->task_execution_min_interval = $task_execution_min_interval;
57
  $this->cron_execution_min_interval = $cron_execution_min_interval;
58
+ if ( time() - $this->getCronLastStart() > $this->cron_execution_min_interval ) {
59
+ if ( ! $this->setCronLastStart() ) {
60
+ return;
61
+ }
62
+
63
  $this->tasks = $this->getTasks();
64
+
65
+ if ( ! empty($this->tasks) ) {
66
+ $this->createId();
67
+ usleep(10000); // 10 ms
68
+ }
69
  }
70
  }
71
 
179
  return $this->saveTasks($tasks);
180
  }
181
 
182
+ // Add task if it's disappeared
183
+ return $this->addTask($task, $handler, $period, $first_call, $params);
184
  }
185
 
186
  /**
202
  public function checkTasks()
203
  {
204
  // No tasks to run
205
+ if ( empty($this->tasks) || get_option('cleantalk_cron_pid') !== $this->id ) {
 
 
 
 
206
  return false;
207
  }
208
 
249
  */
250
  public function runTasks($tasks)
251
  {
252
+ if ( empty($tasks) ) {
253
  return;
254
  }
255
 
292
 
293
  return $this->tasks_completed;
294
  }
295
+
296
+ /**
297
+ * Generates and save Cron ID to the base
298
+ */
299
+ public function createId()
300
+ {
301
+ $this->id = mt_rand(0, mt_getrandmax());
302
+ update_option('cleantalk_cron_pid', $this->id);
303
+ }
304
  }
lib/Cleantalk/Common/Helper.php CHANGED
@@ -620,7 +620,9 @@ class Helper
620
  */
621
  public static function httpRequest($url, $data = array(), $presets = array(), $opts = array())
622
  {
623
- $url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?') . 'no_cache=' . rand(0, getrandmax());
 
 
624
 
625
  if (function_exists('curl_init')) {
626
  $ch = curl_init();
620
  */
621
  public static function httpRequest($url, $data = array(), $presets = array(), $opts = array())
622
  {
623
+ $url .= (parse_url($url, PHP_URL_QUERY) ? '&' : '?') . 'cleantalk_no_cache=' . rand(0, getrandmax());
624
+
625
+ $url = str_replace('http:', 'https:', $url);
626
 
627
  if (function_exists('curl_init')) {
628
  $ch = curl_init();
lib/Cleantalk/Common/State.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Cleantalk\Common;
4
+
5
+ abstract class State
6
+ {
7
+ /**
8
+ * @var string
9
+ */
10
+ protected $option_prefix = '';
11
+
12
+ /**
13
+ * @var array
14
+ */
15
+ protected $options;
16
+
17
+ /**
18
+ * @param string $option_prefix
19
+ * @param array $options
20
+ */
21
+ public function __construct($option_prefix, $options = array('settings'))
22
+ {
23
+ $this->option_prefix = $option_prefix;
24
+ $this->options = $options;
25
+ $this->setOptions();
26
+ $this->setDefinitions();
27
+ $this->init();
28
+ }
29
+
30
+ /**
31
+ * Define necessary constants
32
+ */
33
+ abstract protected function setDefinitions();
34
+
35
+ /**
36
+ * Get options from the database
37
+ * Set it to object
38
+ */
39
+ abstract protected function setOptions();
40
+
41
+ /**
42
+ * Adding some dynamic properties
43
+ */
44
+ abstract protected function init();
45
+
46
+
47
+ abstract protected function getOption($option_name);
48
+
49
+ abstract public function save($option_name, $use_prefix = true, $autoload = true);
50
+
51
+ /**
52
+ * @param $option_name
53
+ * @param false $use_prefix
54
+ *
55
+ * @return void
56
+ * @psalm-suppress PossiblyUnusedMethod
57
+ */
58
+ abstract public function deleteOption($option_name, $use_prefix = false);
59
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: spam, antispam, anti-spam, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
- Stable tag: 5.162
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -63,16 +63,16 @@ Native spam protection for WordPress, JetPack comments and any other comment plu
63
  Plugin extends Contact Form by WPForms to provide spam protection. It filters spam submissions for each type of forms - simple contact form, marketing form, request a quote and etc.
64
 
65
  = Elementor Website Builder filter =
66
- Plugin extends spam protection for Elementor Website Builder. It filters spam submisssions and tested for contact form type.
67
 
68
  = Gravity forms spam filter =
69
- Plugin extends spam protection for Gravity forms. It filters spam submisssions for any type of forms.
70
 
71
  = Formidable Form Builder spam filter =
72
- Plugin extends spam protection for Formidable Form Builder. It filters spam submisssions for any type of forms - Contact Form, Survey & Quiz Forms.
73
 
74
  = Contact Form 7 spam filter =
75
- Plugin extends spam protection for Contact Form 7 (CF7). It can be used with any other third-party spam filters.
76
 
77
  = Ninja forms contact form spam filter =
78
 
@@ -595,6 +595,43 @@ If your website has forms that send data to external sources, you can enable opt
595
 
596
  == Changelog ==
597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  = 5.162 Sep 23 2021 =
599
  * New. SFW. Fall back updating system implemented.
600
  * New: Integration. Added honeypot wc.
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
  Requires PHP: 5.6
7
+ Stable tag: 5.163
8
  License: GPLv2
9
 
10
  Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
63
  Plugin extends Contact Form by WPForms to provide spam protection. It filters spam submissions for each type of forms - simple contact form, marketing form, request a quote and etc.
64
 
65
  = Elementor Website Builder filter =
66
+ Plugin extends spam protection for Elementor Website Builder. It filters spam submisssions and tested for contact form type.
67
 
68
  = Gravity forms spam filter =
69
+ Plugin extends spam protection for Gravity forms. It filters spam submisssions for any type of forms.
70
 
71
  = Formidable Form Builder spam filter =
72
+ Plugin extends spam protection for Formidable Form Builder. It filters spam submisssions for any type of forms - Contact Form, Survey & Quiz Forms.
73
 
74
  = Contact Form 7 spam filter =
75
+ Plugin extends spam protection for Contact Form 7 (CF7). It can be used with any other third-party spam filters.
76
 
77
  = Ninja forms contact form spam filter =
78
 
595
 
596
  == Changelog ==
597
 
598
+ = 5.163 Oct 07 2021 =
599
+ * New: State. errorExists method implemented.
600
+ * New: SFW. Disabling SFW when the database was outdated.
601
+ * New: Settings templates. Saving template to the several blogs implemented.
602
+ * New: Settings. WPMS settings always show now.
603
+ * New: WPMS. No show any sub-sites errors on wpms mode 2.
604
+ * New: WPMS. Plugin settings are disabled on sub-sites on wpms mode 2.
605
+ * Mod: Remote Calls using POST instead of GET request type.
606
+ * Mod: Helper. No cache GET parameter renamed.
607
+ * Mod: Cron. Transactions implemented #2.
608
+ * Mod: Settings. "URL Exclusions" description updated.
609
+ * Upd: Getting JS. AJAX handler type selecting updated.
610
+ * Fix: Added lost info about total comments in CommentChecker::ctAjaxInfo
611
+ * Fix: add subscriber to skip list.
612
+ * Fix: Changed the plugin name in the list of plugins when enabling White Label
613
+ * Fix: Changed the plugin name in the admin bar when enabling White Label
614
+ * Fix: Feedback. Comments feedback description fixed.
615
+ * Fix: Hide information about Security in admin bar if it is not main site.
616
+ * Fix: SFW. Error toggle used instead of error add/delete.
617
+ * Fix: Alt cookies. Selecting type of alt cookies bug fixed.
618
+ * Fix: protect logged users in gravity.
619
+ * Fix: Updated the condition for showing a link to the security installation in the admin bar.
620
+ * Fix: reverse condition for WL security link.
621
+ * Fix: WPMS. Addition WL info link fixed.
622
+ * Changed plugin name in plugin settings multisite__white_label__plugin_name.
623
+ * Fix: rename plugin name after search plugins if WL is on.
624
+ * Fix: Renamed Antispam by Cleantalk to Anti-spam by Cleantalk
625
+ * Fix: add elementor-pro to skip save action.
626
+ * Fix: WPMS. Sanitize api key during getting key fixed.
627
+ * Fix: Cron. Cron results errors handling fixed.
628
+ * Fix: WPMS. Migrate old WPMS to the new wpms mode.
629
+ * Fix: WPMS. Using main site data on wpms_mode=2.
630
+ * Fix: Helper. Hard use https for the curl requests.
631
+ * Fix: WPMS. Sanitize network settings fixed.
632
+ * Fix: WPMS. Applying settings for selected blogs fixed.
633
+ * Fix: Getting key. Sync after getting key fixed.
634
+
635
  = 5.162 Sep 23 2021 =
636
  * New. SFW. Fall back updating system implemented.
637
  * New: Integration. Added honeypot wc.