Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.32

Version Description

2014-02-04 = * New: Added notice about automatically approved comment. The notice shows only for first approved comment and only for new commentators (without approved comments) of the blog.
* New: At WordPress console added banner for notices. * Changed: Screenshots updated.

Download this release

Release Info

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

Code changes from version 2.31 to 2.32

Files changed (4) hide show
  1. cleantalk.php +115 -9
  2. i18n/cleantalk-ru_RU.mo +0 -0
  3. readme.txt +12 -2
  4. screenshot-2.png +0 -0
cleantalk.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  Plugin Name: Anti-spam by CleanTalk
4
- Plugin URI: http://cleantalk.org/wordpress
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.31
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
- $ct_agent_version = 'wordpress-231';
12
  $ct_checkjs_frm = 'ct_checkjs_frm';
13
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
14
  $ct_session_request_id_label = 'request_id';
@@ -29,10 +29,26 @@ $ct_jp_active = false;
29
  // Default value for JS test
30
  $ct_checkjs_def = 0;
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  add_action('init', 'ct_init');
33
 
34
  // Comments
35
  add_filter('preprocess_comment', 'ct_check'); // param - comment data array
 
36
 
37
  // Formidable
38
  add_action('frm_validate_entry', 'ct_frm_validate_entry', 20, 2);
@@ -68,6 +84,8 @@ if (is_admin()) {
68
  add_filter('unspam_comment', 'ct_unspam_comment');
69
 
70
  add_action('delete_user', 'ct_delete_user');
 
 
71
  }
72
 
73
  /**
@@ -83,7 +101,6 @@ function ct_init() {
83
  add_action('wp_footer', 'ct_comment_form');
84
  } else {
85
  add_action('comment_form', 'ct_comment_form');
86
-
87
  }
88
  }
89
 
@@ -433,7 +450,7 @@ function ct_check($comment) {
433
  // this action is called just when WP process POST request (adds new comment)
434
  // this action is called by wp-comments-post.php
435
  // after processing WP makes redirect to post page with comment's form by GET request (see above)
436
- global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done;
437
 
438
  $options = ct_get_options();
439
  if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
@@ -588,6 +605,7 @@ function ct_check($comment) {
588
 
589
  if ($ct_result->allow == 1 && $options['autoPubRevelantMess'] == 1) {
590
  add_filter('pre_comment_approved', 'ct_set_approved');
 
591
  }
592
  if ($ct_result->allow == 0) {
593
  if (isset($ct_result->stop_words)) {
@@ -839,15 +857,22 @@ function ct_unmark_red($message) {
839
  * @return bool
840
  */
841
  function admin_notice_message(){
 
842
 
843
  if (ct_active() === false)
844
  return false;
845
 
846
  $options = ct_get_options();
847
- if (ct_valid_key($options['apikey']) === false) {
 
848
  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>';
849
  }
850
-
 
 
 
 
 
851
  ct_send_feedback();
852
 
853
  delete_spam_comments();
@@ -1291,7 +1316,6 @@ function ct_wpcf7_spam($spam) {
1291
  * Changes CF7 status message
1292
  * @param string $hook URL of hooked page
1293
  */
1294
-
1295
  function ct_wpcf7_display_message($message, $status) {
1296
  global $ct_cf7_comment;
1297
 
@@ -1322,8 +1346,52 @@ function ct_admin_add_page() {
1322
  * Admin action 'admin_init' - Add the admin settings and such
1323
  */
1324
  function ct_admin_init() {
1325
- ct_init_locale();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1326
 
 
 
 
 
1327
  ct_init_session();
1328
 
1329
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
@@ -1466,4 +1534,42 @@ function ct_settings_page() {
1466
  <?php
1467
  }
1468
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
  ?>
1
  <?php
2
  /*
3
  Plugin Name: Anti-spam by CleanTalk
4
+ Plugin URI: http://cleantalk.org/my
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.32
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
+ $ct_agent_version = 'wordpress-232';
12
  $ct_checkjs_frm = 'ct_checkjs_frm';
13
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
14
  $ct_session_request_id_label = 'request_id';
29
  // Default value for JS test
30
  $ct_checkjs_def = 0;
31
 
32
+ // COOKIE label to store request id for last approved
33
+ $ct_approved_request_id_label = 'ct_approved_request_id';
34
+
35
+ // Last request id approved for publication
36
+ $ct_approved_request_id = null;
37
+
38
+ // COOKIE label for trial notice flag
39
+ $ct_notice_trial_label = 'ct_notice_trial';
40
+
41
+ // Flag to show trial notice
42
+ $show_ct_notice_trial = false;
43
+
44
+ // Timeout before new check for trial notice in minutes
45
+ $trial_notice_check_timeout = 10;
46
+
47
  add_action('init', 'ct_init');
48
 
49
  // Comments
50
  add_filter('preprocess_comment', 'ct_check'); // param - comment data array
51
+ add_filter( 'comment_text', 'ct_comment_text' );
52
 
53
  // Formidable
54
  add_action('frm_validate_entry', 'ct_frm_validate_entry', 20, 2);
84
  add_filter('unspam_comment', 'ct_unspam_comment');
85
 
86
  add_action('delete_user', 'ct_delete_user');
87
+
88
+ add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
89
  }
90
 
91
  /**
101
  add_action('wp_footer', 'ct_comment_form');
102
  } else {
103
  add_action('comment_form', 'ct_comment_form');
 
104
  }
105
  }
106
 
450
  // this action is called just when WP process POST request (adds new comment)
451
  // this action is called by wp-comments-post.php
452
  // after processing WP makes redirect to post page with comment's form by GET request (see above)
453
+ global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label;
454
 
455
  $options = ct_get_options();
456
  if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
605
 
606
  if ($ct_result->allow == 1 && $options['autoPubRevelantMess'] == 1) {
607
  add_filter('pre_comment_approved', 'ct_set_approved');
608
+ setcookie($ct_approved_request_id_label, $ct_result->id, 0);
609
  }
610
  if ($ct_result->allow == 0) {
611
  if (isset($ct_result->stop_words)) {
857
  * @return bool
858
  */
859
  function admin_notice_message(){
860
+ global $ct_notice_trial_label, $show_ct_notice_trial;
861
 
862
  if (ct_active() === false)
863
  return false;
864
 
865
  $options = ct_get_options();
866
+ $show_notice = true;
867
+ if ($show_notice && ct_valid_key($options['apikey']) === false) {
868
  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>';
869
  }
870
+
871
+ if ($show_notice && $show_ct_notice_trial) {
872
+ echo '<div class="updated"><p>' . __("CleanTalk anti-spam trial period will end soon, please upgrade to <a href=\"http://cleantalk.org/my\" target=\"_blank\"><b>premium version</b></a>!", 'cleantalk') . '</p></div>';
873
+ $show_notice = false;
874
+ }
875
+
876
  ct_send_feedback();
877
 
878
  delete_spam_comments();
1316
  * Changes CF7 status message
1317
  * @param string $hook URL of hooked page
1318
  */
 
1319
  function ct_wpcf7_display_message($message, $status) {
1320
  global $ct_cf7_comment;
1321
 
1346
  * Admin action 'admin_init' - Add the admin settings and such
1347
  */
1348
  function ct_admin_init() {
1349
+ global $show_ct_notice_trial, $ct_notice_trial_label, $trial_notice_check_timeout;
1350
+
1351
+ $show_ct_notice_trial = false;
1352
+ if (isset($_COOKIE[$ct_notice_trial_label])) {
1353
+ if ($_COOKIE[$ct_notice_trial_label] == 1)
1354
+ $show_ct_notice_trial = true;
1355
+ } else {
1356
+ $options = ct_get_options();
1357
+ if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($options['apikey'])) {
1358
+ $url = 'https://cleantalk.org/app_notice';
1359
+ $server_timeout = 1;
1360
+ $data['auth_key'] = $options['apikey'];
1361
+ $data['param'] = 'notice_paid_till';
1362
+
1363
+ $ch = curl_init();
1364
+ curl_setopt($ch, CURLOPT_URL, $url);
1365
+ curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
1366
+ curl_setopt($ch, CURLOPT_POST, true);
1367
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
1368
+
1369
+ // receive server response ...
1370
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1371
+ // resolve 'Expect: 100-continue' issue
1372
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
1373
+
1374
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
1375
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
1376
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
1377
+
1378
+ $result = curl_exec($ch);
1379
+ curl_close($ch);
1380
+
1381
+ if ($result) {
1382
+ $result = json_decode($result, true);
1383
+ if (isset($result['show_notice']) && $result['show_notice'] == 1) {
1384
+ if (isset($result['trial']) && $result['trial'] == 1) {
1385
+ $show_ct_notice_trial = true;
1386
+ }
1387
+ }
1388
+ }
1389
+ }
1390
 
1391
+ setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"));
1392
+ }
1393
+
1394
+ ct_init_locale();
1395
  ct_init_session();
1396
 
1397
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
1534
  <?php
1535
  }
1536
 
1537
+ /**
1538
+ * Notice for commentators which comment has automatically approved by plugin
1539
+ * @param string $hook URL of hooked page
1540
+ */
1541
+ function ct_comment_text($comment_text) {
1542
+ global $comment, $ct_approved_request_id_label;
1543
+
1544
+
1545
+ if (isset($_COOKIE[$ct_approved_request_id_label])) {
1546
+ $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1547
+
1548
+ if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
1549
+ ct_init_locale();
1550
+ $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
1551
+ }
1552
+
1553
+ }
1554
+
1555
+ return $comment_text;
1556
+ }
1557
+
1558
+
1559
+ /**
1560
+ * Manage links and plugins page
1561
+ * @return array
1562
+ */
1563
+ if (!function_exists ( 'ct_register_plugin_links')) {
1564
+ function ct_register_plugin_links($links, $file) {
1565
+ $base = plugin_basename(__FILE__);
1566
+ if ( $file == $base ) {
1567
+ $links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings','cleantalk' ) . '</a>';
1568
+ $links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1569
+ $links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
1570
+ }
1571
+ return $links;
1572
+ }
1573
+ }
1574
+
1575
  ?>
i18n/cleantalk-ru_RU.mo DELETED
Binary file
readme.txt CHANGED
@@ -3,11 +3,11 @@ Contributors: znaeff, shagimuratov
3
  Tags: antispam, anti-spam, anti spam, spam, captcha, comment, comments, wpmu, network, multisite, forms, registration, login, contact form, buddypress, bbpress, admin, user, users, post, posts, wordpress, javascript, plugin, blacklists, cloud, math, signup, akismet, JetPack, WooCommerce
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
- Stable tag: 2.31
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Cloud anti-spam for comments, signups and contacts.
11
 
12
  == Description ==
13
  No CAPTCHA, no questions, no counting animals, no puzzles, no math.
@@ -93,6 +93,11 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
93
 
94
  == Changelog ==
95
 
 
 
 
 
 
96
  = 2.31 2014-01-24 =
97
  * New: Added spam protection for JetPack comments
98
  * Fixed: cURL connection issue "Expect: 100-continue"
@@ -241,6 +246,11 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
241
  * First version
242
 
243
  == Upgrade Notice ==
 
 
 
 
 
244
  = 2.31 2014-01-24 =
245
  * New: Added spam protection for JetPack comments
246
  * Fixed: CURL connection issue "Expect: 100-continue"
3
  Tags: antispam, anti-spam, anti spam, spam, captcha, comment, comments, wpmu, network, multisite, forms, registration, login, contact form, buddypress, bbpress, admin, user, users, post, posts, wordpress, javascript, plugin, blacklists, cloud, math, signup, akismet, JetPack, WooCommerce
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
+ Stable tag: 2.32
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Anti-spam for comments, signups and contacts.
11
 
12
  == Description ==
13
  No CAPTCHA, no questions, no counting animals, no puzzles, no math.
93
 
94
  == Changelog ==
95
 
96
+ = 2.32 2014-02-04 =
97
+ * New: Added notice about automatically approved comment. The notice shows only for first approved comment and only for new commentators (without approved comments) of the blog.
98
+ * New: At WordPress console added banner for notices.
99
+ * Changed: Screenshots updated.
100
+
101
  = 2.31 2014-01-24 =
102
  * New: Added spam protection for JetPack comments
103
  * Fixed: cURL connection issue "Expect: 100-continue"
246
  * First version
247
 
248
  == Upgrade Notice ==
249
+ = 2.32 2014-02-04 =
250
+ * New: Added notice about automatically approved comment. The notice shows only for first approved comment and only for new commentators (without approved comments) of the blog.
251
+ * New: At WordPress console added banner for notices.
252
+ * Changed: Screenshots updated.
253
+
254
  = 2.31 2014-01-24 =
255
  * New: Added spam protection for JetPack comments
256
  * Fixed: CURL connection issue "Expect: 100-continue"
screenshot-2.png CHANGED
Binary file