Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.18

Version Description

2015-08-04 = * Fixed issue with user_token * Added anti-spam API, see our FAQ

Download this release

Release Info

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

Code changes from version 5.17 to 5.18

cleantalk-admin.php CHANGED
@@ -161,11 +161,19 @@ function ct_admin_init() {
161
  setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
162
  }
163
  }
164
-
165
- if (time() > $ct_data['next_account_status_check']) {
 
166
  $result = false;
167
  if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
168
- $result=noticePaidTill($ct_options['apikey']);
 
 
 
 
 
 
 
169
 
170
  if ($result) {
171
  $result = json_decode($result, true);
@@ -851,39 +859,25 @@ function ct_update_option($option_name) {
851
  $key_valid = true;
852
  $app_server_error = false;
853
  $ct_data['testing_failed']=0;
854
- if (function_exists('curl_init') && function_exists('json_decode')) {
855
- $url = 'https://cleantalk.org/app_notice';
856
- $data['auth_key'] = $api_key;
857
- $data['param'] = 'notice_validate_key';
858
-
859
- $ch = curl_init();
860
- curl_setopt($ch, CURLOPT_URL, $url);
861
- curl_setopt($ch, CURLOPT_TIMEOUT, $ct_server_timeout);
862
- curl_setopt($ch, CURLOPT_POST, true);
863
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
864
-
865
- // receive server response ...
866
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
867
- // resolve 'Expect: 100-continue' issue
868
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
869
-
870
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
871
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
872
-
873
- $result = curl_exec($ch);
874
- curl_close($ch);
875
- if ($result) {
876
- $result = json_decode($result, true);
877
- if (isset($result['valid']) && $result['valid'] == 0) {
878
- $key_valid = false;
879
- $ct_data['testing_failed']=1;
880
- }
881
- }
882
- if (!$result || !isset($result['valid'])) {
883
- $app_server_error = true;
884
  $ct_data['testing_failed']=1;
885
  }
886
  }
 
 
 
 
 
887
 
888
  update_option('cleantalk_data', $ct_data);
889
 
161
  setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
162
  }
163
  }
164
+
165
+ if (time() > $ct_data['next_account_status_check']||
166
+ isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&$ct_options['apikey']!=$_POST['cleantalk_settings']['apikey']) {
167
  $result = false;
168
  if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
169
+ if(@isset($_POST['cleantalk_settings']['apikey']))
170
+ {
171
+ $result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
172
+ }
173
+ else
174
+ {
175
+ $result=noticePaidTill($ct_options['apikey']);
176
+ }
177
 
178
  if ($result) {
179
  $result = json_decode($result, true);
859
  $key_valid = true;
860
  $app_server_error = false;
861
  $ct_data['testing_failed']=0;
862
+
863
+ $request=Array();
864
+ $request['method_name'] = 'notice_validate_key';
865
+ $request['auth_key'] = $api_key;
866
+ $url='https://api.cleantalk.org';
867
+ $result=sendRawRequest($url, $request);
868
+ if ($result)
869
+ {
870
+ $result = json_decode($result, true);
871
+ if (isset($result['valid']) && $result['valid'] == 0) {
872
+ $key_valid = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
873
  $ct_data['testing_failed']=1;
874
  }
875
  }
876
+ if (!$result || !isset($result['valid']))
877
+ {
878
+ $app_server_error = true;
879
+ $ct_data['testing_failed']=1;
880
+ }
881
 
882
  update_option('cleantalk_data', $ct_data);
883
 
cleantalk-ajax.php CHANGED
@@ -75,6 +75,9 @@ add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
75
  add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
76
  add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
77
 
 
 
 
78
  function ct_get_stats()
79
  {
80
  check_ajax_referer( 'ct_secret_nonce', 'security' );
@@ -423,6 +426,12 @@ function ct_ajax_hook()
423
  print json_encode($result);
424
  die();
425
  }
 
 
 
 
 
 
426
  }
427
  }
428
  }
75
  add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
76
  add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
77
 
78
+ /**hooks for cm answers pro */
79
+ add_action( 'template_redirect', 'ct_ajax_hook',1 );
80
+
81
  function ct_get_stats()
82
  {
83
  check_ajax_referer( 'ct_secret_nonce', 'security' );
426
  print json_encode($result);
427
  die();
428
  }
429
+ else if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
430
+ {
431
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
432
+ print json_encode($result);
433
+ die();
434
+ }
435
  }
436
  }
437
  }
cleantalk-common.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $ct_agent_version = 'wordpress-517';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
1
  <?php
2
 
3
+ $ct_agent_version = 'wordpress-518';
4
  $ct_plugin_name = 'Anti-spam by CleanTalk';
5
  $ct_checkjs_frm = 'ct_checkjs_frm';
6
  $ct_checkjs_register_form = 'ct_checkjs_register_form';
cleantalk-public.php CHANGED
@@ -5,13 +5,18 @@
5
  * @return mixed[] Array of options
6
  */
7
  function ct_init() {
8
- global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_direct_post, $ct_options, $ct_data, $ct_check_post_result, $test_external_forms;;
9
 
10
  //$ct_options = ct_get_options();
 
 
 
 
 
 
11
 
12
  ct_init_session();
13
 
14
-
15
  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
16
  if (is_array($_SESSION) && !array_key_exists($ct_formtime_label, $_SESSION) && session_id() != '') {
17
  $ct_direct_post = 1;
@@ -148,6 +153,7 @@ function ct_init() {
148
 
149
  //hook for Anonymous Post
150
  add_action('template_redirect','ct_contact_form_validate',1);
 
151
 
152
  //
153
  // New user approve hack
@@ -473,6 +479,7 @@ function ct_preprocess_comment($comment) {
473
  //
474
  // JetPack comments logic
475
  //
 
476
  if ($ct_jp_comments) {
477
  $post_info['comment_type'] = 'jetpack_comment';
478
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
@@ -480,6 +487,14 @@ function ct_preprocess_comment($comment) {
480
  $post_info['comment_type'] = $comment['comment_type'];
481
  $checkjs = js_test('ct_checkjs', $_POST, true);
482
  }
 
 
 
 
 
 
 
 
483
 
484
  $post_info['post_url'] = ct_post_url(null, $comment_post_id);
485
  $post_info = json_encode($post_info);
@@ -831,6 +846,100 @@ function ct_register_post($sanitized_user_login = null, $user_email = null, $err
831
  return ct_registration_errors($errors, $sanitized_user_login, $user_email);
832
  }
833
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  /**
835
  * Test users registration
836
  * @return array with errors
@@ -1474,7 +1583,6 @@ function ct_contact_form_validate () {
1474
  {
1475
  return null;
1476
  }
1477
- $cleantalk_executed=true;
1478
 
1479
  if ($_SERVER['REQUEST_METHOD'] != 'POST' ||
1480
  (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
@@ -1509,6 +1617,13 @@ function ct_contact_form_validate () {
1509
  if ($sender_email===''|| !$contact_form) {
1510
  return false;
1511
  }
 
 
 
 
 
 
 
1512
 
1513
  $ct_base_call_result = ct_base_call(array(
1514
  'message' => $subject . "\n\n" . $message,
@@ -1520,6 +1635,11 @@ function ct_contact_form_validate () {
1520
  'checkjs' => $checkjs
1521
  ));
1522
 
 
 
 
 
 
1523
  $ct = $ct_base_call_result['ct'];
1524
  $ct_result = $ct_base_call_result['ct_result'];
1525
 
@@ -1528,7 +1648,22 @@ function ct_contact_form_validate () {
1528
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
1529
  global $ct_comment;
1530
  $ct_comment = $ct_result->comment;
1531
- ct_die(null, null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1532
  } else {
1533
  echo $ct_result->comment;
1534
  }
@@ -1616,7 +1751,17 @@ function ct_contact_form_validate_postdata () {
1616
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
1617
  global $ct_comment;
1618
  $ct_comment = $ct_result->comment;
1619
- ct_die(null, null);
 
 
 
 
 
 
 
 
 
 
1620
  } else {
1621
  echo $ct_result->comment;
1622
  }
5
  * @return mixed[] Array of options
6
  */
7
  function ct_init() {
8
+ global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $ct_formtime_label, $ct_direct_post, $ct_options, $ct_data, $ct_check_post_result, $test_external_forms;
9
 
10
  //$ct_options = ct_get_options();
11
+
12
+ //fix for EPM registration form
13
+ if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
14
+ {
15
+ unset($_POST['ct_checkjs_register_form']);
16
+ }
17
 
18
  ct_init_session();
19
 
 
20
  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
21
  if (is_array($_SESSION) && !array_key_exists($ct_formtime_label, $_SESSION) && session_id() != '') {
22
  $ct_direct_post = 1;
153
 
154
  //hook for Anonymous Post
155
  add_action('template_redirect','ct_contact_form_validate',1);
156
+ add_action('template_redirect','ct_contact_form_validate_postdata',1);
157
 
158
  //
159
  // New user approve hack
479
  //
480
  // JetPack comments logic
481
  //
482
+ $checkjs = 0;
483
  if ($ct_jp_comments) {
484
  $post_info['comment_type'] = 'jetpack_comment';
485
  $checkjs = js_test('ct_checkjs', $_COOKIE, true);
487
  $post_info['comment_type'] = $comment['comment_type'];
488
  $checkjs = js_test('ct_checkjs', $_POST, true);
489
  }
490
+ if($checkjs==0)
491
+ {
492
+ $checkjs = js_test('ct_checkjs', $_POST, true);
493
+ }
494
+ if($checkjs==0)
495
+ {
496
+ $checkjs = js_test('ct_checkjs', $_COOKIE, true);
497
+ }
498
 
499
  $post_info['post_url'] = ct_post_url(null, $comment_post_id);
500
  $post_info = json_encode($post_info);
846
  return ct_registration_errors($errors, $sanitized_user_login, $user_email);
847
  }
848
 
849
+ /**
850
+ * Check messages for external plugins
851
+ * @return array with checking result;
852
+ */
853
+
854
+ function ct_test_message($nickname, $email, $ip, $text){
855
+ $checkjs = js_test('ct_checkjs', $_COOKIE, true);
856
+
857
+ $post_info['comment_type'] = 'feedback_plugin_check';
858
+ $post_info = json_encode($post_info);
859
+
860
+ $ct_base_call_result = ct_base_call(array(
861
+ 'message' => $text,
862
+ 'example' => null,
863
+ 'sender_email' => $email,
864
+ 'sender_nickname' => $nickname,
865
+ 'post_info' => $post_info,
866
+ 'sender_info' => get_sender_info(),
867
+ 'checkjs' => $checkjs
868
+ ));
869
+
870
+ $ct_result = $ct_base_call_result['ct_result'];
871
+
872
+ $result=Array(
873
+ 'allow' => $ct_result->allow,
874
+ 'comment' => $ct_result->comment,
875
+ );
876
+ return $result;
877
+ }
878
+
879
+ /**
880
+ * Check registrations for external plugins
881
+ * @return array with checking result;
882
+ */
883
+
884
+ function ct_test_registration($nickname, $email, $ip){
885
+ global $ct_checkjs_register_form, $ct_agent_version, $ct_options, $ct_data;
886
+
887
+ $submit_time = submit_time_test();
888
+
889
+ $sender_info = get_sender_info();
890
+
891
+ $checkjs=0;
892
+
893
+ $checkjs = js_test($ct_checkjs_register_form, $_POST, true);
894
+ $sender_info['post_checkjs_passed'] = $checkjs;
895
+
896
+ //
897
+ // This hack can be helpfull when plugin uses with untested themes&signups plugins.
898
+ //
899
+ if ($checkjs == 0) {
900
+ $checkjs = js_test('ct_checkjs', $_COOKIE, true);
901
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
902
+ }
903
+
904
+ $sender_info = json_encode($sender_info);
905
+ if ($sender_info === false) {
906
+ $sender_info= '';
907
+ }
908
+
909
+ require_once('cleantalk.class.php');
910
+ $config = get_option('cleantalk_server');
911
+ $ct = new Cleantalk();
912
+ $ct->work_url = $config['ct_work_url'];
913
+ $ct->server_url = $ct_options['server'];
914
+
915
+ $ct->server_ttl = $config['ct_server_ttl'];
916
+ $ct->server_changed = $config['ct_server_changed'];
917
+ $ct->ssl_on = $ct_options['ssl_on'];
918
+
919
+ $ct_request = new CleantalkRequest();
920
+ $ct_request->auth_key = $ct_options['apikey'];
921
+ $ct_request->sender_email = $email;
922
+ $ct_request->sender_ip = $ip;
923
+ $ct_request->sender_nickname = $nickname;
924
+ $ct_request->agent = $ct_agent_version;
925
+ $ct_request->sender_info = $sender_info;
926
+ $ct_request->js_on = $checkjs;
927
+ $ct_request->submit_time = $submit_time;
928
+
929
+ $ct_result = $ct->isAllowUser($ct_request);
930
+
931
+ if ($ct_result->errno != 0 && $checkjs==0)
932
+ {
933
+ $ct_result->allow=0;
934
+ }
935
+
936
+ $result=Array(
937
+ 'allow' => $ct_result->allow,
938
+ 'comment' => $ct_result->comment,
939
+ );
940
+ return $result;
941
+ }
942
+
943
  /**
944
  * Test users registration
945
  * @return array with errors
1583
  {
1584
  return null;
1585
  }
 
1586
 
1587
  if ($_SERVER['REQUEST_METHOD'] != 'POST' ||
1588
  (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
1617
  if ($sender_email===''|| !$contact_form) {
1618
  return false;
1619
  }
1620
+ $cleantalk_executed=true;
1621
+
1622
+ if(isset($_POST['TellAFriend_Link']))
1623
+ {
1624
+ $tmp=$_POST['TellAFriend_Link'];
1625
+ unset($_POST['TellAFriend_Link']);
1626
+ }
1627
 
1628
  $ct_base_call_result = ct_base_call(array(
1629
  'message' => $subject . "\n\n" . $message,
1635
  'checkjs' => $checkjs
1636
  ));
1637
 
1638
+ if(isset($_POST['TellAFriend_Link']))
1639
+ {
1640
+ $_POST['TellAFriend_Link']=$tmp;
1641
+ }
1642
+
1643
  $ct = $ct_base_call_result['ct'];
1644
  $ct_result = $ct_base_call_result['ct_result'];
1645
 
1648
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
1649
  global $ct_comment;
1650
  $ct_comment = $ct_result->comment;
1651
+ if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
1652
+ {
1653
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
1654
+ header("Content-Type: application/json");
1655
+ print json_encode($result);
1656
+ die();
1657
+ }
1658
+ else if(isset($_POST['TellAFriend_email']))
1659
+ {
1660
+ echo $ct_result->comment;
1661
+ die();
1662
+ }
1663
+ else
1664
+ {
1665
+ ct_die(null, null);
1666
+ }
1667
  } else {
1668
  echo $ct_result->comment;
1669
  }
1751
  if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
1752
  global $ct_comment;
1753
  $ct_comment = $ct_result->comment;
1754
+ if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
1755
+ {
1756
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
1757
+ header("Content-Type: application/json");
1758
+ print json_encode($result);
1759
+ die();
1760
+ }
1761
+ else
1762
+ {
1763
+ ct_die(null, null);
1764
+ }
1765
  } else {
1766
  echo $ct_result->comment;
1767
  }
cleantalk.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
- Version: 5.17
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.17';
11
  $cleantalk_executed=false;
12
 
13
  if(!defined('CLEANTALK_PLUGIN_DIR')){
@@ -18,7 +18,12 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
18
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
19
  $ct_options=ct_get_options();
20
  $ct_data=ct_get_data();
21
- ct_init_session();
 
 
 
 
 
22
  if(!isset($_SESSION['ct_redirects']))
23
  {
24
  $_SESSION['ct_redirects']=0;
@@ -82,7 +87,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
82
  add_action('admin_menu', 'ct_admin_add_page');
83
  add_action('admin_notices', 'admin_notice_message');
84
  }
85
- if (defined( 'DOING_AJAX' ) && DOING_AJAX)
86
  {
87
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
88
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-ajax.php');
@@ -104,7 +109,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
104
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
105
 
106
  // Init action.
107
- add_action('init', 'ct_init', 1);
 
108
 
109
  // Hourly run hook
110
  add_action('ct_hourly_event_hook', 'ct_do_this_hourly');
@@ -175,6 +181,28 @@ function ct_add_event($event_type)
175
  @$ct_data['stat_blocked']++;
176
  }
177
  $ct_data['stat_all']++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  update_option('cleantalk_data', $ct_data);
179
  $cleantalk_executed=true;
180
  }
@@ -201,11 +229,11 @@ function ct_add_nocache_script()
201
  function ct_add_nocache_script_footer()
202
  {
203
  global $test_external_forms;
204
- print "<script type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
205
  if($test_external_forms)
206
  {
207
  print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
208
- print "<script type='text/javascript' src='".plugins_url( '/cleantalk_external.js' , __FILE__ )."?random=".rand()."'></script>\n";
209
  }
210
  }
211
 
@@ -220,11 +248,11 @@ function ct_inject_nocache_script($html)
220
  if(!is_admin()&&stripos($html,"</body")!==false)
221
  {
222
  //$ct_replace.="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';</script>\n";
223
- $ct_replace="<script type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
224
  if($test_external_forms)
225
  {
226
  $ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
227
- $ct_replace.="<script type='text/javascript' src='".plugins_url( '/cleantalk_external.js' , __FILE__ )."?random=".rand()."'></script>\n";
228
  }
229
 
230
  //$html=str_ireplace("</body",$ct_replace."</body",$html);
3
  Plugin Name: Anti-spam by CleanTalk
4
  Plugin URI: http://cleantalk.org
5
  Description: Max power, all-in-one, captcha less, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
6
+ Version: 5.18
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.18';
11
  $cleantalk_executed=false;
12
 
13
  if(!defined('CLEANTALK_PLUGIN_DIR')){
18
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-common.php');
19
  $ct_options=ct_get_options();
20
  $ct_data=ct_get_data();
21
+ $jigo_version=@get_option('jigoshop_db_version', '');
22
+ if($jigo_version=='')
23
+ {
24
+ ct_init_session();
25
+ }
26
+
27
  if(!isset($_SESSION['ct_redirects']))
28
  {
29
  $_SESSION['ct_redirects']=0;
87
  add_action('admin_menu', 'ct_admin_add_page');
88
  add_action('admin_notices', 'admin_notice_message');
89
  }
90
+ if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action']))
91
  {
92
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
93
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-ajax.php');
109
  require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-public.php');
110
 
111
  // Init action.
112
+ //add_action('init', 'ct_init', 1);
113
+ add_action('plugins_loaded', 'ct_init', 1);
114
 
115
  // Hourly run hook
116
  add_action('ct_hourly_event_hook', 'ct_do_this_hourly');
181
  @$ct_data['stat_blocked']++;
182
  }
183
  $ct_data['stat_all']++;
184
+
185
+ $t=time();
186
+
187
+ if(!isset($ct_data['stat_accepted']))
188
+ {
189
+ $ct_data['stat_accepted']=0;
190
+ $ct_data['stat_blocked']=0;
191
+ $ct_data['stat_all']=0;
192
+ $ct_data['last_time']=$t;
193
+ update_option('cleantalk_data', $ct_data);
194
+ }
195
+
196
+ $last_time=intval($ct_data['last_time']);
197
+ if($t-$last_time>86400)
198
+ {
199
+ $ct_data['stat_accepted']=0;
200
+ $ct_data['stat_blocked']=0;
201
+ $ct_data['stat_all']=0;
202
+ $ct_data['last_time']=$t;
203
+ update_option('cleantalk_data', $ct_data);
204
+ }
205
+
206
  update_option('cleantalk_data', $ct_data);
207
  $cleantalk_executed=true;
208
  }
229
  function ct_add_nocache_script_footer()
230
  {
231
  global $test_external_forms;
232
+ print "<script async type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
233
  if($test_external_forms)
234
  {
235
  print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
236
+ print "<script async type='text/javascript' src='".plugins_url( '/cleantalk_external.js' , __FILE__ )."?random=".rand()."'></script>\n";
237
  }
238
  }
239
 
248
  if(!is_admin()&&stripos($html,"</body")!==false)
249
  {
250
  //$ct_replace.="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';</script>\n";
251
+ $ct_replace="<script async type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
252
  if($test_external_forms)
253
  {
254
  $ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
255
+ $ct_replace.="<script async type='text/javascript' src='".plugins_url( '/cleantalk_external.js' , __FILE__ )."?random=".rand()."'></script>\n";
256
  }
257
 
258
  //$html=str_ireplace("</body",$ct_replace."</body",$html);
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === Anti-Spam by CleanTalk ===
2
  Contributors: znaeff, shagimuratov, vlad-cleantalk
3
- Tags: anti-spam, antispam, bbpress, buddypress, captcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, WooCommerce, wordpress spam, booking spam, order spam, subscriptions spam, gravity spam, captcha spam, spam blocker, spam filter, jetpack, javascript, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
- Stable tag: 5.17
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -22,8 +22,8 @@ No CAPTCHA, no questions, no counting animals, no puzzles, no math and no spam b
22
  1. Stops spam in widgets.
23
  1. Check existing comments for spam.
24
 
25
- = Includes comments spam protection =
26
- Supports native WordPress, JetPack comments and any other comments plugins. Plugin moves spam comments to SPAM folder or you can set option to silent ban spam comments.
27
 
28
  = Spam bots registrations filter =
29
  Filers spam bots on registrations forms WordPress, BuddyPress, bbPress, S2Member, WooCommerce and any other registrations plugins.
@@ -88,6 +88,10 @@ The most popular method is CAPTCHA - the annoying picture with curved and slopin
88
  Sometimes CAPTCHA reminds doodle 2x year old child. For users with vision problems captcha is just an insurmountable obstacle. Users hate captcha. Captcha for users means "hate". Unreadable CAPTCHA stops about 80% of site visitors. After 2 failed attempts to bring it up to 95% reject further attempts.
89
  At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts Concerning the Need for CAPTCHA?
90
 
 
 
 
 
91
  = We recommend =
92
  Audience engagement plugin <a href="http://wordpress.org/plugins/feedweb/">Feedweb</a>
93
 
@@ -184,19 +188,19 @@ Sure, you can. You can use CleanTalk and any backend anti-spam tools to protect
184
  = Can i use CleanTalk functionality in my plugins? =
185
  Yes, you can. Just use following snippet:
186
 
187
- <?php
188
- if(!function_exists('ct_test_message')){
189
- include_once( ABSPATH . '/wp-content/plugins/cleantalk-spam-protect/cleantalk.php' );
190
- }
191
- //for registration test:
192
- $res=ct_test_registration("nickname", "stop_email@example.com", "127.0.0.1");
193
- //or for some other messages (contact forms, comments etc.)
194
- $res=ct_test_message("nickname", "stop_email@example.com", "127.0.0.1", "test message");
195
- ?>
196
 
197
  $res now contents array with two parameters:
198
- * $res['allow'] - is request allowed (1) or not (0)
199
- * $rew['comment'] - comment for our server's decision.
200
 
201
  == Other notes ==
202
 
@@ -284,6 +288,10 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
284
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
285
 
286
  == Changelog ==
 
 
 
 
287
  = 5.17 2015-07-23 =
288
  * Fixed infinite redirection after activation
289
  * Minor backend fixes
@@ -702,6 +710,10 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
702
  * First version
703
 
704
  == Upgrade Notice ==
 
 
 
 
705
  = 5.17 2015-07-23 =
706
  * Fixed infinite redirection after activation
707
  * Minor backend fixes
1
+ === Anti-Spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
  Contributors: znaeff, shagimuratov, vlad-cleantalk
3
+ Tags: anti-spam, antispam, bbpress, buddypress, captcha, cf7 spam, comments, contact form spam, signup, spam, spammers, spammy, WooCommerce, wordpress spam, booking spam, order spam, subscriptions spam, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection
4
  Requires at least: 3.0
5
  Tested up to: 4.3
6
+ Stable tag: 5.18
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
22
  1. Stops spam in widgets.
23
  1. Check existing comments for spam.
24
 
25
+ = Comments spam protection =
26
+ Supports native WordPress, JetPack comments and any other comments plugins. Plugin moves spam comments to SPAM folder or set option to silent ban spam comments.
27
 
28
  = Spam bots registrations filter =
29
  Filers spam bots on registrations forms WordPress, BuddyPress, bbPress, S2Member, WooCommerce and any other registrations plugins.
88
  Sometimes CAPTCHA reminds doodle 2x year old child. For users with vision problems captcha is just an insurmountable obstacle. Users hate captcha. Captcha for users means "hate". Unreadable CAPTCHA stops about 80% of site visitors. After 2 failed attempts to bring it up to 95% reject further attempts.
89
  At the sight of CAPTCHA and after input errors, many visitors leave the resource. Thus, CAPTCHA helps to protect the resource both from bots and visitors. CAPTCHA is not a panacea from spam. Doubts Concerning the Need for CAPTCHA?
90
 
91
+ = Public reviews =
92
+ > Using on WPLift was a great test as we receive huge amounts of spam.
93
+ > *Oliver Dale. <a href="http://wplift.com/wordpress-anti-spam-plugin" target="_blank">WPLift.com</a>.*
94
+
95
  = We recommend =
96
  Audience engagement plugin <a href="http://wordpress.org/plugins/feedweb/">Feedweb</a>
97
 
188
  = Can i use CleanTalk functionality in my plugins? =
189
  Yes, you can. Just use following snippet:
190
 
191
+ <?php
192
+ if(!function_exists('ct_test_message')){
193
+ include_once( ABSPATH . '/wp-content/plugins/cleantalk-spam-protect/cleantalk.php' );
194
+ }
195
+ //for registration test:
196
+ $res=ct_test_registration("nickname", "stop_email@example.com", "127.0.0.1");
197
+ //or for some other messages (contact forms, comments etc.)
198
+ $res=ct_test_message("nickname", "stop_email@example.com", "127.0.0.1", "test message");
199
+
200
 
201
  $res now contents array with two parameters:
202
+ * $res['allow'] - is request allowed (1) or not (0)
203
+ * $res['comment'] - comment for our server's decision.
204
 
205
  == Other notes ==
206
 
288
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
289
 
290
  == Changelog ==
291
+ = 5.18 2015-08-04 =
292
+ * Fixed issue with user_token
293
+ * Added anti-spam API, see our FAQ
294
+
295
  = 5.17 2015-07-23 =
296
  * Fixed infinite redirection after activation
297
  * Minor backend fixes
710
  * First version
711
 
712
  == Upgrade Notice ==
713
+ = 5.18 2015-08-04 =
714
+ * Fixed issue with user_token
715
+ * Added anti-spam API, see our FAQ
716
+
717
  = 5.17 2015-07-23 =
718
  * Fixed infinite redirection after activation
719
  * Minor backend fixes