Version Description
2014-04-25 = * New:FastSecureContactform support. * New: WordPressLandingPages support
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 2.40 |
Comparing to | |
See all releases |
Code changes from version 2.38 to 2.40
- cleantalk.php +314 -59
- i18n/cleantalk-es_ES.mo +0 -0
- readme.txt +8 -11
cleantalk.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Anti-spam by CleanTalk
|
4 |
-
Plugin URI: http://cleantalk.org
|
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.
|
7 |
Author: СleanTalk <welcome@cleantalk.ru>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
|
11 |
-
$ct_agent_version = 'wordpress-
|
12 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
13 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
14 |
$ct_session_request_id_label = 'request_id';
|
@@ -24,9 +24,6 @@ $ct_jpcf_fields = array('name', 'email');
|
|
24 |
// Comment already proccessed
|
25 |
$ct_comment_done = false;
|
26 |
|
27 |
-
// JetPack active
|
28 |
-
$ct_jp_active = false;
|
29 |
-
|
30 |
// Default value for JS test
|
31 |
$ct_checkjs_def = 0;
|
32 |
|
@@ -42,11 +39,20 @@ $ct_notice_trial_label = 'ct_notice_trial';
|
|
42 |
// Flag to show trial notice
|
43 |
$show_ct_notice_trial = false;
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
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' );
|
@@ -76,10 +82,13 @@ add_filter('wpcf7_spam', 'ct_wpcf7_spam');
|
|
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,10 +100,10 @@ if (is_admin()) {
|
|
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 |
|
100 |
/**
|
@@ -102,14 +111,25 @@ if (is_admin()) {
|
|
102 |
* @return mixed[] Array of options
|
103 |
*/
|
104 |
function ct_init() {
|
105 |
-
global $
|
|
|
|
|
106 |
|
107 |
$jetpack_active_modules = get_option('jetpack_active_modules');
|
108 |
-
if (
|
109 |
-
$
|
110 |
-
|
111 |
-
|
112 |
-
add_action('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
114 |
}
|
115 |
|
@@ -340,8 +360,6 @@ function ct_base_call($params = array()) {
|
|
340 |
* Adds hidden filed to comment form
|
341 |
*/
|
342 |
function ct_comment_form() {
|
343 |
-
global $ct_jp_active;
|
344 |
-
|
345 |
if (ct_is_user_enable() === false) {
|
346 |
return false;
|
347 |
}
|
@@ -351,7 +369,25 @@ function ct_comment_form() {
|
|
351 |
return false;
|
352 |
}
|
353 |
|
354 |
-
ct_add_hidden_fields(0, 'ct_checkjs', false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
return null;
|
357 |
}
|
@@ -360,9 +396,9 @@ function ct_comment_form() {
|
|
360 |
* Adds hidden filed to define avaialbility of client's JavaScript
|
361 |
* @param int $post_id Post ID, not used
|
362 |
*/
|
363 |
-
function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
364 |
|
365 |
-
global $
|
366 |
|
367 |
$ct_checkjs_key = ct_get_checkjs_value();
|
368 |
ct_init_session();
|
@@ -370,30 +406,27 @@ function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_
|
|
370 |
|
371 |
if ($cookie_check) {
|
372 |
$html = '
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
// ]]>
|
383 |
-
</script>
|
384 |
-
';
|
385 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
386 |
} else {
|
387 |
$field_id = $field_name . '_' . md5(rand(0, 1000));
|
388 |
$html = '
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
$html = sprintf($html, $field_id, $field_name, $field_id, $field_id, $ct_checkjs_def, $ct_checkjs_key);
|
397 |
}
|
398 |
if ($return_string === true) {
|
399 |
return $html;
|
@@ -460,7 +493,7 @@ function ct_frm_validate_entry ($errors, $values) {
|
|
460 |
return false;
|
461 |
}
|
462 |
|
463 |
-
$checkjs =
|
464 |
|
465 |
$post_info['comment_type'] = 'feedback';
|
466 |
$post_info = json_encode($post_info);
|
@@ -544,7 +577,7 @@ function ct_preprocess_comment($comment) {
|
|
544 |
|
545 |
$post = get_post($comment_post_id);
|
546 |
|
547 |
-
$checkjs =
|
548 |
|
549 |
$example = null;
|
550 |
|
@@ -615,7 +648,7 @@ function ct_preprocess_comment($comment) {
|
|
615 |
|
616 |
if ($ct_result->allow == 1 && $options['autoPubRevelantMess'] == 1) {
|
617 |
add_filter('pre_comment_approved', 'ct_set_approved');
|
618 |
-
setcookie($ct_approved_request_id_label, $ct_result->id, 0);
|
619 |
}
|
620 |
if ($ct_result->allow == 0) {
|
621 |
if (isset($ct_result->stop_words)) {
|
@@ -648,17 +681,46 @@ function ct_die($comment_id, $comment_status) {
|
|
648 |
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
649 |
}
|
650 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
651 |
/**
|
652 |
*
|
653 |
*
|
654 |
*/
|
655 |
-
function
|
656 |
$checkjs = null;
|
657 |
$js_field = null;
|
658 |
|
659 |
if (isset($_POST[$field_name]))
|
660 |
$js_field = $_POST[$field_name];
|
661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
if (isset($_COOKIE[$field_name]))
|
663 |
$js_field = $_COOKIE[$field_name];
|
664 |
|
@@ -855,23 +917,33 @@ function ct_unmark_red($message) {
|
|
855 |
}
|
856 |
|
857 |
/**
|
858 |
-
* Notice blog owner if plugin
|
859 |
* @return bool
|
860 |
*/
|
861 |
-
function admin_notice_message(){
|
862 |
-
global $
|
863 |
|
864 |
if (ct_active() === false)
|
865 |
return false;
|
866 |
|
867 |
$options = ct_get_options();
|
868 |
$show_notice = true;
|
869 |
-
|
870 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
871 |
}
|
872 |
|
873 |
if ($show_notice && $show_ct_notice_trial) {
|
874 |
-
|
875 |
$show_notice = false;
|
876 |
}
|
877 |
|
@@ -935,7 +1007,12 @@ function ct_plugin_active($plugin_name){
|
|
935 |
*/
|
936 |
function ct_get_checkjs_value() {
|
937 |
$options = ct_get_options();
|
938 |
-
|
|
|
|
|
|
|
|
|
|
|
939 |
}
|
940 |
|
941 |
/**
|
@@ -1029,7 +1106,7 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1029 |
return $errors;
|
1030 |
}
|
1031 |
|
1032 |
-
$checkjs =
|
1033 |
|
1034 |
require_once('cleantalk.class.php');
|
1035 |
|
@@ -1176,7 +1253,7 @@ function ct_contact_form_is_spam($form) {
|
|
1176 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1177 |
$js_field_name = $k;
|
1178 |
}
|
1179 |
-
$checkjs =
|
1180 |
|
1181 |
$sender_info = array(
|
1182 |
'sender_url' => @$form['comment_author_url']
|
@@ -1221,6 +1298,7 @@ function ct_contact_form_is_spam($form) {
|
|
1221 |
return (bool) $ct_result->spam;
|
1222 |
}
|
1223 |
|
|
|
1224 |
/**
|
1225 |
* Inserts anti-spam hidden to CF7
|
1226 |
*/
|
@@ -1252,7 +1330,7 @@ function ct_wpcf7_spam($spam) {
|
|
1252 |
return $spam;
|
1253 |
}
|
1254 |
|
1255 |
-
$checkjs =
|
1256 |
|
1257 |
$post_info['comment_type'] = 'feedback';
|
1258 |
$post_info = json_encode($post_info);
|
@@ -1307,6 +1385,70 @@ function ct_wpcf7_display_message($message, $status) {
|
|
1307 |
return $message;
|
1308 |
}
|
1309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1310 |
/**
|
1311 |
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
1312 |
* @param string $hook URL of hooked page
|
@@ -1327,7 +1469,7 @@ function ct_admin_add_page() {
|
|
1327 |
* Admin action 'admin_init' - Add the admin settings and such
|
1328 |
*/
|
1329 |
function ct_admin_init() {
|
1330 |
-
global $show_ct_notice_trial, $ct_notice_trial_label, $trial_notice_check_timeout;
|
1331 |
|
1332 |
$show_ct_notice_trial = false;
|
1333 |
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
@@ -1368,7 +1510,16 @@ function ct_admin_init() {
|
|
1368 |
}
|
1369 |
}
|
1370 |
|
1371 |
-
setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1372 |
}
|
1373 |
|
1374 |
ct_init_session();
|
@@ -1474,7 +1625,7 @@ function ct_input_contact_forms_test() {
|
|
1474 |
echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
|
1475 |
echo ' ';
|
1476 |
echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
|
1477 |
-
admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack', 'cleantalk'));
|
1478 |
}
|
1479 |
|
1480 |
/**
|
@@ -1540,7 +1691,7 @@ if (!function_exists ( 'ct_register_plugin_links')) {
|
|
1540 |
function ct_register_plugin_links($links, $file) {
|
1541 |
$base = plugin_basename(__FILE__);
|
1542 |
if ( $file == $base ) {
|
1543 |
-
$links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings'
|
1544 |
$links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
1545 |
$links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
1546 |
}
|
@@ -1549,4 +1700,108 @@ if (!function_exists ( 'ct_register_plugin_links')) {
|
|
1549 |
}
|
1550 |
|
1551 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1552 |
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Anti-spam by CleanTalk
|
4 |
+
Plugin URI: http://cleantalk.org
|
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.40
|
7 |
Author: СleanTalk <welcome@cleantalk.ru>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
|
11 |
+
$ct_agent_version = 'wordpress-240';
|
12 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
13 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
14 |
$ct_session_request_id_label = 'request_id';
|
24 |
// Comment already proccessed
|
25 |
$ct_comment_done = false;
|
26 |
|
|
|
|
|
|
|
27 |
// Default value for JS test
|
28 |
$ct_checkjs_def = 0;
|
29 |
|
39 |
// Flag to show trial notice
|
40 |
$show_ct_notice_trial = false;
|
41 |
|
42 |
+
// COOKIE label for online notice flag
|
43 |
+
$ct_notice_online_label = 'ct_notice_online';
|
44 |
+
|
45 |
+
// Flag to show online notice - 'Y' or 'N'
|
46 |
+
$show_ct_notice_online = '';
|
47 |
+
|
48 |
// Timeout before new check for trial notice in minutes
|
49 |
$trial_notice_check_timeout = 10;
|
50 |
|
51 |
+
// COOKIE label for WP Landing Page proccessing result
|
52 |
+
$ct_wplp_result_label = 'ct_wplp_result';
|
53 |
+
|
54 |
// Init action.
|
55 |
+
add_action('init', 'ct_init', 1);
|
56 |
|
57 |
// After plugin loaded - to load locale as described in manual
|
58 |
add_action( 'plugins_loaded', 'ct_plugin_loaded' );
|
82 |
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
83 |
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
84 |
|
85 |
+
// Fast Secure contact form
|
86 |
+
add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
|
87 |
+
add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
|
88 |
+
|
89 |
// Login form - for notifications only
|
90 |
add_filter('login_message', 'ct_login_message');
|
91 |
|
|
|
92 |
if (is_admin()) {
|
93 |
add_action('admin_init', 'ct_admin_init', 1);
|
94 |
add_action('admin_menu', 'ct_admin_add_page');
|
100 |
add_action('comment_approved_to_spam', 'ct_comment_spam'); // param - comment object
|
101 |
add_filter('get_comment_text', 'ct_get_comment_text'); // param - current comment text
|
102 |
add_filter('unspam_comment', 'ct_unspam_comment');
|
|
|
103 |
add_action('delete_user', 'ct_delete_user');
|
|
|
104 |
add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
|
105 |
+
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
106 |
+
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
107 |
}
|
108 |
|
109 |
/**
|
111 |
* @return mixed[] Array of options
|
112 |
*/
|
113 |
function ct_init() {
|
114 |
+
global $ct_wplp_result_label;
|
115 |
+
|
116 |
+
add_action('comment_form', 'ct_comment_form');
|
117 |
|
118 |
$jetpack_active_modules = get_option('jetpack_active_modules');
|
119 |
+
if (
|
120 |
+
(class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)) ||
|
121 |
+
(defined('LANDINGPAGES_CURRENT_VERSION'))
|
122 |
+
) {
|
123 |
+
add_action('wp_footer', 'ct_footer_add_cookie');
|
124 |
+
}
|
125 |
+
|
126 |
+
//intercept WordPress Landing Pages POST
|
127 |
+
if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
|
128 |
+
if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
|
129 |
+
ct_check_wplp();
|
130 |
+
}else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
|
131 |
+
ct_check_wplp();
|
132 |
+
}
|
133 |
}
|
134 |
}
|
135 |
|
360 |
* Adds hidden filed to comment form
|
361 |
*/
|
362 |
function ct_comment_form() {
|
|
|
|
|
363 |
if (ct_is_user_enable() === false) {
|
364 |
return false;
|
365 |
}
|
369 |
return false;
|
370 |
}
|
371 |
|
372 |
+
ct_add_hidden_fields(0, 'ct_checkjs', false, false);
|
373 |
+
|
374 |
+
return null;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* Adds cookie script filed to footer
|
379 |
+
*/
|
380 |
+
function ct_footer_add_cookie() {
|
381 |
+
if (ct_is_user_enable() === false) {
|
382 |
+
return false;
|
383 |
+
}
|
384 |
+
|
385 |
+
$options = ct_get_options();
|
386 |
+
if ($options['comments_test'] == 0) {
|
387 |
+
return false;
|
388 |
+
}
|
389 |
+
|
390 |
+
ct_add_hidden_fields(0, 'ct_checkjs', false, true);
|
391 |
|
392 |
return null;
|
393 |
}
|
396 |
* Adds hidden filed to define avaialbility of client's JavaScript
|
397 |
* @param int $post_id Post ID, not used
|
398 |
*/
|
399 |
+
function ct_add_hidden_fields($post_id = 0, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
400 |
|
401 |
+
global $ct_checkjs_def;
|
402 |
|
403 |
$ct_checkjs_key = ct_get_checkjs_value();
|
404 |
ct_init_session();
|
406 |
|
407 |
if ($cookie_check) {
|
408 |
$html = '
|
409 |
+
<script type="text/javascript">
|
410 |
+
// <![CDATA[
|
411 |
+
function ctSetCookie(c_name, value) {
|
412 |
+
document.cookie = c_name + "=" + escape(value) + "; path=/";
|
413 |
+
}
|
414 |
+
ctSetCookie("%s", "%s");
|
415 |
+
// ]]>
|
416 |
+
</script>
|
417 |
+
';
|
|
|
|
|
|
|
418 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
419 |
} else {
|
420 |
$field_id = $field_name . '_' . md5(rand(0, 1000));
|
421 |
$html = '
|
422 |
+
<input type="hidden" id="%s" name="%s" value="%s" />
|
423 |
+
<script type="text/javascript">
|
424 |
+
// <![CDATA[
|
425 |
+
document.getElementById("%s").value = document.getElementById("%s").value.replace(/^%s$/, "%s");
|
426 |
+
// ]]>
|
427 |
+
</script>
|
428 |
+
';
|
429 |
+
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_def, $field_id, $field_id, $ct_checkjs_def, $ct_checkjs_key);
|
430 |
}
|
431 |
if ($return_string === true) {
|
432 |
return $html;
|
493 |
return false;
|
494 |
}
|
495 |
|
496 |
+
$checkjs = js_test_post($ct_checkjs_frm);
|
497 |
|
498 |
$post_info['comment_type'] = 'feedback';
|
499 |
$post_info = json_encode($post_info);
|
577 |
|
578 |
$post = get_post($comment_post_id);
|
579 |
|
580 |
+
$checkjs = js_test_post('ct_checkjs');
|
581 |
|
582 |
$example = null;
|
583 |
|
648 |
|
649 |
if ($ct_result->allow == 1 && $options['autoPubRevelantMess'] == 1) {
|
650 |
add_filter('pre_comment_approved', 'ct_set_approved');
|
651 |
+
setcookie($ct_approved_request_id_label, $ct_result->id, 0, '/');
|
652 |
}
|
653 |
if ($ct_result->allow == 0) {
|
654 |
if (isset($ct_result->stop_words)) {
|
681 |
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
682 |
}
|
683 |
|
684 |
+
/**
|
685 |
+
* Set die page with Cleantalk comment from parameter.
|
686 |
+
* @param type $comment_body
|
687 |
+
*/
|
688 |
+
function ct_die_extended($comment_body) {
|
689 |
+
$err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
|
690 |
+
$err_text .= '<script>setTimeout("history.back()", 5000);</script>';
|
691 |
+
wp_die($err_text, 'Blacklisted', array('back_link' => true));
|
692 |
+
}
|
693 |
+
|
694 |
/**
|
695 |
*
|
696 |
*
|
697 |
*/
|
698 |
+
function js_test_post($field_name = 'ct_checkjs') {
|
699 |
$checkjs = null;
|
700 |
$js_field = null;
|
701 |
|
702 |
if (isset($_POST[$field_name]))
|
703 |
$js_field = $_POST[$field_name];
|
704 |
|
705 |
+
if ($js_field !== null) {
|
706 |
+
if($js_field == ct_get_checkjs_value()) {
|
707 |
+
$checkjs = 1;
|
708 |
+
} else {
|
709 |
+
$checkjs = 0;
|
710 |
+
}
|
711 |
+
}
|
712 |
+
|
713 |
+
return $checkjs;
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
*
|
718 |
+
*
|
719 |
+
*/
|
720 |
+
function js_test_cookie($field_name = 'ct_checkjs') {
|
721 |
+
$checkjs = null;
|
722 |
+
$js_field = null;
|
723 |
+
|
724 |
if (isset($_COOKIE[$field_name]))
|
725 |
$js_field = $_COOKIE[$field_name];
|
726 |
|
917 |
}
|
918 |
|
919 |
/**
|
920 |
+
* Notice blog owner if plugin is used without Access key
|
921 |
* @return bool
|
922 |
*/
|
923 |
+
function admin_notice_message(){
|
924 |
+
global $show_ct_notice_trial, $show_ct_notice_online;
|
925 |
|
926 |
if (ct_active() === false)
|
927 |
return false;
|
928 |
|
929 |
$options = ct_get_options();
|
930 |
$show_notice = true;
|
931 |
+
if ($show_notice && ct_valid_key($options['apikey']) === false) {
|
932 |
+
echo '<div class="updated"><p>' . __("Please enter the Access Key in <a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a> settings to enable protection from spam in comments!", 'cleantalk') . '</p></div>';
|
933 |
+
}
|
934 |
+
|
935 |
+
if ($show_notice && !empty($show_ct_notice_online)) {
|
936 |
+
echo '<div class="updated"><p><b>';
|
937 |
+
if($show_ct_notice_online === 'Y'){
|
938 |
+
echo __("Please don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
|
939 |
+
}else{
|
940 |
+
echo __("Wrong </b><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b><b> access key! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
|
941 |
+
}
|
942 |
+
echo '</b></p></div>';
|
943 |
}
|
944 |
|
945 |
if ($show_notice && $show_ct_notice_trial) {
|
946 |
+
echo '<div class="updated"><p>' . __("CleanTalk anti-spam trial period will end soon, please upgrade to <a href=\"http://cleantalk.org/my\" target=\"_blank\"><b>premium version</b></a>!", 'cleantalk') . '</p></div>';
|
947 |
$show_notice = false;
|
948 |
}
|
949 |
|
1007 |
*/
|
1008 |
function ct_get_checkjs_value() {
|
1009 |
$options = ct_get_options();
|
1010 |
+
|
1011 |
+
$remote_addr = '';
|
1012 |
+
if (isset($_SERVER['REMOTE_ADDR']))
|
1013 |
+
$remote_addr = $_SERVER['REMOTE_ADDR'];
|
1014 |
+
|
1015 |
+
return md5($options['apikey'] . '+' . $remote_addr);
|
1016 |
}
|
1017 |
|
1018 |
/**
|
1106 |
return $errors;
|
1107 |
}
|
1108 |
|
1109 |
+
$checkjs = js_test_post($ct_checkjs_register_form);
|
1110 |
|
1111 |
require_once('cleantalk.class.php');
|
1112 |
|
1253 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1254 |
$js_field_name = $k;
|
1255 |
}
|
1256 |
+
$checkjs = js_test_cookie($js_field_name);
|
1257 |
|
1258 |
$sender_info = array(
|
1259 |
'sender_url' => @$form['comment_author_url']
|
1298 |
return (bool) $ct_result->spam;
|
1299 |
}
|
1300 |
|
1301 |
+
|
1302 |
/**
|
1303 |
* Inserts anti-spam hidden to CF7
|
1304 |
*/
|
1330 |
return $spam;
|
1331 |
}
|
1332 |
|
1333 |
+
$checkjs = js_test_post($ct_checkjs_cf7);
|
1334 |
|
1335 |
$post_info['comment_type'] = 'feedback';
|
1336 |
$post_info = json_encode($post_info);
|
1385 |
return $message;
|
1386 |
}
|
1387 |
|
1388 |
+
/**
|
1389 |
+
* Inserts anti-spam hidden to Fast Secure contact form
|
1390 |
+
*/
|
1391 |
+
function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
|
1392 |
+
$string .= ct_add_hidden_fields(0, 'ct_checkjs', true);
|
1393 |
+
return $string;
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
/**
|
1397 |
+
* Test for Fast Secure contact form
|
1398 |
+
*/
|
1399 |
+
function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
1400 |
+
if (!empty($form_errors))
|
1401 |
+
return $form_errors;
|
1402 |
+
|
1403 |
+
$options = ct_get_options();
|
1404 |
+
if ($options['contact_forms_test'] == 0)
|
1405 |
+
return $form_errors;
|
1406 |
+
|
1407 |
+
$checkjs = js_test_post('ct_checkjs');
|
1408 |
+
|
1409 |
+
$post_info['comment_type'] = 'feedback';
|
1410 |
+
$post_info = json_encode($post_info);
|
1411 |
+
if ($post_info === false)
|
1412 |
+
$post_info = '';
|
1413 |
+
|
1414 |
+
$sender_email = null;
|
1415 |
+
$sender_nickname = null;
|
1416 |
+
$subject = '';
|
1417 |
+
$message = '';
|
1418 |
+
if (isset($_POST['email']))
|
1419 |
+
$sender_email = $_POST['email'];
|
1420 |
+
|
1421 |
+
if (isset($_POST['full_name']))
|
1422 |
+
$sender_nickname = $_POST['full_name'];
|
1423 |
+
|
1424 |
+
if (isset($_POST['subject']))
|
1425 |
+
$subject = $_POST['subject'];
|
1426 |
+
|
1427 |
+
if (isset($_POST['message']))
|
1428 |
+
$message = $_POST['message'];
|
1429 |
+
|
1430 |
+
$ct_base_call_result = ct_base_call(array(
|
1431 |
+
'message' => $subject . "\n\n" . $message,
|
1432 |
+
'example' => null,
|
1433 |
+
'sender_email' => $sender_email,
|
1434 |
+
'sender_nickname' => $sender_nickname,
|
1435 |
+
'post_info' => $post_info,
|
1436 |
+
'sender_info' => $sender_info,
|
1437 |
+
'checkjs' => $checkjs
|
1438 |
+
));
|
1439 |
+
$ct = $ct_base_call_result['ct'];
|
1440 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
1441 |
+
|
1442 |
+
if ($ct_result->spam == 1) {
|
1443 |
+
global $ct_comment;
|
1444 |
+
$ct_comment = $ct_result->comment;
|
1445 |
+
ct_die(null, null);
|
1446 |
+
exit;
|
1447 |
+
}
|
1448 |
+
|
1449 |
+
return $form_errors;
|
1450 |
+
}
|
1451 |
+
|
1452 |
/**
|
1453 |
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
1454 |
* @param string $hook URL of hooked page
|
1469 |
* Admin action 'admin_init' - Add the admin settings and such
|
1470 |
*/
|
1471 |
function ct_admin_init() {
|
1472 |
+
global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout;
|
1473 |
|
1474 |
$show_ct_notice_trial = false;
|
1475 |
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
1510 |
}
|
1511 |
}
|
1512 |
|
1513 |
+
setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"), '/');
|
1514 |
+
}
|
1515 |
+
|
1516 |
+
$show_ct_notice_online = '';
|
1517 |
+
if (isset($_COOKIE[$ct_notice_online_label])) {
|
1518 |
+
if ($_COOKIE[$ct_notice_online_label] == 1) {
|
1519 |
+
$show_ct_notice_online = 'Y';
|
1520 |
+
}else{
|
1521 |
+
$show_ct_notice_online = 'N';
|
1522 |
+
}
|
1523 |
}
|
1524 |
|
1525 |
ct_init_session();
|
1625 |
echo "<input type='radio' id='cleantalk_contact_forms_test1' name='cleantalk_settings[contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test1'> " . __('Yes') . "</label>";
|
1626 |
echo ' ';
|
1627 |
echo "<input type='radio' id='cleantalk_contact_forms_test0' name='cleantalk_settings[contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_contact_forms_test0'> " . __('No') . "</label>";
|
1628 |
+
admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
|
1629 |
}
|
1630 |
|
1631 |
/**
|
1691 |
function ct_register_plugin_links($links, $file) {
|
1692 |
$base = plugin_basename(__FILE__);
|
1693 |
if ( $file == $base ) {
|
1694 |
+
$links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1695 |
$links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
1696 |
$links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
1697 |
}
|
1700 |
}
|
1701 |
|
1702 |
|
1703 |
+
/**
|
1704 |
+
* Manage links in plugins list
|
1705 |
+
* @return array
|
1706 |
+
*/
|
1707 |
+
if (!function_exists ( 'ct_plugin_action_links')) {
|
1708 |
+
function ct_plugin_action_links($links, $file) {
|
1709 |
+
$base = plugin_basename(__FILE__);
|
1710 |
+
if ( $file == $base ) {
|
1711 |
+
$settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1712 |
+
array_unshift( $links, $settings_link ); // before other links
|
1713 |
+
}
|
1714 |
+
return $links;
|
1715 |
+
}
|
1716 |
+
}
|
1717 |
+
|
1718 |
+
/**
|
1719 |
+
* After options update
|
1720 |
+
* @return array
|
1721 |
+
*/
|
1722 |
+
function ct_update_option($option_name) {
|
1723 |
+
global $show_ct_notice_online, $ct_notice_online_label;
|
1724 |
+
if($option_name !== 'cleantalk_settings')
|
1725 |
+
return;
|
1726 |
+
$ct_base_call_result = ct_base_call(array(
|
1727 |
+
'message' => 'CleanTalk setup comment',
|
1728 |
+
'example' => null,
|
1729 |
+
'sender_email' => 'stop_email@example.com',
|
1730 |
+
'sender_nickname' => 'CleanTalk',
|
1731 |
+
'post_info' => '',
|
1732 |
+
'checkjs' => 1
|
1733 |
+
));
|
1734 |
+
$ct = $ct_base_call_result['ct'];
|
1735 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
1736 |
+
|
1737 |
+
if ($ct_result->inactive == 1) {
|
1738 |
+
setcookie($ct_notice_online_label, 0, strtotime("+5 seconds"), '/');
|
1739 |
+
}else{
|
1740 |
+
setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
|
1741 |
+
}
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
/**
|
1745 |
+
* Checks WordPress Landing Pages raw $_POST values
|
1746 |
+
*/
|
1747 |
+
function ct_check_wplp(){
|
1748 |
+
global $ct_wplp_result_label;
|
1749 |
+
if (!isset($_COOKIE[$ct_wplp_result_label])) {
|
1750 |
+
// First AJAX submit of WPLP form
|
1751 |
+
$options = ct_get_options();
|
1752 |
+
if ($options['contact_forms_test'] == 0)
|
1753 |
+
return;
|
1754 |
+
|
1755 |
+
$checkjs = js_test_cookie('ct_checkjs');
|
1756 |
+
if (null === $checkjs)
|
1757 |
+
$checkjs = 0;
|
1758 |
+
|
1759 |
+
$post_info['comment_type'] = 'feedback';
|
1760 |
+
$post_info = json_encode($post_info);
|
1761 |
+
if ($post_info === false)
|
1762 |
+
$post_info = '';
|
1763 |
+
|
1764 |
+
$sender_email = '';
|
1765 |
+
foreach ($_POST as $v) {
|
1766 |
+
if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
|
1767 |
+
$sender_email = $v;
|
1768 |
+
break;
|
1769 |
+
}
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
$message = '';
|
1773 |
+
if(array_key_exists('form_input_values', $_POST)){
|
1774 |
+
$form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
|
1775 |
+
if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
|
1776 |
+
$message = $form_input_values['null'];
|
1777 |
+
}else if(array_key_exists('null', $_POST)){
|
1778 |
+
$message = $_POST['null'];
|
1779 |
+
}
|
1780 |
+
|
1781 |
+
$ct_base_call_result = ct_base_call(array(
|
1782 |
+
'message' => $message,
|
1783 |
+
'example' => null,
|
1784 |
+
'sender_email' => $sender_email,
|
1785 |
+
'sender_nickname' => null,
|
1786 |
+
'post_info' => $post_info,
|
1787 |
+
'checkjs' => $checkjs
|
1788 |
+
));
|
1789 |
+
$ct = $ct_base_call_result['ct'];
|
1790 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
1791 |
+
|
1792 |
+
if ($ct_result->spam == 1) {
|
1793 |
+
$cleantalk_comment = $ct_result->comment;
|
1794 |
+
} else {
|
1795 |
+
$cleantalk_comment = 'OK';
|
1796 |
+
}
|
1797 |
+
|
1798 |
+
setcookie($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
|
1799 |
+
} else {
|
1800 |
+
// Next POST/AJAX submit(s) of same WPLP form
|
1801 |
+
$cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
|
1802 |
+
}
|
1803 |
+
if ($cleantalk_comment !== 'OK')
|
1804 |
+
ct_die_extended($cleantalk_comment);
|
1805 |
+
}
|
1806 |
+
|
1807 |
?>
|
i18n/cleantalk-es_ES.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Anti-spam by CleanTalk ===
|
2 |
Contributors: znaeff, shagimuratov
|
3 |
-
Tags: antispam, anti-spam, anti spam, spam, spammers, captcha,
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.9
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -24,16 +24,9 @@ We have developed anti-spam CleanTalk that would provide **maximum protection fr
|
|
24 |
* WordPress, BuddyPress, bbPress signups.
|
25 |
* Formiadble forms, Contact form 7, JetPack Contact form.
|
26 |
* WooCommerce review form.
|
|
|
27 |
* WordPress Landing Pages.
|
28 |
|
29 |
-
= Spam protection methods =
|
30 |
-
Plugin uses several simple tests to stop spammers.
|
31 |
-
|
32 |
-
1. JavaScript anti spam test. 99% spam bots doesn't have all JavaScript functions support. So, the plugin has code which can run normal visitor and can't run the spam bot.
|
33 |
-
1. Checks by Email, IP, domains at spam activities list. The plugin online use spam activity database at cleantalk.org, which are consist more then 1 billion records about spam activity IPs, Email, Domains and ASN.If the senders IP or Email matches with database, the sender gets some spam scores. To reduce false/positive rate the plugin doesn't use only blacklist test to ban spammers. The sender will be banned only if multiple spam test failed.
|
34 |
-
1. Comment submit time. Spam bots usually send post immediately after page load, because spam bots not really fill the web form, they are only send $_POST data to the blog. The normal visitor send the data within several seconds or minutes.
|
35 |
-
1. Relevance test for the comments. Spam bots posts send to the blog comments which are not matched with article by relevance, so the plugin can filter spam bots with offtop filter.
|
36 |
-
|
37 |
= Anti spam plugin info =
|
38 |
The plugin developers had a long time experience in front-end, backend and server-side PHP programming, client side JavaScript and HTML programming. We were looking for an anti spam tool which is strong for spam bots and invisible to visitors, but nothing matched their criteria. So, we are started an anti-spam project called CleanTalk.
|
39 |
|
@@ -110,10 +103,14 @@ WordPress 3.0 at least. PHP 4, 5 with CURL or file_get_contents() function and e
|
|
110 |
== Screenshots ==
|
111 |
1. Plugin settings screen.
|
112 |
1. Android app main screen.
|
113 |
-
1. Anti spam
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
117 |
= 2.38 2014-03-27 =
|
118 |
* Fixed: Registraion form submit time spam test.
|
119 |
|
1 |
=== Anti-spam by CleanTalk ===
|
2 |
Contributors: znaeff, shagimuratov
|
3 |
+
Tags: antispam, anti-spam, anti spam, spam, spammers, captcha, comments, registration, contact form, blacklists, math, signup, formidable, bot, spam bots, спам, quiz
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.9
|
6 |
+
Stable tag: 2.40
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
24 |
* WordPress, BuddyPress, bbPress signups.
|
25 |
* Formiadble forms, Contact form 7, JetPack Contact form.
|
26 |
* WooCommerce review form.
|
27 |
+
* Fast Secure Contact form.
|
28 |
* WordPress Landing Pages.
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
= Anti spam plugin info =
|
31 |
The plugin developers had a long time experience in front-end, backend and server-side PHP programming, client side JavaScript and HTML programming. We were looking for an anti spam tool which is strong for spam bots and invisible to visitors, but nothing matched their criteria. So, we are started an anti-spam project called CleanTalk.
|
32 |
|
103 |
== Screenshots ==
|
104 |
1. Plugin settings screen.
|
105 |
1. Android app main screen.
|
106 |
+
1. Anti spam stopped spam bot at the registration form.
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 2.40 2014-04-25 =
|
111 |
+
* New: Fast Secure Contact form support.
|
112 |
+
* New: WordPress Landing Pages support
|
113 |
+
|
114 |
= 2.38 2014-03-27 =
|
115 |
* Fixed: Registraion form submit time spam test.
|
116 |
|