Version Description
November 2 2016 = * Added protection for internal forms * Immediate spam check for comments and users from WP dashboard * Optimized code
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.51 |
Comparing to | |
See all releases |
Code changes from version 5.50.1 to 5.51
- cleantalk.php +23 -18
- inc/cleantalk-admin.php +21 -0
- inc/cleantalk-admin_old.php +0 -1219
- inc/cleantalk-comments-checkspam.js +5 -5
- inc/cleantalk-common.php +1 -0
- inc/cleantalk-public.php +19 -1
- inc/cleantalk-users-checkspam.js +6 -5
- inc/cleantalk_internal.js +54 -0
- readme.txt +12 -2
cleantalk.php
CHANGED
@@ -3,12 +3,12 @@
|
|
3 |
Plugin Name: Spam Protection by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
-
$ct_agent_version = 'wordpress-
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
@@ -149,21 +149,15 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
149 |
//cron end
|
150 |
}
|
151 |
|
152 |
-
if(isset($ct_options['check_external']))
|
153 |
-
|
154 |
-
if(@intval($ct_options['check_external'])==1)
|
155 |
-
{
|
156 |
-
$test_external_forms=true;
|
157 |
-
}
|
158 |
-
else
|
159 |
-
{
|
160 |
-
$test_external_forms=false;
|
161 |
-
}
|
162 |
-
}
|
163 |
else
|
164 |
-
{
|
165 |
$test_external_forms=false;
|
166 |
-
|
|
|
|
|
|
|
|
|
167 |
|
168 |
// Activation/deactivation functions must be in main plugin file.
|
169 |
// http://codex.wordpress.org/Function_Reference/register_activation_hook
|
@@ -451,13 +445,18 @@ function ct_add_nocache_script_footer()
|
|
451 |
{
|
452 |
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
453 |
{
|
454 |
-
global $test_external_forms, $cleantalk_plugin_version;
|
|
|
455 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
456 |
if($test_external_forms)
|
457 |
{
|
458 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
459 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
460 |
}
|
|
|
|
|
|
|
|
|
461 |
//print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk-info.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
462 |
}
|
463 |
}
|
@@ -503,7 +502,7 @@ function ct_inject_nocache_script($html)
|
|
503 |
{
|
504 |
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
505 |
{
|
506 |
-
global $test_external_forms, $cleantalk_plugin_version, $ct_options;
|
507 |
|
508 |
$ct_info_flag = ct_set_info_flag();
|
509 |
|
@@ -516,6 +515,10 @@ function ct_inject_nocache_script($html)
|
|
516 |
$ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
517 |
$ct_replace.="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
518 |
}
|
|
|
|
|
|
|
|
|
519 |
|
520 |
//$html=str_ireplace("</body",$ct_replace."</body",$html);
|
521 |
$html=substr_replace($html,$ct_replace."</body",strripos($html,"</body"),6);
|
@@ -633,6 +636,8 @@ function ct_send_sfw_log()
|
|
633 |
|
634 |
if($result !== false){
|
635 |
|
|
|
|
|
636 |
$ct_data['sfw_counter']['all'] += $result['all'];
|
637 |
$ct_data['sfw_counter']['blocked'] += $result['blocked'];
|
638 |
$ct_data['last_sfw_send']=time();
|
3 |
Plugin Name: Spam Protection by CleanTalk
|
4 |
Plugin URI: http://cleantalk.org
|
5 |
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. Formerly Anti-Spam by CleanTalk.
|
6 |
+
Version: 5.51
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.51';
|
11 |
+
$ct_agent_version = 'wordpress-551';
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
149 |
//cron end
|
150 |
}
|
151 |
|
152 |
+
if(isset($ct_options['check_external']) && @intval($ct_options['check_external']) == 1)
|
153 |
+
$test_external_forms=true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
else
|
|
|
155 |
$test_external_forms=false;
|
156 |
+
|
157 |
+
if(isset($ct_options['check_internal']) && @intval($ct_options['check_internal']) == 1)
|
158 |
+
$test_internal_forms = true;
|
159 |
+
else
|
160 |
+
$test_internal_forms = false;
|
161 |
|
162 |
// Activation/deactivation functions must be in main plugin file.
|
163 |
// http://codex.wordpress.org/Function_Reference/register_activation_hook
|
445 |
{
|
446 |
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
447 |
{
|
448 |
+
global $test_external_forms, $test_internal_forms, $cleantalk_plugin_version;
|
449 |
+
|
450 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_nocache.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
451 |
if($test_external_forms)
|
452 |
{
|
453 |
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
454 |
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
455 |
}
|
456 |
+
if($test_internal_forms){
|
457 |
+
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
458 |
+
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_internal.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
459 |
+
}
|
460 |
//print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk-info.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
461 |
}
|
462 |
}
|
502 |
{
|
503 |
if(strpos($_SERVER['REQUEST_URI'],'jm-ajax')===false)
|
504 |
{
|
505 |
+
global $test_external_forms, $test_internal_forms, $cleantalk_plugin_version, $ct_options;
|
506 |
|
507 |
$ct_info_flag = ct_set_info_flag();
|
508 |
|
515 |
$ct_replace.="\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
516 |
$ct_replace.="<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_external.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
517 |
}
|
518 |
+
if($test_internal_forms){
|
519 |
+
print "\n<script type='text/javascript'>var ct_blog_home = '".get_home_url()."';</script>\n";
|
520 |
+
print "<script async type='text/javascript' src='".plugins_url( '/inc/cleantalk_internal.js' , __FILE__ )."?random=".$cleantalk_plugin_version."'></script>\n";
|
521 |
+
}
|
522 |
|
523 |
//$html=str_ireplace("</body",$ct_replace."</body",$html);
|
524 |
$html=substr_replace($html,$ct_replace."</body",strripos($html,"</body"),6);
|
636 |
|
637 |
if($result !== false){
|
638 |
|
639 |
+
if(!isset($ct_data['sfw_counter']))
|
640 |
+
$ct_data['sfw_counter'] = array('all' => 0, 'blocked' => 0);
|
641 |
$ct_data['sfw_counter']['all'] += $result['all'];
|
642 |
$ct_data['sfw_counter']['blocked'] += $result['blocked'];
|
643 |
$ct_data['last_sfw_send']=time();
|
inc/cleantalk-admin.php
CHANGED
@@ -307,6 +307,7 @@ function ct_admin_init()
|
|
307 |
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
308 |
add_settings_field('cleantalk_wc_checkout_test', __('WooCommerce checkout form', 'cleantalk'), 'ct_input_wc_chekout_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
309 |
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
|
|
|
310 |
|
311 |
//Comments and messages
|
312 |
add_settings_field('cleantalk_title_comments_and_messages', "", 'ct_input_comments_and_messages', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
|
@@ -1055,6 +1056,26 @@ function ct_input_check_external() {
|
|
1055 |
@admin_addDescriptionsFields(sprintf(__('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'), $ct_options['check_external']));
|
1056 |
}
|
1057 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1058 |
function ct_input_set_cookies() {
|
1059 |
global $ct_options, $ct_data;
|
1060 |
|
307 |
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
308 |
add_settings_field('cleantalk_wc_checkout_test', __('WooCommerce checkout form', 'cleantalk'), 'ct_input_wc_chekout_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
309 |
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
|
310 |
+
add_settings_field('cleantalk_check_internal', __('Protect internal forms', 'cleantalk'), 'ct_input_check_internal', 'cleantalk', 'cleantalk_settings_anti_spam');
|
311 |
|
312 |
//Comments and messages
|
313 |
add_settings_field('cleantalk_title_comments_and_messages', "", 'ct_input_comments_and_messages', 'cleantalk', 'cleantalk_settings_anti_spam');//Title settings
|
1056 |
@admin_addDescriptionsFields(sprintf(__('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'), $ct_options['check_external']));
|
1057 |
}
|
1058 |
|
1059 |
+
function ct_input_check_internal() {
|
1060 |
+
global $ct_options, $ct_data;
|
1061 |
+
|
1062 |
+
$ct_options = ct_get_options();
|
1063 |
+
$ct_data = ct_get_data();
|
1064 |
+
|
1065 |
+
if(isset($ct_options['check_internal']))
|
1066 |
+
{
|
1067 |
+
$value = @intval($ct_options['check_internal']);
|
1068 |
+
}
|
1069 |
+
else
|
1070 |
+
{
|
1071 |
+
$value=0;
|
1072 |
+
}
|
1073 |
+
echo "<input type='radio' id='cleantalk_check_internal1' name='cleantalk_settings[check_internal]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_internal1'> " . __('Yes') . "</label>";
|
1074 |
+
echo ' ';
|
1075 |
+
echo "<input type='radio' id='cleantalk_check_internal0' name='cleantalk_settings[check_internal]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_internal0'> " . __('No') . "</label>";
|
1076 |
+
@admin_addDescriptionsFields(sprintf(__('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'), $ct_options['check_internal']));
|
1077 |
+
}
|
1078 |
+
|
1079 |
function ct_input_set_cookies() {
|
1080 |
global $ct_options, $ct_data;
|
1081 |
|
inc/cleantalk-admin_old.php
DELETED
@@ -1,1219 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
|
4 |
-
$ct_options=ct_get_options();
|
5 |
-
$ct_data=ct_get_data();
|
6 |
-
|
7 |
-
add_filter( 'activity_box_end', 'cleantalk_custom_glance_items', 10, 1 );
|
8 |
-
function cleantalk_custom_glance_items( )
|
9 |
-
{
|
10 |
-
global $ct_data;
|
11 |
-
$ct_data=ct_get_data();
|
12 |
-
if(!isset($ct_data['admin_blocked']))
|
13 |
-
{
|
14 |
-
$blocked=0;
|
15 |
-
}
|
16 |
-
else
|
17 |
-
{
|
18 |
-
$blocked=$ct_data['admin_blocked'];
|
19 |
-
}
|
20 |
-
if($blocked>0)
|
21 |
-
{
|
22 |
-
$blocked = number_format($blocked, 0, ',', ' ');
|
23 |
-
print "<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><img src='" . plugin_dir_url(__FILE__) . "images/logo_color.png' style='margin-right:1em;vertical-align:middle;'/><span><a href='options-general.php?page=cleantalk'>CleanTalk</a> ";
|
24 |
-
printf(
|
25 |
-
/* translators: %s: Number of spam messages */
|
26 |
-
__( 'has blocked %s spam', 'cleantalk' ),
|
27 |
-
$blocked
|
28 |
-
);
|
29 |
-
print "</span></div>";
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
if(isset($_GET['close_notice']))
|
34 |
-
{
|
35 |
-
global $ct_data, $pagenow;
|
36 |
-
$ct_data=ct_get_data();
|
37 |
-
$ct_data['next_notice_show']=time()+86400;
|
38 |
-
update_option('cleantalk_data', $ct_data);
|
39 |
-
$_SERVER["QUERY_STRING"]=str_replace("close_notice=1","",$_SERVER["QUERY_STRING"]);
|
40 |
-
header("Location: $pagenow?".$_SERVER["QUERY_STRING"]);
|
41 |
-
}
|
42 |
-
|
43 |
-
// Timeout to get app server
|
44 |
-
$ct_server_timeout = 10;
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Admin action 'admin_print_footer_scripts' - Enqueue admin script for checking if timezone offset is saved in settings
|
49 |
-
*/
|
50 |
-
|
51 |
-
add_action( 'admin_print_footer_scripts', 'ct_add_stats_js' );
|
52 |
-
|
53 |
-
function ct_add_stats_js()
|
54 |
-
{
|
55 |
-
echo "<script src='".plugins_url( 'cleantalk-stats.js', __FILE__ )."'></script>\n";
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Admin action 'wp_ajax_ajax_get_timezone' - Ajax method for getting timezone offset
|
63 |
-
*/
|
64 |
-
|
65 |
-
function ct_ajax_get_timezone()
|
66 |
-
{
|
67 |
-
global $ct_data;
|
68 |
-
check_ajax_referer( 'ct_secret_nonce', 'security' );
|
69 |
-
$ct_data = ct_get_data();
|
70 |
-
if(isset($_POST['offset']))
|
71 |
-
{
|
72 |
-
$ct_data['timezone'] = intval($_POST['offset']);
|
73 |
-
update_option('cleantalk_data', $ct_data);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
add_action( 'wp_ajax_ajax_get_timezone', 'ct_ajax_get_timezone' );
|
78 |
-
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
82 |
-
* @param string $hook URL of hooked page
|
83 |
-
*/
|
84 |
-
function ct_enqueue_scripts($hook) {
|
85 |
-
if ($hook == 'edit-comments.php')
|
86 |
-
wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Admin action 'admin_menu' - Add the admin options page
|
91 |
-
*/
|
92 |
-
function ct_admin_add_page() {
|
93 |
-
add_options_page(__('CleanTalk settings', 'cleantalk'), 'CleanTalk', 'manage_options', 'cleantalk', 'ct_settings_page');
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Admin action 'admin_init' - Add the admin settings and such
|
98 |
-
*/
|
99 |
-
function ct_admin_init() {
|
100 |
-
global $ct_server_timeout, $show_ct_notice_autokey, $ct_notice_autokey_label, $ct_notice_autokey_value, $show_ct_notice_renew, $ct_notice_renew_label, $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $renew_notice_showtime, $trial_notice_showtime, $ct_plugin_name, $ct_options, $ct_data, $trial_notice_check_timeout, $account_notice_check_timeout, $ct_user_token_label, $cleantalk_plugin_version, $notice_check_timeout;
|
101 |
-
|
102 |
-
$ct_options = ct_get_options();
|
103 |
-
$ct_data = ct_get_data();
|
104 |
-
|
105 |
-
$current_version=@trim($ct_data['current_version']);
|
106 |
-
if($current_version!=$cleantalk_plugin_version)
|
107 |
-
{
|
108 |
-
$ct_data['current_version']=$cleantalk_plugin_version;
|
109 |
-
update_option('cleantalk_data', $ct_data);
|
110 |
-
/*$ct_base_call_result = ct_base_call(array(
|
111 |
-
'message' => 'CleanTalk setup test',
|
112 |
-
'example' => null,
|
113 |
-
'sender_email' => 'good@cleantalk.org',
|
114 |
-
'sender_nickname' => 'CleanTalk',
|
115 |
-
'post_info' => '',
|
116 |
-
'checkjs' => 1
|
117 |
-
));*/
|
118 |
-
}
|
119 |
-
if(isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings')
|
120 |
-
{
|
121 |
-
/*$ct_base_call_result = ct_base_call(array(
|
122 |
-
'message' => 'CleanTalk setup test',
|
123 |
-
'example' => null,
|
124 |
-
'sender_email' => 'good@cleantalk.org',
|
125 |
-
'sender_nickname' => 'CleanTalk',
|
126 |
-
'post_info' => '',
|
127 |
-
'checkjs' => 1
|
128 |
-
));*/
|
129 |
-
}
|
130 |
-
|
131 |
-
if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1 || isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall'])==1)
|
132 |
-
{
|
133 |
-
cleantalk_update_sfw();
|
134 |
-
}
|
135 |
-
|
136 |
-
$show_ct_notice_trial = false;
|
137 |
-
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
138 |
-
if ($_COOKIE[$ct_notice_trial_label] == 1) {
|
139 |
-
$show_ct_notice_trial = true;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
$show_ct_notice_renew = false;
|
143 |
-
if (isset($_COOKIE[$ct_notice_renew_label])) {
|
144 |
-
if ($_COOKIE[$ct_notice_renew_label] == 1) {
|
145 |
-
$show_ct_notice_renew = true;
|
146 |
-
}
|
147 |
-
}
|
148 |
-
$show_ct_notice_autokey = false;
|
149 |
-
if (isset($_COOKIE[$ct_notice_autokey_label]) && !empty($_COOKIE[$ct_notice_autokey_label])) {
|
150 |
-
if (!empty($_COOKIE[$ct_notice_autokey_label])) {
|
151 |
-
$show_ct_notice_autokey = true;
|
152 |
-
$ct_notice_autokey_value = base64_decode($_COOKIE[$ct_notice_autokey_label]);
|
153 |
-
setcookie($ct_notice_autokey_label, '', 1, '/');
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
if (isset($_POST['get_apikey_auto'])){
|
158 |
-
$email = get_option('admin_email');
|
159 |
-
$website = parse_url(get_option('siteurl'),PHP_URL_HOST);
|
160 |
-
$platform = 'wordpress';
|
161 |
-
|
162 |
-
if(!function_exists('getAutoKey'))
|
163 |
-
{
|
164 |
-
require_once('cleantalk.class.php');
|
165 |
-
}
|
166 |
-
|
167 |
-
$result = getAutoKey($email, $website, $platform);
|
168 |
-
|
169 |
-
if ($result)
|
170 |
-
{
|
171 |
-
$ct_data['next_account_status_check']=0;
|
172 |
-
update_option('cleantalk_data', $ct_data);
|
173 |
-
$result = json_decode($result, true);
|
174 |
-
if (isset($result['data']) && is_array($result['data']))
|
175 |
-
{
|
176 |
-
$result = $result['data'];
|
177 |
-
}
|
178 |
-
if(isset($result['user_token']))
|
179 |
-
{
|
180 |
-
$ct_data['user_token'] = $result['user_token'];
|
181 |
-
update_option('cleantalk_data', $ct_data);
|
182 |
-
}
|
183 |
-
if (isset($result['auth_key']) && !empty($result['auth_key']))
|
184 |
-
{
|
185 |
-
$_POST['cleantalk_settings']['apikey'] = $result['auth_key'];
|
186 |
-
$ct_options['apikey']=$result['auth_key'];
|
187 |
-
update_option('cleantalk_settings', $ct_options);
|
188 |
-
/*$ct_base_call_result = ct_base_call(array(
|
189 |
-
'message' => 'CleanTalk setup test',
|
190 |
-
'example' => null,
|
191 |
-
'sender_email' => 'good@cleantalk.org',
|
192 |
-
'sender_nickname' => 'CleanTalk',
|
193 |
-
'post_info' => '',
|
194 |
-
'checkjs' => 1
|
195 |
-
)); */
|
196 |
-
} else {
|
197 |
-
setcookie($ct_notice_autokey_label, (string) base64_encode($result['error_message']), 0, '/');
|
198 |
-
}
|
199 |
-
} else {
|
200 |
-
setcookie($ct_notice_autokey_label, (string) base64_encode(sprintf(__('Unable to connect to %s.', 'cleantalk'), 'api.cleantalk.org')), 0, '/');
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
if (time() > $ct_data['next_account_status_check']||
|
205 |
-
isset($_POST['option_page'])&&$_POST['option_page']=='cleantalk_settings'&&$ct_options['apikey']!=$_POST['cleantalk_settings']['apikey']) {
|
206 |
-
$result = false;
|
207 |
-
if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($ct_options['apikey'])) {
|
208 |
-
if(!function_exists('noticePaidTill'))
|
209 |
-
{
|
210 |
-
require_once('cleantalk.class.php');
|
211 |
-
}
|
212 |
-
if(@isset($_POST['cleantalk_settings']['apikey']))
|
213 |
-
{
|
214 |
-
$result=noticePaidTill($_POST['cleantalk_settings']['apikey']);
|
215 |
-
}
|
216 |
-
else
|
217 |
-
{
|
218 |
-
$result=noticePaidTill($ct_options['apikey']);
|
219 |
-
}
|
220 |
-
|
221 |
-
if ($result) {
|
222 |
-
$result = json_decode($result, true);
|
223 |
-
if (isset($result['data']) && is_array($result['data'])) {
|
224 |
-
$result = $result['data'];
|
225 |
-
}
|
226 |
-
if(isset($result['spam_count']))
|
227 |
-
{
|
228 |
-
$ct_data['admin_blocked']=$result['spam_count'];
|
229 |
-
}
|
230 |
-
|
231 |
-
if (isset($result['show_notice'])) {
|
232 |
-
if ($result['show_notice'] == 1 && isset($result['trial']) && $result['trial'] == 1) {
|
233 |
-
$notice_check_timeout = $trial_notice_check_timeout;
|
234 |
-
$show_ct_notice_trial = true;
|
235 |
-
}
|
236 |
-
if ($result['show_notice'] == 1 && isset($result['renew']) && $result['renew'] == 1) {
|
237 |
-
$notice_check_timeout = $account_notice_check_timeout;
|
238 |
-
$show_ct_notice_renew = true;
|
239 |
-
}
|
240 |
-
|
241 |
-
if ($result['show_notice'] == 0) {
|
242 |
-
$notice_check_timeout = $account_notice_check_timeout;
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
-
if (isset($result['user_token'])) {
|
247 |
-
$ct_data['user_token'] = $result['user_token'];
|
248 |
-
}
|
249 |
-
}
|
250 |
-
|
251 |
-
// Save next status request time
|
252 |
-
$ct_data['next_account_status_check'] = strtotime("+$notice_check_timeout hours", time());
|
253 |
-
update_option('cleantalk_data', $ct_data);
|
254 |
-
}
|
255 |
-
|
256 |
-
if ($result) {
|
257 |
-
if($show_ct_notice_trial == true){
|
258 |
-
setcookie($ct_notice_trial_label, (string) $show_ct_notice_trial, strtotime("+$trial_notice_showtime minutes"), '/');
|
259 |
-
}
|
260 |
-
if($show_ct_notice_renew == true){
|
261 |
-
setcookie($ct_notice_renew_label, (string) $show_ct_notice_renew, strtotime("+$renew_notice_showtime minutes"), '/');
|
262 |
-
}
|
263 |
-
}
|
264 |
-
}
|
265 |
-
|
266 |
-
$show_ct_notice_online = '';
|
267 |
-
if (isset($_COOKIE[$ct_notice_online_label])) {
|
268 |
-
if ($_COOKIE[$ct_notice_online_label] === 'BAD_KEY') {
|
269 |
-
$show_ct_notice_online = 'N';
|
270 |
-
} else if (time() - $_COOKIE[$ct_notice_online_label] <= 5) {
|
271 |
-
$show_ct_notice_online = 'Y';
|
272 |
-
}
|
273 |
-
}
|
274 |
-
|
275 |
-
//ct_init_session();
|
276 |
-
|
277 |
-
if(stripos($_SERVER['REQUEST_URI'],'options.php')!==false || stripos($_SERVER['REQUEST_URI'],'options-general.php')!==false)
|
278 |
-
{
|
279 |
-
|
280 |
-
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
281 |
-
{
|
282 |
-
$buttons_html='
|
283 |
-
<style type="text/css">
|
284 |
-
#ct_button_check_comments, #ct_button_check_users {background: #999999;}
|
285 |
-
|
286 |
-
';
|
287 |
-
}
|
288 |
-
else
|
289 |
-
{
|
290 |
-
$buttons_html='
|
291 |
-
<style type="text/css">
|
292 |
-
#ct_button_check_comments, #ct_button_check_users {background: #69dd69;}
|
293 |
-
|
294 |
-
';
|
295 |
-
}
|
296 |
-
|
297 |
-
$buttons_html.='
|
298 |
-
#ct_button_check_comments, #ct_button_check_users {padding: 10px; color: #fff; border:0 none;
|
299 |
-
cursor:pointer;
|
300 |
-
-webkit-border-radius: 5px;
|
301 |
-
border-radius: 5px;
|
302 |
-
font-size: 12pt;
|
303 |
-
text-decoration:none;
|
304 |
-
margin-bottom:5px;
|
305 |
-
display:inline-block;
|
306 |
-
}
|
307 |
-
|
308 |
-
#ct_stats_banner
|
309 |
-
{
|
310 |
-
padding: 0px;
|
311 |
-
color: #000;
|
312 |
-
/*border:2px solid #e5e5e5;*/
|
313 |
-
font-size: 10pt;
|
314 |
-
text-decoration:none;
|
315 |
-
margin-bottom:5px;
|
316 |
-
display:inline-block;
|
317 |
-
}
|
318 |
-
</style>';
|
319 |
-
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
320 |
-
{
|
321 |
-
$buttons_html.='<a href="#" id="ct_button_check_comments" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check comments', 'cleantalk').'</a>
|
322 |
-
<a href="#" id="ct_button_check_users" onclick="alert('."'".__('Feature is disabled, because testing of access key is failed!', 'cleantalk')."'".')">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
|
323 |
-
}
|
324 |
-
else
|
325 |
-
{
|
326 |
-
$buttons_html.='<a href="edit-comments.php?page=ct_check_spam&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check comments', 'cleantalk').'</a><br />
|
327 |
-
<a href="users.php?page=ct_check_users&do_check=1" style="font-size:10pt;font-weight:400;">'.__('Check users', 'cleantalk').'</a><div class="clear"></div>';
|
328 |
-
}
|
329 |
-
|
330 |
-
register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
|
331 |
-
add_settings_section('cleantalk_settings_main', __($ct_plugin_name, 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
|
332 |
-
add_settings_section('cleantalk_settings_state', "<hr>".__('Protection is active', 'cleantalk'), 'ct_section_settings_state', 'cleantalk');
|
333 |
-
//add_settings_section('cleantalk_settings_autodel', "<hr>", 'ct_section_settings_autodel', 'cleantalk');
|
334 |
-
add_settings_section('cleantalk_settings_banner', "<hr>Check existing comments and users <br /><br />$buttons_html<hr></h3>", '', 'cleantalk');
|
335 |
-
add_settings_section('cleantalk_settings_anti_spam', "<a href='#' style='text-decoration:underline;font-size:10pt;font-weight:400;'>".__('Advanced settings', 'cleantalk')."</a>", 'ct_section_settings_anti_spam', 'cleantalk');
|
336 |
-
|
337 |
-
add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
338 |
-
add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_anti_spam');
|
339 |
-
|
340 |
-
add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
341 |
-
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
342 |
-
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
343 |
-
add_settings_field('cleantalk_general_contact_forms_test', __('Custom contact forms', 'cleantalk'), 'ct_input_general_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
344 |
-
add_settings_field('cleantalk_general_postdata_test', __('Check all post data', 'cleantalk'), 'ct_input_general_postdata_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
345 |
-
add_settings_field('cleantalk_show_adminbar', __('Show statistics in admin bar', 'cleantalk'), 'ct_input_show_adminbar', 'cleantalk', 'cleantalk_settings_anti_spam');
|
346 |
-
add_settings_field('cleantalk_use_ajax', __('Use AJAX for JavaScript check', 'cleantalk'), 'ct_input_use_ajax', 'cleantalk', 'cleantalk_settings_anti_spam');
|
347 |
-
add_settings_field('cleantalk_check_external', __('Protect external forms', 'cleantalk'), 'ct_input_check_external', 'cleantalk', 'cleantalk_settings_anti_spam');
|
348 |
-
add_settings_field('cleantalk_check_comments_number', __("Don't check comments", 'cleantalk'), 'ct_input_check_comments_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
349 |
-
//add_settings_field('cleantalk_check_messages_number', __("Don't check messages", 'cleantalk'), 'ct_input_check_messages_number', 'cleantalk', 'cleantalk_settings_anti_spam');
|
350 |
-
add_settings_field('cleantalk_show_link', __('', 'cleantalk'), 'ct_input_show_link', 'cleantalk', 'cleantalk_settings_banner');
|
351 |
-
add_settings_field('cleantalk_spam_firewall', __('', 'cleantalk'), 'ct_input_spam_firewall', 'cleantalk', 'cleantalk_settings_banner');
|
352 |
-
}
|
353 |
-
}
|
354 |
-
|
355 |
-
/**
|
356 |
-
* Admin callback function - Displays description of 'main' plugin parameters section
|
357 |
-
*/
|
358 |
-
function ct_section_settings_main() {
|
359 |
-
return true;
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Admin callback function - Displays description of 'anti-spam' plugin parameters section
|
364 |
-
*/
|
365 |
-
function ct_section_settings_anti_spam() {
|
366 |
-
return true;
|
367 |
-
}
|
368 |
-
|
369 |
-
add_action( 'admin_bar_menu', 'ct_add_admin_menu', 999 );
|
370 |
-
|
371 |
-
function ct_add_admin_menu( $wp_admin_bar ) {
|
372 |
-
// add a parent item
|
373 |
-
global $ct_options, $ct_data;
|
374 |
-
|
375 |
-
$ct_options = ct_get_options();
|
376 |
-
$ct_data = ct_get_data();
|
377 |
-
|
378 |
-
if(isset($ct_options['show_adminbar']))
|
379 |
-
{
|
380 |
-
$value = @intval($ct_options['show_adminbar']);
|
381 |
-
}
|
382 |
-
else
|
383 |
-
{
|
384 |
-
$value=1;
|
385 |
-
}
|
386 |
-
|
387 |
-
if ( current_user_can('activate_plugins')&&$value==1 )
|
388 |
-
{
|
389 |
-
//$ct_data=ct_get_data();
|
390 |
-
$args = array(
|
391 |
-
'id' => 'ct_parent_node',
|
392 |
-
'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px;" /><a href="#" class="ab-item alignright" title="allowed / blocked" alt="allowed / blocked"><span class="ab-label" id="ct_stats"><span>0</span> / <span>0</span></span></a>'
|
393 |
-
);
|
394 |
-
$wp_admin_bar->add_node( $args );
|
395 |
-
|
396 |
-
// add a child item to our parent item
|
397 |
-
$args = array(
|
398 |
-
'id' => 'ct_dashboard_link',
|
399 |
-
'title' => '<a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk '.__('dashboard', 'cleantalk').'</a>',
|
400 |
-
'parent' => 'ct_parent_node'
|
401 |
-
);
|
402 |
-
$wp_admin_bar->add_node( $args );
|
403 |
-
|
404 |
-
// add another child item to our parent item (not to our first group)
|
405 |
-
$args = array(
|
406 |
-
'id' => 'ct_settings_link',
|
407 |
-
'title' => '<a href="options-general.php?page=cleantalk">'.__('Settings', 'cleantalk').'</a>',
|
408 |
-
'parent' => 'ct_parent_node'
|
409 |
-
);
|
410 |
-
$wp_admin_bar->add_node( $args );
|
411 |
-
}
|
412 |
-
}
|
413 |
-
|
414 |
-
/**
|
415 |
-
* Admin callback function - Displays description of 'state' plugin parameters section
|
416 |
-
*/
|
417 |
-
function ct_section_settings_state() {
|
418 |
-
global $ct_options, $ct_data;
|
419 |
-
|
420 |
-
$ct_options = ct_get_options();
|
421 |
-
$ct_data = ct_get_data();
|
422 |
-
|
423 |
-
$img="yes.png";
|
424 |
-
$img_no="no.png";
|
425 |
-
$color="black";
|
426 |
-
$test_failed=false;
|
427 |
-
//if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
428 |
-
if(trim($ct_options['apikey'])=='')
|
429 |
-
{
|
430 |
-
$img="yes_gray.png";
|
431 |
-
$img_no="no_gray.png";
|
432 |
-
$color="gray";
|
433 |
-
}
|
434 |
-
if(isset($ct_data['testing_failed'])&&$ct_data['testing_failed']==1)
|
435 |
-
{
|
436 |
-
$img="no.png";
|
437 |
-
$img_no="no.png";
|
438 |
-
$color="black";
|
439 |
-
$test_failed=true;
|
440 |
-
}
|
441 |
-
print "<div style='color:$color'>";
|
442 |
-
if($ct_options['registrations_test']==1)
|
443 |
-
{
|
444 |
-
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
445 |
-
}
|
446 |
-
else
|
447 |
-
{
|
448 |
-
print '<img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Registration forms', 'cleantalk');
|
449 |
-
}
|
450 |
-
|
451 |
-
if($ct_options['comments_test']==1)
|
452 |
-
{
|
453 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
454 |
-
}
|
455 |
-
else
|
456 |
-
{
|
457 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Comments form', 'cleantalk');
|
458 |
-
}
|
459 |
-
|
460 |
-
if($ct_options['contact_forms_test']==1)
|
461 |
-
{
|
462 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
463 |
-
}
|
464 |
-
else
|
465 |
-
{
|
466 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Contact forms', 'cleantalk');
|
467 |
-
}
|
468 |
-
|
469 |
-
if($ct_options['general_contact_forms_test']==1)
|
470 |
-
{
|
471 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
472 |
-
}
|
473 |
-
else
|
474 |
-
{
|
475 |
-
print ' <img src="' . plugin_dir_url(__FILE__) . 'images/'.$img_no.'" alt="" height="" /> '.__('Custom contact forms', 'cleantalk');
|
476 |
-
}
|
477 |
-
|
478 |
-
print "</div>";
|
479 |
-
if($test_failed)
|
480 |
-
{
|
481 |
-
//print "Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>";
|
482 |
-
print __("Testing is failed, check settings. Tech support <a target=_blank href='mailto:support@cleantalk.org'>support@cleantalk.org</a>", 'cleantalk');
|
483 |
-
}
|
484 |
-
return true;
|
485 |
-
}
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Admin callback function - Displays description of 'autodel' plugin parameters section
|
489 |
-
*/
|
490 |
-
function ct_section_settings_autodel() {
|
491 |
-
return true;
|
492 |
-
}
|
493 |
-
|
494 |
-
/**
|
495 |
-
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
496 |
-
*/
|
497 |
-
function ct_input_apikey() {
|
498 |
-
global $ct_options, $ct_data, $ct_notice_online_label;
|
499 |
-
$ct_options=ct_get_options();
|
500 |
-
$ct_data=ct_get_data();
|
501 |
-
|
502 |
-
if(!isset($ct_data['admin_blocked']))
|
503 |
-
{
|
504 |
-
$blocked=0;
|
505 |
-
}
|
506 |
-
else
|
507 |
-
{
|
508 |
-
$blocked=$ct_data['admin_blocked'];
|
509 |
-
}
|
510 |
-
|
511 |
-
if($blocked>0)
|
512 |
-
{
|
513 |
-
$blocked = number_format($blocked, 0, ',', ' ');
|
514 |
-
|
515 |
-
echo "<script>var cleantalk_blocked_message=\"<div style='height:24px;width:100%;display:table-cell; vertical-align:middle;'><span>CleanTalk ";
|
516 |
-
printf(
|
517 |
-
/* translators: %s: Number of spam messages */
|
518 |
-
__( 'has blocked <b>%s</b> spam.', 'cleantalk' ),
|
519 |
-
$blocked
|
520 |
-
);
|
521 |
-
print "</span></div><br />\";\n";
|
522 |
-
}
|
523 |
-
else
|
524 |
-
{
|
525 |
-
echo "<script>var cleantalk_blocked_message=\"\";\n";
|
526 |
-
}
|
527 |
-
echo "var cleantalk_statistics_link=\"<a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>\";
|
528 |
-
</script>";
|
529 |
-
|
530 |
-
echo "<script src='".plugins_url( 'cleantalk-admin.js', __FILE__ )."'></script>\n";
|
531 |
-
|
532 |
-
$value = $ct_options['apikey'];
|
533 |
-
$def_value = '';
|
534 |
-
echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
|
535 |
-
if (ct_valid_key($value) === false) {
|
536 |
-
echo "<script>var cleantalk_good_key=false;</script>";
|
537 |
-
echo "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk')."</a>";
|
538 |
-
if (function_exists('curl_init') && function_exists('json_decode')) {
|
539 |
-
echo '<br /><br /><input name="get_apikey_auto" type="submit" value="' . __('Get access key automatically', 'cleantalk') . '" />';
|
540 |
-
admin_addDescriptionsFields(sprintf(__('Admin e-mail (%s) will be used for registration', 'cleantalk'), get_option('admin_email')));
|
541 |
-
admin_addDescriptionsFields(sprintf('<a target="__blank" style="color:#BBB;" href="https://cleantalk.org/publicoffer">%s</a>', __('License agreement', 'cleantalk')));
|
542 |
-
}
|
543 |
-
} else {
|
544 |
-
echo "<script>var cleantalk_good_key=true;</script>";
|
545 |
-
if (isset($_COOKIE[$ct_notice_online_label]) && $_COOKIE[$ct_notice_online_label] > 0) {
|
546 |
-
//echo ' <span style="text-decoration: underline;">The key accepted!</span> ';
|
547 |
-
}
|
548 |
-
//echo "<br /><br /><a target='__blank' href='https://cleantalk.org/my?user_token=".@$ct_data['user_token']."'>".__('Click here to get anti-spam statistics', 'cleantalk')."</a>";
|
549 |
-
}
|
550 |
-
}
|
551 |
-
|
552 |
-
/**
|
553 |
-
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
554 |
-
*/
|
555 |
-
function ct_input_comments_test() {
|
556 |
-
global $ct_options, $ct_data;
|
557 |
-
|
558 |
-
$ct_options = ct_get_options();
|
559 |
-
$ct_data = ct_get_data();
|
560 |
-
|
561 |
-
$value = $ct_options['comments_test'];
|
562 |
-
echo "<input type='radio' id='cleantalk_comments_test1' name='cleantalk_settings[comments_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_comments_test1'> " . __('Yes') . "</label>";
|
563 |
-
echo ' ';
|
564 |
-
echo "<input type='radio' id='cleantalk_comments_test0' name='cleantalk_settings[comments_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_comments_test0'> " . __('No') . "</label>";
|
565 |
-
admin_addDescriptionsFields(__('WordPress, JetPack, WooCommerce', 'cleantalk'));
|
566 |
-
}
|
567 |
-
|
568 |
-
/**
|
569 |
-
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
570 |
-
*/
|
571 |
-
function ct_input_registrations_test() {
|
572 |
-
global $ct_options, $ct_data;
|
573 |
-
|
574 |
-
$ct_options = ct_get_options();
|
575 |
-
$ct_data = ct_get_data();
|
576 |
-
|
577 |
-
$value = $ct_options['registrations_test'];
|
578 |
-
echo "<input type='radio' id='cleantalk_registrations_test1' name='cleantalk_settings[registrations_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_registrations_test1'> " . __('Yes') . "</label>";
|
579 |
-
echo ' ';
|
580 |
-
echo "<input type='radio' id='cleantalk_registrations_test0' name='cleantalk_settings[registrations_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_registrations_test0'> " . __('No') . "</label>";
|
581 |
-
admin_addDescriptionsFields(__('WordPress, BuddyPress, bbPress, S2Member, WooCommerce', 'cleantalk'));
|
582 |
-
}
|
583 |
-
|
584 |
-
/**
|
585 |
-
* Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
|
586 |
-
*/
|
587 |
-
function ct_input_contact_forms_test() {
|
588 |
-
global $ct_options, $ct_data;
|
589 |
-
|
590 |
-
$ct_options = ct_get_options();
|
591 |
-
$ct_data = ct_get_data();
|
592 |
-
|
593 |
-
$value = $ct_options['contact_forms_test'];
|
594 |
-
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>";
|
595 |
-
echo ' ';
|
596 |
-
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>";
|
597 |
-
admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
|
598 |
-
}
|
599 |
-
|
600 |
-
/**
|
601 |
-
* Admin callback function - Displays inputs of 'general_contact_forms_test' plugin parameter
|
602 |
-
*/
|
603 |
-
function ct_input_general_contact_forms_test() {
|
604 |
-
global $ct_options, $ct_data;
|
605 |
-
|
606 |
-
$ct_options = ct_get_options();
|
607 |
-
$ct_data = ct_get_data();
|
608 |
-
|
609 |
-
$value = $ct_options['general_contact_forms_test'];
|
610 |
-
echo "<input type='radio' id='cleantalk_general_contact_forms_test1' name='cleantalk_settings[general_contact_forms_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test1'> " . __('Yes') . "</label>";
|
611 |
-
echo ' ';
|
612 |
-
echo "<input type='radio' id='cleantalk_general_contact_forms_test0' name='cleantalk_settings[general_contact_forms_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_contact_forms_test0'> " . __('No') . "</label>";
|
613 |
-
admin_addDescriptionsFields(__('Anti spam test for any WordPress or themes contacts forms', 'cleantalk'));
|
614 |
-
}
|
615 |
-
|
616 |
-
/**
|
617 |
-
* @author Artem Leontiev
|
618 |
-
* Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
|
619 |
-
*
|
620 |
-
* @return null
|
621 |
-
*/
|
622 |
-
function ct_input_remove_old_spam() {
|
623 |
-
global $ct_options, $ct_data;
|
624 |
-
|
625 |
-
$ct_options = ct_get_options();
|
626 |
-
$ct_data = ct_get_data();
|
627 |
-
|
628 |
-
$value = $ct_options['remove_old_spam'];
|
629 |
-
echo "<input type='radio' id='cleantalk_remove_old_spam1' name='cleantalk_settings[remove_old_spam]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam1'> " . __('Yes') . "</label>";
|
630 |
-
echo ' ';
|
631 |
-
echo "<input type='radio' id='cleantalk_remove_old_spam0' name='cleantalk_settings[remove_old_spam]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_remove_old_spam0'> " . __('No') . "</label>";
|
632 |
-
admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $ct_options['spam_store_days']));
|
633 |
-
}
|
634 |
-
|
635 |
-
/**
|
636 |
-
* Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
|
637 |
-
*
|
638 |
-
* @return null
|
639 |
-
*/
|
640 |
-
function ct_input_show_adminbar() {
|
641 |
-
global $ct_options, $ct_data;
|
642 |
-
|
643 |
-
$ct_options = ct_get_options();
|
644 |
-
$ct_data = ct_get_data();
|
645 |
-
|
646 |
-
if(isset($ct_options['show_adminbar']))
|
647 |
-
{
|
648 |
-
$value = @intval($ct_options['show_adminbar']);
|
649 |
-
}
|
650 |
-
else
|
651 |
-
{
|
652 |
-
$value=1;
|
653 |
-
}
|
654 |
-
echo "<input type='radio' id='cleantalk_show_adminbar1' name='cleantalk_settings[show_adminbar]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar1'> " . __('Yes') . "</label>";
|
655 |
-
echo ' ';
|
656 |
-
echo "<input type='radio' id='cleantalk_show_adminbar0' name='cleantalk_settings[show_adminbar]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_adminbar0'> " . __('No') . "</label>";
|
657 |
-
admin_addDescriptionsFields(sprintf(__('Show/hide CleanTalk icon in top level menu in WordPress backend.', 'cleantalk'), $ct_options['show_adminbar']));
|
658 |
-
}
|
659 |
-
|
660 |
-
/**
|
661 |
-
* Admin callback function - Displays inputs of 'Show statistics in adminbar' plugin parameter
|
662 |
-
*
|
663 |
-
* @return null
|
664 |
-
*/
|
665 |
-
function ct_input_general_postdata_test() {
|
666 |
-
global $ct_options, $ct_data;
|
667 |
-
|
668 |
-
$ct_options = ct_get_options();
|
669 |
-
$ct_data = ct_get_data();
|
670 |
-
|
671 |
-
if(isset($ct_options['general_postdata_test']))
|
672 |
-
{
|
673 |
-
$value = @intval($ct_options['general_postdata_test']);
|
674 |
-
}
|
675 |
-
else
|
676 |
-
{
|
677 |
-
$value=0;
|
678 |
-
}
|
679 |
-
echo "<input type='radio' id='cleantalk_general_postdata_test1' name='cleantalk_settings[general_postdata_test]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test1'> " . __('Yes') . "</label>";
|
680 |
-
echo ' ';
|
681 |
-
echo "<input type='radio' id='cleantalk_general_postdata_test0' name='cleantalk_settings[general_postdata_test]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_general_postdata_test0'> " . __('No') . "</label>";
|
682 |
-
@admin_addDescriptionsFields(sprintf(__('Check all POST submissions from website visitors. Enable this option if you have spam misses on website or you don`t have records about missed spam in <a href="https://cleantalk.org/my/?user_token='.@$ct_data['user_token'].'&utm_source=wp-backend&utm_medium=admin-bar" target="_blank">CleanTalk dashboard</a>.', 'cleantalk'), $ct_options['general_postdata_test']));
|
683 |
-
}
|
684 |
-
|
685 |
-
function ct_input_use_ajax() {
|
686 |
-
global $ct_options, $ct_data;
|
687 |
-
|
688 |
-
$ct_options = ct_get_options();
|
689 |
-
$ct_data = ct_get_data();
|
690 |
-
|
691 |
-
if(isset($ct_options['use_ajax']))
|
692 |
-
{
|
693 |
-
$value = @intval($ct_options['use_ajax']);
|
694 |
-
}
|
695 |
-
else
|
696 |
-
{
|
697 |
-
$value=1;
|
698 |
-
}
|
699 |
-
echo "<input type='radio' id='cleantalk_use_ajax1' name='cleantalk_settings[use_ajax]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_use_ajax1'> " . __('Yes') . "</label>";
|
700 |
-
echo ' ';
|
701 |
-
echo "<input type='radio' id='cleantalk_use_ajax0' name='cleantalk_settings[use_ajax]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_use_ajax0'> " . __('No') . "</label>";
|
702 |
-
@admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['use_ajax']));
|
703 |
-
}
|
704 |
-
|
705 |
-
function ct_input_check_comments_number() {
|
706 |
-
global $ct_options, $ct_data;
|
707 |
-
|
708 |
-
$ct_options = ct_get_options();
|
709 |
-
$ct_data = ct_get_data();
|
710 |
-
|
711 |
-
if(isset($ct_options['check_comments_number']))
|
712 |
-
{
|
713 |
-
$value = @intval($ct_options['check_comments_number']);
|
714 |
-
}
|
715 |
-
else
|
716 |
-
{
|
717 |
-
$value=1;
|
718 |
-
}
|
719 |
-
|
720 |
-
if(defined('CLEANTALK_CHECK_COMMENTS_NUMBER'))
|
721 |
-
{
|
722 |
-
$comments_check_number = CLEANTALK_CHECK_COMMENTS_NUMBER;
|
723 |
-
}
|
724 |
-
else
|
725 |
-
{
|
726 |
-
$comments_check_number = 3;
|
727 |
-
}
|
728 |
-
|
729 |
-
echo "<input type='radio' id='cleantalk_check_comments_number1' name='cleantalk_settings[check_comments_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number1'> " . __('Yes') . "</label>";
|
730 |
-
echo ' ';
|
731 |
-
echo "<input type='radio' id='cleantalk_check_comments_number0' name='cleantalk_settings[check_comments_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_comments_number0'> " . __('No') . "</label>";
|
732 |
-
@admin_addDescriptionsFields(sprintf(__("Dont't check comments for users with above $comments_check_number comments", 'cleantalk'), $ct_options['check_comments_number']));
|
733 |
-
}
|
734 |
-
|
735 |
-
function ct_input_check_messages_number() {
|
736 |
-
global $ct_options, $ct_data;
|
737 |
-
|
738 |
-
$ct_options = ct_get_options();
|
739 |
-
$ct_data = ct_get_data();
|
740 |
-
|
741 |
-
if(isset($ct_options['check_messages_number']))
|
742 |
-
{
|
743 |
-
$value = @intval($ct_options['check_messages_number']);
|
744 |
-
}
|
745 |
-
else
|
746 |
-
{
|
747 |
-
$value=0;
|
748 |
-
}
|
749 |
-
|
750 |
-
if(defined('CLEANTALK_CHECK_MESSAGES_NUMBER'))
|
751 |
-
{
|
752 |
-
$messages_check_number = CLEANTALK_CHECK_MESSAGES_NUMBER;
|
753 |
-
}
|
754 |
-
else
|
755 |
-
{
|
756 |
-
$messages_check_number = 3;
|
757 |
-
}
|
758 |
-
|
759 |
-
echo "<input type='radio' id='cleantalk_check_messages_number1' name='cleantalk_settings[check_messages_number]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number1'> " . __('Yes') . "</label>";
|
760 |
-
echo ' ';
|
761 |
-
echo "<input type='radio' id='cleantalk_check_messages_number0' name='cleantalk_settings[check_messages_number]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_messages_number0'> " . __('No') . "</label>";
|
762 |
-
@admin_addDescriptionsFields(sprintf(__("Dont't check messages for users with above $messages_check_number messages", 'cleantalk'), $ct_options['check_messages_number']));
|
763 |
-
}
|
764 |
-
|
765 |
-
function ct_input_check_external() {
|
766 |
-
global $ct_options, $ct_data;
|
767 |
-
|
768 |
-
$ct_options = ct_get_options();
|
769 |
-
$ct_data = ct_get_data();
|
770 |
-
|
771 |
-
if(isset($ct_options['check_external']))
|
772 |
-
{
|
773 |
-
$value = @intval($ct_options['check_external']);
|
774 |
-
}
|
775 |
-
else
|
776 |
-
{
|
777 |
-
$value=0;
|
778 |
-
}
|
779 |
-
echo "<input type='radio' id='cleantalk_check_external1' name='cleantalk_settings[check_external]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_check_external1'> " . __('Yes') . "</label>";
|
780 |
-
echo ' ';
|
781 |
-
echo "<input type='radio' id='cleantalk_check_external0' name='cleantalk_settings[check_external]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_check_external0'> " . __('No') . "</label>";
|
782 |
-
@admin_addDescriptionsFields(sprintf(__('', 'cleantalk'), $ct_options['check_external']));
|
783 |
-
}
|
784 |
-
|
785 |
-
function ct_input_show_link() {
|
786 |
-
global $ct_options, $ct_data;
|
787 |
-
|
788 |
-
$ct_options = ct_get_options();
|
789 |
-
$ct_data = ct_get_data();
|
790 |
-
|
791 |
-
if(isset($ct_options['show_link']))
|
792 |
-
{
|
793 |
-
$value = @intval($ct_options['show_link']);
|
794 |
-
}
|
795 |
-
else
|
796 |
-
{
|
797 |
-
$value=0;
|
798 |
-
}
|
799 |
-
|
800 |
-
/* echo "<input type='radio' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Yes') . "</label>";
|
801 |
-
echo ' ';
|
802 |
-
echo "<input type='radio' id='cleantalk_show_link0' name='cleantalk_settings[show_link]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_show_link0'> " . __('No') . "</label>";*/
|
803 |
-
|
804 |
-
echo "<div id='cleantalk_anchor' style='display:none'></div><input type=hidden name='cleantalk_settings[show_link]' value='0' />";
|
805 |
-
echo "<input type='checkbox' id='cleantalk_show_link1' name='cleantalk_settings[show_link]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_show_link1'> " . __('Tell others about CleanTalk') . "</label>";
|
806 |
-
@admin_addDescriptionsFields(sprintf(__("Checking this box places a small link under the comment form that lets others know what anti-spam tool protects your site.", 'cleantalk'), $ct_options['show_link']));
|
807 |
-
echo "<script>
|
808 |
-
jQuery(document).ready(function(){
|
809 |
-
jQuery('#cleantalk_anchor').parent().parent().children().first().hide();
|
810 |
-
jQuery('#cleantalk_anchor').parent().css('padding-left','0px');
|
811 |
-
});
|
812 |
-
</script>";
|
813 |
-
}
|
814 |
-
|
815 |
-
function ct_input_spam_firewall() {
|
816 |
-
global $ct_options, $ct_data;
|
817 |
-
|
818 |
-
$ct_options = ct_get_options();
|
819 |
-
$ct_data = ct_get_data();
|
820 |
-
|
821 |
-
if(isset($ct_options['spam_firewall']))
|
822 |
-
{
|
823 |
-
$value = @intval($ct_options['spam_firewall']);
|
824 |
-
}
|
825 |
-
else
|
826 |
-
{
|
827 |
-
$value=0;
|
828 |
-
}
|
829 |
-
|
830 |
-
echo "<div id='cleantalk_anchor1' style='display:none'></div><input type=hidden name='cleantalk_settings[spam_firewall]' value='0' />";
|
831 |
-
echo "<input type='checkbox' id='cleantalk_spam_firewall1' name='cleantalk_settings[spam_firewall]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_spam_firewall1'> " . __('SpamFireWall') . "</label>";
|
832 |
-
@admin_addDescriptionsFields(sprintf(__("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'), $ct_options['spam_firewall']));
|
833 |
-
echo "<script>
|
834 |
-
jQuery(document).ready(function(){
|
835 |
-
jQuery('#cleantalk_anchor1').parent().parent().children().first().hide();
|
836 |
-
jQuery('#cleantalk_anchor1').parent().css('padding-left','0px');
|
837 |
-
});
|
838 |
-
</script>";
|
839 |
-
}
|
840 |
-
|
841 |
-
|
842 |
-
/**
|
843 |
-
* Admin callback function - Plugin parameters validator
|
844 |
-
*/
|
845 |
-
function ct_settings_validate($input) {
|
846 |
-
return $input;
|
847 |
-
}
|
848 |
-
|
849 |
-
|
850 |
-
/**
|
851 |
-
* Admin callback function - Displays plugin options page
|
852 |
-
*/
|
853 |
-
function ct_settings_page() {
|
854 |
-
?>
|
855 |
-
<style type="text/css">
|
856 |
-
input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 none;
|
857 |
-
cursor:pointer;
|
858 |
-
-webkit-border-radius: 5px;
|
859 |
-
border-radius: 5px;
|
860 |
-
font-size: 12pt;
|
861 |
-
}
|
862 |
-
</style>
|
863 |
-
|
864 |
-
<div>
|
865 |
-
<form action="options.php" method="post">
|
866 |
-
<?php settings_fields('cleantalk_settings'); ?>
|
867 |
-
<?php do_settings_sections('cleantalk'); ?>
|
868 |
-
<br>
|
869 |
-
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
|
870 |
-
</form>
|
871 |
-
</div>
|
872 |
-
<?php
|
873 |
-
|
874 |
-
if (ct_valid_key() === false)
|
875 |
-
return null;
|
876 |
-
?>
|
877 |
-
<br />
|
878 |
-
<br />
|
879 |
-
<br />
|
880 |
-
<div>
|
881 |
-
<?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.<br />
|
882 |
-
<?php echo __('Tech support CleanTalk:', 'cleantalk'); ?> <a href="https://cleantalk.org/forum/viewforum.php?f=25" target="_blank"><?php echo __('CleanTalk tech forum', 'cleantalk'); ?></a>.<br /><?php echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk'); ?><br />
|
883 |
-
</div>
|
884 |
-
<?php
|
885 |
-
}
|
886 |
-
|
887 |
-
/**
|
888 |
-
* Notice blog owner if plugin is used without Access key
|
889 |
-
* @return bool
|
890 |
-
*/
|
891 |
-
function cleantalk_admin_notice_message(){
|
892 |
-
global $show_ct_notice_trial, $show_ct_notice_renew, $show_ct_notice_online, $show_ct_notice_autokey, $ct_notice_autokey_value, $ct_plugin_name, $ct_options, $ct_data;
|
893 |
-
|
894 |
-
$ct_options = ct_get_options();
|
895 |
-
$ct_data = ct_get_data();
|
896 |
-
|
897 |
-
$user_token = '';
|
898 |
-
if (isset($ct_data['user_token']) && $ct_data['user_token'] != '') {
|
899 |
-
$user_token = '&user_token=' . $ct_data['user_token'];
|
900 |
-
}
|
901 |
-
|
902 |
-
$show_notice = true;
|
903 |
-
|
904 |
-
if(current_user_can('activate_plugins'))
|
905 |
-
{
|
906 |
-
$value = 1;
|
907 |
-
}
|
908 |
-
else
|
909 |
-
{
|
910 |
-
$value = 0;
|
911 |
-
}
|
912 |
-
|
913 |
-
if ($show_notice && $show_ct_notice_autokey && $value==1) {
|
914 |
-
echo '<div class="error"><h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $ct_notice_autokey_value);
|
915 |
-
echo " <a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=".urlencode(get_option('admin_email'))."&website=".urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Click here to get access key manually', 'cleantalk').'</a></h3></div>';
|
916 |
-
}
|
917 |
-
|
918 |
-
if ($show_notice && ct_valid_key($ct_options['apikey']) === false && $value==1) {
|
919 |
-
echo '<div class="error"><h3>' . sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a>") . '</h3></div>';
|
920 |
-
$show_notice = false;
|
921 |
-
}
|
922 |
-
|
923 |
-
if ($show_notice && $show_ct_notice_trial && $value==1) {
|
924 |
-
echo '<div class="error"><h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'), "<a href=\"options-general.php?page=cleantalk\">$ct_plugin_name</a>", "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token\" target=\"_blank\"><b>premium version</b></a>") . '</h3></div>';
|
925 |
-
$show_notice = false;
|
926 |
-
}
|
927 |
-
|
928 |
-
if(isset($ct_data['next_notice_show']))
|
929 |
-
{
|
930 |
-
$next_notice_show=$ct_data['next_notice_show'];
|
931 |
-
}
|
932 |
-
else
|
933 |
-
{
|
934 |
-
$next_notice_show=0;
|
935 |
-
}
|
936 |
-
|
937 |
-
$link=@$_SERVER["QUERY_STRING"];
|
938 |
-
if($link!='')
|
939 |
-
{
|
940 |
-
$link="?".$link."&close_notice=1";
|
941 |
-
}
|
942 |
-
else
|
943 |
-
{
|
944 |
-
$link="?close_notice=1";
|
945 |
-
}
|
946 |
-
|
947 |
-
if ($show_notice && $show_ct_notice_renew && $value==1 && time()>$next_notice_show) {
|
948 |
-
$button_html = "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\">" . '<input type="button" class="button button-primary" value="' . __('RENEW ANTI-SPAM', 'cleantalk') . '" />' . "</a>";
|
949 |
-
echo '<div class="updated"><a href="'.$link.'" style="text-decoration:none;float:right;font-size:16px;margin-top:5px;"><b>X</b></a><h3>' . sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), "<a href=\"http://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20renew$user_token\" target=\"_blank\"><b>" . __('next year', 'cleantalk') ."</b></a>") . '<br /><br />' . $button_html . '</h3></div>';
|
950 |
-
$show_notice = false;
|
951 |
-
}
|
952 |
-
|
953 |
-
if ($show_notice && $show_ct_notice_online != '' && $value==1) {
|
954 |
-
if($show_ct_notice_online === 'Y'){
|
955 |
-
echo '<div class="updated"><h3><b>';
|
956 |
-
//echo __("Don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
|
957 |
-
echo __("Settings updated!", 'cleantalk');
|
958 |
-
echo '</b></h3></div>';
|
959 |
-
}
|
960 |
-
|
961 |
-
if($show_ct_notice_online === 'N' && $value==1){
|
962 |
-
echo '<div class="error"><h3><b>';
|
963 |
-
echo __("Wrong <a href=\"options-general.php?page=cleantalk\"><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk');
|
964 |
-
echo '</b></h3></div>';
|
965 |
-
}
|
966 |
-
}
|
967 |
-
|
968 |
-
//ct_send_feedback(); -- removed to ct_do_this_hourly()
|
969 |
-
|
970 |
-
return true;
|
971 |
-
}
|
972 |
-
|
973 |
-
/**
|
974 |
-
* @author Artem Leontiev
|
975 |
-
*
|
976 |
-
* Add descriptions for field
|
977 |
-
*/
|
978 |
-
function admin_addDescriptionsFields($descr = '') {
|
979 |
-
echo "<div style='font-size: 10pt; color: #666 !important'>$descr</div>";
|
980 |
-
}
|
981 |
-
|
982 |
-
/**
|
983 |
-
* Test API key
|
984 |
-
*/
|
985 |
-
function ct_valid_key($apikey = null) {
|
986 |
-
global $ct_options, $ct_data;
|
987 |
-
|
988 |
-
$ct_options = ct_get_options();
|
989 |
-
$ct_data = ct_get_data();
|
990 |
-
|
991 |
-
if ($apikey === null) {
|
992 |
-
$apikey = $ct_options['apikey'];
|
993 |
-
}
|
994 |
-
|
995 |
-
return ($apikey === 'enter key' || $apikey === '') ? false : true;
|
996 |
-
}
|
997 |
-
|
998 |
-
/**
|
999 |
-
* Admin action 'comment_unapproved_to_approved' - Approve comment, sends good feedback to cleantalk, removes cleantalk resume
|
1000 |
-
* @param object $comment_object Comment object
|
1001 |
-
* @return boolean TRUE
|
1002 |
-
*/
|
1003 |
-
function ct_comment_approved($comment_object) {
|
1004 |
-
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
1005 |
-
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
1006 |
-
|
1007 |
-
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
1008 |
-
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
1009 |
-
$comment['comment_approved'] = 1;
|
1010 |
-
wp_update_comment($comment);
|
1011 |
-
|
1012 |
-
return true;
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
/**
|
1016 |
-
* Admin action 'comment_approved_to_unapproved' - Unapprove comment, sends bad feedback to cleantalk
|
1017 |
-
* @param object $comment_object Comment object
|
1018 |
-
* @return boolean TRUE
|
1019 |
-
*/
|
1020 |
-
function ct_comment_unapproved($comment_object) {
|
1021 |
-
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
1022 |
-
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
1023 |
-
ct_feedback($hash, $comment['comment_content'], 0);
|
1024 |
-
$comment['comment_approved'] = 0;
|
1025 |
-
wp_update_comment($comment);
|
1026 |
-
|
1027 |
-
return true;
|
1028 |
-
}
|
1029 |
-
|
1030 |
-
/**
|
1031 |
-
* Admin actions 'comment_unapproved_to_spam', 'comment_approved_to_spam' - Mark comment as spam, sends bad feedback to cleantalk
|
1032 |
-
* @param object $comment_object Comment object
|
1033 |
-
* @return boolean TRUE
|
1034 |
-
*/
|
1035 |
-
function ct_comment_spam($comment_object) {
|
1036 |
-
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
1037 |
-
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
1038 |
-
ct_feedback($hash, $comment['comment_content'], 0);
|
1039 |
-
$comment['comment_approved'] = 'spam';
|
1040 |
-
wp_update_comment($comment);
|
1041 |
-
|
1042 |
-
return true;
|
1043 |
-
}
|
1044 |
-
|
1045 |
-
|
1046 |
-
/**
|
1047 |
-
* Unspam comment
|
1048 |
-
* @param type $comment_id
|
1049 |
-
*/
|
1050 |
-
function ct_unspam_comment($comment_id) {
|
1051 |
-
update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
|
1052 |
-
$comment = get_comment($comment_id, 'ARRAY_A');
|
1053 |
-
$hash = get_comment_meta($comment_id, 'ct_hash', true);
|
1054 |
-
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
1055 |
-
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
1056 |
-
|
1057 |
-
wp_update_comment($comment);
|
1058 |
-
}
|
1059 |
-
|
1060 |
-
/**
|
1061 |
-
* Admin filter 'get_comment_text' - Adds some info to comment text to display
|
1062 |
-
* @param string $current_text Current comment text
|
1063 |
-
* @return string New comment text
|
1064 |
-
*/
|
1065 |
-
function ct_get_comment_text($current_text) {
|
1066 |
-
global $comment;
|
1067 |
-
$new_text = $current_text;
|
1068 |
-
if (isset($comment) && is_object($comment)) {
|
1069 |
-
$hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
1070 |
-
if (!empty($hash)) {
|
1071 |
-
$new_text .= '<hr>Cleantalk ID = ' . $hash;
|
1072 |
-
}
|
1073 |
-
}
|
1074 |
-
return $new_text;
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
/**
|
1078 |
-
* Send feedback for user deletion
|
1079 |
-
* @return null
|
1080 |
-
*/
|
1081 |
-
function ct_delete_user($user_id) {
|
1082 |
-
$hash = get_user_meta($user_id, 'ct_hash', true);
|
1083 |
-
if ($hash !== '') {
|
1084 |
-
ct_feedback($hash, null, 0);
|
1085 |
-
}
|
1086 |
-
}
|
1087 |
-
|
1088 |
-
/**
|
1089 |
-
* Manage links and plugins page
|
1090 |
-
* @return array
|
1091 |
-
*/
|
1092 |
-
if (!function_exists ( 'ct_register_plugin_links')) {
|
1093 |
-
function ct_register_plugin_links($links, $file) {
|
1094 |
-
global $ct_plugin_basename;
|
1095 |
-
|
1096 |
-
if ($file == $ct_plugin_basename) {
|
1097 |
-
$links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1098 |
-
$links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
1099 |
-
$links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
1100 |
-
}
|
1101 |
-
return $links;
|
1102 |
-
}
|
1103 |
-
}
|
1104 |
-
|
1105 |
-
/**
|
1106 |
-
* Manage links in plugins list
|
1107 |
-
* @return array
|
1108 |
-
*/
|
1109 |
-
if (!function_exists ( 'ct_plugin_action_links')) {
|
1110 |
-
function ct_plugin_action_links($links, $file) {
|
1111 |
-
global $ct_plugin_basename;
|
1112 |
-
|
1113 |
-
if ($file == $ct_plugin_basename) {
|
1114 |
-
$settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1115 |
-
array_unshift( $links, $settings_link ); // before other links
|
1116 |
-
}
|
1117 |
-
return $links;
|
1118 |
-
}
|
1119 |
-
}
|
1120 |
-
|
1121 |
-
/**
|
1122 |
-
* After options update
|
1123 |
-
* @return array
|
1124 |
-
*/
|
1125 |
-
function ct_update_option($option_name) {
|
1126 |
-
global $show_ct_notice_online, $ct_notice_online_label, $ct_notice_trial_label, $trial_notice_showtime, $ct_options, $ct_data, $ct_server_timeout;
|
1127 |
-
|
1128 |
-
$ct_options = ct_get_options(true);
|
1129 |
-
$ct_data = ct_get_data(true);
|
1130 |
-
|
1131 |
-
if($option_name !== 'cleantalk_settings') {
|
1132 |
-
return;
|
1133 |
-
}
|
1134 |
-
|
1135 |
-
$api_key = $ct_options['apikey'];
|
1136 |
-
if (isset($_POST['cleantalk_settings']['apikey'])) {
|
1137 |
-
$api_key = trim($_POST['cleantalk_settings']['apikey']);
|
1138 |
-
$ct_options['apikey'] = $api_key;
|
1139 |
-
}
|
1140 |
-
|
1141 |
-
if(@isset($_POST['cleantalk_settings']['spam_firewall']) && $_POST['cleantalk_settings']['spam_firewall']==1 || isset($ct_options['spam_firewall']) && intval($ct_options['spam_firewall'])==1)
|
1142 |
-
{
|
1143 |
-
cleantalk_update_sfw();
|
1144 |
-
}
|
1145 |
-
|
1146 |
-
if (!ct_valid_key($api_key)) {
|
1147 |
-
return;
|
1148 |
-
}
|
1149 |
-
|
1150 |
-
/*$ct_base_call_result = ct_base_call(array(
|
1151 |
-
'message' => 'CleanTalk setup test',
|
1152 |
-
'example' => null,
|
1153 |
-
'sender_email' => 'good@cleantalk.org',
|
1154 |
-
'sender_nickname' => 'CleanTalk',
|
1155 |
-
'post_info' => '',
|
1156 |
-
'checkjs' => 1
|
1157 |
-
));*/
|
1158 |
-
|
1159 |
-
$key_valid = true;
|
1160 |
-
$app_server_error = false;
|
1161 |
-
$ct_data['testing_failed']=0;
|
1162 |
-
|
1163 |
-
|
1164 |
-
if(!function_exists('sendRawRequest'))
|
1165 |
-
{
|
1166 |
-
require_once('cleantalk.class.php');
|
1167 |
-
}
|
1168 |
-
|
1169 |
-
$request=Array();
|
1170 |
-
$request['method_name'] = 'notice_validate_key';
|
1171 |
-
$request['auth_key'] = $api_key;
|
1172 |
-
$url='https://api.cleantalk.org';
|
1173 |
-
if(!function_exists('sendRawRequest'))
|
1174 |
-
{
|
1175 |
-
require_once('cleantalk.class.php');
|
1176 |
-
}
|
1177 |
-
$result=sendRawRequest($url, $request);
|
1178 |
-
if ($result)
|
1179 |
-
{
|
1180 |
-
$result = json_decode($result, true);
|
1181 |
-
if (isset($result['valid']) && $result['valid'] == 0) {
|
1182 |
-
$key_valid = false;
|
1183 |
-
$ct_data['testing_failed']=1;
|
1184 |
-
}
|
1185 |
-
}
|
1186 |
-
if (!$result || !isset($result['valid']))
|
1187 |
-
{
|
1188 |
-
$app_server_error = true;
|
1189 |
-
$ct_data['testing_failed']=1;
|
1190 |
-
}
|
1191 |
-
|
1192 |
-
update_option('cleantalk_data', $ct_data);
|
1193 |
-
|
1194 |
-
if ($key_valid) {
|
1195 |
-
// Removes cookie for server errors
|
1196 |
-
if ($app_server_error) {
|
1197 |
-
setcookie($ct_notice_online_label, '', 1, '/'); // time 1 is exactly in past even clients time() is wrong
|
1198 |
-
unset($_COOKIE[$ct_notice_online_label]);
|
1199 |
-
} else {
|
1200 |
-
setcookie($ct_notice_online_label, (string) time(), strtotime("+14 days"), '/');
|
1201 |
-
}
|
1202 |
-
setcookie($ct_notice_trial_label, '0', strtotime("+$trial_notice_showtime minutes"), '/');
|
1203 |
-
} else {
|
1204 |
-
setcookie($ct_notice_online_label, 'BAD_KEY', 0, '/');
|
1205 |
-
}
|
1206 |
-
}
|
1207 |
-
|
1208 |
-
/**
|
1209 |
-
* Unmark bad words
|
1210 |
-
* @param string $message
|
1211 |
-
* @return string Cleat comment
|
1212 |
-
*/
|
1213 |
-
function ct_unmark_red($message) {
|
1214 |
-
$message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
|
1215 |
-
|
1216 |
-
return $message;
|
1217 |
-
}
|
1218 |
-
|
1219 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cleantalk-comments-checkspam.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var working=false;
|
2 |
|
3 |
String.prototype.format = String.prototype.f = function ()
|
4 |
{
|
@@ -72,7 +72,7 @@ function ct_send_comments()
|
|
72 |
working=false;
|
73 |
jQuery('#ct_working_message').hide();
|
74 |
//alert('finish!');
|
75 |
-
location.href='edit-comments.php?page=ct_check_spam';
|
76 |
}
|
77 |
else
|
78 |
{
|
@@ -148,7 +148,7 @@ function ct_delete_all()
|
|
148 |
}
|
149 |
else
|
150 |
{
|
151 |
-
location.href='edit-comments.php?page=ct_check_spam';
|
152 |
}
|
153 |
}
|
154 |
});
|
@@ -175,7 +175,7 @@ function ct_delete_checked()
|
|
175 |
url: ajaxurl,
|
176 |
data: data,
|
177 |
success: function(msg){
|
178 |
-
location.href='edit-comments.php?page=ct_check_spam';
|
179 |
//alert(msg);
|
180 |
}
|
181 |
});
|
@@ -270,7 +270,7 @@ jQuery(document).ready(function(){
|
|
270 |
working=true;
|
271 |
ct_show_info();
|
272 |
working=false;
|
273 |
-
if(location.href.match(/
|
274 |
{
|
275 |
jQuery("#ct_check_spam_button").click();
|
276 |
}
|
1 |
+
var working = false;
|
2 |
|
3 |
String.prototype.format = String.prototype.f = function ()
|
4 |
{
|
72 |
working=false;
|
73 |
jQuery('#ct_working_message').hide();
|
74 |
//alert('finish!');
|
75 |
+
location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
|
76 |
}
|
77 |
else
|
78 |
{
|
148 |
}
|
149 |
else
|
150 |
{
|
151 |
+
location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
|
152 |
}
|
153 |
}
|
154 |
});
|
175 |
url: ajaxurl,
|
176 |
data: data,
|
177 |
success: function(msg){
|
178 |
+
location.href='edit-comments.php?page=ct_check_spam&ct_worked=1';
|
179 |
//alert(msg);
|
180 |
}
|
181 |
});
|
270 |
working=true;
|
271 |
ct_show_info();
|
272 |
working=false;
|
273 |
+
if(location.href.match(/ct_check_spam/) && !location.href.match(/ct_worked=1/))
|
274 |
{
|
275 |
jQuery("#ct_check_spam_button").click();
|
276 |
}
|
inc/cleantalk-common.php
CHANGED
@@ -473,6 +473,7 @@ function ct_def_options() {
|
|
473 |
'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
|
474 |
'wc_checkout_test' => '0', //WooCommerce checkout default test => OFF
|
475 |
'check_external' => '0',
|
|
|
476 |
//Comments and messages
|
477 |
'bp_private_messages' => '1', //buddyPress private messages test => ON
|
478 |
'check_comments_number' => '1',
|
473 |
'general_contact_forms_test' => '1', // Antispam test for unsupported and untested contact forms
|
474 |
'wc_checkout_test' => '0', //WooCommerce checkout default test => OFF
|
475 |
'check_external' => '0',
|
476 |
+
'check_internal' => '0',
|
477 |
//Comments and messages
|
478 |
'bp_private_messages' => '1', //buddyPress private messages test => ON
|
479 |
'check_comments_number' => '1',
|
inc/cleantalk-public.php
CHANGED
@@ -9,7 +9,21 @@ function ct_init() {
|
|
9 |
|
10 |
$ct_options = ct_get_options();
|
11 |
$ct_data=ct_get_data();
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
//fix for EPM registration form
|
14 |
if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
|
15 |
{
|
@@ -2385,6 +2399,10 @@ function ct_contact_form_validate () {
|
|
2385 |
die();
|
2386 |
}
|
2387 |
}
|
|
|
|
|
|
|
|
|
2388 |
else
|
2389 |
{
|
2390 |
ct_die(null, null);
|
9 |
|
10 |
$ct_options = ct_get_options();
|
11 |
$ct_data=ct_get_data();
|
12 |
+
|
13 |
+
//Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
|
14 |
+
if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
|
15 |
+
(isset($ct_options['check_internal']) && intval($ct_options['check_internal']))
|
16 |
+
){
|
17 |
+
$ct_result = ct_contact_form_validate();
|
18 |
+
if($ct_result == null){
|
19 |
+
echo 'true';
|
20 |
+
die();
|
21 |
+
}else{
|
22 |
+
echo $ct_result;
|
23 |
+
die();
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
//fix for EPM registration form
|
28 |
if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
|
29 |
{
|
2399 |
die();
|
2400 |
}
|
2401 |
}
|
2402 |
+
elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal')
|
2403 |
+
{
|
2404 |
+
return $ct_result->comment;
|
2405 |
+
}
|
2406 |
else
|
2407 |
{
|
2408 |
ct_die(null, null);
|
inc/cleantalk-users-checkspam.js
CHANGED
@@ -72,7 +72,7 @@ function ct_send_users()
|
|
72 |
working=false;
|
73 |
jQuery('#ct_working_message').hide();
|
74 |
//alert('finish!');
|
75 |
-
location.href='users.php?page=ct_check_users';
|
76 |
}
|
77 |
else
|
78 |
{
|
@@ -144,7 +144,7 @@ function ct_delete_all_users()
|
|
144 |
}
|
145 |
else
|
146 |
{
|
147 |
-
location.href='users.php?page=ct_check_users';
|
148 |
}
|
149 |
},
|
150 |
error: function(jqXHR, textStatus, errorThrown) {
|
@@ -178,7 +178,7 @@ function ct_delete_checked_users()
|
|
178 |
url: ajaxurl,
|
179 |
data: data,
|
180 |
success: function(msg){
|
181 |
-
location.href='users.php?page=ct_check_users';
|
182 |
//alert(msg);
|
183 |
}
|
184 |
});
|
@@ -234,7 +234,8 @@ jQuery("#ct_insert_users").click(function(){
|
|
234 |
});
|
235 |
|
236 |
jQuery("#ct_stop_deletion").click(function(){
|
237 |
-
window.location.reload();
|
|
|
238 |
});
|
239 |
jQuery("#ct_delete_all_users").click(function(){
|
240 |
if (!confirm('Delete all spam users?')) {
|
@@ -275,7 +276,7 @@ jQuery(document).ready(function(){
|
|
275 |
working=true;
|
276 |
ct_show_users_info();
|
277 |
working=false;
|
278 |
-
if(location.href.match(/
|
279 |
{
|
280 |
jQuery("#ct_check_users_button").click();
|
281 |
}
|
72 |
working=false;
|
73 |
jQuery('#ct_working_message').hide();
|
74 |
//alert('finish!');
|
75 |
+
location.href='users.php?page=ct_check_users&ct_worked=1';
|
76 |
}
|
77 |
else
|
78 |
{
|
144 |
}
|
145 |
else
|
146 |
{
|
147 |
+
location.href='users.php?page=ct_check_users&ct_worked=1';
|
148 |
}
|
149 |
},
|
150 |
error: function(jqXHR, textStatus, errorThrown) {
|
178 |
url: ajaxurl,
|
179 |
data: data,
|
180 |
success: function(msg){
|
181 |
+
location.href='users.php?page=ct_check_users&ct_worked=1';
|
182 |
//alert(msg);
|
183 |
}
|
184 |
});
|
234 |
});
|
235 |
|
236 |
jQuery("#ct_stop_deletion").click(function(){
|
237 |
+
//window.location.reload();
|
238 |
+
window.location.href='users.php?page=ct_check_users&ct_worked=1';
|
239 |
});
|
240 |
jQuery("#ct_delete_all_users").click(function(){
|
241 |
if (!confirm('Delete all spam users?')) {
|
276 |
working=true;
|
277 |
ct_show_users_info();
|
278 |
working=false;
|
279 |
+
if(location.href.match(/ct_check_users/) && !location.href.match(/ct_worked=1/))
|
280 |
{
|
281 |
jQuery("#ct_check_users_button").click();
|
282 |
}
|
inc/cleantalk_internal.js
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function ct_check_internal(currForm){
|
2 |
+
|
3 |
+
//Gathering data
|
4 |
+
var ct_data = {},
|
5 |
+
elems = currForm.elements;
|
6 |
+
|
7 |
+
for (var key in elems) {
|
8 |
+
if(elems[key].type == 'submit' || elems[key].value == undefined || elems[key].value == '')
|
9 |
+
continue;
|
10 |
+
ct_data[elems[key].name] = currForm.elements[key].value;
|
11 |
+
}
|
12 |
+
ct_data['action'] = 'ct_check_internal';
|
13 |
+
|
14 |
+
//AJAX Request
|
15 |
+
jQuery.ajax({
|
16 |
+
type: 'POST',
|
17 |
+
url: ct_blog_home,
|
18 |
+
datatype : 'text',
|
19 |
+
data: ct_data,
|
20 |
+
success: function(data){
|
21 |
+
if(data == 'true'){
|
22 |
+
currForm.submit();
|
23 |
+
}else{
|
24 |
+
alert(data);
|
25 |
+
return false;
|
26 |
+
}
|
27 |
+
},
|
28 |
+
error: function(){
|
29 |
+
currForm.submit();
|
30 |
+
}
|
31 |
+
});
|
32 |
+
}
|
33 |
+
|
34 |
+
jQuery(document).ready( function(){
|
35 |
+
var ct_currAction = '',
|
36 |
+
ct_currForm = '';
|
37 |
+
for(i=0;i<document.forms.length;i++){
|
38 |
+
if(typeof(document.forms[i].action)=='string'){
|
39 |
+
ct_currForm = document.forms[i];
|
40 |
+
ct_currAction = ct_currForm.action;
|
41 |
+
if(ct_currAction.indexOf('http://')!=-1||ct_currAction.indexOf('https://')!=-1){
|
42 |
+
if(ct_currAction.search(/\/wp-content\/themes.*\.php$/) != (-1) && ct_currAction.indexOf(ct_blog_home) != (-1)){
|
43 |
+
ctPrevHandler = ct_currForm.click;
|
44 |
+
jQuery(ct_currForm).off('**');
|
45 |
+
jQuery(ct_currForm).off();
|
46 |
+
jQuery(ct_currForm).on('submit', function(){
|
47 |
+
ct_check_internal(ct_currForm);
|
48 |
+
return false;
|
49 |
+
});
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
});
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00
|
|
3 |
Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, plugin, contact, recaptcha, google captcha, google recaptcha, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, widget, review, firewall, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,honeypot,puzzle,quiz,survey,poll,security
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.6.1
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -41,7 +41,7 @@ Supports native WordPress, JetPack comments and any other comment plugins. The p
|
|
41 |
Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
|
42 |
|
43 |
= Protection from contact form spam =
|
44 |
-
The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin
|
45 |
|
46 |
= WooCommerce spam filter =
|
47 |
Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
|
@@ -484,6 +484,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
484 |
1. The Dashboard with a map of most spam active countries per your account.
|
485 |
|
486 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
487 |
= 5.50.1 October 24 2016 =
|
488 |
* Improved filtration in contact forms.
|
489 |
* SpamFireWall: Fixed issue with SFW logs
|
@@ -1182,6 +1187,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
1182 |
|
1183 |
== Upgrade Notice ==
|
1184 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
1185 |
= 5.50.1 October 24 2016 =
|
1186 |
* Improved filtration in contact forms.
|
1187 |
* SpamFireWall: Fixed issue with SFW logs
|
3 |
Tags: spam, anti-spam, antispam, anti spam, bbpress, buddypress, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, plugin, contact, recaptcha, google captcha, google recaptcha, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, widget, review, firewall, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,honeypot,puzzle,quiz,survey,poll,security
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.6.1
|
6 |
+
Stable tag: 5.51
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
41 |
Filters spam bots on registration forms of WordPress, BuddyPress, bbPress, S2Member, WooCommerce, Profile builder, Login with AJAX and any other registration plugins.
|
42 |
|
43 |
= Protection from contact form spam =
|
44 |
+
The plugin is tested and ready to protect from spam emails via Formidable forms, Contact form 7, JetPack Contact form, Fast Secure Contact form, Ninja forms, Landing pages, Gravity forms, Contact Form by BestWebSoft, Simple Contact Form Plugin - PirateForms, Visual Form Builder, Form, Contact Form by WebDorado, Contact Form Email, MW WP Form, Contact Form by Jeff Bulllins, Easy Contact, Contact Us Form, Grunion Contact Form, WCP Contact Form, Easy WordPress Contact Form Plugin, WPForms Lite, Custom Contact Forms and any other themes/custom contact forms.
|
45 |
|
46 |
= WooCommerce spam filter =
|
47 |
Anti-spam by CleanTalk filters spam registrations and spam reviews for WooCommerce. The plugin is fully compatible with WooCommerce 2.1 and higher.
|
484 |
1. The Dashboard with a map of most spam active countries per your account.
|
485 |
|
486 |
== Changelog ==
|
487 |
+
= 5.51 November 2 2016 =
|
488 |
+
* Added protection for internal forms
|
489 |
+
* Immediate spam check for comments and users from WP dashboard
|
490 |
+
* Optimized code
|
491 |
+
|
492 |
= 5.50.1 October 24 2016 =
|
493 |
* Improved filtration in contact forms.
|
494 |
* SpamFireWall: Fixed issue with SFW logs
|
1187 |
|
1188 |
== Upgrade Notice ==
|
1189 |
== Changelog ==
|
1190 |
+
= 5.51 November 2 2016 =
|
1191 |
+
* Added protection for internal forms
|
1192 |
+
* Immediate spam check for comments and users from WP dashboard
|
1193 |
+
* Optimized code
|
1194 |
+
|
1195 |
= 5.50.1 October 24 2016 =
|
1196 |
* Improved filtration in contact forms.
|
1197 |
* SpamFireWall: Fixed issue with SFW logs
|