Version Description
March 29 2017 = * Added main dashboard widget with spam sctivity statistics. * Mailster - integration. * Base class updated.
Download this release
Release Info
Developer | Safronik |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.60 |
Comparing to | |
See all releases |
Code changes from version 5.59 to 5.60
- assets/css/cleantalk-dashboard-widget.css +93 -0
- inc/cleantalk-admin.notices.js → assets/js/cleantalk-admin-notices.js +0 -0
- inc/cleantalk-admin.js → assets/js/cleantalk-admin-settings-page.js +0 -0
- assets/js/cleantalk-dashboard-widget.js +51 -0
- cleantalk.php +23 -3
- inc/cleantalk-admin.php +157 -16
- inc/cleantalk-common.php +1 -1
- inc/cleantalk-public.php +8 -1
- inc/cleantalk.class.php +44 -0
- readme.txt +11 -1
assets/css/cleantalk-dashboard-widget.css
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.ct_widget_settings_link{
|
2 |
+
position: absolute;
|
3 |
+
top: 10px;
|
4 |
+
}
|
5 |
+
.ct_widget_settings_link{right: 40px;}
|
6 |
+
.ct_widget_refresh_link{right: 100px}
|
7 |
+
|
8 |
+
.ct_preloader{
|
9 |
+
display: none;
|
10 |
+
position: absolute; top: 8px; right: 145px;
|
11 |
+
width: 20px; height: 20px;
|
12 |
+
}
|
13 |
+
|
14 |
+
.ct_widget_wrapper{
|
15 |
+
display: block; position: relative;
|
16 |
+
width: 100%; height: 100%;
|
17 |
+
}
|
18 |
+
.ct_widget_hr{
|
19 |
+
width: 100%;
|
20 |
+
}
|
21 |
+
|
22 |
+
.ct_widget_block_header{
|
23 |
+
font-size: 18px !important;
|
24 |
+
margin-left: 12px !important;
|
25 |
+
}
|
26 |
+
|
27 |
+
.ct_widget_block{
|
28 |
+
display: block; position: relative;
|
29 |
+
padding: 12px;
|
30 |
+
}
|
31 |
+
.ct_widget_chart_wrapper{margin-right: 10px;}
|
32 |
+
#ct_widget_chart{}
|
33 |
+
|
34 |
+
.bar {fill: steelblue;}
|
35 |
+
.bar:nth-child(odd){fill: rgba(50,50,250,0.9);}
|
36 |
+
.bar:hover {fill: brown;}
|
37 |
+
|
38 |
+
.axis--x path {
|
39 |
+
display: none;
|
40 |
+
}
|
41 |
+
|
42 |
+
.ct_widget_block table{
|
43 |
+
width: 100%;
|
44 |
+
text-align: left;
|
45 |
+
}
|
46 |
+
.ct_widget_block table tr{margin-bottom: 10px;}
|
47 |
+
.ct_widget_block table th{
|
48 |
+
text-align: left;
|
49 |
+
padding: 10px 0 5px 10px;;
|
50 |
+
border-bottom: 2px solid gray;
|
51 |
+
|
52 |
+
}
|
53 |
+
.ct_widget_block table td{
|
54 |
+
text-align: left;
|
55 |
+
padding: 10px 0 5px 10px;;
|
56 |
+
border-bottom: 1px solid gray;
|
57 |
+
}
|
58 |
+
|
59 |
+
.ct_widget_button{
|
60 |
+
display: block;
|
61 |
+
margin: 10px auto;
|
62 |
+
}
|
63 |
+
.ct_widget_activate_button{
|
64 |
+
display: block;
|
65 |
+
margin: 10px auto; padding: 7px 15px;
|
66 |
+
font-weight: 600;
|
67 |
+
border-radius: 3px;
|
68 |
+
border: 2px solid #aaa;
|
69 |
+
background: rgba(250,50,50,0.9);
|
70 |
+
}
|
71 |
+
.ct_widget_resolve_button{
|
72 |
+
background: rgba(50,250,50,0.9);
|
73 |
+
}
|
74 |
+
.ct_widget_activate_header{
|
75 |
+
display: inline-block;
|
76 |
+
width: 100%;
|
77 |
+
text-align: center;
|
78 |
+
font-size: 18px !important;
|
79 |
+
}
|
80 |
+
.ct_widget_wprapper_total_blocked{
|
81 |
+
padding: 10px 0px 10px 10px;
|
82 |
+
background: #f1f1f1;
|
83 |
+
}
|
84 |
+
.ct_widget_wprapper_total_blocked span{
|
85 |
+
position: relative;
|
86 |
+
top: 2px;
|
87 |
+
}
|
88 |
+
.ct_widget_small_logo{
|
89 |
+
margin-right: 1em;
|
90 |
+
vertical-align: middle;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
inc/cleantalk-admin.notices.js → assets/js/cleantalk-admin-notices.js
RENAMED
File without changes
|
inc/cleantalk-admin.js → assets/js/cleantalk-admin-settings-page.js
RENAMED
File without changes
|
assets/js/cleantalk-dashboard-widget.js
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function(){
|
2 |
+
|
3 |
+
// Set "refresh" link handler
|
4 |
+
jQuery(".ct_widget_refresh_link").on('click', function(){
|
5 |
+
jQuery('.ct_preloader').show();
|
6 |
+
setTimeout(function(){jQuery("#ct_refresh_form").submit();}, 3000);
|
7 |
+
});
|
8 |
+
|
9 |
+
// Fixing default wrapper style
|
10 |
+
jQuery("#ct_widget_wrapper").parent().css('padding', 0);
|
11 |
+
|
12 |
+
|
13 |
+
// Chart
|
14 |
+
var ct_chart = jQuery("#ct_widget_chart");
|
15 |
+
|
16 |
+
function ctParseData(date){
|
17 |
+
var date_formatter = new Intl.DateTimeFormat("ru", {
|
18 |
+
month: "short",
|
19 |
+
day: "numeric"
|
20 |
+
});
|
21 |
+
date.forEach(function(d){
|
22 |
+
d[0] = Date.parse(d[0]);
|
23 |
+
d[0] = date_formatter.format(d[0]);
|
24 |
+
});
|
25 |
+
}
|
26 |
+
|
27 |
+
google.charts.load('current', {packages:['corechart', 'bar']});
|
28 |
+
google.charts.setOnLoadCallback(drawStuff);
|
29 |
+
|
30 |
+
function drawStuff() {
|
31 |
+
var data = new google.visualization.DataTable();
|
32 |
+
data.addColumn('string', 'Spam Blocked');
|
33 |
+
data.addColumn('number', 'Frequency');
|
34 |
+
|
35 |
+
ctParseData(ct_chart_data);
|
36 |
+
data.addRows(ct_chart_data);
|
37 |
+
|
38 |
+
var options = {
|
39 |
+
width: jQuery(".ct_widget_block").first().width(),
|
40 |
+
height: 300,
|
41 |
+
colors: ['steelblue'],
|
42 |
+
legend: 'none',
|
43 |
+
bar: {groupWidth: '95%'},
|
44 |
+
chartArea:{left:30,top:20,width:'93%',height:'80%'},
|
45 |
+
vAxis: { gridlines: { count: 5 } }
|
46 |
+
};
|
47 |
+
|
48 |
+
var chart = new google.visualization.ColumnChart(document.getElementById('ct_widget_chart'));
|
49 |
+
chart.draw(data, options);
|
50 |
+
};
|
51 |
+
});
|
cleantalk.php
CHANGED
@@ -3,12 +3,12 @@
|
|
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. Formerly Anti-Spam by CleanTalk.
|
6 |
-
Version: 5.
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
-
$cleantalk_plugin_version='5.
|
11 |
-
$ct_agent_version = 'wordpress-
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
@@ -33,6 +33,7 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
33 |
|
34 |
//Cron jobs
|
35 |
add_action('cleantalk_send_daily_report_hook', 'cleantalk_send_daily_report'); //Sending daily report
|
|
|
36 |
|
37 |
//Delete cookie for admin trial notice
|
38 |
add_action('wp_logout', 'ct_wp_logout');
|
@@ -241,6 +242,9 @@ if(!defined('CLEANTALK_PLUGIN_DIR')){
|
|
241 |
|
242 |
add_action('admin_notices', 'cleantalk_admin_notice_message');
|
243 |
add_action('network_admin_notices', 'cleantalk_admin_notice_message');
|
|
|
|
|
|
|
244 |
}
|
245 |
if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action'])){
|
246 |
$cleantalk_hooked_actions = array();
|
@@ -374,6 +378,8 @@ if (!function_exists ( 'ct_activation')) {
|
|
374 |
wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw_hook' );
|
375 |
//Sends log every day
|
376 |
wp_schedule_event(time()+85400 , 'daily', 'cleantalk_send_daily_report_hook' );
|
|
|
|
|
377 |
|
378 |
cleantalk_update_sfw();
|
379 |
|
@@ -398,6 +404,7 @@ if (!function_exists ( 'ct_deactivation')) {
|
|
398 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
|
399 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw_hook' );
|
400 |
wp_clear_scheduled_hook( 'cleantalk_send_daily_report_hook' );
|
|
|
401 |
|
402 |
}
|
403 |
}
|
@@ -777,6 +784,19 @@ function cleantalk_send_daily_report(){
|
|
777 |
|
778 |
}
|
779 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
780 |
//Delete cookie for admin trial notice
|
781 |
function ct_wp_logout(){
|
782 |
if(!headers_sent())
|
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. Formerly Anti-Spam by CleanTalk.
|
6 |
+
Version: 5.60
|
7 |
Author: СleanTalk <welcome@cleantalk.org>
|
8 |
Author URI: http://cleantalk.org
|
9 |
*/
|
10 |
+
$cleantalk_plugin_version='5.60';
|
11 |
+
$ct_agent_version = 'wordpress-560';
|
12 |
$cleantalk_executed=false;
|
13 |
$ct_sfw_updated = false;
|
14 |
|
33 |
|
34 |
//Cron jobs
|
35 |
add_action('cleantalk_send_daily_report_hook', 'cleantalk_send_daily_report'); //Sending daily report
|
36 |
+
add_action('cleantalk_get_brief_data_hook', 'cleantalk_get_brief_data'); //Sending daily report
|
37 |
|
38 |
//Delete cookie for admin trial notice
|
39 |
add_action('wp_logout', 'ct_wp_logout');
|
242 |
|
243 |
add_action('admin_notices', 'cleantalk_admin_notice_message');
|
244 |
add_action('network_admin_notices', 'cleantalk_admin_notice_message');
|
245 |
+
|
246 |
+
add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
|
247 |
+
|
248 |
}
|
249 |
if (defined( 'DOING_AJAX' ) && DOING_AJAX||isset($_POST['cma-action'])){
|
250 |
$cleantalk_hooked_actions = array();
|
378 |
wp_schedule_event(time(), 'daily', 'cleantalk_update_sfw_hook' );
|
379 |
//Sends log every day
|
380 |
wp_schedule_event(time()+85400 , 'daily', 'cleantalk_send_daily_report_hook' );
|
381 |
+
//
|
382 |
+
wp_schedule_event(time()+85400 , 'daily', 'cleantalk_get_brief_data_hook' );
|
383 |
|
384 |
cleantalk_update_sfw();
|
385 |
|
404 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw' );
|
405 |
wp_clear_scheduled_hook( 'cleantalk_update_sfw_hook' );
|
406 |
wp_clear_scheduled_hook( 'cleantalk_send_daily_report_hook' );
|
407 |
+
wp_clear_scheduled_hook( 'cleantalk_get_brief_data_hook' );
|
408 |
|
409 |
}
|
410 |
}
|
784 |
|
785 |
}
|
786 |
|
787 |
+
function cleantalk_get_brief_data(){
|
788 |
+
$ct_options = ct_get_options();
|
789 |
+
$ct_data = ct_get_data();
|
790 |
+
|
791 |
+
require_once('inc/cleantalk.class.php');
|
792 |
+
$result = getAntispamReportBreif($ct_options['apikey']);
|
793 |
+
|
794 |
+
$ct_data['brief_data'] = $result;
|
795 |
+
update_option('cleantalk_data', $ct_data);
|
796 |
+
|
797 |
+
return;
|
798 |
+
}
|
799 |
+
|
800 |
//Delete cookie for admin trial notice
|
801 |
function ct_wp_logout(){
|
802 |
if(!headers_sent())
|
inc/cleantalk-admin.php
CHANGED
@@ -10,12 +10,137 @@ $ct_ip_penalty_days = 30;
|
|
10 |
// Timeout to get app server
|
11 |
$ct_server_timeout = 10;
|
12 |
|
13 |
-
|
14 |
-
function
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
if(isset($current_user) && in_array("administrator", $current_user->roles)){
|
20 |
if(!isset($ct_data['admin_blocked'])){
|
21 |
$blocked=0;
|
@@ -24,15 +149,20 @@ function cleantalk_custom_glance_items( )
|
|
24 |
}
|
25 |
if($blocked>0){
|
26 |
$blocked = number_format($blocked, 0, ',', ' ');
|
27 |
-
print "<div
|
|
|
|
|
|
|
28 |
printf(
|
29 |
/* translators: %s: Number of spam messages */
|
30 |
-
__( 'has blocked %s spam', 'cleantalk' ),
|
31 |
$blocked
|
32 |
);
|
33 |
print "</span></div>";
|
34 |
}
|
35 |
}
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
@@ -60,9 +190,21 @@ add_action( 'wp_ajax_ajax_get_timezone', 'ct_ajax_get_timezone' );
|
|
60 |
function ct_enqueue_scripts($hook) {
|
61 |
global $cleantalk_plugin_version;
|
62 |
|
|
|
63 |
if ($hook == 'edit-comments.php'){
|
64 |
//wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__), array(), $cleantalk_plugin_version);
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
// Scripts for comments check
|
68 |
if( $hook == 'comments_page_ct_check_spam' || $hook == 'edit-comments.php'){
|
@@ -108,14 +250,14 @@ function ct_enqueue_scripts($hook) {
|
|
108 |
));
|
109 |
}
|
110 |
|
111 |
-
// Scripts &
|
112 |
if( $hook == 'settings_page_cleantalk' ){
|
113 |
|
114 |
-
//Styles
|
115 |
-
wp_enqueue_style('
|
116 |
|
117 |
-
//Scripts
|
118 |
-
wp_enqueue_script('
|
119 |
|
120 |
$ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
|
121 |
wp_localize_script( 'jquery', 'ctSettingsPage', array(
|
@@ -123,19 +265,18 @@ function ct_enqueue_scripts($hook) {
|
|
123 |
));
|
124 |
}
|
125 |
|
126 |
-
// Scripts to control admin notices
|
127 |
-
wp_enqueue_script('ct_users_editscreen', plugins_url('/cleantalk-spam-protect/inc/cleantalk-admin.notices.js'), array(), $cleantalk_plugin_version);
|
128 |
}
|
129 |
|
130 |
/**
|
131 |
* Admin action 'admin_menu' - Add the admin options page
|
132 |
*/
|
133 |
function ct_admin_add_page() {
|
|
|
134 |
|
135 |
if(is_network_admin())
|
136 |
-
add_submenu_page("settings.php", __('CleanTalk settings', 'cleantalk'),
|
137 |
else
|
138 |
-
add_options_page(__('CleanTalk settings', 'cleantalk'),
|
139 |
|
140 |
}
|
141 |
|
10 |
// Timeout to get app server
|
11 |
$ct_server_timeout = 10;
|
12 |
|
13 |
+
//Adding widjet
|
14 |
+
function ct_dashboard_statistics_widget() {
|
15 |
+
$plugin_settings_link = (is_network_admin() ? "settings.php" : "options-general.php" )."?page=cleantalk";
|
16 |
+
wp_add_dashboard_widget(
|
17 |
+
'ct_dashboard_statistics_widget',
|
18 |
+
__("CleanTalk Anti-Spam Statistics")
|
19 |
+
.sprintf(__("%sConfigure%s"), "<a href='$plugin_settings_link' class='ct_widget_top_link ct_widget_settings_link'>", "</a>")
|
20 |
+
.sprintf(__("%sRefresh%s"), "<a href='#ct_widget' class='ct_widget_settings_link ct_widget_refresh_link'>", "</a>")
|
21 |
+
."<img src='".plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif')."' class='ct_preloader'>",
|
22 |
+
'ct_dashboard_statistics_widget_output'
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
// Outputs statistics widget content
|
27 |
+
function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
|
28 |
+
global $ct_data, $ct_options, $current_user;
|
29 |
+
|
30 |
+
if(empty($ct_data['brief_data']) || !empty($_POST['ct_brief_refresh'])){
|
31 |
+
require_once('cleantalk.class.php');
|
32 |
+
$brief_data = getAntispamReportBreif($ct_options['apikey']);
|
33 |
+
|
34 |
+
$ct_data['brief_data'] = $brief_data;
|
35 |
+
update_option('cleantalk_data', $ct_data);
|
36 |
+
}else{
|
37 |
+
$brief_data = $ct_data['brief_data'];
|
38 |
+
}
|
39 |
+
|
40 |
+
if(ct_valid_key()){
|
41 |
+
$ct_error = is_string($brief_data) ? true : false;
|
42 |
+
$key_is_good = is_string($brief_data) && $brief_data == 'Unknown access key.' ? false : true;
|
43 |
+
}else{
|
44 |
+
$ct_error = true;
|
45 |
+
$key_is_good = false;
|
46 |
+
$brief_data = 'Unknown access key.';
|
47 |
+
}
|
48 |
+
|
49 |
+
if($ct_error){
|
50 |
+
$tmp = array();
|
51 |
+
for($i=0; $i<7; $i++)
|
52 |
+
$tmp[date("Y-m-d", time()-86400*7+86400*$i)] = 0;
|
53 |
+
$spam_stat = $tmp;
|
54 |
+
}else{
|
55 |
+
$spam_stat = $brief_data['spam_stat'];
|
56 |
+
}
|
57 |
|
58 |
+
echo "<div id='ct_widget_wrapper'>";
|
59 |
+
// 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"]]
|
60 |
+
$to_chart = array();
|
61 |
+
foreach($spam_stat as $key => $value)
|
62 |
+
$to_chart[] = array($key, $value);
|
63 |
+
unset($key, $value);
|
64 |
+
$to_chart = json_encode($to_chart);
|
65 |
+
?>
|
66 |
+
<a name='ct_widget'></a>
|
67 |
+
<form id='ct_refresh_form' method='POST' action='#ct_widget'>
|
68 |
+
<input type='hidden' name='ct_brief_refresh' value='1'>
|
69 |
+
</form>
|
70 |
+
<h4 class='ct_widget_block_header' style='margin-left: 12px;'>7 days anti-spam stats</h4>
|
71 |
+
<div class='ct_widget_block ct_widget_chart_wrapper'>
|
72 |
+
|
73 |
+
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
74 |
+
<script>
|
75 |
+
var ct_chart_data = <?php echo $to_chart; ?>;
|
76 |
+
</script>
|
77 |
+
<div id='ct_widget_chart'></div>
|
78 |
+
</div>
|
79 |
+
<h4 class='ct_widget_block_header'>Top 5 spam IPs blocked</h4>
|
80 |
+
<hr class='ct_widget_hr'>
|
81 |
+
<?php
|
82 |
+
if($key_is_good && !$ct_error){
|
83 |
+
?>
|
84 |
+
<div class='ct_widget_block'>
|
85 |
+
<table cellspacing="0">
|
86 |
+
<tr>
|
87 |
+
<th>IP</th>
|
88 |
+
<th>Country</th>
|
89 |
+
<th>Block Count</th>
|
90 |
+
</tr>
|
91 |
+
<?php
|
92 |
+
foreach($brief_data['top5_spam_ip'] as $val){
|
93 |
+
?>
|
94 |
+
<tr>
|
95 |
+
<td><?php echo $val[0]; ?></td>
|
96 |
+
<td><?php echo $val[1] ? "<img src='https://cleantalk.org/images/flags/".strtolower($val[1]).".png'>" : ''; ?> <?php echo $val[1] ? locale_get_display_region('-'.$val[1]) : 'Unknown'; ?></td>
|
97 |
+
<td><?php echo $val[2]; ?></td>
|
98 |
+
</tr>
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
?>
|
102 |
+
</table>
|
103 |
+
<?php
|
104 |
+
if(!empty($ct_data['user_token'])){
|
105 |
+
?>
|
106 |
+
<a target='_blank' href='https://cleantalk.org/my?user_token=<?php echo $ct_data['user_token']; ?>&cp_mode=antispam'>
|
107 |
+
<input class='ct_widget_button' type='button' value='View all'>
|
108 |
+
</a>
|
109 |
+
<?php
|
110 |
+
}
|
111 |
+
?>
|
112 |
+
</div>
|
113 |
+
|
114 |
+
<?php
|
115 |
+
}else{
|
116 |
+
$plugin_settings_link = (is_network_admin() ? "settings.php" : "options-general.php" )."?page=cleantalk";
|
117 |
+
|
118 |
+
if(!$key_is_good){
|
119 |
+
?> <div class='ct_widget_block'>
|
120 |
+
<form action='<? echo $plugin_settings_link; ?>' method='POST'>
|
121 |
+
<h2 class='ct_widget_activate_header'>Get Access key to activate Anti-Spam protection!</h2>
|
122 |
+
<input class='ct_widget_button ct_widget_activate_button' type='submit' name='get_apikey_auto' value='ACTIVATE'>
|
123 |
+
</form>
|
124 |
+
</div>
|
125 |
+
<?php
|
126 |
+
}else{
|
127 |
+
?>
|
128 |
+
<div class='ct_widget_block'>
|
129 |
+
<h2 class='ct_widget_activate_header'>Something went wrong! Server response is: "<u><? echo $brief_data ?></u>".</h2>
|
130 |
+
<?php
|
131 |
+
if(!empty($ct_data['user_token'])){
|
132 |
+
?>
|
133 |
+
<h2 class='ct_widget_activate_header'>Please, visit your dashboard.</h2>
|
134 |
+
<a target='_blank' href='https://cleantalk.org/my?user_token=<?php echo $ct_data['user_token']; ?>&cp_mode=antispam'>
|
135 |
+
<input class='ct_widget_button ct_widget_activate_button ct_widget_resolve_button' type='button' value='VISIT CONTROL PANEL'>
|
136 |
+
</a>
|
137 |
+
<?php
|
138 |
+
}
|
139 |
+
?>
|
140 |
+
</div>
|
141 |
+
<?php }
|
142 |
+
}
|
143 |
+
// Notice at the bottom
|
144 |
if(isset($current_user) && in_array("administrator", $current_user->roles)){
|
145 |
if(!isset($ct_data['admin_blocked'])){
|
146 |
$blocked=0;
|
149 |
}
|
150 |
if($blocked>0){
|
151 |
$blocked = number_format($blocked, 0, ',', ' ');
|
152 |
+
print "<div class='ct_widget_wprapper_total_blocked'>
|
153 |
+
<img src='".plugins_url('/cleantalk-spam-protect/inc/images/logo_color.png')."' class='ct_widget_small_logo'/>
|
154 |
+
<span>
|
155 |
+
<a href='https://cleantalk.org/my/?user_token=".@$ct_data['user_token']."&utm_source=wp-backend&utm_medium=dashboard_widget&cp_mode=antispam' target='_blank'>CleanTalk</a> ";
|
156 |
printf(
|
157 |
/* translators: %s: Number of spam messages */
|
158 |
+
__( 'has blocked %s spam. The statistics is automatically updated every 24 hours.', 'cleantalk' ),
|
159 |
$blocked
|
160 |
);
|
161 |
print "</span></div>";
|
162 |
}
|
163 |
}
|
164 |
+
|
165 |
+
echo "</div>";
|
166 |
}
|
167 |
|
168 |
/**
|
190 |
function ct_enqueue_scripts($hook) {
|
191 |
global $cleantalk_plugin_version;
|
192 |
|
193 |
+
/*/ INACTIVE
|
194 |
if ($hook == 'edit-comments.php'){
|
195 |
//wp_enqueue_script('ct_reload_script', plugins_url('/cleantalk-rel.js', __FILE__), array(), $cleantalk_plugin_version);
|
196 |
}
|
197 |
+
//*/
|
198 |
+
|
199 |
+
// Scripts to all admin pages
|
200 |
+
wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-admin-notices.js'), array(), $cleantalk_plugin_version);
|
201 |
+
|
202 |
+
// Scripts & Styles to main dashboard page
|
203 |
+
if($hook == 'index.php'){
|
204 |
+
wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-dashboard-widget.js'), array(), $cleantalk_plugin_version);
|
205 |
+
|
206 |
+
wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/assets/css/cleantalk-dashboard-widget.css'), array(), $cleantalk_plugin_version, 'all');
|
207 |
+
}
|
208 |
|
209 |
// Scripts for comments check
|
210 |
if( $hook == 'comments_page_ct_check_spam' || $hook == 'edit-comments.php'){
|
250 |
));
|
251 |
}
|
252 |
|
253 |
+
// Scripts & Styles for CleanTalk's settings page
|
254 |
if( $hook == 'settings_page_cleantalk' ){
|
255 |
|
256 |
+
// Styles
|
257 |
+
wp_enqueue_style('cleantalk_css_admin_settings_page', plugins_url().'/cleantalk-spam-protect/assets/css/cleantalk-admin-settings-page.css', array(), $cleantalk_plugin_version, 'all');
|
258 |
|
259 |
+
// Scripts
|
260 |
+
wp_enqueue_script('cleantalk_js_admin_settings_page', plugins_url('/cleantalk-spam-protect/assets/js/cleantalk-admin-settings-page.js'), array(), $cleantalk_plugin_version);
|
261 |
|
262 |
$ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
|
263 |
wp_localize_script( 'jquery', 'ctSettingsPage', array(
|
265 |
));
|
266 |
}
|
267 |
|
|
|
|
|
268 |
}
|
269 |
|
270 |
/**
|
271 |
* Admin action 'admin_menu' - Add the admin options page
|
272 |
*/
|
273 |
function ct_admin_add_page() {
|
274 |
+
global $ct_plugin_name;
|
275 |
|
276 |
if(is_network_admin())
|
277 |
+
add_submenu_page("settings.php", __('CleanTalk settings', 'cleantalk'), $ct_plugin_name, 'manage_options', 'cleantalk', 'ct_settings_page');
|
278 |
else
|
279 |
+
add_options_page(__('CleanTalk settings', 'cleantalk'), $ct_plugin_name, 'manage_options', 'cleantalk', 'ct_settings_page');
|
280 |
|
281 |
}
|
282 |
|
inc/cleantalk-common.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$ct_plugin_name = '
|
4 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
5 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
6 |
$ct_session_request_id_label = 'request_id';
|
1 |
<?php
|
2 |
|
3 |
+
$ct_plugin_name = 'Antispam by CleanTalk';
|
4 |
$ct_checkjs_frm = 'ct_checkjs_frm';
|
5 |
$ct_checkjs_register_form = 'ct_checkjs_register_form';
|
6 |
$ct_session_request_id_label = 'request_id';
|
inc/cleantalk-public.php
CHANGED
@@ -2570,9 +2570,16 @@ function ct_contact_form_validate() {
|
|
2570 |
}elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
|
2571 |
echo "<h3>Antispam by CleanTalk: <u>".$ct_result->comment."</u></h3>";
|
2572 |
die();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2573 |
}else
|
2574 |
ct_die(null, null);
|
2575 |
-
|
2576 |
}
|
2577 |
exit;
|
2578 |
}
|
2570 |
}elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
|
2571 |
echo "<h3>Antispam by CleanTalk: <u>".$ct_result->comment."</u></h3>";
|
2572 |
die();
|
2573 |
+
//Mailster
|
2574 |
+
}elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
|
2575 |
+
$return = array(
|
2576 |
+
'success' => false,
|
2577 |
+
'html' => '<p>' . $ct_result->comment . '</p>',
|
2578 |
+
);
|
2579 |
+
print json_encode($return);
|
2580 |
+
die();
|
2581 |
}else
|
2582 |
ct_die(null, null);
|
|
|
2583 |
}
|
2584 |
exit;
|
2585 |
}
|
inc/cleantalk.class.php
CHANGED
@@ -1135,6 +1135,42 @@ if(!function_exists('getAntispamReport'))
|
|
1135 |
}
|
1136 |
}
|
1137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1138 |
/**
|
1139 |
* Function sends raw request to API server
|
1140 |
*
|
@@ -1254,3 +1290,11 @@ function cleantalk_is_JSON($string)
|
|
1254 |
{
|
1255 |
return ((is_string($string) && (is_object(json_decode($string)) || is_array(json_decode($string))))) ? true : false;
|
1256 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1135 |
}
|
1136 |
}
|
1137 |
|
1138 |
+
/**
|
1139 |
+
* Function gets spam statistics
|
1140 |
+
*
|
1141 |
+
* @param string website host
|
1142 |
+
* @param integer report days
|
1143 |
+
* @return type
|
1144 |
+
*/
|
1145 |
+
|
1146 |
+
if(!function_exists('getAntispamReportBreif'))
|
1147 |
+
{
|
1148 |
+
function getAntispamReportBreif($key='')
|
1149 |
+
{
|
1150 |
+
|
1151 |
+
$url="https://api.cleantalk.org?auth_key=$key";
|
1152 |
+
$request=Array(
|
1153 |
+
'method_name' => 'get_antispam_report_breif'
|
1154 |
+
);
|
1155 |
+
$result = sendRawRequest($url,$request);
|
1156 |
+
|
1157 |
+
if($result === false)
|
1158 |
+
return "Network error. Please, check <a target='_blank' href='https://cleantalk.org/help/faq-setup#hosting'>this article</a>.";
|
1159 |
+
|
1160 |
+
$result = !empty($result) ? json_decode($result, true) : false;
|
1161 |
+
|
1162 |
+
if(!empty($result['error_message']))
|
1163 |
+
return $result['error_message'];
|
1164 |
+
else{
|
1165 |
+
$tmp = array();
|
1166 |
+
for($i=0; $i<7; $i++)
|
1167 |
+
$tmp[date("Y-m-d", time()-86400*7+86400*$i)] = 0;
|
1168 |
+
$result['data']['spam_stat'] = array_merge($tmp, $result['data']['spam_stat']);
|
1169 |
+
return $result['data'];
|
1170 |
+
}
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
|
1174 |
/**
|
1175 |
* Function sends raw request to API server
|
1176 |
*
|
1290 |
{
|
1291 |
return ((is_string($string) && (is_object(json_decode($string)) || is_array(json_decode($string))))) ? true : false;
|
1292 |
}
|
1293 |
+
|
1294 |
+
// Patch for locale_get_display_region() for old PHP versions
|
1295 |
+
if( !function_exists('apache_request_headers') ){
|
1296 |
+
function locale_get_display_region($locale){
|
1297 |
+
return $locale;
|
1298 |
+
}
|
1299 |
+
}
|
1300 |
+
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: znaeff, shagimuratov, serge00, sartemd174
|
|
3 |
Tags: spam, antispam, anti-spam, buddypress, firewall, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, plugin, contact, recaptcha, google captcha, google recaptcha, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, widget, review, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,honeypot,puzzle,quiz,survey,poll,security, amo forms, caldera forms, visual form builder, contact form clean and simple
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.7.2
|
6 |
-
Stable tag: 5.
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -552,6 +552,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
552 |
1. The Dashboard with a map of most spam active countries per your account.
|
553 |
|
554 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
555 |
= 5.59 March 24 2017 =
|
556 |
* Users/comments check fix.
|
557 |
* Plugin's name changed to Anti-Spam by CleanTalk.
|
@@ -1345,6 +1350,11 @@ WordPress 3.0 at least. PHP 5 with CURL or file_get_contents() function and enab
|
|
1345 |
* First version
|
1346 |
|
1347 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
1348 |
= 5.59 March 24 2017 =
|
1349 |
* Users/comments check fix.
|
1350 |
* Plugin's name changed to Anti-Spam by CleanTalk.
|
3 |
Tags: spam, antispam, anti-spam, buddypress, firewall, captcha, capcha, captha, catcha, cf7 spam, comments, contact form spam, signup, spammers, spammy, woocommerce, wordpress spam, subscription, gravity spam, jetpack, bots, contact form 7, contact form, registrations, ninja, Fast Secure Contact, Gravity forms, formidable, mailchimp, s2member, protection, protect, email, plugin, contact, recaptcha, google captcha, google recaptcha, blacklist, prevent spam comments, wordpress, User Frontend, bulk delete, bulk remove, widget, review, cleantalk, mailpoet, profile builder, comment spam, registration spam, spam comments, comment moderation, spam bots, block spam, signup spam, spam blocker, spam filter, user registration spam,pingback,trackback, anti-spam plugin, varnish, amp, spam free, userpro,honeypot,puzzle,quiz,survey,poll,security, amo forms, caldera forms, visual form builder, contact form clean and simple
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.7.2
|
6 |
+
Stable tag: 5.60
|
7 |
License: GPLv2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
552 |
1. The Dashboard with a map of most spam active countries per your account.
|
553 |
|
554 |
== Changelog ==
|
555 |
+
= 5.60 March 29 2017 =
|
556 |
+
* Added main dashboard widget with spam sctivity statistics.
|
557 |
+
* Mailster - integration.
|
558 |
+
* Base class updated.
|
559 |
+
|
560 |
= 5.59 March 24 2017 =
|
561 |
* Users/comments check fix.
|
562 |
* Plugin's name changed to Anti-Spam by CleanTalk.
|
1350 |
* First version
|
1351 |
|
1352 |
== Upgrade Notice ==
|
1353 |
+
= 5.60 March 29 2017 =
|
1354 |
+
* Added main dashboard widget with spam sctivity statistics.
|
1355 |
+
* Mailster - integration.
|
1356 |
+
* Base class updated.
|
1357 |
+
|
1358 |
= 5.59 March 24 2017 =
|
1359 |
* Users/comments check fix.
|
1360 |
* Plugin's name changed to Anti-Spam by CleanTalk.
|