Version Description
Download this release
Release Info
Developer | Vlad Cleantalk |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 4.24-j |
Comparing to | |
See all releases |
Code changes from version 4.24 to 4.24-j
- cleantalk-public.php +71 -1
cleantalk-public.php
CHANGED
@@ -35,7 +35,18 @@ function ct_init() {
|
|
35 |
$jetpack_active_modules = false;
|
36 |
if(defined('JETPACK__VERSION')){
|
37 |
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
$jetpack_active_modules = get_option('jetpack_active_modules');
|
40 |
if (
|
41 |
(class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules))
|
@@ -953,6 +964,65 @@ function ct_contact_form_is_spam($form) {
|
|
953 |
return (bool) $ct_result->spam;
|
954 |
}
|
955 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
956 |
|
957 |
/**
|
958 |
* Inserts anti-spam hidden to CF7
|
35 |
$jetpack_active_modules = false;
|
36 |
if(defined('JETPACK__VERSION')){
|
37 |
add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
|
38 |
+
if(JETPACK__VERSION=='3.4-beta')
|
39 |
+
{
|
40 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
41 |
+
}
|
42 |
+
else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
|
43 |
+
{
|
44 |
+
add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',1,2);
|
45 |
+
}
|
46 |
+
else
|
47 |
+
{
|
48 |
+
add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
|
49 |
+
}
|
50 |
$jetpack_active_modules = get_option('jetpack_active_modules');
|
51 |
if (
|
52 |
(class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules))
|
964 |
return (bool) $ct_result->spam;
|
965 |
}
|
966 |
|
967 |
+
function ct_contact_form_is_spam_jetpack($is_spam,$form) {
|
968 |
+
global $ct_checkjs_jpcf, $ct_options, $ct_data;
|
969 |
+
|
970 |
+
if ($ct_options['contact_forms_test'] == 0) {
|
971 |
+
return null;
|
972 |
+
}
|
973 |
+
|
974 |
+
$js_field_name = $ct_checkjs_jpcf;
|
975 |
+
foreach ($_POST as $k => $v) {
|
976 |
+
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
977 |
+
$js_field_name = $k;
|
978 |
+
}
|
979 |
+
|
980 |
+
$checkjs = js_test($js_field_name, $_POST, true);
|
981 |
+
|
982 |
+
$sender_info = array(
|
983 |
+
'sender_url' => @$form['comment_author_url']
|
984 |
+
);
|
985 |
+
|
986 |
+
$post_info['comment_type'] = 'feedback';
|
987 |
+
$post_info = json_encode($post_info);
|
988 |
+
if ($post_info === false)
|
989 |
+
$post_info = '';
|
990 |
+
|
991 |
+
$sender_email = null;
|
992 |
+
$sender_nickname = null;
|
993 |
+
$message = '';
|
994 |
+
if (isset($form['comment_author_email']))
|
995 |
+
$sender_email = $form['comment_author_email'];
|
996 |
+
|
997 |
+
if (isset($form['comment_author']))
|
998 |
+
$sender_nickname = $form['comment_author'];
|
999 |
+
|
1000 |
+
if (isset($form['comment_content']))
|
1001 |
+
$message = $form['comment_content'];
|
1002 |
+
|
1003 |
+
$ct_base_call_result = ct_base_call(array(
|
1004 |
+
'message' => $message,
|
1005 |
+
'example' => null,
|
1006 |
+
'sender_email' => $sender_email,
|
1007 |
+
'sender_nickname' => $sender_nickname,
|
1008 |
+
'post_info' => $post_info,
|
1009 |
+
'sender_info' => $sender_info,
|
1010 |
+
'checkjs' => $checkjs
|
1011 |
+
));
|
1012 |
+
$ct = $ct_base_call_result['ct'];
|
1013 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
1014 |
+
|
1015 |
+
if ($ct_result->spam == 1) {
|
1016 |
+
global $ct_comment;
|
1017 |
+
$ct_comment = $ct_result->comment;
|
1018 |
+
ct_die(null, null);
|
1019 |
+
exit;
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
return (bool) $ct_result->spam;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
|
1026 |
|
1027 |
/**
|
1028 |
* Inserts anti-spam hidden to CF7
|