Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.4.10

Version Description

2013-07-24 = * Fixed warning in PHP 5.4 * Fixed bug with disabling comments test for Administrators, Authors and Editors * "Stop words" settings moved to Control panel of the service * "Response language" settings moved Control panel of the service

Download this release

Release Info

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

Code changes from version 2.4.9 to 2.4.10

Files changed (3) hide show
  1. cleantalk.class.php +3 -3
  2. cleantalk.php +21 -72
  3. readme.txt +15 -21
cleantalk.class.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Cleantalk base class
4
  *
5
- * @version 0.20.1
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Сleantalk team (welcome@cleantalk.ru)
@@ -202,14 +202,14 @@ class CleantalkRequest {
202
  * valid are 0|1
203
  * @var int
204
  */
205
- public $stoplist_check = 1;
206
 
207
  /**
208
  * Language server response,
209
  * valid are 'en' or 'ru'
210
  * @var string
211
  */
212
- public $response_lang = 'en';
213
 
214
  /**
215
  * User IP
2
  /**
3
  * Cleantalk base class
4
  *
5
+ * @version 0.20.2
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Сleantalk team (welcome@cleantalk.ru)
202
  * valid are 0|1
203
  * @var int
204
  */
205
+ public $stoplist_check = null;
206
 
207
  /**
208
  * Language server response,
209
  * valid are 'en' or 'ru'
210
  * @var string
211
  */
212
+ public $response_lang = null;
213
 
214
  /**
215
  * User IP
cleantalk.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: CleanTalk. Spam protection
4
  Plugin URI: http://cleantalk.org/wordpress
5
- Description: Plugin stops spambots without move spam comments to trash or manual approval queue, invisible for users and admins. Every new comment compares with article and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
6
- Version: 2.4.9
7
  Author: СleanTalk team <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
@@ -36,7 +36,7 @@ function ct_get_options() {
36
  $options = get_option('cleantalk_settings');
37
  if (!is_array($options))
38
  $options = array();
39
- return array_merge(ct_def_options(), $options);
40
  }
41
 
42
  /**
@@ -46,9 +46,6 @@ function ct_get_options() {
46
  function ct_def_options() {
47
  $lang = get_bloginfo('language');
48
  return array(
49
- 'stopwords' => '1',
50
- 'allowlinks' => '0',
51
- 'language' => 'en',
52
  'server' => 'http://moderate.cleantalk.ru',
53
  'apikey' => __('enter key', 'cleantalk'),
54
  'autoPubRevelantMess' => '1'
@@ -205,30 +202,23 @@ function ct_set_session() {
205
  $_SESSION['formtime'] = time();
206
  }
207
 
208
- /**
209
- * Get user role
210
- * @global type $current_user
211
- * @return type
212
- */
213
- function ct_get_user_role() {
214
- global $current_user;
215
-
216
- $user_roles = $current_user->roles;
217
- $user_role = array_shift($user_roles);
218
-
219
- return $user_role;
220
- }
221
-
222
  /**
223
  * Is enable for user group
224
  * @return boolean
225
  */
226
  function ct_is_user_enable() {
 
 
 
 
 
 
227
  $disable_roles = array('administrator', 'editor', 'author');
228
- $user_role = ct_get_user_role();
229
- if (in_array($user_role, $disable_roles)) {
230
- return false;
231
  }
 
232
  return true;
233
  }
234
  /**
@@ -325,11 +315,8 @@ function ct_check($comment) {
325
  $ct_request->sender_email = $comment['comment_author_email'];
326
  $ct_request->sender_nickname = $comment['comment_author'];
327
  $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
328
- $ct_request->agent = 'wordpress-249';
329
  $ct_request->sender_info = $user_info;
330
- $ct_request->stoplist_check = $options['stopwords'];
331
- $ct_request->response_lang = $options['language'];
332
- $ct_request->allow_links = $options['allowlinks'];
333
  $ct_request->submit_time = $submit_time;
334
  $ct_request->js_on = $checkjs;
335
  $ct_request->post_info = $post_info;
@@ -565,7 +552,7 @@ function ct_enqueue_scripts($hook) {
565
  * Admin action 'admin_menu' - Add the admin options page
566
  */
567
  function ct_admin_add_page() {
568
- add_options_page(__('CleanTalk settings', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>. Spam protection', 'manage_options', 'cleantalk', 'ct_settings_page');
569
  }
570
 
571
  /**
@@ -574,8 +561,6 @@ function ct_admin_add_page() {
574
  function ct_admin_init() {
575
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
576
  add_settings_section('cleantalk_settings_main', __('Main settings', 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
577
- add_settings_field('cleantalk_stopwords', __('Stop words checking', 'cleantalk'), 'ct_input_stopwords', 'cleantalk', 'cleantalk_settings_main');
578
- add_settings_field('cleantalk_language', __('System messages language', 'cleantalk'), 'ct_input_language', 'cleantalk', 'cleantalk_settings_main');
579
  add_settings_field('cleantalk_autoPubRevelantMess', __('Publicate relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
580
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
581
  }
@@ -584,18 +569,7 @@ function ct_admin_init() {
584
  * Admin callback function - Displays description of 'main' plugin parameters section
585
  */
586
  function ct_section_settings_main() {
587
- }
588
-
589
- /**
590
- * Admin callback function - Displays inputs of 'stopwords' plugin parameter
591
- */
592
- function ct_input_stopwords() {
593
- $options = ct_get_options();
594
- $value = $options['stopwords'];
595
- echo "<input type='radio' id='cleantalk_stopwords0' name='cleantalk_settings[stopwords]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_stopwords0'> " . __('No') . "</label>";
596
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
597
- echo "<input type='radio' id='cleantalk_stopwords1' name='cleantalk_settings[stopwords]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_stopwords1'> " . __('Yes') . "</label>";
598
- admin_addDescriptionsFields(__('Comments with rude and swear words will be moved to manual moderation.', 'cleantalk'));
599
  }
600
 
601
  /**
@@ -613,38 +587,15 @@ function ct_input_autoPubRevelantMess () {
613
  admin_addDescriptionsFields(__('Relevant comments will be automatic publicated at the blog.', 'cleantalk'));
614
  }
615
 
616
- /**
617
- * Admin callback function - Displays inputs of 'allowlinks' plugin parameter
618
- */
619
- function ct_input_allowlinks() {
620
- $options = ct_get_options();
621
- $value = $options['allowlinks'];
622
- echo "<input type='radio' id='cleantalk_allowlinks0' name='cleantalk_settings[allowlinks]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_allowlinks0'> " . __('No') . "</label>";
623
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
624
- echo "<input type='radio' id='cleantalk_allowlinks1' name='cleantalk_settings[allowlinks]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_allowlinks1'> " . __('Yes') . "</label>";
625
- }
626
-
627
- /**
628
- * Admin callback function - Displays inputs of 'language' plugin parameter
629
- */
630
- function ct_input_language() {
631
- $options = ct_get_options();
632
- $value = $options['language'];
633
- echo "<input type='radio' id='cleantalk_language0' name='cleantalk_settings[language]' value='en' " . ($value == 'en' ? 'checked' : '') . " /><label for='cleantalk_language0'> " . __('English', 'cleantalk') . "</label>";
634
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
635
- echo "<input type='radio' id='cleantalk_language1' name='cleantalk_settings[language]' value='ru' " . ($value == 'ru' ? 'checked' : '') . " /><label for='cleantalk_language1'> " . __('Russian', 'cleantalk') . "</label>";
636
- admin_addDescriptionsFields(__('This language will be used to notice blogs owner and commentators.', 'cleantalk'));
637
- }
638
-
639
  /**
640
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
641
  */
642
  function ct_input_apikey() {
643
  $options = ct_get_options();
644
- $def_options = __('enter key', 'cleantalk');
645
  $value = $options['apikey'];
646
- $def_value = $def_options['apikey'];
647
- echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='10' type='text' value='$value' onfocus=\"if(this.value=='$def_value') this.value='';\"/>";
 
648
  echo "<a target='__blank' style='margin-left: 10px' href='http://cleantalk.org/install/wordpress?step=2'>".__('Click here to get access key', 'cleantalk')."</a>";
649
  }
650
 
@@ -662,9 +613,7 @@ function ct_settings_validate($input) {
662
  function ct_settings_page() {
663
  ?>
664
  <div>
665
- <h2><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>. Spam protection
666
-
667
- </h2>
668
  <form action="options.php" method="post">
669
  <?php settings_fields('cleantalk_settings'); ?>
670
  <?php do_settings_sections('cleantalk'); ?>
1
  <?php
2
  /*
3
+ Plugin Name: CleanTalk
4
  Plugin URI: http://cleantalk.org/wordpress
5
+ Description: Plug-in filters spam bots in the comments of a blog without move to trash or approval in the queue. Spam protection is not visible for visitors and administrators of a blog. The plug-in not uses CAPTCHA or Q&A to stop spam-bots. It's simple and clever antispam for your blog.
6
+ Version: 2.4.10
7
  Author: СleanTalk team <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
36
  $options = get_option('cleantalk_settings');
37
  if (!is_array($options))
38
  $options = array();
39
+ return array_merge(ct_def_options(), (array) $options);
40
  }
41
 
42
  /**
46
  function ct_def_options() {
47
  $lang = get_bloginfo('language');
48
  return array(
 
 
 
49
  'server' => 'http://moderate.cleantalk.ru',
50
  'apikey' => __('enter key', 'cleantalk'),
51
  'autoPubRevelantMess' => '1'
202
  $_SESSION['formtime'] = time();
203
  }
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * Is enable for user group
207
  * @return boolean
208
  */
209
  function ct_is_user_enable() {
210
+ global $current_user;
211
+
212
+ if (!isset($current_user->roles)) {
213
+ return true;
214
+ }
215
+
216
  $disable_roles = array('administrator', 'editor', 'author');
217
+ foreach ($current_user->roles as $k => $v) {
218
+ if (in_array($v, $disable_roles))
219
+ return false;
220
  }
221
+
222
  return true;
223
  }
224
  /**
315
  $ct_request->sender_email = $comment['comment_author_email'];
316
  $ct_request->sender_nickname = $comment['comment_author'];
317
  $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
318
+ $ct_request->agent = 'wordpress-2410';
319
  $ct_request->sender_info = $user_info;
 
 
 
320
  $ct_request->submit_time = $submit_time;
321
  $ct_request->js_on = $checkjs;
322
  $ct_request->post_info = $post_info;
552
  * Admin action 'admin_menu' - Add the admin options page
553
  */
554
  function ct_admin_add_page() {
555
+ add_options_page(__('CleanTalk settings', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>', 'manage_options', 'cleantalk', 'ct_settings_page');
556
  }
557
 
558
  /**
561
  function ct_admin_init() {
562
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
563
  add_settings_section('cleantalk_settings_main', __('Main settings', 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
 
 
564
  add_settings_field('cleantalk_autoPubRevelantMess', __('Publicate relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
565
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
566
  }
569
  * Admin callback function - Displays description of 'main' plugin parameters section
570
  */
571
  function ct_section_settings_main() {
572
+ return true;
 
 
 
 
 
 
 
 
 
 
 
573
  }
574
 
575
  /**
587
  admin_addDescriptionsFields(__('Relevant comments will be automatic publicated at the blog.', 'cleantalk'));
588
  }
589
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
  /**
591
  * Admin callback function - Displays inputs of 'apikey' plugin parameter
592
  */
593
  function ct_input_apikey() {
594
  $options = ct_get_options();
 
595
  $value = $options['apikey'];
596
+
597
+ $def_value = '';
598
+ echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='10' type='text' value='$value' />";
599
  echo "<a target='__blank' style='margin-left: 10px' href='http://cleantalk.org/install/wordpress?step=2'>".__('Click here to get access key', 'cleantalk')."</a>";
600
  }
601
 
613
  function ct_settings_page() {
614
  ?>
615
  <div>
616
+ <h2><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b></h2>
 
 
617
  <form action="options.php" method="post">
618
  <?php settings_fields('cleantalk_settings'); ?>
619
  <?php do_settings_sections('cleantalk'); ?>
readme.txt CHANGED
@@ -4,18 +4,18 @@ Tags: comments, spam, cleantalk, anti-spam, antispam, captcha, comment, spambot,
4
  Requires at least: 3.1.2
5
  License: GPLv2
6
  Tested up to: 3.5.1
7
- Stable tag: trunk
8
 
9
- Spam free WordPress.
10
 
11
  == Description ==
 
 
 
12
 
13
- Plugin stops spambots without move spam comments to trash or manual approval queue, invisible for users and admins. Every new comment compares with article and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
14
 
15
- 1. Stop spam-bots in comments.
16
- 1. Invisible for users.
17
- 1. Antispam without CAPTCHA.
18
- 1. Automatic approval not spam comments.
19
 
20
  This plugin is a client application for anti-spam service cleantalk.org. It is free to use for small and medium sized blogs.
21
 
@@ -26,7 +26,7 @@ Please use <a href="http://cleantalk.org/install/wordpress" target="_blank">Setu
26
  == Frequently Asked Questions ==
27
 
28
  = How plugin stop spam? =
29
- Plugin use several simple tests to stop spambots
30
 
31
  * Blacklists checks by Email, IP in lists with several billions records.
32
  * JavaScript availability.
@@ -46,13 +46,19 @@ Plugin sends a comment's text and several previous approved comments to the serv
46
 
47
  == Screenshots ==
48
 
49
- 1. Plug-in's anti-spam work scheme
50
  1. CleanTalk stops spam comment
51
  1. CleanTalk settings to filter spam-bots
52
  1. Service Control panel at cleantalk.org
53
 
54
  == Changelog ==
55
 
 
 
 
 
 
 
56
  = 2.4.9 =
57
  * Fixed extra debugging in base class
58
 
@@ -127,15 +133,3 @@ Plugin sends a comment's text and several previous approved comments to the serv
127
 
128
  = 1.1.0 =
129
  * First version
130
-
131
- == Upgrade Notice ==
132
-
133
- = 1.1.2 =
134
- * Addition: Title of the post attached to the example text in auto publication tool.
135
- * Tested with WordPress 3.4.1.
136
-
137
- = 1.1.1 =
138
- * Added user locale support, tested up to WP 3.4
139
-
140
- = 1.1.0 =
141
- * First version
4
  Requires at least: 3.1.2
5
  License: GPLv2
6
  Tested up to: 3.5.1
7
+ Stable tag: 2.4.10
8
 
9
+ No spam in the comments. Smart, simple antispam without CAPTCHA.
10
 
11
  == Description ==
12
+ 1. Stops spam bots in the comments.
13
+ 1. Invisible spam protection for visitors.
14
+ 1. Antispam without CAPTCHA.
15
 
16
+ Plug-in filters spam bots in the comments of a blog without move to trash or approval in the queue. The plugin is not visible for visitors and administrators of a blog. The plug-in not uses CAPTCHA or Q&A to stop spam bots. It's simple and clever antispam for your blog.
17
 
18
+ Every new comment compares with article and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
 
 
 
19
 
20
  This plugin is a client application for anti-spam service cleantalk.org. It is free to use for small and medium sized blogs.
21
 
26
  == Frequently Asked Questions ==
27
 
28
  = How plugin stop spam? =
29
+ Plugin uses several simple tests to stop spambots
30
 
31
  * Blacklists checks by Email, IP in lists with several billions records.
32
  * JavaScript availability.
46
 
47
  == Screenshots ==
48
 
49
+ 1. Plug-in's antispam work scheme
50
  1. CleanTalk stops spam comment
51
  1. CleanTalk settings to filter spam-bots
52
  1. Service Control panel at cleantalk.org
53
 
54
  == Changelog ==
55
 
56
+ = 2.4.10 2013-07-24 =
57
+ * Fixed warning in PHP 5.4
58
+ * Fixed bug with disabling comments test for Administrators, Authors and Editors
59
+ * "Stop words" settings moved to <a href="http://cleantalk.org/my">Control panel</a> of the service
60
+ * "Response language" settings moved <a href="http://cleantalk.org/my">Control panel</a> of the service
61
+
62
  = 2.4.9 =
63
  * Fixed extra debugging in base class
64
 
133
 
134
  = 1.1.0 =
135
  * First version