Version Description
- Updated dismissible notice
Download this release
Release Info
Developer | webvitaly |
Plugin | Anti-spam |
Version | 5.4 |
Comparing to | |
See all releases |
Code changes from version 5.3 to 5.4
- .gitattributes +0 -17
- .gitignore +0 -43
- anti-spam-functions.php +140 -140
- anti-spam-info.php +79 -79
- anti-spam-notice.php +214 -214
- anti-spam-settings.php +89 -89
- anti-spam.php +101 -97
- js/{anti-spam-5.3.js → anti-spam-5.4.js} +72 -72
- readme.txt +246 -243
.gitattributes
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
# Auto detect text files and perform LF normalization
|
2 |
-
* text=auto
|
3 |
-
|
4 |
-
# Custom for Visual Studio
|
5 |
-
*.cs diff=csharp
|
6 |
-
|
7 |
-
# Standard to msysgit
|
8 |
-
*.doc diff=astextplain
|
9 |
-
*.DOC diff=astextplain
|
10 |
-
*.docx diff=astextplain
|
11 |
-
*.DOCX diff=astextplain
|
12 |
-
*.dot diff=astextplain
|
13 |
-
*.DOT diff=astextplain
|
14 |
-
*.pdf diff=astextplain
|
15 |
-
*.PDF diff=astextplain
|
16 |
-
*.rtf diff=astextplain
|
17 |
-
*.RTF diff=astextplain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
# Windows image file caches
|
2 |
-
Thumbs.db
|
3 |
-
ehthumbs.db
|
4 |
-
|
5 |
-
# Folder config file
|
6 |
-
Desktop.ini
|
7 |
-
|
8 |
-
# Recycle Bin used on file shares
|
9 |
-
$RECYCLE.BIN/
|
10 |
-
|
11 |
-
# Windows Installer files
|
12 |
-
*.cab
|
13 |
-
*.msi
|
14 |
-
*.msm
|
15 |
-
*.msp
|
16 |
-
|
17 |
-
# Windows shortcuts
|
18 |
-
*.lnk
|
19 |
-
|
20 |
-
# =========================
|
21 |
-
# Operating System Files
|
22 |
-
# =========================
|
23 |
-
|
24 |
-
# OSX
|
25 |
-
# =========================
|
26 |
-
|
27 |
-
.DS_Store
|
28 |
-
.AppleDouble
|
29 |
-
.LSOverride
|
30 |
-
|
31 |
-
# Thumbnails
|
32 |
-
._*
|
33 |
-
|
34 |
-
# Files that might appear on external disk
|
35 |
-
.Spotlight-V100
|
36 |
-
.Trashes
|
37 |
-
|
38 |
-
# Directories potentially created on remote AFP share
|
39 |
-
.AppleDB
|
40 |
-
.AppleDesktop
|
41 |
-
Network Trash Folder
|
42 |
-
Temporary Items
|
43 |
-
.apdisk
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
anti-spam-functions.php
CHANGED
@@ -1,141 +1,141 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
|
7 |
-
function antispam_default_settings() {
|
8 |
-
$settings = array(
|
9 |
-
'save_spam_comments' => 0
|
10 |
-
);
|
11 |
-
return $settings;
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
function antispam_get_settings() {
|
16 |
-
$antispam_settings = (array) get_option('antispam_settings');
|
17 |
-
$default_settings = antispam_default_settings();
|
18 |
-
$antispam_settings = array_merge($default_settings, $antispam_settings); // set empty options with default values
|
19 |
-
return $antispam_settings;
|
20 |
-
}
|
21 |
-
|
22 |
-
|
23 |
-
function antispam_counter_stats() {
|
24 |
-
$antispam_stats = get_option('antispam_stats', array());
|
25 |
-
if (array_key_exists('blocked_total', $antispam_stats)){
|
26 |
-
$antispam_stats['blocked_total']++;
|
27 |
-
} else {
|
28 |
-
$antispam_stats['blocked_total'] = 1;
|
29 |
-
}
|
30 |
-
update_option('antispam_stats', $antispam_stats);
|
31 |
-
}
|
32 |
-
|
33 |
-
|
34 |
-
function antispam_check_for_spam() {
|
35 |
-
$spam_flag = false;
|
36 |
-
|
37 |
-
$antspm_q = '';
|
38 |
-
if (isset($_POST['antspm-q'])) {
|
39 |
-
$antspm_q = trim($_POST['antspm-q']);
|
40 |
-
}
|
41 |
-
|
42 |
-
$antspm_d = '';
|
43 |
-
if (isset($_POST['antspm-d'])) {
|
44 |
-
$antspm_d = trim($_POST['antspm-d']);
|
45 |
-
}
|
46 |
-
|
47 |
-
$antspm_e = '';
|
48 |
-
if (isset($_POST['antspm-e-email-url-website'])) {
|
49 |
-
$antspm_e = trim($_POST['antspm-e-email-url-website']);
|
50 |
-
}
|
51 |
-
|
52 |
-
if ( $antspm_q != date('Y') ) { // year-answer is wrong - it is spam
|
53 |
-
if ( $antspm_d != date('Y') ) { // extra js-only check: there is no js added input - it is spam
|
54 |
-
$spam_flag = true;
|
55 |
-
if (empty($antspm_q)) { // empty answer - it is spam
|
56 |
-
//$antispam_error_message .= 'Error: empty answer. ['.esc_attr( $antspm_q ).']<br> '.$rn;
|
57 |
-
} else {
|
58 |
-
//$antispam_error_message .= 'Error: answer is wrong. ['.esc_attr( $antspm_q ).']<br> '.$rn;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
if ( ! empty($antspm_e)) { // trap field is not empty - it is spam
|
64 |
-
$spam_flag = true;
|
65 |
-
//$antispam_error_message .= 'Error: field should be empty. ['.esc_attr( $antspm_e ).']<br> '.$rn;
|
66 |
-
}
|
67 |
-
|
68 |
-
return $spam_flag;
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
function antispam_store_comment($commentdata) {
|
73 |
-
global $wpdb;
|
74 |
-
|
75 |
-
if ( isset( $commentdata['user_ID'] ) ) {
|
76 |
-
$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
77 |
-
}
|
78 |
-
|
79 |
-
$prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
|
80 |
-
|
81 |
-
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
82 |
-
if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) {
|
83 |
-
$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
84 |
-
} elseif ( isset( $commentdata['user_id'] ) ) {
|
85 |
-
$commentdata['user_id'] = (int) $commentdata['user_id'];
|
86 |
-
}
|
87 |
-
|
88 |
-
$commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
|
89 |
-
$parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
|
90 |
-
$commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
|
91 |
-
|
92 |
-
if ( ! isset( $commentdata['comment_author_IP'] ) ) {
|
93 |
-
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
|
94 |
-
}
|
95 |
-
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] );
|
96 |
-
|
97 |
-
if ( ! isset( $commentdata['comment_agent'] ) ) {
|
98 |
-
$commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '';
|
99 |
-
}
|
100 |
-
$commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 );
|
101 |
-
|
102 |
-
if ( empty( $commentdata['comment_date'] ) ) {
|
103 |
-
$commentdata['comment_date'] = current_time('mysql');
|
104 |
-
}
|
105 |
-
|
106 |
-
if ( empty( $commentdata['comment_date_gmt'] ) ) {
|
107 |
-
$commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
|
108 |
-
}
|
109 |
-
|
110 |
-
$commentdata = wp_filter_comment($commentdata);
|
111 |
-
|
112 |
-
$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
|
113 |
-
if ( is_wp_error( $commentdata['comment_approved'] ) ) {
|
114 |
-
return $commentdata['comment_approved'];
|
115 |
-
}
|
116 |
-
|
117 |
-
$comment_ID = wp_insert_comment($commentdata);
|
118 |
-
if ( ! $comment_ID ) {
|
119 |
-
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
|
120 |
-
|
121 |
-
foreach ( $fields as $field ) {
|
122 |
-
if ( isset( $commentdata[ $field ] ) ) {
|
123 |
-
$commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] );
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
$commentdata = wp_filter_comment( $commentdata );
|
128 |
-
|
129 |
-
$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
|
130 |
-
if ( is_wp_error( $commentdata['comment_approved'] ) ) {
|
131 |
-
return $commentdata['comment_approved'];
|
132 |
-
}
|
133 |
-
|
134 |
-
$comment_ID = wp_insert_comment( $commentdata );
|
135 |
-
if ( ! $comment_ID ) {
|
136 |
-
return false;
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
wp_set_comment_status( $comment_ID, 'spam' );
|
141 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
function antispam_default_settings() {
|
8 |
+
$settings = array(
|
9 |
+
'save_spam_comments' => 0
|
10 |
+
);
|
11 |
+
return $settings;
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
function antispam_get_settings() {
|
16 |
+
$antispam_settings = (array) get_option('antispam_settings');
|
17 |
+
$default_settings = antispam_default_settings();
|
18 |
+
$antispam_settings = array_merge($default_settings, $antispam_settings); // set empty options with default values
|
19 |
+
return $antispam_settings;
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
function antispam_counter_stats() {
|
24 |
+
$antispam_stats = get_option('antispam_stats', array());
|
25 |
+
if (array_key_exists('blocked_total', $antispam_stats)){
|
26 |
+
$antispam_stats['blocked_total']++;
|
27 |
+
} else {
|
28 |
+
$antispam_stats['blocked_total'] = 1;
|
29 |
+
}
|
30 |
+
update_option('antispam_stats', $antispam_stats);
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
function antispam_check_for_spam() {
|
35 |
+
$spam_flag = false;
|
36 |
+
|
37 |
+
$antspm_q = '';
|
38 |
+
if (isset($_POST['antspm-q'])) {
|
39 |
+
$antspm_q = trim($_POST['antspm-q']);
|
40 |
+
}
|
41 |
+
|
42 |
+
$antspm_d = '';
|
43 |
+
if (isset($_POST['antspm-d'])) {
|
44 |
+
$antspm_d = trim($_POST['antspm-d']);
|
45 |
+
}
|
46 |
+
|
47 |
+
$antspm_e = '';
|
48 |
+
if (isset($_POST['antspm-e-email-url-website'])) {
|
49 |
+
$antspm_e = trim($_POST['antspm-e-email-url-website']);
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $antspm_q != date('Y') ) { // year-answer is wrong - it is spam
|
53 |
+
if ( $antspm_d != date('Y') ) { // extra js-only check: there is no js added input - it is spam
|
54 |
+
$spam_flag = true;
|
55 |
+
if (empty($antspm_q)) { // empty answer - it is spam
|
56 |
+
//$antispam_error_message .= 'Error: empty answer. ['.esc_attr( $antspm_q ).']<br> '.$rn;
|
57 |
+
} else {
|
58 |
+
//$antispam_error_message .= 'Error: answer is wrong. ['.esc_attr( $antspm_q ).']<br> '.$rn;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( ! empty($antspm_e)) { // trap field is not empty - it is spam
|
64 |
+
$spam_flag = true;
|
65 |
+
//$antispam_error_message .= 'Error: field should be empty. ['.esc_attr( $antspm_e ).']<br> '.$rn;
|
66 |
+
}
|
67 |
+
|
68 |
+
return $spam_flag;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
function antispam_store_comment($commentdata) {
|
73 |
+
global $wpdb;
|
74 |
+
|
75 |
+
if ( isset( $commentdata['user_ID'] ) ) {
|
76 |
+
$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
77 |
+
}
|
78 |
+
|
79 |
+
$prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
|
80 |
+
|
81 |
+
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
|
82 |
+
if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) {
|
83 |
+
$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
|
84 |
+
} elseif ( isset( $commentdata['user_id'] ) ) {
|
85 |
+
$commentdata['user_id'] = (int) $commentdata['user_id'];
|
86 |
+
}
|
87 |
+
|
88 |
+
$commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
|
89 |
+
$parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
|
90 |
+
$commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
|
91 |
+
|
92 |
+
if ( ! isset( $commentdata['comment_author_IP'] ) ) {
|
93 |
+
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
|
94 |
+
}
|
95 |
+
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] );
|
96 |
+
|
97 |
+
if ( ! isset( $commentdata['comment_agent'] ) ) {
|
98 |
+
$commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '';
|
99 |
+
}
|
100 |
+
$commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 );
|
101 |
+
|
102 |
+
if ( empty( $commentdata['comment_date'] ) ) {
|
103 |
+
$commentdata['comment_date'] = current_time('mysql');
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( empty( $commentdata['comment_date_gmt'] ) ) {
|
107 |
+
$commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
|
108 |
+
}
|
109 |
+
|
110 |
+
$commentdata = wp_filter_comment($commentdata);
|
111 |
+
|
112 |
+
$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
|
113 |
+
if ( is_wp_error( $commentdata['comment_approved'] ) ) {
|
114 |
+
return $commentdata['comment_approved'];
|
115 |
+
}
|
116 |
+
|
117 |
+
$comment_ID = wp_insert_comment($commentdata);
|
118 |
+
if ( ! $comment_ID ) {
|
119 |
+
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
|
120 |
+
|
121 |
+
foreach ( $fields as $field ) {
|
122 |
+
if ( isset( $commentdata[ $field ] ) ) {
|
123 |
+
$commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] );
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
$commentdata = wp_filter_comment( $commentdata );
|
128 |
+
|
129 |
+
$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
|
130 |
+
if ( is_wp_error( $commentdata['comment_approved'] ) ) {
|
131 |
+
return $commentdata['comment_approved'];
|
132 |
+
}
|
133 |
+
|
134 |
+
$comment_ID = wp_insert_comment( $commentdata );
|
135 |
+
if ( ! $comment_ID ) {
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
wp_set_comment_status( $comment_ID, 'spam' );
|
141 |
}
|
anti-spam-info.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
|
7 |
-
function antispam_admin_notice() {
|
8 |
-
global $pagenow;
|
9 |
-
if ($pagenow == 'edit-comments.php'):
|
10 |
-
$user_id = get_current_user_id();
|
11 |
-
$antispam_info_visibility = get_user_meta($user_id, 'antispam_info_visibility', true);
|
12 |
-
if ($antispam_info_visibility == 1 OR $antispam_info_visibility == ''):
|
13 |
-
$blocked_total = 0; // show 0 by default
|
14 |
-
$antispam_stats = get_option('antispam_stats', array());
|
15 |
-
if (isset($antispam_stats['blocked_total'])) {
|
16 |
-
$blocked_total = $antispam_stats['blocked_total'];
|
17 |
-
}
|
18 |
-
?>
|
19 |
-
<div class="update-nag antispam-panel-info">
|
20 |
-
<p style="margin: 0;">
|
21 |
-
<?php echo $blocked_total; ?> spam comments were blocked by <a href="http://wordpress.org/plugins/anti-spam/">Anti-spam</a> plugin so far.
|
22 |
-
<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" title="Anti-spam Pro">Upgrade to Pro</a> for more advanced protection.
|
23 |
-
</p>
|
24 |
-
</div>
|
25 |
-
<?php
|
26 |
-
endif; // end of if($antispam_info_visibility)
|
27 |
-
endif; // end of if($pagenow == 'edit-comments.php')
|
28 |
-
}
|
29 |
-
add_action('admin_notices', 'antispam_admin_notice');
|
30 |
-
|
31 |
-
|
32 |
-
function antispam_display_screen_option() {
|
33 |
-
global $pagenow;
|
34 |
-
if ($pagenow == 'edit-comments.php'):
|
35 |
-
$user_id = get_current_user_id();
|
36 |
-
$antispam_info_visibility = get_user_meta($user_id, 'antispam_info_visibility', true);
|
37 |
-
|
38 |
-
if ($antispam_info_visibility == 1 OR $antispam_info_visibility == '') {
|
39 |
-
$checked = 'checked="checked"';
|
40 |
-
} else {
|
41 |
-
$checked = '';
|
42 |
-
}
|
43 |
-
|
44 |
-
?>
|
45 |
-
<script>
|
46 |
-
jQuery(function($){
|
47 |
-
$('.antispam_screen_options_group').insertAfter('#screen-options-wrap #adv-settings');
|
48 |
-
});
|
49 |
-
</script>
|
50 |
-
<form method="post" class="antispam_screen_options_group" style="padding: 20px 0 5px 0;">
|
51 |
-
<input type="hidden" name="antispam_option_submit" value="1" />
|
52 |
-
<label>
|
53 |
-
<input name="antispam_info_visibility" type="checkbox" value="1" <?php echo $checked; ?> />
|
54 |
-
Anti-spam info
|
55 |
-
</label>
|
56 |
-
<input type="submit" class="button" value="<?php _e('Apply'); ?>" />
|
57 |
-
</form>
|
58 |
-
<?php
|
59 |
-
endif; // end of if($pagenow == 'edit-comments.php')
|
60 |
-
}
|
61 |
-
|
62 |
-
|
63 |
-
function antispam_register_screen_option() {
|
64 |
-
add_filter('screen_layout_columns', 'antispam_display_screen_option');
|
65 |
-
}
|
66 |
-
add_action('admin_head', 'antispam_register_screen_option');
|
67 |
-
|
68 |
-
|
69 |
-
function antispam_update_screen_option() {
|
70 |
-
if (isset($_POST['antispam_option_submit']) AND $_POST['antispam_option_submit'] == 1) {
|
71 |
-
$user_id = get_current_user_id();
|
72 |
-
if (isset($_POST['antispam_info_visibility']) AND $_POST['antispam_info_visibility'] == 1) {
|
73 |
-
update_user_meta($user_id, 'antispam_info_visibility', 1);
|
74 |
-
} else {
|
75 |
-
update_user_meta($user_id, 'antispam_info_visibility', 0);
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
-
add_action('admin_init', 'antispam_update_screen_option');
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
function antispam_admin_notice() {
|
8 |
+
global $pagenow;
|
9 |
+
if ($pagenow == 'edit-comments.php'):
|
10 |
+
$user_id = get_current_user_id();
|
11 |
+
$antispam_info_visibility = get_user_meta($user_id, 'antispam_info_visibility', true);
|
12 |
+
if ($antispam_info_visibility == 1 OR $antispam_info_visibility == ''):
|
13 |
+
$blocked_total = 0; // show 0 by default
|
14 |
+
$antispam_stats = get_option('antispam_stats', array());
|
15 |
+
if (isset($antispam_stats['blocked_total'])) {
|
16 |
+
$blocked_total = $antispam_stats['blocked_total'];
|
17 |
+
}
|
18 |
+
?>
|
19 |
+
<div class="update-nag antispam-panel-info">
|
20 |
+
<p style="margin: 0;">
|
21 |
+
<?php echo $blocked_total; ?> spam comments were blocked by <a href="http://wordpress.org/plugins/anti-spam/">Anti-spam</a> plugin so far.
|
22 |
+
<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" title="Anti-spam Pro">Upgrade to Pro</a> for more advanced protection.
|
23 |
+
</p>
|
24 |
+
</div>
|
25 |
+
<?php
|
26 |
+
endif; // end of if($antispam_info_visibility)
|
27 |
+
endif; // end of if($pagenow == 'edit-comments.php')
|
28 |
+
}
|
29 |
+
add_action('admin_notices', 'antispam_admin_notice');
|
30 |
+
|
31 |
+
|
32 |
+
function antispam_display_screen_option() {
|
33 |
+
global $pagenow;
|
34 |
+
if ($pagenow == 'edit-comments.php'):
|
35 |
+
$user_id = get_current_user_id();
|
36 |
+
$antispam_info_visibility = get_user_meta($user_id, 'antispam_info_visibility', true);
|
37 |
+
|
38 |
+
if ($antispam_info_visibility == 1 OR $antispam_info_visibility == '') {
|
39 |
+
$checked = 'checked="checked"';
|
40 |
+
} else {
|
41 |
+
$checked = '';
|
42 |
+
}
|
43 |
+
|
44 |
+
?>
|
45 |
+
<script>
|
46 |
+
jQuery(function($){
|
47 |
+
$('.antispam_screen_options_group').insertAfter('#screen-options-wrap #adv-settings');
|
48 |
+
});
|
49 |
+
</script>
|
50 |
+
<form method="post" class="antispam_screen_options_group" style="padding: 20px 0 5px 0;">
|
51 |
+
<input type="hidden" name="antispam_option_submit" value="1" />
|
52 |
+
<label>
|
53 |
+
<input name="antispam_info_visibility" type="checkbox" value="1" <?php echo $checked; ?> />
|
54 |
+
Anti-spam info
|
55 |
+
</label>
|
56 |
+
<input type="submit" class="button" value="<?php _e('Apply'); ?>" />
|
57 |
+
</form>
|
58 |
+
<?php
|
59 |
+
endif; // end of if($pagenow == 'edit-comments.php')
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
function antispam_register_screen_option() {
|
64 |
+
add_filter('screen_layout_columns', 'antispam_display_screen_option');
|
65 |
+
}
|
66 |
+
add_action('admin_head', 'antispam_register_screen_option');
|
67 |
+
|
68 |
+
|
69 |
+
function antispam_update_screen_option() {
|
70 |
+
if (isset($_POST['antispam_option_submit']) AND $_POST['antispam_option_submit'] == 1) {
|
71 |
+
$user_id = get_current_user_id();
|
72 |
+
if (isset($_POST['antispam_info_visibility']) AND $_POST['antispam_info_visibility'] == 1) {
|
73 |
+
update_user_meta($user_id, 'antispam_info_visibility', 1);
|
74 |
+
} else {
|
75 |
+
update_user_meta($user_id, 'antispam_info_visibility', 0);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
add_action('admin_init', 'antispam_update_screen_option');
|
anti-spam-notice.php
CHANGED
@@ -1,214 +1,214 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Plugin Notice.
|
10 |
-
*
|
11 |
-
* @version 3.6.8
|
12 |
-
*/
|
13 |
-
class AntiSpamNotice {
|
14 |
-
/* Recommend plugins.
|
15 |
-
*
|
16 |
-
* @since 3.6.8
|
17 |
-
*/
|
18 |
-
protected static $sponsors = array(
|
19 |
-
'mailoptin' => 'mailoptin/mailoptin.php',
|
20 |
-
);
|
21 |
-
|
22 |
-
/**
|
23 |
-
* AntiSpamNotice constructor.
|
24 |
-
*
|
25 |
-
* @since 3.6.8
|
26 |
-
*/
|
27 |
-
public function __construct() {
|
28 |
-
// admin notices.
|
29 |
-
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
30 |
-
add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
|
31 |
-
|
32 |
-
add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Dismiss admin notice.
|
37 |
-
*
|
38 |
-
* @since 3.6.8
|
39 |
-
* @access public
|
40 |
-
*
|
41 |
-
* @return void
|
42 |
-
*/
|
43 |
-
public function dismiss_admin_notice() {
|
44 |
-
if ( ! isset( $_GET['antispam_action'] ) || $_GET['antispam_action'] != 'antispam_dismiss_notice' ) {
|
45 |
-
return;
|
46 |
-
}
|
47 |
-
|
48 |
-
$url = admin_url();
|
49 |
-
update_option( 'antispam_dismiss_notice', 'true' );
|
50 |
-
|
51 |
-
wp_redirect( $url );
|
52 |
-
exit;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Add admin notices.
|
57 |
-
*
|
58 |
-
* @since 3.6.8
|
59 |
-
* @access public
|
60 |
-
*
|
61 |
-
* @return void
|
62 |
-
*/
|
63 |
-
public function admin_notice() {
|
64 |
-
if ( get_option( 'antispam_dismiss_notice', 'false' ) == 'true' ) {
|
65 |
-
return;
|
66 |
-
}
|
67 |
-
|
68 |
-
if ( $this->is_plugin_installed( 'mailoptin' ) && $this->is_plugin_active( 'mailoptin' ) ) {
|
69 |
-
return;
|
70 |
-
}
|
71 |
-
|
72 |
-
$dismiss_url = esc_url_raw(
|
73 |
-
add_query_arg(
|
74 |
-
array(
|
75 |
-
'antispam_action' => 'antispam_dismiss_notice',
|
76 |
-
),
|
77 |
-
admin_url()
|
78 |
-
)
|
79 |
-
);
|
80 |
-
|
81 |
-
$this->notice_css();
|
82 |
-
|
83 |
-
$install_url = wp_nonce_url(
|
84 |
-
admin_url( 'update.php?action=install-plugin&plugin=mailoptin' ),
|
85 |
-
'install-plugin_mailoptin'
|
86 |
-
);
|
87 |
-
|
88 |
-
$activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php' ),
|
89 |
-
'activate-plugin_mailoptin/mailoptin.php' );
|
90 |
-
?>
|
91 |
-
<div class="mo-admin-notice notice notice-success">
|
92 |
-
<div class="mo-notice-row">
|
93 |
-
<div class="mo-notice-first-half">
|
94 |
-
<p>
|
95 |
-
<?php
|
96 |
-
printf(
|
97 |
-
__( 'Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.' ),
|
98 |
-
'<strong>', '</strong>' );
|
99 |
-
?>
|
100 |
-
</p>
|
101 |
-
<p style="font-size: 11px;">Recommended by Anti-Spam plugin</p>
|
102 |
-
</div>
|
103 |
-
<div class="mo-notice-other-half">
|
104 |
-
<?php if ( ! $this->is_plugin_installed( 'mailoptin' ) ) : ?>
|
105 |
-
<a class="button button-primary button-hero" id="mo-install-mailoptin-plugin"
|
106 |
-
href="<?php echo $install_url; ?>">
|
107 |
-
<?php _e( 'Install MailOptin Now for Free!' ); ?>
|
108 |
-
</a>
|
109 |
-
<?php endif; ?>
|
110 |
-
<?php if ( $this->is_plugin_installed( 'mailoptin' ) && ! $this->is_plugin_active( 'mailoptin' ) ) : ?>
|
111 |
-
<a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin"
|
112 |
-
href="<?php echo $activate_url; ?>">
|
113 |
-
<?php _e( 'Activate MailOptin Now!' ); ?>
|
114 |
-
</a>
|
115 |
-
<?php endif; ?>
|
116 |
-
<p>
|
117 |
-
<a target="_blank" href="https://mailoptin.io">Learn more</a>
|
118 |
-
</p>
|
119 |
-
</div>
|
120 |
-
</div>
|
121 |
-
<a class="notice-dismiss" href="<?php echo $dismiss_url; ?>">
|
122 |
-
|
123 |
-
<span class="screen-reader-text"><?php _e( 'Dismiss this notice' ); ?>.</span>
|
124 |
-
</a>
|
125 |
-
</div>
|
126 |
-
<?php
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Check if plugin is installed.
|
131 |
-
*
|
132 |
-
* @param $key
|
133 |
-
*
|
134 |
-
* @return bool
|
135 |
-
*/
|
136 |
-
protected function is_plugin_installed( $key ) {
|
137 |
-
$installed_plugins = get_plugins();
|
138 |
-
|
139 |
-
return isset( $installed_plugins[ self::$sponsors[ $key ] ] );
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Check if plugin is active.
|
144 |
-
*
|
145 |
-
* @param $key
|
146 |
-
*
|
147 |
-
* @return bool
|
148 |
-
*/
|
149 |
-
protected function is_plugin_active( $key ) {
|
150 |
-
return is_plugin_active( self::$sponsors[ $key ] );
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Styles for notice.
|
155 |
-
*
|
156 |
-
* @return void
|
157 |
-
*/
|
158 |
-
protected function notice_css() {
|
159 |
-
?>
|
160 |
-
<style type="text/css">
|
161 |
-
.mo-admin-notice {
|
162 |
-
background: #fff;
|
163 |
-
color: #000;
|
164 |
-
border-left-color: #46b450;
|
165 |
-
position: relative;
|
166 |
-
}
|
167 |
-
|
168 |
-
.mo-admin-notice .notice-dismiss {
|
169 |
-
text-decoration: none;
|
170 |
-
}
|
171 |
-
|
172 |
-
.mo-admin-notice .notice-dismiss:before {
|
173 |
-
color: #72777c;
|
174 |
-
}
|
175 |
-
|
176 |
-
.mo-notice-row {
|
177 |
-
display: flex;
|
178 |
-
flex-wrap: wrap;
|
179 |
-
padding: 15px 0;
|
180 |
-
}
|
181 |
-
|
182 |
-
.mo-notice-first-half {
|
183 |
-
flex-basis: 0;
|
184 |
-
flex-grow: 1;
|
185 |
-
flex: 0 0 66%;
|
186 |
-
max-width: 66%;
|
187 |
-
}
|
188 |
-
|
189 |
-
.mo-notice-other-half {
|
190 |
-
flex-basis: 0;
|
191 |
-
flex-grow: 1;
|
192 |
-
flex: 0 0 33%;
|
193 |
-
max-width: 33%;
|
194 |
-
text-align: center;
|
195 |
-
padding-top: 20px;
|
196 |
-
}
|
197 |
-
|
198 |
-
.mo-notice-first-half p {
|
199 |
-
font-size: 14px;
|
200 |
-
line-height: 18px;
|
201 |
-
}
|
202 |
-
|
203 |
-
@media (max-width: 768px) {
|
204 |
-
.mo-notice-first-half,
|
205 |
-
.mo-notice-other-half {
|
206 |
-
flex: 0 0 100%;
|
207 |
-
max-width: 100%;
|
208 |
-
}
|
209 |
-
}
|
210 |
-
|
211 |
-
</style>
|
212 |
-
<?php
|
213 |
-
}
|
214 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Plugin Notice.
|
10 |
+
*
|
11 |
+
* @version 3.6.8
|
12 |
+
*/
|
13 |
+
class AntiSpamNotice {
|
14 |
+
/* Recommend plugins.
|
15 |
+
*
|
16 |
+
* @since 3.6.8
|
17 |
+
*/
|
18 |
+
protected static $sponsors = array(
|
19 |
+
'mailoptin' => 'mailoptin/mailoptin.php',
|
20 |
+
);
|
21 |
+
|
22 |
+
/**
|
23 |
+
* AntiSpamNotice constructor.
|
24 |
+
*
|
25 |
+
* @since 3.6.8
|
26 |
+
*/
|
27 |
+
public function __construct() {
|
28 |
+
// admin notices.
|
29 |
+
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
|
30 |
+
add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
|
31 |
+
|
32 |
+
add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Dismiss admin notice.
|
37 |
+
*
|
38 |
+
* @since 3.6.8
|
39 |
+
* @access public
|
40 |
+
*
|
41 |
+
* @return void
|
42 |
+
*/
|
43 |
+
public function dismiss_admin_notice() {
|
44 |
+
if ( ! isset( $_GET['antispam_action'] ) || $_GET['antispam_action'] != 'antispam_dismiss_notice' ) {
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
|
48 |
+
$url = admin_url();
|
49 |
+
update_option( 'antispam_dismiss_notice', 'true' );
|
50 |
+
|
51 |
+
wp_redirect( $url );
|
52 |
+
exit;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Add admin notices.
|
57 |
+
*
|
58 |
+
* @since 3.6.8
|
59 |
+
* @access public
|
60 |
+
*
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
public function admin_notice() {
|
64 |
+
if ( get_option( 'antispam_dismiss_notice', 'false' ) == 'true' ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( $this->is_plugin_installed( 'mailoptin' ) && $this->is_plugin_active( 'mailoptin' ) ) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
|
72 |
+
$dismiss_url = esc_url_raw(
|
73 |
+
add_query_arg(
|
74 |
+
array(
|
75 |
+
'antispam_action' => 'antispam_dismiss_notice',
|
76 |
+
),
|
77 |
+
admin_url()
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
$this->notice_css();
|
82 |
+
|
83 |
+
$install_url = wp_nonce_url(
|
84 |
+
admin_url( 'update.php?action=install-plugin&plugin=mailoptin' ),
|
85 |
+
'install-plugin_mailoptin'
|
86 |
+
);
|
87 |
+
|
88 |
+
$activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php' ),
|
89 |
+
'activate-plugin_mailoptin/mailoptin.php' );
|
90 |
+
?>
|
91 |
+
<div class="mo-admin-notice notice notice-success">
|
92 |
+
<div class="mo-notice-row">
|
93 |
+
<div class="mo-notice-first-half">
|
94 |
+
<p>
|
95 |
+
<?php
|
96 |
+
printf(
|
97 |
+
__( 'Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.' ),
|
98 |
+
'<strong>', '</strong>' );
|
99 |
+
?>
|
100 |
+
</p>
|
101 |
+
<p style="font-size: 11px;">Recommended by Anti-Spam plugin</p>
|
102 |
+
</div>
|
103 |
+
<div class="mo-notice-other-half">
|
104 |
+
<?php if ( ! $this->is_plugin_installed( 'mailoptin' ) ) : ?>
|
105 |
+
<a class="button button-primary button-hero" id="mo-install-mailoptin-plugin"
|
106 |
+
href="<?php echo $install_url; ?>">
|
107 |
+
<?php _e( 'Install MailOptin Now for Free!' ); ?>
|
108 |
+
</a>
|
109 |
+
<?php endif; ?>
|
110 |
+
<?php if ( $this->is_plugin_installed( 'mailoptin' ) && ! $this->is_plugin_active( 'mailoptin' ) ) : ?>
|
111 |
+
<a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin"
|
112 |
+
href="<?php echo $activate_url; ?>">
|
113 |
+
<?php _e( 'Activate MailOptin Now!' ); ?>
|
114 |
+
</a>
|
115 |
+
<?php endif; ?>
|
116 |
+
<p>
|
117 |
+
<a target="_blank" href="https://mailoptin.io">Learn more</a>
|
118 |
+
</p>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
<a class="notice-dismiss" href="<?php echo $dismiss_url; ?>">
|
122 |
+
|
123 |
+
<span class="screen-reader-text"><?php _e( 'Dismiss this notice' ); ?>.</span>
|
124 |
+
</a>
|
125 |
+
</div>
|
126 |
+
<?php
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Check if plugin is installed.
|
131 |
+
*
|
132 |
+
* @param $key
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
+
protected function is_plugin_installed( $key ) {
|
137 |
+
$installed_plugins = get_plugins();
|
138 |
+
|
139 |
+
return isset( $installed_plugins[ self::$sponsors[ $key ] ] );
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Check if plugin is active.
|
144 |
+
*
|
145 |
+
* @param $key
|
146 |
+
*
|
147 |
+
* @return bool
|
148 |
+
*/
|
149 |
+
protected function is_plugin_active( $key ) {
|
150 |
+
return is_plugin_active( self::$sponsors[ $key ] );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Styles for notice.
|
155 |
+
*
|
156 |
+
* @return void
|
157 |
+
*/
|
158 |
+
protected function notice_css() {
|
159 |
+
?>
|
160 |
+
<style type="text/css">
|
161 |
+
.mo-admin-notice {
|
162 |
+
background: #fff;
|
163 |
+
color: #000;
|
164 |
+
border-left-color: #46b450;
|
165 |
+
position: relative;
|
166 |
+
}
|
167 |
+
|
168 |
+
.mo-admin-notice .notice-dismiss {
|
169 |
+
text-decoration: none;
|
170 |
+
}
|
171 |
+
|
172 |
+
.mo-admin-notice .notice-dismiss:before {
|
173 |
+
color: #72777c;
|
174 |
+
}
|
175 |
+
|
176 |
+
.mo-notice-row {
|
177 |
+
display: flex;
|
178 |
+
flex-wrap: wrap;
|
179 |
+
padding: 15px 0;
|
180 |
+
}
|
181 |
+
|
182 |
+
.mo-notice-first-half {
|
183 |
+
flex-basis: 0;
|
184 |
+
flex-grow: 1;
|
185 |
+
flex: 0 0 66%;
|
186 |
+
max-width: 66%;
|
187 |
+
}
|
188 |
+
|
189 |
+
.mo-notice-other-half {
|
190 |
+
flex-basis: 0;
|
191 |
+
flex-grow: 1;
|
192 |
+
flex: 0 0 33%;
|
193 |
+
max-width: 33%;
|
194 |
+
text-align: center;
|
195 |
+
padding-top: 20px;
|
196 |
+
}
|
197 |
+
|
198 |
+
.mo-notice-first-half p {
|
199 |
+
font-size: 14px;
|
200 |
+
line-height: 18px;
|
201 |
+
}
|
202 |
+
|
203 |
+
@media (max-width: 768px) {
|
204 |
+
.mo-notice-first-half,
|
205 |
+
.mo-notice-other-half {
|
206 |
+
flex: 0 0 100%;
|
207 |
+
max-width: 100%;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
</style>
|
212 |
+
<?php
|
213 |
+
}
|
214 |
+
}
|
anti-spam-settings.php
CHANGED
@@ -1,89 +1,89 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Anti-spam settings code
|
4 |
-
used WordPress Settings API - http://codex.wordpress.org/Settings_API
|
5 |
-
*/
|
6 |
-
|
7 |
-
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
8 |
-
exit;
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
function antispam_menu() { // add menu item
|
13 |
-
add_options_page('Anti-spam', 'Anti-spam', 'manage_options', 'anti-spam', 'antispam_settings');
|
14 |
-
}
|
15 |
-
add_action('admin_menu', 'antispam_menu');
|
16 |
-
|
17 |
-
|
18 |
-
function antispam_admin_init() {
|
19 |
-
register_setting('antispam_settings_group', 'antispam_settings', 'antispam_settings_validate');
|
20 |
-
|
21 |
-
add_settings_section('antispam_settings_automatic_section', '', 'antispam_section_callback', 'antispam_automatic_page');
|
22 |
-
|
23 |
-
add_settings_field('save_spam_comments', 'Save spam comments', 'antispam_field_save_spam_comments_callback', 'antispam_automatic_page', 'antispam_settings_automatic_section');
|
24 |
-
|
25 |
-
}
|
26 |
-
add_action('admin_init', 'antispam_admin_init');
|
27 |
-
|
28 |
-
|
29 |
-
function antispam_settings_init() { // set default settings
|
30 |
-
global $antispam_settings;
|
31 |
-
$antispam_settings = antispam_get_settings();
|
32 |
-
update_option('antispam_settings', $antispam_settings);
|
33 |
-
}
|
34 |
-
add_action('admin_init', 'antispam_settings_init');
|
35 |
-
|
36 |
-
|
37 |
-
function antispam_settings_validate($input) {
|
38 |
-
$default_settings = antispam_get_settings();
|
39 |
-
|
40 |
-
// checkbox
|
41 |
-
$output['save_spam_comments'] = $input['save_spam_comments'];
|
42 |
-
|
43 |
-
return $output;
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
function antispam_section_callback() { // Anti-spam settings description
|
48 |
-
echo '';
|
49 |
-
}
|
50 |
-
|
51 |
-
|
52 |
-
function antispam_field_save_spam_comments_callback() {
|
53 |
-
$settings = antispam_get_settings();
|
54 |
-
echo '<label><input type="checkbox" name="antispam_settings[save_spam_comments]" '.checked(1, $settings['save_spam_comments'], false).' value="1" />';
|
55 |
-
echo ' Save spam comments into spam section</label>';
|
56 |
-
echo '<p class="description">Useful for testing how the plugin works. <a href="'. admin_url( 'edit-comments.php?comment_status=spam' ) . '">View spam section</a>.</p>';
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
function antispam_settings() {
|
61 |
-
$antispam_stats = get_option('antispam_stats', array());
|
62 |
-
$blocked_total = $antispam_stats['blocked_total'];
|
63 |
-
if (empty($blocked_total)) {
|
64 |
-
$blocked_total = 0;
|
65 |
-
}
|
66 |
-
?>
|
67 |
-
<div class="wrap">
|
68 |
-
|
69 |
-
<h2><span class="dashicons dashicons-admin-generic"></span> Anti-spam</h2>
|
70 |
-
|
71 |
-
<div class="antispam-panel-info">
|
72 |
-
<p style="margin: 0;">
|
73 |
-
<span class="dashicons dashicons-chart-bar"></span>
|
74 |
-
<strong><?php echo $blocked_total; ?></strong> spam comments were blocked by <a href="https://wordpress.org/plugins/anti-spam/" target="_blank">Anti-spam</a> plugin so far.
|
75 |
-
Upgrade to <strong><a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" target="_blank">Anti-spam Pro</a></strong> for advanced protection.
|
76 |
-
</p>
|
77 |
-
</div>
|
78 |
-
|
79 |
-
<form method="post" action="options.php">
|
80 |
-
<?php settings_fields('antispam_settings_group'); ?>
|
81 |
-
<div class="antispam-group-automatic">
|
82 |
-
<?php do_settings_sections('antispam_automatic_page'); ?>
|
83 |
-
</div>
|
84 |
-
<?php submit_button(); ?>
|
85 |
-
</form>
|
86 |
-
|
87 |
-
</div>
|
88 |
-
<?php
|
89 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Anti-spam settings code
|
4 |
+
used WordPress Settings API - http://codex.wordpress.org/Settings_API
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
8 |
+
exit;
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
function antispam_menu() { // add menu item
|
13 |
+
add_options_page('Anti-spam', 'Anti-spam', 'manage_options', 'anti-spam', 'antispam_settings');
|
14 |
+
}
|
15 |
+
add_action('admin_menu', 'antispam_menu');
|
16 |
+
|
17 |
+
|
18 |
+
function antispam_admin_init() {
|
19 |
+
register_setting('antispam_settings_group', 'antispam_settings', 'antispam_settings_validate');
|
20 |
+
|
21 |
+
add_settings_section('antispam_settings_automatic_section', '', 'antispam_section_callback', 'antispam_automatic_page');
|
22 |
+
|
23 |
+
add_settings_field('save_spam_comments', 'Save spam comments', 'antispam_field_save_spam_comments_callback', 'antispam_automatic_page', 'antispam_settings_automatic_section');
|
24 |
+
|
25 |
+
}
|
26 |
+
add_action('admin_init', 'antispam_admin_init');
|
27 |
+
|
28 |
+
|
29 |
+
function antispam_settings_init() { // set default settings
|
30 |
+
global $antispam_settings;
|
31 |
+
$antispam_settings = antispam_get_settings();
|
32 |
+
update_option('antispam_settings', $antispam_settings);
|
33 |
+
}
|
34 |
+
add_action('admin_init', 'antispam_settings_init');
|
35 |
+
|
36 |
+
|
37 |
+
function antispam_settings_validate($input) {
|
38 |
+
$default_settings = antispam_get_settings();
|
39 |
+
|
40 |
+
// checkbox
|
41 |
+
$output['save_spam_comments'] = $input['save_spam_comments'];
|
42 |
+
|
43 |
+
return $output;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
function antispam_section_callback() { // Anti-spam settings description
|
48 |
+
echo '';
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
function antispam_field_save_spam_comments_callback() {
|
53 |
+
$settings = antispam_get_settings();
|
54 |
+
echo '<label><input type="checkbox" name="antispam_settings[save_spam_comments]" '.checked(1, $settings['save_spam_comments'], false).' value="1" />';
|
55 |
+
echo ' Save spam comments into spam section</label>';
|
56 |
+
echo '<p class="description">Useful for testing how the plugin works. <a href="'. admin_url( 'edit-comments.php?comment_status=spam' ) . '">View spam section</a>.</p>';
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
function antispam_settings() {
|
61 |
+
$antispam_stats = get_option('antispam_stats', array());
|
62 |
+
$blocked_total = $antispam_stats['blocked_total'];
|
63 |
+
if (empty($blocked_total)) {
|
64 |
+
$blocked_total = 0;
|
65 |
+
}
|
66 |
+
?>
|
67 |
+
<div class="wrap">
|
68 |
+
|
69 |
+
<h2><span class="dashicons dashicons-admin-generic"></span> Anti-spam</h2>
|
70 |
+
|
71 |
+
<div class="antispam-panel-info">
|
72 |
+
<p style="margin: 0;">
|
73 |
+
<span class="dashicons dashicons-chart-bar"></span>
|
74 |
+
<strong><?php echo $blocked_total; ?></strong> spam comments were blocked by <a href="https://wordpress.org/plugins/anti-spam/" target="_blank">Anti-spam</a> plugin so far.
|
75 |
+
Upgrade to <strong><a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" target="_blank">Anti-spam Pro</a></strong> for advanced protection.
|
76 |
+
</p>
|
77 |
+
</div>
|
78 |
+
|
79 |
+
<form method="post" action="options.php">
|
80 |
+
<?php settings_fields('antispam_settings_group'); ?>
|
81 |
+
<div class="antispam-group-automatic">
|
82 |
+
<?php do_settings_sections('antispam_automatic_page'); ?>
|
83 |
+
</div>
|
84 |
+
<?php submit_button(); ?>
|
85 |
+
</form>
|
86 |
+
|
87 |
+
</div>
|
88 |
+
<?php
|
89 |
+
}
|
anti-spam.php
CHANGED
@@ -1,97 +1,101 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Anti-spam
|
4 |
-
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
-
Description: No spam in comments. No captcha.
|
6 |
-
Version: 5.
|
7 |
-
Author: webvitaly
|
8 |
-
Text Domain: anti-spam
|
9 |
-
Author URI: http://web-profile.net/wordpress/plugins/
|
10 |
-
License: GPLv3
|
11 |
-
*/
|
12 |
-
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
define('ANTISPAM_PLUGIN_VERSION', '5.
|
18 |
-
|
19 |
-
include('anti-spam-functions.php');
|
20 |
-
include('anti-spam-settings.php');
|
21 |
-
include('anti-spam-info.php');
|
22 |
-
|
23 |
-
include 'anti-spam-notice.php';
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
<
|
48 |
-
<input type="text" name="antspm-
|
49 |
-
</p>'.$rn; //
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Anti-spam
|
4 |
+
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
+
Description: No spam in comments. No captcha.
|
6 |
+
Version: 5.4
|
7 |
+
Author: webvitaly
|
8 |
+
Text Domain: anti-spam
|
9 |
+
Author URI: http://web-profile.net/wordpress/plugins/
|
10 |
+
License: GPLv3
|
11 |
+
*/
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
define('ANTISPAM_PLUGIN_VERSION', '5.4');
|
18 |
+
|
19 |
+
include('anti-spam-functions.php');
|
20 |
+
include('anti-spam-settings.php');
|
21 |
+
include('anti-spam-info.php');
|
22 |
+
|
23 |
+
include 'anti-spam-notice.php';
|
24 |
+
|
25 |
+
global $pagenow;
|
26 |
+
if ($pagenow == 'options-general.php' && $_GET['page'] == 'anti-spam'):
|
27 |
+
new AntiSpamNotice();
|
28 |
+
endif;
|
29 |
+
|
30 |
+
|
31 |
+
function antispam_enqueue_script() {
|
32 |
+
global $withcomments; // WP flag to show comments on all pages
|
33 |
+
if ((is_singular() || $withcomments) && comments_open()) { // load script only for pages with comments form
|
34 |
+
wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-5.4.js', __FILE__), null, null, true);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
|
38 |
+
|
39 |
+
|
40 |
+
function antispam_form_part() {
|
41 |
+
$rn = "\r\n"; // .chr(13).chr(10)
|
42 |
+
|
43 |
+
if ( ! is_user_logged_in()) { // add anti-spam fields only for not logged in users
|
44 |
+
echo $rn.'<!-- Anti-spam plugin v.'.ANTISPAM_PLUGIN_VERSION.' wordpress.org/plugins/anti-spam/ -->'.$rn;
|
45 |
+
echo ' <p class="antispam-group antispam-group-q" style="clear: both;">
|
46 |
+
<label>Current ye@r <span class="required">*</span></label>
|
47 |
+
<input type="hidden" name="antspm-a" class="antispam-control antispam-control-a" value="'.date('Y').'" />
|
48 |
+
<input type="text" name="antspm-q" class="antispam-control antispam-control-q" value="'.ANTISPAM_PLUGIN_VERSION.'" autocomplete="off" />
|
49 |
+
</p>'.$rn; // question (hidden with js)
|
50 |
+
echo ' <p class="antispam-group antispam-group-e" style="display: none;">
|
51 |
+
<label>Leave this field empty</label>
|
52 |
+
<input type="text" name="antspm-e-email-url-website" class="antispam-control antispam-control-e" value="" autocomplete="off" />
|
53 |
+
</p>'.$rn; // empty field (hidden with css); trap for spammers because many bots will try to put email or url here
|
54 |
+
}
|
55 |
+
}
|
56 |
+
add_action('comment_form', 'antispam_form_part'); // add anti-spam inputs to the comment form
|
57 |
+
|
58 |
+
|
59 |
+
function antispam_check_comment($commentdata) {
|
60 |
+
$antispam_settings = antispam_get_settings();
|
61 |
+
|
62 |
+
extract($commentdata);
|
63 |
+
|
64 |
+
if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback') { // logged in user is not a spammer
|
65 |
+
if( antispam_check_for_spam() ) {
|
66 |
+
if( $antispam_settings['save_spam_comments'] ) {
|
67 |
+
antispam_store_comment($commentdata);
|
68 |
+
}
|
69 |
+
antispam_counter_stats();
|
70 |
+
wp_die('Comment is a spam.'); // die - do not send comment and show error message
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
if ($comment_type == 'trackback') {
|
75 |
+
if( $antispam_settings['save_spam_comments'] ) {
|
76 |
+
antispam_store_comment($commentdata);
|
77 |
+
}
|
78 |
+
antispam_counter_stats();
|
79 |
+
wp_die('Trackbacks are disabled.'); // die - do not send trackback and show error message
|
80 |
+
}
|
81 |
+
|
82 |
+
return $commentdata; // if comment does not looks like spam
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( ! is_admin()) { // without this check it is not possible to add comment in admin section
|
86 |
+
add_filter('preprocess_comment', 'antispam_check_comment', 1);
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
function antispam_plugin_meta($links, $file) { // add some links to plugin meta row
|
91 |
+
if ( $file == plugin_basename( __FILE__ ) ) {
|
92 |
+
$row_meta = array(
|
93 |
+
'support' => '<a href="http://web-profile.net/wordpress/plugins/anti-spam/" target="_blank">' . __( 'Anti-spam', 'anti-spam' ) . '</a>',
|
94 |
+
'donate' => '<a href="http://web-profile.net/donate/" target="_blank">' . __( 'Donate', 'anti-spam' ) . '</a>',
|
95 |
+
'upgrage' => '<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" target="_blank">' . __( 'Anti-spam Pro', 'anti-spam' ) . '</a>'
|
96 |
+
);
|
97 |
+
$links = array_merge( $links, $row_meta );
|
98 |
+
}
|
99 |
+
return (array) $links;
|
100 |
+
}
|
101 |
+
add_filter('plugin_row_meta', 'antispam_plugin_meta', 10, 2);
|
js/{anti-spam-5.3.js → anti-spam-5.4.js}
RENAMED
@@ -1,73 +1,73 @@
|
|
1 |
-
/*
|
2 |
-
Anti-spam plugin
|
3 |
-
No spam in comments. No captcha.
|
4 |
-
wordpress.org/plugins/anti-spam/
|
5 |
-
*/
|
6 |
-
|
7 |
-
"use strict";
|
8 |
-
(function() {
|
9 |
-
function anti_spam_init() {
|
10 |
-
|
11 |
-
var i,
|
12 |
-
len,
|
13 |
-
elements,
|
14 |
-
answer = '',
|
15 |
-
current_year = new Date().getFullYear(),
|
16 |
-
dynamic_control;
|
17 |
-
|
18 |
-
elements = document.querySelectorAll('.antispam-group');
|
19 |
-
len = elements.length;
|
20 |
-
for (i = 0; i < len; i++) { // hide inputs from users
|
21 |
-
elements[i].style.display = 'none';
|
22 |
-
}
|
23 |
-
|
24 |
-
elements = document.querySelectorAll('.antispam-control-a');
|
25 |
-
if ((elements) && (elements.length > 0)) { // get the answer
|
26 |
-
answer = elements[0].value;
|
27 |
-
}
|
28 |
-
|
29 |
-
elements = document.querySelectorAll('.antispam-control-q');
|
30 |
-
len = elements.length;
|
31 |
-
for (i = 0; i < len; i++) { // set answer into other input instead of user
|
32 |
-
elements[i].value = answer;
|
33 |
-
}
|
34 |
-
|
35 |
-
// clear value of the empty input because some themes are adding some value for all inputs
|
36 |
-
elements = document.querySelectorAll('.antispam-control-e');
|
37 |
-
len = elements.length;
|
38 |
-
for (i = 0; i < len; i++) {
|
39 |
-
elements[i].value = '';
|
40 |
-
}
|
41 |
-
|
42 |
-
//dynamic_control = '<input type="text" name="antspm-d" class="antispam-control antispam-control-d" value="' + current_year + '" />';
|
43 |
-
dynamic_control = document.createElement('input');
|
44 |
-
dynamic_control.setAttribute('type', 'hidden');
|
45 |
-
dynamic_control.setAttribute('name', 'antspm-d');
|
46 |
-
dynamic_control.setAttribute('class', 'antispam-control antispam-control-d');
|
47 |
-
dynamic_control.setAttribute('value', current_year);
|
48 |
-
|
49 |
-
// add input for every comment form if there are more than 1 form with IDs: comments, respond or commentform
|
50 |
-
elements = document.querySelectorAll('form');
|
51 |
-
len = elements.length;
|
52 |
-
for (i = 0; i < len; i++) {
|
53 |
-
if ( (elements[i].id === 'comments') || (elements[i].id === 'respond') || (elements[i].id === 'commentform') ) {
|
54 |
-
var class_index = elements[i].className.indexOf('anti-spam-form-processed');
|
55 |
-
if ( class_index == -1 ) { // form is not yet js processed
|
56 |
-
//elements[i].innerHTML += dynamic_control; // not working
|
57 |
-
elements[i].appendChild(dynamic_control);
|
58 |
-
elements[i].className = elements[i].className + ' anti-spam-form-processed';
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
if (document.addEventListener) {
|
65 |
-
document.addEventListener('DOMContentLoaded', anti_spam_init, false);
|
66 |
-
}
|
67 |
-
|
68 |
-
// set 1 second timeout for having form loaded and adding support for browsers which does not support 'DOMContentLoaded' listener
|
69 |
-
setTimeout(function () {
|
70 |
-
anti_spam_init();
|
71 |
-
}, 1000);
|
72 |
-
|
73 |
})();
|
1 |
+
/*
|
2 |
+
Anti-spam plugin
|
3 |
+
No spam in comments. No captcha.
|
4 |
+
wordpress.org/plugins/anti-spam/
|
5 |
+
*/
|
6 |
+
|
7 |
+
"use strict";
|
8 |
+
(function() {
|
9 |
+
function anti_spam_init() {
|
10 |
+
|
11 |
+
var i,
|
12 |
+
len,
|
13 |
+
elements,
|
14 |
+
answer = '',
|
15 |
+
current_year = new Date().getFullYear(),
|
16 |
+
dynamic_control;
|
17 |
+
|
18 |
+
elements = document.querySelectorAll('.antispam-group');
|
19 |
+
len = elements.length;
|
20 |
+
for (i = 0; i < len; i++) { // hide inputs from users
|
21 |
+
elements[i].style.display = 'none';
|
22 |
+
}
|
23 |
+
|
24 |
+
elements = document.querySelectorAll('.antispam-control-a');
|
25 |
+
if ((elements) && (elements.length > 0)) { // get the answer
|
26 |
+
answer = elements[0].value;
|
27 |
+
}
|
28 |
+
|
29 |
+
elements = document.querySelectorAll('.antispam-control-q');
|
30 |
+
len = elements.length;
|
31 |
+
for (i = 0; i < len; i++) { // set answer into other input instead of user
|
32 |
+
elements[i].value = answer;
|
33 |
+
}
|
34 |
+
|
35 |
+
// clear value of the empty input because some themes are adding some value for all inputs
|
36 |
+
elements = document.querySelectorAll('.antispam-control-e');
|
37 |
+
len = elements.length;
|
38 |
+
for (i = 0; i < len; i++) {
|
39 |
+
elements[i].value = '';
|
40 |
+
}
|
41 |
+
|
42 |
+
//dynamic_control = '<input type="text" name="antspm-d" class="antispam-control antispam-control-d" value="' + current_year + '" />';
|
43 |
+
dynamic_control = document.createElement('input');
|
44 |
+
dynamic_control.setAttribute('type', 'hidden');
|
45 |
+
dynamic_control.setAttribute('name', 'antspm-d');
|
46 |
+
dynamic_control.setAttribute('class', 'antispam-control antispam-control-d');
|
47 |
+
dynamic_control.setAttribute('value', current_year);
|
48 |
+
|
49 |
+
// add input for every comment form if there are more than 1 form with IDs: comments, respond or commentform
|
50 |
+
elements = document.querySelectorAll('form');
|
51 |
+
len = elements.length;
|
52 |
+
for (i = 0; i < len; i++) {
|
53 |
+
if ( (elements[i].id === 'comments') || (elements[i].id === 'respond') || (elements[i].id === 'commentform') ) {
|
54 |
+
var class_index = elements[i].className.indexOf('anti-spam-form-processed');
|
55 |
+
if ( class_index == -1 ) { // form is not yet js processed
|
56 |
+
//elements[i].innerHTML += dynamic_control; // not working
|
57 |
+
elements[i].appendChild(dynamic_control);
|
58 |
+
elements[i].className = elements[i].className + ' anti-spam-form-processed';
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
if (document.addEventListener) {
|
65 |
+
document.addEventListener('DOMContentLoaded', anti_spam_init, false);
|
66 |
+
}
|
67 |
+
|
68 |
+
// set 1 second timeout for having form loaded and adding support for browsers which does not support 'DOMContentLoaded' listener
|
69 |
+
setTimeout(function () {
|
70 |
+
anti_spam_init();
|
71 |
+
}, 1000);
|
72 |
+
|
73 |
})();
|
readme.txt
CHANGED
@@ -1,244 +1,247 @@
|
|
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.
|
7 |
-
Stable tag: 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.
|
126 |
-
*
|
127 |
-
|
128 |
-
|
129 |
-
*
|
130 |
-
|
131 |
-
|
132 |
-
*
|
133 |
-
|
134 |
-
= 5.
|
135 |
-
* Disable
|
136 |
-
|
137 |
-
= 5.
|
138 |
-
*
|
139 |
-
|
140 |
-
|
141 |
-
*
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
= 4.
|
148 |
-
*
|
149 |
-
|
150 |
-
= 4.
|
151 |
-
*
|
152 |
-
|
153 |
-
= 4.
|
154 |
-
*
|
155 |
-
|
156 |
-
|
157 |
-
*
|
158 |
-
*
|
159 |
-
|
160 |
-
|
161 |
-
*
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
*
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
* added
|
171 |
-
|
172 |
-
= 3.
|
173 |
-
*
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
*
|
183 |
-
|
184 |
-
= 3.
|
185 |
-
*
|
186 |
-
|
187 |
-
|
188 |
-
*
|
189 |
-
|
190 |
-
|
191 |
-
*
|
192 |
-
|
193 |
-
= 2.
|
194 |
-
*
|
195 |
-
|
196 |
-
= 2.
|
197 |
-
* update input names
|
198 |
-
|
199 |
-
= 2.
|
200 |
-
*
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
*
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
*
|
209 |
-
|
210 |
-
= 2.
|
211 |
-
*
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
*
|
216 |
-
|
217 |
-
= 1.
|
218 |
-
*
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
*
|
223 |
-
|
224 |
-
= 1.
|
225 |
-
*
|
226 |
-
|
227 |
-
= 1.
|
228 |
-
*
|
229 |
-
|
230 |
-
= 1.
|
231 |
-
*
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
*
|
236 |
-
|
237 |
-
= 1.
|
238 |
-
*
|
239 |
-
|
240 |
-
= 1.
|
241 |
-
*
|
242 |
-
|
243 |
-
= 1.
|
|
|
|
|
|
|
244 |
* initial release
|
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.4
|
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.4 =
|
126 |
+
* Updated dismissible notice
|
127 |
+
|
128 |
+
= 5.3 =
|
129 |
+
* Fixed the typo in the readme
|
130 |
+
* Readme cleanup
|
131 |
+
* Code cleanup
|
132 |
+
* Added dismissible notice
|
133 |
+
|
134 |
+
= 5.2 =
|
135 |
+
* Disable trackbacks
|
136 |
+
|
137 |
+
= 5.1 =
|
138 |
+
* Disable check for comments from logged in users
|
139 |
+
|
140 |
+
= 5.0 =
|
141 |
+
* Rewriting/refactoring a lot of the code
|
142 |
+
* Adding Settings page
|
143 |
+
* Storing blocked comments into the Spam section
|
144 |
+
* Working on GDPR compliance
|
145 |
+
|
146 |
+
|
147 |
+
= 4.4 - 2017-08-30 =
|
148 |
+
* Fixed issue with showing comments on every page. Thanks to [johnh10](https://wordpress.org/support/topic/shows-the-captcha-on-archive-pages/)
|
149 |
+
|
150 |
+
= 4.3 - 2016-11-22 =
|
151 |
+
* fixed notices
|
152 |
+
|
153 |
+
= 4.2 - 2016-01-30 =
|
154 |
+
* removed XSS vulnerability - thanks to Kenan from [tbmnull.com](http://tbmnull.com/)
|
155 |
+
|
156 |
+
= 4.1 - 2015-10-25 =
|
157 |
+
* added log spam to file feature - huge thanks to [Guti](http://www.javiergutierrezchamorro.com/ "Javier Gutiérrez Chamorro")
|
158 |
+
* prevent full path disclosure
|
159 |
+
* added empty index.php file
|
160 |
+
* publish plugin to GitHub
|
161 |
+
* added Text Domain for translation.wordpress.org
|
162 |
+
|
163 |
+
= 4.0 - 2015-10-11 =
|
164 |
+
* 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! )
|
165 |
+
* fixed issue with empty blocked spam counter (showing zero instead of nothing)
|
166 |
+
|
167 |
+
= 3.5 - 2015-01-17 =
|
168 |
+
* removed function_exists check because each function has unique prefix
|
169 |
+
* removed add_option()
|
170 |
+
* added autocomplete="off" for inputs (thanks to Feriman)
|
171 |
+
|
172 |
+
= 3.4 - 2014-12-20 =
|
173 |
+
* added the ability to hide or show info block in the "Screen Options" section
|
174 |
+
|
175 |
+
= 3.3 - 2014-12-15 =
|
176 |
+
* refactor code structure
|
177 |
+
* added blocked spam counter in the comments section
|
178 |
+
* clean up the docs
|
179 |
+
|
180 |
+
= 3.2 - 2014-12-05 =
|
181 |
+
* added ANTISPAM_VERSION constant (thanks to jumbo)
|
182 |
+
* removed new spam-block algorithm because it is not needed
|
183 |
+
|
184 |
+
= 3.1 - 2014-12-04 =
|
185 |
+
* remove log notices
|
186 |
+
|
187 |
+
= 3.0 - 2014-12-02 =
|
188 |
+
* added new spam-block algorithm
|
189 |
+
* bugfixing
|
190 |
+
* enqueue script only for pages with comments form and in the footer (thanks to dougvdotcom)
|
191 |
+
* refactor code structure
|
192 |
+
|
193 |
+
= 2.6 - 2014-11-30 =
|
194 |
+
* reverting to ver.2.2 state (enqueue script using 'init' hook and into the header) because users start receiving spam messages
|
195 |
+
|
196 |
+
= 2.5 - 2014-11-26 =
|
197 |
+
* update input names
|
198 |
+
|
199 |
+
= 2.4 - 2014-11-25 =
|
200 |
+
* update input names
|
201 |
+
|
202 |
+
= 2.3 - 2014-11-23 =
|
203 |
+
* enqueue script only for pages with comments form and in the footer (thanks to dougvdotcom)
|
204 |
+
* clean up code
|
205 |
+
|
206 |
+
= 2.2 - 2014-08-03 =
|
207 |
+
* clear value of the empty input because some themes are adding some value for all inputs
|
208 |
+
* updated FAQ section
|
209 |
+
|
210 |
+
= 2.1 - 2014-02-15 =
|
211 |
+
* add support for comments forms loaded via ajax
|
212 |
+
|
213 |
+
= 2.0 - 2014-01-04 =
|
214 |
+
* bug fixing
|
215 |
+
* updating info
|
216 |
+
|
217 |
+
= 1.9 - 2013-10-23 =
|
218 |
+
* change the html structure
|
219 |
+
|
220 |
+
= 1.8 - 2013-07-19 =
|
221 |
+
* 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)
|
222 |
+
* added info to FAQ section that Anti-spam plugin does not work with Jetpack Comments
|
223 |
+
|
224 |
+
= 1.7 - 2013-05-31 =
|
225 |
+
* 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
|
226 |
+
|
227 |
+
= 1.6 - 2013-05-05 =
|
228 |
+
* add some more debug info in errors text
|
229 |
+
|
230 |
+
= 1.5 - 2013-04-15 =
|
231 |
+
* disable trackbacks because of spam (pingbacks are enabled)
|
232 |
+
|
233 |
+
= 1.4 - 2013-04-13 =
|
234 |
+
* code refactor
|
235 |
+
* renaming empty field to "*-email-url" to trap more spam
|
236 |
+
|
237 |
+
= 1.3 - 2013-04-10 =
|
238 |
+
* changing the input names and add some more traps because some spammers are passing the plugin
|
239 |
+
|
240 |
+
= 1.2 - 2012-10-28 =
|
241 |
+
* minor changes
|
242 |
+
|
243 |
+
= 1.1 - 2012-10-14 =
|
244 |
+
* sending answer from server to client into hidden field (because client year and server year could mismatch)
|
245 |
+
|
246 |
+
= 1.0 - 2012-09-06 =
|
247 |
* initial release
|