Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.109

Version Description

November 15 2018 = Fix: Added URL and IP exclusions to Contact Form 7. Fix: js error when responseText is not exists Fix: Sitename when getting key automatically under WPMS. Mod: SpamFireWall is now fully compatible with WPMS. Mod: Setting 'Tell others about CleanTalk' was deleted. Mod: Protection from spam improved.

Download this release

Release Info

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

Code changes from version 5.108.1 to 5.109

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.108.1
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
@@ -20,7 +20,6 @@ define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP pat
20
  define('APBCT_DIR_PATH', plugin_dir_path(__FILE__)); //System path. Plugin root folder with '/'.
21
  define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
22
  define('APBCT_CASERT_PATH', file_exists(ABSPATH.WPINC.'/certificates/ca-bundle.crt') ? ABSPATH.WPINC.'/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
23
-
24
  // API params
25
  define('CLEANTALK_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
26
  define('CLEANTALK_API_URL', 'https://api.cleantalk.org'); //Api URL
@@ -35,19 +34,11 @@ define('APBCT_DEBUG', 'cleantalk_debug'); //Option name wi
35
  // Different params
36
  define('APBCT_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
37
 
38
- // Database parameters
39
- global $wpdb;
40
- define('APBCT_TBL_FIREWALL_DATA', $wpdb->base_prefix . 'cleantalk_sfw'); // Table with firewall data.
41
- define('APBCT_TBL_FIREWALL_LOG', $wpdb->base_prefix . 'cleantalk_sfw_logs'); // Table with firewall logs.
42
- define('APBCT_TBL_SESSIONS', $wpdb->base_prefix . 'cleantalk_sessions'); // Table with session data.
43
- define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs.
44
- define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data.
45
-
46
  if(!defined('CLEANTALK_PLUGIN_DIR')){
47
 
48
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
49
 
50
- require_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB_Wordpress.php'); // State class
51
 
52
  require_once( CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
53
  require_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkHelper.php'); // Helper class. Different useful functions
@@ -63,10 +54,12 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
63
  global $apbct;
64
  $apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors'), is_multisite());
65
 
 
 
66
  // Customize CleantalkState
67
  // Account status
68
- $apbct->plugin_name = APBCT_NAME;
69
  $apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
 
70
 
71
  $apbct->logo = plugin_dir_url(__FILE__) . '/inc/images/logo.png';
72
  $apbct->logo__small = plugin_dir_url(__FILE__) . '/inc/images/logo_small.png';
@@ -75,38 +68,30 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
75
  $apbct->key_is_ok = !empty($apbct->data['key_is_ok']) ? $apbct->data['key_is_ok'] : 0;
76
  $apbct->key_is_ok = isset($apbct->data['testing_failed']) && $apbct->data['testing_failed'] == 0 ? 1 : $apbct->key_is_ok;
77
 
78
- $apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
79
  $apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
80
-
81
- // START OF White label reassignments
82
- $apbct->white_label = defined('APBCT_WHITELABLE') && APBCT_WHITELABLE == true ? true : false;
83
 
84
- if($apbct->white_label){
85
-
86
- // New plugin name
87
- // $apbct->plugin_name = $apcbt->data['white_label_data']['plugin_name'];
88
- $apbct->plugin_name = defined('APBCT_WHITELABEL_NAME') ? APBCT_WHITELABEL_NAME : $apbct->plugin_name; // For test purposes
89
-
90
- // Logotypes
91
- // $apbct->logo = $apcbt->data['white_label_data']['logo']
92
- // $apbct->logo__small = $apcbt->data['white_label_data']['logo__small']
93
- // $apbct->logo__small__colored = $apcbt->data['white_label_data']['logo__small__colored']
94
-
95
- // $apbct->settings_link = 'admin.php?page=apbct_menu';
96
-
97
- $apbct->settings_link = is_network_admin()
98
- ? 'settings.php?page=cleantalk'
99
- : 'options-general.php?page=cleantalk';
100
-
101
- }else{
102
  require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
103
  $apbct->settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $apbct->settings['apikey'];
104
 
105
- $apbct->settings_link = is_network_admin()
106
- ? 'settings.php?page=cleantalk'
107
- : 'options-general.php?page=cleantalk';
108
  }
109
- // END OF White label
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  // Self cron
112
  if(!defined('DOING_CRON') || (defined('DOING_CRON') && DOING_CRON !== true)){
@@ -160,7 +145,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
160
  $cleantalk_hooked_actions[]='nf_ajax_submit';
161
  $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
162
 
163
-
164
  if(!is_admin() && !defined('DOING_AJAX')){
165
 
166
  // Remote calls
@@ -186,6 +170,10 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
186
  // Redirect admin to plugin settings.
187
  if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
188
  add_action('admin_init', 'apbct_plugin_redirect');
 
 
 
 
189
 
190
  // After plugin loaded - to load locale as described in manual
191
  add_action('plugins_loaded', 'apbct_plugin_loaded' );
@@ -197,9 +185,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
197
  add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
198
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
199
  }
200
-
201
- if($apbct->settings['show_link'] == 1)
202
- add_action('comment_form_after', 'ct_show_comment_link');
203
 
204
  if(is_admin() || is_network_admin()){
205
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
@@ -338,7 +323,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
338
  }
339
 
340
  // Short code for GDPR
341
- add_shortcode('cleantalk_gdpr_form', 'apbct_shrotcode_hadler__GDPR_public_notice__form');
342
 
343
  }
344
 
@@ -475,55 +460,86 @@ function apbct_sfw__check()
475
  /**
476
  * On activation, set a time, frequency and name of an action hook to be scheduled.
477
  */
478
- function apbct_activation() {
479
 
480
  global $wpdb;
481
 
482
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
483
  `network` int(11) unsigned NOT NULL,
484
  `mask` int(11) unsigned NOT NULL,
485
  INDEX ( `network` , `mask` )
486
- ) ENGINE = MYISAM ;"
487
- );
488
-
489
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs` (
490
  `ip` VARCHAR(15) NOT NULL,
491
  `all_entries` INT NOT NULL,
492
  `blocked_entries` INT NOT NULL,
493
  `entries_timestamp` INT NOT NULL,
494
  PRIMARY KEY (`ip`))
495
- ENGINE = MYISAM;"
496
- );
497
-
498
- // Cron tasks
499
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
500
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
501
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
502
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200);// SFW update
503
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
504
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
505
- CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
 
507
  // Additional options
508
  add_option('ct_plugin_do_activation_redirect', true);
509
-
510
- // Updating SFW
511
- ct_sfw_update();
512
  }
513
 
514
  /**
515
  * On deactivation, clear schedule.
516
  */
517
- function apbct_deactivation() {
518
 
519
  global $wpdb;
520
 
521
- // Deleting SFW tables
522
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->base_prefix."cleantalk_sfw`;");
523
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs`;");
524
-
525
- // Deleting cron entries
526
- delete_option('cleantalk_cron');
 
 
 
 
 
 
 
 
 
 
 
 
527
  }
528
 
529
  /**
@@ -586,14 +602,6 @@ function ct_get_cookie()
586
  die();
587
  }
588
 
589
- function ct_show_comment_link(){
590
-
591
- print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>".__( 'WordPress spam', 'cleantalk' )."</a> ".__( 'blocked by', 'cleantalk' )." CleanTalk.</div>";
592
-
593
- }
594
-
595
- add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' );
596
-
597
  function ct_sfw_update(){
598
 
599
  global $apbct;
@@ -602,7 +610,7 @@ function ct_sfw_update(){
602
 
603
  include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW_Base.php");
604
  include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php");
605
-
606
  $sfw = new CleantalkSFW();
607
  $result = $sfw->sfw_update($apbct->api_key);
608
  unset($sfw);
@@ -953,4 +961,17 @@ function apbct_log($message = 'empty', $func = null, $params = array())
953
  if($settings) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_settings'] = $apbct->settings;
954
 
955
  update_option(APBCT_DEBUG, $debug);
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  }
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.109
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
20
  define('APBCT_DIR_PATH', plugin_dir_path(__FILE__)); //System path. Plugin root folder with '/'.
21
  define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
22
  define('APBCT_CASERT_PATH', file_exists(ABSPATH.WPINC.'/certificates/ca-bundle.crt') ? ABSPATH.WPINC.'/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
 
23
  // API params
24
  define('CLEANTALK_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
25
  define('CLEANTALK_API_URL', 'https://api.cleantalk.org'); //Api URL
34
  // Different params
35
  define('APBCT_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
36
 
 
 
 
 
 
 
 
 
37
  if(!defined('CLEANTALK_PLUGIN_DIR')){
38
 
39
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
40
 
41
+ require_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB_Wordpress.php'); // Database class
42
 
43
  require_once( CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
44
  require_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkHelper.php'); // Helper class. Different useful functions
54
  global $apbct;
55
  $apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors'), is_multisite());
56
 
57
+ $apbct->white_label = defined('APBCT_WHITELABEL') && APBCT_WHITELABEL == true ? true : false;
58
+
59
  // Customize CleantalkState
60
  // Account status
 
61
  $apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
62
+ $apbct->plugin_name = defined('APBCT_WHITELABEL_NAME') ? APBCT_WHITELABEL_NAME : APBCT_NAME; // For test purposes
63
 
64
  $apbct->logo = plugin_dir_url(__FILE__) . '/inc/images/logo.png';
65
  $apbct->logo__small = plugin_dir_url(__FILE__) . '/inc/images/logo_small.png';
68
  $apbct->key_is_ok = !empty($apbct->data['key_is_ok']) ? $apbct->data['key_is_ok'] : 0;
69
  $apbct->key_is_ok = isset($apbct->data['testing_failed']) && $apbct->data['testing_failed'] == 0 ? 1 : $apbct->key_is_ok;
70
 
71
+ $apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
72
  $apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
 
 
 
73
 
74
+ $apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
75
+
76
+ if(!$apbct->white_label){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
78
  $apbct->settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $apbct->settings['apikey'];
79
 
 
 
 
80
  }
81
+
82
+ /** @todo HARDCODE FIX */
83
+ if($apbct->plugin_version === '1.0.0')
84
+ $apbct->plugin_version = '5.100';
85
+
86
+ // Database prefix
87
+ global $wpdb;
88
+ $apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
89
+ // Database constants
90
+ define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
91
+ define('APBCT_TBL_FIREWALL_LOG', $apbct->db_prefix . 'cleantalk_sfw_logs'); // Table with firewall logs.
92
+ define('APBCT_TBL_SESSIONS', $apbct->db_prefix . 'cleantalk_sessions'); // Table with session data.
93
+ define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs.
94
+ define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data.
95
 
96
  // Self cron
97
  if(!defined('DOING_CRON') || (defined('DOING_CRON') && DOING_CRON !== true)){
145
  $cleantalk_hooked_actions[]='nf_ajax_submit';
146
  $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
147
 
 
148
  if(!is_admin() && !defined('DOING_AJAX')){
149
 
150
  // Remote calls
170
  // Redirect admin to plugin settings.
171
  if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
172
  add_action('admin_init', 'apbct_plugin_redirect');
173
+
174
+ // Deleting SFW tables when deleting websites
175
+ if(defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE === true)
176
+ add_action( 'delete_blog', 'apbct_sfw__delete_tables', 10, 2 );
177
 
178
  // After plugin loaded - to load locale as described in manual
179
  add_action('plugins_loaded', 'apbct_plugin_loaded' );
185
  add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
186
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
187
  }
 
 
 
188
 
189
  if(is_admin() || is_network_admin()){
190
  require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-comments.php');
323
  }
324
 
325
  // Short code for GDPR
326
+ add_shortcode('cleantalk_gdpr_form', 'apbct_shrotcode_handler__GDPR_public_notice__form');
327
 
328
  }
329
 
460
  /**
461
  * On activation, set a time, frequency and name of an action hook to be scheduled.
462
  */
463
+ function apbct_activation( $network ) {
464
 
465
  global $wpdb;
466
 
467
+ $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
468
  `network` int(11) unsigned NOT NULL,
469
  `mask` int(11) unsigned NOT NULL,
470
  INDEX ( `network` , `mask` )
471
+ ) ENGINE = MYISAM ;';
472
+
473
+ $sfw_log_query = 'CREATE TABLE IF NOT EXISTS `%s` (
 
474
  `ip` VARCHAR(15) NOT NULL,
475
  `all_entries` INT NOT NULL,
476
  `blocked_entries` INT NOT NULL,
477
  `entries_timestamp` INT NOT NULL,
478
  PRIMARY KEY (`ip`))
479
+ ENGINE = MYISAM;';
480
+
481
+ if($network && !defined('CLEANTALK_ACCESS_KEY')){
482
+ $initial_blog = get_current_blog_id();
483
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
484
+ foreach ($blogs as $blog) {
485
+ switch_to_blog($blog);
486
+ $wpdb->query(sprintf($sfw_data_query, $wpdb->prefix . 'cleantalk_sfw')); // Table for SpamFireWall data
487
+ $wpdb->query(sprintf($sfw_log_query, $wpdb->prefix . 'cleantalk_sfw_logs')); // Table for SpamFireWall logs
488
+ // Cron tasks
489
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
490
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
491
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
492
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
493
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
494
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
495
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
496
+ }
497
+ switch_to_blog($initial_blog);
498
+ }else{
499
+
500
+ // Cron tasks
501
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
502
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
503
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
504
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
505
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
506
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
507
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
508
+
509
+ $wpdb->query(sprintf($sfw_data_query, APBCT_TBL_FIREWALL_DATA)); // Table for SpamFireWall data
510
+ $wpdb->query(sprintf($sfw_log_query, APBCT_TBL_FIREWALL_LOG)); // Table for SpamFireWall logs
511
+ ct_sfw_update(); // Updating SFW
512
+ }
513
 
514
  // Additional options
515
  add_option('ct_plugin_do_activation_redirect', true);
 
 
 
516
  }
517
 
518
  /**
519
  * On deactivation, clear schedule.
520
  */
521
+ function apbct_deactivation( $network ) {
522
 
523
  global $wpdb;
524
 
525
+ if($network){
526
+ $initial_blog = get_current_blog_id();
527
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
528
+ foreach ($blogs as $blog) {
529
+ switch_to_blog($blog);
530
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
531
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
532
+ // Deleting cron entries
533
+ delete_option('cleantalk_cron');
534
+ }
535
+ switch_to_blog($initial_blog);
536
+ }else{
537
+ $wpdb->query('DROP TABLE IF EXISTS `'. APBCT_TBL_FIREWALL_DATA .'`;'); // Deleting SFW data
538
+ $wpdb->query('DROP TABLE IF EXISTS `'. APBCT_TBL_FIREWALL_LOG .'`;'); // Deleting SFW logs
539
+ // Deleting cron entries
540
+ delete_option('cleantalk_cron');
541
+ }
542
+
543
  }
544
 
545
  /**
602
  die();
603
  }
604
 
 
 
 
 
 
 
 
 
605
  function ct_sfw_update(){
606
 
607
  global $apbct;
610
 
611
  include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW_Base.php");
612
  include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php");
613
+
614
  $sfw = new CleantalkSFW();
615
  $result = $sfw->sfw_update($apbct->api_key);
616
  unset($sfw);
961
  if($settings) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_settings'] = $apbct->settings;
962
 
963
  update_option(APBCT_DEBUG, $debug);
964
+ }
965
+
966
+ function apbct_sfw__delete_tables( $blog_id, $drop ) {
967
+
968
+ global $wpdb;
969
+
970
+ $initial_blog = get_current_blog_id();
971
+
972
+ switch_to_blog($blog_id);
973
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
974
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
975
+
976
+ switch_to_blog($initial_blog);
977
  }
inc/cleantalk-admin.php CHANGED
@@ -134,7 +134,7 @@ function apbct_admin__init(){
134
  global $apbct;
135
 
136
  // Update logic
137
- if($apbct->plugin_version != '1.0.0' && $apbct->plugin_version != APBCT_VERSION){
138
  if(is_main_site()){
139
  require_once('cleantalk-updater.php');
140
  $result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
@@ -144,6 +144,10 @@ function apbct_admin__init(){
144
  $apbct->data['plugin_version'] = APBCT_VERSION;
145
  $apbct->saveData();
146
  }
 
 
 
 
147
  }
148
  }
149
 
134
  global $apbct;
135
 
136
  // Update logic
137
+ if($apbct->plugin_version != APBCT_VERSION){
138
  if(is_main_site()){
139
  require_once('cleantalk-updater.php');
140
  $result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
144
  $apbct->data['plugin_version'] = APBCT_VERSION;
145
  $apbct->saveData();
146
  }
147
+ // Update version for side blogs
148
+ }else{
149
+ $apbct->data['plugin_version'] = APBCT_VERSION;
150
+ $apbct->saveData();
151
  }
152
  }
153
 
inc/cleantalk-comments.php CHANGED
@@ -543,7 +543,7 @@ function ct_ajax_insert_comments(){
543
  $to_insert = 100;
544
  $time = current_time('timestamp')-(730*86400);
545
 
546
- $result = $wpdb->get_results("SELECT network FROM `".$wpdb->base_prefix."cleantalk_sfw` LIMIT $to_insert;", ARRAY_A);
547
 
548
  if($result){
549
  $ip = array();
543
  $to_insert = 100;
544
  $time = current_time('timestamp')-(730*86400);
545
 
546
+ $result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
547
 
548
  if($result){
549
  $ip = array();
inc/cleantalk-common.php CHANGED
@@ -811,6 +811,4 @@ function apbct_api_key__is_correct($api_key = null)
811
  global $apbct;
812
  $api_key = $api_key !== null ? $api_key : $apbct->api_key;
813
  return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
814
- }
815
-
816
- ?>
811
  global $apbct;
812
  $api_key = $api_key !== null ? $api_key : $apbct->api_key;
813
  return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
814
+ }
 
 
inc/cleantalk-public.php CHANGED
@@ -1563,11 +1563,9 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
1563
  * Test for JetPack contact form
1564
  */
1565
  function ct_contact_form_is_spam($form) {
1566
- global $ct_checkjs_jpcf, $apbct;
1567
-
1568
-
1569
 
1570
-
 
1571
  if ($apbct->settings['contact_forms_test'] == 0) {
1572
  return null;
1573
  }
@@ -1696,7 +1694,9 @@ function apbct_form__contactForm7__testSpam($param) {
1696
  $apbct->settings['contact_forms_test'] == 0 ||
1697
  $param == false && WPCF7_VERSION < '3.0.0' ||
1698
  $param === true && WPCF7_VERSION >= '3.0.0' ||
1699
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
 
 
1700
  ){
1701
  return $param;
1702
  }
@@ -2676,7 +2676,7 @@ function ct_enqueue_scripts_public($hook){
2676
  wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.js', array('jquery'), APBCT_VERSION, false /*in header*/);
2677
 
2678
  // GDPR script
2679
- if(shortcode_exists( 'cleantalk_gdpr_form')){
2680
 
2681
  wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
2682
 
@@ -2846,7 +2846,7 @@ function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
2846
  *
2847
  * attrs = array()
2848
  */
2849
- function apbct_shrotcode_hadler__GDPR_public_notice__form( $attrs ){
2850
 
2851
  $out = '';
2852
 
@@ -2859,4 +2859,3 @@ function apbct_shrotcode_hadler__GDPR_public_notice__form( $attrs ){
2859
  $out = '<script>'.$out.'</script>';
2860
  return $out;
2861
  }
2862
- ?>
1563
  * Test for JetPack contact form
1564
  */
1565
  function ct_contact_form_is_spam($form) {
 
 
 
1566
 
1567
+ global $ct_checkjs_jpcf, $apbct;
1568
+
1569
  if ($apbct->settings['contact_forms_test'] == 0) {
1570
  return null;
1571
  }
1694
  $apbct->settings['contact_forms_test'] == 0 ||
1695
  $param == false && WPCF7_VERSION < '3.0.0' ||
1696
  $param === true && WPCF7_VERSION >= '3.0.0' ||
1697
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
1698
+ check_url_exclusions() ||
1699
+ check_ip_exclusions()
1700
  ){
1701
  return $param;
1702
  }
2676
  wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.js', array('jquery'), APBCT_VERSION, false /*in header*/);
2677
 
2678
  // GDPR script
2679
+ if(shortcode_exists('cleantalk_gdpr_form')){
2680
 
2681
  wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
2682
 
2846
  *
2847
  * attrs = array()
2848
  */
2849
+ function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
2850
 
2851
  $out = '';
2852
 
2859
  $out = '<script>'.$out.'</script>';
2860
  return $out;
2861
  }
 
inc/cleantalk-settings.php CHANGED
@@ -101,12 +101,6 @@ function apbct_settings__add_page() {
101
  'html_before' => '<hr>',
102
  'html_after' => '',
103
  'fields' => array(
104
- 'show_link' => array(
105
- 'type' => 'checkbox',
106
- 'title' => __('Tell others about CleanTalk', 'cleantalk'),
107
- 'description' => __("Checking this box places a small link under the comment form that lets others know what anti-spam tool protects your site.", 'cleantalk'),
108
- 'display' => !$apbct->white_label,
109
- ),
110
  'spam_firewall' => array(
111
  'type' => 'checkbox',
112
  'title' => __('SpamFireWall', 'cleantalk'),
@@ -346,7 +340,7 @@ function apbct_settings_page() {
346
  echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
347
  apbct_admin__badge__get_premium();
348
  echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
349
- apbct_gdpr__show_text();
350
  echo '</div>';
351
  echo '</div>';
352
  }
@@ -619,7 +613,7 @@ function apbct_settings__field__api_key(){
619
  if((apbct_api_key__is_correct($apbct->api_key) || $apbct->key_is_ok) && isset($apbct->data['account_name_ob']) && $apbct->data['account_name_ob'] != ''){
620
  echo '<br>'
621
  .sprintf(
622
- __('Account at cleantalk.org is %s', 'cleantalk'),
623
  '<b>'.$apbct->data['account_name_ob'].'</b>'
624
  );
625
  }
@@ -815,7 +809,7 @@ function apbct_settings__validate($settings) {
815
  // Auto getting key
816
  if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
817
 
818
- $website = parse_url(get_option('siteurl'),PHP_URL_HOST);
819
  $platform = 'wordpress';
820
  $timezone = isset($_POST['ct_admin_timezone']) ? $_POST['ct_admin_timezone'] : null;
821
  $language = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
@@ -907,27 +901,23 @@ function apbct_settings__validate($settings) {
907
  return $settings;
908
  }
909
 
910
- function apbct_gdpr__show_text(){
911
- ?>
912
- <p>The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided.</p>
913
-
914
- <p>Automated individual decision-making, including profiling (Article 22) is contestable, similarly to the Data Protection Directive (Article 15). Citizens have rights to question and fight significant decisions that affect them that have been made on a solely-algorithmic basis. Many media outlets have commented on the introduction of a "right to explanation" of algorithmic decisions, but legal scholars have since argued that the existence of such a right is highly unclear without judicial tests and is limited at best.</p>
915
-
916
- <p>To be able to demonstrate compliance with the GDPR, the data controller should implement measures, which meet the principles of data protection by design and data protection by default. Privacy by design and by default (Article 25) require data protection measures to be designed into the development of business processes for products and services. Such measures include pseudonymising personal data, by the controller, as soon as possible (Recital 78).</p>
917
-
918
- <p>It is the responsibility and the liability of the data controller to implement effective measures and be able to demonstrate the compliance of processing activities even if the processing is carried out by a data processor on behalf of the controller (Recital 74).</p>
919
-
920
- <p>Data Protection Impact Assessments (Article 35) have to be conducted when specific risks occur to the rights and freedoms of data subjects. Risk assessment and mitigation is required and prior approval of the national data protection authorities (DPAs) is required for high risks. Data protection officers (Articles 37–39) are required to ensure compliance within organisations.</p>
921
-
922
- <p>They have to be appointed:</p>
923
- <ul style="padding: 0px 25px; list-style: disc;">
924
- <li>for all public authorities, except for courts acting in their judicial capacity</li>
925
- <li>if the core activities of the controller or the processor are:</li>
926
- <ul style="padding: 0px 25px; list-style: disc;">
927
- <li>processing operations, which, by virtue of their nature, their scope and/or their purposes, require regular and systematic monitoring of data subjects on a large scale</li>
928
- <li>processing on a large scale of special categories of data pursuant to Article 9 and personal data relating to criminal convictions and offences referred to in Article 10';</li>
929
- </ul>
930
- </li>
931
- </ul>
932
- <?php
933
  }
101
  'html_before' => '<hr>',
102
  'html_after' => '',
103
  'fields' => array(
 
 
 
 
 
 
104
  'spam_firewall' => array(
105
  'type' => 'checkbox',
106
  'title' => __('SpamFireWall', 'cleantalk'),
340
  echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
341
  apbct_admin__badge__get_premium();
342
  echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
343
+ apbct_gdpr__show_text('print');
344
  echo '</div>';
345
  echo '</div>';
346
  }
613
  if((apbct_api_key__is_correct($apbct->api_key) || $apbct->key_is_ok) && isset($apbct->data['account_name_ob']) && $apbct->data['account_name_ob'] != ''){
614
  echo '<br>'
615
  .sprintf(
616
+ __('Account at cleantalk.org is %s.', 'cleantalk'),
617
  '<b>'.$apbct->data['account_name_ob'].'</b>'
618
  );
619
  }
809
  // Auto getting key
810
  if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
811
 
812
+ $website = parse_url(get_option('siteurl'), PHP_URL_HOST).parse_url(get_option('siteurl'), PHP_URL_PATH);
813
  $platform = 'wordpress';
814
  $timezone = isset($_POST['ct_admin_timezone']) ? $_POST['ct_admin_timezone'] : null;
815
  $language = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : null;
901
  return $settings;
902
  }
903
 
904
+ function apbct_gdpr__show_text($print = false){
905
+
906
+ $out = wpautop('The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided.
907
+ Automated individual decision-making, including profiling (Article 22) is contestable, similarly to the Data Protection Directive (Article 15). Citizens have rights to question and fight significant decisions that affect them that have been made on a solely-algorithmic basis. Many media outlets have commented on the introduction of a "right to explanation" of algorithmic decisions, but legal scholars have since argued that the existence of such a right is highly unclear without judicial tests and is limited at best.
908
+ To be able to demonstrate compliance with the GDPR, the data controller should implement measures, which meet the principles of data protection by design and data protection by default. Privacy by design and by default (Article 25) require data protection measures to be designed into the development of business processes for products and services. Such measures include pseudonymising personal data, by the controller, as soon as possible (Recital 78).
909
+ It is the responsibility and the liability of the data controller to implement effective measures and be able to demonstrate the compliance of processing activities even if the processing is carried out by a data processor on behalf of the controller (Recital 74).
910
+ Data Protection Impact Assessments (Article 35) have to be conducted when specific risks occur to the rights and freedoms of data subjects. Risk assessment and mitigation is required and prior approval of the national data protection authorities (DPAs) is required for high risks. Data protection officers (Articles 37–39) are required to ensure compliance within organisations.
911
+ They have to be appointed:')
912
+ .'<ul style="padding: 0px 25px; list-style: disc;">'
913
+ .'<li>for all public authorities, except for courts acting in their judicial capacity</li>'
914
+ .'<li>if the core activities of the controller or the processor are:</li>'
915
+ .'<ul style="padding: 0px 25px; list-style: disc;">'
916
+ .'<li>processing operations, which, by virtue of their nature, their scope and/or their purposes, require regular and systematic monitoring of data subjects on a large scale</li>'
917
+ .'<li>processing on a large scale of special categories of data pursuant to Article 9 and personal data relating to criminal convictions and offences referred to in Article 10;</li>'
918
+ .'</ul>'
919
+ .'</li>'
920
+ .'</ul>';
921
+
922
+ if($print) echo $out; else return $out;
 
 
 
 
923
  }
inc/cleantalk-updater.php CHANGED
@@ -46,19 +46,19 @@ function apbct_version_standartization($version){
46
 
47
  function apbct_update_to_5_50_0(){
48
  global $wpdb;
49
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw` (
50
  `network` int(11) unsigned NOT NULL,
51
  `mask` int(11) unsigned NOT NULL,
52
  INDEX ( `network` , `mask` )
53
- ) ENGINE = MYISAM ;");
54
 
55
- $wpdb->query("CREATE TABLE IF NOT EXISTS `".$wpdb->base_prefix."cleantalk_sfw_logs` (
56
  `ip` VARCHAR(15) NOT NULL ,
57
  `all` INT NOT NULL ,
58
  `blocked` INT NOT NULL ,
59
  `timestamp` INT NOT NULL ,
60
  PRIMARY KEY (`ip`))
61
- ENGINE = MYISAM;");
62
  }
63
 
64
  function apbct_update_to_5_56_0(){
@@ -69,11 +69,11 @@ function apbct_update_to_5_70_0(){
69
 
70
  global $wpdb;
71
 
72
- if(!in_array('all_entries', $wpdb->get_col("DESC " . $wpdb->base_prefix."cleantalk_sfw_logs", 0))){
73
- $wpdb->query("ALTER TABLE `".$wpdb->base_prefix."cleantalk_sfw_logs`
74
  CHANGE `all` `all_entries` INT(11) NOT NULL,
75
  CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
76
- CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;"
77
  );
78
  }
79
 
@@ -109,3 +109,42 @@ function apbct_update_to_5_97_0(){
109
 
110
  $apbct->saveData();
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  function apbct_update_to_5_50_0(){
48
  global $wpdb;
49
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
50
  `network` int(11) unsigned NOT NULL,
51
  `mask` int(11) unsigned NOT NULL,
52
  INDEX ( `network` , `mask` )
53
+ ) ENGINE = MYISAM ;');
54
 
55
+ $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_LOG .'` (
56
  `ip` VARCHAR(15) NOT NULL ,
57
  `all` INT NOT NULL ,
58
  `blocked` INT NOT NULL ,
59
  `timestamp` INT NOT NULL ,
60
  PRIMARY KEY (`ip`))
61
+ ENGINE = MYISAM;');
62
  }
63
 
64
  function apbct_update_to_5_56_0(){
69
 
70
  global $wpdb;
71
 
72
+ if(!in_array('all_entries', $wpdb->get_col('DESC '. APBCT_TBL_FIREWALL_LOG, 0))){
73
+ $wpdb->query('ALTER TABLE `'. APBCT_TBL_FIREWALL_LOG .'`
74
  CHANGE `all` `all_entries` INT(11) NOT NULL,
75
  CHANGE `blocked` `blocked_entries` INT(11) NOT NULL,
76
+ CHANGE `timestamp` `entries_timestamp` INT(11) NOT NULL;'
77
  );
78
  }
79
 
109
 
110
  $apbct->saveData();
111
  }
112
+
113
+ function apbct_update_to_5_109_0(){
114
+
115
+ global $apbct, $wpdb;
116
+
117
+ if(is_plugin_active_for_network($apbct->base_name) && !defined('CLEANTALK_ACCESS_KEY')){
118
+
119
+ $sfw_data_query = 'CREATE TABLE IF NOT EXISTS `%s` (
120
+ `network` int(11) unsigned NOT NULL,
121
+ `mask` int(11) unsigned NOT NULL,
122
+ INDEX ( `network` , `mask` )
123
+ ) ENGINE = MYISAM ;';
124
+
125
+ $sfw_log_query = 'CREATE TABLE IF NOT EXISTS `%s` (
126
+ `ip` VARCHAR(15) NOT NULL,
127
+ `all_entries` INT NOT NULL,
128
+ `blocked_entries` INT NOT NULL,
129
+ `entries_timestamp` INT NOT NULL,
130
+ PRIMARY KEY (`ip`))
131
+ ENGINE = MYISAM;';
132
+
133
+ $initial_blog = get_current_blog_id();
134
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
135
+ foreach ($blogs as $blog) {
136
+ switch_to_blog($blog);
137
+ $wpdb->query(sprintf($sfw_data_query, $wpdb->prefix . 'cleantalk_sfw')); // Table for SpamFireWall data
138
+ $wpdb->query(sprintf($sfw_log_query, $wpdb->prefix . 'cleantalk_sfw_logs')); // Table for SpamFireWall logs
139
+ // Cron tasks
140
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
141
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
142
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
143
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
144
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
145
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
146
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
147
+ }
148
+ switch_to_blog($initial_blog);
149
+ }
150
+ }
inc/cleantalk-users.php CHANGED
@@ -563,7 +563,7 @@ function ct_ajax_insert_users()
563
  //* INSERTION
564
  global $wpdb;
565
  $to_insert = 100;
566
- $result = $wpdb->get_results("SELECT network FROM `".$wpdb->base_prefix."cleantalk_sfw` LIMIT $to_insert;", ARRAY_A);
567
 
568
  if($result){
569
  $ip = array();
563
  //* INSERTION
564
  global $wpdb;
565
  $to_insert = 100;
566
+ $result = $wpdb->get_results('SELECT network FROM `'. APBCT_TBL_FIREWALL_DATA .'` LIMIT '. $to_insert .';', ARRAY_A);
567
 
568
  if($result){
569
  $ip = array();
inc/cleantalk-widget.php CHANGED
@@ -1,5 +1,15 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
3
  class cleantalk_widget extends WP_Widget
4
  {
5
  function __construct()
@@ -106,12 +116,4 @@ class cleantalk_widget extends WP_Widget
106
  $instance['refid'] = ( ! empty( $new_instance['refid'] ) ) ? strip_tags( $new_instance['refid'] ) : '';
107
  return $instance;
108
  }
109
- } // Class cleantalk_widget ends here
110
-
111
- // Register and load the widget
112
- function cleantalk_load_widget()
113
- {
114
- register_widget( 'cleantalk_widget' );
115
- }
116
- add_action( 'widgets_init', 'cleantalk_load_widget' );
117
- ?>
1
  <?php
2
 
3
+ // Hooks on widget loads
4
+ add_action( 'widgets_init', 'cleantalk_load_widget' );
5
+
6
+ /**
7
+ * Register and load the widget
8
+ */
9
+ function cleantalk_load_widget(){
10
+ register_widget( 'cleantalk_widget' );
11
+ }
12
+
13
  class cleantalk_widget extends WP_Widget
14
  {
15
  function __construct()
116
  $instance['refid'] = ( ! empty( $new_instance['refid'] ) ) ? strip_tags( $new_instance['refid'] ) : '';
117
  return $instance;
118
  }
119
+ }
 
 
 
 
 
 
 
 
js/apbct-public.js CHANGED
@@ -49,8 +49,8 @@ var ctFunctionMouseMove = function output(event){
49
  if(ctMouseEventTimerFlag === true){
50
 
51
  ctMouseData.push([
52
- Math.round(event.pageY),
53
- Math.round(event.pageX),
54
  Math.round(new Date().getTime() - ctTimeMs)
55
  ]);
56
 
@@ -155,7 +155,7 @@ apbct_attach_event_handler(window, "DOMContentLoaded", apbct_ready);
155
 
156
  // Capturing responses and output block message for unknown AJAX forms
157
  jQuery(document).ajaxComplete(function(event, xhr, settings) {
158
- if(xhr.responseText.indexOf('"apbct') !== -1){
159
  var response = JSON.parse(xhr.responseText);
160
  if(typeof response.apbct !== 'undefined'){
161
  var response = response.apbct;
49
  if(ctMouseEventTimerFlag === true){
50
 
51
  ctMouseData.push([
52
+ Math.round(event.clientY),
53
+ Math.round(event.clientX),
54
  Math.round(new Date().getTime() - ctTimeMs)
55
  ]);
56
 
155
 
156
  // Capturing responses and output block message for unknown AJAX forms
157
  jQuery(document).ajaxComplete(function(event, xhr, settings) {
158
+ if(xhr.responseText && xhr.responseText.indexOf('"apbct') !== -1){
159
  var response = JSON.parse(xhr.responseText);
160
  if(typeof response.apbct !== 'undefined'){
161
  var response = response.apbct;
lib/CleantalkDB_Wordpress.php CHANGED
@@ -13,7 +13,7 @@
13
  class CleantalkDB_Wordpress
14
  {
15
 
16
- public $table_prefix;
17
  public $result = array();
18
 
19
  private $db;
@@ -22,9 +22,9 @@ class CleantalkDB_Wordpress
22
 
23
  public function __construct()
24
  {
25
- global $wpdb;
26
  $this->db = $wpdb;
27
- $this->table_prefix = $wpdb->base_prefix;
28
  }
29
 
30
  public function query($query, $straight_query = false)
13
  class CleantalkDB_Wordpress
14
  {
15
 
16
+ public $prefix;
17
  public $result = array();
18
 
19
  private $db;
22
 
23
  public function __construct()
24
  {
25
+ global $wpdb, $apbct;
26
  $this->db = $wpdb;
27
+ $this->prefix = $apbct->db_prefix;
28
  }
29
 
30
  public function query($query, $straight_query = false)
lib/CleantalkSFW.php CHANGED
@@ -19,8 +19,8 @@ class CleantalkSFW extends CleantalkSFW_Base
19
  $this->db = new CleantalkDB_Wordpress();
20
 
21
  // Use default tables if not specified
22
- $this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->table_prefix . 'cleantalk_sfw';
23
- $this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->table_prefix . 'cleantalk_sfw_logs';
24
  }
25
 
26
  /*
19
  $this->db = new CleantalkDB_Wordpress();
20
 
21
  // Use default tables if not specified
22
+ $this->data_table = defined('APBCT_TBL_FIREWALL_DATA') ? APBCT_TBL_FIREWALL_DATA : $this->db->prefix . 'cleantalk_sfw';
23
+ $this->log_table = defined('APBCT_TBL_FIREWALL_LOG') ? APBCT_TBL_FIREWALL_LOG : $this->db->prefix . 'cleantalk_sfw_logs';
24
  }
25
 
26
  /*
lib/CleantalkState.php CHANGED
@@ -62,7 +62,6 @@ class CleantalkState
62
  'user_token' => '', //user token for auto login into spam statistics
63
  'collect_details' => 0, // Collect details about browser of the visitor.
64
  'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
65
- 'show_link' => 0,
66
  'async_js' => 0,
67
  'debug_ajax' => 0,
68
 
@@ -78,8 +77,7 @@ class CleantalkState
78
  public $def_data = array(
79
 
80
  // Plugin data
81
- 'start_version' => APBCT_VERSION,
82
- 'plugin_version' => '1.0.0',
83
  'user_token' => '', // User token
84
  'js_keys' => array(), // Keys to do JavaScript antispam test
85
  'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
62
  'user_token' => '', //user token for auto login into spam statistics
63
  'collect_details' => 0, // Collect details about browser of the visitor.
64
  'send_connection_reports' => 0, //Send connection reports to Cleantalk servers
 
65
  'async_js' => 0,
66
  'debug_ajax' => 0,
67
 
77
  public $def_data = array(
78
 
79
  // Plugin data
80
+ 'plugin_version' => APBCT_VERSION,
 
81
  'user_token' => '', // User token
82
  'js_keys' => array(), // Keys to do JavaScript antispam test
83
  'js_keys_store_days' => 14, // JavaScript keys store days - 8 days now
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
- Stable tag: 5.108.1
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
@@ -12,21 +12,24 @@ Spam protection, antispam, all-in-one, premium plugin. No spam comments & users,
12
 
13
  **Supports: Contact Form 7, Ninja Forms, Gravity Forms, MailChimp, Formidable forms, WooCommerce, JetPack comments and contact form, BuddyPress, bbPress, Fast Secure Contact form, S2Member, MailPoet, any WordPress registrations & contact forms and themes. Just setup and forget the spam!**
14
 
15
- No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal AntiSpam plugin.
16
 
17
  = AntiSpam features =
18
  1. Stops spam comments.
19
- 1. Stops spam registrations.
20
- 1. Stops spam contact emails.
21
- 1. Stops spam orders.
22
- 1. Stops spam bookings.
23
- 1. Stops spam subscriptions.
24
- 1. Stops spam surveys, polls.
25
- 1. Stops spam in widgets.
26
- 1. Stops spam in WooCommerce.
27
- 1. Checks and removes the existing spam comments and spam users.
28
- 1. Compatible with mobile users and devices.
29
- 1. Compatible with General Data Protection Regulation (GDPR) (EU).
 
 
 
30
 
31
  = Public reviews =
32
  > CleanTalk - Cloud-Based Anti-Spam Service to Keep Your Site Bot-Free.
@@ -208,9 +211,11 @@ CleanTalk has an advanced option "Spam FireWall". This option allows you to bloc
208
 
209
  To switch the plugin work in the white-label mode you must insert this code to your wp-config.php:
210
 
211
- define('APBCT_WHITELABLE', true);
 
212
  define('APBCT_HOSTER_API_KEY', 'YOUR_HOSTER_API_KEY');
213
-
 
214
  Where YOUR_HOSTER_API_KEY is a key from CleanTalk's hoster panel.
215
 
216
  The plugin will do everything rest.
@@ -223,6 +228,17 @@ Note: there is 24 hours delay before auto-update will do. This delay allows need
223
 
224
  Auto-updating system will work from CleanTalk AntiSpam version 5.88
225
 
 
 
 
 
 
 
 
 
 
 
 
226
  = Translations =
227
  * Albanian (sq_AL) - thanks to fjalaime https://wordpress.org/support/users/fjalaime/
228
  * French (fr_FR) - thanks to Gilles Santacreu http://net-ik.net
@@ -254,10 +270,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
254
  **Important!** To test spam protection you must post a dummy submissions as website visitor (use must logged out from WordPress console), because the plugin doesn't filter submissions from WordPress administrators.
255
 
256
  = How can setup plugin in WPMU version? =
257
- In WordPress multisite version you can switch the plugin to use Global Access key. In this way the plugin doesn't show any options to enter Access key in plugin settings and doesn't show Trial banner in WordPress backend. To setup global CleanTalk access key for all websites in WPMU, define constant in your wp-config.php file before defining database constants:
258
 
259
  define('CLEANTALK_ACCESS_KEY', 'place your key here');
260
 
 
261
  Now, all subsites will have this access key.
262
 
263
  = Manage and control spam protection =
@@ -445,7 +462,7 @@ Yes, it does. But you have to turn off the option 'Use AJAX for JavaScript check
445
  To close the notice please save the plugin settings again or it will be closed automatically within 60 minutes after the renewal.
446
 
447
  = I'm using PHP 4.2 version and i'm getting errors related with JSON. Why does it happens? =
448
- leanTalk is no longer supports PHP lower than 5.2 version because the support code have incompatibility with PHP 7 version. Please, upgrade your PHP. If you couldn't perform that, let us know about it via support ticket here: https://cleantalk.org/my/support.
449
 
450
  = Should I change anything in the plugin's settings or in my CleanTalk Control Panel when I switch my website from HTTP to HTTPS or vice versa? =
451
  No. You don't need to change anything in the plugin's settings or in your CleanTalk Control Panel. The plugin will work regardless of the protocol.
@@ -530,6 +547,14 @@ Yes, it is. Please read this article,
530
  10. Website's options.
531
 
532
  == Changelog ==
 
 
 
 
 
 
 
 
533
  = 5.108.1 November 8 2018 =
534
  * Fix: Errors with integration class.
535
 
@@ -1705,6 +1730,14 @@ Yes, it is. Please read this article,
1705
  * First version
1706
 
1707
  == Upgrade Notice ==
 
 
 
 
 
 
 
 
1708
  = 5.108.1 November 8 2018 =
1709
  * Fix: Errors with integration class.
1710
 
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
+ Stable tag: 5.109
7
  License: GPLv2
8
 
9
  Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
12
 
13
  **Supports: Contact Form 7, Ninja Forms, Gravity Forms, MailChimp, Formidable forms, WooCommerce, JetPack comments and contact form, BuddyPress, bbPress, Fast Secure Contact form, S2Member, MailPoet, any WordPress registrations & contact forms and themes. Just setup and forget the spam!**
14
 
15
+ No CAPTCHA, no questions, no animal counting, no puzzles, no math and no spam bots. Universal AntiSpam plugin.
16
 
17
  = AntiSpam features =
18
  1. Stops spam comments.
19
+ 2. Stops spam registrations.
20
+ 3. Stops spam contact emails.
21
+ 4. Stops spam orders.
22
+ 5. Stops spam bookings.
23
+ 6. Stops spam subscriptions.
24
+ 7. Stops spam surveys, polls.
25
+ 8. Stops spam in widgets.
26
+ 9. Stops spam in WooCommerce.
27
+ 10. Checks and removes the existing spam comments and spam users.
28
+ 11. Compatible with mobile users and devices.
29
+ 12. Compatible with General Data Protection Regulation (GDPR) (EU).
30
+ 13. Real-time email validation. Is email real or Not.
31
+ 14. No Spam - No Google Penalties. Give your SEO boost.
32
+
33
 
34
  = Public reviews =
35
  > CleanTalk - Cloud-Based Anti-Spam Service to Keep Your Site Bot-Free.
211
 
212
  To switch the plugin work in the white-label mode you must insert this code to your wp-config.php:
213
 
214
+ define('APBCT_WHITELABEL', true);
215
+ define('APBCT_WHITELABEL_NAME', 'YOUR_PLUGIN_NAME');
216
  define('APBCT_HOSTER_API_KEY', 'YOUR_HOSTER_API_KEY');
217
+
218
+ Where APBCT_WHITELABEL_NAME is any name you want for the plugin.
219
  Where YOUR_HOSTER_API_KEY is a key from CleanTalk's hoster panel.
220
 
221
  The plugin will do everything rest.
228
 
229
  Auto-updating system will work from CleanTalk AntiSpam version 5.88
230
 
231
+ = Real-time email validation. Is email real or Not. =
232
+ It is very important to be sure that the user used his real email address. Spambots very often use fake email addresses, i.e. which addresses do not exist.
233
+
234
+ CleanTalk will check email addresses for existence in real time.
235
+
236
+ Non-existing email addresses also entail several other problems for website owners.
237
+
238
+ * You can never contact them by email,
239
+ * the client will never receive any notifications from you (account activation letter, password recovery, email distribution, notifications, etc.),
240
+ * if you use email marketing for your clients, then a large number of nonexistent emails in the mailing list may result in your IP address being added to various blacklists of email servers.
241
+
242
  = Translations =
243
  * Albanian (sq_AL) - thanks to fjalaime https://wordpress.org/support/users/fjalaime/
244
  * French (fr_FR) - thanks to Gilles Santacreu http://net-ik.net
270
  **Important!** To test spam protection you must post a dummy submissions as website visitor (use must logged out from WordPress console), because the plugin doesn't filter submissions from WordPress administrators.
271
 
272
  = How can setup plugin in WPMU version? =
273
+ In WordPress multisite version you can switch the plugin to use Global Access key. In this way the plugin doesn't show any options to enter Access key in plugin settings and doesn't show Trial banner in WordPress backend. To setup global CleanTalk access key for all websites in WPMS, define constant in your wp-config.php file before defining database constants:
274
 
275
  define('CLEANTALK_ACCESS_KEY', 'place your key here');
276
 
277
+ **Make it before you activated the plugin. If the plugin already activated, deactivate it and add the code and active it again.**
278
  Now, all subsites will have this access key.
279
 
280
  = Manage and control spam protection =
462
  To close the notice please save the plugin settings again or it will be closed automatically within 60 minutes after the renewal.
463
 
464
  = I'm using PHP 4.2 version and i'm getting errors related with JSON. Why does it happens? =
465
+ СleanTalk is no longer supports PHP lower than 5.2 version because the support code have incompatibility with PHP 7 version. Please, upgrade your PHP. If you couldn't perform that, let us know about it via support ticket here: https://cleantalk.org/my/support.
466
 
467
  = Should I change anything in the plugin's settings or in my CleanTalk Control Panel when I switch my website from HTTP to HTTPS or vice versa? =
468
  No. You don't need to change anything in the plugin's settings or in your CleanTalk Control Panel. The plugin will work regardless of the protocol.
547
  10. Website's options.
548
 
549
  == Changelog ==
550
+ = 5.109 November 15 2018 =
551
+ Fix: Added URL and IP exclusions to Contact Form 7.
552
+ Fix: js error when responseText is not exists
553
+ Fix: Sitename when getting key automatically under WPMS.
554
+ Mod: SpamFireWall is now fully compatible with WPMS.
555
+ Mod: Setting 'Tell others about CleanTalk' was deleted.
556
+ Mod: Protection from spam improved.
557
+
558
  = 5.108.1 November 8 2018 =
559
  * Fix: Errors with integration class.
560
 
1730
  * First version
1731
 
1732
  == Upgrade Notice ==
1733
+ = 5.109 November 15 2018 =
1734
+ Fix: Added URL and IP exclusions to Contact Form 7.
1735
+ Fix: js error when responseText is not exists
1736
+ Fix: Sitename when getting key automatically under WPMS.
1737
+ Mod: SpamFireWall is now fully compatible with WPMS.
1738
+ Mod: Setting 'Tell others about CleanTalk' was deleted.
1739
+ Mod: Protection from spam improved.
1740
+
1741
  = 5.108.1 November 8 2018 =
1742
  * Fix: Errors with integration class.
1743