Version Description
Download this release
Release Info
Developer | shagimuratov |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 2.45 |
Comparing to | |
See all releases |
Code changes from version 2.42 to 2.45
- cleantalk-admin.php +434 -0
- cleantalk-utils.js +13 -0
- cleantalk-utils.php +27 -0
- cleantalk.class.php +25 -21
- cleantalk.php +254 -513
- i18n/cleantalk-ru_RU.mo +0 -0
- readme.txt +1 -2
cleantalk-admin.php
ADDED
@@ -0,0 +1,434 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$ct_plugin_basename = 'cleantalk-spam-protect/cleantalk.php';
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
7 |
+
* @param string $hook URL of hooked page
|
8 |
+
*/
|
9 |
+
function ct_enqueue_scripts($hook) {
|
10 |
+
if ($hook == 'edit-comments.php')
|
11 |
+
wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Admin action 'admin_menu' - Add the admin options page
|
16 |
+
*/
|
17 |
+
function ct_admin_add_page() {
|
18 |
+
add_options_page(__('CleanTalk settings', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>', 'manage_options', 'cleantalk', 'ct_settings_page');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Admin action 'admin_init' - Add the admin settings and such
|
23 |
+
*/
|
24 |
+
function ct_admin_init() {
|
25 |
+
global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout;
|
26 |
+
|
27 |
+
$show_ct_notice_trial = false;
|
28 |
+
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
29 |
+
if ($_COOKIE[$ct_notice_trial_label] == 1)
|
30 |
+
$show_ct_notice_trial = true;
|
31 |
+
} else {
|
32 |
+
$options = ct_get_options();
|
33 |
+
if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($options['apikey'])) {
|
34 |
+
$url = 'https://cleantalk.org/app_notice';
|
35 |
+
$server_timeout = 1;
|
36 |
+
$data['auth_key'] = $options['apikey'];
|
37 |
+
$data['param'] = 'notice_paid_till';
|
38 |
+
|
39 |
+
$ch = curl_init();
|
40 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
41 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
|
42 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
43 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
44 |
+
|
45 |
+
// receive server response ...
|
46 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
47 |
+
// resolve 'Expect: 100-continue' issue
|
48 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
49 |
+
|
50 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
51 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
52 |
+
|
53 |
+
$result = curl_exec($ch);
|
54 |
+
curl_close($ch);
|
55 |
+
|
56 |
+
if ($result) {
|
57 |
+
$result = json_decode($result, true);
|
58 |
+
if (isset($result['show_notice']) && $result['show_notice'] == 1) {
|
59 |
+
if (isset($result['trial']) && $result['trial'] == 1) {
|
60 |
+
$show_ct_notice_trial = true;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"), '/');
|
67 |
+
}
|
68 |
+
|
69 |
+
$show_ct_notice_online = '';
|
70 |
+
if (isset($_COOKIE[$ct_notice_online_label])) {
|
71 |
+
if ($_COOKIE[$ct_notice_online_label] == 1) {
|
72 |
+
$show_ct_notice_online = 'Y';
|
73 |
+
}else{
|
74 |
+
$show_ct_notice_online = 'N';
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
ct_init_session();
|
79 |
+
|
80 |
+
register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
|
81 |
+
add_settings_section('cleantalk_settings_main', __('Anti-spam by CleanTalk', 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
|
82 |
+
add_settings_section('cleantalk_settings_anti_spam', __('Anti-spam settings', 'cleantalk'), 'ct_section_settings_anti_spam', 'cleantalk');
|
83 |
+
add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
84 |
+
add_settings_field('cleantalk_autoPubRevelantMess', __('Publish relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
|
85 |
+
add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
86 |
+
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
87 |
+
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Admin callback function - Displays description of 'main' plugin parameters section
|
92 |
+
*/
|
93 |
+
function ct_section_settings_main() {
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Admin callback function - Displays description of 'anti-spam' plugin parameters section
|
99 |
+
*/
|
100 |
+
function ct_section_settings_anti_spam() {
|
101 |
+
return true;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @author Artem Leontiev
|
106 |
+
* Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
|
107 |
+
*
|
108 |
+
* @return null
|
109 |
+
*/
|
110 |
+
function ct_input_autoPubRevelantMess () {
|
111 |
+
$options = ct_get_options();
|
112 |
+
$value = $options['autoPubRevelantMess'];
|
113 |
+
echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
|
114 |
+
echo ' ';
|
115 |
+
echo "<input type='radio' id='cleantalk_autoPubRevelantMess0' name='cleantalk_settings[autoPubRevelantMess]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess0'> " . __('No') . "</label>";
|
116 |
+
admin_addDescriptionsFields(__('Relevant (not spam) comments from new authors will be automatic published at the blog', 'cleantalk'));
|
117 |
+
}
|
118 |
+
/**
|
119 |
+
* @author Artem Leontiev
|
120 |
+
* Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
|
121 |
+
*
|
122 |
+
* @return null
|
123 |
+
*/
|
124 |
+
function ct_input_remove_old_spam() {
|
125 |
+
$options = ct_get_options();
|
126 |
+
$value = $options['remove_old_spam'];
|
127 |
+
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>";
|
128 |
+
echo ' ';
|
129 |
+
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>";
|
130 |
+
admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $options['spam_store_days']));
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
135 |
+
*/
|
136 |
+
function ct_input_apikey() {
|
137 |
+
$options = ct_get_options();
|
138 |
+
$value = $options['apikey'];
|
139 |
+
|
140 |
+
$def_value = '';
|
141 |
+
echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='20' type='text' value='$value' style=\"font-size: 14pt;\"/>";
|
142 |
+
if (ct_valid_key($value) === false) {
|
143 |
+
echo "<a target='__blank' style='margin-left: 10px' href='http://cleantalk.org/install/wordpress?step=2'>".__('Click here to get access key', 'cleantalk')."</a>";
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
149 |
+
*/
|
150 |
+
function ct_input_comments_test() {
|
151 |
+
$options = ct_get_options();
|
152 |
+
$value = $options['comments_test'];
|
153 |
+
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>";
|
154 |
+
echo ' ';
|
155 |
+
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>";
|
156 |
+
admin_addDescriptionsFields(__('WordPress, JetPack', 'cleantalk'));
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
161 |
+
*/
|
162 |
+
function ct_input_registrations_test() {
|
163 |
+
$options = ct_get_options();
|
164 |
+
$value = $options['registrations_test'];
|
165 |
+
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>";
|
166 |
+
echo ' ';
|
167 |
+
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>";
|
168 |
+
admin_addDescriptionsFields(__('WordPress, BuddyPress, bbPress, S2Member', 'cleantalk'));
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
|
173 |
+
*/
|
174 |
+
function ct_input_contact_forms_test() {
|
175 |
+
$options = ct_get_options();
|
176 |
+
$value = $options['contact_forms_test'];
|
177 |
+
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>";
|
178 |
+
echo ' ';
|
179 |
+
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>";
|
180 |
+
admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Admin callback function - Plugin parameters validator
|
185 |
+
*/
|
186 |
+
function ct_settings_validate($input) {
|
187 |
+
return $input;
|
188 |
+
}
|
189 |
+
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Admin callback function - Displays plugin options page
|
193 |
+
*/
|
194 |
+
function ct_settings_page() {
|
195 |
+
?>
|
196 |
+
<style type="text/css">
|
197 |
+
input[type=submit] {padding: 10px; background: #3399FF; color: #fff; border:0 none;
|
198 |
+
cursor:pointer;
|
199 |
+
-webkit-border-radius: 5px;
|
200 |
+
border-radius: 5px;
|
201 |
+
font-size: 12pt;
|
202 |
+
}
|
203 |
+
</style>
|
204 |
+
|
205 |
+
<div>
|
206 |
+
<form action="options.php" method="post">
|
207 |
+
<?php settings_fields('cleantalk_settings'); ?>
|
208 |
+
<?php do_settings_sections('cleantalk'); ?>
|
209 |
+
<br>
|
210 |
+
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
|
211 |
+
</form>
|
212 |
+
</div>
|
213 |
+
<?php
|
214 |
+
|
215 |
+
if (ct_valid_key() === false)
|
216 |
+
return null;
|
217 |
+
?>
|
218 |
+
<br />
|
219 |
+
<br />
|
220 |
+
<br />
|
221 |
+
<div>
|
222 |
+
<?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.
|
223 |
+
</div>
|
224 |
+
<?php
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Notice blog owner if plugin is used without Access key
|
229 |
+
* @return bool
|
230 |
+
*/
|
231 |
+
function admin_notice_message(){
|
232 |
+
global $show_ct_notice_trial, $show_ct_notice_online;
|
233 |
+
|
234 |
+
if (ct_active() === false)
|
235 |
+
return false;
|
236 |
+
|
237 |
+
$options = ct_get_options();
|
238 |
+
$show_notice = true;
|
239 |
+
if ($show_notice && ct_valid_key($options['apikey']) === false) {
|
240 |
+
echo '<div class="updated"><h3>' . __("Please enter the Access Key in <a href=\"options-general.php?page=cleantalk\">CleanTalk plugin</a> settings to enable protection from spam!", 'cleantalk') . '</h3></div>';
|
241 |
+
}
|
242 |
+
|
243 |
+
if ($show_notice && !empty($show_ct_notice_online)) {
|
244 |
+
echo '<div class="updated"><h3><b>';
|
245 |
+
if($show_ct_notice_online === 'Y'){
|
246 |
+
echo __("Please don’t forget to disable CAPTCHA if you have it!", 'cleantalk');
|
247 |
+
}else{
|
248 |
+
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');
|
249 |
+
}
|
250 |
+
echo '</b></h3></div>';
|
251 |
+
}
|
252 |
+
|
253 |
+
if ($show_notice && $show_ct_notice_trial) {
|
254 |
+
echo '<div class="updated"><h3>' . __("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') . '</h3></div>';
|
255 |
+
$show_notice = false;
|
256 |
+
}
|
257 |
+
|
258 |
+
ct_send_feedback();
|
259 |
+
|
260 |
+
delete_spam_comments();
|
261 |
+
|
262 |
+
return true;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* @author Artem Leontiev
|
267 |
+
*
|
268 |
+
* Add descriptions for field
|
269 |
+
*/
|
270 |
+
function admin_addDescriptionsFields($descr = '') {
|
271 |
+
echo "<div style='color: #666 !important'>$descr</div>";
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Test API key
|
276 |
+
*/
|
277 |
+
function ct_valid_key($apikey = null) {
|
278 |
+
if ($apikey === null) {
|
279 |
+
$options = ct_get_options();
|
280 |
+
$apikey = $options['apikey'];
|
281 |
+
}
|
282 |
+
|
283 |
+
return ($apikey === 'enter key' || $apikey === '') ? false : true;
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Admin action 'comment_unapproved_to_approved' - Approve comment, sends good feedback to cleantalk, removes cleantalk resume
|
288 |
+
* @param object $comment_object Comment object
|
289 |
+
* @return boolean TRUE
|
290 |
+
*/
|
291 |
+
function ct_comment_approved($comment_object) {
|
292 |
+
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
293 |
+
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
294 |
+
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
295 |
+
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
296 |
+
$comment['comment_approved'] = 1;
|
297 |
+
wp_update_comment($comment);
|
298 |
+
|
299 |
+
return true;
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Admin action 'comment_approved_to_unapproved' - Unapprove comment, sends bad feedback to cleantalk
|
304 |
+
* @param object $comment_object Comment object
|
305 |
+
* @return boolean TRUE
|
306 |
+
*/
|
307 |
+
function ct_comment_unapproved($comment_object) {
|
308 |
+
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
309 |
+
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
310 |
+
ct_feedback($hash, $comment['comment_content'], 0);
|
311 |
+
$comment['comment_approved'] = 0;
|
312 |
+
wp_update_comment($comment);
|
313 |
+
|
314 |
+
return true;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Admin actions 'comment_unapproved_to_spam', 'comment_approved_to_spam' - Mark comment as spam, sends bad feedback to cleantalk
|
319 |
+
* @param object $comment_object Comment object
|
320 |
+
* @return boolean TRUE
|
321 |
+
*/
|
322 |
+
function ct_comment_spam($comment_object) {
|
323 |
+
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
324 |
+
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
325 |
+
ct_feedback($hash, $comment['comment_content'], 0);
|
326 |
+
$comment['comment_approved'] = 'spam';
|
327 |
+
wp_update_comment($comment);
|
328 |
+
|
329 |
+
return true;
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Unspam comment
|
335 |
+
* @param type $comment_id
|
336 |
+
*/
|
337 |
+
function ct_unspam_comment($comment_id) {
|
338 |
+
update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
|
339 |
+
$comment = get_comment($comment_id, 'ARRAY_A');
|
340 |
+
$hash = get_comment_meta($comment_id, 'ct_hash', true);
|
341 |
+
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
342 |
+
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
343 |
+
|
344 |
+
wp_update_comment($comment);
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Admin filter 'get_comment_text' - Adds some info to comment text to display
|
349 |
+
* @param string $current_text Current comment text
|
350 |
+
* @return string New comment text
|
351 |
+
*/
|
352 |
+
function ct_get_comment_text($current_text) {
|
353 |
+
global $comment;
|
354 |
+
$new_text = $current_text;
|
355 |
+
if (isset($comment) && is_object($comment)) {
|
356 |
+
$hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
357 |
+
if (!empty($hash)) {
|
358 |
+
$new_text .= '<hr>Cleantalk ID = ' . $hash;
|
359 |
+
}
|
360 |
+
}
|
361 |
+
return $new_text;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Send feedback for user deletion
|
366 |
+
* @return null
|
367 |
+
*/
|
368 |
+
function ct_delete_user($user_id) {
|
369 |
+
$hash = get_user_meta($user_id, 'ct_hash', true);
|
370 |
+
if ($hash !== '') {
|
371 |
+
ct_feedback($hash, null, 0);
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Manage links and plugins page
|
377 |
+
* @return array
|
378 |
+
*/
|
379 |
+
if (!function_exists ( 'ct_register_plugin_links')) {
|
380 |
+
function ct_register_plugin_links($links, $file) {
|
381 |
+
global $ct_plugin_basename;
|
382 |
+
|
383 |
+
if ($file == $ct_plugin_basename) {
|
384 |
+
$links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
385 |
+
$links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
386 |
+
$links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
387 |
+
}
|
388 |
+
return $links;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Manage links in plugins list
|
394 |
+
* @return array
|
395 |
+
*/
|
396 |
+
if (!function_exists ( 'ct_plugin_action_links')) {
|
397 |
+
function ct_plugin_action_links($links, $file) {
|
398 |
+
global $ct_plugin_basename;
|
399 |
+
|
400 |
+
if ($file == $ct_plugin_basename) {
|
401 |
+
$settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
402 |
+
array_unshift( $links, $settings_link ); // before other links
|
403 |
+
}
|
404 |
+
return $links;
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* After options update
|
410 |
+
* @return array
|
411 |
+
*/
|
412 |
+
function ct_update_option($option_name) {
|
413 |
+
global $show_ct_notice_online, $ct_notice_online_label;
|
414 |
+
if($option_name !== 'cleantalk_settings')
|
415 |
+
return;
|
416 |
+
$ct_base_call_result = ct_base_call(array(
|
417 |
+
'message' => 'CleanTalk setup comment',
|
418 |
+
'example' => null,
|
419 |
+
'sender_email' => 'stop_email@example.com',
|
420 |
+
'sender_nickname' => 'CleanTalk',
|
421 |
+
'post_info' => '',
|
422 |
+
'checkjs' => 1
|
423 |
+
));
|
424 |
+
$ct = $ct_base_call_result['ct'];
|
425 |
+
$ct_result = $ct_base_call_result['ct_result'];
|
426 |
+
|
427 |
+
if ($ct_result->inactive == 1) {
|
428 |
+
setcookie($ct_notice_online_label, 0, null, '/');
|
429 |
+
}else{
|
430 |
+
setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
?>
|
cleantalk-utils.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/**
|
3 |
+
* Generates random password
|
4 |
+
*/
|
5 |
+
function ct_random_password(length, list) {
|
6 |
+
retVal = "";
|
7 |
+
for (var i = 0, n = list.length; i < length; ++i) {
|
8 |
+
retVal += list.charAt(Math.floor(Math.random() * n));
|
9 |
+
}
|
10 |
+
return retVal;
|
11 |
+
}
|
12 |
+
|
13 |
+
function md5cycle(e,t){var n=e[0],r=e[1],i=e[2],s=e[3];n=ff(n,r,i,s,t[0],7,-680876936);s=ff(s,n,r,i,t[1],12,-389564586);i=ff(i,s,n,r,t[2],17,606105819);r=ff(r,i,s,n,t[3],22,-1044525330);n=ff(n,r,i,s,t[4],7,-176418897);s=ff(s,n,r,i,t[5],12,1200080426);i=ff(i,s,n,r,t[6],17,-1473231341);r=ff(r,i,s,n,t[7],22,-45705983);n=ff(n,r,i,s,t[8],7,1770035416);s=ff(s,n,r,i,t[9],12,-1958414417);i=ff(i,s,n,r,t[10],17,-42063);r=ff(r,i,s,n,t[11],22,-1990404162);n=ff(n,r,i,s,t[12],7,1804603682);s=ff(s,n,r,i,t[13],12,-40341101);i=ff(i,s,n,r,t[14],17,-1502002290);r=ff(r,i,s,n,t[15],22,1236535329);n=gg(n,r,i,s,t[1],5,-165796510);s=gg(s,n,r,i,t[6],9,-1069501632);i=gg(i,s,n,r,t[11],14,643717713);r=gg(r,i,s,n,t[0],20,-373897302);n=gg(n,r,i,s,t[5],5,-701558691);s=gg(s,n,r,i,t[10],9,38016083);i=gg(i,s,n,r,t[15],14,-660478335);r=gg(r,i,s,n,t[4],20,-405537848);n=gg(n,r,i,s,t[9],5,568446438);s=gg(s,n,r,i,t[14],9,-1019803690);i=gg(i,s,n,r,t[3],14,-187363961);r=gg(r,i,s,n,t[8],20,1163531501);n=gg(n,r,i,s,t[13],5,-1444681467);s=gg(s,n,r,i,t[2],9,-51403784);i=gg(i,s,n,r,t[7],14,1735328473);r=gg(r,i,s,n,t[12],20,-1926607734);n=hh(n,r,i,s,t[5],4,-378558);s=hh(s,n,r,i,t[8],11,-2022574463);i=hh(i,s,n,r,t[11],16,1839030562);r=hh(r,i,s,n,t[14],23,-35309556);n=hh(n,r,i,s,t[1],4,-1530992060);s=hh(s,n,r,i,t[4],11,1272893353);i=hh(i,s,n,r,t[7],16,-155497632);r=hh(r,i,s,n,t[10],23,-1094730640);n=hh(n,r,i,s,t[13],4,681279174);s=hh(s,n,r,i,t[0],11,-358537222);i=hh(i,s,n,r,t[3],16,-722521979);r=hh(r,i,s,n,t[6],23,76029189);n=hh(n,r,i,s,t[9],4,-640364487);s=hh(s,n,r,i,t[12],11,-421815835);i=hh(i,s,n,r,t[15],16,530742520);r=hh(r,i,s,n,t[2],23,-995338651);n=ii(n,r,i,s,t[0],6,-198630844);s=ii(s,n,r,i,t[7],10,1126891415);i=ii(i,s,n,r,t[14],15,-1416354905);r=ii(r,i,s,n,t[5],21,-57434055);n=ii(n,r,i,s,t[12],6,1700485571);s=ii(s,n,r,i,t[3],10,-1894986606);i=ii(i,s,n,r,t[10],15,-1051523);r=ii(r,i,s,n,t[1],21,-2054922799);n=ii(n,r,i,s,t[8],6,1873313359);s=ii(s,n,r,i,t[15],10,-30611744);i=ii(i,s,n,r,t[6],15,-1560198380);r=ii(r,i,s,n,t[13],21,1309151649);n=ii(n,r,i,s,t[4],6,-145523070);s=ii(s,n,r,i,t[11],10,-1120210379);i=ii(i,s,n,r,t[2],15,718787259);r=ii(r,i,s,n,t[9],21,-343485551);e[0]=add32(n,e[0]);e[1]=add32(r,e[1]);e[2]=add32(i,e[2]);e[3]=add32(s,e[3])}function cmn(e,t,n,r,i,s){t=add32(add32(t,e),add32(r,s));return add32(t<<i|t>>>32-i,n)}function ff(e,t,n,r,i,s,o){return cmn(t&n|~t&r,e,t,i,s,o)}function gg(e,t,n,r,i,s,o){return cmn(t&r|n&~r,e,t,i,s,o)}function hh(e,t,n,r,i,s,o){return cmn(t^n^r,e,t,i,s,o)}function ii(e,t,n,r,i,s,o){return cmn(n^(t|~r),e,t,i,s,o)}function md51(e){txt="";var t=e.length,n=[1732584193,-271733879,-1732584194,271733878],r;for(r=64;r<=e.length;r+=64){md5cycle(n,md5blk(e.substring(r-64,r)))}e=e.substring(r-64);var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<e.length;r++)i[r>>2]|=e.charCodeAt(r)<<(r%4<<3);i[r>>2]|=128<<(r%4<<3);if(r>55){md5cycle(n,i);for(r=0;r<16;r++)i[r]=0}i[14]=t*8;md5cycle(n,i);return n}function md5blk(e){var t=[],n;for(n=0;n<64;n+=4){t[n>>2]=e.charCodeAt(n)+(e.charCodeAt(n+1)<<8)+(e.charCodeAt(n+2)<<16)+(e.charCodeAt(n+3)<<24)}return t}function rhex(e){var t="",n=0;for(;n<4;n++)t+=hex_chr[e>>n*8+4&15]+hex_chr[e>>n*8&15];return t}function hex(e){for(var t=0;t<e.length;t++)e[t]=rhex(e[t]);return e.join("")}function md5(e){return hex(md51(e))}function add32(e,t){return e+t&4294967295}var hex_chr="0123456789abcdef".split("")
|
cleantalk-utils.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Generates random password
|
5 |
+
* @param int $length
|
6 |
+
* @param string $list
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
function ct_random_password($length = 4, $list = '') {
|
10 |
+
return substr(str_shuffle($list), 0, $length);
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Check COOKIES
|
15 |
+
* @return null
|
16 |
+
*/
|
17 |
+
function ct_check_cookies() {
|
18 |
+
global $ct_session_name, $ct_plugin_name;
|
19 |
+
|
20 |
+
if (!isset($_COOKIE[$ct_session_name])) {
|
21 |
+
wp_die('<p>Sorry, this is error. Please enable Cookies in your browser and try again! ' . $ct_plugin_name . '</p>', null, array('back_link' => true));
|
22 |
+
}
|
23 |
+
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
|
27 |
+
?>
|
cleantalk.class.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Cleantalk base class
|
4 |
*
|
5 |
-
* @version 1.
|
6 |
* @package Cleantalk
|
7 |
* @subpackage Base
|
8 |
* @author Сleantalk team (welcome@cleantalk.ru)
|
@@ -343,7 +343,7 @@ class Cleantalk {
|
|
343 |
* Server connection timeout in seconds
|
344 |
* @var int
|
345 |
*/
|
346 |
-
private $server_timeout =
|
347 |
|
348 |
/**
|
349 |
* Cleantalk server url
|
@@ -613,13 +613,13 @@ class Cleantalk {
|
|
613 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
614 |
// receive server response ...
|
615 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
616 |
-
// resolve 'Expect: 100-continue' issue
|
617 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
618 |
|
619 |
$result = curl_exec($ch);
|
620 |
curl_close($ch);
|
621 |
-
}
|
622 |
-
if (!$result) {
|
623 |
$allow_url_fopen = ini_get('allow_url_fopen');
|
624 |
if (function_exists('file_get_contents') && isset($allow_url_fopen) && $allow_url_fopen == '1') {
|
625 |
$opts = array('http' =>
|
@@ -633,7 +633,7 @@ class Cleantalk {
|
|
633 |
|
634 |
$context = stream_context_create($opts);
|
635 |
$result = @file_get_contents($url, false, $context);
|
636 |
-
}
|
637 |
}
|
638 |
if (!$result) {
|
639 |
$response = null;
|
@@ -643,7 +643,7 @@ class Cleantalk {
|
|
643 |
|
644 |
return $response;
|
645 |
}
|
646 |
-
|
647 |
|
|
|
648 |
|
649 |
$errstr = null;
|
650 |
$response = json_decode($result);
|
651 |
if ($result !== false && is_object($response)) {
|
@@ -658,7 +658,7 @@ class Cleantalk {
|
|
658 |
$response = json_decode(json_encode($response));
|
659 |
}
|
660 |
|
661 |
-
|
662 |
return $response;
|
663 |
}
|
664 |
|
@@ -699,7 +699,6 @@ class Cleantalk {
|
|
699 |
if (empty($pool)) {
|
700 |
return false;
|
701 |
} else {
|
702 |
-
|
703 |
// Loop until find work server
|
704 |
foreach ($this->get_servers_ip($pool) as $server) {
|
705 |
if ($server['host'] === 'localhost' || $server['ip'] === null) {
|
@@ -724,17 +723,17 @@ class Cleantalk {
|
|
724 |
}
|
725 |
}
|
726 |
}
|
727 |
-
|
728 |
$response = new CleantalkResponse(null, $result);
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
|
739 |
return $response;
|
740 |
}
|
@@ -899,7 +898,12 @@ class Cleantalk {
|
|
899 |
return mb_convert_encoding($str, 'UTF-8', $data_codepage);
|
900 |
|
901 |
$encoding = mb_detect_encoding($str);
|
902 |
-
|
|
|
|
|
|
|
|
|
|
|
903 |
}
|
904 |
|
905 |
return $str;
|
2 |
/**
|
3 |
* Cleantalk base class
|
4 |
*
|
5 |
+
* @version 1.23
|
6 |
* @package Cleantalk
|
7 |
* @subpackage Base
|
8 |
* @author Сleantalk team (welcome@cleantalk.ru)
|
343 |
* Server connection timeout in seconds
|
344 |
* @var int
|
345 |
*/
|
346 |
+
private $server_timeout = 15;
|
347 |
|
348 |
/**
|
349 |
* Cleantalk server url
|
613 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
614 |
// receive server response ...
|
615 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
616 |
+
// resolve 'Expect: 100-continue' issue
|
617 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
618 |
|
619 |
$result = curl_exec($ch);
|
620 |
curl_close($ch);
|
621 |
+
}
|
622 |
+
if (!$result) {
|
623 |
$allow_url_fopen = ini_get('allow_url_fopen');
|
624 |
if (function_exists('file_get_contents') && isset($allow_url_fopen) && $allow_url_fopen == '1') {
|
625 |
$opts = array('http' =>
|
633 |
|
634 |
$context = stream_context_create($opts);
|
635 |
$result = @file_get_contents($url, false, $context);
|
636 |
+
}
|
637 |
}
|
638 |
if (!$result) {
|
639 |
$response = null;
|
643 |
|
644 |
return $response;
|
645 |
}
|
|
|
646 |
|
647 |
+
|
648 |
|
649 |
$errstr = null;
|
650 |
$response = json_decode($result);
|
651 |
if ($result !== false && is_object($response)) {
|
658 |
$response = json_decode(json_encode($response));
|
659 |
}
|
660 |
|
661 |
+
|
662 |
return $response;
|
663 |
}
|
664 |
|
699 |
if (empty($pool)) {
|
700 |
return false;
|
701 |
} else {
|
|
|
702 |
// Loop until find work server
|
703 |
foreach ($this->get_servers_ip($pool) as $server) {
|
704 |
if ($server['host'] === 'localhost' || $server['ip'] === null) {
|
723 |
}
|
724 |
}
|
725 |
}
|
726 |
+
|
727 |
$response = new CleantalkResponse(null, $result);
|
728 |
+
|
729 |
+
if (!empty($this->data_codepage) && $this->data_codepage !== 'UTF-8') {
|
730 |
+
if (!empty($response->comment))
|
731 |
+
$response->comment = $this->stringFromUTF8($response->comment, $this->data_codepage);
|
732 |
+
if (!empty($response->errstr))
|
733 |
+
$response->errstr = $this->stringFromUTF8($response->errstr, $this->data_codepage);
|
734 |
+
if (!empty($response->sms_error_text))
|
735 |
+
$response->sms_error_text = $this->stringFromUTF8($response->sms_error_text, $this->data_codepage);
|
736 |
+
}
|
737 |
|
738 |
return $response;
|
739 |
}
|
898 |
return mb_convert_encoding($str, 'UTF-8', $data_codepage);
|
899 |
|
900 |
$encoding = mb_detect_encoding($str);
|
901 |
+
if ($encoding && $encoding != 'UTF-8') {
|
902 |
+
$str = mb_convert_encoding($str, 'UTF-8', $encoding);
|
903 |
+
} else {
|
904 |
+
// Final cut of non UTF-8 characters
|
905 |
+
$str = preg_replace('/[^(\x20-\x7F)]*/','', $str);
|
906 |
+
}
|
907 |
}
|
908 |
|
909 |
return $str;
|
cleantalk.php
CHANGED
@@ -3,12 +3,16 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
12 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
13 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
14 |
$ct_session_request_id_label = 'request_id';
|
@@ -51,6 +55,24 @@ $trial_notice_check_timeout = 10;
|
|
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 |
|
@@ -59,7 +81,7 @@ add_action( 'plugins_loaded', 'ct_plugin_loaded' );
|
|
59 |
|
60 |
// Comments
|
61 |
add_filter('preprocess_comment', 'ct_preprocess_comment'); // param - comment data array
|
62 |
-
add_filter(
|
63 |
|
64 |
// Formidable
|
65 |
add_action('frm_validate_entry', 'ct_frm_validate_entry', 20, 2);
|
@@ -90,6 +112,8 @@ add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
|
|
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');
|
95 |
add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
|
@@ -104,6 +128,9 @@ if (is_admin()) {
|
|
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,7 +138,9 @@ if (is_admin()) {
|
|
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 |
|
@@ -119,8 +148,14 @@ function ct_init() {
|
|
119 |
if (
|
120 |
(class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)) ||
|
121 |
(defined('LANDINGPAGES_CURRENT_VERSION'))
|
|
|
122 |
) {
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
|
126 |
//intercept WordPress Landing Pages POST
|
@@ -131,6 +166,11 @@ function ct_init() {
|
|
131 |
ct_check_wplp();
|
132 |
}
|
133 |
}
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -214,7 +254,6 @@ function ct_feedback($hash, $message = null, $allow) {
|
|
214 |
}
|
215 |
|
216 |
$ct_feedback = $hash . ':' . $allow . ';';
|
217 |
-
ct_init_session();
|
218 |
if (empty($_SESSION['feedback_request'])) {
|
219 |
$_SESSION['feedback_request'] = $ct_feedback;
|
220 |
} else {
|
@@ -231,7 +270,6 @@ function ct_feedback($hash, $message = null, $allow) {
|
|
231 |
*/
|
232 |
function ct_send_feedback($feedback_request = null) {
|
233 |
|
234 |
-
ct_init_session();
|
235 |
if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
|
236 |
$feedback_request = $_SESSION['feedback_request'];
|
237 |
unset($_SESSION['feedback_request']);
|
@@ -275,8 +313,10 @@ function ct_send_feedback($feedback_request = null) {
|
|
275 |
* @return null;
|
276 |
*/
|
277 |
function ct_init_session() {
|
278 |
-
|
279 |
-
|
|
|
|
|
280 |
@session_start();
|
281 |
}
|
282 |
|
@@ -299,13 +339,8 @@ function ct_base_call($params = array()) {
|
|
299 |
global $wpdb, $ct_agent_version;
|
300 |
|
301 |
require_once('cleantalk.class.php');
|
302 |
-
|
303 |
-
|
304 |
-
if (array_key_exists('formtime', $_SESSION)) {
|
305 |
-
$submit_time = time() - (int) $_SESSION['formtime'];
|
306 |
-
} else {
|
307 |
-
$submit_time = null;
|
308 |
-
}
|
309 |
|
310 |
$sender_info = array(
|
311 |
'cms_lang' => substr(get_locale(), 0, 2),
|
@@ -359,7 +394,9 @@ function ct_base_call($params = array()) {
|
|
359 |
/**
|
360 |
* Adds hidden filed to comment form
|
361 |
*/
|
362 |
-
function ct_comment_form() {
|
|
|
|
|
363 |
if (ct_is_user_enable() === false) {
|
364 |
return false;
|
365 |
}
|
@@ -368,9 +405,9 @@ function ct_comment_form() {
|
|
368 |
if ($options['comments_test'] == 0) {
|
369 |
return false;
|
370 |
}
|
371 |
-
|
372 |
-
ct_add_hidden_fields(
|
373 |
-
|
374 |
return null;
|
375 |
}
|
376 |
|
@@ -386,8 +423,7 @@ function ct_footer_add_cookie() {
|
|
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,16 +432,14 @@ function ct_footer_add_cookie() {
|
|
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 =
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
$ct_checkjs_key = ct_get_checkjs_value();
|
404 |
-
ct_init_session();
|
405 |
-
$_SESSION['formtime'] = time();
|
406 |
|
407 |
if ($cookie_check) {
|
408 |
-
|
|
|
409 |
<script type="text/javascript">
|
410 |
// <![CDATA[
|
411 |
function ctSetCookie(c_name, value) {
|
@@ -417,17 +451,49 @@ ctSetCookie("%s", "%s");
|
|
417 |
';
|
418 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
419 |
} else {
|
420 |
-
|
421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
<input type="hidden" id="%s" name="%s" value="%s" />
|
|
|
423 |
<script type="text/javascript">
|
424 |
// <![CDATA[
|
425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
// ]]>
|
427 |
</script>
|
428 |
';
|
429 |
-
$html = sprintf($html, $field_id, $field_name, $
|
430 |
-
|
|
|
|
|
|
|
|
|
|
|
431 |
if ($return_string === true) {
|
432 |
return $html;
|
433 |
} else {
|
@@ -460,12 +526,14 @@ function ct_is_user_enable() {
|
|
460 |
* return null;
|
461 |
*/
|
462 |
function ct_frm_entries_footer_scripts($fields, $form) {
|
463 |
-
global $current_user, $ct_checkjs_frm;
|
464 |
|
465 |
$options = ct_get_options();
|
466 |
if ($options['contact_forms_test'] == 0) {
|
467 |
return false;
|
468 |
}
|
|
|
|
|
469 |
|
470 |
$ct_checkjs_key = ct_get_checkjs_value();
|
471 |
$ct_frm_name = 'form_' . $form->form_key;
|
@@ -492,8 +560,10 @@ function ct_frm_validate_entry ($errors, $values) {
|
|
492 |
if ($options['contact_forms_test'] == 0) {
|
493 |
return false;
|
494 |
}
|
|
|
|
|
495 |
|
496 |
-
$checkjs =
|
497 |
|
498 |
$post_info['comment_type'] = 'feedback';
|
499 |
$post_info = json_encode($post_info);
|
@@ -537,8 +607,8 @@ function ct_preprocess_comment($comment) {
|
|
537 |
// this action is called just when WP process POST request (adds new comment)
|
538 |
// this action is called by wp-comments-post.php
|
539 |
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
540 |
-
global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label;
|
541 |
-
|
542 |
$options = ct_get_options();
|
543 |
if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
|
544 |
return $comment;
|
@@ -577,7 +647,8 @@ function ct_preprocess_comment($comment) {
|
|
577 |
|
578 |
$post = get_post($comment_post_id);
|
579 |
|
580 |
-
|
|
|
581 |
|
582 |
$example = null;
|
583 |
|
@@ -692,21 +763,36 @@ function ct_die_extended($comment_body) {
|
|
692 |
}
|
693 |
|
694 |
/**
|
695 |
-
*
|
696 |
*
|
697 |
*/
|
698 |
-
function
|
699 |
-
$
|
700 |
-
$js_field = null;
|
701 |
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
if (
|
706 |
-
|
707 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
} else {
|
709 |
-
$
|
|
|
|
|
|
|
710 |
}
|
711 |
}
|
712 |
|
@@ -714,25 +800,18 @@ function js_test_post($field_name = 'ct_checkjs') {
|
|
714 |
}
|
715 |
|
716 |
/**
|
717 |
-
*
|
718 |
*
|
719 |
*/
|
720 |
-
function
|
721 |
-
$
|
722 |
-
$js_field = null;
|
723 |
-
|
724 |
-
if (isset($_COOKIE[$field_name]))
|
725 |
-
$js_field = $_COOKIE[$field_name];
|
726 |
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
} else {
|
731 |
-
$checkjs = 0;
|
732 |
-
}
|
733 |
}
|
734 |
|
735 |
-
return $
|
736 |
}
|
737 |
|
738 |
/**
|
@@ -747,8 +826,8 @@ function ct_post_url($comment_id = null, $comment_post_id) {
|
|
747 |
return null;
|
748 |
|
749 |
if ($comment_id === null) {
|
750 |
-
|
751 |
-
|
752 |
}
|
753 |
$permalink = get_permalink($comment_post_id);
|
754 |
|
@@ -807,84 +886,6 @@ function ct_set_meta($comment_id, $comment_status) {
|
|
807 |
return true;
|
808 |
}
|
809 |
|
810 |
-
/**
|
811 |
-
* Admin action 'comment_unapproved_to_approved' - Approve comment, sends good feedback to cleantalk, removes cleantalk resume
|
812 |
-
* @param object $comment_object Comment object
|
813 |
-
* @return boolean TRUE
|
814 |
-
*/
|
815 |
-
function ct_comment_approved($comment_object) {
|
816 |
-
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
817 |
-
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
818 |
-
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
819 |
-
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
820 |
-
$comment['comment_approved'] = 1;
|
821 |
-
wp_update_comment($comment);
|
822 |
-
|
823 |
-
return true;
|
824 |
-
}
|
825 |
-
|
826 |
-
/**
|
827 |
-
* Admin action 'comment_approved_to_unapproved' - Unapprove comment, sends bad feedback to cleantalk
|
828 |
-
* @param object $comment_object Comment object
|
829 |
-
* @return boolean TRUE
|
830 |
-
*/
|
831 |
-
function ct_comment_unapproved($comment_object) {
|
832 |
-
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
833 |
-
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
834 |
-
ct_feedback($hash, $comment['comment_content'], 0);
|
835 |
-
$comment['comment_approved'] = 0;
|
836 |
-
wp_update_comment($comment);
|
837 |
-
|
838 |
-
return true;
|
839 |
-
}
|
840 |
-
|
841 |
-
/**
|
842 |
-
* Admin actions 'comment_unapproved_to_spam', 'comment_approved_to_spam' - Mark comment as spam, sends bad feedback to cleantalk
|
843 |
-
* @param object $comment_object Comment object
|
844 |
-
* @return boolean TRUE
|
845 |
-
*/
|
846 |
-
function ct_comment_spam($comment_object) {
|
847 |
-
$comment = get_comment($comment_object->comment_ID, 'ARRAY_A');
|
848 |
-
$hash = get_comment_meta($comment_object->comment_ID, 'ct_hash', true);
|
849 |
-
ct_feedback($hash, $comment['comment_content'], 0);
|
850 |
-
$comment['comment_approved'] = 'spam';
|
851 |
-
wp_update_comment($comment);
|
852 |
-
|
853 |
-
return true;
|
854 |
-
}
|
855 |
-
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Unspam comment
|
859 |
-
* @param type $comment_id
|
860 |
-
*/
|
861 |
-
function ct_unspam_comment($comment_id) {
|
862 |
-
update_comment_meta($comment_id, '_wp_trash_meta_status', 1);
|
863 |
-
$comment = get_comment($comment_id, 'ARRAY_A');
|
864 |
-
$hash = get_comment_meta($comment_id, 'ct_hash', true);
|
865 |
-
$comment['comment_content'] = ct_unmark_red($comment['comment_content']);
|
866 |
-
$comment['comment_content'] = ct_feedback($hash, $comment['comment_content'], 1);
|
867 |
-
|
868 |
-
wp_update_comment($comment);
|
869 |
-
}
|
870 |
-
|
871 |
-
/**
|
872 |
-
* Admin filter 'get_comment_text' - Adds some info to comment text to display
|
873 |
-
* @param string $current_text Current comment text
|
874 |
-
* @return string New comment text
|
875 |
-
*/
|
876 |
-
function ct_get_comment_text($current_text) {
|
877 |
-
global $comment;
|
878 |
-
$new_text = $current_text;
|
879 |
-
if (isset($comment) && is_object($comment)) {
|
880 |
-
$hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
881 |
-
if (!empty($hash)) {
|
882 |
-
$new_text .= '<hr>Cleantalk ID = ' . $hash;
|
883 |
-
}
|
884 |
-
}
|
885 |
-
return $new_text;
|
886 |
-
}
|
887 |
-
|
888 |
/**
|
889 |
* Mark bad words
|
890 |
* @global string $ct_stop_words
|
@@ -916,65 +917,6 @@ function ct_unmark_red($message) {
|
|
916 |
return $message;
|
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 |
-
|
950 |
-
ct_send_feedback();
|
951 |
-
|
952 |
-
delete_spam_comments();
|
953 |
-
|
954 |
-
return true;
|
955 |
-
}
|
956 |
-
|
957 |
-
/**
|
958 |
-
* @author Artem Leontiev
|
959 |
-
*
|
960 |
-
* Add descriptions for field
|
961 |
-
*/
|
962 |
-
function admin_addDescriptionsFields($descr = '') {
|
963 |
-
echo "<div style='color: #666 !important'>$descr</div>";
|
964 |
-
}
|
965 |
-
|
966 |
-
/**
|
967 |
-
* Test API key
|
968 |
-
*/
|
969 |
-
function ct_valid_key($apikey = null) {
|
970 |
-
if ($apikey === null) {
|
971 |
-
$options = ct_get_options();
|
972 |
-
$apikey = $options['apikey'];
|
973 |
-
}
|
974 |
-
|
975 |
-
return ($apikey === 'enter key' || $apikey === '') ? false : true;
|
976 |
-
}
|
977 |
-
|
978 |
/**
|
979 |
* Tests plugin activation status
|
980 |
* @return bool
|
@@ -1005,10 +947,13 @@ function ct_plugin_active($plugin_name){
|
|
1005 |
* Get ct_get_checkjs_value
|
1006 |
* @return string
|
1007 |
*/
|
1008 |
-
function ct_get_checkjs_value() {
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
|
|
|
|
|
|
1012 |
}
|
1013 |
|
1014 |
/**
|
@@ -1044,7 +989,7 @@ function ct_register_form() {
|
|
1044 |
return false;
|
1045 |
}
|
1046 |
|
1047 |
-
ct_add_hidden_fields(
|
1048 |
|
1049 |
return null;
|
1050 |
}
|
@@ -1059,7 +1004,6 @@ function ct_login_message($message) {
|
|
1059 |
$options = ct_get_options();
|
1060 |
if ($options['registrations_test'] != 0) {
|
1061 |
if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
|
1062 |
-
ct_init_session();
|
1063 |
if (isset($_SESSION[$ct_session_register_ok_label])) {
|
1064 |
unset($_SESSION[$ct_session_register_ok_label]);
|
1065 |
if(is_wp_error($errors))
|
@@ -1090,19 +1034,14 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1090 |
$buddypress = true;
|
1091 |
}
|
1092 |
|
1093 |
-
|
1094 |
-
if (array_key_exists('formtime', $_SESSION)) {
|
1095 |
-
$submit_time = time() - (int) $_SESSION['formtime'];
|
1096 |
-
} else {
|
1097 |
-
$submit_time = null;
|
1098 |
-
}
|
1099 |
|
1100 |
$options = ct_get_options();
|
1101 |
if ($options['registrations_test'] == 0) {
|
1102 |
return $errors;
|
1103 |
}
|
1104 |
|
1105 |
-
$checkjs =
|
1106 |
|
1107 |
require_once('cleantalk.class.php');
|
1108 |
|
@@ -1174,7 +1113,6 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1174 |
}
|
1175 |
} else {
|
1176 |
if ($ct_result->id !== null) {
|
1177 |
-
ct_init_session();
|
1178 |
$_SESSION[$ct_session_request_id_label] = $ct_result->id;
|
1179 |
$_SESSION[$ct_session_register_ok_label] = $ct_result->id;
|
1180 |
}
|
@@ -1190,23 +1128,12 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema
|
|
1190 |
function ct_user_register($user_id) {
|
1191 |
global $ct_session_request_id_label;
|
1192 |
|
1193 |
-
ct_init_session();
|
1194 |
if (isset($_SESSION[$ct_session_request_id_label])) {
|
1195 |
update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
|
1196 |
unset($_SESSION[$ct_session_request_id_label]);
|
1197 |
}
|
1198 |
}
|
1199 |
|
1200 |
-
/**
|
1201 |
-
* Send feedback for user deletion
|
1202 |
-
* @return null
|
1203 |
-
*/
|
1204 |
-
function ct_delete_user($user_id) {
|
1205 |
-
$hash = get_user_meta($user_id, 'ct_hash', true);
|
1206 |
-
if ($hash !== '') {
|
1207 |
-
ct_feedback($hash, null, 0);
|
1208 |
-
}
|
1209 |
-
}
|
1210 |
|
1211 |
/**
|
1212 |
* Test for JetPack contact form
|
@@ -1226,7 +1153,7 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
|
|
1226 |
}
|
1227 |
}
|
1228 |
|
1229 |
-
$r .= ct_add_hidden_fields(
|
1230 |
$ct_jpcf_patched = true;
|
1231 |
}
|
1232 |
|
@@ -1237,6 +1164,8 @@ function ct_grunion_contact_form_field_html($r, $field_label) {
|
|
1237 |
*/
|
1238 |
function ct_contact_form_is_spam($form) {
|
1239 |
global $ct_checkjs_jpcf;
|
|
|
|
|
1240 |
|
1241 |
$options = ct_get_options();
|
1242 |
|
@@ -1249,7 +1178,8 @@ function ct_contact_form_is_spam($form) {
|
|
1249 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1250 |
$js_field_name = $k;
|
1251 |
}
|
1252 |
-
|
|
|
1253 |
|
1254 |
$sender_info = array(
|
1255 |
'sender_url' => @$form['comment_author_url']
|
@@ -1307,7 +1237,7 @@ function ct_wpcf7_form_elements($html) {
|
|
1307 |
return $html;
|
1308 |
}
|
1309 |
|
1310 |
-
$html .= ct_add_hidden_fields(
|
1311 |
|
1312 |
return $html;
|
1313 |
}
|
@@ -1326,7 +1256,9 @@ function ct_wpcf7_spam($spam) {
|
|
1326 |
return $spam;
|
1327 |
}
|
1328 |
|
1329 |
-
|
|
|
|
|
1330 |
|
1331 |
$post_info['comment_type'] = 'feedback';
|
1332 |
$post_info = json_encode($post_info);
|
@@ -1385,7 +1317,7 @@ function ct_wpcf7_display_message($message, $status) {
|
|
1385 |
* Inserts anti-spam hidden to Fast Secure contact form
|
1386 |
*/
|
1387 |
function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
|
1388 |
-
$string .= ct_add_hidden_fields(
|
1389 |
return $string;
|
1390 |
}
|
1391 |
|
@@ -1400,7 +1332,8 @@ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
|
1400 |
if ($options['contact_forms_test'] == 0)
|
1401 |
return $form_errors;
|
1402 |
|
1403 |
-
|
|
|
1404 |
|
1405 |
$post_info['comment_type'] = 'feedback';
|
1406 |
$post_info = json_encode($post_info);
|
@@ -1445,233 +1378,18 @@ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
|
|
1445 |
return $form_errors;
|
1446 |
}
|
1447 |
|
1448 |
-
/**
|
1449 |
-
* Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
|
1450 |
-
* @param string $hook URL of hooked page
|
1451 |
-
*/
|
1452 |
-
function ct_enqueue_scripts($hook) {
|
1453 |
-
if ($hook == 'edit-comments.php')
|
1454 |
-
wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__));
|
1455 |
-
}
|
1456 |
-
|
1457 |
-
/**
|
1458 |
-
* Admin action 'admin_menu' - Add the admin options page
|
1459 |
-
*/
|
1460 |
-
function ct_admin_add_page() {
|
1461 |
-
add_options_page(__('CleanTalk settings', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>', 'manage_options', 'cleantalk', 'ct_settings_page');
|
1462 |
-
}
|
1463 |
-
|
1464 |
-
/**
|
1465 |
-
* Admin action 'admin_init' - Add the admin settings and such
|
1466 |
-
*/
|
1467 |
-
function ct_admin_init() {
|
1468 |
-
global $show_ct_notice_trial, $ct_notice_trial_label, $show_ct_notice_online, $ct_notice_online_label, $trial_notice_check_timeout;
|
1469 |
-
|
1470 |
-
$show_ct_notice_trial = false;
|
1471 |
-
if (isset($_COOKIE[$ct_notice_trial_label])) {
|
1472 |
-
if ($_COOKIE[$ct_notice_trial_label] == 1)
|
1473 |
-
$show_ct_notice_trial = true;
|
1474 |
-
} else {
|
1475 |
-
$options = ct_get_options();
|
1476 |
-
if (function_exists('curl_init') && function_exists('json_decode') && ct_valid_key($options['apikey'])) {
|
1477 |
-
$url = 'https://cleantalk.org/app_notice';
|
1478 |
-
$server_timeout = 1;
|
1479 |
-
$data['auth_key'] = $options['apikey'];
|
1480 |
-
$data['param'] = 'notice_paid_till';
|
1481 |
-
|
1482 |
-
$ch = curl_init();
|
1483 |
-
curl_setopt($ch, CURLOPT_URL, $url);
|
1484 |
-
curl_setopt($ch, CURLOPT_TIMEOUT, $server_timeout);
|
1485 |
-
curl_setopt($ch, CURLOPT_POST, true);
|
1486 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
1487 |
-
|
1488 |
-
// receive server response ...
|
1489 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
1490 |
-
// resolve 'Expect: 100-continue' issue
|
1491 |
-
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
1492 |
-
|
1493 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
1494 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
1495 |
-
|
1496 |
-
$result = curl_exec($ch);
|
1497 |
-
curl_close($ch);
|
1498 |
-
|
1499 |
-
if ($result) {
|
1500 |
-
$result = json_decode($result, true);
|
1501 |
-
if (isset($result['show_notice']) && $result['show_notice'] == 1) {
|
1502 |
-
if (isset($result['trial']) && $result['trial'] == 1) {
|
1503 |
-
$show_ct_notice_trial = true;
|
1504 |
-
}
|
1505 |
-
}
|
1506 |
-
}
|
1507 |
-
}
|
1508 |
-
|
1509 |
-
setcookie($ct_notice_trial_label, (int) $show_ct_notice_trial, strtotime("+$trial_notice_check_timeout minutes"), '/');
|
1510 |
-
}
|
1511 |
-
|
1512 |
-
$show_ct_notice_online = '';
|
1513 |
-
if (isset($_COOKIE[$ct_notice_online_label])) {
|
1514 |
-
if ($_COOKIE[$ct_notice_online_label] == 1) {
|
1515 |
-
$show_ct_notice_online = 'Y';
|
1516 |
-
}else{
|
1517 |
-
$show_ct_notice_online = 'N';
|
1518 |
-
}
|
1519 |
-
}
|
1520 |
-
|
1521 |
-
ct_init_session();
|
1522 |
-
|
1523 |
-
register_setting('cleantalk_settings', 'cleantalk_settings', 'ct_settings_validate');
|
1524 |
-
add_settings_section('cleantalk_settings_main', __('Main settings', 'cleantalk'), 'ct_section_settings_main', 'cleantalk');
|
1525 |
-
add_settings_section('cleantalk_settings_anti_spam', __('Anti-spam settings', 'cleantalk'), 'ct_section_settings_anti_spam', 'cleantalk');
|
1526 |
-
add_settings_field('cleantalk_apikey', __('Access key', 'cleantalk'), 'ct_input_apikey', 'cleantalk', 'cleantalk_settings_main');
|
1527 |
-
add_settings_field('cleantalk_autoPubRevelantMess', __('Publish relevant comments', 'cleantalk'), 'ct_input_autoPubRevelantMess', 'cleantalk', 'cleantalk_settings_main');
|
1528 |
-
add_settings_field('cleantalk_remove_old_spam', __('Automatically delete spam comments', 'cleantalk'), 'ct_input_remove_old_spam', 'cleantalk', 'cleantalk_settings_main');
|
1529 |
-
add_settings_field('cleantalk_registrations_test', __('Registration forms', 'cleantalk'), 'ct_input_registrations_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
1530 |
-
add_settings_field('cleantalk_comments_test', __('Comments form', 'cleantalk'), 'ct_input_comments_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
1531 |
-
add_settings_field('cleantalk_contact_forms_test', __('Contact forms', 'cleantalk'), 'ct_input_contact_forms_test', 'cleantalk', 'cleantalk_settings_anti_spam');
|
1532 |
-
}
|
1533 |
-
|
1534 |
-
/**
|
1535 |
-
* Admin callback function - Displays description of 'main' plugin parameters section
|
1536 |
-
*/
|
1537 |
-
function ct_section_settings_main() {
|
1538 |
-
return true;
|
1539 |
-
}
|
1540 |
-
|
1541 |
-
/**
|
1542 |
-
* Admin callback function - Displays description of 'anti-spam' plugin parameters section
|
1543 |
-
*/
|
1544 |
-
function ct_section_settings_anti_spam() {
|
1545 |
-
return true;
|
1546 |
-
}
|
1547 |
-
|
1548 |
-
/**
|
1549 |
-
* @author Artem Leontiev
|
1550 |
-
* Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
|
1551 |
-
*
|
1552 |
-
* @return null
|
1553 |
-
*/
|
1554 |
-
function ct_input_autoPubRevelantMess () {
|
1555 |
-
$options = ct_get_options();
|
1556 |
-
$value = $options['autoPubRevelantMess'];
|
1557 |
-
echo "<input type='radio' id='cleantalk_autoPubRevelantMess1' name='cleantalk_settings[autoPubRevelantMess]' value='1' " . ($value == '1' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess1'> " . __('Yes') . "</label>";
|
1558 |
-
echo ' ';
|
1559 |
-
echo "<input type='radio' id='cleantalk_autoPubRevelantMess0' name='cleantalk_settings[autoPubRevelantMess]' value='0' " . ($value == '0' ? 'checked' : '') . " /><label for='cleantalk_autoPubRevelantMess0'> " . __('No') . "</label>";
|
1560 |
-
admin_addDescriptionsFields(__('Relevant (not spam) comments from new authors will be automatic published at the blog', 'cleantalk'));
|
1561 |
-
}
|
1562 |
-
/**
|
1563 |
-
* @author Artem Leontiev
|
1564 |
-
* Admin callback function - Displays inputs of 'Publicate relevant comments' plugin parameter
|
1565 |
-
*
|
1566 |
-
* @return null
|
1567 |
-
*/
|
1568 |
-
function ct_input_remove_old_spam() {
|
1569 |
-
$options = ct_get_options();
|
1570 |
-
$value = $options['remove_old_spam'];
|
1571 |
-
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>";
|
1572 |
-
echo ' ';
|
1573 |
-
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>";
|
1574 |
-
admin_addDescriptionsFields(sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $options['spam_store_days']));
|
1575 |
-
}
|
1576 |
-
|
1577 |
-
/**
|
1578 |
-
* Admin callback function - Displays inputs of 'apikey' plugin parameter
|
1579 |
-
*/
|
1580 |
-
function ct_input_apikey() {
|
1581 |
-
$options = ct_get_options();
|
1582 |
-
$value = $options['apikey'];
|
1583 |
-
|
1584 |
-
$def_value = '';
|
1585 |
-
echo "<input id='cleantalk_apikey' name='cleantalk_settings[apikey]' size='10' type='text' value='$value' />";
|
1586 |
-
if (ct_valid_key($value) === false) {
|
1587 |
-
echo "<a target='__blank' style='margin-left: 10px' href='http://cleantalk.org/install/wordpress?step=2'>".__('Click here to get access key', 'cleantalk')."</a>";
|
1588 |
-
}
|
1589 |
-
}
|
1590 |
-
|
1591 |
-
/**
|
1592 |
-
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
1593 |
-
*/
|
1594 |
-
function ct_input_comments_test() {
|
1595 |
-
$options = ct_get_options();
|
1596 |
-
$value = $options['comments_test'];
|
1597 |
-
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>";
|
1598 |
-
echo ' ';
|
1599 |
-
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>";
|
1600 |
-
admin_addDescriptionsFields(__('WordPress, JetPack', 'cleantalk'));
|
1601 |
-
}
|
1602 |
-
|
1603 |
-
/**
|
1604 |
-
* Admin callback function - Displays inputs of 'comments_test' plugin parameter
|
1605 |
-
*/
|
1606 |
-
function ct_input_registrations_test() {
|
1607 |
-
$options = ct_get_options();
|
1608 |
-
$value = $options['registrations_test'];
|
1609 |
-
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>";
|
1610 |
-
echo ' ';
|
1611 |
-
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>";
|
1612 |
-
admin_addDescriptionsFields(__('WordPress, BuddyPress, bbPress', 'cleantalk'));
|
1613 |
-
}
|
1614 |
-
|
1615 |
-
/**
|
1616 |
-
* Admin callback function - Displays inputs of 'contact_forms_test' plugin parameter
|
1617 |
-
*/
|
1618 |
-
function ct_input_contact_forms_test() {
|
1619 |
-
$options = ct_get_options();
|
1620 |
-
$value = $options['contact_forms_test'];
|
1621 |
-
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>";
|
1622 |
-
echo ' ';
|
1623 |
-
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>";
|
1624 |
-
admin_addDescriptionsFields(__('Contact Form 7, Formiadble forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages', 'cleantalk'));
|
1625 |
-
}
|
1626 |
-
|
1627 |
-
/**
|
1628 |
-
* Admin callback function - Plugin parameters validator
|
1629 |
-
*/
|
1630 |
-
function ct_settings_validate($input) {
|
1631 |
-
return $input;
|
1632 |
-
}
|
1633 |
-
|
1634 |
-
|
1635 |
-
/**
|
1636 |
-
* Admin callback function - Displays plugin options page
|
1637 |
-
*/
|
1638 |
-
function ct_settings_page() {
|
1639 |
-
?>
|
1640 |
-
<div>
|
1641 |
-
<h2><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b></h2>
|
1642 |
-
<form action="options.php" method="post">
|
1643 |
-
<?php settings_fields('cleantalk_settings'); ?>
|
1644 |
-
<?php do_settings_sections('cleantalk'); ?>
|
1645 |
-
<br>
|
1646 |
-
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />
|
1647 |
-
</form>
|
1648 |
-
</div>
|
1649 |
-
<?php
|
1650 |
-
|
1651 |
-
if (ct_valid_key() === false)
|
1652 |
-
return null;
|
1653 |
-
?>
|
1654 |
-
<br />
|
1655 |
-
<br />
|
1656 |
-
<br />
|
1657 |
-
<div>
|
1658 |
-
<?php echo __('Plugin Homepage at', 'cleantalk'); ?> <a href="http://cleantalk.org" target="_blank">cleantalk.org</a>.
|
1659 |
-
</div>
|
1660 |
-
<?php
|
1661 |
-
}
|
1662 |
-
|
1663 |
/**
|
1664 |
* Notice for commentators which comment has automatically approved by plugin
|
1665 |
* @param string $hook URL of hooked page
|
1666 |
*/
|
1667 |
function ct_comment_text($comment_text) {
|
1668 |
-
global $comment, $ct_approved_request_id_label;
|
1669 |
|
1670 |
if (isset($_COOKIE[$ct_approved_request_id_label])) {
|
1671 |
$ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
1672 |
|
1673 |
if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
|
1674 |
-
$comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __(
|
1675 |
}
|
1676 |
}
|
1677 |
|
@@ -1679,64 +1397,6 @@ function ct_comment_text($comment_text) {
|
|
1679 |
}
|
1680 |
|
1681 |
|
1682 |
-
/**
|
1683 |
-
* Manage links and plugins page
|
1684 |
-
* @return array
|
1685 |
-
*/
|
1686 |
-
if (!function_exists ( 'ct_register_plugin_links')) {
|
1687 |
-
function ct_register_plugin_links($links, $file) {
|
1688 |
-
$base = plugin_basename(__FILE__);
|
1689 |
-
if ( $file == $base ) {
|
1690 |
-
$links[] = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1691 |
-
$links[] = '<a href="http://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
|
1692 |
-
$links[] = '<a href="http://cleantalk.org/forum" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
|
1693 |
-
}
|
1694 |
-
return $links;
|
1695 |
-
}
|
1696 |
-
}
|
1697 |
-
|
1698 |
-
|
1699 |
-
/**
|
1700 |
-
* Manage links in plugins list
|
1701 |
-
* @return array
|
1702 |
-
*/
|
1703 |
-
if (!function_exists ( 'ct_plugin_action_links')) {
|
1704 |
-
function ct_plugin_action_links($links, $file) {
|
1705 |
-
$base = plugin_basename(__FILE__);
|
1706 |
-
if ( $file == $base ) {
|
1707 |
-
$settings_link = '<a href="options-general.php?page=cleantalk">' . __( 'Settings' ) . '</a>';
|
1708 |
-
array_unshift( $links, $settings_link ); // before other links
|
1709 |
-
}
|
1710 |
-
return $links;
|
1711 |
-
}
|
1712 |
-
}
|
1713 |
-
|
1714 |
-
/**
|
1715 |
-
* After options update
|
1716 |
-
* @return array
|
1717 |
-
*/
|
1718 |
-
function ct_update_option($option_name) {
|
1719 |
-
global $show_ct_notice_online, $ct_notice_online_label;
|
1720 |
-
if($option_name !== 'cleantalk_settings')
|
1721 |
-
return;
|
1722 |
-
$ct_base_call_result = ct_base_call(array(
|
1723 |
-
'message' => 'CleanTalk setup comment',
|
1724 |
-
'example' => null,
|
1725 |
-
'sender_email' => 'stop_email@example.com',
|
1726 |
-
'sender_nickname' => 'CleanTalk',
|
1727 |
-
'post_info' => '',
|
1728 |
-
'checkjs' => 1
|
1729 |
-
));
|
1730 |
-
$ct = $ct_base_call_result['ct'];
|
1731 |
-
$ct_result = $ct_base_call_result['ct_result'];
|
1732 |
-
|
1733 |
-
if ($ct_result->inactive == 1) {
|
1734 |
-
setcookie($ct_notice_online_label, 0, strtotime("+5 seconds"), '/');
|
1735 |
-
}else{
|
1736 |
-
setcookie($ct_notice_online_label, 1, strtotime("+5 seconds"), '/');
|
1737 |
-
}
|
1738 |
-
}
|
1739 |
-
|
1740 |
/**
|
1741 |
* Checks WordPress Landing Pages raw $_POST values
|
1742 |
*/
|
@@ -1747,10 +1407,13 @@ function ct_check_wplp(){
|
|
1747 |
$options = ct_get_options();
|
1748 |
if ($options['contact_forms_test'] == 0)
|
1749 |
return;
|
|
|
|
|
1750 |
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
|
|
1754 |
|
1755 |
$post_info['comment_type'] = 'feedback';
|
1756 |
$post_info = json_encode($post_info);
|
@@ -1800,4 +1463,82 @@ function ct_check_wplp(){
|
|
1800 |
ct_die_extended($cleantalk_comment);
|
1801 |
}
|
1802 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1803 |
?>
|
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.44
|
7 |
Author: СleanTalk <welcome@cleantalk.ru>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
|
11 |
+
define('CLEANTALK_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
12 |
+
|
13 |
+
$ct_agent_version = 'wordpress-244';
|
14 |
+
$ct_plugin_name = 'Anti-spam by CleanTalk';
|
15 |
+
$ct_session_name = 'cleantalksession';
|
16 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
17 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
18 |
$ct_session_request_id_label = 'request_id';
|
55 |
// COOKIE label for WP Landing Page proccessing result
|
56 |
$ct_wplp_result_label = 'ct_wplp_result';
|
57 |
|
58 |
+
// Flag indicates active JetPack comments
|
59 |
+
$ct_jp_comments = false;
|
60 |
+
|
61 |
+
// S2member post data label
|
62 |
+
$ct_post_data_label = 's2member_pro_paypal_registration';
|
63 |
+
|
64 |
+
// Form time load label
|
65 |
+
$ct_formtime_label = 'formtime';
|
66 |
+
|
67 |
+
// Characters list for random password generation
|
68 |
+
$ct_password_list = '0123456789';
|
69 |
+
|
70 |
+
// Random password length
|
71 |
+
$ct_password_length = 3;
|
72 |
+
|
73 |
+
// Name of the array with random passwords
|
74 |
+
$ct_post_id_label = 'ct_post_id';
|
75 |
+
|
76 |
// Init action.
|
77 |
add_action('init', 'ct_init', 1);
|
78 |
|
81 |
|
82 |
// Comments
|
83 |
add_filter('preprocess_comment', 'ct_preprocess_comment'); // param - comment data array
|
84 |
+
add_filter('comment_text', 'ct_comment_text' );
|
85 |
|
86 |
// Formidable
|
87 |
add_action('frm_validate_entry', 'ct_frm_validate_entry', 20, 2);
|
112 |
add_filter('login_message', 'ct_login_message');
|
113 |
|
114 |
if (is_admin()) {
|
115 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-admin.php');
|
116 |
+
|
117 |
add_action('admin_init', 'ct_admin_init', 1);
|
118 |
add_action('admin_menu', 'ct_admin_add_page');
|
119 |
add_action('admin_enqueue_scripts', 'ct_enqueue_scripts');
|
128 |
add_filter('plugin_row_meta', 'ct_register_plugin_links', 10, 2);
|
129 |
add_filter('plugin_action_links', 'ct_plugin_action_links', 10, 2);
|
130 |
add_action('updated_option', 'ct_update_option'); // param - option name, i.e. 'cleantalk_settings'
|
131 |
+
} else {
|
132 |
+
require_once(CLEANTALK_PLUGIN_DIR . 'cleantalk-utils.php');
|
133 |
+
wp_enqueue_script('ct_utills', plugins_url('/cleantalk-utils.js', __FILE__));
|
134 |
}
|
135 |
|
136 |
/**
|
138 |
* @return mixed[] Array of options
|
139 |
*/
|
140 |
function ct_init() {
|
141 |
+
global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label;
|
142 |
+
|
143 |
+
ct_init_session();
|
144 |
|
145 |
add_action('comment_form', 'ct_comment_form');
|
146 |
|
148 |
if (
|
149 |
(class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)) ||
|
150 |
(defined('LANDINGPAGES_CURRENT_VERSION'))
|
151 |
+
|| (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION'))
|
152 |
) {
|
153 |
+
add_action('wp_footer', 'ct_footer_add_cookie');
|
154 |
+
}
|
155 |
+
if (
|
156 |
+
(class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules))
|
157 |
+
) {
|
158 |
+
$ct_jp_comments = true;
|
159 |
}
|
160 |
|
161 |
//intercept WordPress Landing Pages POST
|
166 |
ct_check_wplp();
|
167 |
}
|
168 |
}
|
169 |
+
|
170 |
+
// intercept S2member POST
|
171 |
+
if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION') && isset($_POST[$ct_post_data_label]['email'])){
|
172 |
+
ct_s2member_registration_test();
|
173 |
+
}
|
174 |
}
|
175 |
|
176 |
/**
|
254 |
}
|
255 |
|
256 |
$ct_feedback = $hash . ':' . $allow . ';';
|
|
|
257 |
if (empty($_SESSION['feedback_request'])) {
|
258 |
$_SESSION['feedback_request'] = $ct_feedback;
|
259 |
} else {
|
270 |
*/
|
271 |
function ct_send_feedback($feedback_request = null) {
|
272 |
|
|
|
273 |
if (empty($feedback_request) && isset($_SESSION['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $_SESSION['feedback_request'])) {
|
274 |
$feedback_request = $_SESSION['feedback_request'];
|
275 |
unset($_SESSION['feedback_request']);
|
313 |
* @return null;
|
314 |
*/
|
315 |
function ct_init_session() {
|
316 |
+
global $ct_session_name;
|
317 |
+
|
318 |
+
if(session_id() === '') {
|
319 |
+
session_name($ct_session_name);
|
320 |
@session_start();
|
321 |
}
|
322 |
|
339 |
global $wpdb, $ct_agent_version;
|
340 |
|
341 |
require_once('cleantalk.class.php');
|
342 |
+
|
343 |
+
$submit_time = submit_time_test();
|
|
|
|
|
|
|
|
|
|
|
344 |
|
345 |
$sender_info = array(
|
346 |
'cms_lang' => substr(get_locale(), 0, 2),
|
394 |
/**
|
395 |
* Adds hidden filed to comment form
|
396 |
*/
|
397 |
+
function ct_comment_form($post_id) {
|
398 |
+
global $ct_jp_comments;
|
399 |
+
|
400 |
if (ct_is_user_enable() === false) {
|
401 |
return false;
|
402 |
}
|
405 |
if ($options['comments_test'] == 0) {
|
406 |
return false;
|
407 |
}
|
408 |
+
|
409 |
+
ct_add_hidden_fields(null, 'ct_checkjs', false, false);
|
410 |
+
|
411 |
return null;
|
412 |
}
|
413 |
|
423 |
if ($options['comments_test'] == 0) {
|
424 |
return false;
|
425 |
}
|
426 |
+
ct_add_hidden_fields(null, 'ct_checkjs', false, true);
|
|
|
427 |
|
428 |
return null;
|
429 |
}
|
432 |
* Adds hidden filed to define avaialbility of client's JavaScript
|
433 |
* @param int $post_id Post ID, not used
|
434 |
*/
|
435 |
+
function ct_add_hidden_fields($post_id = null, $field_name = 'ct_checkjs', $return_string = false, $cookie_check = false) {
|
436 |
+
global $ct_checkjs_def, $ct_formtime_label, $ct_password_list, $ct_password_length, $ct_post_id_label, $ct_plugin_name;
|
437 |
+
|
438 |
+
$_SESSION[$ct_formtime_label] = time();
|
|
|
|
|
|
|
439 |
|
440 |
if ($cookie_check) {
|
441 |
+
$ct_checkjs_key = ct_get_checkjs_value();
|
442 |
+
$html = '
|
443 |
<script type="text/javascript">
|
444 |
// <![CDATA[
|
445 |
function ctSetCookie(c_name, value) {
|
451 |
';
|
452 |
$html = sprintf($html, $field_name, $ct_checkjs_key);
|
453 |
} else {
|
454 |
+
$post_id = md5(time() . '_' . rand(0, 1000));
|
455 |
+
$field_id = $field_name . '_' . $post_id;
|
456 |
+
|
457 |
+
$password = ct_random_password($ct_password_length, $ct_password_list) . $post_id;
|
458 |
+
|
459 |
+
$ct_checkjs_key = ct_get_checkjs_value($password);
|
460 |
+
|
461 |
+
$html = '
|
462 |
<input type="hidden" id="%s" name="%s" value="%s" />
|
463 |
+
<input type="hidden" name="ct_post_id" value="%s" />
|
464 |
<script type="text/javascript">
|
465 |
// <![CDATA[
|
466 |
+
var ct_input_name = \'%s\';
|
467 |
+
var ct_input_value = document.getElementById(ct_input_name).value;
|
468 |
+
var ct_password_length = %d;
|
469 |
+
var ct_password_list = \'%s\';
|
470 |
+
var ct_post_id = \'%s\';
|
471 |
+
|
472 |
+
window.setTimeout(ct_find_password(), 500);
|
473 |
+
|
474 |
+
function ct_find_password(){
|
475 |
+
var ct_password = "";
|
476 |
+
var ct_password_encrypted = "";
|
477 |
+
var ct_password_mixed = "";
|
478 |
+
while (ct_password_encrypted != ct_input_value) {
|
479 |
+
ct_password = ct_random_password(ct_password_length, ct_password_list);
|
480 |
+
ct_password_mixed = ct_password + ct_post_id;
|
481 |
+
ct_password_encrypted = md5(ct_password_mixed);
|
482 |
+
}
|
483 |
+
document.getElementById(ct_input_name).value = ct_password_mixed;
|
484 |
+
|
485 |
+
return null;
|
486 |
+
};
|
487 |
// ]]>
|
488 |
</script>
|
489 |
';
|
490 |
+
$html = sprintf($html, $field_id, $field_name, $ct_checkjs_key, $post_id, $field_id, $ct_password_length, $ct_password_list, $post_id);
|
491 |
+
|
492 |
+
$_SESSION[$ct_post_id_label][$post_id] = $password;
|
493 |
+
};
|
494 |
+
|
495 |
+
$html .= '<noscript><p><b>Please enable JavaScript and Cookies to pass anti-spam protection!</b><br />Here are the instructions how to enable JavaScript in your web browser <a href="http://www.enable-javascript.com" rel="nofollow" target="_blank">http://www.enable-javascript.com</a>.<br />' . $ct_plugin_name . '.</p></noscript>';
|
496 |
+
|
497 |
if ($return_string === true) {
|
498 |
return $html;
|
499 |
} else {
|
526 |
* return null;
|
527 |
*/
|
528 |
function ct_frm_entries_footer_scripts($fields, $form) {
|
529 |
+
global $current_user, $ct_checkjs_frm, $ct_formtime_label;
|
530 |
|
531 |
$options = ct_get_options();
|
532 |
if ($options['contact_forms_test'] == 0) {
|
533 |
return false;
|
534 |
}
|
535 |
+
|
536 |
+
$_SESSION[$ct_formtime_label] = time();
|
537 |
|
538 |
$ct_checkjs_key = ct_get_checkjs_value();
|
539 |
$ct_frm_name = 'form_' . $form->form_key;
|
560 |
if ($options['contact_forms_test'] == 0) {
|
561 |
return false;
|
562 |
}
|
563 |
+
|
564 |
+
ct_check_cookies();
|
565 |
|
566 |
+
$checkjs = js_test($ct_checkjs_frm, $_POST);
|
567 |
|
568 |
$post_info['comment_type'] = 'feedback';
|
569 |
$post_info = json_encode($post_info);
|
607 |
// this action is called just when WP process POST request (adds new comment)
|
608 |
// this action is called by wp-comments-post.php
|
609 |
// after processing WP makes redirect to post page with comment's form by GET request (see above)
|
610 |
+
global $wpdb, $current_user, $comment_post_id, $ct_agent_version, $ct_comment_done, $ct_approved_request_id_label, $ct_jp_comments;
|
611 |
+
|
612 |
$options = ct_get_options();
|
613 |
if (ct_is_user_enable() === false || $options['comments_test'] == 0 || $ct_comment_done) {
|
614 |
return $comment;
|
647 |
|
648 |
$post = get_post($comment_post_id);
|
649 |
|
650 |
+
ct_check_cookies();
|
651 |
+
$checkjs = js_test('ct_checkjs', $_POST);
|
652 |
|
653 |
$example = null;
|
654 |
|
763 |
}
|
764 |
|
765 |
/**
|
766 |
+
* Validates JavaScript anti-spam test
|
767 |
*
|
768 |
*/
|
769 |
+
function js_test($field_name = 'ct_checkjs', $data = null) {
|
770 |
+
global $ct_post_id_label;
|
|
|
771 |
|
772 |
+
$checkjs = null;
|
773 |
+
$js_post_value = null;
|
774 |
+
|
775 |
+
if (!$data)
|
776 |
+
return $checkjs;
|
777 |
+
|
778 |
+
if (isset($data[$field_name])) {
|
779 |
+
$checkjs = 0;
|
780 |
+
|
781 |
+
$js_post_value = $data[$field_name];
|
782 |
+
|
783 |
+
if (isset($data[$ct_post_id_label])) {
|
784 |
+
// Cryptograhic test
|
785 |
+
if (isset($_SESSION[$ct_post_id_label][$data[$ct_post_id_label]])) {
|
786 |
+
$ct_challenge = $_SESSION[$ct_post_id_label][$data[$ct_post_id_label]];
|
787 |
+
}
|
788 |
+
if($ct_challenge == $js_post_value) {
|
789 |
+
$checkjs = 1;
|
790 |
+
}
|
791 |
} else {
|
792 |
+
$ct_challenge = ct_get_checkjs_value();
|
793 |
+
if(preg_match("/$ct_challenge/", $js_post_value)) {
|
794 |
+
$checkjs = 1;
|
795 |
+
}
|
796 |
}
|
797 |
}
|
798 |
|
800 |
}
|
801 |
|
802 |
/**
|
803 |
+
* Validate form submit time
|
804 |
*
|
805 |
*/
|
806 |
+
function submit_time_test() {
|
807 |
+
global $ct_formtime_label;
|
|
|
|
|
|
|
|
|
808 |
|
809 |
+
$submit_time = null;
|
810 |
+
if (isset($_SESSION[$ct_formtime_label])) {
|
811 |
+
$submit_time = time() - (int) $_SESSION[$ct_formtime_label];
|
|
|
|
|
|
|
812 |
}
|
813 |
|
814 |
+
return $submit_time;
|
815 |
}
|
816 |
|
817 |
/**
|
826 |
return null;
|
827 |
|
828 |
if ($comment_id === null) {
|
829 |
+
$last_comment = get_comments('number=1');
|
830 |
+
$comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
|
831 |
}
|
832 |
$permalink = get_permalink($comment_post_id);
|
833 |
|
886 |
return true;
|
887 |
}
|
888 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
889 |
/**
|
890 |
* Mark bad words
|
891 |
* @global string $ct_stop_words
|
917 |
return $message;
|
918 |
}
|
919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
920 |
/**
|
921 |
* Tests plugin activation status
|
922 |
* @return bool
|
947 |
* Get ct_get_checkjs_value
|
948 |
* @return string
|
949 |
*/
|
950 |
+
function ct_get_checkjs_value($salt = null) {
|
951 |
+
if (!$salt) {
|
952 |
+
$options = ct_get_options();
|
953 |
+
$salt = $options['apikey'] . '+' . get_option('admin_email');
|
954 |
+
}
|
955 |
+
|
956 |
+
return md5($salt);
|
957 |
}
|
958 |
|
959 |
/**
|
989 |
return false;
|
990 |
}
|
991 |
|
992 |
+
ct_add_hidden_fields(null, $ct_checkjs_register_form, false);
|
993 |
|
994 |
return null;
|
995 |
}
|
1004 |
$options = ct_get_options();
|
1005 |
if ($options['registrations_test'] != 0) {
|
1006 |
if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) {
|
|
|
1007 |
if (isset($_SESSION[$ct_session_register_ok_label])) {
|
1008 |
unset($_SESSION[$ct_session_register_ok_label]);
|
1009 |
if(is_wp_error($errors))
|
1034 |
$buddypress = true;
|
1035 |
}
|
1036 |
|
1037 |
+
$submit_time = submit_time_test();
|
|
|
|
|
|
|
|
|
|
|
1038 |
|
1039 |
$options = ct_get_options();
|
1040 |
if ($options['registrations_test'] == 0) {
|
1041 |
return $errors;
|
1042 |
}
|
1043 |
|
1044 |
+
$checkjs = js_test($ct_checkjs_register_form, $_POST);
|
1045 |
|
1046 |
require_once('cleantalk.class.php');
|
1047 |
|
1113 |
}
|
1114 |
} else {
|
1115 |
if ($ct_result->id !== null) {
|
|
|
1116 |
$_SESSION[$ct_session_request_id_label] = $ct_result->id;
|
1117 |
$_SESSION[$ct_session_register_ok_label] = $ct_result->id;
|
1118 |
}
|
1128 |
function ct_user_register($user_id) {
|
1129 |
global $ct_session_request_id_label;
|
1130 |
|
|
|
1131 |
if (isset($_SESSION[$ct_session_request_id_label])) {
|
1132 |
update_user_meta($user_id, 'ct_hash', $_SESSION[$ct_session_request_id_label]);
|
1133 |
unset($_SESSION[$ct_session_request_id_label]);
|
1134 |
}
|
1135 |
}
|
1136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1137 |
|
1138 |
/**
|
1139 |
* Test for JetPack contact form
|
1153 |
}
|
1154 |
}
|
1155 |
|
1156 |
+
$r .= ct_add_hidden_fields(null, $ct_checkjs_jpcf, true);
|
1157 |
$ct_jpcf_patched = true;
|
1158 |
}
|
1159 |
|
1164 |
*/
|
1165 |
function ct_contact_form_is_spam($form) {
|
1166 |
global $ct_checkjs_jpcf;
|
1167 |
+
|
1168 |
+
ct_check_cookies();
|
1169 |
|
1170 |
$options = ct_get_options();
|
1171 |
|
1178 |
if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
|
1179 |
$js_field_name = $k;
|
1180 |
}
|
1181 |
+
|
1182 |
+
$checkjs = js_test($js_field_name, $_COOKIE);
|
1183 |
|
1184 |
$sender_info = array(
|
1185 |
'sender_url' => @$form['comment_author_url']
|
1237 |
return $html;
|
1238 |
}
|
1239 |
|
1240 |
+
$html .= ct_add_hidden_fields(null, $ct_checkjs_cf7, true);
|
1241 |
|
1242 |
return $html;
|
1243 |
}
|
1256 |
return $spam;
|
1257 |
}
|
1258 |
|
1259 |
+
ct_check_cookies();
|
1260 |
+
|
1261 |
+
$checkjs = js_test($ct_checkjs_cf7, $_POST);
|
1262 |
|
1263 |
$post_info['comment_type'] = 'feedback';
|
1264 |
$post_info = json_encode($post_info);
|
1317 |
* Inserts anti-spam hidden to Fast Secure contact form
|
1318 |
*/
|
1319 |
function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
|
1320 |
+
$string .= ct_add_hidden_fields(null, 'ct_checkjs', true);
|
1321 |
return $string;
|
1322 |
}
|
1323 |
|
1332 |
if ($options['contact_forms_test'] == 0)
|
1333 |
return $form_errors;
|
1334 |
|
1335 |
+
ct_check_cookies();
|
1336 |
+
$checkjs = js_test('ct_checkjs', $_POST);
|
1337 |
|
1338 |
$post_info['comment_type'] = 'feedback';
|
1339 |
$post_info = json_encode($post_info);
|
1378 |
return $form_errors;
|
1379 |
}
|
1380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1381 |
/**
|
1382 |
* Notice for commentators which comment has automatically approved by plugin
|
1383 |
* @param string $hook URL of hooked page
|
1384 |
*/
|
1385 |
function ct_comment_text($comment_text) {
|
1386 |
+
global $comment, $ct_approved_request_id_label, $ct_plugin_name;
|
1387 |
|
1388 |
if (isset($_COOKIE[$ct_approved_request_id_label])) {
|
1389 |
$ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
|
1390 |
|
1391 |
if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
|
1392 |
+
$comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __("Comment is approved. $ct_plugin_name.", 'cleantalk') . '</em>';
|
1393 |
}
|
1394 |
}
|
1395 |
|
1397 |
}
|
1398 |
|
1399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1400 |
/**
|
1401 |
* Checks WordPress Landing Pages raw $_POST values
|
1402 |
*/
|
1407 |
$options = ct_get_options();
|
1408 |
if ($options['contact_forms_test'] == 0)
|
1409 |
return;
|
1410 |
+
|
1411 |
+
ct_check_cookies();
|
1412 |
|
1413 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE);
|
1414 |
+
|
1415 |
+
if (null === $checkjs)
|
1416 |
+
$checkjs = 0;
|
1417 |
|
1418 |
$post_info['comment_type'] = 'feedback';
|
1419 |
$post_info = json_encode($post_info);
|
1463 |
ct_die_extended($cleantalk_comment);
|
1464 |
}
|
1465 |
|
1466 |
+
/**
|
1467 |
+
* Test S2member registration
|
1468 |
+
* @return array with errors
|
1469 |
+
*/
|
1470 |
+
function ct_s2member_registration_test() {
|
1471 |
+
global $ct_agent_version, $ct_post_data_label;
|
1472 |
+
|
1473 |
+
$options = ct_get_options();
|
1474 |
+
if ($options['registrations_test'] == 0) {
|
1475 |
+
return null;
|
1476 |
+
}
|
1477 |
+
|
1478 |
+
$submit_time = submit_time_test();
|
1479 |
+
|
1480 |
+
ct_check_cookies();
|
1481 |
+
|
1482 |
+
$checkjs = js_test('ct_checkjs', $_COOKIE);
|
1483 |
+
|
1484 |
+
require_once('cleantalk.class.php');
|
1485 |
+
|
1486 |
+
$blog_lang = substr(get_locale(), 0, 2);
|
1487 |
+
$user_info = array(
|
1488 |
+
'cms_lang' => $blog_lang,
|
1489 |
+
'REFFERRER' => @$_SERVER['HTTP_REFERER'],
|
1490 |
+
'USER_AGENT' => @$_SERVER['HTTP_USER_AGENT'],
|
1491 |
+
);
|
1492 |
+
$user_info = json_encode($user_info);
|
1493 |
+
if ($user_info === false)
|
1494 |
+
$user_info = '';
|
1495 |
+
|
1496 |
+
$sender_email = null;
|
1497 |
+
if (isset($_POST[$ct_post_data_label]['email']))
|
1498 |
+
$sender_email = $_POST[$ct_post_data_label]['email'];
|
1499 |
+
|
1500 |
+
$sender_nickname = null;
|
1501 |
+
if (isset($_POST[$ct_post_data_label]['username']))
|
1502 |
+
$sender_nickname = $_POST[$ct_post_data_label]['username'];
|
1503 |
+
|
1504 |
+
$config = get_option('cleantalk_server');
|
1505 |
+
|
1506 |
+
$ct = new Cleantalk();
|
1507 |
+
$ct->work_url = $config['ct_work_url'];
|
1508 |
+
$ct->server_url = $options['server'];
|
1509 |
+
$ct->server_ttl = $config['ct_server_ttl'];
|
1510 |
+
$ct->server_changed = $config['ct_server_changed'];
|
1511 |
+
|
1512 |
+
$ct_request = new CleantalkRequest();
|
1513 |
+
|
1514 |
+
$ct_request->auth_key = $options['apikey'];
|
1515 |
+
$ct_request->sender_email = $sender_email;
|
1516 |
+
$ct_request->sender_ip = $ct->ct_session_ip($_SERVER['REMOTE_ADDR']);
|
1517 |
+
$ct_request->sender_nickname = $sender_nickname;
|
1518 |
+
$ct_request->agent = $ct_agent_version;
|
1519 |
+
$ct_request->sender_info = $user_info;
|
1520 |
+
$ct_request->js_on = $checkjs;
|
1521 |
+
$ct_request->submit_time = $submit_time;
|
1522 |
+
|
1523 |
+
$ct_result = $ct->isAllowUser($ct_request);
|
1524 |
+
if ($ct->server_change) {
|
1525 |
+
update_option(
|
1526 |
+
'cleantalk_server', array(
|
1527 |
+
'ct_work_url' => $ct->work_url,
|
1528 |
+
'ct_server_ttl' => $ct->server_ttl,
|
1529 |
+
'ct_server_changed' => time()
|
1530 |
+
)
|
1531 |
+
);
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
if ($ct_result->errno != 0) {
|
1535 |
+
return false;
|
1536 |
+
}
|
1537 |
+
if ($ct_result->allow == 0) {
|
1538 |
+
ct_die_extended($ct_result->comment);
|
1539 |
+
}
|
1540 |
+
|
1541 |
+
return true;
|
1542 |
+
}
|
1543 |
+
|
1544 |
?>
|
i18n/cleantalk-ru_RU.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -35,7 +35,7 @@ We have developed anti-spam for WordPress that would provide **maximum protectio
|
|
35 |
|
36 |
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.
|
37 |
|
38 |
-
The CleanTalk is premium anti-spam for WordPress, please look at the <a href="http://cleantalk.org/price">pricing</a>. We try to provide the service at the highest level and we can not afford to offer a free version of our service, as this will immediately affect the quality of providing anti spam protection. Paying for a year of service, you save a lot more and get:
|
39 |
|
40 |
* Up to 100% protection from spam bots.
|
41 |
* Simple and convenient form of commenting/registrations without captcha.
|
@@ -70,7 +70,6 @@ Plugin uses several simple tests to stop spammers.
|
|
70 |
* JavaScript antispam test.
|
71 |
* Checks by Email, IP, web-sites domain at <a href="http://cleantalk.org/blacklists" target="_blank">spam activities list</a>.
|
72 |
* Comment submit time. Spam bots usually send post immediately after page load.
|
73 |
-
* Relevance test for the comment. Spam bots send offtop posts, so the plugin can filter spam bots by oftop.
|
74 |
|
75 |
= How plugin works with spam comments? =
|
76 |
Spam comments moves to SPAM folder. First comment from a new author plugin compares with post and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
|
35 |
|
36 |
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.
|
37 |
|
38 |
+
The CleanTalk is premium anti-spam for WordPress, please look at the <a href="http://cleantalk.org/price">pricing</a>. We try to provide the service at the highest level and we can not afford to offer a free version of our service, as this will immediately affect the quality of providing anti spam protection. Paying for a year of service, you save a lot more and get:
|
39 |
|
40 |
* Up to 100% protection from spam bots.
|
41 |
* Simple and convenient form of commenting/registrations without captcha.
|
70 |
* JavaScript antispam test.
|
71 |
* Checks by Email, IP, web-sites domain at <a href="http://cleantalk.org/blacklists" target="_blank">spam activities list</a>.
|
72 |
* Comment submit time. Spam bots usually send post immediately after page load.
|
|
|
73 |
|
74 |
= How plugin works with spam comments? =
|
75 |
Spam comments moves to SPAM folder. First comment from a new author plugin compares with post and previous comments. If the relevance of the comment is good enough it gets approval at the blog without manual approval.
|