Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.49

Version Description

2014-06-10 = * Added spam protection for S2Member Auth.net forms. * Added spam protection for multisite signup form. * Optimized account status check function.

Download this release

Release Info

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

Code changes from version 2.50-profiling to 2.49

Files changed (3) hide show
  1. cleantalk-admin.php +1 -27
  2. cleantalk.php +8 -99
  3. readme.txt +17 -16
cleantalk-admin.php CHANGED
@@ -7,7 +7,6 @@ $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
7
  * @param string $hook URL of hooked page
8
  */
9
  function ct_enqueue_scripts($hook) {
10
- ct_profiler(__FILE__, __LINE__);
11
  if ($hook == 'edit-comments.php')
12
  wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
13
  }
@@ -16,7 +15,6 @@ function ct_enqueue_scripts($hook) {
16
  * Admin action 'admin_menu' - Add the admin options page
17
  */
18
  function ct_admin_add_page() {
19
- ct_profiler(__FILE__, __LINE__);
20
  add_options_page(__('CleanTalk settings', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>', 'manage_options', 'cleantalk', 'ct_settings_page');
21
  }
22
 
@@ -24,9 +22,8 @@ function ct_admin_add_page() {
24
  * Admin action 'admin_init' - Add the admin settings and such
25
  */
26
  function ct_admin_init() {
27
- ct_profiler(__FILE__, __LINE__);
28
  global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout, $pagenow, $ct_plugin_name;
29
-
30
  $show_ct_notice_trial = false;
31
  if (isset($_COOKIE[$ct_notice_trial_label])) {
32
  if ($_COOKIE[$ct_notice_trial_label] == 1)
@@ -87,7 +84,6 @@ function ct_admin_init() {
87
  $show_ct_notice_online = 'N';
88
  }
89
  }
90
- ct_profiler(__FILE__, __LINE__);
91
 
92
  ct_init_session();
93
 
@@ -99,8 +95,6 @@ function ct_admin_init() {
99
  add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
100
  add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
101
  add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
102
-
103
- ct_profiler(__FILE__, __LINE__);
104
  }
105
 
106
  /**
@@ -124,7 +118,6 @@ function ct_section_settings_anti_spam() {
124
  * @return null
125
  */
126
  function ct_input_autoPubRevelantMess () {
127
- ct_profiler(__FILE__, __LINE__);
128
  $options = ct_get_options();
129
  $value = $options['autoPubRevelantMess'];
130
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
@@ -139,7 +132,6 @@ function ct_input_autoPubRevelantMess () {
139
  * @return null
140
  */
141
  function ct_input_remove_old_spam() {
142
- ct_profiler(__FILE__, __LINE__);
143
  $options = ct_get_options();
144
  $value = $options['remove_old_spam'];
145
  echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
@@ -152,7 +144,6 @@ function ct_input_remove_old_spam() {
152
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
153
  */
154
  function ct_input_apikey() {
155
- ct_profiler(__FILE__, __LINE__);
156
  $options = ct_get_options();
157
  $value = $options['apikey'];
158
 
@@ -167,7 +158,6 @@ function ct_input_apikey() {
167
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
168
  */
169
  function ct_input_comments_test() {
170
- ct_profiler(__FILE__, __LINE__);
171
  $options = ct_get_options();
172
  $value = $options['comments_test'];
173
  echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
@@ -180,7 +170,6 @@ function ct_input_comments_test() {
180
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
181
  */
182
  function ct_input_registrations_test() {
183
- ct_profiler(__FILE__, __LINE__);
184
  $options = ct_get_options();
185
  $value = $options['registrations_test'];
186
  echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
@@ -193,7 +182,6 @@ function ct_input_registrations_test() {
193
  * Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
194
  */
195
  function ct_input_contact_forms_test() {
196
- ct_profiler(__FILE__, __LINE__);
197
  $options = ct_get_options();
198
  $value = $options['contact_forms_test'];
199
  echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
@@ -206,7 +194,6 @@ function ct_input_contact_forms_test() {
206
  * Admin callback function - Plugin parameters validator
207
  */
208
  function ct_settings_validate($input) {
209
- ct_profiler(__FILE__, __LINE__);
210
  return $input;
211
  }
212
 
@@ -215,7 +202,6 @@ function ct_settings_validate($input) {
215
  * Admin callback function - Displays plugin options page
216
  */
217
  function ct_settings_page() {
218
- ct_profiler(__FILE__, __LINE__);
219
  ?>
220
  <style type="text/css">
221
  input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 none;
@@ -253,7 +239,6 @@ input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 no
253
  * @return bool
254
  */
255
  function admin_notice_message(){
256
- ct_profiler(__FILE__, __LINE__);
257
  global $show_ct_notice_trial, $show_ct_notice_online, $ct_plugin_name;
258
 
259
  if (ct_active() === false)
@@ -293,7 +278,6 @@ function admin_notice_message(){
293
  * Add descriptions for field
294
  */
295
  function admin_addDescriptionsFields($descr = '') {
296
- ct_profiler(__FILE__, __LINE__);
297
  echo "<div style='color: #666 !important'>$descr</div>";
298
  }
299
 
@@ -301,7 +285,6 @@ function admin_addDescriptionsFields($descr = '') {
301
  * Test API key
302
  */
303
  function ct_valid_key($apikey = null) {
304
- ct_profiler(__FILE__, __LINE__);
305
  if ($apikey === null) {
306
  $options = ct_get_options();
307
  $apikey = $options['apikey'];
@@ -316,7 +299,6 @@ function ct_valid_key($apikey = null) {
316
  * @return boolean TRUE
317
  */
318
  function ct_comment_approved($comment_object) {
319
- ct_profiler(__FILE__, __LINE__);
320
  $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
321
  $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
322
  $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
@@ -333,7 +315,6 @@ function ct_comment_approved($comment_object) {
333
  * @return boolean TRUE
334
  */
335
  function ct_comment_unapproved($comment_object) {
336
- ct_profiler(__FILE__, __LINE__);
337
  $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
338
  $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
339
  ct_feedback($hash, $comment['comment_content'], 0);
@@ -349,7 +330,6 @@ function ct_comment_unapproved($comment_object) {
349
  * @return boolean TRUE
350
  */
351
  function ct_comment_spam($comment_object) {
352
- ct_profiler(__FILE__, __LINE__);
353
  $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
354
  $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
355
  ct_feedback($hash, $comment['comment_content'], 0);
@@ -365,7 +345,6 @@ function ct_comment_spam($comment_object) {
365
  * @param type $comment_id
366
  */
367
  function ct_unspam_comment($comment_id) {
368
- ct_profiler(__FILE__, __LINE__);
369
  update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
370
  $comment = get_comment($comment_id, 'ARRAY_A');
371
  $hash = get_comment_meta($comment_id, 'ct_hash', true);
@@ -381,7 +360,6 @@ function ct_unspam_comment($comment_id) {
381
  * @return string New comment text
382
  */
383
  function ct_get_comment_text($current_text) {
384
- ct_profiler(__FILE__, __LINE__);
385
  global $comment;
386
  $new_text = $current_text;
387
  if (isset($comment) && is_object($comment)) {
@@ -398,7 +376,6 @@ function ct_get_comment_text($current_text) {
398
  * @return null
399
  */
400
  function ct_delete_user($user_id) {
401
- ct_profiler(__FILE__, __LINE__);
402
  $hash = get_user_meta($user_id, 'ct_hash', true);
403
  if ($hash !== '') {
404
  ct_feedback($hash, null, 0);
@@ -411,7 +388,6 @@ function ct_delete_user($user_id) {
411
  */
412
  if (!function_exists ( 'ct_register_plugin_links')) {
413
  function ct_register_plugin_links($links, $file) {
414
- ct_profiler(__FILE__, __LINE__);
415
  global $ct_plugin_basename;
416
 
417
  if ($file == $ct_plugin_basename) {
@@ -429,7 +405,6 @@ if (!function_exists ( 'ct_register_plugin_links')) {
429
  */
430
  if (!function_exists ( 'ct_plugin_action_links')) {
431
  function ct_plugin_action_links($links, $file) {
432
- ct_profiler(__FILE__, __LINE__);
433
  global $ct_plugin_basename;
434
 
435
  if ($file == $ct_plugin_basename) {
@@ -445,7 +420,6 @@ if (!function_exists ( 'ct_plugin_action_links')) {
445
  * @return array
446
  */
447
  function ct_update_option($option_name) {
448
- ct_profiler(__FILE__, __LINE__);
449
  global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_check_timeout;
450
  if($option_name !== 'cleantalk_settings')
451
  return;
7
  * @param string $hook URL of hooked page
8
  */
9
  function ct_enqueue_scripts($hook) {
 
10
  if ($hook == 'edit-comments.php')
11
  wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
12
  }
15
  * Admin action 'admin_menu' - Add the admin options page
16
  */
17
  function ct_admin_add_page() {
 
18
  add_options_page(__('CleanTalk settings', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>', 'manage_options', 'cleantalk', 'ct_settings_page');
19
  }
20
 
22
  * Admin action 'admin_init' - Add the admin settings and such
23
  */
24
  function ct_admin_init() {
 
25
  global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout, $pagenow, $ct_plugin_name;
26
+
27
  $show_ct_notice_trial = false;
28
  if (isset($_COOKIE[$ct_notice_trial_label])) {
29
  if ($_COOKIE[$ct_notice_trial_label] == 1)
84
  $show_ct_notice_online = 'N';
85
  }
86
  }
 
87
 
88
  ct_init_session();
89
 
95
  add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
96
  add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
97
  add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
 
 
98
  }
99
 
100
  /**
118
  * @return null
119
  */
120
  function ct_input_autoPubRevelantMess () {
 
121
  $options = ct_get_options();
122
  $value = $options['autoPubRevelantMess'];
123
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
132
  * @return null
133
  */
134
  function ct_input_remove_old_spam() {
 
135
  $options = ct_get_options();
136
  $value = $options['remove_old_spam'];
137
  echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
144
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
145
  */
146
  function ct_input_apikey() {
 
147
  $options = ct_get_options();
148
  $value = $options['apikey'];
149
 
158
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
159
  */
160
  function ct_input_comments_test() {
 
161
  $options = ct_get_options();
162
  $value = $options['comments_test'];
163
  echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
170
  * Admin callback function - Displays inputs of 'comments_test' plugin parameter
171
  */
172
  function ct_input_registrations_test() {
 
173
  $options = ct_get_options();
174
  $value = $options['registrations_test'];
175
  echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
182
  * Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
183
  */
184
  function ct_input_contact_forms_test() {
 
185
  $options = ct_get_options();
186
  $value = $options['contact_forms_test'];
187
  echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
194
  * Admin callback function - Plugin parameters validator
195
  */
196
  function ct_settings_validate($input) {
 
197
  return $input;
198
  }
199
 
202
  * Admin callback function - Displays plugin options page
203
  */
204
  function ct_settings_page() {
 
205
  ?>
206
  <style type="text/css">
207
  input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 none;
239
  * @return bool
240
  */
241
  function admin_notice_message(){
 
242
  global $show_ct_notice_trial, $show_ct_notice_online, $ct_plugin_name;
243
 
244
  if (ct_active() === false)
278
  * Add descriptions for field
279
  */
280
  function admin_addDescriptionsFields($descr = '') {
 
281
  echo "<div style='color: #666 !important'>$descr</div>";
282
  }
283
 
285
  * Test API key
286
  */
287
  function ct_valid_key($apikey = null) {
 
288
  if ($apikey === null) {
289
  $options = ct_get_options();
290
  $apikey = $options['apikey'];
299
  * @return boolean TRUE
300
  */
301
  function ct_comment_approved($comment_object) {
 
302
  $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
303
  $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
304
  $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
315
  * @return boolean TRUE
316
  */
317
  function ct_comment_unapproved($comment_object) {
 
318
  $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
319
  $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
320
  ct_feedback($hash, $comment['comment_content'], 0);
330
  * @return boolean TRUE
331
  */
332
  function ct_comment_spam($comment_object) {
 
333
  $comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
334
  $hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
335
  ct_feedback($hash, $comment['comment_content'], 0);
345
  * @param type $comment_id
346
  */
347
  function ct_unspam_comment($comment_id) {
 
348
  update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
349
  $comment = get_comment($comment_id, 'ARRAY_A');
350
  $hash = get_comment_meta($comment_id, 'ct_hash', true);
360
  * @return string New comment text
361
  */
362
  function ct_get_comment_text($current_text) {
 
363
  global $comment;
364
  $new_text = $current_text;
365
  if (isset($comment) && is_object($comment)) {
376
  * @return null
377
  */
378
  function ct_delete_user($user_id) {
 
379
  $hash = get_user_meta($user_id, 'ct_hash', true);
380
  if ($hash !== '') {
381
  ct_feedback($hash, null, 0);
388
  */
389
  if (!function_exists ( 'ct_register_plugin_links')) {
390
  function ct_register_plugin_links($links, $file) {
 
391
  global $ct_plugin_basename;
392
 
393
  if ($file == $ct_plugin_basename) {
405
  */
406
  if (!function_exists ( 'ct_plugin_action_links')) {
407
  function ct_plugin_action_links($links, $file) {
 
408
  global $ct_plugin_basename;
409
 
410
  if ($file == $ct_plugin_basename) {
420
  * @return array
421
  */
422
  function ct_update_option($option_name) {
 
423
  global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_check_timeout;
424
  if($option_name !== 'cleantalk_settings')
425
  return;
cleantalk.php CHANGED
@@ -3,14 +3,14 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
- Version: 2.50
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
12
 
13
- $ct_agent_version = 'wordpress-250';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
@@ -27,9 +27,6 @@ $ct_jpcf_fields = array('name', 'email');
27
  // Comment already proccessed
28
  $ct_comment_done = false;
29
 
30
- // Comment already proccessed
31
- $ct_signup_done = false;
32
-
33
  // Default value for JS test
34
  $ct_checkjs_def = 0;
35
 
@@ -67,16 +64,7 @@ $ct_post_data_label = 's2member_pro_paypal_registration';
67
  $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
68
 
69
  // Form time load label
70
- $ct_formtime_label = 'formtime';
71
-
72
- // Profiler proccess ID
73
- $ct_profiler_proccess_id = null;
74
-
75
- // Profiler last execution time
76
- $ct_profiler_last_run = null;
77
-
78
- // Enable code profiler
79
- $ct_enable_profiler = true;
80
 
81
  // Init action.
82
  add_action('init', 'ct_init', 1);
@@ -119,8 +107,8 @@ add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
119
 
120
  // Login form - for notifications only
121
  add_filter('login_message', 'ct_login_message');
122
-
123
- if (is_admin() && !(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
124
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
125
 
126
  add_action('admin_init', 'ct_admin_init', 1);
@@ -177,15 +165,6 @@ function ct_init() {
177
  if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && (isset($_POST[$ct_post_data_label]['email']) || isset($_POST[$ct_post_data_authnet_label]['email']))){
178
  ct_s2member_registration_test();
179
  }
180
-
181
- //
182
- // New user approve hack
183
- // https://wordpress.org/plugins/new-user-approve/
184
- //
185
- if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
186
- add_action('register_post', 'ct_register_post', 1, 3);
187
- }
188
-
189
  }
190
 
191
  /**
@@ -1010,7 +989,7 @@ function ct_registration_errors_wpmu($errors) {
1010
  return $errors;
1011
  }
1012
  $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
1013
-
1014
  // Show CleanTalk errors in user_name field
1015
  if (isset($errors['errors']->errors['ct_error'])) {
1016
  $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
@@ -1019,31 +998,13 @@ function ct_registration_errors_wpmu($errors) {
1019
 
1020
  return $errors;
1021
  }
1022
-
1023
- /**
1024
- * Shell for action register_post
1025
- * @return array with errors
1026
- */
1027
- function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1028
- return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1029
- }
1030
-
1031
  /**
1032
  * Test users registration
1033
  * @return array with errors
1034
  */
1035
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1036
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp, $ct_signup_done;
1037
-
1038
- // If there is an error already, let it do it's thing
1039
- if ($errors->get_error_code()) {
1040
- return $errors;
1041
- }
1042
-
1043
- // The function already executed
1044
- if ($ct_signup_done) {
1045
- return $errors;
1046
- }
1047
  //
1048
  // BuddyPress actions
1049
  //
@@ -1109,8 +1070,6 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1109
  )
1110
  );
1111
  }
1112
-
1113
- $ct_signup_done = true;
1114
 
1115
  if ($ct_result->errno != 0) {
1116
  return $errors;
@@ -1562,54 +1521,4 @@ function ct_s2member_registration_test() {
1562
  return true;
1563
  }
1564
 
1565
- /**
1566
- * Writes to log execution time CleanTalk's functions
1567
- * @return null
1568
- */
1569
- function ct_profiler ($file, $line) {
1570
- global $ct_profiler_proccess_id, $ct_profiler_last_run, $ct_enable_profiler;
1571
-
1572
- if (!$ct_enable_profiler) {
1573
- return null;
1574
- }
1575
-
1576
- if ($ct_profiler_proccess_id === null) {
1577
- $ct_profiler_proccess_id = md5(time() . rand(0, 10000));
1578
- }
1579
-
1580
- $warning_label = '';
1581
- if ($ct_profiler_last_run === null) {
1582
- $ct_profiler_last_run = microtime();
1583
- } else {
1584
- $ct_profiler_last_run = microtime() - $ct_profiler_last_run;
1585
-
1586
- $max_execute_time = 1.0;
1587
- if ((float) $ct_profiler_last_run >= $max_execute_time) {
1588
- $warning_label = 'WARNING!!!';
1589
- }
1590
- }
1591
-
1592
- $file = preg_replace("/^.+\/(.+)$/", "$1", $file);
1593
-
1594
- $log_file = CLEANTALK_PLUGIN_DIR . 'ct-profiler.php';
1595
- $fp = fopen($log_file, 'a+') or error_log('Could not open file:' . $file);
1596
-
1597
- //
1598
- // PROFILE_ID FILE LINE_NUM CURRENT_TIME MILLISECONDS_FROM_LAST_RUN
1599
- //
1600
- $to_file = sprintf("%s\t%s\t%d\t%s\t%.3f\t%s\n",
1601
- $ct_profiler_proccess_id,
1602
- $file,
1603
- $line,
1604
- date("Y-m-d H:i:s"),
1605
- $ct_profiler_last_run,
1606
- $warning_label
1607
- );
1608
-
1609
- fwrite($fp, $to_file);
1610
- fclose($fp);
1611
-
1612
- return null;
1613
- }
1614
-
1615
  ?>
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Cloud antispam for comments, registrations and contacts. The plugin doesn't use CAPTCHA, Q&A, math, counting animals or quiz to stop spam bots.
6
+ Version: 2.49
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
  define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
12
 
13
+ $ct_agent_version = 'wordpress-249';
14
  $ct_plugin_name = 'Anti-spam by CleanTalk';
15
  $ct_checkjs_frm = 'ct_checkjs_frm';
16
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
27
  // Comment already proccessed
28
  $ct_comment_done = false;
29
 
 
 
 
30
  // Default value for JS test
31
  $ct_checkjs_def = 0;
32
 
64
  $ct_post_data_authnet_label = 's2member_pro_authnet_registration';
65
 
66
  // Form time load label
67
+ $ct_formtime_label = 'formtime';
 
 
 
 
 
 
 
 
 
68
 
69
  // Init action.
70
  add_action('init', 'ct_init', 1);
107
 
108
  // Login form - for notifications only
109
  add_filter('login_message', 'ct_login_message');
110
+
111
+ if (is_admin()) {
112
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
113
 
114
  add_action('admin_init', 'ct_admin_init', 1);
165
  if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && (isset($_POST[$ct_post_data_label]['email']) || isset($_POST[$ct_post_data_authnet_label]['email']))){
166
  ct_s2member_registration_test();
167
  }
 
 
 
 
 
 
 
 
 
168
  }
169
 
170
  /**
989
  return $errors;
990
  }
991
  $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
992
+
993
  // Show CleanTalk errors in user_name field
994
  if (isset($errors['errors']->errors['ct_error'])) {
995
  $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
998
 
999
  return $errors;
1000
  }
 
 
 
 
 
 
 
 
 
1001
  /**
1002
  * Test users registration
1003
  * @return array with errors
1004
  */
1005
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1006
+ global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp;
1007
+
 
 
 
 
 
 
 
 
 
1008
  //
1009
  // BuddyPress actions
1010
  //
1070
  )
1071
  );
1072
  }
 
 
1073
 
1074
  if ($ct_result->errno != 0) {
1075
  return $errors;
1521
  return true;
1522
  }
1523
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1524
  ?>
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === Anti-spam by CleanTalk ===
2
  Contributors: znaeff, shagimuratov
3
- Tags: antispam, anti-spam, anti spam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, quiz, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cache
4
  Requires at least: 3.0
5
  Tested up to: 3.9.1
6
  Stable tag: 2.49
@@ -12,13 +12,13 @@ SPAM defender for WordPress - no spam comments, no spam registrations, no spam c
12
  == Description ==
13
  No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam bots.
14
 
15
- = Anti-spam features =
16
  1. Stops spam bots comments.
17
  1. Stops spam bots signups.
18
  1. Stops spam bots contacts emails.
19
  1. Stops spam trackbacks.
20
 
21
- = Anti-spam protection =
22
  * WordPress, JetPack comments.
23
  * WordPress, BuddyPress, bbPress, S2Member signups.
24
  * Formiadble forms, Contact form 7, JetPack Contact form.
@@ -26,12 +26,13 @@ No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam b
26
  * Fast Secure Contact form.
27
  * WordPress Landing Pages.
28
 
29
- = Anti spam plugin info =
30
  Spam is one of the most irritating factors. Spam become every year more and conventional anti spam can no longer handle all the spam bots. CleanTalk prevents spam and automatically blocks it. You'll be surprised of effective protection against spam.
31
 
32
- CleanTalk is an antispam protection **4 in 1 for WordPress** that protects login, comment, contact and WooCommerce forms all at once. You don't need to install separate antispam plugins for each form. This allows your blog to work faster and save resources. After installation **you will forget about spam**, CleanTalk plugin will do all the work. You won't have to deal with spam, CleanTalk will do this for you automatically.
 
33
 
34
- CleanTalk is a transparent antispam protection, we provide detailed statistics of all entering comments and logins. You can always be sure that **there are no errors**. We have developed a mobile app for you to see antispam statistics wherever whenever.
35
 
36
  We have developed anti-spam for WordPress that would provide **maximum protection from spam bots** and you can provide for your visitors **a simple and convenient form of comments/registrations without annoying CAPTCHAs and puzzles**. Used to detect spam multistage test that allows us to block up to 100% of spam bots.
37
 
@@ -90,7 +91,7 @@ Plugin Anti-spam by CleanTalk stops up to 100% of spam comments, spam signups (r
90
  = What about pingback, trackback spam? =
91
  Plugin by default pass pingbacks without any checks. All trackbacks will be blocked if the sender have spam activity.
92
 
93
- = Should I use another antispam plugins? =
94
  CleanTalk stops up to 100% of spam bots, so you can disable other anti spam plugins (especially CAPTCHA like anti spam plugins). In some cases several anti-spam plugins can conflict, so it will be better use just one plugin.
95
 
96
  = The plugin WordPress MultiUser (WPMU or WordPress network) compatible? =
@@ -127,7 +128,7 @@ If you're having trouble getting things to work after installing the plugin, her
127
 
128
  = CAPTCHA =
129
  The annoying picture with curved and sloping symbols, which are offered to the visitor to fill in. It is supposed that spam bots won’t discern these symbols, but a visitor will. CAPTCHA provokes great irritation, but if one wants to speak out, he has to fill in these symbols time after time, making mistakes and starting once again. At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource from visitors. Spam bots can automatically recognize Captcha.
130
- Spam bots can not pass through the anti-spam CleanTalk, complex invisible checks can immediately detect spam bots.
131
 
132
  = Requirements =
133
  WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and enabled 'allow_url_fopen' setting. <a href="http://cleantalk.org/register?platform=wordpress">Sign up</a> to get an Access key.
@@ -194,11 +195,11 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
194
 
195
  = 2.28 2013-12-19 =
196
  * New: Added protection against spam bots for WooCommerce review form.
197
- * Fixed: JavaScript antispam logic for WooCommerce review form.
198
 
199
  = 2.27 2013-12-06 =
200
  * New: Added protection against spam bots for JetPack Contact form.
201
- * Fixed: JavaScript antispam logic for registrations and Contact form 7.
202
 
203
  = 2.25 2013-11-27 =
204
  * New: Added protection against spam bots for BuddyPress registrations.
@@ -208,10 +209,10 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
208
  = 2.23 2013-11-20 =
209
  * New: Added automatic training blacklists on spam bot account deletion.
210
  * New: Added URL to project homepage at plugin options.
211
- * Changed: Improved antispam logic.
212
 
213
  = 2.21 2013-11-13 =
214
- * Changed: WordPress blacklists settings get priority over plugin's antispam settings
215
  * Changed: Disabled management approval comments for regular commentators of the blog. Automatically approved for publication only the comments of the new blog authors.
216
  * Changed: Removed form submit time test. Imporved JavaScript spam test.
217
  * Changed: PHP code optimizations
@@ -244,7 +245,7 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
244
  = 2.4.12 2013-08-12 =
245
  * Removed RPC::XML library from plugin.
246
  * Switched plugin to HTTP+JSON connection with servers.
247
- * Fixed bug with comments antispam tests with non UTF8 codepage.
248
 
249
  = 2.4.11 2013-08-02 =
250
  * Removed spam tests for self-made pingbacks
@@ -380,7 +381,7 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
380
 
381
  = 2.27 2013-12-06 =
382
  * New: Added protection against spam bots for JetPack Contact form.
383
- * Fixed: JavaScript antispam logic for registrations and Contact form 7.
384
 
385
  = 2.25 2013-11-27 =
386
  * New: Added protection against spam bots for BuddyPress registrations.
@@ -390,10 +391,10 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
390
  = 2.23 2013-11-20 =
391
  * New: Added automatic training blacklists on spam bot account deletion.
392
  * New: Added URL to project homepage at plugin options.
393
- * Changed: Improved antispam logic.
394
 
395
  = 2.21 2013-11-13 =
396
- * Changed: WordPress blacklists settings get priority over plugin's antispam settings
397
  * Changed: Disabled management approval comments for regular commentators of the blog. Automatically approved for publication only the comments of the new blog authors.
398
  * Changed: PHP code optimizations
399
 
1
  === Anti-spam by CleanTalk ===
2
  Contributors: znaeff, shagimuratov
3
+ Tags: anti spam, anti-spam, antispam, spam, spammers, captcha, comments, registration, contact form, blacklist, math, signup, formidable, bot, spam bots, spammy, s2member, wordpress, support, BuddyPress, bbpress, landing pages, fast secure contact form, WooCommerce, jetpack, cache
4
  Requires at least: 3.0
5
  Tested up to: 3.9.1
6
  Stable tag: 2.49
12
  == Description ==
13
  No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam bots.
14
 
15
+ = Anti spam features =
16
  1. Stops spam bots comments.
17
  1. Stops spam bots signups.
18
  1. Stops spam bots contacts emails.
19
  1. Stops spam trackbacks.
20
 
21
+ = Spam protection =
22
  * WordPress, JetPack comments.
23
  * WordPress, BuddyPress, bbPress, S2Member signups.
24
  * Formiadble forms, Contact form 7, JetPack Contact form.
26
  * Fast Secure Contact form.
27
  * WordPress Landing Pages.
28
 
29
+ = SPAM defender for WordPress - no spam comments, no spam registrations, no spam contact emails, no spam trackbacks =
30
  Spam is one of the most irritating factors. Spam become every year more and conventional anti spam can no longer handle all the spam bots. CleanTalk prevents spam and automatically blocks it. You'll be surprised of effective protection against spam.
31
 
32
+ = Anti spam plugin info =
33
+ CleanTalk is an anti spam protection **4 in 1 for WordPress** that protects login, comment, contact and WooCommerce forms all at once. You don't need to install separate anti spam plugins for each form. This allows your blog to work faster and save resources. After installation **you will forget about spam**, CleanTalk plugin will do all the work. You won't have to deal with spam, CleanTalk will do this for you automatically.
34
 
35
+ CleanTalk is a transparent anti spam protection, we provide detailed statistics of all entering comments and logins. You can always be sure that **there are no errors**. We have developed a mobile app for you to see anti spam statistics wherever whenever.
36
 
37
  We have developed anti-spam for WordPress that would provide **maximum protection from spam bots** and you can provide for your visitors **a simple and convenient form of comments/registrations without annoying CAPTCHAs and puzzles**. Used to detect spam multistage test that allows us to block up to 100% of spam bots.
38
 
91
  = What about pingback, trackback spam? =
92
  Plugin by default pass pingbacks without any checks. All trackbacks will be blocked if the sender have spam activity.
93
 
94
+ = Should I use another anti spam plugins? =
95
  CleanTalk stops up to 100% of spam bots, so you can disable other anti spam plugins (especially CAPTCHA like anti spam plugins). In some cases several anti-spam plugins can conflict, so it will be better use just one plugin.
96
 
97
  = The plugin WordPress MultiUser (WPMU or WordPress network) compatible? =
128
 
129
  = CAPTCHA =
130
  The annoying picture with curved and sloping symbols, which are offered to the visitor to fill in. It is supposed that spam bots won’t discern these symbols, but a visitor will. CAPTCHA provokes great irritation, but if one wants to speak out, he has to fill in these symbols time after time, making mistakes and starting once again. At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource from visitors. Spam bots can automatically recognize Captcha.
131
+ Spam bots can not pass through the anti spam CleanTalk, complex invisible checks can immediately detect spam bots.
132
 
133
  = Requirements =
134
  WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and enabled 'allow_url_fopen' setting. <a href="http://cleantalk.org/register?platform=wordpress">Sign up</a> to get an Access key.
195
 
196
  = 2.28 2013-12-19 =
197
  * New: Added protection against spam bots for WooCommerce review form.
198
+ * Fixed: JavaScript anti spam logic for WooCommerce review form.
199
 
200
  = 2.27 2013-12-06 =
201
  * New: Added protection against spam bots for JetPack Contact form.
202
+ * Fixed: JavaScript anti spam logic for registrations and Contact form 7.
203
 
204
  = 2.25 2013-11-27 =
205
  * New: Added protection against spam bots for BuddyPress registrations.
209
  = 2.23 2013-11-20 =
210
  * New: Added automatic training blacklists on spam bot account deletion.
211
  * New: Added URL to project homepage at plugin options.
212
+ * Changed: Improved anti spam logic.
213
 
214
  = 2.21 2013-11-13 =
215
+ * Changed: WordPress blacklists settings get priority over plugin's anti spam settings
216
  * Changed: Disabled management approval comments for regular commentators of the blog. Automatically approved for publication only the comments of the new blog authors.
217
  * Changed: Removed form submit time test. Imporved JavaScript spam test.
218
  * Changed: PHP code optimizations
245
  = 2.4.12 2013-08-12 =
246
  * Removed RPC::XML library from plugin.
247
  * Switched plugin to HTTP+JSON connection with servers.
248
+ * Fixed bug with comments anti spam tests with non UTF8 codepage.
249
 
250
  = 2.4.11 2013-08-02 =
251
  * Removed spam tests for self-made pingbacks
381
 
382
  = 2.27 2013-12-06 =
383
  * New: Added protection against spam bots for JetPack Contact form.
384
+ * Fixed: JavaScript anti spam logic for registrations and Contact form 7.
385
 
386
  = 2.25 2013-11-27 =
387
  * New: Added protection against spam bots for BuddyPress registrations.
391
  = 2.23 2013-11-20 =
392
  * New: Added automatic training blacklists on spam bot account deletion.
393
  * New: Added URL to project homepage at plugin options.
394
+ * Changed: Improved anti spam logic.
395
 
396
  = 2.21 2013-11-13 =
397
+ * Changed: WordPress blacklists settings get priority over plugin's anti spam settings
398
  * Changed: Disabled management approval comments for regular commentators of the blog. Automatically approved for publication only the comments of the new blog authors.
399
  * Changed: PHP code optimizations
400