Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.4.13

Version Description

2013-08-19 = * Changed: Switched HTTP requests from file_get_contents() to CURL. Added file_get_contens() as backup connection to the servers. * Changed: Removed feedback requests for comments moved to trash. * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.

Download this release

Release Info

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

Code changes from version 2.4.12 to 2.4.13

cleantalk.class.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Cleantalk base class
4
  *
5
- * @version 1.21.5
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Сleantalk team (welcome@cleantalk.ru)
@@ -336,7 +336,7 @@ class Cleantalk {
336
  * Server connection timeout in seconds
337
  * @var int
338
  */
339
- private $server_timeout = 2;
340
 
341
  /**
342
  * Cleantalk server url
@@ -599,22 +599,46 @@ class Cleantalk {
599
 
600
  // Convert to JSON
601
  $data = json_encode($data);
602
-
603
- $opts = array('http' =>
604
- array(
605
- 'method' => 'POST',
606
- 'header' => "Content-Type: text/html\r\n",
607
- 'content' => $data,
608
- 'timeout' => $server_timeout
609
- )
610
- );
611
-
612
  if (isset($this->api_version))
613
  $url = $url . $this->api_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
 
615
- $context = stream_context_create($opts);
616
- $result = @file_get_contents($url, false, $context);
617
-
618
  $errstr = null;
619
  $response = json_decode($result);
620
  if ($result !== false && is_object($response)) {
@@ -622,7 +646,7 @@ class Cleantalk {
622
  $response->errstr = $errstr;
623
  } else {
624
  if ($result === false)
625
- $errstr = 'Failed connect to ' . $url;
626
  else
627
  $errstr = $result;
628
 
@@ -797,7 +821,12 @@ class Cleantalk {
797
  */
798
  public function delCleantalkComment($message) {
799
  $message = preg_replace('/\n\n\*\*\*.+\*\*\*$/', '', $message);
 
 
 
 
800
  $message = preg_replace('/\<br.*\>[\n]{0,1}\<br.*\>[\n]{0,1}\*\*\*.+\*\*\*$/', '', $message);
 
801
  return $message;
802
  }
803
 
2
  /**
3
  * Cleantalk base class
4
  *
5
+ * @version 1.21.9
6
  * @package Cleantalk
7
  * @subpackage Base
8
  * @author Сleantalk team (welcome@cleantalk.ru)
336
  * Server connection timeout in seconds
337
  * @var int
338
  */
339
+ private $server_timeout = 5;
340
 
341
  /**
342
  * Cleantalk server url
599
 
600
  // Convert to JSON
601
  $data = json_encode($data);
602
+
 
 
 
 
 
 
 
 
 
603
  if (isset($this->api_version))
604
  $url = $url . $this->api_version;
605
+
606
+ $result = false;
607
+ if(function_exists('curl_init')) {
608
+ $ch = curl_init();
609
+ curl_setopt($ch, CURLOPT_URL, $url);
610
+ curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
611
+ curl_setopt($ch, CURLOPT_POST, 1);
612
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
613
+ // receive server response ...
614
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
615
+
616
+ $result = curl_exec($ch);
617
+ curl_close($ch);
618
+ } else {
619
+ $allow_url_fopen = ini_get('allow_url_fopen');
620
+ if (function_exists('file_get_contents') && isset($allow_url_fopen) && $allow_url_fopen == '1') {
621
+ $opts = array('http' =>
622
+ array(
623
+ 'method' => 'POST',
624
+ 'header' => "Content-Type: text/html\r\n",
625
+ 'content' => $data,
626
+ 'timeout' => $server_timeout
627
+ )
628
+ );
629
+
630
+ $context = stream_context_create($opts);
631
+ $result = @file_get_contents($url, false, $context);
632
+ } else {
633
+ $response = null;
634
+ $response['errno'] = 1;
635
+ $response['errstr'] = 'No CURL support compiled in. Disabled allow_url_fopen in php.ini.';
636
+ $response = json_decode(json_encode($response));
637
+
638
+ return $response;
639
+ }
640
+ }
641
 
 
 
 
642
  $errstr = null;
643
  $response = json_decode($result);
644
  if ($result !== false && is_object($response)) {
646
  $response->errstr = $errstr;
647
  } else {
648
  if ($result === false)
649
+ $errstr = 'Failed connect to ' . $url . '.';
650
  else
651
  $errstr = $result;
652
 
821
  */
822
  public function delCleantalkComment($message) {
823
  $message = preg_replace('/\n\n\*\*\*.+\*\*\*$/', '', $message);
824
+
825
+ // DLE sign cut
826
+ $message = preg_replace('/<br\s?\/><br\s?\/>\*\*\*.+\*\*\*$/', '', $message);
827
+
828
  $message = preg_replace('/\<br.*\>[\n]{0,1}\<br.*\>[\n]{0,1}\*\*\*.+\*\*\*$/', '', $message);
829
+
830
  return $message;
831
  }
832
 
cleantalk.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
- Plugin Name: CleanTalk. Anti-spam app
4
  Plugin URI: http://cleantalk.org/wordpress
5
- Description: Plug-in filters spam bots in the comments of a blog without move to trash. Spam protection is invisible for visitors of a blog. The plug-in doesn't use CAPTCHA or Q&A to stop spam bots. It's simple, smart antispam for your blog.
6
- Version: 2.4.12
7
  Author: СleanTalk team <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
- $ct_agent_version = 'wordpress-2412';
12
 
13
  add_action('init', 'ct_init_locale');
14
  add_action('delete_comment', 'ct_delete_comment_meta'); // param - comment ID
@@ -25,7 +25,6 @@ if (is_admin()) {
25
  add_action('comment_approved_to_unapproved', 'ct_comment_unapproved'); // param - comment object
26
  add_action('comment_unapproved_to_spam', 'ct_comment_spam'); // param - comment object
27
  add_action('comment_approved_to_spam', 'ct_comment_spam'); // param - comment object
28
- add_action('trash_comment', 'ct_comment_trash'); // param - comment ID
29
  add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
30
  add_filter('unspam_comment', 'ct_unspam_comment');
31
  }
@@ -101,7 +100,7 @@ function ct_feedback($hash, $message, $allow) {
101
  } else {
102
  $_SESSION['feedback_request'] .= $ct_feedback;
103
  }
104
-
105
  return $resultMessage;
106
  }
107
 
@@ -527,18 +526,6 @@ function ct_unspam_comment($comment_id) {
527
  wp_update_comment($comment);
528
  }
529
 
530
- /**
531
- * Admin action 'trash_comment' - Sends bad feedback to cleantalk
532
- * @param int $comment_id Comment ID
533
- * @return boolean TRUE
534
- */
535
- function ct_comment_trash($comment_id) {
536
- $comment = get_comment($comment_id, 'ARRAY_A');
537
- $hash = get_comment_meta($comment_id, 'ct_hash', true);
538
- ct_feedback($hash, $comment['comment_content'], 0);
539
- return true;
540
- }
541
-
542
  /**
543
  * Admin filter 'get_comment_text' - Adds some info to comment text to display
544
  * @param string $current_text Current comment text
@@ -578,7 +565,7 @@ function ct_admin_add_page() {
578
  function ct_admin_init() {
579
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
580
  add_settings_section('cleantalk_settings_main', __('Main settings', 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
581
- add_settings_field('cleantalk_autoPubRevelantMess', __('Publicate relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
582
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
583
  }
584
 
@@ -601,7 +588,7 @@ function ct_input_autoPubRevelantMess () {
601
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess0' name='cleantalk_settings[autoPubRevelantMess]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess0'> " . __('No') . "</label>";
602
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
603
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
604
- admin_addDescriptionsFields(__('Relevant comments will be automatic publicated at the blog.', 'cleantalk'));
605
  }
606
 
607
  /**
@@ -687,7 +674,7 @@ function admin_notice_message(){
687
  if ($options['apikey'] === 'enter key' || $options['apikey'] === '')
688
  echo '<div class="updated"><p>' . __("Please enter the Access Key in <a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a> settings to enable protection from spam in comments!", 'cleantalk') . '</p></div>';
689
 
690
- ct_send_feedback();
691
 
692
  return true;
693
  }
1
  <?php
2
  /*
3
+ Plugin Name: CleanTalk. Cloud anti-spam
4
  Plugin URI: http://cleantalk.org/wordpress
5
+ Description: Plugin filters spam bots in comments without move to trash. Spam protection is invisible for visitors of a blog. The plugin doesn't use CAPTCHA or Q&A to stop spam bots. It's cloud, invisible, smart antispam for your blog.
6
+ Version: 2.4.13
7
  Author: СleanTalk team <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
+ $ct_agent_version = 'wordpress-2413';
12
 
13
  add_action('init', 'ct_init_locale');
14
  add_action('delete_comment', 'ct_delete_comment_meta'); // param - comment ID
25
  add_action('comment_approved_to_unapproved', 'ct_comment_unapproved'); // param - comment object
26
  add_action('comment_unapproved_to_spam', 'ct_comment_spam'); // param - comment object
27
  add_action('comment_approved_to_spam', 'ct_comment_spam'); // param - comment object
 
28
  add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
29
  add_filter('unspam_comment', 'ct_unspam_comment');
30
  }
100
  } else {
101
  $_SESSION['feedback_request'] .= $ct_feedback;
102
  }
103
+
104
  return $resultMessage;
105
  }
106
 
526
  wp_update_comment($comment);
527
  }
528
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  /**
530
  * Admin filter 'get_comment_text' - Adds some info to comment text to display
531
  * @param string $current_text Current comment text
565
  function ct_admin_init() {
566
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
567
  add_settings_section('cleantalk_settings_main', __('Main settings', 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
568
+ add_settings_field('cleantalk_autoPubRevelantMess', __('Publish relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
569
  add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
570
  }
571
 
588
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess0' name='cleantalk_settings[autoPubRevelantMess]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess0'> " . __('No') . "</label>";
589
  echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
590
  echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
591
+ admin_addDescriptionsFields(__('Relevant (not spam) comments will be automatic published at the blog', 'cleantalk'));
592
  }
593
 
594
  /**
674
  if ($options['apikey'] === 'enter key' || $options['apikey'] === '')
675
  echo '<div class="updated"><p>' . __("Please enter the Access Key in <a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a> settings to enable protection from spam in comments!", 'cleantalk') . '</p></div>';
676
 
677
+ ct_send_feedback();
678
 
679
  return true;
680
  }
readme.txt CHANGED
@@ -1,23 +1,29 @@
1
- === Plugin Name ===
2
  Contributors: znaeff, default.asp, shagimuratov, aleontiev
3
- Tags: spam, antispam, anti-spam, spambot, spam-bot, stop spam, spammers, spamfree, captcha, recaptcha, comment, comments, plugin
4
- Requires at least: 3.1.2
5
- License: GPLv2
6
  Tested up to: 3.6
7
- Stable tag: 2.4.12
 
 
8
 
9
- No spam in the comments. Smart, simple anti-spam app without CAPTCHA.
10
 
11
  == Description ==
 
 
12
  1. Stops spam bots in the comments.
13
  1. Invisible spam protection for visitors.
14
- 1. Anti-spam without CAPTCHA.
15
 
16
- Plugin 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 plugin doesn't use CAPTCHA or Q&A to stop spammers. 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
 
22
  == Installation ==
23
 
@@ -36,7 +42,7 @@ Plugin uses several simple tests to stop spammers.
36
 
37
  = How plugin works? =
38
 
39
- Plugin sends a comment's text and several previous approved comments to the servers. Servers evaluates the relevance of the comment's text on the topic, tests on spam and finaly provides a solution - to publish or put on manual moderation of comments. If a comment is placed on manual moderation, the plugin adds to the text of a comment explaining the reason for the ban server publishing.
40
 
41
  = Will plugin works with my theme? =
42
 
@@ -54,12 +60,17 @@ Please use test email stop_email@example.com for comments. Also you can see comm
54
 
55
  == Screenshots ==
56
 
57
- 1. Antispam work scheme of plugin
58
- 1. Plugin stops spammer comment
59
- 1. Antispam settings to filter spam bots
60
 
61
  == Changelog ==
62
 
 
 
 
 
 
63
  = 2.4.12 2013-08-12 =
64
  * Removed RPC::XML library from plugin.
65
  * Switched plugin to HTTP+JSON connection with servers.
@@ -149,3 +160,8 @@ Please use test email stop_email@example.com for comments. Also you can see comm
149
 
150
  = 1.1.0 =
151
  * First version
 
 
 
 
 
1
+ === CleanTalk. Cloud anti-spam ===
2
  Contributors: znaeff, default.asp, shagimuratov, aleontiev
3
+ Tags: spam, antispam, anti-spam, spambot, spam-bot, stop spam, spammers, spamfree, captcha, capcha, captha, catcha, recaptcha, comment, comments, math, cloud, blacklist
4
+ Requires at least: 3.0
 
5
  Tested up to: 3.6
6
+ Stable tag: 2.4.13
7
+ License: GPLv2
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ No spam in the comments. Cloud, smart, invisible anti-spam without CAPTCHA.
11
 
12
  == Description ==
13
+
14
+ = Features =
15
  1. Stops spam bots in the comments.
16
  1. Invisible spam protection for visitors.
17
+ 1. Anti-spam without CAPTCHA, math or Q&A.
18
 
19
+ Plugin filters spam bots in the comments of a blog without move to trash or approval queue. The plugin is not visible for visitors and administrators of a blog. The plugin doesn't use CAPTCHA or Q&A to stop spammers. It's simple and clever antispam for your blog.
20
 
21
  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.
22
 
23
+ This plugin is a client application for anti-spam cloud service <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.
24
+
25
+ = Requirements =
26
+ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and enabled 'allow_url_fopen' setting.
27
 
28
  == Installation ==
29
 
42
 
43
  = How plugin works? =
44
 
45
+ Plugin sends a comment's text and several previous approved comments to the cloud. Cloud evaluates the relevance of the comment's text on the topic, tests on spam and finaly provides a solution - to publish or put on manual moderation of comments. If a comment is placed on manual moderation, the plugin adds to the text of a comment explaining the reason for the ban server publishing.
46
 
47
  = Will plugin works with my theme? =
48
 
60
 
61
  == Screenshots ==
62
 
63
+ 1. The comment from spammer (sender blacklisted by IP/Email, comment text not relevant for the post) prohibited to place in the queue WordPress
64
+ 1. Antispam settings to filter spam bots. Just enter Access key and app ready to stop spammers at the blog.
65
+ 1. Not spam, not relevant to article comment has moved to approval.
66
 
67
  == Changelog ==
68
 
69
+ = 2.4.13 2013-08-19 =
70
+ * Changed: Switched HTTP requests from file_get_contents() to CURL. Added file_get_contens() as backup connection to the servers.
71
+ * Changed: Removed feedback requests for comments moved to trash.
72
+ * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.
73
+
74
  = 2.4.12 2013-08-12 =
75
  * Removed RPC::XML library from plugin.
76
  * Switched plugin to HTTP+JSON connection with servers.
160
 
161
  = 1.1.0 =
162
  * First version
163
+
164
+ == Upgrade Notice ==
165
+ = 2.4.13 2013-08-19 =
166
+ * Fixed: "Fail connect to servers..." error on hostings with disabled 'allow_url_fopen' PHP option.
167
+
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png DELETED
Binary file