Version Description
Download this release
Release Info
Developer | alexkovalevv |
Plugin | Anti-spam |
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/3rd-party/class-extention-caldera.php
DELETED
@@ -1,135 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
use Caldera_Forms;
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Caldera Forms plugin integration
|
9 |
-
*
|
10 |
-
* It stops spam in the Caldera Forms plugin.
|
11 |
-
*
|
12 |
-
* @author Artem Prihodko <webtemyk@yandex.ru>, Github: https://github.com/temyk
|
13 |
-
* @copyright (c) 26.12.2019, Webcraftic
|
14 |
-
* @version 1.0
|
15 |
-
*/
|
16 |
-
|
17 |
-
if ( ! defined( 'CFCORE_VER' ) ) {
|
18 |
-
return;
|
19 |
-
}
|
20 |
-
|
21 |
-
class Caldera extends Extension {
|
22 |
-
|
23 |
-
/**
|
24 |
-
* {@inheritDoc}
|
25 |
-
*
|
26 |
-
* @since 1.1.1
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
protected $prefix = 'caldera';
|
30 |
-
|
31 |
-
public function __construct() {
|
32 |
-
parent::__construct();
|
33 |
-
|
34 |
-
add_filter( 'caldera_forms_render_form', [ $this, 'form_elements' ], 10, 2 );
|
35 |
-
|
36 |
-
//Register processor for Caldera
|
37 |
-
add_filter( 'caldera_forms_get_form_processors', [ $this, 'add_processor' ], 10, 1 );
|
38 |
-
}
|
39 |
-
|
40 |
-
function add_processor( $processors ) {
|
41 |
-
$processors['anti-spam-processor'] = array(
|
42 |
-
'name' => 'Anti-Spam',
|
43 |
-
'description' => 'Check Caldera Forms Data to spam',
|
44 |
-
'pre_processor' => [ $this, 'check_spam' ],
|
45 |
-
"template" => CFCORE_PATH . "processors/akismet/config.php",
|
46 |
-
"single" => false,
|
47 |
-
);
|
48 |
-
|
49 |
-
return $processors;
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @param string $output
|
54 |
-
*
|
55 |
-
* @return string
|
56 |
-
* @since 1.1.1
|
57 |
-
*
|
58 |
-
*/
|
59 |
-
public function form_elements( $out, $form ) {
|
60 |
-
|
61 |
-
$fields = $this->get_add_required_fields( false ) . $this->get_display_comment_form_privacy_notice();
|
62 |
-
$out = str_replace( "</form>", $fields . "</form>", $out );
|
63 |
-
|
64 |
-
return $out;
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Test message for spam
|
69 |
-
*
|
70 |
-
* @param array $config
|
71 |
-
* @param array $form_data
|
72 |
-
* @param int $process_id
|
73 |
-
*
|
74 |
-
* @return array|void
|
75 |
-
* @since 1.1.1
|
76 |
-
*
|
77 |
-
*/
|
78 |
-
public function check_spam( $config, $form, $process_id ) {
|
79 |
-
|
80 |
-
// is js support?
|
81 |
-
$is_js_enable = \WBCR\Titan\Plugin::app()->request->post( "wantispam_d" );
|
82 |
-
|
83 |
-
$start_form_filling = (int) \WBCR\Titan\Plugin::app()->request->post( "wantispam_t", 0 );
|
84 |
-
$start_form_filling = time() - $start_form_filling;
|
85 |
-
|
86 |
-
$author = Caldera_Forms::do_magic_tags( $config['sender_name'] );
|
87 |
-
$email = Caldera_Forms::do_magic_tags( $config['sender_email'] );
|
88 |
-
$url = Caldera_Forms::do_magic_tags( $config['url'] );
|
89 |
-
$message = Caldera_Forms::do_magic_tags( $config['content'] );
|
90 |
-
|
91 |
-
$items = [
|
92 |
-
[
|
93 |
-
'uid' => wantispamp_generate_uid(),
|
94 |
-
'email' => $email,
|
95 |
-
'ip' => wantispamp_get_ip(),
|
96 |
-
'text' => $message,
|
97 |
-
'username' => $author,
|
98 |
-
'url' => $url,
|
99 |
-
'headers' => wantispamp_get_all_headers(),
|
100 |
-
'referrer' => $_SERVER['HTTP_REFERER'],
|
101 |
-
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
102 |
-
'js_on' => $is_js_enable,
|
103 |
-
'submit_time' => $start_form_filling,
|
104 |
-
'without_queue' => true
|
105 |
-
]
|
106 |
-
];
|
107 |
-
|
108 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Prepared params to send: %s", var_export( $items, true ) ) );
|
109 |
-
|
110 |
-
$request = $this->cm_api->check_spam( $items );
|
111 |
-
|
112 |
-
if ( ! is_wp_error( $request ) && $items[0]['uid'] === $request->response[0]->uid ) {
|
113 |
-
$spam = ( 'done' === $request->response[0]->status ) ? wantispamp_normalize_bool( $request->response[0]->spam ) : false;
|
114 |
-
|
115 |
-
if ( true === $spam ) {
|
116 |
-
\WBCR\Titan\Logger\Writter::warning( 'Message marked as spam! ' );
|
117 |
-
|
118 |
-
return array(
|
119 |
-
'note' => 'Message marked as spam! ',
|
120 |
-
'type' => 'error'
|
121 |
-
);
|
122 |
-
}
|
123 |
-
} else {
|
124 |
-
\WBCR\Titan\Logger\Writter::error( $request->get_error_message() );
|
125 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Server responsed: %s", var_export( $request, true ) ) );
|
126 |
-
}
|
127 |
-
|
128 |
-
\WBCR\Titan\Logger\Writter::info( "Stops check spam for Caldera Forms [PROCESS END]." );
|
129 |
-
|
130 |
-
return;
|
131 |
-
}
|
132 |
-
|
133 |
-
}
|
134 |
-
|
135 |
-
new Caldera();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/3rd-party/class-extention-contact-form7.php
DELETED
@@ -1,131 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Contact form 7 plugin integration
|
7 |
-
*
|
8 |
-
* It stops spam in the contact forms of the CF7 plugin.
|
9 |
-
*
|
10 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
11 |
-
* @copyright (c) 19.12.2019, Webcraftic
|
12 |
-
* @version 1.0
|
13 |
-
*/
|
14 |
-
|
15 |
-
// Contact Form7
|
16 |
-
if ( ! defined( 'WPCF7_VERSION' ) ) {
|
17 |
-
return;
|
18 |
-
}
|
19 |
-
|
20 |
-
class Contact_Form7 extends Extension {
|
21 |
-
|
22 |
-
public function __construct() {
|
23 |
-
parent::__construct();
|
24 |
-
|
25 |
-
add_filter( 'wpcf7_form_elements', [ $this, 'form_elements' ] );
|
26 |
-
add_filter( WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', [ $this, 'check_spam' ] );
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
31 |
-
* @since 1.1.1
|
32 |
-
*
|
33 |
-
* @param string $output
|
34 |
-
*
|
35 |
-
* @return string
|
36 |
-
*/
|
37 |
-
public function form_elements( $output ) {
|
38 |
-
if ( is_user_logged_in() ) {
|
39 |
-
return $output;
|
40 |
-
}
|
41 |
-
|
42 |
-
$output .= $this->get_add_required_fields();
|
43 |
-
$output .= $this->get_display_comment_form_privacy_notice();
|
44 |
-
|
45 |
-
return $output;
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Test CF7 message for spam
|
50 |
-
*
|
51 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
52 |
-
* @since 1.1.1
|
53 |
-
*
|
54 |
-
* @param bool $param
|
55 |
-
*
|
56 |
-
* @return bool
|
57 |
-
*/
|
58 |
-
public function check_spam( $param ) {
|
59 |
-
if ( is_user_logged_in() ) {
|
60 |
-
return $param;
|
61 |
-
}
|
62 |
-
|
63 |
-
\WBCR\Titan\Logger\Writter::info( "Starts check spam for Contact form 7 [PROCESS START]." );
|
64 |
-
|
65 |
-
if ( $this->check_spam_by_honeypot() ) {
|
66 |
-
return WPCF7_VERSION >= '3.0.0' ? true : false;
|
67 |
-
}
|
68 |
-
|
69 |
-
// is js support?
|
70 |
-
$is_js_enable = \WBCR\Titan\Plugin::app()->request->post( "wantispam_d" );
|
71 |
-
|
72 |
-
$start_form_filling = (int) \WBCR\Titan\Plugin::app()->request->post( "wantispam_t", 0 );
|
73 |
-
$start_form_filling = time() - $start_form_filling;
|
74 |
-
|
75 |
-
$temp_msg_data = $this->get_fields_any( $_POST );
|
76 |
-
|
77 |
-
$sender_email = ( $temp_msg_data['email'] ? $temp_msg_data['email'] : '' );
|
78 |
-
$sender_nickname = ( $temp_msg_data['nickname'] ? $temp_msg_data['nickname'] : '' );
|
79 |
-
$subject = ( $temp_msg_data['subject'] ? $temp_msg_data['subject'] : '' );
|
80 |
-
//$contact_form = ( $temp_msg_data['contact'] ? $temp_msg_data['contact'] : true );
|
81 |
-
$message = ( $temp_msg_data['message'] ? $temp_msg_data['message'] : [] );
|
82 |
-
|
83 |
-
if ( $subject != '' ) {
|
84 |
-
$message['subject'] = $subject;
|
85 |
-
}
|
86 |
-
|
87 |
-
$items = [
|
88 |
-
[
|
89 |
-
'uid' => wantispamp_generate_uid(), // todo: удалить после фикса бага на сервере
|
90 |
-
'email' => $sender_email,
|
91 |
-
'ip' => wantispamp_get_ip(),
|
92 |
-
'text' => $message,
|
93 |
-
'username' => $sender_nickname,
|
94 |
-
'headers' => wantispamp_get_all_headers(),
|
95 |
-
'referrer' => $_SERVER['HTTP_REFERER'],
|
96 |
-
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
97 |
-
'js_on' => date( 'Y' ) == $is_js_enable,
|
98 |
-
'submit_time' => $start_form_filling,
|
99 |
-
'without_queue' => true
|
100 |
-
]
|
101 |
-
];
|
102 |
-
|
103 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Prepared params to send: %s", var_export( $items, true ) ) );
|
104 |
-
|
105 |
-
$request = $this->cm_api->check_spam( $items );
|
106 |
-
|
107 |
-
if ( ! is_wp_error( $request ) && $items[0]['uid'] === $request->response[0]->uid ) {
|
108 |
-
$spam = ( 'done' === $request->response[0]->status ) ? wantispamp_normalize_bool( $request->response[0]->spam ) : false;
|
109 |
-
|
110 |
-
if ( true === $spam ) {
|
111 |
-
add_filter( 'wpcf7_display_message', 'show_response', 10, 2 );
|
112 |
-
$param = WPCF7_VERSION >= '3.0.0' ? true : false;
|
113 |
-
\WBCR\Titan\Logger\Writter::warning( 'Message marked as spam! ' );
|
114 |
-
}
|
115 |
-
} else {
|
116 |
-
\WBCR\Titan\Logger\Writter::error( $request->get_error_message() );
|
117 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Server responsed: %s", var_export( $request, true ) ) );
|
118 |
-
}
|
119 |
-
|
120 |
-
\WBCR\Titan\Logger\Writter::info( "Stops check spam for Contact form 7 [PROCESS END]." );
|
121 |
-
|
122 |
-
return $param;
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
-
new Contact_Form7();
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/3rd-party/class-extention-ninja-forms.php
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Ninja Forms plugin integration
|
7 |
-
*
|
8 |
-
* It stops spam in the Ninja Forms plugin.
|
9 |
-
*
|
10 |
-
* @author Artem Prihodko <webtemyk@yandex.ru>, Github: https://github.com/temyk
|
11 |
-
* @copyright (c) 24.12.2019, Webcraftic
|
12 |
-
* @version 1.0
|
13 |
-
*/
|
14 |
-
|
15 |
-
if ( ! class_exists( 'Ninja_Forms' ) ) {
|
16 |
-
return;
|
17 |
-
}
|
18 |
-
|
19 |
-
class Ninja_Forms extends Extension {
|
20 |
-
|
21 |
-
public function __construct() {
|
22 |
-
parent::__construct();
|
23 |
-
|
24 |
-
add_filter( 'ninja_forms_display_after_fields', [ $this, 'form_elements' ], 10, 2 );
|
25 |
-
add_filter( 'ninja_forms_submit_data', [ $this, 'check_spam' ], 10, 1 );
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @since 1.1.1
|
30 |
-
*
|
31 |
-
* @param string $output
|
32 |
-
*
|
33 |
-
* @return string
|
34 |
-
*/
|
35 |
-
public function form_elements( $is_preview, $form_id ) {
|
36 |
-
return $this->get_display_comment_form_privacy_notice();
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Test message for spam
|
41 |
-
*
|
42 |
-
* @since 1.1.1
|
43 |
-
*
|
44 |
-
* @param array $form_data
|
45 |
-
*
|
46 |
-
* @return array
|
47 |
-
*/
|
48 |
-
public function check_spam( $form_data ) {
|
49 |
-
|
50 |
-
$form_data = $this->convert_data_to_array( $form_data );
|
51 |
-
\WBCR\Titan\Logger\Writter::info( "Starts check spam for Ninja Forms [PROCESS START]." );
|
52 |
-
|
53 |
-
$temp_msg_data = $this->get_fields_any( $form_data );
|
54 |
-
|
55 |
-
$sender_email = ( $temp_msg_data['email'] ? $temp_msg_data['email'] : '' );
|
56 |
-
$sender_nickname = ( $temp_msg_data['nickname'] ? $temp_msg_data['nickname'] : '' );
|
57 |
-
$subject = ( $temp_msg_data['subject'] ? $temp_msg_data['subject'] : '' );
|
58 |
-
$message = ( $temp_msg_data['message'] ? $temp_msg_data['message'] : [] );
|
59 |
-
|
60 |
-
if ( $subject != '' ) {
|
61 |
-
$message['subject'] = $subject;
|
62 |
-
}
|
63 |
-
|
64 |
-
$items = [
|
65 |
-
[
|
66 |
-
'uid' => wantispamp_generate_uid(),
|
67 |
-
'email' => $sender_email,
|
68 |
-
'ip' => wantispamp_get_ip(),
|
69 |
-
'text' => $message,
|
70 |
-
'username' => $sender_nickname,
|
71 |
-
'headers' => wantispamp_get_all_headers(),
|
72 |
-
'referrer' => $_SERVER['HTTP_REFERER'],
|
73 |
-
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
74 |
-
//'js_on' => $is_js_enable,
|
75 |
-
//'submit_time' => $start_form_filling,
|
76 |
-
//Считаем что JS включен и время заплнения формы достаточное
|
77 |
-
'js_on' => true,
|
78 |
-
'submit_time' => 9999999,
|
79 |
-
'without_queue' => true
|
80 |
-
]
|
81 |
-
];
|
82 |
-
|
83 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Prepared params to send: %s", var_export( $items, true ) ) );
|
84 |
-
|
85 |
-
$request = $this->cm_api->check_spam( $items );
|
86 |
-
|
87 |
-
if ( ! is_wp_error( $request ) && $items[0]['uid'] === $request->response[0]->uid ) {
|
88 |
-
$spam = ( 'done' === $request->response[0]->status ) ? wantispamp_normalize_bool( $request->response[0]->spam ) : false;
|
89 |
-
|
90 |
-
if ( true === $spam ) {
|
91 |
-
\WBCR\Titan\Logger\Writter::warning( 'Message marked as spam! ' );
|
92 |
-
|
93 |
-
//Don't save submission
|
94 |
-
add_filter( 'ninja_forms_run_action_type_save', '__return_false' );
|
95 |
-
//Don't email about spam
|
96 |
-
add_filter( 'ninja_forms_run_action_type_email', '__return_false' );
|
97 |
-
}
|
98 |
-
} else {
|
99 |
-
\WBCR\Titan\Logger\Writter::error( $request->get_error_message() );
|
100 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Server responsed: %s", var_export( $request, true ) ) );
|
101 |
-
}
|
102 |
-
|
103 |
-
\WBCR\Titan\Logger\Writter::info( "Stops check spam for Ninja Forms [PROCESS END]." );
|
104 |
-
|
105 |
-
return $form_data;
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Convert $form_data to array(key => value)
|
110 |
-
*
|
111 |
-
* @since 1.1.1
|
112 |
-
*
|
113 |
-
* @param array $form_data
|
114 |
-
*
|
115 |
-
* @return array
|
116 |
-
*/
|
117 |
-
public function convert_data_to_array( $form_data ) {
|
118 |
-
$result = [];
|
119 |
-
foreach ( $form_data['fields'] as $field ) {
|
120 |
-
$result[ $field['key'] ] = $field['value'];
|
121 |
-
}
|
122 |
-
|
123 |
-
return $result;
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
new Ninja_Forms();
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/class-array.php
DELETED
@@ -1,234 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
*
|
7 |
-
* @author Webcraftic <wordpress.webraftic@gmail.com>, Alexander Kovalev <alex.kovalevv@gmail.com>
|
8 |
-
* @copyright (c) 20.12.2019, Webcraftic
|
9 |
-
* @version 1.0
|
10 |
-
*/
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class Arr
|
14 |
-
* Fluent Interface
|
15 |
-
* Allows to work with multi dimensional arrays
|
16 |
-
*
|
17 |
-
* @package Cleantalk
|
18 |
-
*/
|
19 |
-
class Arr {
|
20 |
-
|
21 |
-
private $array = [];
|
22 |
-
private $found = [];
|
23 |
-
private $result = [];
|
24 |
-
|
25 |
-
public function __construct( $array ) {
|
26 |
-
$this->array = is_array( $array ) ? $array : [];
|
27 |
-
|
28 |
-
return $this;
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Recursive
|
33 |
-
* Check if Array has keys given keys
|
34 |
-
* Save found keys in $this->found
|
35 |
-
*
|
36 |
-
* @param array|string $keys
|
37 |
-
* @param bool $regexp
|
38 |
-
* @param array $array
|
39 |
-
*
|
40 |
-
* @return Arr
|
41 |
-
*/
|
42 |
-
public function get_keys( $keys = [], $regexp = false, $array = [] ) {
|
43 |
-
$array = $array ? $array : $this->array;
|
44 |
-
$keys = is_array( $keys ) ? $keys : explode( ',', $keys );
|
45 |
-
|
46 |
-
if ( empty( $array ) || empty( $keys ) ) {
|
47 |
-
return $this;
|
48 |
-
}
|
49 |
-
|
50 |
-
$this->found = $keys === [ 'all' ] ? $this->array : $this->search( 'key', $array, $keys, $regexp );
|
51 |
-
|
52 |
-
return $this;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Recursive
|
57 |
-
* Check if Array has valuse given valuse
|
58 |
-
* Save found keys in $this->found
|
59 |
-
*
|
60 |
-
* @param array|string $values
|
61 |
-
* @param bool $regexp
|
62 |
-
* @param array $array
|
63 |
-
*
|
64 |
-
* @return $this
|
65 |
-
*/
|
66 |
-
public function get_values( $values = [], $regexp = false, $array = [] ) {
|
67 |
-
$array = $array ? $array : $this->array;
|
68 |
-
$keys = is_array( $values ) ? $values : explode( ',', $values );
|
69 |
-
|
70 |
-
if ( empty( $array ) || empty( $values ) ) {
|
71 |
-
return $this;
|
72 |
-
}
|
73 |
-
|
74 |
-
$this->found = $values === [ 'all' ] ? $this->array : $this->search( 'value', $array, $keys, $regexp );
|
75 |
-
|
76 |
-
return $this;
|
77 |
-
}
|
78 |
-
|
79 |
-
public function get_array( $searched = [], $regexp = false, $array = [] ) {
|
80 |
-
|
81 |
-
$array = $array ? $array : $this->array;
|
82 |
-
|
83 |
-
if ( empty( $array ) || empty( $searched ) ) {
|
84 |
-
return $this;
|
85 |
-
}
|
86 |
-
|
87 |
-
$this->found = $searched === [ 'all' ] ? $this->array : $this->search( 'array', $array, $searched, $regexp );
|
88 |
-
|
89 |
-
$this->found = $this->found === $searched ? $this->found : [];
|
90 |
-
|
91 |
-
return $this;
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Recursive
|
96 |
-
* Check if array contains wanted data type
|
97 |
-
*
|
98 |
-
* @param string $type
|
99 |
-
* @param array $array
|
100 |
-
* @param array $found
|
101 |
-
*
|
102 |
-
* @return bool|void
|
103 |
-
*/
|
104 |
-
public function is( $type, $array = [], $found = [] ) {
|
105 |
-
$array = $array ? $array : $this->array;
|
106 |
-
$found = $found ? $found : $this->found;
|
107 |
-
|
108 |
-
foreach ( $array as $key => $value ) {
|
109 |
-
|
110 |
-
if ( array_key_exists( $key, $found ) ) {
|
111 |
-
if ( is_array( $found[ $key ] ) ) {
|
112 |
-
if ( ! $this->is( $type, $value, $found[ $key ] ) ) {
|
113 |
-
return false;
|
114 |
-
}
|
115 |
-
} else {
|
116 |
-
switch ( $type ) {
|
117 |
-
case 'regexp':
|
118 |
-
$value = preg_match( '/\/.*\//', $value ) === 1 ? $value : '/' . $value . '/';
|
119 |
-
if ( @preg_match( $value, null ) === false ) {
|
120 |
-
return false;
|
121 |
-
}
|
122 |
-
break;
|
123 |
-
}
|
124 |
-
}
|
125 |
-
}
|
126 |
-
}
|
127 |
-
|
128 |
-
return true;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* @param string $type
|
133 |
-
* @param array $array
|
134 |
-
* @param array $searched
|
135 |
-
* @param bool $regexp
|
136 |
-
* @param array $found
|
137 |
-
*
|
138 |
-
* @return array
|
139 |
-
*/
|
140 |
-
private function search( $type, $array = [], $searched = [], $regexp = false, $found = [] ) {
|
141 |
-
foreach ( $array as $key => $value ) {
|
142 |
-
|
143 |
-
// Recursion
|
144 |
-
if ( is_array( $value ) ) {
|
145 |
-
$result = $this->search( $type, $value, $searched, $regexp, [] );
|
146 |
-
if ( $result ) {
|
147 |
-
$found[ $key ] = $result;
|
148 |
-
}
|
149 |
-
// Execution
|
150 |
-
} else {
|
151 |
-
foreach ( $searched as $searched_key => $searched_val ) {
|
152 |
-
switch ( $type ) {
|
153 |
-
case 'key':
|
154 |
-
if ( $key === $searched_val || ( $regexp && preg_match( '/' . $searched_val . '/', $key ) === 1 ) ) {
|
155 |
-
$found[ $key ] = true;
|
156 |
-
}
|
157 |
-
break;
|
158 |
-
case 'value':
|
159 |
-
if ( stripos( $value, $searched_val ) !== false || ( $regexp && preg_match( '/' . $searched_val . '/', $value ) === 1 ) ) {
|
160 |
-
$found[ $key ] = true;
|
161 |
-
}
|
162 |
-
break;
|
163 |
-
case 'array':
|
164 |
-
if ( stripos( $key, $searched_key ) !== false || ( $regexp && preg_match( '/' . $searched_key . '/', $key ) === 1 ) ) {
|
165 |
-
if ( is_array( $value ) && is_array( $value ) ) {
|
166 |
-
$result = $this->search( 'array', $value, $searched_key, $regexp, [] );
|
167 |
-
if ( $result ) {
|
168 |
-
$found[ $key ] = $result;
|
169 |
-
}
|
170 |
-
} else {
|
171 |
-
$found[ $key ] = $value;
|
172 |
-
}
|
173 |
-
}
|
174 |
-
break;
|
175 |
-
}
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
return $found;
|
181 |
-
}
|
182 |
-
|
183 |
-
public function compare( $arr1, $arr2 ) {
|
184 |
-
// $arr1 = is_array( $arr1 ) ? $arr1 : array();
|
185 |
-
// $arr2 = is_array( $arr2 ) ? $arr2 : array();
|
186 |
-
foreach ( $arr1 as $key1 => $val1 ) {
|
187 |
-
if ( $arr1 === $arr2 ) {
|
188 |
-
if ( is_array( $arr1 ) && is_array( $arr2 ) ) {
|
189 |
-
$result = $this->compare( $arr1, $arr2 );
|
190 |
-
}
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Recursive
|
197 |
-
* Delete elements from array with found keys ( $this->found )
|
198 |
-
* If $searched param is differ from 'arr_special_param'
|
199 |
-
*
|
200 |
-
* @param mixed $searched
|
201 |
-
* @param array $array
|
202 |
-
* @param array $found
|
203 |
-
*
|
204 |
-
* @return array
|
205 |
-
*/
|
206 |
-
public function delete( $searched = 'arr_special_param', $array = [], $found = [] ) {
|
207 |
-
$array = $array ? $array : $this->array;
|
208 |
-
$found = $found ? $found : $this->found;
|
209 |
-
|
210 |
-
foreach ( $array as $key => $value ) {
|
211 |
-
|
212 |
-
if ( array_key_exists( $key, $found ) ) {
|
213 |
-
if ( is_array( $found[ $key ] ) ) {
|
214 |
-
$array[ $key ] = $this->delete( $searched, $value, $found[ $key ] );
|
215 |
-
if ( empty( $array[ $key ] ) ) {
|
216 |
-
unset( $array[ $key ] );
|
217 |
-
}
|
218 |
-
} else {
|
219 |
-
if ( $searched === 'arr_special_param' || $searched === $value ) {
|
220 |
-
unset( $array[ $key ] );
|
221 |
-
}
|
222 |
-
}
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
$this->result = $array;
|
227 |
-
|
228 |
-
return $array;
|
229 |
-
}
|
230 |
-
|
231 |
-
public function result() {
|
232 |
-
return (boolean) $this->found;
|
233 |
-
}
|
234 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/class-forms-listener.php
DELETED
@@ -1,191 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The class implement some protections ways against spam
|
7 |
-
*
|
8 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
9 |
-
*
|
10 |
-
* @copyright (c) 2018 Webraftic Ltd
|
11 |
-
*/
|
12 |
-
class Listener {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* CreativeMotion API wrapper
|
16 |
-
*
|
17 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
18 |
-
* @since 6.0
|
19 |
-
* @var \WBCR\Titan\Premium\Api\Request
|
20 |
-
*/
|
21 |
-
protected $cm_api;
|
22 |
-
|
23 |
-
public function __construct() {
|
24 |
-
$this->cm_api = new Api\Request();
|
25 |
-
|
26 |
-
if ( ! is_admin() && \WBCR\Titan\Plugin::app()->getPopulateOption( 'protect_comments_form' ) ) { // without this check it is not possible to add comment in admin section
|
27 |
-
add_action( 'comment_post', [ $this, 'check_comment_for_spam' ], 10, 3 );
|
28 |
-
}
|
29 |
-
|
30 |
-
if ( \WBCR\Titan\Plugin::app()->getPopulateOption( 'protect_register_form' ) ) {
|
31 |
-
add_action( 'user_register', [ $this, 'check_user_for_spam' ] );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Checking user registration for spam throught a server request.
|
37 |
-
*
|
38 |
-
* When user registered, our method check the user registration for spam.
|
39 |
-
* To check spam comment must be send to remote server and parse response.
|
40 |
-
* If server request has been failed, we are logging error in database.
|
41 |
-
*
|
42 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
43 |
-
* @since 6.0
|
44 |
-
*
|
45 |
-
* @param int $user_id User ID.
|
46 |
-
*/
|
47 |
-
public function check_user_for_spam( $user_id ) {
|
48 |
-
|
49 |
-
$user_ip = wantispamp_get_ip();
|
50 |
-
|
51 |
-
//Add user metadata to the usermeta table
|
52 |
-
update_user_meta( $user_id, wantispamp_db_key( 'signup_ip' ), $user_ip );
|
53 |
-
|
54 |
-
$user = new \WP_User( $user_id );
|
55 |
-
|
56 |
-
if ( ! $user->exists() ) {
|
57 |
-
return;
|
58 |
-
}
|
59 |
-
|
60 |
-
// Set the user's role (and implicitly remove the previous role).
|
61 |
-
$items = [
|
62 |
-
[
|
63 |
-
'uid' => wantispamp_generate_uid(),
|
64 |
-
'email' => $user->user_email,
|
65 |
-
'ip' => $user_ip
|
66 |
-
]
|
67 |
-
];
|
68 |
-
|
69 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Resitered new user #%d, ip: %s, email: %s.", $user->ID, $user_ip, $user->user_email ) );
|
70 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d, uid: %s prepared for sending to server.", $user->ID, $items[0]['uid'] ) );
|
71 |
-
|
72 |
-
$request = $this->cm_api->check_spam( $items );
|
73 |
-
|
74 |
-
if ( ! is_wp_error( $request ) && $items[0]['uid'] === $request->response[0]->uid ) {
|
75 |
-
if ( 'done' === $request->response[0]->status ) {
|
76 |
-
if ( true === $request->response[0]->spam ) {
|
77 |
-
$user->remove_all_caps();
|
78 |
-
$user->set_role( 'spam' );
|
79 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d noticed as spam!", $user->ID ) );
|
80 |
-
} else {
|
81 |
-
delete_user_meta( $user_id, wantispamp_db_key( 'spam_checking' ) );
|
82 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d noticed as approve!", $user->ID ) );
|
83 |
-
}
|
84 |
-
|
85 |
-
add_user_meta( $user_id, wantispamp_db_key( 'user_checked' ), 1 );
|
86 |
-
|
87 |
-
return;
|
88 |
-
} else if ( 'process' === $request->response[0]->status ) {
|
89 |
-
$user->remove_all_caps();
|
90 |
-
$user->set_role( 'spam_checking' );
|
91 |
-
add_user_meta( $user_id, wantispamp_db_key( 'spam_checking' ), $items[0]['uid'] );
|
92 |
-
|
93 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User check #%d has been delayed! The one will be after 5 min.", $user->ID ) );
|
94 |
-
|
95 |
-
return;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
$error = __( "User #%d hasn't been checked for spam due an unknown error.", 'titan-security' );
|
100 |
-
if ( is_wp_error( $request ) ) {
|
101 |
-
$error = __( "User #%d hasn't been checked for spam due an error:", 'titan-security' ) . $request->get_error_message();
|
102 |
-
}
|
103 |
-
|
104 |
-
add_user_meta( $user_id, wantispamp_db_key( 'spam_checking_fail' ), sprintf( $error, $user->ID, $error ) );
|
105 |
-
|
106 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( $error, $user->ID, $error ) );
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Checking comment for spam thought a server request.
|
111 |
-
*
|
112 |
-
* When user published comment, our method check the comment for spam.
|
113 |
-
* To check spam comment must be send to remote server and parse response.
|
114 |
-
* If server request has been failed, we are logging error in database.
|
115 |
-
*
|
116 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
117 |
-
* @since 6.0
|
118 |
-
*
|
119 |
-
* @param int $comment_ID The comment ID.
|
120 |
-
* @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
|
121 |
-
* @param array $commentdata Comment data.
|
122 |
-
*/
|
123 |
-
public function check_comment_for_spam( $comment_ID, $comment_approved, $commentdata ) {
|
124 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Added new comment #%d, approved: %s, email: %s, ip: %s [START].", $comment_ID, $comment_approved, $commentdata['comment_author_email'], $commentdata['comment_author_IP'] ) );
|
125 |
-
|
126 |
-
if ( 'spam' === $comment_approved ) {
|
127 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Comment #%d notices as spam [END]!", $comment_ID ) );
|
128 |
-
|
129 |
-
return;
|
130 |
-
}
|
131 |
-
|
132 |
-
if ( 1 !== $comment_approved ) {
|
133 |
-
wp_set_comment_status( $comment_ID, 'hold' );
|
134 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Comment #%d notices as hold!", $comment_ID ) );
|
135 |
-
}
|
136 |
-
|
137 |
-
// is js support?
|
138 |
-
$is_js_enable = \WBCR\Titan\Plugin::app()->request->post( "wantispam_d" );
|
139 |
-
$start_form_filling = (int) \WBCR\Titan\Plugin::app()->request->post( 'wantispam_t', 0 );
|
140 |
-
$start_form_filling = time() - $start_form_filling;
|
141 |
-
|
142 |
-
$items = [
|
143 |
-
[
|
144 |
-
'uid' => wantispamp_generate_uid(),
|
145 |
-
'email' => $commentdata['comment_author_email'],
|
146 |
-
'ip' => $commentdata['comment_author_IP'],
|
147 |
-
'text' => $commentdata['comment_content'],
|
148 |
-
'username' => $commentdata['comment_author'],
|
149 |
-
'useragent' => $commentdata['comment_agent'],
|
150 |
-
'headers' => wantispamp_get_all_headers(),
|
151 |
-
'referrer' => $_SERVER['HTTP_REFERER'],
|
152 |
-
'js_on' => date( 'Y' ) == $is_js_enable,
|
153 |
-
'submit_time' => $start_form_filling,
|
154 |
-
'callback_url' => rest_url( 'wantispam/v1/sync/' )
|
155 |
-
]
|
156 |
-
];
|
157 |
-
|
158 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Comment #%d, uid: %s prepared to checking!", $comment_ID, $items[0]['uid'] ) );
|
159 |
-
|
160 |
-
$request = $this->cm_api->check_spam( $items );
|
161 |
-
|
162 |
-
if ( ! is_wp_error( $request ) && $items[0]['uid'] === $request->response[0]->uid ) {
|
163 |
-
$spam = ( 'done' === $request->response[0]->status ) ? $request->response[0]->spam : false;
|
164 |
-
if ( wantispamp_approve_comment( $items[0]['uid'], $comment_ID, $request->response[0]->status, $spam ) ) {
|
165 |
-
return;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
$error = __( "Comment #%d hasn't been checked for spam due an unknown error.", 'titan-security' );
|
170 |
-
if ( is_wp_error( $request ) ) {
|
171 |
-
$error = __( "Comment #%d hasn't been checked for spam due an error:", 'titan-security' ) . $request->get_error_message();
|
172 |
-
}
|
173 |
-
|
174 |
-
add_comment_meta( $comment_ID, wantispamp_db_key( 'spam_checking_fail' ), sprintf( $error, $comment_ID ) );
|
175 |
-
delete_comment_meta( $comment_ID, wantispamp_db_key( 'spam_checking' ) );
|
176 |
-
|
177 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( $error, $comment_ID ) );
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
new \WBCR\Titan\Premium\Listener();
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/class-request-api.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace WBCR\Titan\Premium\Api;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The class implement some protections ways against spam
|
7 |
-
*
|
8 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
9 |
-
*
|
10 |
-
* @copyright (c) 2018 Webraftic Ltd
|
11 |
-
*/
|
12 |
-
class Request {
|
13 |
-
|
14 |
-
//const SERVER_API_URL_V1 = 'https://api.anti-spam.space/api/v1.0';
|
15 |
-
const SERVER_API_URL_V1 = 'https://api.titansitescanner.com/api/v1.0';
|
16 |
-
//const SERVER_API_URL_V1 = 'https://dev.anti-spam.space/api/v1.0';
|
17 |
-
const STAT_ENDPOINT = '/spam/statistics';
|
18 |
-
|
19 |
-
protected $plugin_id;
|
20 |
-
protected $license_key;
|
21 |
-
|
22 |
-
public function __construct() {
|
23 |
-
$this->plugin_id = wantispam_get_freemius_plugin_id();
|
24 |
-
$this->license_key = wantispam_get_license_key();
|
25 |
-
}
|
26 |
-
|
27 |
-
|
28 |
-
public function get_statistic( $days = 7 ) {
|
29 |
-
if ( empty( $days ) ) {
|
30 |
-
return new \WP_Error( 'http_request_failed', 'Variable $items is empty! You must pass number days to get statistic for period.' );
|
31 |
-
}
|
32 |
-
|
33 |
-
$request_url = \WBCR\Titan\Premium\Api\Request::SERVER_API_URL_V1 . \WBCR\Titan\Premium\Api\Request::STAT_ENDPOINT;
|
34 |
-
$request_url = add_query_arg( [ 'days' => (int) $days ], $request_url );
|
35 |
-
|
36 |
-
return $this->request( $request_url, 'GET' );
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Checking spam through Creative Motion API
|
41 |
-
*
|
42 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
43 |
-
* @since 6.0
|
44 |
-
*
|
45 |
-
* @param $items
|
46 |
-
*
|
47 |
-
* @return array|mixed|object|\WP_Error
|
48 |
-
*/
|
49 |
-
public function check_spam( $items ) {
|
50 |
-
if ( empty( $items ) ) {
|
51 |
-
return new \WP_Error( 'http_request_failed', 'Variable $items is empty! You must pass one or more items to spam check.' );
|
52 |
-
}
|
53 |
-
|
54 |
-
return $this->request( self::SERVER_API_URL_V1 . '/spam', 'POST', $items );
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Checking status queue through Creative Motion API
|
59 |
-
*
|
60 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
61 |
-
* @since 6.0
|
62 |
-
*
|
63 |
-
* @param string|string[] $uid
|
64 |
-
*
|
65 |
-
* @return array|mixed|object|\WP_Error
|
66 |
-
*/
|
67 |
-
public function check_status_queue( $uid ) {
|
68 |
-
if ( empty( $uid ) ) {
|
69 |
-
return new \WP_Error( 'http_request_failed', 'Variable $uid is empty!' );
|
70 |
-
}
|
71 |
-
|
72 |
-
if ( is_array( $uid ) ) {
|
73 |
-
return $this->request( self::SERVER_API_URL_V1 . "/spam/queue-status", 'POST', $uid );
|
74 |
-
}
|
75 |
-
|
76 |
-
return $this->request( self::SERVER_API_URL_V1 . "/spam/queue-status/{$uid}", 'GET' );
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Send request to remote server
|
81 |
-
*
|
82 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
83 |
-
* @since 6.0
|
84 |
-
*
|
85 |
-
* @param string $url Url for request
|
86 |
-
* @param string $type Can be only (POST|GET)
|
87 |
-
* @param array $body Params which must be pass in request body
|
88 |
-
*
|
89 |
-
* @return array|mixed|object|\WP_Error
|
90 |
-
*/
|
91 |
-
public function request( $url, $type = 'GET', array $body = [] ) {
|
92 |
-
if ( empty( $url ) ) {
|
93 |
-
return new \WP_Error( 'http_request_failed', 'Variable $url cannot be empty!' );
|
94 |
-
}
|
95 |
-
|
96 |
-
$headers['Accept'] = 'application/json';
|
97 |
-
$headers['Authorization'] = 'Bearer ' . base64_encode( $this->license_key );
|
98 |
-
$headers['PluginId'] = $this->plugin_id;
|
99 |
-
|
100 |
-
$args = [
|
101 |
-
'method' => $type,
|
102 |
-
'headers' => $headers,
|
103 |
-
'sslverify' => false,
|
104 |
-
'body' => []
|
105 |
-
];
|
106 |
-
|
107 |
-
if ( 'GET' !== $type ) {
|
108 |
-
$args['headers']['Content-Type'] = 'application/json';
|
109 |
-
$args['data_format'] = 'body';
|
110 |
-
$args['body'] = json_encode( $body );
|
111 |
-
}
|
112 |
-
|
113 |
-
$request = wp_remote_request( $url, $args );
|
114 |
-
|
115 |
-
if ( is_wp_error( $request ) ) {
|
116 |
-
return $request;
|
117 |
-
}
|
118 |
-
|
119 |
-
$response_code = wp_remote_retrieve_response_code( $request );
|
120 |
-
$response_body = wp_remote_retrieve_body( $request );
|
121 |
-
|
122 |
-
if ( $response_code != 200 ) {
|
123 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( "Http request failed, code: %d!", $response_code ) );
|
124 |
-
|
125 |
-
return new \WP_Error( 'http_request_failed', 'Server response ' . $response_code );
|
126 |
-
}
|
127 |
-
|
128 |
-
$response_data = @json_decode( $response_body );
|
129 |
-
|
130 |
-
if ( empty( $response_data ) || ! is_object( $response_data ) ) {
|
131 |
-
\WBCR\Titan\Logger\Writter::error( "Server returned empty response. Maybe, there accidented a critical error!" );
|
132 |
-
|
133 |
-
return new \WP_Error( 'http_request_failed', 'Server returned empty response. Maybe, there accidented a critical error.' );
|
134 |
-
}
|
135 |
-
|
136 |
-
if ( 'fail' === $response_data->status && ! empty( $response_data->error ) ) {
|
137 |
-
\WBCR\Titan\Logger\Writter::error( $response_data->error );
|
138 |
-
|
139 |
-
return new \WP_Error( 'http_server_error', $response_data->error );
|
140 |
-
}
|
141 |
-
|
142 |
-
if ( 'ok' === $response_data->status && ! empty( $response_data->response ) ) {
|
143 |
-
return $response_data;
|
144 |
-
}
|
145 |
-
|
146 |
-
\WBCR\Titan\Logger\Writter::error( 'Unknown http request error!' );
|
147 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( "Request body: %s", json_encode( $body, JSON_PRETTY_PRINT ) ) );
|
148 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( "Response: %s", $response_body ) );
|
149 |
-
|
150 |
-
return new \WP_Error( 'http_request_failed', 'Unknown http request error!' );
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/cron-schedules.php
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Cron schedules for the plugin
|
4 |
-
*
|
5 |
-
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
|
6 |
-
* @copyright (c) 27.10.2019, Webcraftic
|
7 |
-
* @version 1.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Create a new interval for cron schedules (5 min)
|
12 |
-
*/
|
13 |
-
add_filter( 'cron_schedules', function ( $schedules ) {
|
14 |
-
$schedules['five_minets'] = [
|
15 |
-
'interval' => 5 * MINUTE_IN_SECONDS,
|
16 |
-
'display' => esc_html__( 'Every Five minets' ),
|
17 |
-
];
|
18 |
-
|
19 |
-
return $schedules;
|
20 |
-
} );
|
21 |
-
|
22 |
-
/**
|
23 |
-
* This action is triggered when a 5 minute cron task is performed.
|
24 |
-
* With this action, we check the queue status on the remote server
|
25 |
-
* to complete the spam check.
|
26 |
-
*/
|
27 |
-
add_action( 'wantispamp_check_status_queue', function () {
|
28 |
-
global $wpdb;
|
29 |
-
|
30 |
-
\WBCR\Titan\Logger\Writter::warning( "Cron event [START]!" );
|
31 |
-
|
32 |
-
$cm_api = new WBCR\Titan\Premium\Api\Request();
|
33 |
-
|
34 |
-
// Check status for comments
|
35 |
-
$checking_comments = $wpdb->get_results( $wpdb->prepare( "
|
36 |
-
SELECT meta_value as uid, comment_id FROM {$wpdb->commentmeta}
|
37 |
-
WHERE meta_key='%s' LIMIT 50", wantispamp_db_key( 'spam_checking' ) ) );
|
38 |
-
|
39 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "%d comments prepared for spam checking.", sizeof( $checking_comments ) ) );
|
40 |
-
|
41 |
-
if ( ! empty( $checking_comments ) ) {
|
42 |
-
$uid_list = [];
|
43 |
-
$comment_IDs = [];
|
44 |
-
|
45 |
-
foreach ( (array) $checking_comments as $comment ) {
|
46 |
-
$uid_list[] = $comment->uid;
|
47 |
-
$comment_IDs[ $comment->uid ] = $comment->comment_id;
|
48 |
-
}
|
49 |
-
|
50 |
-
$request = $cm_api->check_status_queue( $uid_list );
|
51 |
-
|
52 |
-
if ( ! is_wp_error( $request ) ) {
|
53 |
-
foreach ( $request->response as $element ) {
|
54 |
-
$spam = ( 'done' === $element->status ) ? $element->spam : false;
|
55 |
-
$comment_ID = $comment_IDs[ $element->uid ];
|
56 |
-
|
57 |
-
if ( wantispamp_approve_comment( $element->uid, $comment_ID, $element->status, $spam ) ) {
|
58 |
-
unset( $comment_IDs[ $element->uid ] );
|
59 |
-
}
|
60 |
-
}
|
61 |
-
} else {
|
62 |
-
$checking_comments_error = $request->get_error_message();
|
63 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( "Request error: %s", $checking_comments_error ) );
|
64 |
-
}
|
65 |
-
|
66 |
-
if ( ! empty( $comment_IDs ) ) {
|
67 |
-
// Skipping comments that have not been processed (not found on server)
|
68 |
-
foreach ( $comment_IDs as $comment_ID ) {
|
69 |
-
$error_text = 'Comment #%d has been skipping: not found on server';
|
70 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( $error_text, $comment_ID ) );
|
71 |
-
//wp_set_comment_status( $comment_ID, 'approve' );
|
72 |
-
add_comment_meta( $comment_ID, wantispamp_db_key( 'spam_checking_fail' ), sprintf( $error_text, $comment_ID ) );
|
73 |
-
delete_comment_meta( $comment_ID, wantispamp_db_key( 'spam_checking' ) );
|
74 |
-
add_comment_meta( $comment_ID, wantispamp_db_key( 'comment_checked' ), 1 );
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
// Check status for users
|
80 |
-
$checking_users = get_users( [ 'role' => 'spam_checking' ] );
|
81 |
-
|
82 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "%d users prepared for spam cheking.", sizeof( $checking_users ) ) );
|
83 |
-
|
84 |
-
if ( ! empty( $checking_users ) ) {
|
85 |
-
foreach ( (array) $checking_users as $user ) {
|
86 |
-
$user = new \WP_User( $user->ID );
|
87 |
-
$user_uid = get_user_meta( $user->ID, wantispamp_db_key( 'spam_checking' ) );
|
88 |
-
|
89 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d, uid: %s prepared for sending to server.", $user->ID, $user_uid ) );
|
90 |
-
$request = $cm_api->check_status_queue( $user_uid );
|
91 |
-
|
92 |
-
if ( ! is_wp_error( $request ) ) {
|
93 |
-
if ( 'done' === $request->response->status ) {
|
94 |
-
if ( true === $request->response->spam ) {
|
95 |
-
$user->set_role( 'spam' );
|
96 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d noticed as spam!", $user->ID ) );
|
97 |
-
} else {
|
98 |
-
$user->set_role( 'subscriber' );
|
99 |
-
$user->remove_role( 'spam_checking' );
|
100 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d noticed as approve!", $user->ID ) );
|
101 |
-
}
|
102 |
-
|
103 |
-
add_user_meta( $user->ID, wantispamp_db_key( 'user_checked' ), 1 );
|
104 |
-
} else if ( 'process' === $request->response[0]->status ) {
|
105 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "User #%d hasn't checked yet!", $user->ID ) );
|
106 |
-
}
|
107 |
-
} else {
|
108 |
-
$checking_user_error = __( "User hasn't been checked for spam due an error:", 'titan-security' ) . $request->get_error_message();
|
109 |
-
add_user_meta( $user->ID, wantispamp_db_key( 'spam_checking_fail' ), $checking_user_error );
|
110 |
-
$user->remove_role( 'spam_checking' );
|
111 |
-
$user->set_role( 'subscriber' );
|
112 |
-
|
113 |
-
\WBCR\Titan\Logger\Writter::error( sprintf( "User #%d hasn't been checked because of error: %s!", $user->ID, $checking_user_error ) );
|
114 |
-
}
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
\WBCR\Titan\Logger\Writter::warning( "Cron event [END]!" );
|
119 |
-
} );
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/function.php
DELETED
@@ -1,299 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Helpers functions for the plugin
|
4 |
-
*
|
5 |
-
* @author Webcraftic <wordpress.webraftic@gmail.com>, Alexander Kovalev <alex.kovalevv@gmail.com>
|
6 |
-
* @copyright (c) 26.10.2019, Webcraftic
|
7 |
-
* @version 1.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Masks a value with asterisks (*)
|
12 |
-
*
|
13 |
-
* @return string
|
14 |
-
*/
|
15 |
-
function wantispamp_obfuscate_param($value = null)
|
16 |
-
{
|
17 |
-
if( $value && (!is_object($value) || !is_array($value)) ) {
|
18 |
-
$length = strlen($value);
|
19 |
-
$value = str_repeat('*', $length);
|
20 |
-
}
|
21 |
-
|
22 |
-
return $value;
|
23 |
-
}
|
24 |
-
|
25 |
-
function wantispamp_array($array)
|
26 |
-
{
|
27 |
-
require_once(WANTISPAMP_PLUGIN_DIR . '/includes/class-array.php');
|
28 |
-
|
29 |
-
return new \WBCR\Titan\Premium\Arr($array);
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Convert value to bool if it is string or int
|
34 |
-
*
|
35 |
-
* @param bool $value
|
36 |
-
*
|
37 |
-
* @return bool
|
38 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
39 |
-
* @since 6.3
|
40 |
-
*
|
41 |
-
*/
|
42 |
-
function wantispamp_normalize_bool($value)
|
43 |
-
{
|
44 |
-
if( is_string($value) ) {
|
45 |
-
$value = "true" === $value ? true : false;
|
46 |
-
} else if( is_int($value) ) {
|
47 |
-
$value = (bool)$value;
|
48 |
-
}
|
49 |
-
|
50 |
-
return $value;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Get database key with plugin prefix
|
55 |
-
*
|
56 |
-
* @param $key
|
57 |
-
*
|
58 |
-
* @return string
|
59 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
60 |
-
* @since 6.0
|
61 |
-
*
|
62 |
-
*/
|
63 |
-
function wantispamp_db_key($key)
|
64 |
-
{
|
65 |
-
return \WBCR\Titan\Plugin::app()->getPrefix() . str_replace('-', '_', trim($key));
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Generate unique ID
|
70 |
-
*
|
71 |
-
* @param string $salt Any text to enhance uniqueness
|
72 |
-
*
|
73 |
-
* @return string
|
74 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
75 |
-
* @since 6.0
|
76 |
-
*
|
77 |
-
*/
|
78 |
-
function wantispamp_generate_uid($salt = '')
|
79 |
-
{
|
80 |
-
return md5($salt . wp_generate_password(20) . time());
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Sends comments for verification
|
85 |
-
*
|
86 |
-
* @return \WP_Error|array
|
87 |
-
* - @since 6.2
|
88 |
-
*
|
89 |
-
* @author Alexander Gorenkov <g.a.androidjc2@ya.ru>
|
90 |
-
* @var bool Check result
|
91 |
-
* - @var int Remaining comments
|
92 |
-
*/
|
93 |
-
function wantispamp_check_existing_comments()
|
94 |
-
{
|
95 |
-
if( !current_user_can('manage_options') ) {
|
96 |
-
wp_die(-1);
|
97 |
-
}
|
98 |
-
|
99 |
-
$comments = wantispamp_get_comment_list();
|
100 |
-
|
101 |
-
if( empty($comments) ) {
|
102 |
-
return [true, 0];
|
103 |
-
}
|
104 |
-
|
105 |
-
$items = [];
|
106 |
-
foreach($comments as $comment) {
|
107 |
-
$uid = wantispamp_generate_uid();
|
108 |
-
$items[$uid] = [
|
109 |
-
'uid' => $uid,
|
110 |
-
'comment_ID' => $comment->comment_ID,
|
111 |
-
'email' => $comment->comment_author_email,
|
112 |
-
'ip' => $comment->comment_author_IP,
|
113 |
-
'text' => $comment->comment_content,
|
114 |
-
'js_on' => true,
|
115 |
-
'callback_url' => rest_url('wantispam/v1/sync/')
|
116 |
-
];
|
117 |
-
}
|
118 |
-
|
119 |
-
\WBCR\Titan\Logger\Writter::info(sprintf("%d comments prepared to checking!", sizeof($items)));
|
120 |
-
|
121 |
-
$cm_api = new WBCR\Titan\Premium\Api\Request();
|
122 |
-
$request = $cm_api->check_spam($items);
|
123 |
-
|
124 |
-
if( is_wp_error($request) ) {
|
125 |
-
return $request;
|
126 |
-
}
|
127 |
-
|
128 |
-
if( !empty($request->response) ) {
|
129 |
-
$count_checked = sizeof($request->response);
|
130 |
-
foreach($request->response as $result_item) {
|
131 |
-
if( isset($items[$result_item->uid]) ) {
|
132 |
-
$spam = ('done' === $result_item->status) ? $result_item->spam : false;
|
133 |
-
$comment_ID = $items[$result_item->uid]['comment_ID'];
|
134 |
-
if( wantispamp_approve_comment($result_item->uid, $comment_ID, $result_item->status, $spam) ) {
|
135 |
-
$count_checked--;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
if( sizeof($request->response) === $count_checked ) {
|
141 |
-
return new WP_Error('not_one_comments_checked', 'Comments cannot be checked for spam because of error.');
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
return [true, wantispamp_get_unchecked_comments_count()];
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Puts comment to spam or marks as approved.
|
150 |
-
*
|
151 |
-
* @param string $uid
|
152 |
-
* @param int $comment_ID
|
153 |
-
* @param string $status
|
154 |
-
* @param bool $spam
|
155 |
-
*
|
156 |
-
* @return bool
|
157 |
-
* @since 6.2
|
158 |
-
*
|
159 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
160 |
-
*/
|
161 |
-
function wantispamp_approve_comment($uid, $comment_ID, $status, $spam)
|
162 |
-
{
|
163 |
-
if( 'done' === $status ) {
|
164 |
-
if( true === $spam ) {
|
165 |
-
wp_set_comment_status($comment_ID, 'spam');
|
166 |
-
\WBCR\Titan\Logger\Writter::info(sprintf("Comment #%d notices as spam!", $comment_ID));
|
167 |
-
} else {
|
168 |
-
wp_set_comment_status($comment_ID, 'approve');
|
169 |
-
\WBCR\Titan\Logger\Writter::info(sprintf("Comment #%d notices as approve!", $comment_ID));
|
170 |
-
}
|
171 |
-
|
172 |
-
\WBCR\Titan\Logger\Writter::info(sprintf("Comment #%d has been checked [END]!", $comment_ID));
|
173 |
-
delete_comment_meta($comment_ID, wantispamp_db_key('spam_checking'));
|
174 |
-
add_comment_meta($comment_ID, wantispamp_db_key('comment_checked'), 1);
|
175 |
-
|
176 |
-
return true;
|
177 |
-
} else if( 'process' === $status ) {
|
178 |
-
update_comment_meta($comment_ID, wantispamp_db_key('spam_checking'), $uid);
|
179 |
-
\WBCR\Titan\Logger\Writter::info(sprintf("Comment check #%d has been delayed! The one will be after 5 min [END].", $comment_ID));
|
180 |
-
|
181 |
-
return true;
|
182 |
-
}
|
183 |
-
|
184 |
-
return false;
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Returns unverified comments indented from the beginning of the comment list
|
189 |
-
*
|
190 |
-
* @return array Array of unverified comments
|
191 |
-
* @since 6.2
|
192 |
-
*
|
193 |
-
* @author Alexander Gorenkov <g.a.androidjc2@ya.ru>
|
194 |
-
* @see https://developer.wordpress.org/reference/functions/get_comments/
|
195 |
-
*/
|
196 |
-
function wantispamp_get_comment_list()
|
197 |
-
{
|
198 |
-
$args = [
|
199 |
-
'status' => 'hold',
|
200 |
-
'number' => \WBCR\Titan\Plugin::COUNT_TO_CHECK,
|
201 |
-
'meta_query' => [
|
202 |
-
|
203 |
-
[
|
204 |
-
'key' => wantispamp_db_key('spam_checking'),
|
205 |
-
'compare' => 'NOT EXISTS',
|
206 |
-
],
|
207 |
-
[
|
208 |
-
'key' => wantispamp_db_key('comment_checked'),
|
209 |
-
'compare' => 'NOT EXISTS',
|
210 |
-
],
|
211 |
-
],
|
212 |
-
];
|
213 |
-
|
214 |
-
return get_comments($args);
|
215 |
-
}
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Get count of unchecked comments
|
219 |
-
*
|
220 |
-
* The counter will be cached to improve performance
|
221 |
-
*
|
222 |
-
* @return bool|int|mixed
|
223 |
-
* @since 6.2
|
224 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
225 |
-
*/
|
226 |
-
function wantispamp_get_unchecked_comments_count()
|
227 |
-
{
|
228 |
-
global $wpdb;
|
229 |
-
|
230 |
-
$count_comments = wp_cache_get('count_unchecked_comments', 'wantispam');
|
231 |
-
|
232 |
-
if( false === $count_comments ) {
|
233 |
-
$count_comments = (int)$wpdb->get_var("
|
234 |
-
SELECT COUNT(*) FROM {$wpdb->comments} c
|
235 |
-
LEFT JOIN {$wpdb->commentmeta} AS cm ON (c.comment_ID = cm.comment_id AND cm.meta_key = 'wantispam_spam_checking' )
|
236 |
-
LEFT JOIN {$wpdb->commentmeta} AS mt1 ON (c.comment_ID = mt1.comment_id AND mt1.meta_key = 'wantispam_comment_checked' )
|
237 |
-
WHERE ( comment_approved = '0' ) AND (cm.comment_id IS NULL AND mt1.comment_id IS NULL) ");
|
238 |
-
|
239 |
-
wp_cache_set('count_unchecked_comments', $count_comments, 'wantispam');
|
240 |
-
}
|
241 |
-
|
242 |
-
return $count_comments;
|
243 |
-
}
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Returns the request headers
|
247 |
-
* This approach is used because the user can use any non-Apache web server
|
248 |
-
*
|
249 |
-
* @return array [Request headers]
|
250 |
-
* @since 6.2
|
251 |
-
*
|
252 |
-
* @author Alexander Gorenkov <g.a.androidjc2@ya.ru>
|
253 |
-
*/
|
254 |
-
function wantispamp_get_all_headers()
|
255 |
-
{
|
256 |
-
$requestHeaders = [];
|
257 |
-
foreach($_SERVER as $name => $value) {
|
258 |
-
if( substr($name, 0, 5) === "HTTP_" ) {
|
259 |
-
$key = str_replace('_', ' ', substr($name, 5));
|
260 |
-
$key = ucwords(strtolower($key));
|
261 |
-
$key = str_replace(' ', '-', $key);
|
262 |
-
$requestHeaders[$key] = $value;
|
263 |
-
}
|
264 |
-
}
|
265 |
-
|
266 |
-
return $requestHeaders;
|
267 |
-
}
|
268 |
-
|
269 |
-
/**
|
270 |
-
* Get the IP address
|
271 |
-
*
|
272 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
273 |
-
* @since 6.0
|
274 |
-
*/
|
275 |
-
function wantispamp_get_ip()
|
276 |
-
{
|
277 |
-
$how_get_ip = \WBCR\Titan\Plugin::app()->getPopulateOption('get_ip_method', "recommended");
|
278 |
-
|
279 |
-
switch( $how_get_ip ) {
|
280 |
-
case "recommended":
|
281 |
-
case "remote_addr";
|
282 |
-
//Get the IP of the person registering
|
283 |
-
return $_SERVER['REMOTE_ADDR'];
|
284 |
-
case "x_forwarded_for":
|
285 |
-
if( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
|
286 |
-
$http_x_headers = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
287 |
-
|
288 |
-
return $http_x_headers[0];
|
289 |
-
} else {
|
290 |
-
return '0.0.0.0';
|
291 |
-
}
|
292 |
-
case "x-real-ip":
|
293 |
-
return isset($_SERVER['X-Real-IP']) ? $_SERVER['X-Real-IP'] : '0.0.0.0';
|
294 |
-
case "CF-Connecting-IP":
|
295 |
-
return isset($_SERVER['CF-Connecting-IP']) ? $_SERVER['CF-Connecting-IP'] : '0.0.0.0';
|
296 |
-
default:
|
297 |
-
return '0.0.0.0';
|
298 |
-
}
|
299 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/includes/index.php
DELETED
File without changes
|
libs/antispam-premium/includes/plugin-rest-api.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin rest api
|
4 |
-
*
|
5 |
-
* @author Alexander Kovalev <alex.kovalevv@gmail.com>
|
6 |
-
* @copyright (c) 07.12.2019, Webcraftic
|
7 |
-
* @version 1.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Endpoint for sync listings
|
12 |
-
*/
|
13 |
-
add_action( 'rest_api_init', function () {
|
14 |
-
register_rest_route( 'wantispam/v1', '/sync/', [
|
15 |
-
'methods' => 'POST',
|
16 |
-
'permission_callback' => function ( $request ) {
|
17 |
-
$license_key = md5( wantispam_get_license_key() );
|
18 |
-
|
19 |
-
if ( $license_key === $request->get_param( 'access_token' ) ) {
|
20 |
-
return true;
|
21 |
-
}
|
22 |
-
|
23 |
-
return false;
|
24 |
-
},
|
25 |
-
'args' => [
|
26 |
-
'access_token' => [
|
27 |
-
'default' => null,
|
28 |
-
'required' => true,
|
29 |
-
'sanitize_callback' => 'sanitize_key',
|
30 |
-
],
|
31 |
-
'spam_checking_result' => [
|
32 |
-
'default' => [],
|
33 |
-
'required' => true
|
34 |
-
],
|
35 |
-
],
|
36 |
-
'callback' => function ( \WP_REST_Request $request ) {
|
37 |
-
global $wpdb;
|
38 |
-
|
39 |
-
\WBCR\Titan\Logger\Writter::warning( "Rest API request [START PROCESS]." );
|
40 |
-
|
41 |
-
$is_protect_comments_form = \WBCR\Titan\Plugin::app()->getPopulateOption( 'protect_comments_form' );
|
42 |
-
$is_protect_register_form = \WBCR\Titan\Plugin::app()->getPopulateOption( 'protect_register_form' );
|
43 |
-
|
44 |
-
if ( ! $is_protect_comments_form && ! $is_protect_register_form ) {
|
45 |
-
\WBCR\Titan\Logger\Writter::error( "The plugin api is closed!" );
|
46 |
-
|
47 |
-
return new WP_Error( 'plugin_api_closed', 'The plugin api is closed.', [ 'status' => 404 ] );
|
48 |
-
}
|
49 |
-
|
50 |
-
$checking_result = $request->get_param( 'spam_checking_result' );
|
51 |
-
|
52 |
-
if ( empty( $checking_result ) || ! is_array( $checking_result ) ) {
|
53 |
-
\WBCR\Titan\Logger\Writter::error( "The body var {spam_checking_result} must be array." );
|
54 |
-
|
55 |
-
return new WP_Error( 'invalid_data_type', 'The body var {spam_checking_result} must be array.', [ 'status' => 404 ] );
|
56 |
-
}
|
57 |
-
|
58 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Got data: %s", var_export( $checking_result, true ) ) );
|
59 |
-
|
60 |
-
$comment_uids = [];
|
61 |
-
$checking_result_formatted = [];
|
62 |
-
foreach ( (array) $checking_result as $checked_item ) {
|
63 |
-
$comment_uids[] = "'" . sanitize_key( $checked_item['uid'] ) . "'";
|
64 |
-
$checking_result_formatted[ $checked_item['uid'] ] = $checked_item;
|
65 |
-
}
|
66 |
-
|
67 |
-
// Check status for comments
|
68 |
-
$comments = $wpdb->get_results( $wpdb->prepare( "
|
69 |
-
SELECT meta_value as uid, comment_id
|
70 |
-
FROM {$wpdb->commentmeta}
|
71 |
-
WHERE meta_key='%s' AND meta_value in (" . implode( ',', $comment_uids ) . ")", wantispamp_db_key( 'spam_checking' ) ) );
|
72 |
-
|
73 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Finded comments: %s", var_export( $comments, true ) ) );
|
74 |
-
|
75 |
-
$updated_comments = [];
|
76 |
-
if ( ! empty( $comments ) ) {
|
77 |
-
foreach ( $comments as $comment ) {
|
78 |
-
$type = wantispamp_normalize_bool( $checking_result_formatted[ $comment->uid ]['spam'] );
|
79 |
-
$spam = ( 'done' === $checking_result_formatted[ $comment->uid ]['status'] ) ? $type : false;
|
80 |
-
|
81 |
-
if ( wantispamp_approve_comment( $comment->uid, $comment->comment_id, $checking_result_formatted[ $comment->uid ]['status'], $spam ) ) {
|
82 |
-
$updated_comments[] = $comment->uid;
|
83 |
-
unset( $checking_result_formatted[ $comment->uid ] );
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Comments updated: %s", var_export( $updated_comments, true ) ) );
|
89 |
-
\WBCR\Titan\Logger\Writter::info( sprintf( "Comments haven't been updated: %s", var_export( $updated_comments, true ) ) );
|
90 |
-
|
91 |
-
\WBCR\Titan\Logger\Writter::warning( sprintf( "Rest API request completed [END PROCESS]." ) );
|
92 |
-
|
93 |
-
return [
|
94 |
-
'success' => true,
|
95 |
-
'checked_comments' => $updated_comments,
|
96 |
-
'skip_comments' => array_keys( $checking_result_formatted )
|
97 |
-
];
|
98 |
-
}
|
99 |
-
] );
|
100 |
-
} );
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/antispam-premium/index.php
DELETED
File without changes
|
libs/antispam-premium/languages/index.php
DELETED
File without changes
|
libs/antispam-premium/readme.txt
DELETED
@@ -1,251 +0,0 @@
|
|
1 |
-
=== Anti-spam ===
|
2 |
-
Contributors: webvitaly
|
3 |
-
Donate link: http://web-profile.net/donate/
|
4 |
-
Tags: spam, spammer, comment, comments, comment-spam, antispam, anti-spam, block-spam, spam-free, spambot, spam-bot, bot
|
5 |
-
Requires at least: 3.3
|
6 |
-
Tested up to: 5.2
|
7 |
-
Stable tag: 5.5
|
8 |
-
License: GPLv3
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
-
|
11 |
-
No spam in comments. No captcha.
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
* **[Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii "Upgrade to Pro")**
|
16 |
-
* **[Anti-spam](http://web-profile.net/wordpress/plugins/anti-spam/ "Plugin page")**
|
17 |
-
* **[Donate](http://web-profile.net/donate/ "Support the development")**
|
18 |
-
* **[GitHub](https://github.com/webvitalii/anti-spam "Fork")**
|
19 |
-
|
20 |
-
|
21 |
-
Anti-spam plugin blocks automatic spam in comments section. No captcha.
|
22 |
-
|
23 |
-
Plugin is easy to use: just install it and it just works.
|
24 |
-
|
25 |
-
Blocked comments can be stored in the Spam area if needed. This can be enabled/disabled via Settings page. This is useful for testing and debug purpose. Blocked spam comments can be easily converted to regular comments if needed.
|
26 |
-
|
27 |
-
Anti-spam plugin is GDPR compliant and does not store any other user data except of the behavior mentioned above.
|
28 |
-
|
29 |
-
**Plugin blocks spam only in comments section**.
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
After installing the Anti-spam plugin **try to submit a comment on your site being logged out**.
|
34 |
-
If you get an error - you may check the solution in the [Support section](http://wordpress.org/support/plugin/anti-spam) or submit a new topic with detailed description of your problem.
|
35 |
-
|
36 |
-
|
37 |
-
== Installation ==
|
38 |
-
|
39 |
-
1. Install and activate the plugin on the Plugins page
|
40 |
-
2. Enjoy life without spam in comments
|
41 |
-
|
42 |
-
== Frequently Asked Questions ==
|
43 |
-
|
44 |
-
= How to test what spam comments were blocked? =
|
45 |
-
|
46 |
-
You can visit Anti-spam settings page and enable saving blocked comments as spam in the spam section.
|
47 |
-
To enabled that you need to go to: WordPress admin dashboard => Settings section => Anti-spam
|
48 |
-
Saving blocked comments into spam section is disabled by default.
|
49 |
-
Saving spam comments can help you to keep all the comments saved and review them in future if needed. You can easily mark comment as "not spam" if some of the comments were blocked by mistake.
|
50 |
-
|
51 |
-
= What is the percentage of spam blocked? =
|
52 |
-
|
53 |
-
Anti-spam plugin blocks 100% of automatic spam messages (sent by spam-bots via post requests).
|
54 |
-
Plugin does not block manual spam (submitted by spammers manually via browser).
|
55 |
-
You can use [Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii "Upgrade to Pro") plugin if you need to block manual spam.
|
56 |
-
|
57 |
-
= Incompatible with: =
|
58 |
-
|
59 |
-
* Disqus
|
60 |
-
* Jetpack Comments
|
61 |
-
* AJAX Comment Form
|
62 |
-
* bbPress
|
63 |
-
|
64 |
-
= How does Anti-spam plugin work? =
|
65 |
-
|
66 |
-
The blocking algorithm is based on 2 methods: 'invisible js-captcha' and 'invisible input trap' (aka honeypot technique).
|
67 |
-
|
68 |
-
= How does 'invisible js-captcha' method (aka honeypot) work? =
|
69 |
-
|
70 |
-
The 'invisible js-captcha' method is based on fact that bots does not have javascript on their user-agents.
|
71 |
-
Extra hidden field is added to comments form.
|
72 |
-
It is the question about the current year.
|
73 |
-
If the user visits site, than this field is answered automatically with javascript, is hidden by javascript and css and invisible for the user.
|
74 |
-
If the spammer will fill year-field incorrectly - the comment will be blocked because it is spam.
|
75 |
-
|
76 |
-
= How does 'invisible input trap' (aka honeypot technique) method work? =
|
77 |
-
|
78 |
-
The 'invisible input trap' method is based on fact that almost all the bots will fill inputs with name 'email' or 'url'.
|
79 |
-
Extra hidden field is added to comments form.
|
80 |
-
This field is hidden for the user and user will not fill it.
|
81 |
-
But this field is visible for the spammer.
|
82 |
-
If the spammer will fill this trap-field with anything - the comment will be blocked because it is spam.
|
83 |
-
|
84 |
-
= How to know the counter of blocked spam comments? =
|
85 |
-
|
86 |
-
You can find the info block with total spam blocked counter in the admin comments section.
|
87 |
-
You can hide or show this info block in the "Screen Options" section.
|
88 |
-
The visibility option for this info block is saved per user.
|
89 |
-
|
90 |
-
= Does plugin block spam from Contact or other forms? =
|
91 |
-
|
92 |
-
Plugin blocks spam only in comments form section and does not block spam from any other forms on site.
|
93 |
-
If you installed and activated the plugin and you still receiving spam - probably this could be because of some other forms on your site (for example feedback form).
|
94 |
-
|
95 |
-
= What about trackback spam? =
|
96 |
-
|
97 |
-
Users rarely use trackbacks because it is manual and requires extra input. Spammers uses trackbacks because it is easy to cheat here.
|
98 |
-
Users use pingbacks very often because they work automatically. Spammers does not use pingbacks because backlinks are checked.
|
99 |
-
So trackbacks are blocked but pingbacks are enabled.
|
100 |
-
You may use [Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii "Upgrade to Pro") plugin if you need to enable trackbacks.
|
101 |
-
You may read more about the [difference between trackbacks and pingbacks](http://web-profile.net/web/trackback-vs-pingback/)
|
102 |
-
|
103 |
-
= What browsers are supported? =
|
104 |
-
|
105 |
-
All modern browsers and IE8+ are supported.
|
106 |
-
|
107 |
-
= Unobtrusive JavaScript =
|
108 |
-
|
109 |
-
Anti-spam plugin works with disabled JavaScript. JavaScript is disabled on less than 1% of devices.
|
110 |
-
Users with disabled JavaScript should manually fill catcha-like input before submitting the comment.
|
111 |
-
|
112 |
-
= And one more extra note... =
|
113 |
-
|
114 |
-
If site has caching plugin enabled and cache is not cleared or if theme does not use 'comment_form' action
|
115 |
-
and there is no plugin inputs in comments form - plugin tries to add hidden fields automatically using JavaScript.
|
116 |
-
|
117 |
-
= Not enough information about the plugin? =
|
118 |
-
|
119 |
-
You may check out the [source code of the plugin](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php).
|
120 |
-
The plugin is pretty small and easy to read.
|
121 |
-
|
122 |
-
|
123 |
-
== Changelog ==
|
124 |
-
|
125 |
-
= 5.5 =
|
126 |
-
* Code cleanup
|
127 |
-
* Removed dismissible notice
|
128 |
-
|
129 |
-
= 5.4 =
|
130 |
-
* Updated dismissible notice
|
131 |
-
|
132 |
-
= 5.3 =
|
133 |
-
* Fixed the typo in the readme
|
134 |
-
* Readme cleanup
|
135 |
-
* Code cleanup
|
136 |
-
* Added dismissible notice
|
137 |
-
|
138 |
-
= 5.2 =
|
139 |
-
* Disable trackbacks
|
140 |
-
|
141 |
-
= 5.1 =
|
142 |
-
* Disable check for comments from logged in users
|
143 |
-
|
144 |
-
= 5.0 =
|
145 |
-
* Rewriting/refactoring a lot of the code
|
146 |
-
* Adding Settings page
|
147 |
-
* Storing blocked comments into the Spam section
|
148 |
-
* Working on GDPR compliance
|
149 |
-
|
150 |
-
|
151 |
-
= 4.4 - 2017-08-30 =
|
152 |
-
* Fixed issue with showing comments on every page. Thanks to [johnh10](https://wordpress.org/support/topic/shows-the-captcha-on-archive-pages/)
|
153 |
-
|
154 |
-
= 4.3 - 2016-11-22 =
|
155 |
-
* fixed notices
|
156 |
-
|
157 |
-
= 4.2 - 2016-01-30 =
|
158 |
-
* removed XSS vulnerability - thanks to Kenan from [tbmnull.com](http://tbmnull.com/)
|
159 |
-
|
160 |
-
= 4.1 - 2015-10-25 =
|
161 |
-
* added log spam to file feature - huge thanks to [Guti](http://www.javiergutierrezchamorro.com/ "Javier Gutiérrez Chamorro")
|
162 |
-
* prevent full path disclosure
|
163 |
-
* added empty index.php file
|
164 |
-
* publish plugin to GitHub
|
165 |
-
* added Text Domain for translation.wordpress.org
|
166 |
-
|
167 |
-
= 4.0 - 2015-10-11 =
|
168 |
-
* dropped jQuery dependency (huge thanks to [Guti](http://www.javiergutierrezchamorro.com/ "Javier Gutiérrez Chamorro") for rewriting javascript code from scratch. Força Barça! )
|
169 |
-
* fixed issue with empty blocked spam counter (showing zero instead of nothing)
|
170 |
-
|
171 |
-
= 3.5 - 2015-01-17 =
|
172 |
-
* removed function_exists check because each function has unique prefix
|
173 |
-
* removed add_option()
|
174 |
-
* added autocomplete="off" for inputs (thanks to Feriman)
|
175 |
-
|
176 |
-
= 3.4 - 2014-12-20 =
|
177 |
-
* added the ability to hide or show info block in the "Screen Options" section
|
178 |
-
|
179 |
-
= 3.3 - 2014-12-15 =
|
180 |
-
* refactor code structure
|
181 |
-
* added blocked spam counter in the comments section
|
182 |
-
* clean up the docs
|
183 |
-
|
184 |
-
= 3.2 - 2014-12-05 =
|
185 |
-
* added ANTISPAM_VERSION constant (thanks to jumbo)
|
186 |
-
* removed new spam-block algorithm because it is not needed
|
187 |
-
|
188 |
-
= 3.1 - 2014-12-04 =
|
189 |
-
* remove log notices
|
190 |
-
|
191 |
-
= 3.0 - 2014-12-02 =
|
192 |
-
* added new spam-block algorithm
|
193 |
-
* bugfixing
|
194 |
-
* enqueue script only for pages with comments form and in the footer (thanks to dougvdotcom)
|
195 |
-
* refactor code structure
|
196 |
-
|
197 |
-
= 2.6 - 2014-11-30 =
|
198 |
-
* reverting to ver.2.2 state (enqueue script using 'init' hook and into the header) because users start receiving spam messages
|
199 |
-
|
200 |
-
= 2.5 - 2014-11-26 =
|
201 |
-
* update input names
|
202 |
-
|
203 |
-
= 2.4 - 2014-11-25 =
|
204 |
-
* update input names
|
205 |
-
|
206 |
-
= 2.3 - 2014-11-23 =
|
207 |
-
* enqueue script only for pages with comments form and in the footer (thanks to dougvdotcom)
|
208 |
-
* clean up code
|
209 |
-
|
210 |
-
= 2.2 - 2014-08-03 =
|
211 |
-
* clear value of the empty input because some themes are adding some value for all inputs
|
212 |
-
* updated FAQ section
|
213 |
-
|
214 |
-
= 2.1 - 2014-02-15 =
|
215 |
-
* add support for comments forms loaded via ajax
|
216 |
-
|
217 |
-
= 2.0 - 2014-01-04 =
|
218 |
-
* bug fixing
|
219 |
-
* updating info
|
220 |
-
|
221 |
-
= 1.9 - 2013-10-23 =
|
222 |
-
* change the html structure
|
223 |
-
|
224 |
-
= 1.8 - 2013-07-19 =
|
225 |
-
* removed labels from plugin markup because some themes try to get text from labels and insert it into inputs like placeholders (what cause an error)
|
226 |
-
* added info to FAQ section that Anti-spam plugin does not work with Jetpack Comments
|
227 |
-
|
228 |
-
= 1.7 - 2013-05-31 =
|
229 |
-
* if site has caching plugin enabled and cache is not cleared or if theme does not use 'comment_form' action - Anti-spam plugin does not worked; so now whole input added via javascript if it does not exist in html
|
230 |
-
|
231 |
-
= 1.6 - 2013-05-05 =
|
232 |
-
* add some more debug info in errors text
|
233 |
-
|
234 |
-
= 1.5 - 2013-04-15 =
|
235 |
-
* disable trackbacks because of spam (pingbacks are enabled)
|
236 |
-
|
237 |
-
= 1.4 - 2013-04-13 =
|
238 |
-
* code refactor
|
239 |
-
* renaming empty field to "*-email-url" to trap more spam
|
240 |
-
|
241 |
-
= 1.3 - 2013-04-10 =
|
242 |
-
* changing the input names and add some more traps because some spammers are passing the plugin
|
243 |
-
|
244 |
-
= 1.2 - 2012-10-28 =
|
245 |
-
* minor changes
|
246 |
-
|
247 |
-
= 1.1 - 2012-10-14 =
|
248 |
-
* sending answer from server to client into hidden field (because client year and server year could mismatch)
|
249 |
-
|
250 |
-
= 1.0 - 2012-09-06 =
|
251 |
-
* initial release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -193,6 +193,10 @@ You may check out the [source code of the plugin](http://plugins.trac.wordpress.
|
|
193 |
The plugin is pretty small and easy to read.
|
194 |
|
195 |
== Changelog ==
|
|
|
|
|
|
|
|
|
196 |
7.3.1 – 02.08.2022
|
197 |
Added: Compatibility with WordPress 6.0
|
198 |
Fixed: Minor bugs
|
193 |
The plugin is pretty small and easy to read.
|
194 |
|
195 |
== Changelog ==
|
196 |
+
7.3.2 – 10.09.2022
|
197 |
+
* Added: Compatibility with the new version of the premium plugin
|
198 |
+
* Fixed: Minor bugs
|
199 |
+
|
200 |
7.3.1 – 02.08.2022
|
201 |
Added: Compatibility with WordPress 6.0
|
202 |
Fixed: Minor bugs
|