Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.25-devel

Version Description

Download this release

Release Info

Developer Vlad Cleantalk
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.25-devel
Comparing to
See all releases

Code changes from version 4.24.1 to 5.25-devel

cleantalk-admin.js CHANGED
@@ -17,6 +17,30 @@ jQuery(document).ready(function(){
17
  //
18
  }
19
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
21
  ct_adv_settings.hide();
22
  ct_adv_settings_title=ct_adv_settings.prev();
17
  //
18
  }
19
  });
20
+
21
+ if(cleantalk_good_key)
22
+ {
23
+ jQuery('.form-table').first().hide();
24
+
25
+ banner_html="<div id='ct_stats_banner'>"+cleantalk_blocked_message;
26
+ banner_html+=cleantalk_statistics_link+'</div>';
27
+ //jQuery('.form-table').first().before(cleantalk_blocked_message);
28
+ jQuery('.form-table').first().before(banner_html);
29
+ //jQuery('.form-table').first().before(cleantalk_statistics_link);
30
+ jQuery('.form-table').first().before("<br /><a href='#' style='font-size:10pt;' id='cleantalk_access_key_link'>Show the access key</a>");
31
+ }
32
+
33
+ jQuery('#cleantalk_access_key_link').click(function(){
34
+ if(jQuery('.form-table').first().is(":visible"))
35
+ {
36
+ jQuery('.form-table').first().hide();
37
+ }
38
+ else
39
+ {
40
+ jQuery('.form-table').first().show();
41
+ }
42
+ });
43
+
44
  ct_adv_settings=jQuery('#cleantalk_registrations_test1').parent().parent().parent().parent();
45
  ct_adv_settings.hide();
46
  ct_adv_settings_title=ct_adv_settings.prev();
cleantalk-admin.php CHANGED
@@ -4,6 +4,23 @@ $ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
4
  $ct_options=ct_get_options();
5
  $ct_data=ct_get_data();
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if(isset($_GET['close_notice']))
8
  {
9
  global $ct_data, $pagenow;
@@ -184,7 +201,11 @@ function ct_admin_init() {
184
  $result = json_decode($result, true);
185
  if (isset($result['data']) && is_array($result['data'])) {
186
  $result = $result['data'];
187
- }
 
 
 
 
188
 
189
  if (isset($result['show_notice'])) {
190
  if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
@@ -259,6 +280,17 @@ function ct_admin_init() {
259
  margin-bottom:5px;
260
  display:inline-block;
261
  }
 
 
 
 
 
 
 
 
 
 
 
262
  </style>';
263
  if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
264
  {
@@ -267,15 +299,17 @@ if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
267
  }
268
  else
269
  {
270
- $buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" id="ct_button_check_comments">'.__('Check comments', 'cleantalk').'</a>
271
- <a href="users.php?page=ct_check_users&do_check=1" id="ct_button_check_users">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
272
  }
273
 
274
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
275
  add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
276
  add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active for:', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
277
  //add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
278
- add_settings_section('cleantalk_settings_anti_spam', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3><a href='#' style='text-decoration:underline;font-size:14px;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
 
 
279
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
280
  add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
281
 
@@ -287,7 +321,9 @@ else
287
  add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
288
  add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
289
  add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
290
- //add_settings_field('cleantalk_show_link', __('Show link to CleanTalk on comment forms', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_anti_spam');
 
 
291
  }
292
 
293
  /**
@@ -437,13 +473,26 @@ function ct_input_apikey() {
437
  $ct_options=ct_get_options();
438
  $ct_data=ct_get_data();
439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
441
 
442
  $value = $ct_options['apikey'];
443
  $def_value = '';
444
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
445
  if (ct_valid_key($value) === false) {
446
-
447
  echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
448
  if (function_exists('curl_init') && function_exists('json_decode')) {
449
  echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
@@ -451,6 +500,7 @@ function ct_input_apikey() {
451
  admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
452
  }
453
  } else {
 
454
  if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
455
  //echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;';
456
  }
@@ -611,6 +661,66 @@ function ct_input_use_ajax() {
611
  @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
612
  }
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  function ct_input_check_external() {
615
  global $ct_options, $ct_data;
616
 
@@ -645,10 +755,20 @@ function ct_input_show_link() {
645
  {
646
  $value=0;
647
  }
648
- echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
 
649
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
650
- echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";
 
 
 
651
  @admin_addDescriptionsFields(sprintf(__("Place a small link under comments form, it lets know what's anti-spam tool protects your site", 'cleantalk'), $ct_options['show_link']));
 
 
 
 
 
 
652
  }
653
 
654
 
4
  $ct_options=ct_get_options();
5
  $ct_data=ct_get_data();
6
 
7
+ add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
8
+ function cleantalk_custom_glance_items( )
9
+ {
10
+ global $ct_data;
11
+ $ct_data=ct_get_data();
12
+ if(!isset($ct_data['admin_blocked']))
13
+ {
14
+ $blocked=0;
15
+ }
16
+ else
17
+ {
18
+ $blocked=$ct_data['admin_blocked'];
19
+ }
20
+ print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "inc/images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='options-general.php?page=cleantalk'>CleanTalk</a> has blocked $blocked spam.</span></div>";
21
+ }
22
+
23
+
24
  if(isset($_GET['close_notice']))
25
  {
26
  global $ct_data, $pagenow;
201
  $result = json_decode($result, true);
202
  if (isset($result['data']) && is_array($result['data'])) {
203
  $result = $result['data'];
204
+ }
205
+ if(isset($result['spam_count']))
206
+ {
207
+ $ct_data['admin_blocked']=$result['spam_count'];
208
+ }
209
 
210
  if (isset($result['show_notice'])) {
211
  if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
280
  margin-bottom:5px;
281
  display:inline-block;
282
  }
283
+
284
+ #ct_stats_banner
285
+ {
286
+ padding: 0px;
287
+ color: #000;
288
+ /*border:2px solid #e5e5e5;*/
289
+ font-size: 10pt;
290
+ text-decoration:none;
291
+ margin-bottom:5px;
292
+ display:inline-block;
293
+ }
294
  </style>';
295
  if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
296
  {
299
  }
300
  else
301
  {
302
+ $buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check comments', 'cleantalk').'</a><br />
303
+ <a href="users.php?page=ct_check_users&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
304
  }
305
 
306
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
307
  add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
308
  add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active for:', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
309
  //add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
310
+ add_settings_section('cleantalk_settings_banner', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3>", '', 'cleantalk');
311
+ add_settings_section('cleantalk_settings_anti_spam', "<a href='#' style='text-decoration:underline;font-size:10pt;font-weight:400;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
312
+
313
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
314
  add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
315
 
321
  add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
322
  add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
323
  add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
324
+ add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
325
+ add_settings_field('cleantalk_check_messages_number', __("Don't check messages", 'cleantalk'), 'ct_input_check_messages_number', 'cleantalk', 'cleantalk_settings_anti_spam');
326
+ add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
327
  }
328
 
329
  /**
473
  $ct_options=ct_get_options();
474
  $ct_data=ct_get_data();
475
 
476
+ if(!isset($ct_data['admin_blocked']))
477
+ {
478
+ $blocked=0;
479
+ }
480
+ else
481
+ {
482
+ $blocked=$ct_data['admin_blocked'];
483
+ }
484
+
485
+ echo "<script>var cleantalk_blocked_message=\"<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><span>CleanTalk has blocked <b>$blocked</b> spam.</span></div>\";
486
+ var cleantalk_statistics_link=\"<a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>\";
487
+ </script>";
488
+
489
  echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
490
 
491
  $value = $ct_options['apikey'];
492
  $def_value = '';
493
  echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
494
  if (ct_valid_key($value) === false) {
495
+ echo "<script>var cleantalk_good_key=false;</script>";
496
  echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
497
  if (function_exists('curl_init') && function_exists('json_decode')) {
498
  echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
500
  admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
501
  }
502
  } else {
503
+ echo "<script>var cleantalk_good_key=true;</script>";
504
  if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
505
  //echo '&nbsp;&nbsp;<span style="text-decoration: underline;">The key accepted!</span>&nbsp;';
506
  }
661
  @admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
662
  }
663
 
664
+ function ct_input_check_comments_number() {
665
+ global $ct_options, $ct_data;
666
+
667
+ $ct_options = ct_get_options();
668
+ $ct_data = ct_get_data();
669
+
670
+ if(isset($ct_options['check_comments_number']))
671
+ {
672
+ $value = @intval($ct_options['check_comments_number']);
673
+ }
674
+ else
675
+ {
676
+ $value=0;
677
+ }
678
+
679
+ if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
680
+ {
681
+ $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
682
+ }
683
+ else
684
+ {
685
+ $comments_check_number = 3;
686
+ }
687
+
688
+ echo "<input type='radio' id='cleantalk_check_comments_number1' name='cleantalk_settings[check_comments_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number1'> " . __('Yes') . "</label>";
689
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
690
+ echo "<input type='radio' id='cleantalk_check_comments_number0' name='cleantalk_settings[check_comments_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number0'> " . __('No') . "</label>";
691
+ @admin_addDescriptionsFields(sprintf(__("Dont't check comments for users with above $comments_check_number comments", 'cleantalk'), $ct_options['check_comments_number']));
692
+ }
693
+
694
+ function ct_input_check_messages_number() {
695
+ global $ct_options, $ct_data;
696
+
697
+ $ct_options = ct_get_options();
698
+ $ct_data = ct_get_data();
699
+
700
+ if(isset($ct_options['check_messages_number']))
701
+ {
702
+ $value = @intval($ct_options['check_messages_number']);
703
+ }
704
+ else
705
+ {
706
+ $value=0;
707
+ }
708
+
709
+ if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
710
+ {
711
+ $messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
712
+ }
713
+ else
714
+ {
715
+ $messages_check_number = 3;
716
+ }
717
+
718
+ echo "<input type='radio' id='cleantalk_check_messages_number1' name='cleantalk_settings[check_messages_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number1'> " . __('Yes') . "</label>";
719
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
720
+ echo "<input type='radio' id='cleantalk_check_messages_number0' name='cleantalk_settings[check_messages_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number0'> " . __('No') . "</label>";
721
+ @admin_addDescriptionsFields(sprintf(__("Dont't check messages for users with above $messages_check_number messages", 'cleantalk'), $ct_options['check_messages_number']));
722
+ }
723
+
724
  function ct_input_check_external() {
725
  global $ct_options, $ct_data;
726
 
755
  {
756
  $value=0;
757
  }
758
+
759
+ /* echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
760
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
761
+ echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";*/
762
+
763
+ echo "<div id='cleantalk_anchor' style='display:none'></div><input type=hidden name='cleantalk_settings[show_link]' value='0' />";
764
+ echo "<input type='checkbox' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Help others known CleanTalk') . "</label>";
765
  @admin_addDescriptionsFields(sprintf(__("Place a small link under comments form, it lets know what's anti-spam tool protects your site", 'cleantalk'), $ct_options['show_link']));
766
+ echo "<script>
767
+ jQuery(document).ready(function(){
768
+ jQuery('#cleantalk_anchor').parent().parent().children().first().hide();
769
+ jQuery('#cleantalk_anchor').parent().css('padding-left','0px');
770
+ });
771
+ </script>";
772
  }
773
 
774
 
cleantalk-common.php CHANGED
@@ -133,6 +133,50 @@ function ct_base_call($params = array()) {
133
 
134
  $ct_options=ct_get_options();
135
  $ct_data=ct_get_data();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
  require_once('cleantalk.class.php');
138
 
@@ -204,6 +248,11 @@ function ct_base_call($params = array()) {
204
  }
205
  }
206
  ct_add_event('yes');
 
 
 
 
 
207
  }
208
 
209
  return array('ct' => $ct, 'ct_result' => $ct_result);
133
 
134
  $ct_options=ct_get_options();
135
  $ct_data=ct_get_data();
136
+
137
+ if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
138
+ {
139
+ $messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
140
+ }
141
+ else
142
+ {
143
+ $messages_check_number = 3;
144
+ }
145
+
146
+ $is_max_messages = false;
147
+ $is_logged_in = false;
148
+ $user_id = 0;
149
+ $user_cnt = 0;
150
+ if(isset($ct_options['check_messages_number']))
151
+ {
152
+ $value = @intval($ct_options['check_messages_number']);
153
+ }
154
+ else
155
+ {
156
+ $value=0;
157
+ }
158
+
159
+ if($value == 1 && is_user_logged_in())
160
+ {
161
+ $is_logged_in = true;
162
+ $user_id = get_current_user_id();
163
+ $user_cnt = get_user_meta( $user_id, 'cleantalk_messages_number', true );
164
+ if($user_cnt===false)
165
+ {
166
+ $user_cnt = 0;
167
+ }
168
+ if($user_cnt!==false && $user_cnt > $messages_check_number)
169
+ {
170
+ $is_max_messages = true;
171
+ }
172
+ }
173
+
174
+ if($is_max_messages)
175
+ {
176
+ $ct_result = new stdClass();
177
+ $ct_result->allow = 1;
178
+ return array('ct' => null, 'ct_result' => $ct_result);
179
+ }
180
 
181
  require_once('cleantalk.class.php');
182
 
248
  }
249
  }
250
  ct_add_event('yes');
251
+ if($is_logged_in)
252
+ {
253
+ $user_cnt++;
254
+ update_user_meta( $user_id, 'cleantalk_messages_number', $user_cnt);
255
+ }
256
  }
257
 
258
  return array('ct' => $ct, 'ct_result' => $ct_result);
cleantalk-public.php CHANGED
@@ -467,8 +467,40 @@ function ct_preprocess_comment($comment) {
467
 
468
  $ct_options = ct_get_options();
469
  $ct_data = ct_get_data();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
 
471
- if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false)) {
472
  return $comment;
473
  }
474
 
467
 
468
  $ct_options = ct_get_options();
469
  $ct_data = ct_get_data();
470
+
471
+ if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
472
+ {
473
+ $comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
474
+ }
475
+ else
476
+ {
477
+ $comments_check_number = 3;
478
+ }
479
+
480
+ $is_max_comments = false;
481
+ if(isset($ct_options['check_comments_number']))
482
+ {
483
+ $value = @intval($ct_options['check_comments_number']);
484
+ }
485
+ else
486
+ {
487
+ $value=0;
488
+ }
489
+
490
+ if($value == 1 && is_user_logged_in())
491
+ {
492
+ $user_id = get_current_user_id();
493
+ $args=Array('author__in' => Array($user_id),
494
+ 'count' => true,
495
+ );
496
+ $cnt = get_comments( $args );
497
+ if($cnt > $comments_check_number)
498
+ {
499
+ $is_max_comments = true;
500
+ }
501
+ }
502
 
503
+ if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || $ct_comment_done || (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) || $is_max_comments) {
504
  return $comment;
505
  }
506
 
cleantalk-widget.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?
2
+
3
+ class cleantalk_widget extends WP_Widget
4
+ {
5
+
6
+ function __construct()
7
+ {
8
+ parent::__construct(
9
+ // Base ID of your widget
10
+ 'cleantalk_widget',
11
+
12
+ // Widget name will appear in UI
13
+ __('CleanTalk Widget', 'cleantalk'),
14
+
15
+ // Widget description
16
+ array( 'description' => __( 'CleanTalk widget', 'cleantalk' ), )
17
+ );
18
+ }
19
+
20
+ // Creating widget front-end
21
+ // This is where the action happens
22
+ public function widget( $args, $instance )
23
+ {
24
+ $title = apply_filters( 'widget_title', $instance['title'] );
25
+ // before and after widget arguments are defined by themes
26
+ echo $args['before_widget'];
27
+ if ( ! empty( $title ) )
28
+ {
29
+ echo $args['before_title'] . $title . $args['after_title'];
30
+ }
31
+ global $ct_data;
32
+ $ct_data=ct_get_data();
33
+ if(!isset($ct_data['admin_blocked']))
34
+ {
35
+ $blocked=0;
36
+ }
37
+ else
38
+ {
39
+ $blocked=$ct_data['admin_blocked'];
40
+ }
41
+
42
+ // This is where you run the code and display the output
43
+ ?>
44
+ <div style="width:auto;">
45
+ <a href="http://cleantalk.org" target="_blank" title="" style="background: #7CA821; background-image: -moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821); background-image: -webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14)); border: 1px solid #5F8E14; border-radius: 3px; color: #CFEA93; cursor: pointer; display: block; font-weight: normal; height: 100%; -moz-border-radius: 3px; padding: 7px 0 8px; text-align: center; text-decoration: none; -webkit-border-radius: 3px; width: 100%;"><strong style="color: #FFF;display: block;font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap;"><b><?php print $blocked; ?></b> spam</strong> blocked by <strong>CleanTalk</strong></a>
46
+ </div>
47
+ <?php
48
+ echo $args['after_widget'];
49
+ }
50
+
51
+ // Widget Backend
52
+ public function form( $instance )
53
+ {
54
+ if ( isset( $instance[ 'title' ] ) )
55
+ {
56
+ $title = $instance[ 'title' ];
57
+ }
58
+ else
59
+ {
60
+ $title = __( 'Spam blocked', 'cleantalk' );
61
+ }
62
+ // Widget admin form
63
+ ?>
64
+ <p>
65
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
66
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
67
+ </p>
68
+ <?php
69
+ }
70
+
71
+ // Updating widget replacing old instances with new
72
+ public function update( $new_instance, $old_instance )
73
+ {
74
+ $instance = array();
75
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
76
+ return $instance;
77
+ }
78
+ } // Class cleantalk_widget ends here
79
+
80
+ // Register and load the widget
81
+ function cleantalk_load_widget()
82
+ {
83
+ register_widget( 'cleantalk_widget' );
84
+ }
85
+ add_action( 'widgets_init', 'cleantalk_load_widget' );
cleantalk.php CHANGED
@@ -34,6 +34,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
34
 
35
 
36
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
 
37
  $ct_options=ct_get_options();
38
  $ct_data=ct_get_data();
39
  $jigo_version=@get_option('jigoshop_db_version', '');
@@ -114,7 +115,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
114
  }
115
  if($value==1)
116
  {
117
- //add_action('comment_form_after', 'ct_show_comment_link');
118
  }
119
 
120
 
@@ -313,7 +314,9 @@ if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
313
 
314
  function ct_show_comment_link()
315
  {
316
- print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>WordPress spam</a> blocked by CleanTalk</div>";
317
  }
318
 
 
 
319
  ?>
34
 
35
 
36
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
37
+ require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-widget.php');
38
  $ct_options=ct_get_options();
39
  $ct_data=ct_get_data();
40
  $jigo_version=@get_option('jigoshop_db_version', '');
115
  }
116
  if($value==1)
117
  {
118
+ add_action('comment_form_after', 'ct_show_comment_link');
119
  }
120
 
121
 
314
 
315
  function ct_show_comment_link()
316
  {
317
+ print "<div style='font-size:10pt;'><a href='https://cleantalk.org/wordpress-anti-spam-plugin' target='_blank'>WordPress spam</a> blocked by CleanTalk.</div>";
318
  }
319
 
320
+ add_action( 'right_now_content_table_end', 'my_add_counts_to_dashboard' );
321
+
322
  ?>
inc/images/logo_color.png ADDED
Binary file