Version Description
August 10 2018 = * Fix: Set cookie only for non-dashboard pages. * Fix: Dashboard widget JS error. * Fix: JavaScript error for some environment. * Mod: Antispam protection accelerated for some pages.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.101 |
Comparing to | |
See all releases |
Code changes from version 5.100 to 5.101
- cleantalk.php +40 -22
- inc/cleantalk-admin.php +21 -16
- inc/cleantalk-public.php +3 -1
- js/cleantalk-dashboard-widget.js +7 -5
- lib/CleantalkHelper.php +1 -1
- readme.txt +13 -1
cleantalk.php
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
Plugin Name: Anti-Spam 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.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
|
11 |
$cleantalk_executed = false;
|
12 |
|
13 |
-
define('APBCT_VERSION', '5.
|
14 |
-
define('APBCT_AGENT', 'wordpress-
|
15 |
|
16 |
define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
|
17 |
define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt')
|
@@ -58,8 +58,10 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
58 |
//Delete cookie for admin trial notice
|
59 |
add_action('wp_logout', 'ct_wp_logout');
|
60 |
|
61 |
-
|
|
|
62 |
add_action('template_redirect','apbct_cookie', 2);
|
|
|
63 |
|
64 |
// Early checks
|
65 |
// Facebook
|
@@ -283,14 +285,19 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
283 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
284 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
285 |
|
286 |
-
//
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
(!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
|
291 |
){
|
292 |
ct_ajax_hook();
|
293 |
}
|
|
|
|
|
|
|
|
|
|
|
294 |
//
|
295 |
// Some of plugins to register a users use AJAX context.
|
296 |
//
|
@@ -298,9 +305,6 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
298 |
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
299 |
add_action('user_register', 'ct_user_register');
|
300 |
|
301 |
-
//QAEngine Theme answers
|
302 |
-
if (intval($ct_options['general_contact_forms_test']))
|
303 |
-
add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1);
|
304 |
}
|
305 |
|
306 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
@@ -714,6 +718,22 @@ function apbct_cookies_test()
|
|
714 |
}
|
715 |
}
|
716 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
/**
|
718 |
* Gets submit time
|
719 |
* Uses Cookies with check via apbct_cookies_test()
|
@@ -724,15 +744,13 @@ function apbct_get_submit_time()
|
|
724 |
return apbct_cookies_test() == 1 ? time() - $_COOKIE['apbct_timestamp'] : null;
|
725 |
}
|
726 |
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
|
|
731 |
}
|
732 |
-
|
733 |
-
function myplugin_init() {
|
734 |
-
add_filter( 'pre_update_option_cleantalk_data', 'myplugin_update_field', 10, 2 );
|
735 |
}
|
736 |
-
|
737 |
-
|
738 |
-
*/
|
3 |
Plugin Name: Anti-Spam 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.
|
6 |
+
Version: 5.101
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
|
11 |
$cleantalk_executed = false;
|
12 |
|
13 |
+
define('APBCT_VERSION', '5.101');
|
14 |
+
define('APBCT_AGENT', 'wordpress-5101');
|
15 |
|
16 |
define('CLEANTALK_REMOTE_CALL_SLEEP', 10); // Minimum time between remote call
|
17 |
define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt')
|
58 |
//Delete cookie for admin trial notice
|
59 |
add_action('wp_logout', 'ct_wp_logout');
|
60 |
|
61 |
+
// Set cookie only for unauthorized users and for non-AJAX requests
|
62 |
+
if (!is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX))){
|
63 |
add_action('template_redirect','apbct_cookie', 2);
|
64 |
+
}
|
65 |
|
66 |
// Early checks
|
67 |
// Facebook
|
285 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
286 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
|
287 |
|
288 |
+
// Check AJAX requests
|
289 |
+
// if User is not logged in
|
290 |
+
// if Unknown action or Known action with mandatory check
|
291 |
+
if( defined('LOGGED_IN_COOKIE') && !isset($_COOKIE[LOGGED_IN_COOKIE]) &&
|
292 |
+
isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
|
293 |
){
|
294 |
ct_ajax_hook();
|
295 |
}
|
296 |
+
|
297 |
+
//QAEngine Theme answers
|
298 |
+
if (intval($ct_options['general_contact_forms_test']))
|
299 |
+
add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1);
|
300 |
+
|
301 |
//
|
302 |
// Some of plugins to register a users use AJAX context.
|
303 |
//
|
305 |
add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
|
306 |
add_action('user_register', 'ct_user_register');
|
307 |
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
718 |
}
|
719 |
}
|
720 |
|
721 |
+
function apbct_cookies__delete($cookie){
|
722 |
+
if(isset($_COOKIE[$cookie]))
|
723 |
+
setcookie($cookie, '', time()-3600);
|
724 |
+
}
|
725 |
+
|
726 |
+
function apbct_cookies__delete_all(){
|
727 |
+
if(count($_COOKIE)){
|
728 |
+
foreach($_COOKIE as $key => $val){
|
729 |
+
if(preg_match("/apbct_|ct_/", $key)){
|
730 |
+
setcookie($key, '', time()-3600);
|
731 |
+
}
|
732 |
+
} unset($key, $val);
|
733 |
+
}
|
734 |
+
return false;
|
735 |
+
}
|
736 |
+
|
737 |
/**
|
738 |
* Gets submit time
|
739 |
* Uses Cookies with check via apbct_cookies_test()
|
744 |
return apbct_cookies_test() == 1 ? time() - $_COOKIE['apbct_timestamp'] : null;
|
745 |
}
|
746 |
|
747 |
+
function apbct_is_user_logged_in(){
|
748 |
+
if(count($_COOKIE)){
|
749 |
+
foreach($_COOKIE as $key => $val){
|
750 |
+
if(preg_match("/wordpress_logged_in/", $key)){
|
751 |
+
return true;
|
752 |
}
|
753 |
+
} unset($key, $val);
|
|
|
|
|
754 |
}
|
755 |
+
return false;
|
756 |
+
}
|
|
inc/cleantalk-admin.php
CHANGED
@@ -37,18 +37,6 @@ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
|
|
37 |
|
38 |
$brief_data = $ct_data['brief_data'];
|
39 |
|
40 |
-
if(!empty($_POST['ct_brief_refresh']) or empty($brief_data['spam_stat'])){
|
41 |
-
$brief_data = CleantalkHelper::api_method__get_antispam_report_breif($ct_options['apikey']);
|
42 |
-
$ct_data['brief_data'] = $brief_data;
|
43 |
-
update_option('cleantalk_data', $ct_data);
|
44 |
-
}
|
45 |
-
// Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
|
46 |
-
$to_chart = array();
|
47 |
-
foreach( $brief_data['spam_stat'] as $key => $value ){
|
48 |
-
$to_chart[] = array( $key, $value );
|
49 |
-
} unset( $key, $value );
|
50 |
-
$to_chart = json_encode( $to_chart );
|
51 |
-
|
52 |
echo "<div id='ct_widget_wrapper'>";
|
53 |
?>
|
54 |
<form id='ct_refresh_form' method='POST' action='#ct_widget'>
|
@@ -56,9 +44,6 @@ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
|
|
56 |
</form>
|
57 |
<h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk'); ?></h4>
|
58 |
<div class='ct_widget_block ct_widget_chart_wrapper'>
|
59 |
-
<script>
|
60 |
-
var ct_chart_data = <?php echo $to_chart; ?>;
|
61 |
-
</script>
|
62 |
<div id='ct_widget_chart'></div>
|
63 |
</div>
|
64 |
<h4 class='ct_widget_block_header'><?php _e('Top 5 spam IPs blocked', 'cleantalk'); ?></h4>
|
@@ -187,9 +172,23 @@ function apbct_enqueue_scripts($hook) {
|
|
187 |
|
188 |
// Scripts & Styles to main dashboard page
|
189 |
if($hook == 'index.php' && current_user_can('activate_plugins')){
|
|
|
|
|
|
|
190 |
wp_enqueue_script('ct_gstatic_charts_loader', 'https://www.gstatic.com/charts/loader.js', array(), APBCT_VERSION);
|
191 |
wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.js'), array('ct_gstatic_charts_loader'), APBCT_VERSION);
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
|
195 |
// Scripts & Styles for CleanTalk's settings page
|
@@ -470,6 +469,12 @@ function apbct_admin_init(){
|
|
470 |
ct_account_status_check();
|
471 |
}
|
472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
|
474 |
$show_ct_notice_online = '';
|
475 |
if (isset($_COOKIE[$ct_notice_online_label]))
|
37 |
|
38 |
$brief_data = $ct_data['brief_data'];
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
echo "<div id='ct_widget_wrapper'>";
|
41 |
?>
|
42 |
<form id='ct_refresh_form' method='POST' action='#ct_widget'>
|
44 |
</form>
|
45 |
<h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk'); ?></h4>
|
46 |
<div class='ct_widget_block ct_widget_chart_wrapper'>
|
|
|
|
|
|
|
47 |
<div id='ct_widget_chart'></div>
|
48 |
</div>
|
49 |
<h4 class='ct_widget_block_header'><?php _e('Top 5 spam IPs blocked', 'cleantalk'); ?></h4>
|
172 |
|
173 |
// Scripts & Styles to main dashboard page
|
174 |
if($hook == 'index.php' && current_user_can('activate_plugins')){
|
175 |
+
|
176 |
+
wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.css'), array(), APBCT_VERSION, 'all');
|
177 |
+
|
178 |
wp_enqueue_script('ct_gstatic_charts_loader', 'https://www.gstatic.com/charts/loader.js', array(), APBCT_VERSION);
|
179 |
wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.js'), array('ct_gstatic_charts_loader'), APBCT_VERSION);
|
180 |
+
|
181 |
+
// Preparing widget data
|
182 |
+
// Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
|
183 |
+
$to_chart = array();
|
184 |
+
foreach( $ct_data['brief_data']['spam_stat'] as $key => $value ){
|
185 |
+
$to_chart[] = array( $key, $value );
|
186 |
+
} unset( $key, $value );
|
187 |
+
|
188 |
+
wp_localize_script( 'jquery', 'apbctDashboardWidget', array(
|
189 |
+
'data' => $to_chart,
|
190 |
+
));
|
191 |
+
|
192 |
}
|
193 |
|
194 |
// Scripts & Styles for CleanTalk's settings page
|
469 |
ct_account_status_check();
|
470 |
}
|
471 |
|
472 |
+
// Getting dashboard widget statistics
|
473 |
+
if(!empty($_POST['ct_brief_refresh']) || empty($ct_data['brief_data'])){
|
474 |
+
$brief_data = CleantalkHelper::api_method__get_antispam_report_breif($ct_options['apikey']);
|
475 |
+
$ct_data['brief_data'] = $brief_data;
|
476 |
+
update_option('cleantalk_data', $ct_data);
|
477 |
+
}
|
478 |
|
479 |
$show_ct_notice_online = '';
|
480 |
if (isset($_COOKIE[$ct_notice_online_label]))
|
inc/cleantalk-public.php
CHANGED
@@ -651,8 +651,10 @@ function ct_frm_entries_footer_scripts($fields, $form) {
|
|
651 |
input.setAttribute('name', '$ct_checkjs_frm');
|
652 |
input.setAttribute('value', '$ct_checkjs_key');
|
653 |
for (i = 0; i < document.forms.length; i++) {
|
654 |
-
if (document.forms[i].id
|
|
|
655 |
document.forms[i].appendChild(input);
|
|
|
656 |
}
|
657 |
}";
|
658 |
|
651 |
input.setAttribute('name', '$ct_checkjs_frm');
|
652 |
input.setAttribute('value', '$ct_checkjs_key');
|
653 |
for (i = 0; i < document.forms.length; i++) {
|
654 |
+
if (document.forms[i].id){
|
655 |
+
if(document.forms[i].id.search('$ct_frm_name') != -1) {
|
656 |
document.forms[i].appendChild(input);
|
657 |
+
}
|
658 |
}
|
659 |
}";
|
660 |
|
js/cleantalk-dashboard-widget.js
CHANGED
@@ -14,7 +14,7 @@ jQuery(document).ready(function(){
|
|
14 |
jQuery("#ct_widget_wrapper").parent().css('padding', 0);
|
15 |
|
16 |
// Chart
|
17 |
-
var ct_chart =
|
18 |
locale = navigator.language || navigator.userLanguage;
|
19 |
|
20 |
function ctParseData(date){
|
@@ -36,8 +36,8 @@ jQuery(document).ready(function(){
|
|
36 |
data.addColumn('string', 'Spam Blocked');
|
37 |
data.addColumn('number', 'Frequency');
|
38 |
|
39 |
-
ctParseData(
|
40 |
-
data.addRows(
|
41 |
|
42 |
var options = {
|
43 |
width: jQuery(".ct_widget_block").first().width(),
|
@@ -49,7 +49,9 @@ jQuery(document).ready(function(){
|
|
49 |
vAxis: { gridlines: { count: 5 } }
|
50 |
};
|
51 |
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
};
|
55 |
});
|
14 |
jQuery("#ct_widget_wrapper").parent().css('padding', 0);
|
15 |
|
16 |
// Chart
|
17 |
+
var ct_chart = document.getElementById('ct_widget_chart'),
|
18 |
locale = navigator.language || navigator.userLanguage;
|
19 |
|
20 |
function ctParseData(date){
|
36 |
data.addColumn('string', 'Spam Blocked');
|
37 |
data.addColumn('number', 'Frequency');
|
38 |
|
39 |
+
ctParseData(apbctDashboardWidget.data);
|
40 |
+
data.addRows(apbctDashboardWidget.data);
|
41 |
|
42 |
var options = {
|
43 |
width: jQuery(".ct_widget_block").first().width(),
|
49 |
vAxis: { gridlines: { count: 5 } }
|
50 |
};
|
51 |
|
52 |
+
if(ct_chart){
|
53 |
+
var chart = new google.visualization.ColumnChart(ct_chart);
|
54 |
+
chart.draw(data, options);
|
55 |
+
}
|
56 |
};
|
57 |
});
|
lib/CleantalkHelper.php
CHANGED
@@ -343,7 +343,7 @@ class CleantalkHelper
|
|
343 |
|
344 |
if($date) $request['date'] = $date;
|
345 |
|
346 |
-
$result = self::api_send_request($request);
|
347 |
$result = $do_check ? self::api_check_response($result, 'spam_check_cms') : $result;
|
348 |
|
349 |
return $result;
|
343 |
|
344 |
if($date) $request['date'] = $date;
|
345 |
|
346 |
+
$result = self::api_send_request($request, self::URL, false, 6);
|
347 |
$result = $do_check ? self::api_check_response($result, 'spam_check_cms') : $result;
|
348 |
|
349 |
return $result;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: safronik
|
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
@@ -516,6 +516,12 @@ Yes, it is. Please read this article,
|
|
516 |
10. Website's options.
|
517 |
|
518 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
= 5.100 July 30 2018 =
|
520 |
* Fix: JavaScript dependencies.
|
521 |
|
@@ -1617,6 +1623,12 @@ Yes, it is. Please read this article,
|
|
1617 |
* First version
|
1618 |
|
1619 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
1620 |
= 5.100 July 30 2018 =
|
1621 |
* Fix: JavaScript dependencies.
|
1622 |
|
3 |
Tags: spam, antispam, protection, comments, firewall
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 5.101
|
7 |
License: GPLv2
|
8 |
|
9 |
Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
|
516 |
10. Website's options.
|
517 |
|
518 |
== Changelog ==
|
519 |
+
= 5.101 August 10 2018 =
|
520 |
+
* Fix: Set cookie only for non-dashboard pages.
|
521 |
+
* Fix: Dashboard widget JS error.
|
522 |
+
* Fix: JavaScript error for some environment.
|
523 |
+
* Mod: Antispam protection accelerated for some pages.
|
524 |
+
|
525 |
= 5.100 July 30 2018 =
|
526 |
* Fix: JavaScript dependencies.
|
527 |
|
1623 |
* First version
|
1624 |
|
1625 |
== Upgrade Notice ==
|
1626 |
+
= 5.101 August 10 2018 =
|
1627 |
+
* Fix: Set cookie only for non-dashboard pages.
|
1628 |
+
* Fix: Dashboard widget JS error.
|
1629 |
+
* Fix: JavaScript error for some environment.
|
1630 |
+
* Mod: Antispam protection accelerated for some pages.
|
1631 |
+
|
1632 |
= 5.100 July 30 2018 =
|
1633 |
* Fix: JavaScript dependencies.
|
1634 |
|