Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.10

Version Description

2015-05-25 = * Fixed Javascript error on some forms

Download this release

Release Info

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

Code changes from version 5.9 to 5.10

cleantalk-common.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $ct_agent_version = 'wordpress-59';
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-510';
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
@@ -105,6 +105,9 @@ function ct_init() {
105
  ct_s2member_registration_test();
106
  }
107
 
 
 
 
108
  //
109
  // New user approve hack
110
  // https://wordpress.org/plugins/new-user-approve/
@@ -275,8 +278,11 @@ function ct_frm_validate_entry ($errors, $values) {
275
  if ($ct_options['contact_forms_test'] == 0) {
276
  return false;
277
  }
278
-
279
- $checkjs = js_test($ct_checkjs_frm, $_POST);
 
 
 
280
 
281
  $post_info['comment_type'] = 'feedback';
282
  $post_info = json_encode($post_info);
@@ -1401,6 +1407,7 @@ function ct_contact_form_validate () {
1401
  {
1402
  return null;
1403
  }
 
1404
  /*if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
1405
  {
1406
  return null;
105
  ct_s2member_registration_test();
106
  }
107
 
108
+ //hook for Anonymous Post
109
+ add_action('template_redirect','ct_contact_form_validate',1);
110
+
111
  //
112
  // New user approve hack
113
  // https://wordpress.org/plugins/new-user-approve/
278
  if ($ct_options['contact_forms_test'] == 0) {
279
  return false;
280
  }
281
+
282
+ $checkjs = js_test('ct_checkjs', $_COOKIE, true);
283
+ if($checkjs != 1){
284
+ $checkjs = js_test($ct_checkjs_frm, $_POST, true);
285
+ }
286
 
287
  $post_info['comment_type'] = 'feedback';
288
  $post_info = json_encode($post_info);
1407
  {
1408
  return null;
1409
  }
1410
+ $cleantalk_executed=true;
1411
  /*if ((defined( 'DOING_AJAX' ) && DOING_AJAX))
1412
  {
1413
  return null;
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.9
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
- $cleantalk_plugin_version='5.9';
11
  $cleantalk_executed=false;
12
 
13
  if(!defined('CLEANTALK_PLUGIN_DIR')){
@@ -27,6 +27,8 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
27
  add_action( 'plugins_loaded', 'ct_plugin_loaded' );
28
 
29
  add_action('wp_loaded', 'ct_add_nocache_script', 1);
 
 
30
  add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
31
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
32
 
@@ -155,15 +157,30 @@ function ct_add_nocache_script()
155
  ob_start('ct_inject_nocache_script');
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
158
  function ct_inject_nocache_script($html)
159
  {
160
- if(stripos($html,"</body")!==false)
161
  {
162
- $ct_replace="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';</script>\n";
163
- $ct_replace.="<script type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
164
  //$html=str_ireplace("</body",$ct_replace."</body",$html);
165
  $html=substr_replace($html,$ct_replace."</body",strripos($html,"</body"),6);
166
  }
 
 
 
 
 
167
  return $html;
168
  }
169
 
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.10
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
10
+ $cleantalk_plugin_version='5.10';
11
  $cleantalk_executed=false;
12
 
13
  if(!defined('CLEANTALK_PLUGIN_DIR')){
27
  add_action( 'plugins_loaded', 'ct_plugin_loaded' );
28
 
29
  add_action('wp_loaded', 'ct_add_nocache_script', 1);
30
+ add_action('wp_footer', 'ct_add_nocache_script_footer', 1);
31
+ add_action('wp_head', 'ct_add_nocache_script_header', 1);
32
  add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
33
  add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
34
 
157
  ob_start('ct_inject_nocache_script');
158
  }
159
 
160
+ function ct_add_nocache_script_footer()
161
+ {
162
+ print "<script type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
163
+ }
164
+
165
+ function ct_add_nocache_script_header()
166
+ {
167
+ print "\n<script type='text/javascript'>\nvar ct_ajaxurl = '".admin_url('admin-ajax.php')."';\n</script>\n";
168
+ }
169
+
170
  function ct_inject_nocache_script($html)
171
  {
172
+ if(!is_admin()&&stripos($html,"</body")!==false)
173
  {
174
+ //$ct_replace.="\n<script type='text/javascript'>var ajaxurl = '".admin_url('admin-ajax.php')."';</script>\n";
175
+ $ct_replace="<script type='text/javascript' src='".plugins_url( '/cleantalk_nocache.js' , __FILE__ )."?random=".rand()."'></script>\n";
176
  //$html=str_ireplace("</body",$ct_replace."</body",$html);
177
  $html=substr_replace($html,$ct_replace."</body",strripos($html,"</body"),6);
178
  }
179
+ if(!is_admin()&&preg_match("#<head[^>]*>#i",$html)==1)
180
+ {
181
+ $ct_replace="\n<script type='text/javascript'>\nvar ct_ajaxurl = '".admin_url('admin-ajax.php')."';\n</script>\n";
182
+ $html=preg_replace("(<head[^>]*>)","$0".$ct_replace,$html,1);
183
+ }
184
  return $html;
185
  }
186
 
cleantalk_nocache.js CHANGED
@@ -40,7 +40,7 @@ function createXMLHTTPObject() {
40
 
41
  function ct_callback(req)
42
  {
43
- ct_cookie=req.responseText;
44
  //alert('Key value: ' + ct_cookie);
45
 
46
  var domain=location.hostname;
@@ -72,7 +72,7 @@ function ct_callback(req)
72
  for(j=0;j<f.elements.length;j++)
73
  {
74
  e=f.elements[j];
75
- if(e.name.indexOf('ct_checkjs')!=-1)
76
  {
77
  e.value=ct_cookie;
78
  //alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);
@@ -80,4 +80,8 @@ function ct_callback(req)
80
  }
81
  }
82
  }
83
- sendRequest(ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');
 
 
 
 
40
 
41
  function ct_callback(req)
42
  {
43
+ ct_cookie=req.responseText.trim();
44
  //alert('Key value: ' + ct_cookie);
45
 
46
  var domain=location.hostname;
72
  for(j=0;j<f.elements.length;j++)
73
  {
74
  e=f.elements[j];
75
+ if(e.name!==undefined&&e.name.indexOf('ct_checkjs')!=-1)
76
  {
77
  e.value=ct_cookie;
78
  //alert('Form #' + i + ', field ' + e.name + ' = ' + ct_cookie);
80
  }
81
  }
82
  }
83
+ if(ct_nocache_executed==undefined)
84
+ {
85
+ var ct_nocache_executed=true;
86
+ sendRequest(ct_ajaxurl+'?'+Math.random(),ct_callback,'action=ct_get_cookie');
87
+ }
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Anti-spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
  Contributors: znaeff, shagimuratov, vlad-cleantalk
3
- Tags: akismet, anti-spam, antispam, bbpress spam, buddypress spam, captcha antispam, cf7 spam, comments spam, contact form spam, form, Formidable spam, jetpack spam, math, registration spam, s2member spam, signup spam, spam, spammers, spammy, WooCommerce spam, wordpress spam, booking spam, order spam, subscriptions spam, comments, gravity spam, gravity forms spam, widget, widget antispam, registration, spam pingbacks
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
- Stable tag: 5.9
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -46,7 +46,7 @@ We have developed antispam for WordPress that would provide **maximum protection
46
 
47
  The anti-spam method offered by CleanTalk allows to switch from the methods that trouble the communication (CAPTCHA, question-answer etc.) to a more convenient one.
48
 
49
- The CleanTalk is premium anti-spam for WordPress, please look at the <a href="http://cleantalk.org/price">pricing</a>. The plugin works with cloud anti spam service CleanTalk. <b>CleanTalk has free trial for 14 days.</b> We try to provide anti-spam service at the highest level and we can not afford to offer a free version of our service, as this will immediately affect the quality of providing anti-spam protection. Paying for a year of anti-spam service, you save a lot more and get:
50
 
51
  * Up to 100% protection against spam bots.
52
  * Time and resources saving.
@@ -181,6 +181,9 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
181
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
182
 
183
  == Changelog ==
 
 
 
184
  = 5.9 2015-05-21 =
185
  * Fixed Javascript error on CF7 and JetPack
186
  * Some backend and frontent fixes
@@ -571,6 +574,9 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
571
  * First version
572
 
573
  == Upgrade Notice ==
 
 
 
574
  = 5.9 2015-05-21 =
575
  * Fixed Javascript error on CF7 and JetPack
576
  * Some backend and frontent fixes
1
  === Anti-spam by CleanTalk - No Captcha, no comments & registrations spam ===
2
  Contributors: znaeff, shagimuratov, vlad-cleantalk
3
+ Tags: akismet, anti-spam, antispam, bbpress spam, buddypress spam, captcha antispam, cf7 spam, comments spam, contact form spam, form, Formidable spam, jetpack spam, math, registration spam, s2member spam, signup spam, spam, spammers, spammy, WooCommerce spam, wordpress spam, booking spam, order spam, subscriptions spam, comments, gravity spam, gravity forms spam, widget, widget antispam, registration
4
  Requires at least: 3.0
5
  Tested up to: 4.2.2
6
+ Stable tag: 5.10
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
46
 
47
  The anti-spam method offered by CleanTalk allows to switch from the methods that trouble the communication (CAPTCHA, question-answer etc.) to a more convenient one.
48
 
49
+ CleanTalk is premium anti-spam for WordPress, please look at the <a href="http://cleantalk.org/price">pricing</a>. The plugin works with cloud anti spam service CleanTalk. <b>CleanTalk has free trial for 14 days.</b> We try to provide anti-spam service at the highest level and we can not afford to offer a free version of our service, as this will immediately affect the quality of providing anti-spam protection. Paying for a year of anti-spam service, you save a lot more and get:
50
 
51
  * Up to 100% protection against spam bots.
52
  * Time and resources saving.
181
  1. Setup Android/iOS app to have push notices when new legitiamte comments/registrations or contactcs appears on the website.
182
 
183
  == Changelog ==
184
+ = 5.10 2015-05-25 =
185
+ * Fixed Javascript error on some forms
186
+
187
  = 5.9 2015-05-21 =
188
  * Fixed Javascript error on CF7 and JetPack
189
  * Some backend and frontent fixes
574
  * First version
575
 
576
  == Upgrade Notice ==
577
+ = 5.10 2015-05-25 =
578
+ * Fixed Javascript error on some forms
579
+
580
  = 5.9 2015-05-21 =
581
  * Fixed Javascript error on CF7 and JetPack
582
  * Some backend and frontent fixes