Version Description
Download this release
Release Info
Developer | alexkovalevv |
Plugin | ![]() |
Version | 7.3.2 |
Comparing to | |
See all releases |
Code changes from version 7.3.1 to 7.3.2
- anti-spam.php +3 -5
- includes/helpers.php +3 -3
- libs/antispam-premium/admin/ajax/check-existing-comments.php +0 -50
- libs/antispam-premium/admin/ajax/index.php +0 -7
- libs/antispam-premium/admin/assets/css/manage-comments.css +0 -7
- libs/antispam-premium/admin/assets/css/manage-comments.css.map +0 -1
- libs/antispam-premium/admin/assets/css/manage-comments.less +0 -10
- libs/antispam-premium/admin/assets/js/check-existing-comments.js +0 -69
- libs/antispam-premium/admin/boot.php +0 -118
- libs/antispam-premium/admin/includes/class-comments-list-table.php +0 -155
- libs/antispam-premium/admin/includes/class-dashboard-widget.php +0 -218
- libs/antispam-premium/admin/includes/class-users-list-table.php +0 -149
- libs/antispam-premium/admin/includes/index.php +0 -7
- libs/antispam-premium/admin/index.php +0 -0
- libs/antispam-premium/admin/pages/class-pages-settings.php +0 -118
- libs/antispam-premium/anti-spam-premium.php +0 -155
- libs/antispam-premium/includes/3rd-party/class-extension.php +0 -351
- libs/antispam-premium/includes/3rd-party/class-extention-caldera.php +0 -135
- libs/antispam-premium/includes/3rd-party/class-extention-contact-form7.php +0 -131
- libs/antispam-premium/includes/3rd-party/class-extention-ninja-forms.php +0 -132
- libs/antispam-premium/includes/class-array.php +0 -234
- libs/antispam-premium/includes/class-forms-listener.php +0 -191
- libs/antispam-premium/includes/class-request-api.php +0 -162
- libs/antispam-premium/includes/cron-schedules.php +0 -120
- libs/antispam-premium/includes/function.php +0 -299
- libs/antispam-premium/includes/index.php +0 -0
- libs/antispam-premium/includes/plugin-rest-api.php +0 -101
- libs/antispam-premium/index.php +0 -0
- libs/antispam-premium/languages/index.php +0 -0
- libs/antispam-premium/readme.txt +0 -251
- readme.txt +4 -0
anti-spam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Titan Anti-spam & Security
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: Titan Security - Anti-spam, Anti-virus, Firewall and Malware Scan
|
6 |
-
Version: 7.3.
|
7 |
Author: CreativeMotion
|
8 |
Text Domain: titan-security
|
9 |
Author URI: https://cm-wp.com/
|
@@ -167,10 +167,6 @@ try {
|
|
167 |
]));
|
168 |
|
169 |
require_once(WTITAN_PLUGIN_DIR . '/includes/functions.php');
|
170 |
-
|
171 |
-
if( $plugin->is_premium() ) {
|
172 |
-
require_once(WTITAN_PLUGIN_DIR . '/libs/antispam-premium/anti-spam-premium.php');
|
173 |
-
}
|
174 |
} catch( Exception $e ) {
|
175 |
// Plugin wasn't initialized due to an error
|
176 |
define('WTITAN_PLUGIN_THROW_ERROR', true);
|
@@ -183,4 +179,6 @@ try {
|
|
183 |
add_action('admin_notices', $wtitan_plugin_error_func);
|
184 |
add_action('network_admin_notices', $wtitan_plugin_error_func);
|
185 |
}
|
|
|
|
|
186 |
// @formatter:on
|
3 |
Plugin Name: Titan Anti-spam & Security
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: Titan Security - Anti-spam, Anti-virus, Firewall and Malware Scan
|
6 |
+
Version: 7.3.2
|
7 |
Author: CreativeMotion
|
8 |
Text Domain: titan-security
|
9 |
Author URI: https://cm-wp.com/
|
167 |
]));
|
168 |
|
169 |
require_once(WTITAN_PLUGIN_DIR . '/includes/functions.php');
|
|
|
|
|
|
|
|
|
170 |
} catch( Exception $e ) {
|
171 |
// Plugin wasn't initialized due to an error
|
172 |
define('WTITAN_PLUGIN_THROW_ERROR', true);
|
179 |
add_action('admin_notices', $wtitan_plugin_error_func);
|
180 |
add_action('network_admin_notices', $wtitan_plugin_error_func);
|
181 |
}
|
182 |
+
|
183 |
+
// remove plugin options
|
184 |
// @formatter:on
|
includes/helpers.php
CHANGED
@@ -103,7 +103,7 @@ class Helper {
|
|
103 |
*/
|
104 |
public static function maybeGetPostJson($name)
|
105 |
{
|
106 |
-
return \
|
107 |
}
|
108 |
|
109 |
/**
|
@@ -129,7 +129,7 @@ class Helper {
|
|
129 |
*/
|
130 |
public static function recursiveSanitizeArray($array, $function)
|
131 |
{
|
132 |
-
return \
|
133 |
}
|
134 |
|
135 |
/*
|
@@ -139,7 +139,7 @@ class Helper {
|
|
139 |
*/
|
140 |
public static function flushPageCache()
|
141 |
{
|
142 |
-
\
|
143 |
}
|
144 |
|
145 |
}
|
103 |
*/
|
104 |
public static function maybeGetPostJson($name)
|
105 |
{
|
106 |
+
return \WBCR\Factory_Templates_110\Helpers::maybeGetPostJson($name);
|
107 |
}
|
108 |
|
109 |
/**
|
129 |
*/
|
130 |
public static function recursiveSanitizeArray($array, $function)
|
131 |
{
|
132 |
+
return \WBCR\Factory_Templates_110\Helpers::recursiveSanitizeArray($array, $function);
|
133 |
}
|
134 |
|
135 |
/*
|
139 |
*/
|
140 |
public static function flushPageCache()
|
141 |
{
|
142 |
+
\WBCR\Factory_Templates_110\Helpers::flushPageCache();
|
143 |
}
|
144 |
|
145 |
}
|
libs/antispam-premium/admin/ajax/check-existing-comments.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ajax action to check existing comments
|
4 |
-
*
|
5 |
-
* @author Webcraftic <wordpress.webraftic@gmail.com>
|
6 |
-
* @author Alexander Gorenkov <g.a.androidjc2@ya.ru>
|
7 |
-
*
|
8 |
-
* @since 6.2
|
9 |
-
* @version 1.0
|
10 |
-
* @copyright (c) 2019 Webcraftic Ltd
|
11 |
-
*/
|
12 |
-
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
add_action( 'wp_ajax_waspam-check-existing-comments', 'wantispamp_checking_existing_comments' );
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Checking existing comment
|
21 |
-
*
|
22 |
-
* @author Alexander Gorenkov <g.a.androidjc2@ya.ru>
|
23 |
-
*/
|
24 |
-
function wantispamp_checking_existing_comments() {
|
25 |
-
check_admin_referer( 'waspam-check-existing-comments' );
|
26 |
-
|
27 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
28 |
-
wp_die( - 1 );
|
29 |
-
}
|
30 |
-
|
31 |
-
$result = wantispamp_check_existing_comments();
|
32 |
-
|
33 |
-
if ( is_wp_error( $result ) ) {
|
34 |
-
wp_send_json_error( [
|
35 |
-
'error_message' => $result->get_error_message()
|
36 |
-
] );
|
37 |
-
}
|
38 |
-
|
39 |
-
list( $status, $remaining ) = $result;
|
40 |
-
|
41 |
-
if ( $status ) {
|
42 |
-
wp_send_json_success( [
|
43 |
-
'remaining' => $remaining
|
44 |
-
] );
|
45 |
-
}
|
46 |
-
|
47 |
-
wp_send_json_error( [
|
48 |
-
'error_message' => 'Empty AntiSpam API response'
|
49 |
-
] );
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/ajax/index.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by PhpStorm.
|
4 |
-
* User: admin
|
5 |
-
* Date: 11.02.2019
|
6 |
-
* Time: 16:36
|
7 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/assets/css/manage-comments.css
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
.wantispam-status-text--green {
|
2 |
-
color: green;
|
3 |
-
}
|
4 |
-
.wantispam-status-text--red {
|
5 |
-
color: red;
|
6 |
-
}
|
7 |
-
/*# sourceMappingURL=manage-comments.css.map */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/assets/css/manage-comments.css.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["manage-comments.less"],"names":[],"mappings":"AAEE,sBAAC;EACC,YAAA;;AAGF,sBAAC;EACC,UAAA","file":"manage-comments.css"}
|
|
libs/antispam-premium/admin/assets/css/manage-comments.less
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
.wantispam-status-text {
|
2 |
-
|
3 |
-
&--green {
|
4 |
-
color: green;
|
5 |
-
}
|
6 |
-
|
7 |
-
&--red {
|
8 |
-
color: red;
|
9 |
-
}
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/assets/js/check-existing-comments.js
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Checking existing comments
|
3 |
-
*
|
4 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
5 |
-
* @author Alexander Gorenkov <g.a.androidjc2@ya.ru>
|
6 |
-
* @copyright (c) 03.12.2019, CreativeMotion
|
7 |
-
* @version 1.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
jQuery(function($) {
|
11 |
-
let contanierElement = $('#wantispam-check-existing-comments'),
|
12 |
-
progressBarElement = contanierElement.find('progress'),
|
13 |
-
totalComments = 0,
|
14 |
-
progressStep,
|
15 |
-
stopProgress = false;
|
16 |
-
|
17 |
-
progressBarElement.attr('value', 0);
|
18 |
-
progressBarElement.attr('max', 100);
|
19 |
-
|
20 |
-
contanierElement.find('.wantispam-check-existing-comments__left-comments').hide();
|
21 |
-
|
22 |
-
send_request({
|
23 |
-
'action': 'waspam-check-existing-comments',
|
24 |
-
'_wpnonce': contanierElement.data('nonce')
|
25 |
-
});
|
26 |
-
|
27 |
-
function send_request(data) {
|
28 |
-
$.post(window.ajaxurl, data, function(response) {
|
29 |
-
if( !response || !response.data || !response.success ) {
|
30 |
-
console.error("[AntiSpam PRO] Response error:");
|
31 |
-
console.log(response);
|
32 |
-
|
33 |
-
$.wbcr_factory_templates_110.app.showNotice("[AntiSpam PRO] Ajax error: " + response.data.error_message, 'danger');
|
34 |
-
return;
|
35 |
-
}
|
36 |
-
|
37 |
-
if( response.data.remaining === 0 ) {
|
38 |
-
progressBarElement.val(100);
|
39 |
-
progressBarElement.attr('max', 100);
|
40 |
-
|
41 |
-
contanierElement.find('.wantispam-check-existing-comments__left-comments').show();
|
42 |
-
contanierElement.find('.wantispam-check-existing-comments__left-comments').find('span').text(response.data.remaining);
|
43 |
-
|
44 |
-
window.location.href = contanierElement.data('redirect-url');
|
45 |
-
} else {
|
46 |
-
if( 0 === totalComments ) {
|
47 |
-
totalComments = response.data.remaining;
|
48 |
-
progressBarElement.attr('max', totalComments);
|
49 |
-
}
|
50 |
-
|
51 |
-
progressStep = totalComments - response.data.remaining;
|
52 |
-
progressBarElement.val(progressStep);
|
53 |
-
|
54 |
-
contanierElement.find('.wantispam-check-existing-comments__left-comments').show();
|
55 |
-
contanierElement.find('.wantispam-check-existing-comments__left-comments').find('span').text(response.data.remaining);
|
56 |
-
|
57 |
-
setTimeout(function() {
|
58 |
-
send_request(data);
|
59 |
-
}, 1000);
|
60 |
-
}
|
61 |
-
}).fail(function(xhr, status, error) {
|
62 |
-
console.log(xhr);
|
63 |
-
console.log(status);
|
64 |
-
console.log(error);
|
65 |
-
|
66 |
-
$.wbcr_factory_templates_110.app.showNotice("[AntiSpam PRO] Ajax error: " + error, 'danger');
|
67 |
-
});
|
68 |
-
}
|
69 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/boot.php
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Usually in this file places the code that is responsible for the notification, compatibility with other plugins,
|
4 |
-
* minor functions that must be performed on all pages of the admin panel.
|
5 |
-
*
|
6 |
-
* This file should contain code that applies only to the administration area.
|
7 |
-
*
|
8 |
-
* @author Webcraftic <wordpress.webraftic@gmail.com>
|
9 |
-
* @copyright Webcraftic 20.11.2019
|
10 |
-
* @version 1.0
|
11 |
-
*/
|
12 |
-
|
13 |
-
// Exit if accessed directly
|
14 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
-
exit;
|
16 |
-
}
|
17 |
-
/**
|
18 |
-
* Include dashboard widget
|
19 |
-
*
|
20 |
-
* Include functionality the output of the widget on the dashboard.
|
21 |
-
* Only one dashboard widget must be shown for some plugins with this setting (dashboard_widget).
|
22 |
-
*
|
23 |
-
* @since 1.0.0 Added
|
24 |
-
*/
|
25 |
-
add_action( 'current_screen', function () {
|
26 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
27 |
-
return;
|
28 |
-
}
|
29 |
-
|
30 |
-
$current_screen = get_current_screen();
|
31 |
-
|
32 |
-
if ( ! in_array( $current_screen->id, [ 'dashboard', 'dashboard-network' ] ) ) {
|
33 |
-
return;
|
34 |
-
}
|
35 |
-
|
36 |
-
require_once WANTISPAMP_PLUGIN_DIR . '/admin/includes/class-dashboard-widget.php';
|
37 |
-
new \WBCR\Titan\Premium\Dashboard_Widget();
|
38 |
-
}, 10, 2 );
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Displays a notification inside the Antispam interface, on all pages of the plugin.
|
42 |
-
* This is necessary to remind the user to update the configuration of the plugin components,
|
43 |
-
* Otherwise, the newly activated components will not be involved in the work of the plugin.
|
44 |
-
*
|
45 |
-
* @param Wbcr_Factory458_Plugin $plugin
|
46 |
-
* @param Wbcr_FactoryPages457_ImpressiveThemplate $obj
|
47 |
-
*
|
48 |
-
* @return bool
|
49 |
-
*/
|
50 |
-
add_action( 'wbcr/factory/pages/impressive/print_all_notices', function ( $plugin, $obj ) {
|
51 |
-
if ( $plugin->getPluginName() != \WBCR\Titan\Plugin::app()->getPluginName() ) {
|
52 |
-
return;
|
53 |
-
}
|
54 |
-
$count_comments = wantispamp_get_unchecked_comments_count();
|
55 |
-
|
56 |
-
if ( ! $count_comments ) {
|
57 |
-
return;
|
58 |
-
}
|
59 |
-
|
60 |
-
$manage_comments_link = '<a href="' . admin_url( 'edit-comments.php?comment_status=moderated' ) . '">' . $count_comments . '</a>';
|
61 |
-
$action_link = '<a class="button button-default" href="' . wp_nonce_url( \WBCR\Titan\Plugin::app()->getPluginPageUrl( 'progress', [ 'action' => 'check-existing-comments' ] ), 'wantispam_checking_unapproved_comments' ) . '">' . __( 'Yes, do it' ) . '</a>';
|
62 |
-
|
63 |
-
$notice_text = sprintf( __( "You have %s unapproved comments. Would you like to send them for spam checking? %s", "anti-spam" ), $manage_comments_link, $action_link );
|
64 |
-
|
65 |
-
$obj->printWarningNotice( $notice_text );
|
66 |
-
}, 10, 2 );
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Print admin notice: "Would you like to send them for spam checking?"
|
70 |
-
*
|
71 |
-
* If user clicked button "Yes, do it", plugin will exec action,
|
72 |
-
* that put all unapproved comments to spam check queue.
|
73 |
-
*/
|
74 |
-
add_action( 'wbcr/factory/admin_notices', function ( $notices, $plugin_name ) {
|
75 |
-
if ( $plugin_name != \WBCR\Titan\Plugin::app()->getPluginName() ) {
|
76 |
-
return $notices;
|
77 |
-
}
|
78 |
-
|
79 |
-
$count_comments = wantispamp_get_unchecked_comments_count();
|
80 |
-
|
81 |
-
if ( ! $count_comments ) {
|
82 |
-
return $notices;
|
83 |
-
}
|
84 |
-
|
85 |
-
$manage_comments_link = '<a href="' . admin_url( 'edit-comments.php?comment_status=moderated' ) . '">' . $count_comments . '</a>';
|
86 |
-
$action_link = '<a class="button button-default" href="' . wp_nonce_url( \WBCR\Titan\Plugin::app()->getPluginPageUrl( 'progress', [ 'action' => 'check-existing-comments' ] ), 'wantispam_checking_unapproved_comments' ) . '">' . __( 'Yes, do it' ) . '</a>';
|
87 |
-
|
88 |
-
$notice_text = sprintf( __( "You have %s unapproved comments. Would you like to send them for spam checking? %s", "anti-spam" ), $manage_comments_link, $action_link );
|
89 |
-
|
90 |
-
$notices[] = [
|
91 |
-
'id' => 'wantispam_check_unapproved_comments',
|
92 |
-
'type' => 'warning',
|
93 |
-
'where' => [
|
94 |
-
'edit-comments',
|
95 |
-
'plugins',
|
96 |
-
'themes',
|
97 |
-
'dashboard',
|
98 |
-
'edit',
|
99 |
-
'settings'
|
100 |
-
],
|
101 |
-
'dismissible' => true,
|
102 |
-
'dismiss_expires' => 0,
|
103 |
-
'text' => '<p>' . $notice_text . '</p>'
|
104 |
-
];
|
105 |
-
|
106 |
-
return $notices;
|
107 |
-
}, 10, 2 );
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Changes plugin title in plugin interface header
|
111 |
-
*/
|
112 |
-
add_filter( 'wbcr/factory/pages/impressive/plugin_title', function ( $title, $plugin_name ) {
|
113 |
-
if ( \WBCR\Titan\Plugin::app()->getPluginName() == $plugin_name ) {
|
114 |
-
return __( 'Anti-spam Pro', 'realforce' );
|
115 |
-
}
|
116 |
-
|
117 |
-
return $title;
|
118 |
-
}, 30, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/includes/class-comments-list-table.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The class extend Comments_List_Table
|
7 |
-
*
|
8 |
-
* Add new status tab and comments filter. We exclude from all list
|
9 |
-
* comments that haven't checked for spam yet.
|
10 |
-
*
|
11 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
12 |
-
*
|
13 |
-
* @copyright (c) 2018 Webraftic Ltd
|
14 |
-
*/
|
15 |
-
class Comments_List_Table_Extension {
|
16 |
-
|
17 |
-
public function __construct() {
|
18 |
-
add_filter( 'comment_status_links', [ $this, 'add_status_link' ] );
|
19 |
-
add_filter( 'comments_list_table_query_args', [ $this, 'add_filter_comments' ] );
|
20 |
-
add_filter( 'manage_edit-comments_columns', [ $this, 'register_new_column' ] );
|
21 |
-
add_action( 'manage_comments_custom_column', [ $this, 'register_new_column_handler' ], 10, 2 );
|
22 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Enqueue styles for "Manage comments pages"
|
27 |
-
*
|
28 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
29 |
-
* @since 6.0
|
30 |
-
*
|
31 |
-
* @param string $hook Current page hook
|
32 |
-
*/
|
33 |
-
public function enqueue_scripts( $hook ) {
|
34 |
-
if ( "edit-comments.php" !== $hook ) {
|
35 |
-
return;
|
36 |
-
}
|
37 |
-
wp_enqueue_style( 'wantispam-manage-comments', WANTISPAMP_PLUGIN_URL . '/admin/assets/css/manage-comments.css' );
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Register a new column on the "Manage comments page"
|
42 |
-
*
|
43 |
-
* Column need for showing a status check for spam.
|
44 |
-
*
|
45 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
46 |
-
* @since 6.0
|
47 |
-
*
|
48 |
-
* @param array $columns
|
49 |
-
*
|
50 |
-
* @return mixed
|
51 |
-
*/
|
52 |
-
public function register_new_column( $columns ) {
|
53 |
-
$columns['wantispam_spam_checking_status'] = __( 'Spam checking status' );
|
54 |
-
|
55 |
-
return $columns;
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Register a new column handler
|
60 |
-
*
|
61 |
-
* Errors and status is printed after the comment checked.
|
62 |
-
*
|
63 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
64 |
-
* @since 6.0
|
65 |
-
*
|
66 |
-
* @param string $column_name
|
67 |
-
* @param int $comment_ID
|
68 |
-
*/
|
69 |
-
public function register_new_column_handler( $column_name, $comment_ID ) {
|
70 |
-
if ( "wantispam_spam_checking_status" === $column_name ) {
|
71 |
-
$is_checked_comment = get_comment_meta( $comment_ID, wantispamp_db_key( 'comment_checked' ), true );
|
72 |
-
$error = get_comment_meta( $comment_ID, wantispamp_db_key( 'spam_checking_fail' ), true );
|
73 |
-
|
74 |
-
if ( ! empty( $error ) ) {
|
75 |
-
echo '<span class="wantispam-status-text wantispam-status-text--red">' . __( "Comment hasn't been checked for spam because of error:", 'titan-security' ) . ' ' . esc_html( $error ) . '</span>';
|
76 |
-
} else if ( $is_checked_comment ) {
|
77 |
-
echo '<span class="wantispam-status-text wantispam-status-text--green">' . __( 'Successfully was checked for spam!', 'titan-security' ) . '</span>';
|
78 |
-
}
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Add comments filter
|
84 |
-
*
|
85 |
-
* The comments filter exclude unchecked comments from all comments list.
|
86 |
-
* But if comment_status equeal spam_checking, the filter exclude all comments
|
87 |
-
* except unchecked comments.
|
88 |
-
*
|
89 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
90 |
-
* @since 6.0
|
91 |
-
*
|
92 |
-
* @param $args
|
93 |
-
*
|
94 |
-
* @return mixed
|
95 |
-
*/
|
96 |
-
public function add_filter_comments( $args ) {
|
97 |
-
$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
|
98 |
-
if ( 'spam_checking' === $comment_status ) {
|
99 |
-
$args['meta_key'] = wantispamp_db_key( 'spam_checking' );
|
100 |
-
|
101 |
-
return $args;
|
102 |
-
}
|
103 |
-
|
104 |
-
$args['meta_query'] = [
|
105 |
-
[
|
106 |
-
'key' => wantispamp_db_key( 'spam_checking' ),
|
107 |
-
'compare' => 'NOT EXISTS',
|
108 |
-
],
|
109 |
-
];
|
110 |
-
|
111 |
-
return $args;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Add new status link "Spam checking queue"
|
116 |
-
*
|
117 |
-
* In this tab user can look unchecked comments.
|
118 |
-
*
|
119 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
120 |
-
* @since 6.0
|
121 |
-
*
|
122 |
-
* @param array $status_links All status links of comments list table
|
123 |
-
*
|
124 |
-
* @return array
|
125 |
-
*/
|
126 |
-
public function add_status_link( $status_links ) {
|
127 |
-
global $wpdb;
|
128 |
-
|
129 |
-
$admin_url = admin_url( "edit-comments.php?comment_status=spam_checking" );
|
130 |
-
$link_title = __( "Spam checking queue", 'titan-security' );
|
131 |
-
|
132 |
-
$total = (int) $wpdb->get_var( $wpdb->prepare( "
|
133 |
-
SELECT COUNT( * ) AS total
|
134 |
-
FROM {$wpdb->comments} c LEFT JOIN {$wpdb->commentmeta} cm ON c.comment_ID = cm.comment_id
|
135 |
-
WHERE cm.meta_key='%s'", wantispamp_db_key( 'spam_checking' ) ) );
|
136 |
-
|
137 |
-
$counter = sprintf( '<span class="count">(<span class="spam-checking-count">%d</span>)</span>', $total );
|
138 |
-
$status_links[] = sprintf( '<a href="%s">%s %s</a>', $admin_url, $link_title, $counter );
|
139 |
-
|
140 |
-
return $status_links;
|
141 |
-
}
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
new \WBCR\Titan\Premium\Comments_List_Table_Extension();
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/includes/class-dashboard-widget.php
DELETED
@@ -1,218 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
// Exit if accessed directly
|
6 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
/**
|
11 |
-
* A widget to display spam statistics.
|
12 |
-
*
|
13 |
-
* The plugin receives statistics from a remote server, the server sends data for 7 days.
|
14 |
-
* This class inserts data into the Google chart and displays the chart in the widget.
|
15 |
-
*
|
16 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
17 |
-
*
|
18 |
-
* @since 1.1
|
19 |
-
* @copyright (c) 2019 Webcraftic Ltd
|
20 |
-
*/
|
21 |
-
class Dashboard_Widget {
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Request interval in hours
|
25 |
-
*
|
26 |
-
* @since 1.1
|
27 |
-
*/
|
28 |
-
const DEFAULT_REQUESTS_INTERVAL = 4;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Request interval in hours, if server is unavailable
|
32 |
-
*
|
33 |
-
* @since 1.1
|
34 |
-
*/
|
35 |
-
const SERVER_UNAVAILABLE_INTERVAL = 4;
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Statistic data
|
39 |
-
*
|
40 |
-
* @since 1.1
|
41 |
-
* @var \stdClass
|
42 |
-
*/
|
43 |
-
protected $statistic_data;
|
44 |
-
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Dashboard_Widget constructor.
|
48 |
-
*
|
49 |
-
* Call parent constructor. Registration hooks.
|
50 |
-
*
|
51 |
-
* @since 1.1 Added
|
52 |
-
*
|
53 |
-
* @param string $content
|
54 |
-
*/
|
55 |
-
public function __construct() {
|
56 |
-
$this->statistic_data = $this->get_statistic_data();
|
57 |
-
|
58 |
-
if ( is_wp_error( $this->statistic_data ) || empty( $this->statistic_data->stat ) ) {
|
59 |
-
return;
|
60 |
-
}
|
61 |
-
|
62 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_dashboard_widget_scripts' ] );
|
63 |
-
|
64 |
-
if ( \WBCR\Titan\Plugin::app()->isNetworkActive() && \WBCR\Titan\Plugin::app()->isNetworkAdmin() ) {
|
65 |
-
add_action( 'wp_network_dashboard_setup', [ $this, 'add_dashboard_widgets' ], 999 );
|
66 |
-
|
67 |
-
return;
|
68 |
-
}
|
69 |
-
|
70 |
-
add_action( 'wp_dashboard_setup', [ $this, 'add_dashboard_widgets' ], 999 );
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Enqueue google charts library
|
75 |
-
*
|
76 |
-
* @since 1.1
|
77 |
-
*/
|
78 |
-
public function enqueue_dashboard_widget_scripts( $page ) {
|
79 |
-
if ( 'index.php' !== $page ) {
|
80 |
-
return;
|
81 |
-
}
|
82 |
-
|
83 |
-
wp_enqueue_script( 'wantispam-google-chart', 'https://www.gstatic.com/charts/loader.js', false, WANTISPAMP_PLUGIN_VERSION, true );
|
84 |
-
|
85 |
-
ob_start();
|
86 |
-
?>
|
87 |
-
<!-- Google chart API-->
|
88 |
-
<script type="text/javascript">
|
89 |
-
(function() {
|
90 |
-
google.charts.load('current', {'packages': ['bar']});
|
91 |
-
google.charts.setOnLoadCallback(function() {
|
92 |
-
var data = google.visualization.arrayToDataTable([
|
93 |
-
['<?php _e( 'Date', 'titan-security' ) ?>', '<?php _e( 'Spam attack', 'titan-security' ) ?>'],
|
94 |
-
<?php foreach((array) $this->statistic_data->stat as $day => $number): ?>
|
95 |
-
['<?php echo date( "d.m", strtotime( $day ) ) ?>', <?php echo (int) $number ?>],
|
96 |
-
<?php endforeach; ?>
|
97 |
-
]);
|
98 |
-
|
99 |
-
var options = {
|
100 |
-
width: 370,
|
101 |
-
height: 300,
|
102 |
-
chart: {
|
103 |
-
title: '<?php _e( 'Plugin stopped spam attacks', 'titan-security' ) ?>',
|
104 |
-
subtitle: '<?php _e( 'Show statistics for 7 days', 'titan-security' ) ?>',
|
105 |
-
},
|
106 |
-
legend: {position: "none"}
|
107 |
-
};
|
108 |
-
|
109 |
-
var chart = new google.charts.Bar(document.getElementById('wantispam-chart-div'));
|
110 |
-
|
111 |
-
chart.draw(data, google.charts.Bar.convertOptions(options));
|
112 |
-
});
|
113 |
-
})();
|
114 |
-
</script>
|
115 |
-
<?php
|
116 |
-
$code = ob_get_clean();
|
117 |
-
$code = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $code ) );
|
118 |
-
wp_add_inline_script( 'wantispam-google-chart', $code );
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Add the News widget to the dashboard.
|
123 |
-
*
|
124 |
-
* @since 1.1 Added
|
125 |
-
*/
|
126 |
-
public function add_dashboard_widgets() {
|
127 |
-
$widget_id = 'wantispam-statistic';
|
128 |
-
|
129 |
-
wp_add_dashboard_widget( $widget_id, ' Anti-spam Pro statistic', [
|
130 |
-
$this,
|
131 |
-
'print_widget_content'
|
132 |
-
] );
|
133 |
-
|
134 |
-
$this->sort_dashboard_widgets( $widget_id );
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Create the function to output the contents of the Dashboard Widget.
|
139 |
-
*
|
140 |
-
* @since 1.1 Added
|
141 |
-
*/
|
142 |
-
public function print_widget_content() {
|
143 |
-
?>
|
144 |
-
<div class="wordpress-news hide-if-no-js">
|
145 |
-
<div class="rss-widget">
|
146 |
-
<div id="wantispam-chart-div"></div>
|
147 |
-
<p><?php printf( __( 'For all time using the plugin, %s spam attacks were stopped.', 'titan-security' ), '<strong style="color:red">' . (int) $this->statistic_data->total . '</strong>' ) ?></p>
|
148 |
-
</div>
|
149 |
-
</div>
|
150 |
-
<?php
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Sorts widgets on the dashboard page
|
156 |
-
*
|
157 |
-
* Our widget must be top than other.
|
158 |
-
*
|
159 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
160 |
-
* @author Alexander Vitkalov <nechin.va@gmail.com>
|
161 |
-
*
|
162 |
-
* @since 1.1
|
163 |
-
*
|
164 |
-
* @param string $widget_id Widget ID
|
165 |
-
*/
|
166 |
-
private function sort_dashboard_widgets( $widget_id ) {
|
167 |
-
global $wp_meta_boxes;
|
168 |
-
|
169 |
-
$location = \WBCR\Titan\Plugin::app()->isNetworkAdmin() ? 'dashboard-network' : 'dashboard';
|
170 |
-
|
171 |
-
$normal_core = $wp_meta_boxes[ $location ]['normal']['core'];
|
172 |
-
$widget_backup = [ $widget_id => $normal_core[ $widget_id ] ];
|
173 |
-
unset( $normal_core[ $widget_id ] );
|
174 |
-
$sorted_core = array_merge( $widget_backup, $normal_core );
|
175 |
-
|
176 |
-
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_core;
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Get data from cache.
|
181 |
-
*
|
182 |
-
* If data in the cache, not empty and not expired, then get data from cache. Or get data from server.
|
183 |
-
*
|
184 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
185 |
-
*
|
186 |
-
* @since 1.1
|
187 |
-
* @return mixed array
|
188 |
-
*/
|
189 |
-
private function get_statistic_data() {
|
190 |
-
$key = \WBCR\Titan\Plugin::app()->getPrefix() . 'stats_transient_';
|
191 |
-
|
192 |
-
$cached = get_transient( $key );
|
193 |
-
|
194 |
-
if ( $cached !== false ) {
|
195 |
-
if ( isset( $cached->error_code ) && isset( $cached->error ) ) {
|
196 |
-
return new \WP_Error( $cached->error_code, $cached->error );
|
197 |
-
}
|
198 |
-
|
199 |
-
return $cached;
|
200 |
-
}
|
201 |
-
|
202 |
-
$api = new \WBCR\Titan\Premium\Api\Request();
|
203 |
-
$data = $api->get_statistic( 7 );
|
204 |
-
|
205 |
-
if ( is_wp_error( $data ) ) {
|
206 |
-
set_transient( $key, (object) [
|
207 |
-
'error' => $data->get_error_message(),
|
208 |
-
'error_code' => $data->get_error_code()
|
209 |
-
], self::SERVER_UNAVAILABLE_INTERVAL * HOUR_IN_SECONDS );
|
210 |
-
|
211 |
-
return $data;
|
212 |
-
}
|
213 |
-
|
214 |
-
set_transient( $key, $data->response, self::DEFAULT_REQUESTS_INTERVAL * HOUR_IN_SECONDS );
|
215 |
-
|
216 |
-
return $data->response;
|
217 |
-
}
|
218 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/includes/class-users-list-table.php
DELETED
@@ -1,149 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The class extend Comments_List_Table
|
7 |
-
*
|
8 |
-
* Add new status tab and comments filter. We exclude from all list
|
9 |
-
* comments that haven't checked for spam yet.
|
10 |
-
*
|
11 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
12 |
-
*
|
13 |
-
* @copyright (c) 2018 Webraftic Ltd
|
14 |
-
*/
|
15 |
-
class Users_List_Table_Extension {
|
16 |
-
|
17 |
-
public function __construct() {
|
18 |
-
add_filter( 'users_list_table_query_args', function ( $args ) {
|
19 |
-
if ( empty( $args['role'] ) ) {
|
20 |
-
$args['role__not_in'] = [ 'spam_checking', 'spam' ];
|
21 |
-
}
|
22 |
-
|
23 |
-
return $args;
|
24 |
-
} );
|
25 |
-
|
26 |
-
add_action( 'restrict_manage_users', [ $this, 'add_empty_spam_button' ] );
|
27 |
-
add_action( 'current_screen', [ $this, 'empty_spam' ] );
|
28 |
-
add_filter( 'manage_users_columns', [ $this, 'register_new_column' ] );
|
29 |
-
add_action( 'manage_users_custom_column', [ $this, 'register_new_column_handler' ], 10, 3 );
|
30 |
-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Enqueue styles for "Manage users pages"
|
35 |
-
*
|
36 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
37 |
-
* @since 6.0
|
38 |
-
*
|
39 |
-
* @param string $hook Current page hook
|
40 |
-
*/
|
41 |
-
public function enqueue_scripts( $hook ) {
|
42 |
-
if ( "users.php" !== $hook ) {
|
43 |
-
return;
|
44 |
-
}
|
45 |
-
wp_enqueue_style( 'wantispam-manage-comments', WANTISPAMP_PLUGIN_URL . '/admin/assets/css/manage-comments.css' );
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Register a new column on the "Manage users page"
|
50 |
-
*
|
51 |
-
* Column need for showing a status check for spam.
|
52 |
-
*
|
53 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
54 |
-
* @since 6.0
|
55 |
-
*
|
56 |
-
* @param array $columns
|
57 |
-
*
|
58 |
-
* @return mixed
|
59 |
-
*/
|
60 |
-
public function register_new_column( $columns ) {
|
61 |
-
$columns['wantispam_spam_checking_status'] = __( 'Spam checking status' );
|
62 |
-
|
63 |
-
return $columns;
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Register a new column handler
|
68 |
-
*
|
69 |
-
* Errors and status is printed after the user checked.
|
70 |
-
*
|
71 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
72 |
-
* @since 6.0
|
73 |
-
*
|
74 |
-
* @param string $column_name
|
75 |
-
* @param int $comment_ID
|
76 |
-
*/
|
77 |
-
public function register_new_column_handler( $val, $column_name, $user_id ) {
|
78 |
-
if ( "wantispam_spam_checking_status" === $column_name ) {
|
79 |
-
$is_checked_comment = get_user_meta( $user_id, wantispamp_db_key( 'user_checked' ), true );
|
80 |
-
$error = get_user_meta( $user_id, wantispamp_db_key( 'spam_checking_fail' ), true );
|
81 |
-
|
82 |
-
if ( ! empty( $error ) ) {
|
83 |
-
return '<span class="wantispam-status-text wantispam-status-text--red">' . __( "Comment hasn't been checked for spam because of error:", 'titan-security' ) . ' ' . esc_html( $error ) . '</span>';
|
84 |
-
} else if ( $is_checked_comment ) {
|
85 |
-
return '<span class="wantispam-status-text wantispam-status-text--green">' . __( 'Successfully was checked for spam!', 'titan-security' ) . '</span>';
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
return $val;
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Add new button to users page in a filters line.
|
94 |
-
*
|
95 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
96 |
-
* @since 6.0
|
97 |
-
*/
|
98 |
-
public function add_empty_spam_button() {
|
99 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
if ( isset( $_GET['role'] ) && 'spam' === $_GET['role'] ):
|
103 |
-
$url = wp_nonce_url( admin_url( 'users.php?role=spam&wanspam_delete_all_spam' ), 'wanspam_delete_all_spam' );
|
104 |
-
?>
|
105 |
-
<a class="button button-default" href="<?php echo esc_url( $url ); ?>"><?php _e( 'Empty Spam', 'titan-security' ) ?></a>
|
106 |
-
<?php
|
107 |
-
endif;
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Clear all spam users.
|
112 |
-
*
|
113 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
114 |
-
* @since 6.0
|
115 |
-
*/
|
116 |
-
public function empty_spam() {
|
117 |
-
$current_screen = get_current_screen();
|
118 |
-
|
119 |
-
if ( ! empty( $current_screen ) && 'users' === $current_screen->id && isset( $_GET['wanspam_delete_all_spam'] ) ) {
|
120 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
121 |
-
wp_die( "You haven't permissions for make the action!" );
|
122 |
-
}
|
123 |
-
check_admin_referer( 'wanspam_delete_all_spam' );
|
124 |
-
|
125 |
-
$users = get_users( [
|
126 |
-
'role' => [ 'spam_checking', 'spam' ]
|
127 |
-
] );
|
128 |
-
|
129 |
-
if ( ! empty( $users ) ) {
|
130 |
-
foreach ( $users as $user ) {
|
131 |
-
wp_delete_user( $user->ID );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
new \WBCR\Titan\Premium\Users_List_Table_Extension();
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/includes/index.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by PhpStorm.
|
4 |
-
* User: admin
|
5 |
-
* Date: 11.02.2019
|
6 |
-
* Time: 16:36
|
7 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/admin/index.php
DELETED
File without changes
|
libs/antispam-premium/admin/pages/class-pages-settings.php
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Page;
|
4 |
-
|
5 |
-
//require_once WTITAN_PLUGIN_DIR. "admin/class-page-titan-basic.php";
|
6 |
-
|
7 |
-
// Exit if accessed directly
|
8 |
-
if( !defined('ABSPATH') ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Страница общих настроек для этого плагина.
|
14 |
-
*
|
15 |
-
* Не поддерживает режим работы с мультисаймами.
|
16 |
-
*
|
17 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
18 |
-
* @copyright (c) 2019 Webraftic Ltd
|
19 |
-
* @version 1.0
|
20 |
-
*/
|
21 |
-
class Progress extends \WBCR\Titan\Page\Base {
|
22 |
-
|
23 |
-
/**
|
24 |
-
* {@inheritdoc}
|
25 |
-
*/
|
26 |
-
public $id = 'progress';
|
27 |
-
|
28 |
-
/**
|
29 |
-
*
|
30 |
-
* @var string
|
31 |
-
*/
|
32 |
-
public $page_parent_page = 'none';
|
33 |
-
|
34 |
-
/**
|
35 |
-
* {@inheritDoc}
|
36 |
-
*
|
37 |
-
* @since 6.0
|
38 |
-
* @var bool
|
39 |
-
*/
|
40 |
-
public $show_right_sidebar_in_options = false;
|
41 |
-
|
42 |
-
public function __construct(\Wbcr_Factory458_Plugin $plugin)
|
43 |
-
{
|
44 |
-
$this->plugin = $plugin;
|
45 |
-
parent::__construct($plugin);
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Enqueue page assets
|
50 |
-
*
|
51 |
-
* @return void
|
52 |
-
* @since 1.0.0
|
53 |
-
* @see Wbcr_FactoryPages457_AdminPage
|
54 |
-
*
|
55 |
-
*/
|
56 |
-
public function assets($scripts, $styles)
|
57 |
-
{
|
58 |
-
parent::assets($scripts, $styles);
|
59 |
-
|
60 |
-
if( isset($_GET['action']) && "check-existing-comments" === $_GET['action'] ) {
|
61 |
-
$this->scripts->add(WANTISPAMP_PLUGIN_URL . '/admin/assets/js/check-existing-comments.js', [
|
62 |
-
'jquery'
|
63 |
-
]);
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
69 |
-
* @since 7.0.0
|
70 |
-
*/
|
71 |
-
public function checkExistingCommentsAction()
|
72 |
-
{
|
73 |
-
if( !current_user_can('manage_options') ) {
|
74 |
-
wp_die('You do not have permission to view page!');
|
75 |
-
}
|
76 |
-
|
77 |
-
check_admin_referer('wantispam_checking_unapproved_comments');
|
78 |
-
|
79 |
-
$count_comments = wantispamp_get_unchecked_comments_count();
|
80 |
-
|
81 |
-
if( !$count_comments ) {
|
82 |
-
$this->redirectToAction('index');
|
83 |
-
}
|
84 |
-
|
85 |
-
$wp_nonce = wp_create_nonce('waspam-check-existing-comments');
|
86 |
-
$redirect_url = admin_url('edit-comments.php?comment_status=spam_checking');
|
87 |
-
|
88 |
-
ob_start();
|
89 |
-
?>
|
90 |
-
<script type="application/javascript" src="<?= WANTISPAMP_PLUGIN_URL . '/admin/assets/js/check-existing-comments.js'; ?>"></script>
|
91 |
-
<style>
|
92 |
-
#wantispam-check-existing-comments {
|
93 |
-
padding: 30px;
|
94 |
-
}
|
95 |
-
|
96 |
-
#wantispam-check-existing-comments__progress-bar {
|
97 |
-
background-color: #f3f3f3;
|
98 |
-
border: 1px solid #cacaca;
|
99 |
-
width: 400px;
|
100 |
-
height: 30px;
|
101 |
-
}
|
102 |
-
|
103 |
-
.wantispam-check-existing-comments__left-comments {
|
104 |
-
display: none;
|
105 |
-
padding: 5px 0;
|
106 |
-
}
|
107 |
-
</style>
|
108 |
-
<div id="wantispam-check-existing-comments" data-step="<?php echo esc_attr(\WBCR\Titan\Plugin::COUNT_TO_CHECK) ?>" data-nonce="<?php echo esc_attr($wp_nonce); ?>" data-redirect-url="<?php echo esc_attr($redirect_url); ?>">
|
109 |
-
<h4><?php _e('Please wait! Checking comments...', 'titan-security') ?></h4>
|
110 |
-
<progress id="wantispam-check-existing-comments__progress-bar" value="0" max="100"></progress>
|
111 |
-
<div class="wantispam-check-existing-comments__left-comments"><?php printf(__('It remains to check %s comments.', 'titan-security'), '<span></span>'); ?></div>
|
112 |
-
</div>
|
113 |
-
<?php
|
114 |
-
|
115 |
-
$this->showPage(ob_get_clean());
|
116 |
-
}
|
117 |
-
|
118 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/anti-spam-premium.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Anti-spam premium
|
4 |
-
* Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
-
* Description: Premium addon for the Antispam plugin.
|
6 |
-
* Author: CreativeMotion <wordpress.webraftic@gmail.com>
|
7 |
-
* Version: 1.1.4
|
8 |
-
* Text Domain: anti-spam
|
9 |
-
* Domain Path: /languages/
|
10 |
-
* Author URI: http://anti-spam.space
|
11 |
-
*/
|
12 |
-
|
13 |
-
// @formatter:off
|
14 |
-
// Выход при непосредственном доступе
|
15 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
16 |
-
exit;
|
17 |
-
}
|
18 |
-
|
19 |
-
if ( ! function_exists( 'wantispamp_premium_load' ) ) {
|
20 |
-
|
21 |
-
function wantispamp_premium_load() {
|
22 |
-
|
23 |
-
# Если бесплатный плагин не установлен или вызвал ошибку, то прерываем выполнение кода
|
24 |
-
if ( ! defined( 'WTITAN_PLUGIN_ACTIVE' ) || defined( 'WTITAN_PLUGIN_THROW_ERROR' ) ) {
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
|
28 |
-
$plugin = \WBCR\Titan\Plugin::app();
|
29 |
-
|
30 |
-
# Если лицензия не активирована, то прерываем выполнение кода
|
31 |
-
if ( ! wantispam_is_license_activate() ) {
|
32 |
-
return;
|
33 |
-
}
|
34 |
-
|
35 |
-
// Устанавливаем контстанту, что плагин уже используется
|
36 |
-
define( 'WANTISPAMP_PLUGIN_ACTIVE', true );
|
37 |
-
|
38 |
-
// Устанавливаем контстанту c версией плагина
|
39 |
-
define( 'WANTISPAMP_PLUGIN_VERSION', '1.1.4' );
|
40 |
-
|
41 |
-
// Директория плагина
|
42 |
-
define( 'WANTISPAMP_PLUGIN_DIR', dirname( __FILE__ ) );
|
43 |
-
|
44 |
-
// Относительный путь к плагину
|
45 |
-
define( 'WANTISPAMP_PLUGIN_BASE', plugin_basename( __FILE__ ) );
|
46 |
-
|
47 |
-
// Ссылка к директории плагина
|
48 |
-
define( 'WANTISPAMP_PLUGIN_URL', plugins_url( null, __FILE__ ) );
|
49 |
-
|
50 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/function.php' );
|
51 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/class-request-api.php' );
|
52 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/class-forms-listener.php' );
|
53 |
-
|
54 |
-
// 3rd-party
|
55 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/3rd-party/class-extension.php' );
|
56 |
-
|
57 |
-
if ( $plugin->getPopulateOption( 'protect_contacts_form7' ) && is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
|
58 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/3rd-party/class-extention-contact-form7.php' );
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( $plugin->getPopulateOption( 'protect_ninja_forms' ) && is_plugin_active( 'ninja-forms/ninja-forms.php' ) ) {
|
62 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/3rd-party/class-extention-ninja-forms.php' );
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( $plugin->getPopulateOption( 'protect_caldera_forms' ) && is_plugin_active( 'caldera-forms/caldera-core.php' ) ) {
|
66 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/3rd-party/class-extention-caldera.php' );
|
67 |
-
}
|
68 |
-
|
69 |
-
$is_protect_comments_form = $plugin->getPopulateOption( 'protect_comments_form' );
|
70 |
-
$is_protect_register_form = $plugin->getPopulateOption( 'protect_register_form' );
|
71 |
-
|
72 |
-
if ( $is_protect_comments_form || $is_protect_register_form ) {
|
73 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/cron-schedules.php' );
|
74 |
-
|
75 |
-
if ( ! wp_next_scheduled( 'wantispamp_check_status_queue' ) ) {
|
76 |
-
wp_schedule_event( time(), 'five_minets', 'wantispamp_check_status_queue' );
|
77 |
-
\WBCR\Titan\Logger\Writter::info( "The cron event added for wantispamp_check_status_queue hook!" );
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/includes/plugin-rest-api.php' );
|
82 |
-
|
83 |
-
if ( is_admin() ) {
|
84 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/admin/pages/class-pages-settings.php' );
|
85 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/admin/includes/class-comments-list-table.php' );
|
86 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/admin/includes/class-users-list-table.php' );
|
87 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/admin/boot.php' );
|
88 |
-
|
89 |
-
// Rewrite free plugin settings page
|
90 |
-
$plugin->registerPage( 'WBCR\Titan\Page\Progress', WANTISPAMP_PLUGIN_DIR . '/admin/pages/class-pages-settings.php' );
|
91 |
-
}
|
92 |
-
|
93 |
-
if ( ! wp_doing_ajax() || ! isset( $_REQUEST['action'] ) ) {
|
94 |
-
return;
|
95 |
-
}
|
96 |
-
|
97 |
-
switch ( $_REQUEST['action'] ) {
|
98 |
-
case 'waspam-check-existing-comments':
|
99 |
-
require_once( WANTISPAMP_PLUGIN_DIR . '/admin/ajax/check-existing-comments.php' );
|
100 |
-
break;
|
101 |
-
}
|
102 |
-
}
|
103 |
-
wantispamp_premium_load();
|
104 |
-
//add_action( 'plugins_loaded', 'wantispamp_premium_load', 20 );
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Register activation hook
|
108 |
-
* @since 1.0.0
|
109 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
110 |
-
*/
|
111 |
-
function wantispamp_activate() {
|
112 |
-
# Если бесплатный плагин не установлен или вызвал ошибку, то прерываем выполнение кода
|
113 |
-
if ( ! defined( 'WTITAN_PLUGIN_ACTIVE' ) || defined( 'WTITAN_PLUGIN_THROW_ERROR' ) ) {
|
114 |
-
wp_die( 'The plugin CreativeMotion Anti-spam is not activated!' );
|
115 |
-
}
|
116 |
-
|
117 |
-
$log_message = "Premium plugin starts activation [START].\r\n";
|
118 |
-
|
119 |
-
\WBCR\Titan\Logger\Writter::info( $log_message );
|
120 |
-
|
121 |
-
if ( ! add_role( 'spam', __( 'Spam' ), [] ) ) {
|
122 |
-
\WBCR\Titan\Logger\Writter::warning( "Role spam is already exists!" );
|
123 |
-
}
|
124 |
-
if ( ! add_role( 'spam_checking', __( "Spam checking queue", 'titan-security' ), [] ) ) {
|
125 |
-
\WBCR\Titan\Logger\Writter::warning( "Role spam_checking is already exists!" );
|
126 |
-
}
|
127 |
-
|
128 |
-
\WBCR\Titan\Logger\Writter::info( "Roles have been created!" );
|
129 |
-
\WBCR\Titan\Logger\Writter::info( "Premium plugin has been activated [END]!" );
|
130 |
-
//register_uninstall_hook( __FILE__, 'wantispamp_uninstall' );
|
131 |
-
}
|
132 |
-
|
133 |
-
register_activation_hook( __FILE__, 'wantispamp_activate' );
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Register deactivation hook
|
137 |
-
* @since 1.0.0
|
138 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
139 |
-
*/
|
140 |
-
function wantispamp_deactivate() {
|
141 |
-
if ( wp_next_scheduled( 'wantispamp_check_status_queue' ) ) {
|
142 |
-
wp_unschedule_hook( 'wantispamp_check_status_queue' );
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
register_deactivation_hook( __FILE__, 'wantispamp_deactivate' );
|
147 |
-
|
148 |
-
// And here goes the uninstallation function:
|
149 |
-
/*function wantispamp_uninstall(){
|
150 |
-
// codes to perform during unistallation
|
151 |
-
}*/
|
152 |
-
}
|
153 |
-
|
154 |
-
|
155 |
-
// @formatter:on
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/3rd-party/class-extension.php
DELETED
@@ -1,351 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Base class for create integration
|
7 |
-
*
|
8 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
9 |
-
* @copyright (c) 19.12.2019, Webcraftic
|
10 |
-
* @version 1.0
|
11 |
-
*/
|
12 |
-
|
13 |
-
// Contact Form7
|
14 |
-
if ( ! defined( 'WPCF7_VERSION' ) ) {
|
15 |
-
return;
|
16 |
-
}
|
17 |
-
|
18 |
-
class Extension {
|
19 |
-
|
20 |
-
public function __construct() {
|
21 |
-
$this->plugin = \WBCR\Titan\Plugin::app();
|
22 |
-
$this->cm_api = new Api\Request();
|
23 |
-
|
24 |
-
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_script' ] );
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* We enqueue js script required for the plugin to work. The script overwrites the values
|
29 |
-
* of hidden fields or determines whether the user uses javascript or not.
|
30 |
-
*
|
31 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
32 |
-
* @since 1.1.1
|
33 |
-
*/
|
34 |
-
public function enqueue_script() {
|
35 |
-
wp_enqueue_script( 'anti-spam-script' );
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Inserts anti-spam hidden fields
|
40 |
-
*
|
41 |
-
* @param string $render_honeypot_fields
|
42 |
-
*
|
43 |
-
* @return string
|
44 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
45 |
-
* @since 1.1.1
|
46 |
-
*
|
47 |
-
*/
|
48 |
-
public function get_add_required_fields( $render_honeypot_fields = true ) {
|
49 |
-
return wantispam_get_required_fields( $render_honeypot_fields );
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Get the privacy related notice underneath the comment form.
|
54 |
-
*
|
55 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
56 |
-
* @since 1.1.1
|
57 |
-
*/
|
58 |
-
public function get_display_comment_form_privacy_notice() {
|
59 |
-
return wantispam_display_comment_form_privacy_notice();
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Print the privacy related notice underneath the comment form.
|
64 |
-
*/
|
65 |
-
public function print_display_comment_form_privacy_notice() {
|
66 |
-
wantispam_display_comment_form_privacy_notice( true );
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Gets honeypot fields.
|
71 |
-
*
|
72 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
73 |
-
* @since 1.1.1
|
74 |
-
*/
|
75 |
-
public function get_honeypot_fields() {
|
76 |
-
return wantispam_get_honeypot_fields();
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Checks spam by honeypot
|
81 |
-
*
|
82 |
-
* @return bool
|
83 |
-
* @since 1.1.1
|
84 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
85 |
-
*/
|
86 |
-
public function check_spam_by_honeypot() {
|
87 |
-
$spam_flag = false;
|
88 |
-
|
89 |
-
$antspm_q = $this->plugin->request->post( "wantispam_q", '', 'trim' );
|
90 |
-
$antspm_d = $this->plugin->request->post( "wantispam_d", '', 'trim' );
|
91 |
-
$antspm_e = $this->plugin->request->post( "wantispam_e_email_url_website", '', 'trim' );
|
92 |
-
|
93 |
-
if ( $antspm_q != date( 'Y' ) ) { // year-answer is wrong - it is spam
|
94 |
-
if ( $antspm_d != date( 'Y' ) ) { // extra js-only check: there is no js added input - it is spam
|
95 |
-
$spam_flag = true;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
if ( ! empty( $antspm_e ) ) { // trap field is not empty - it is spam
|
100 |
-
$spam_flag = true;
|
101 |
-
}
|
102 |
-
|
103 |
-
return $spam_flag;
|
104 |
-
}
|
105 |
-
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Changes CF7 status message
|
109 |
-
*
|
110 |
-
* @param string $hook URL of hooked page
|
111 |
-
*
|
112 |
-
* @since 1.1.1
|
113 |
-
*
|
114 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
115 |
-
*/
|
116 |
-
public function show_response() {
|
117 |
-
return __( 'Your message has been marked as spam!', 'titan-security' );
|
118 |
-
}
|
119 |
-
|
120 |
-
/*
|
121 |
-
* Get data from an ARRAY recursively
|
122 |
-
*
|
123 |
-
* @return array
|
124 |
-
*/
|
125 |
-
protected function get_fields_any( $arr, $message = [], $email = null, $nickname = [], $subject = null, $contact = true, $prev_name = '' ) {
|
126 |
-
if ( empty( $nickname ) ) {
|
127 |
-
$nickname = [
|
128 |
-
'nick' => '',
|
129 |
-
'first' => '',
|
130 |
-
'last' => ''
|
131 |
-
];
|
132 |
-
}
|
133 |
-
|
134 |
-
//Skip request if fields exists
|
135 |
-
$skip_params = [
|
136 |
-
'ipn_track_id', // PayPal IPN #
|
137 |
-
'txn_type', // PayPal transaction type
|
138 |
-
'payment_status', // PayPal payment status
|
139 |
-
'ccbill_ipn', // CCBill IPN
|
140 |
-
'wantispam_j', // skip wantispam-j field
|
141 |
-
'wantispam_t', // skip wantispam-j field
|
142 |
-
'api_mode', // DigiStore-API
|
143 |
-
'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
|
144 |
-
];
|
145 |
-
|
146 |
-
// Fields to replace with ****
|
147 |
-
$obfuscate_params = [
|
148 |
-
'password',
|
149 |
-
'pass',
|
150 |
-
'pwd',
|
151 |
-
'pswd'
|
152 |
-
];
|
153 |
-
|
154 |
-
// Skip feilds with these strings and known service fields
|
155 |
-
$skip_fields_with_strings = [
|
156 |
-
// Common
|
157 |
-
'wantispam_j', //Do not send wantispam-j
|
158 |
-
'wantispam_t', //Do not send wantispam-j
|
159 |
-
'nonce', //nonce for strings such as 'rsvp_nonce_name'
|
160 |
-
'security',
|
161 |
-
// 'action',
|
162 |
-
'http_referer',
|
163 |
-
'referer-page',
|
164 |
-
'timestamp',
|
165 |
-
'captcha',
|
166 |
-
// Formidable Form
|
167 |
-
'form_key',
|
168 |
-
'submit_entry',
|
169 |
-
// Custom Contact Forms
|
170 |
-
'form_id',
|
171 |
-
'ccf_form',
|
172 |
-
'form_page',
|
173 |
-
// Qu Forms
|
174 |
-
'iphorm_uid',
|
175 |
-
'form_url',
|
176 |
-
'post_id',
|
177 |
-
'iphorm_ajax',
|
178 |
-
'iphorm_id',
|
179 |
-
// Fast SecureContact Froms
|
180 |
-
'fs_postonce_1',
|
181 |
-
'fscf_submitted',
|
182 |
-
'mailto_id',
|
183 |
-
'si_contact_action',
|
184 |
-
// Ninja Forms
|
185 |
-
'formData_id',
|
186 |
-
'formData_settings',
|
187 |
-
'formData_fields_\d+_id',
|
188 |
-
'formData_fields_\d+_files.*',
|
189 |
-
// E_signature
|
190 |
-
'recipient_signature',
|
191 |
-
'output_\d+_\w{0,2}',
|
192 |
-
// Contact Form by Web-Settler protection
|
193 |
-
'_formId',
|
194 |
-
'_returnLink',
|
195 |
-
// Social login and more
|
196 |
-
'_save',
|
197 |
-
'_facebook',
|
198 |
-
'_social',
|
199 |
-
'user_login-',
|
200 |
-
// Contact Form 7
|
201 |
-
'_wpcf7',
|
202 |
-
'ebd_settings',
|
203 |
-
'ebd_downloads_',
|
204 |
-
'ecole_origine',
|
205 |
-
// Caldera Forms
|
206 |
-
'submit',
|
207 |
-
];
|
208 |
-
|
209 |
-
// Reset $message if we have a sign-up data
|
210 |
-
$skip_message_post = [
|
211 |
-
'edd_action', // Easy Digital Downloads
|
212 |
-
];
|
213 |
-
|
214 |
-
if ( wantispamp_array( [ $_POST, $_GET ] )->get_keys( $skip_params )->result() ) {
|
215 |
-
$contact = false;
|
216 |
-
}
|
217 |
-
|
218 |
-
if ( count( $arr ) ) {
|
219 |
-
foreach ( $arr as $key => $value ) {
|
220 |
-
if ( gettype( $value ) == 'string' ) {
|
221 |
-
$tmp = strpos( $value, '\\' ) !== false ? stripslashes( $value ) : $value;
|
222 |
-
$decoded_json_value = json_decode( $tmp, true );
|
223 |
-
|
224 |
-
// Decoding JSON
|
225 |
-
if ( $decoded_json_value !== null ) {
|
226 |
-
$value = $decoded_json_value;
|
227 |
-
|
228 |
-
// Ajax Contact Forms. Get data from such strings:
|
229 |
-
// acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
|
230 |
-
// acfw30_textarea %% msg
|
231 |
-
} else if ( preg_match( '/^\S+\s%%\s\S+.+$/', $value ) ) {
|
232 |
-
$value = explode( '~', $value );
|
233 |
-
foreach ( $value as &$val ) {
|
234 |
-
$tmp = explode( ' %% ', $val );
|
235 |
-
$val = [ $tmp[0] => $tmp[1] ];
|
236 |
-
}
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
if ( ! is_array( $value ) && ! is_object( $value ) ) {
|
241 |
-
|
242 |
-
if ( in_array( $key, $skip_params, true ) && $key != 0 && $key != '' || preg_match( "/^wantispam-(j|t)/", $key ) ) {
|
243 |
-
$contact = false;
|
244 |
-
}
|
245 |
-
|
246 |
-
if ( $value === '' ) {
|
247 |
-
continue;
|
248 |
-
}
|
249 |
-
|
250 |
-
// Skipping fields names with strings from (array)skip_fields_with_strings
|
251 |
-
foreach ( $skip_fields_with_strings as $needle ) {
|
252 |
-
if ( preg_match( "/" . $needle . "/", $prev_name . $key ) == 1 ) {
|
253 |
-
continue( 2 );
|
254 |
-
}
|
255 |
-
}
|
256 |
-
unset( $needle );
|
257 |
-
|
258 |
-
// Obfuscating params
|
259 |
-
foreach ( $obfuscate_params as $needle ) {
|
260 |
-
if ( strpos( $key, $needle ) !== false ) {
|
261 |
-
$value = wantispamp_obfuscate_param( $value );
|
262 |
-
continue( 2 );
|
263 |
-
}
|
264 |
-
}
|
265 |
-
unset( $needle );
|
266 |
-
|
267 |
-
// Removes whitespaces
|
268 |
-
$value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
|
269 |
-
$value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
|
270 |
-
|
271 |
-
// Email
|
272 |
-
if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
|
273 |
-
$email = $value_for_email;
|
274 |
-
// Names
|
275 |
-
} else if ( preg_match( "/name/i", $key ) ) {
|
276 |
-
|
277 |
-
preg_match( "/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename );
|
278 |
-
preg_match( "/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname );
|
279 |
-
preg_match( "/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname );
|
280 |
-
|
281 |
-
if ( count( $match_forename ) > 1 ) {
|
282 |
-
$nickname['first'] = $value;
|
283 |
-
} else if ( count( $match_surname ) > 1 ) {
|
284 |
-
$nickname['last'] = $value;
|
285 |
-
} else if ( count( $match_nickname ) > 1 ) {
|
286 |
-
$nickname['nick'] = $value;
|
287 |
-
} else {
|
288 |
-
$message[ $prev_name . $key ] = $value;
|
289 |
-
}
|
290 |
-
// Subject
|
291 |
-
} else if ( $subject === null && preg_match( "/subject/i", $key ) ) {
|
292 |
-
$subject = $value;
|
293 |
-
// Message
|
294 |
-
} else {
|
295 |
-
$message[ $prev_name . $key ] = $value;
|
296 |
-
}
|
297 |
-
} else if ( ! is_object( $value ) ) {
|
298 |
-
|
299 |
-
$prev_name_original = $prev_name;
|
300 |
-
$prev_name = ( $prev_name === '' ? $key . '_' : $prev_name . $key . '_' );
|
301 |
-
|
302 |
-
$temp = $this->get_fields_any( $value, $message, $email, $nickname, $subject, $contact, $prev_name );
|
303 |
-
|
304 |
-
$message = $temp['message'];
|
305 |
-
$email = ( $temp['email'] ? $temp['email'] : null );
|
306 |
-
$nickname = ( $temp['nickname'] ? $temp['nickname'] : null );
|
307 |
-
$subject = ( $temp['subject'] ? $temp['subject'] : null );
|
308 |
-
if ( $contact === true ) {
|
309 |
-
$contact = ( $temp['contact'] === false ? false : true );
|
310 |
-
}
|
311 |
-
$prev_name = $prev_name_original;
|
312 |
-
}
|
313 |
-
}
|
314 |
-
unset( $key, $value );
|
315 |
-
}
|
316 |
-
|
317 |
-
foreach ( $skip_message_post as $v ) {
|
318 |
-
if ( isset( $_POST[ $v ] ) ) {
|
319 |
-
$message = null;
|
320 |
-
break;
|
321 |
-
}
|
322 |
-
}
|
323 |
-
unset( $v );
|
324 |
-
|
325 |
-
//If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
|
326 |
-
if ( $prev_name === '' ) {
|
327 |
-
if ( ! empty( $nickname ) ) {
|
328 |
-
$nickname_str = '';
|
329 |
-
foreach ( $nickname as $value ) {
|
330 |
-
$nickname_str .= ( $value ? $value . " " : "" );
|
331 |
-
}
|
332 |
-
unset( $value );
|
333 |
-
}
|
334 |
-
$nickname = $nickname_str;
|
335 |
-
}
|
336 |
-
|
337 |
-
$return_param = [
|
338 |
-
'email' => $email,
|
339 |
-
'nickname' => $nickname,
|
340 |
-
'subject' => $subject,
|
341 |
-
'contact' => $contact,
|
342 |
-
'message' => $message
|
343 |
-
];
|
344 |
-
|
345 |
-
return $return_param;
|
346 |
-
}
|
347 |
-
}
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|