Spam protection, AntiSpam, FireWall by CleanTalk - Version 2.35

Version Description

2014-03-12 = * New: Notifications about disabled account * New: Improved JavaScript spam test. * Fixed: Code optimization * Fixed: JavaScript test for signups.

Download this release

Release Info

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

Code changes from version 2.33 to 2.35

Files changed (4) hide show
  1. cleantalk.php +378 -412
  2. i18n/cleantalk-es_ES.mo +0 -0
  3. i18n/cleantalk-ru_RU.mo +0 -0
  4. readme.txt +13 -1
cleantalk.php CHANGED
@@ -3,15 +3,16 @@
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.33
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
- $ct_agent_version = 'wordpress-233';
12
  $ct_checkjs_frm = 'ct_checkjs_frm';
13
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
14
  $ct_session_request_id_label = 'request_id';
 
15
 
16
  $ct_checkjs_cf7 = 'ct_checkjs_cf7';
17
  $ct_cf7_comment = 'This is a spam!';
@@ -26,7 +27,7 @@ $ct_comment_done = false;
26
  // JetPack active
27
  $ct_jp_active = false;
28
 
29
- // Default value for JS test
30
  $ct_checkjs_def = 0;
31
 
32
  // COOKIE label to store request id for last approved
@@ -44,10 +45,14 @@ $show_ct_notice_trial = false;
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
@@ -71,6 +76,10 @@ add_filter('wpcf7_spam', 'ct_wpcf7_spam');
71
  add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
72
  add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
73
 
 
 
 
 
74
  if (is_admin()) {
75
  add_action('admin_init', 'ct_admin_init', 1);
76
  add_action('admin_menu', 'ct_admin_add_page');
@@ -82,9 +91,9 @@ if (is_admin()) {
82
  add_action('comment_approved_to_spam', 'ct_comment_spam'); // param - comment object
83
  add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
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
 
@@ -93,15 +102,22 @@ if (is_admin()) {
93
  * @return mixed[] Array of options
94
  */
95
  function ct_init() {
96
- global $ct_jp_active;
97
-
98
- $jetpack_active_modules = get_option('jetpack_active_modules');
99
- if (class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)) {
100
- $ct_jp_active = true;
101
- add_action('wp_footer', 'ct_comment_form');
102
- } else {
103
- add_action('comment_form', 'ct_comment_form');
104
- }
 
 
 
 
 
 
 
105
  }
106
 
107
  /**
@@ -161,7 +177,7 @@ function ct_feedback($hash, $message = null, $allow) {
161
 
162
  require_once('cleantalk.class.php');
163
  $options = ct_get_options();
164
-
165
  $config = get_option('cleantalk_server');
166
 
167
  $ct = new Cleantalk();
@@ -170,21 +186,22 @@ function ct_feedback($hash, $message = null, $allow) {
170
  $ct->server_ttl = $config['ct_server_ttl'];
171
  $ct->server_changed = $config['ct_server_changed'];
172
 
173
- if (empty($hash)) {
174
- $hash = $ct->getCleantalkCommentHash($message);
175
- }
176
  if ($message !== null) {
177
- $resultMessage = $ct->delCleantalkComment($message);
 
 
 
 
 
 
 
 
178
  }
179
-
180
- $ct_feedback = $hash . ':' . $allow . ';';
181
- if (empty($_SESSION['feedback_request'])) {
182
- $_SESSION['feedback_request'] = $ct_feedback;
183
- } else {
184
- $_SESSION['feedback_request'] .= $ct_feedback;
185
- }
186
 
187
- return $resultMessage;
188
  }
189
 
190
  /**
@@ -193,50 +210,44 @@ function ct_feedback($hash, $message = null, $allow) {
193
  * @return bool
194
  */
195
  function ct_send_feedback($feedback_request = null) {
196
-
197
- if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
198
- $feedback_request = $_SESSION['feedback_request'];
199
- unset($_SESSION['feedback_request']);
200
- }
201
-
202
- if ($feedback_request !== null) {
203
- require_once('cleantalk.class.php');
204
- $options = ct_get_options();
205
-
206
- $config = get_option('cleantalk_server');
207
-
208
- $ct = new Cleantalk();
209
- $ct->work_url = $config['ct_work_url'];
210
- $ct->server_url = $options['server'];
211
- $ct->server_ttl = $config['ct_server_ttl'];
212
- $ct->server_changed = $config['ct_server_changed'];
213
-
214
- $ct_request = new CleantalkRequest();
215
- $ct_request->auth_key = $options['apikey'];
216
- $ct_request->feedback = $feedback_request;
217
-
218
- $ct->sendFeedback($ct_request);
219
-
220
- if ($ct->server_change) {
221
- update_option(
222
- 'cleantalk_server', array(
223
- 'ct_work_url' => $ct->work_url,
224
- 'ct_server_ttl' => $ct->server_ttl,
225
- 'ct_server_changed' => time()
226
- )
227
- );
228
- }
229
- return true;
230
  }
231
-
232
- return false;
233
- }
234
 
235
- /**
236
- * Public action 'init' - Inits locale
237
- */
238
- function ct_init_locale() {
239
- load_plugin_textdomain('cleantalk', false, basename(dirname(__FILE__)) . '/i18n');
240
  }
241
 
242
  /**
@@ -252,6 +263,79 @@ function ct_init_session() {
252
  return null;
253
  }
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  /**
256
  * Adds hidden filed to comment form
257
  */
@@ -259,14 +343,14 @@ function ct_comment_form() {
259
  if (ct_is_user_enable() === false) {
260
  return false;
261
  }
262
-
263
  $options = ct_get_options();
264
  if ($options['comments_test'] == 0) {
265
  return false;
266
  }
267
-
268
  ct_add_hidden_fields(0, 'ct_checkjs', false);
269
-
270
  return null;
271
  }
272
 
@@ -275,13 +359,13 @@ function ct_comment_form() {
275
  * @param int $post_id Post ID, not used
276
  */
277
  function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_string = false) {
278
- global $ct_jp_active, $ct_checkjs_def;
279
 
280
  $ct_checkjs_key = ct_get_checkjs_value();
281
  ct_init_session();
282
  $_SESSION['formtime'] = time();
283
-
284
- if ($ct_jp_active) {
285
  $html = '
286
  <script type="text/javascript">
287
  // <![CDATA[
@@ -296,7 +380,7 @@ function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_
296
  </script>
297
  ';
298
  $html = sprintf($html, $field_name, $ct_checkjs_key);
299
- } else {
300
  $field_id = $field_name . '_' . md5(rand(0, 1000));
301
  $html = '
302
  <input type="hidden" id="%s" name="%s" value="0" />
@@ -307,7 +391,7 @@ function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_
307
  </script>
308
  ';
309
  $html = sprintf($html, $field_id, $field_name, $field_id, $field_id, $ct_checkjs_def, $ct_checkjs_key);
310
- }
311
  if ($return_string === true) {
312
  return $html;
313
  } else {
@@ -325,7 +409,7 @@ function ct_is_user_enable() {
325
  if (!isset($current_user->roles)) {
326
  return true;
327
  }
328
-
329
  $disable_roles = array('administrator', 'editor', 'author');
330
  foreach ($current_user->roles as $k => $v) {
331
  if (in_array($v, $disable_roles))
@@ -341,23 +425,23 @@ function ct_is_user_enable() {
341
  */
342
  function ct_frm_entries_footer_scripts($fields, $form) {
343
  global $current_user, $ct_checkjs_frm;
344
-
345
  $options = ct_get_options();
346
  if ($options['contact_forms_test'] == 0) {
347
  return false;
348
  }
349
-
350
  $ct_checkjs_key = ct_get_checkjs_value();
351
  $ct_frm_name = 'form_' . $form->form_key;
352
-
353
  ?>
354
-
355
  var input = document.createElement("input");
356
  input.setAttribute("type", "hidden");
357
  input.setAttribute("name", "<?php echo $ct_checkjs_frm; ?>");
358
  input.setAttribute("value", "<?php echo $ct_checkjs_key; ?>");
359
  document.getElementById("<?php echo $ct_frm_name; ?>").appendChild(input);
360
-
361
  <?php
362
  }
363
 
@@ -367,32 +451,19 @@ function ct_frm_entries_footer_scripts($fields, $form) {
367
  */
368
  function ct_frm_validate_entry ($errors, $values) {
369
  global $wpdb, $current_user, $ct_agent_version, $ct_checkjs_frm;
370
-
371
  $options = ct_get_options();
372
  if ($options['contact_forms_test'] == 0) {
373
  return false;
374
  }
375
 
376
- $checkjs = js_test($ct_checkjs_frm);
377
-
378
- require_once('cleantalk.class.php');
379
 
380
- $example = null;
381
- $blog_lang = substr(get_locale(), 0, 2);
382
- $user_info = array(
383
- 'cms_lang' => $blog_lang,
384
- 'REFFERRER' => @$_SERVER['HTTP_REFERER'],
385
- 'USER_AGENT' => @$_SERVER['HTTP_USER_AGENT'],
386
- );
387
- $user_info = json_encode($user_info);
388
- if ($user_info === false)
389
- $user_info = '';
390
-
391
  $post_info['comment_type'] = 'feedback';
392
  $post_info = json_encode($post_info);
393
  if ($post_info === false)
394
  $post_info = '';
395
-
396
  $sender_email = null;
397
  $message = '';
398
  foreach ($values['item_meta'] as $v) {
@@ -403,41 +474,21 @@ function ct_frm_validate_entry ($errors, $values) {
403
  $message .= ' ' . $v;
404
  }
405
 
406
- $config = get_option('cleantalk_server');
 
 
 
 
 
 
 
 
 
407
 
408
- $ct = new Cleantalk();
409
- $ct->work_url = $config['ct_work_url'];
410
- $ct->server_url = $options['server'];
411
- $ct->server_ttl = $config['ct_server_ttl'];
412
- $ct->server_changed = $config['ct_server_changed'];
413
-
414
- $ct_request = new CleantalkRequest();
415
-
416
- $ct_request->auth_key = $options['apikey'];
417
- $ct_request->message = $message;
418
- $ct_request->example = $example;
419
- $ct_request->sender_email = $sender_email;
420
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
421
- $ct_request->agent = $ct_agent_version;
422
- $ct_request->sender_info = $user_info;
423
- $ct_request->js_on = $checkjs;
424
- $ct_request->post_info = $post_info;
425
-
426
- $ct_result = $ct->isAllowMessage($ct_request);
427
- if ($ct->server_change) {
428
- update_option(
429
- 'cleantalk_server', array(
430
- 'ct_work_url' => $ct->work_url,
431
- 'ct_server_ttl' => $ct->server_ttl,
432
- 'ct_server_changed' => time()
433
- )
434
- );
435
- }
436
-
437
  if ($ct_result->spam == 1) {
438
  $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
439
  }
440
-
441
  return $errors;
442
  }
443
 
@@ -446,17 +497,17 @@ function ct_frm_validate_entry ($errors, $values) {
446
  * @param mixed[] $comment Comment data array
447
  * @return mixed[] New data array of comment
448
  */
449
- function ct_check($comment) {
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) {
457
  return $comment;
458
  }
459
-
460
  $local_blacklists = wp_blacklist_check(
461
  $comment['comment_author'],
462
  $comment['comment_author_email'],
@@ -465,138 +516,94 @@ function ct_check($comment) {
465
  @$_SERVER['REMOTE_ADDR'],
466
  @$_SERVER['HTTP_USER_AGENT']
467
  );
468
-
469
  // Go out if author in local blacklists
470
  if ($local_blacklists === true) {
471
  return $comment;
472
  }
473
-
474
  $wp_host = null;
475
  if (preg_match("@^(?:https?://)([^/:]+)@i", get_permalink($comment['comment_post_ID']), $matches))
476
  $wp_host = $matches[1];
477
-
478
  $author_host = null;
479
  if (preg_match("@^(?:https?://)([^/:]+)@i", $comment['comment_author_url'], $matches))
480
  $author_host = $matches[1];
481
-
482
  // Skip tests for selfmade pingback's
483
  if ($comment['comment_type'] == 'pingback' && $wp_host !== null && $wp_host === $author_host) {
484
  return $comment;
485
  }
486
-
487
- $ct_comment_done = true;
488
 
489
  $comment_post_id = $comment['comment_post_ID'];
490
 
491
  $post = get_post($comment_post_id);
492
 
493
- $checkjs = js_test('ct_checkjs');
494
-
495
- ct_init_session();
496
- if (array_key_exists('formtime', $_SESSION)) {
497
- $submit_time = time() - (int) $_SESSION['formtime'];
498
- } else {
499
- $submit_time = null;
500
- }
501
 
502
- $example = null;
503
- if (function_exists('json_encode')) {
504
- $blog_lang = substr(get_locale(), 0, 2);
505
- $user_info = array(
506
- 'cms_lang' => $blog_lang,
507
- 'REFFERRER' => @$_SERVER['HTTP_REFERER'],
508
- 'USER_AGENT' => @$_SERVER['HTTP_USER_AGENT'],
509
- 'sender_url' => $comment['comment_author_url'],
510
- );
511
-
512
- $user_info = json_encode($user_info);
513
- if ($user_info === false)
514
- $user_info = '';
515
-
516
- $post_info['comment_type'] = $comment['comment_type'];
517
- $post_info['post_url'] = ct_post_url(null, $comment_post_id);
518
-
519
- $post_info = json_encode($post_info);
520
- if ($post_info === false)
521
- $post_info = '';
522
-
523
- if ($post !== null){
524
- $example['title'] = $post->post_title;
525
- $example['body'] = $post->post_content;
526
- $example['comments'] = null;
527
-
528
- $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
529
- foreach ($last_comments as $post_comment){
530
- $example['comments'] .= "\n\n" . $post_comment->comment_content;
531
- }
532
-
533
- $example = json_encode($example);
534
- }
535
- }
536
-
537
- // Use plain string format if've failed with JSON
538
- if ($example === false || $example === null){
539
- $example = ($post->post_title !== null) ? $post->post_title : '';
540
- $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
541
- }
542
 
543
- require_once('cleantalk.class.php');
 
544
 
545
- $config = get_option('cleantalk_server');
 
 
546
 
547
- $ct = new Cleantalk();
548
- $ct->work_url = $config['ct_work_url'];
549
- $ct->server_url = $options['server'];
550
- $ct->server_ttl = $config['ct_server_ttl'];
551
- $ct->server_changed = $config['ct_server_changed'];
552
 
553
- $ct_request = new CleantalkRequest();
 
 
 
554
 
555
- $ct_request->auth_key = $options['apikey'];
556
- $ct_request->message = $comment['comment_content'];
557
- $ct_request->example = $example;
558
- $ct_request->sender_email = $comment['comment_author_email'];
559
- $ct_request->sender_nickname = $comment['comment_author'];
560
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
561
- $ct_request->agent = $ct_agent_version;
562
- $ct_request->sender_info = $user_info;
563
- $ct_request->js_on = $checkjs;
564
- $ct_request->submit_time = $submit_time;
565
- $ct_request->post_info = $post_info;
566
 
567
- $ct_result = $ct->isAllowMessage($ct_request);
568
- if ($ct->server_change) {
569
- update_option(
570
- 'cleantalk_server', array(
571
- 'ct_work_url' => $ct->work_url,
572
- 'ct_server_ttl' => $ct->server_ttl,
573
- 'ct_server_changed' => time()
574
- )
575
- );
576
  }
577
 
 
 
 
 
 
 
 
 
 
 
 
578
  if ($ct_result->stop_queue == 1) {
579
  $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
580
  $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
581
  wp_die($err_text, 'Blacklisted', array('back_link' => true));
582
 
583
  return $comment;
584
- }
585
-
586
  ct_hash($ct_result->id);
587
 
588
  if ($ct_result->spam == 1) {
589
  $comment['comment_content'] = $ct->addCleantalkComment($comment['comment_content'], $ct_result->comment);
590
  add_filter('pre_comment_approved', 'ct_set_comment_spam');
591
-
592
  global $ct_comment;
593
  $ct_comment = $ct_result->comment;
594
  add_action('comment_post', 'ct_die', 12, 2);
595
  add_action('comment_post', 'ct_set_meta', 10, 2);
596
-
597
  return $comment;
598
  }
599
-
600
  if (isset($comment['comment_author_email'])) {
601
  $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
602
 
@@ -613,15 +620,15 @@ function ct_check($comment) {
613
  $ct_stop_words = $ct_result->stop_words;
614
  add_action('comment_post', 'ct_mark_red', 11, 2);
615
  }
616
-
617
  $comment['comment_content'] = $ct->addCleantalkComment($comment['comment_content'], $ct_result->comment);
618
  add_filter('pre_comment_approved', 'ct_set_not_approved');
619
  }
620
-
621
  add_action('comment_post', 'ct_set_meta', 10, 2);
622
  }
623
  }
624
-
625
  return $comment;
626
  }
627
 
@@ -638,29 +645,28 @@ function ct_die($comment_id, $comment_status) {
638
  wp_die($err_text, 'Blacklisted', array('back_link' => true));
639
  }
640
 
641
-
642
  /**
643
  *
644
  *
645
  */
646
  function js_test($field_name = 'ct_checkjs') {
647
  $checkjs = null;
648
- $js_field = null;
649
- if (isset($_POST[$field_name]))
650
- $js_field = $_POST[$field_name];
651
-
652
- if (isset($_COOKIE[$field_name])) {
653
- $js_field = $_COOKIE[$field_name];
654
- }
655
 
656
  if ($js_field !== null) {
657
  if($js_field == ct_get_checkjs_value()) {
658
  $checkjs = 1;
659
  } else {
660
- $checkjs = 0;
661
  }
662
  }
663
-
664
  return $checkjs;
665
  }
666
 
@@ -671,21 +677,21 @@ function js_test($field_name = 'ct_checkjs') {
671
  * @return string|bool
672
  */
673
  function ct_post_url($comment_id = null, $comment_post_id) {
674
-
675
- if (empty($comment_post_id))
676
- return null;
677
 
678
- if ($comment_id === null) {
679
- $last_comment = get_comments('number=1');
680
- $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
681
- }
682
- $permalink = get_permalink($comment_post_id);
 
 
 
683
 
684
- $post_url = null;
685
- if ($permalink !== null)
686
- $post_url = $permalink . '#comment-' . $comment_id;
687
 
688
- return $post_url;
689
  }
690
 
691
  /**
@@ -719,28 +725,21 @@ function ct_set_comment_spam() {
719
  * @param mixed $comment_status Approval status ("spam", or 0/1), not used
720
  */
721
  function ct_set_meta($comment_id, $comment_status) {
722
- /* update_comment_meta($comment_id, 'ct_hash', 'huz');
723
- return; */
724
-
725
- global $comment_post_id;
726
-
727
  $hash1 = ct_hash();
728
  if (!empty($hash1)) {
729
  update_comment_meta($comment_id, 'ct_hash', $hash1);
730
-
731
  if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
732
- $post_url = ct_post_url($comment_id, $comment_post_id);
733
- $post_url = base64_encode($post_url);
734
- if ($post_url === false)
735
- return false;
736
-
737
- // 01 - URL to approved comment
738
- $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
739
- ct_send_feedback($feedback_request);
740
- }
741
  }
742
-
743
- return true;
744
  }
745
 
746
  /**
@@ -755,7 +754,7 @@ function ct_comment_approved($comment_object) {
755
  $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
756
  $comment['comment_approved'] = 1;
757
  wp_update_comment($comment);
758
-
759
  return true;
760
  }
761
 
@@ -770,7 +769,7 @@ function ct_comment_unapproved($comment_object) {
770
  ct_feedback($hash, $comment['comment_content'], 0);
771
  $comment['comment_approved'] = 0;
772
  wp_update_comment($comment);
773
-
774
  return true;
775
  }
776
 
@@ -791,7 +790,7 @@ function ct_comment_spam($comment_object) {
791
 
792
 
793
  /**
794
- * Unspam comment
795
  * @param type $comment_id
796
  */
797
  function ct_unspam_comment($comment_id) {
@@ -800,7 +799,7 @@ function ct_unspam_comment($comment_id) {
800
  $hash = get_comment_meta($comment_id, 'ct_hash', true);
801
  $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
802
  $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
803
-
804
  wp_update_comment($comment);
805
  }
806
 
@@ -859,8 +858,8 @@ function ct_unmark_red($message) {
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;
@@ -874,10 +873,10 @@ function admin_notice_message(){
874
  }
875
 
876
  ct_send_feedback();
877
-
878
  delete_spam_comments();
879
 
880
- return true;
881
  }
882
 
883
  /**
@@ -898,7 +897,7 @@ function ct_valid_key($apikey = null) {
898
  $apikey = $options['apikey'];
899
  }
900
 
901
- return ($apikey === 'enter key' || $apikey === '') ? false : true;
902
  }
903
 
904
  /**
@@ -906,13 +905,13 @@ function ct_valid_key($apikey = null) {
906
  * @return bool
907
  */
908
  function ct_active(){
909
- $ct_active = false;
910
- foreach (get_option('active_plugins') as $k => $v) {
911
  if (preg_match("/cleantalk.php$/", $v))
912
- $ct_active = true;
913
- }
914
 
915
- return $ct_active;
916
  }
917
  /**
918
  * Tests plugin activation status
@@ -933,8 +932,7 @@ function ct_plugin_active($plugin_name){
933
  */
934
  function ct_get_checkjs_value() {
935
  $options = ct_get_options();
936
-
937
- return md5($options['apikey'] . '+' . get_settings('admin_email'));
938
  }
939
 
940
  /**
@@ -943,7 +941,7 @@ function ct_get_checkjs_value() {
943
  */
944
  function delete_spam_comments() {
945
  $options = ct_get_options();
946
-
947
  if ($options['remove_old_spam'] == 1) {
948
  $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
949
  foreach ($last_comments as $c) {
@@ -964,7 +962,7 @@ function delete_spam_comments() {
964
  */
965
  function ct_register_form() {
966
  global $ct_checkjs_register_form;
967
-
968
  $options = ct_get_options();
969
  if ($options['registrations_test'] == 0) {
970
  return false;
@@ -975,13 +973,34 @@ function ct_register_form() {
975
  return null;
976
  }
977
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
978
  /**
979
  * Test users registration
980
  * @return array with errors
981
  */
982
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
983
- global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $bp;
984
-
985
  //
986
  // BuddyPress actions
987
  //
@@ -1000,8 +1019,8 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1000
  return $errors;
1001
  }
1002
 
1003
- $checkjs = js_test($ct_checkjs_register_form);
1004
-
1005
  require_once('cleantalk.class.php');
1006
 
1007
  $blog_lang = substr(get_locale(), 0, 2);
@@ -1013,9 +1032,9 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1013
  $user_info = json_encode($user_info);
1014
  if ($user_info === false)
1015
  $user_info = '';
1016
-
1017
  $sender_email = $user_email;
1018
-
1019
  $config = get_option('cleantalk_server');
1020
 
1021
  $ct = new Cleantalk();
@@ -1044,22 +1063,36 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1044
  )
1045
  );
1046
  }
1047
-
1048
  if ($ct_result->errno != 0) {
1049
  return $errors;
1050
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1051
 
1052
  if ($ct_result->allow == 0) {
1053
- $wordpress_domain = preg_replace("/^https?:\/\//", "", site_url());
1054
  if ($buddypress === true) {
1055
  $bp->signup->errors['signup_username'] = $ct_result->comment;
1056
  } else {
1057
- $errors->add('ct_error', __($ct_result->comment, $wordpress_domain));
1058
  }
1059
  } else {
1060
  if ($ct_result->id !== null) {
1061
- ct_init_session();
1062
  $_SESSION[$ct_session_request_id_label] = $ct_result->id;
 
1063
  }
1064
  }
1065
 
@@ -1073,9 +1106,10 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
1073
  function ct_user_register($user_id) {
1074
  global $ct_session_request_id_label;
1075
 
 
1076
  if (isset($_SESSION[$ct_session_request_id_label])) {
1077
  update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
1078
- unset($_SESSION[$ct_session_request_id_label]);
1079
  }
1080
  }
1081
 
@@ -1095,10 +1129,10 @@ function ct_delete_user($user_id) {
1095
  */
1096
  function ct_grunion_contact_form_field_html($r, $field_label) {
1097
  global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields;
1098
-
1099
  $options = ct_get_options();
1100
  if ($options['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match("/[text|email]/i", $r)) {
1101
-
1102
  // Looking for element name prefix
1103
  $name_patched = false;
1104
  foreach ($ct_jpcf_fields as $v) {
@@ -1111,7 +1145,7 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
1111
  $r .= ct_add_hidden_fields(0, $ct_checkjs_jpcf, true);
1112
  $ct_jpcf_patched = true;
1113
  }
1114
-
1115
  return $r;
1116
  }
1117
  /**
@@ -1121,89 +1155,58 @@ function ct_contact_form_is_spam($form) {
1121
  global $ct_checkjs_jpcf;
1122
 
1123
  $options = ct_get_options();
1124
-
1125
  if ($options['contact_forms_test'] == 0) {
1126
  return null;
1127
  }
1128
-
1129
  $js_field_name = $ct_checkjs_jpcf;
1130
  foreach ($_POST as $k => $v) {
1131
  if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
1132
  $js_field_name = $k;
1133
  }
1134
- $checkjs = js_test($js_field_name);
1135
-
1136
- require_once('cleantalk.class.php');
1137
 
1138
- $example = null;
1139
- $blog_lang = substr(get_locale(), 0, 2);
1140
- $user_info = array(
1141
- 'cms_lang' => $blog_lang,
1142
- 'REFFERRER' => @$_SERVER['HTTP_REFERER'],
1143
- 'USER_AGENT' => @$_SERVER['HTTP_USER_AGENT'],
1144
- 'sender_url' => @$form['comment_author_url'],
1145
  );
1146
 
1147
- $user_info = json_encode($user_info);
1148
- if ($user_info === false)
1149
- $user_info = '';
1150
-
1151
  $post_info['comment_type'] = 'feedback';
1152
  $post_info = json_encode($post_info);
1153
  if ($post_info === false)
1154
  $post_info = '';
1155
-
1156
  $sender_email = null;
1157
  $sender_nickname = null;
1158
  $message = '';
1159
  if (isset($form['comment_author_email']))
1160
  $sender_email = $form['comment_author_email'];
1161
-
1162
  if (isset($form['comment_author']))
1163
  $sender_nickname = $form['comment_author'];
1164
-
1165
  if (isset($form['comment_content']))
1166
  $message = $form['comment_content'];
1167
 
1168
- $config = get_option('cleantalk_server');
1169
-
1170
- $ct = new Cleantalk();
1171
- $ct->work_url = $config['ct_work_url'];
1172
- $ct->server_url = $options['server'];
1173
- $ct->server_ttl = $config['ct_server_ttl'];
1174
- $ct->server_changed = $config['ct_server_changed'];
1175
-
1176
- $ct_request = new CleantalkRequest();
 
 
1177
 
1178
- $ct_request->auth_key = $options['apikey'];
1179
- $ct_request->message = $message;
1180
- $ct_request->example = $example;
1181
- $ct_request->sender_email = $sender_email;
1182
- $ct_request->sender_nickname = $sender_nickname;
1183
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
1184
- $ct_request->agent = $ct_agent_version;
1185
- $ct_request->sender_info = $user_info;
1186
- $ct_request->js_on = $checkjs;
1187
- $ct_request->post_info = $post_info;
1188
-
1189
- $ct_result = $ct->isAllowMessage($ct_request);
1190
-
1191
- if ($ct->server_change) {
1192
- update_option(
1193
- 'cleantalk_server', array(
1194
- 'ct_work_url' => $ct->work_url,
1195
- 'ct_server_ttl' => $ct->server_ttl,
1196
- 'ct_server_changed' => time()
1197
- )
1198
- );
1199
- }
1200
  if ($ct_result->spam == 1) {
1201
  global $ct_comment;
1202
  $ct_comment = $ct_result->comment;
1203
  ct_die(null, null);
1204
  exit;
1205
  }
1206
-
1207
  return (bool) $ct_result->spam;
1208
  }
1209
 
@@ -1233,31 +1236,18 @@ function ct_wpcf7_spam($spam) {
1233
  $options = ct_get_options();
1234
  if ($spam === true)
1235
  return $spam;
1236
-
1237
  if ($options['contact_forms_test'] == 0) {
1238
  return $spam;
1239
  }
1240
 
1241
- $checkjs = js_test($ct_checkjs_cf7);
1242
-
1243
- require_once('cleantalk.class.php');
1244
 
1245
- $example = null;
1246
- $blog_lang = substr(get_locale(), 0, 2);
1247
- $user_info = array(
1248
- 'cms_lang' => $blog_lang,
1249
- 'REFFERRER' => @$_SERVER['HTTP_REFERER'],
1250
- 'USER_AGENT' => @$_SERVER['HTTP_USER_AGENT'],
1251
- );
1252
- $user_info = json_encode($user_info);
1253
- if ($user_info === false)
1254
- $user_info = '';
1255
-
1256
  $post_info['comment_type'] = 'feedback';
1257
  $post_info = json_encode($post_info);
1258
  if ($post_info === false)
1259
  $post_info = '';
1260
-
1261
  $sender_email = null;
1262
  $sender_nickname = null;
1263
  $message = '';
@@ -1272,44 +1262,24 @@ function ct_wpcf7_spam($spam) {
1272
  $sender_nickname = $v;
1273
  }
1274
  }
1275
-
1276
- $config = get_option('cleantalk_server');
1277
-
1278
- $ct = new Cleantalk();
1279
- $ct->work_url = $config['ct_work_url'];
1280
- $ct->server_url = $options['server'];
1281
- $ct->server_ttl = $config['ct_server_ttl'];
1282
- $ct->server_changed = $config['ct_server_changed'];
1283
-
1284
- $ct_request = new CleantalkRequest();
1285
 
1286
- $ct_request->auth_key = $options['apikey'];
1287
- $ct_request->message = $message;
1288
- $ct_request->example = $example;
1289
- $ct_request->sender_email = $sender_email;
1290
- $ct_request->sender_nickname = $sender_nickname;
1291
- $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
1292
- $ct_request->agent = $ct_agent_version;
1293
- $ct_request->sender_info = $user_info;
1294
- $ct_request->js_on = $checkjs;
1295
- $ct_request->post_info = $post_info;
1296
 
1297
- $ct_result = $ct->isAllowMessage($ct_request);
1298
- if ($ct->server_change) {
1299
- update_option(
1300
- 'cleantalk_server', array(
1301
- 'ct_work_url' => $ct->work_url,
1302
- 'ct_server_ttl' => $ct->server_ttl,
1303
- 'ct_server_changed' => time()
1304
- )
1305
- );
1306
- }
1307
  if ($ct_result->spam == 1) {
1308
  $spam = true;
1309
  $ct_cf7_comment = $ct_result->comment;
1310
  add_filter('wpcf7_display_message', 'ct_wpcf7_display_message', 10, 2);
1311
  }
1312
-
1313
  return $spam;
1314
  }
1315
  /**
@@ -1322,7 +1292,7 @@ function ct_wpcf7_display_message($message, $status) {
1322
  if ($status == 'spam') {
1323
  $message = $ct_cf7_comment;
1324
  }
1325
-
1326
  return $message;
1327
  }
1328
 
@@ -1347,7 +1317,7 @@ function ct_admin_add_page() {
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)
@@ -1365,12 +1335,12 @@ function ct_admin_init() {
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
 
@@ -1390,7 +1360,6 @@ function ct_admin_init() {
1390
  setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"));
1391
  }
1392
 
1393
- ct_init_locale();
1394
  ct_init_session();
1395
 
1396
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
@@ -1539,16 +1508,13 @@ function ct_settings_page() {
1539
  */
1540
  function ct_comment_text($comment_text) {
1541
  global $comment, $ct_approved_request_id_label;
1542
-
1543
-
1544
  if (isset($_COOKIE[$ct_approved_request_id_label])) {
1545
  $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1546
 
1547
  if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
1548
- ct_init_locale();
1549
- $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
1550
  }
1551
-
1552
  }
1553
 
1554
  return $comment_text;
@@ -1560,15 +1526,15 @@ function ct_comment_text($comment_text) {
1560
  * @return array
1561
  */
1562
  if (!function_exists ( 'ct_register_plugin_links')) {
1563
- function ct_register_plugin_links($links, $file) {
1564
- $base = plugin_basename(__FILE__);
1565
- if ( $file == $base ) {
1566
- $links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings','cleantalk' ) . '</a>';
1567
- $links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1568
- $links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
1569
- }
1570
- return $links;
1571
- }
1572
  }
1573
 
1574
  ?>
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.35
7
  Author: СleanTalk <welcome@cleantalk.ru>
8
  Author URI: http://cleantalk.org
9
  */
10
 
11
+ $ct_agent_version = 'wordpress-235';
12
  $ct_checkjs_frm = 'ct_checkjs_frm';
13
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
14
  $ct_session_request_id_label = 'request_id';
15
+ $ct_session_register_ok_label = 'register_ok';
16
 
17
  $ct_checkjs_cf7 = 'ct_checkjs_cf7';
18
  $ct_cf7_comment = 'This is a spam!';
27
  // JetPack active
28
  $ct_jp_active = false;
29
 
30
+ // Default value for JS test
31
  $ct_checkjs_def = 0;
32
 
33
  // COOKIE label to store request id for last approved
45
  // Timeout before new check for trial notice in minutes
46
  $trial_notice_check_timeout = 10;
47
 
48
+ // Init action.
49
  add_action('init', 'ct_init');
50
 
51
+ // After plugin loaded - to load locale as described in manual
52
+ add_action( 'plugins_loaded', 'ct_plugin_loaded' );
53
+
54
  // Comments
55
+ add_filter('preprocess_comment', 'ct_preprocess_comment'); // param - comment data array
56
  add_filter( 'comment_text', 'ct_comment_text' );
57
 
58
  // Formidable
76
  add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
77
  add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
78
 
79
+ // Login form - for notifications only
80
+ add_filter('login_message', 'ct_login_message');
81
+
82
+
83
  if (is_admin()) {
84
  add_action('admin_init', 'ct_admin_init', 1);
85
  add_action('admin_menu', 'ct_admin_add_page');
91
  add_action('comment_approved_to_spam', 'ct_comment_spam'); // param - comment object
92
  add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
93
  add_filter('unspam_comment', 'ct_unspam_comment');
94
+
95
  add_action('delete_user', 'ct_delete_user');
96
+
97
  add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
98
  }
99
 
102
  * @return mixed[] Array of options
103
  */
104
  function ct_init() {
105
+ global $ct_jp_active;
106
+
107
+ $jetpack_active_modules = get_option('jetpack_active_modules');
108
+ if (class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)) {
109
+ $ct_jp_active = true;
110
+ add_action('wp_footer', 'ct_comment_form');
111
+ } else {
112
+ add_action('comment_form', 'ct_comment_form');
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
118
+ */
119
+ function ct_plugin_loaded() {
120
+ load_plugin_textdomain('cleantalk', false, basename(dirname(__FILE__)) . '/i18n');
121
  }
122
 
123
  /**
177
 
178
  require_once('cleantalk.class.php');
179
  $options = ct_get_options();
180
+
181
  $config = get_option('cleantalk_server');
182
 
183
  $ct = new Cleantalk();
186
  $ct->server_ttl = $config['ct_server_ttl'];
187
  $ct->server_changed = $config['ct_server_changed'];
188
 
189
+ if (empty($hash)) {
190
+ $hash = $ct->getCleantalkCommentHash($message);
191
+ }
192
  if ($message !== null) {
193
+ $resultMessage = $ct->delCleantalkComment($message);
194
+ }
195
+
196
+ $ct_feedback = $hash . ':' . $allow . ';';
197
+ ct_init_session();
198
+ if (empty($_SESSION['feedback_request'])) {
199
+ $_SESSION['feedback_request'] = $ct_feedback;
200
+ } else {
201
+ $_SESSION['feedback_request'] .= $ct_feedback;
202
  }
 
 
 
 
 
 
 
203
 
204
+ return $resultMessage;
205
  }
206
 
207
  /**
210
  * @return bool
211
  */
212
  function ct_send_feedback($feedback_request = null) {
213
+
214
+ ct_init_session();
215
+ if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
216
+ $feedback_request = $_SESSION['feedback_request'];
217
+ unset($_SESSION['feedback_request']);
218
+ }
219
+
220
+ if ($feedback_request !== null) {
221
+ require_once('cleantalk.class.php');
222
+ $options = ct_get_options();
223
+
224
+ $config = get_option('cleantalk_server');
225
+
226
+ $ct = new Cleantalk();
227
+ $ct->work_url = $config['ct_work_url'];
228
+ $ct->server_url = $options['server'];
229
+ $ct->server_ttl = $config['ct_server_ttl'];
230
+ $ct->server_changed = $config['ct_server_changed'];
231
+
232
+ $ct_request = new CleantalkRequest();
233
+ $ct_request->auth_key = $options['apikey'];
234
+ $ct_request->feedback = $feedback_request;
235
+
236
+ $ct->sendFeedback($ct_request);
237
+
238
+ if ($ct->server_change) {
239
+ update_option(
240
+ 'cleantalk_server', array(
241
+ 'ct_work_url' => $ct->work_url,
242
+ 'ct_server_ttl' => $ct->server_ttl,
243
+ 'ct_server_changed' => time()
244
+ )
245
+ );
 
246
  }
247
+ return true;
248
+ }
 
249
 
250
+ return false;
 
 
 
 
251
  }
252
 
253
  /**
263
  return null;
264
  }
265
 
266
+ /**
267
+ * Inner function - Common part of request sending
268
+ * @param array Array of parameters:
269
+ * 'message' - string
270
+ * 'example' - string
271
+ * 'checkjs' - int
272
+ * 'sender_email' - string
273
+ * 'sender_nickname' - string
274
+ * 'sender_info' - array
275
+ * 'post_info' - string
276
+ * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
277
+ */
278
+ function ct_base_call($params = array()) {
279
+ global $wpdb, $ct_agent_version;
280
+
281
+ require_once('cleantalk.class.php');
282
+
283
+ ct_init_session();
284
+ if (array_key_exists('formtime', $_SESSION)) {
285
+ $submit_time = time() - (int) $_SESSION['formtime'];
286
+ } else {
287
+ $submit_time = null;
288
+ }
289
+
290
+ $sender_info = array(
291
+ 'cms_lang' => substr(get_locale(), 0, 2),
292
+ 'REFFERRER' => @$_SERVER['HTTP_REFERER'],
293
+ 'USER_AGENT' => @$_SERVER['HTTP_USER_AGENT'],
294
+ );
295
+ if(array_key_exists('sender_info', $params)){
296
+ $sender_info = array_merge($sender_info, (array) $params['sender_info']);
297
+ }
298
+ $sender_info = json_encode($sender_info);
299
+ if ($sender_info === false)
300
+ $sender_info = '';
301
+
302
+ $config = get_option('cleantalk_server');
303
+ $options = ct_get_options();
304
+
305
+ $ct = new Cleantalk();
306
+ $ct->work_url = $config['ct_work_url'];
307
+ $ct->server_url = $options['server'];
308
+ $ct->server_ttl = $config['ct_server_ttl'];
309
+ $ct->server_changed = $config['ct_server_changed'];
310
+
311
+ $ct_request = new CleantalkRequest();
312
+
313
+ $ct_request->auth_key = $options['apikey'];
314
+ $ct_request->message = $params['message'];
315
+ $ct_request->example = $params['example'];
316
+ $ct_request->sender_email = $params['sender_email'];
317
+ $ct_request->sender_nickname = $params['sender_nickname'];
318
+ $ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
319
+ $ct_request->agent = $ct_agent_version;
320
+ $ct_request->sender_info = $sender_info;
321
+ $ct_request->js_on = $params['checkjs'];
322
+ $ct_request->submit_time = $submit_time;
323
+ $ct_request->post_info = $params['post_info'];
324
+
325
+ $ct_result = $ct->isAllowMessage($ct_request);
326
+ if ($ct->server_change) {
327
+ update_option(
328
+ 'cleantalk_server', array(
329
+ 'ct_work_url' => $ct->work_url,
330
+ 'ct_server_ttl' => $ct->server_ttl,
331
+ 'ct_server_changed' => time()
332
+ )
333
+ );
334
+ }
335
+
336
+ return array('ct' => $ct, 'ct_result' => $ct_result);
337
+ }
338
+
339
  /**
340
  * Adds hidden filed to comment form
341
  */
343
  if (ct_is_user_enable() === false) {
344
  return false;
345
  }
346
+
347
  $options = ct_get_options();
348
  if ($options['comments_test'] == 0) {
349
  return false;
350
  }
351
+
352
  ct_add_hidden_fields(0, 'ct_checkjs', false);
353
+
354
  return null;
355
  }
356
 
359
  * @param int $post_id Post ID, not used
360
  */
361
  function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_string = false) {
362
+ global $ct_jp_active, $ct_checkjs_def;
363
 
364
  $ct_checkjs_key = ct_get_checkjs_value();
365
  ct_init_session();
366
  $_SESSION['formtime'] = time();
367
+
368
+ if ($ct_jp_active) {
369
  $html = '
370
  <script type="text/javascript">
371
  // <![CDATA[
380
  </script>
381
  ';
382
  $html = sprintf($html, $field_name, $ct_checkjs_key);
383
+ } else {
384
  $field_id = $field_name . '_' . md5(rand(0, 1000));
385
  $html = '
386
  <input type="hidden" id="%s" name="%s" value="0" />
391
  </script>
392
  ';
393
  $html = sprintf($html, $field_id, $field_name, $field_id, $field_id, $ct_checkjs_def, $ct_checkjs_key);
394
+ }
395
  if ($return_string === true) {
396
  return $html;
397
  } else {
409
  if (!isset($current_user->roles)) {
410
  return true;
411
  }
412
+
413
  $disable_roles = array('administrator', 'editor', 'author');
414
  foreach ($current_user->roles as $k => $v) {
415
  if (in_array($v, $disable_roles))
425
  */
426
  function ct_frm_entries_footer_scripts($fields, $form) {
427
  global $current_user, $ct_checkjs_frm;
428
+
429
  $options = ct_get_options();
430
  if ($options['contact_forms_test'] == 0) {
431
  return false;
432
  }
433
+
434
  $ct_checkjs_key = ct_get_checkjs_value();
435
  $ct_frm_name = 'form_' . $form->form_key;
436
+
437
  ?>
438
+
439
  var input = document.createElement("input");
440
  input.setAttribute("type", "hidden");
441
  input.setAttribute("name", "<?php echo $ct_checkjs_frm; ?>");
442
  input.setAttribute("value", "<?php echo $ct_checkjs_key; ?>");
443
  document.getElementById("<?php echo $ct_frm_name; ?>").appendChild(input);
444
+
445
  <?php
446
  }
447
 
451
  */
452
  function ct_frm_validate_entry ($errors, $values) {
453
  global $wpdb, $current_user, $ct_agent_version, $ct_checkjs_frm;
454
+
455
  $options = ct_get_options();
456
  if ($options['contact_forms_test'] == 0) {
457
  return false;
458
  }
459
 
460
+ $checkjs = js_test($ct_checkjs_frm);
 
 
461
 
 
 
 
 
 
 
 
 
 
 
 
462
  $post_info['comment_type'] = 'feedback';
463
  $post_info = json_encode($post_info);
464
  if ($post_info === false)
465
  $post_info = '';
466
+
467
  $sender_email = null;
468
  $message = '';
469
  foreach ($values['item_meta'] as $v) {
474
  $message .= ' ' . $v;
475
  }
476
 
477
+ $ct_base_call_result = ct_base_call(array(
478
+ 'message' => $message,
479
+ 'example' => null,
480
+ 'sender_email' => $sender_email,
481
+ 'sender_nickname' => null,
482
+ 'post_info' => $post_info,
483
+ 'checkjs' => $checkjs
484
+ ));
485
+ $ct = $ct_base_call_result['ct'];
486
+ $ct_result = $ct_base_call_result['ct_result'];
487
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  if ($ct_result->spam == 1) {
489
  $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
490
  }
491
+
492
  return $errors;
493
  }
494
 
497
  * @param mixed[] $comment Comment data array
498
  * @return mixed[] New data array of comment
499
  */
500
+ function ct_preprocess_comment($comment) {
501
  // this action is called just when WP process POST request (adds new comment)
502
  // this action is called by wp-comments-post.php
503
  // after processing WP makes redirect to post page with comment's form by GET request (see above)
504
  global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label;
505
+
506
  $options = ct_get_options();
507
  if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
508
  return $comment;
509
  }
510
+
511
  $local_blacklists = wp_blacklist_check(
512
  $comment['comment_author'],
513
  $comment['comment_author_email'],
516
  @$_SERVER['REMOTE_ADDR'],
517
  @$_SERVER['HTTP_USER_AGENT']
518
  );
519
+
520
  // Go out if author in local blacklists
521
  if ($local_blacklists === true) {
522
  return $comment;
523
  }
524
+
525
  $wp_host = null;
526
  if (preg_match("@^(?:https?://)([^/:]+)@i", get_permalink($comment['comment_post_ID']), $matches))
527
  $wp_host = $matches[1];
528
+
529
  $author_host = null;
530
  if (preg_match("@^(?:https?://)([^/:]+)@i", $comment['comment_author_url'], $matches))
531
  $author_host = $matches[1];
532
+
533
  // Skip tests for selfmade pingback's
534
  if ($comment['comment_type'] == 'pingback' && $wp_host !== null && $wp_host === $author_host) {
535
  return $comment;
536
  }
537
+
538
+ $ct_comment_done = true;
539
 
540
  $comment_post_id = $comment['comment_post_ID'];
541
 
542
  $post = get_post($comment_post_id);
543
 
544
+ $checkjs = js_test('ct_checkjs');
 
 
 
 
 
 
 
545
 
546
+ $example = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
 
548
+ $post_info['comment_type'] = $comment['comment_type'];
549
+ $post_info['post_url'] = ct_post_url(null, $comment_post_id);
550
 
551
+ $post_info = json_encode($post_info);
552
+ if ($post_info === false)
553
+ $post_info = '';
554
 
555
+ if ($post !== null){
556
+ $example['title'] = $post->post_title;
557
+ $example['body'] = $post->post_content;
558
+ $example['comments'] = null;
 
559
 
560
+ $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
561
+ foreach ($last_comments as $post_comment){
562
+ $example['comments'] .= "\n\n" . $post_comment->comment_content;
563
+ }
564
 
565
+ $example = json_encode($example);
566
+ }
 
 
 
 
 
 
 
 
 
567
 
568
+ // Use plain string format if've failed with JSON
569
+ if ($example === false || $example === null){
570
+ $example = ($post->post_title !== null) ? $post->post_title : '';
571
+ $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
 
 
 
 
 
572
  }
573
 
574
+ $ct_base_call_result = ct_base_call(array(
575
+ 'message' => $comment['comment_content'],
576
+ 'example' => $example,
577
+ 'sender_email' => $comment['comment_author_email'],
578
+ 'sender_nickname' => $comment['comment_author'],
579
+ 'post_info' => $post_info,
580
+ 'checkjs' => $checkjs
581
+ ));
582
+ $ct = $ct_base_call_result['ct'];
583
+ $ct_result = $ct_base_call_result['ct_result'];
584
+
585
  if ($ct_result->stop_queue == 1) {
586
  $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
587
  $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
588
  wp_die($err_text, 'Blacklisted', array('back_link' => true));
589
 
590
  return $comment;
591
+ }
592
+
593
  ct_hash($ct_result->id);
594
 
595
  if ($ct_result->spam == 1) {
596
  $comment['comment_content'] = $ct->addCleantalkComment($comment['comment_content'], $ct_result->comment);
597
  add_filter('pre_comment_approved', 'ct_set_comment_spam');
598
+
599
  global $ct_comment;
600
  $ct_comment = $ct_result->comment;
601
  add_action('comment_post', 'ct_die', 12, 2);
602
  add_action('comment_post', 'ct_set_meta', 10, 2);
603
+
604
  return $comment;
605
  }
606
+
607
  if (isset($comment['comment_author_email'])) {
608
  $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
609
 
620
  $ct_stop_words = $ct_result->stop_words;
621
  add_action('comment_post', 'ct_mark_red', 11, 2);
622
  }
623
+
624
  $comment['comment_content'] = $ct->addCleantalkComment($comment['comment_content'], $ct_result->comment);
625
  add_filter('pre_comment_approved', 'ct_set_not_approved');
626
  }
627
+
628
  add_action('comment_post', 'ct_set_meta', 10, 2);
629
  }
630
  }
631
+
632
  return $comment;
633
  }
634
 
645
  wp_die($err_text, 'Blacklisted', array('back_link' => true));
646
  }
647
 
 
648
  /**
649
  *
650
  *
651
  */
652
  function js_test($field_name = 'ct_checkjs') {
653
  $checkjs = null;
654
+ $js_field = null;
655
+
656
+ if (isset($_POST[$field_name]))
657
+ $js_field = $_POST[$field_name];
658
+
659
+ if (isset($_COOKIE[$field_name]))
660
+ $js_field = $_COOKIE[$field_name];
661
 
662
  if ($js_field !== null) {
663
  if($js_field == ct_get_checkjs_value()) {
664
  $checkjs = 1;
665
  } else {
666
+ $checkjs = 0;
667
  }
668
  }
669
+
670
  return $checkjs;
671
  }
672
 
677
  * @return string|bool
678
  */
679
  function ct_post_url($comment_id = null, $comment_post_id) {
 
 
 
680
 
681
+ if (empty($comment_post_id))
682
+ return null;
683
+
684
+ if ($comment_id === null) {
685
+ $last_comment = get_comments('number=1');
686
+ $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
687
+ }
688
+ $permalink = get_permalink($comment_post_id);
689
 
690
+ $post_url = null;
691
+ if ($permalink !== null)
692
+ $post_url = $permalink . '#comment-' . $comment_id;
693
 
694
+ return $post_url;
695
  }
696
 
697
  /**
725
  * @param mixed $comment_status Approval status ("spam", or 0/1), not used
726
  */
727
  function ct_set_meta($comment_id, $comment_status) {
728
+ global $comment_post_id;
 
 
 
 
729
  $hash1 = ct_hash();
730
  if (!empty($hash1)) {
731
  update_comment_meta($comment_id, 'ct_hash', $hash1);
 
732
  if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
733
+ $post_url = ct_post_url($comment_id, $comment_post_id);
734
+ $post_url = base64_encode($post_url);
735
+ if ($post_url === false)
736
+ return false;
737
+ // 01 - URL to approved comment
738
+ $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
739
+ ct_send_feedback($feedback_request);
740
+ }
 
741
  }
742
+ return true;
 
743
  }
744
 
745
  /**
754
  $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
755
  $comment['comment_approved'] = 1;
756
  wp_update_comment($comment);
757
+
758
  return true;
759
  }
760
 
769
  ct_feedback($hash, $comment['comment_content'], 0);
770
  $comment['comment_approved'] = 0;
771
  wp_update_comment($comment);
772
+
773
  return true;
774
  }
775
 
790
 
791
 
792
  /**
793
+ * Unspam comment
794
  * @param type $comment_id
795
  */
796
  function ct_unspam_comment($comment_id) {
799
  $hash = get_comment_meta($comment_id, 'ct_hash', true);
800
  $comment['comment_content'] = ct_unmark_red($comment['comment_content']);
801
  $comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
802
+
803
  wp_update_comment($comment);
804
  }
805
 
858
  function admin_notice_message(){
859
  global $ct_notice_trial_label, $show_ct_notice_trial;
860
 
861
+ if (ct_active() === false)
862
+ return false;
863
 
864
  $options = ct_get_options();
865
  $show_notice = true;
873
  }
874
 
875
  ct_send_feedback();
876
+
877
  delete_spam_comments();
878
 
879
+ return true;
880
  }
881
 
882
  /**
897
  $apikey = $options['apikey'];
898
  }
899
 
900
+ return ($apikey === 'enter key' || $apikey === '') ? false : true;
901
  }
902
 
903
  /**
905
  * @return bool
906
  */
907
  function ct_active(){
908
+ $ct_active = false;
909
+ foreach (get_option('active_plugins') as $k => $v) {
910
  if (preg_match("/cleantalk.php$/", $v))
911
+ $ct_active = true;
912
+ }
913
 
914
+ return $ct_active;
915
  }
916
  /**
917
  * Tests plugin activation status
932
  */
933
  function ct_get_checkjs_value() {
934
  $options = ct_get_options();
935
+ return md5($options['apikey'] . '+' . get_option('admin_email'));
 
936
  }
937
 
938
  /**
941
  */
942
  function delete_spam_comments() {
943
  $options = ct_get_options();
944
+
945
  if ($options['remove_old_spam'] == 1) {
946
  $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
947
  foreach ($last_comments as $c) {
962
  */
963
  function ct_register_form() {
964
  global $ct_checkjs_register_form;
965
+
966
  $options = ct_get_options();
967
  if ($options['registrations_test'] == 0) {
968
  return false;
973
  return null;
974
  }
975
 
976
+ /**
977
+ * Adds notification text to login form - to inform about approced registration
978
+ * @return null
979
+ */
980
+ function ct_login_message($message) {
981
+ global $errors, $ct_session_register_ok_label;
982
+
983
+ $options = ct_get_options();
984
+ if ($options['registrations_test'] != 0) {
985
+ if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
986
+ ct_init_session();
987
+ if (isset($_SESSION[$ct_session_register_ok_label])) {
988
+ unset($_SESSION[$ct_session_register_ok_label]);
989
+ if(is_wp_error($errors))
990
+ $errors->add('ct_message','<br />' . sprintf(__('Registration is approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
991
+ }
992
+ }
993
+ }
994
+ return $message;
995
+ }
996
+
997
  /**
998
  * Test users registration
999
  * @return array with errors
1000
  */
1001
  function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1002
+ global $ct_agent_version, $ct_checkjs_register_form, $ct_session_request_id_label, $ct_session_register_ok_label, $bp;
1003
+
1004
  //
1005
  // BuddyPress actions
1006
  //
1019
  return $errors;
1020
  }
1021
 
1022
+ $checkjs = js_test($ct_checkjs_register_form);
1023
+
1024
  require_once('cleantalk.class.php');
1025
 
1026
  $blog_lang = substr(get_locale(), 0, 2);
1032
  $user_info = json_encode($user_info);
1033
  if ($user_info === false)
1034
  $user_info = '';
1035
+
1036
  $sender_email = $user_email;
1037
+
1038
  $config = get_option('cleantalk_server');
1039
 
1040
  $ct = new Cleantalk();
1063
  )
1064
  );
1065
  }
1066
+
1067
  if ($ct_result->errno != 0) {
1068
  return $errors;
1069
  }
1070
+
1071
+ if ($ct_result->inactive != 0) {
1072
+ $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
1073
+ if(time() - 900 > $timelabel_reg){
1074
+ update_option('cleantalk_timelabel_reg', time());
1075
+
1076
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1077
+ $message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
1078
+ $message .= sprintf(__('"Anti-spam by CleanTalk" plugin error on your site %s:', 'cleantalk'), $blogname) . "\r\n\r\n";
1079
+ $message .= $ct_result->comment . "\r\n\r\n";
1080
+ @wp_mail(get_option('admin_email'), sprintf(__('[%s] Anti-spam by CleanTalk error!', 'cleantalk'), $blogname), $message);
1081
+ }
1082
+ return $errors;
1083
+ }
1084
 
1085
  if ($ct_result->allow == 0) {
 
1086
  if ($buddypress === true) {
1087
  $bp->signup->errors['signup_username'] = $ct_result->comment;
1088
  } else {
1089
+ $errors->add('ct_error', $ct_result->comment);
1090
  }
1091
  } else {
1092
  if ($ct_result->id !== null) {
1093
+ ct_init_session();
1094
  $_SESSION[$ct_session_request_id_label] = $ct_result->id;
1095
+ $_SESSION[$ct_session_register_ok_label] = $ct_result->id;
1096
  }
1097
  }
1098
 
1106
  function ct_user_register($user_id) {
1107
  global $ct_session_request_id_label;
1108
 
1109
+ ct_init_session();
1110
  if (isset($_SESSION[$ct_session_request_id_label])) {
1111
  update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
1112
+ unset($_SESSION[$ct_session_request_id_label]);
1113
  }
1114
  }
1115
 
1129
  */
1130
  function ct_grunion_contact_form_field_html($r, $field_label) {
1131
  global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields;
1132
+
1133
  $options = ct_get_options();
1134
  if ($options['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match("/[text|email]/i", $r)) {
1135
+
1136
  // Looking for element name prefix
1137
  $name_patched = false;
1138
  foreach ($ct_jpcf_fields as $v) {
1145
  $r .= ct_add_hidden_fields(0, $ct_checkjs_jpcf, true);
1146
  $ct_jpcf_patched = true;
1147
  }
1148
+
1149
  return $r;
1150
  }
1151
  /**
1155
  global $ct_checkjs_jpcf;
1156
 
1157
  $options = ct_get_options();
1158
+
1159
  if ($options['contact_forms_test'] == 0) {
1160
  return null;
1161
  }
1162
+
1163
  $js_field_name = $ct_checkjs_jpcf;
1164
  foreach ($_POST as $k => $v) {
1165
  if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
1166
  $js_field_name = $k;
1167
  }
1168
+ $checkjs = js_test($js_field_name);
 
 
1169
 
1170
+ $sender_info = array(
1171
+ 'sender_url' => @$form['comment_author_url']
 
 
 
 
 
1172
  );
1173
 
 
 
 
 
1174
  $post_info['comment_type'] = 'feedback';
1175
  $post_info = json_encode($post_info);
1176
  if ($post_info === false)
1177
  $post_info = '';
1178
+
1179
  $sender_email = null;
1180
  $sender_nickname = null;
1181
  $message = '';
1182
  if (isset($form['comment_author_email']))
1183
  $sender_email = $form['comment_author_email'];
1184
+
1185
  if (isset($form['comment_author']))
1186
  $sender_nickname = $form['comment_author'];
1187
+
1188
  if (isset($form['comment_content']))
1189
  $message = $form['comment_content'];
1190
 
1191
+ $ct_base_call_result = ct_base_call(array(
1192
+ 'message' => $message,
1193
+ 'example' => null,
1194
+ 'sender_email' => $sender_email,
1195
+ 'sender_nickname' => $sender_nickname,
1196
+ 'post_info' => $post_info,
1197
+ 'sender_info' => $sender_info,
1198
+ 'checkjs' => $checkjs
1199
+ ));
1200
+ $ct = $ct_base_call_result['ct'];
1201
+ $ct_result = $ct_base_call_result['ct_result'];
1202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1203
  if ($ct_result->spam == 1) {
1204
  global $ct_comment;
1205
  $ct_comment = $ct_result->comment;
1206
  ct_die(null, null);
1207
  exit;
1208
  }
1209
+
1210
  return (bool) $ct_result->spam;
1211
  }
1212
 
1236
  $options = ct_get_options();
1237
  if ($spam === true)
1238
  return $spam;
1239
+
1240
  if ($options['contact_forms_test'] == 0) {
1241
  return $spam;
1242
  }
1243
 
1244
+ $checkjs = js_test($ct_checkjs_cf7);
 
 
1245
 
 
 
 
 
 
 
 
 
 
 
 
1246
  $post_info['comment_type'] = 'feedback';
1247
  $post_info = json_encode($post_info);
1248
  if ($post_info === false)
1249
  $post_info = '';
1250
+
1251
  $sender_email = null;
1252
  $sender_nickname = null;
1253
  $message = '';
1262
  $sender_nickname = $v;
1263
  }
1264
  }
 
 
 
 
 
 
 
 
 
 
1265
 
1266
+ $ct_base_call_result = ct_base_call(array(
1267
+ 'message' => $message,
1268
+ 'example' => null,
1269
+ 'sender_email' => $sender_email,
1270
+ 'sender_nickname' => $sender_nickname,
1271
+ 'post_info' => $post_info,
1272
+ 'checkjs' => $checkjs
1273
+ ));
1274
+ $ct = $ct_base_call_result['ct'];
1275
+ $ct_result = $ct_base_call_result['ct_result'];
1276
 
 
 
 
 
 
 
 
 
 
 
1277
  if ($ct_result->spam == 1) {
1278
  $spam = true;
1279
  $ct_cf7_comment = $ct_result->comment;
1280
  add_filter('wpcf7_display_message', 'ct_wpcf7_display_message', 10, 2);
1281
  }
1282
+
1283
  return $spam;
1284
  }
1285
  /**
1292
  if ($status == 'spam') {
1293
  $message = $ct_cf7_comment;
1294
  }
1295
+
1296
  return $message;
1297
  }
1298
 
1317
  */
1318
  function ct_admin_init() {
1319
  global $show_ct_notice_trial, $ct_notice_trial_label, $trial_notice_check_timeout;
1320
+
1321
  $show_ct_notice_trial = false;
1322
  if (isset($_COOKIE[$ct_notice_trial_label])) {
1323
  if ($_COOKIE[$ct_notice_trial_label] == 1)
1335
  curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
1336
  curl_setopt($ch, CURLOPT_POST, true);
1337
  curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
1338
+
1339
  // receive server response ...
1340
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1341
  // resolve 'Expect: 100-continue' issue
1342
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
1343
+
1344
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
1345
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
1346
 
1360
  setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"));
1361
  }
1362
 
 
1363
  ct_init_session();
1364
 
1365
  register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
1508
  */
1509
  function ct_comment_text($comment_text) {
1510
  global $comment, $ct_approved_request_id_label;
1511
+
 
1512
  if (isset($_COOKIE[$ct_approved_request_id_label])) {
1513
  $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
1514
 
1515
  if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
1516
+ $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment is approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
 
1517
  }
 
1518
  }
1519
 
1520
  return $comment_text;
1526
  * @return array
1527
  */
1528
  if (!function_exists ( 'ct_register_plugin_links')) {
1529
+ function ct_register_plugin_links($links, $file) {
1530
+ $base = plugin_basename(__FILE__);
1531
+ if ( $file == $base ) {
1532
+ $links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings','cleantalk' ) . '</a>';
1533
+ $links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
1534
+ $links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
1535
+ }
1536
+ return $links;
1537
+ }
1538
  }
1539
 
1540
  ?>
i18n/cleantalk-es_ES.mo CHANGED
Binary file
i18n/cleantalk-ru_RU.mo CHANGED
Binary file
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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, ios, iphone, ipad
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
- Stable tag: 2.33
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -94,6 +94,12 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
97
  = 2.33 2014-02-12 =
98
  * Fixed: CURLOPT_FOLLOWLOCATION bug at admin notice
99
 
@@ -250,6 +256,12 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
250
  * First version
251
 
252
  == Upgrade Notice ==
 
 
 
 
 
 
253
  = 2.33 2014-02-12 =
254
  * Fixed: CURLOPT_FOLLOWLOCATION bug at admin notice
255
 
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, ios, iphone, ipad
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
+ Stable tag: 2.35
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
94
 
95
  == Changelog ==
96
 
97
+ = 2.35 2014-03-12 =
98
+ * New: Notifications about disabled account
99
+ * New: Improved JavaScript spam test.
100
+ * Fixed: Code optimization
101
+ * Fixed: JavaScript test for signups.
102
+
103
  = 2.33 2014-02-12 =
104
  * Fixed: CURLOPT_FOLLOWLOCATION bug at admin notice
105
 
256
  * First version
257
 
258
  == Upgrade Notice ==
259
+ = 2.35 2014-03-12 =
260
+ * New: Notifications about disabled account
261
+ * New: Improved JavaScript spam test.
262
+ * Fixed: Code optimization
263
+ * Fixed: JavaScript test for signups.
264
+
265
  = 2.33 2014-02-12 =
266
  * Fixed: CURLOPT_FOLLOWLOCATION bug at admin notice
267