Version Description
- Removed Grunt creation of the trunk directory
- Added spam detection script to registration form
Download this release
Release Info
Developer | bmarshall511 |
Plugin | WordPress Zero Spam |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.3.0
- grunt/aliases.yaml +0 -1
- grunt/watch.js +0 -4
- package.json +0 -1
- readme.txt +9 -4
- zero-spam.js +3 -3
- zero-spam.min.js +1 -1
- zero-spam.php +28 -7
grunt/aliases.yaml
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
default:
|
2 |
- 'jshint'
|
3 |
- 'uglify'
|
4 |
-
- 'copy'
|
5 |
- 'watch'
|
1 |
default:
|
2 |
- 'jshint'
|
3 |
- 'uglify'
|
|
|
4 |
- 'watch'
|
grunt/watch.js
CHANGED
@@ -6,9 +6,5 @@ module.exports = {
|
|
6 |
src: {
|
7 |
files: ['zero-spam.js'],
|
8 |
tasks: ['jshint:src', 'uglify']
|
9 |
-
},
|
10 |
-
trunk: {
|
11 |
-
files: ['zero-spam.js', 'zero-spam.min.js', 'zero-spam.php', 'readme.txt'],
|
12 |
-
tasks: ['copy']
|
13 |
}
|
14 |
};
|
6 |
src: {
|
7 |
files: ['zero-spam.js'],
|
8 |
tasks: ['jshint:src', 'uglify']
|
|
|
|
|
|
|
|
|
9 |
}
|
10 |
};
|
package.json
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
},
|
8 |
"devDependencies": {
|
9 |
"grunt": "~0.4.2",
|
10 |
-
"grunt-contrib-copy": "^0.5.0",
|
11 |
"grunt-contrib-jshint": "*",
|
12 |
"grunt-contrib-uglify": "^0.5.0",
|
13 |
"grunt-contrib-watch": "^0.6.1",
|
7 |
},
|
8 |
"devDependencies": {
|
9 |
"grunt": "~0.4.2",
|
|
|
10 |
"grunt-contrib-jshint": "*",
|
11 |
"grunt-contrib-uglify": "^0.5.0",
|
12 |
"grunt-contrib-watch": "^0.6.1",
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== WordPress Zero Spam ===
|
2 |
Contributors: bmarshall511, afragen
|
3 |
Donate link: https://www.gittip.com/bmarshall511/
|
4 |
-
Tags: comments, spam, antispam, anti-spam, comment spam, spambot, spammer, spam free, spam blocker
|
5 |
Requires at least: 3.0.0
|
6 |
Tested up to: 3.9.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -14,7 +14,7 @@ Zero Spam makes blocking spam comments a cinch. Install, activate and enjoy a sp
|
|
14 |
|
15 |
**Why should your users prove that they're humans by filling out captchas? Let bots prove their not bots with the <a href="http://www.benmarshall.me/wordpress-zero-spam-plugin/" target="_blank">WordPress Zero Spam plugin</a>.**
|
16 |
|
17 |
-
WordPress Zero Spam blocks spam in comments automatically without any additional config or setup. Just install, activate and enjoy a spam-free site.
|
18 |
|
19 |
Zero Spam was initially built based on the work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
|
20 |
|
@@ -22,7 +22,8 @@ Major features in WordPress Zero Spam include:
|
|
22 |
|
23 |
* **No captcha**, because spam is not users' problem
|
24 |
* **No moderation queues**, because spam is not administrators' problem
|
25 |
-
* Blocks spam comments with
|
|
|
26 |
|
27 |
**Languages:** English
|
28 |
|
@@ -43,6 +44,10 @@ Be sure JavaScript is enabled and there are no JS errors.
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
|
|
46 |
= 1.2.1 =
|
47 |
* Fixed some typos in the readme.txt file
|
48 |
|
1 |
=== WordPress Zero Spam ===
|
2 |
Contributors: bmarshall511, afragen
|
3 |
Donate link: https://www.gittip.com/bmarshall511/
|
4 |
+
Tags: comments, spam, antispam, anti-spam, comment spam, spambot, spammer, spam free, spam blocker, registration spam
|
5 |
Requires at least: 3.0.0
|
6 |
Tested up to: 3.9.2
|
7 |
+
Stable tag: 1.3.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
14 |
|
15 |
**Why should your users prove that they're humans by filling out captchas? Let bots prove their not bots with the <a href="http://www.benmarshall.me/wordpress-zero-spam-plugin/" target="_blank">WordPress Zero Spam plugin</a>.**
|
16 |
|
17 |
+
WordPress Zero Spam blocks registration spam and spam in comments automatically without any additional config or setup. Just install, activate and enjoy a spam-free site.
|
18 |
|
19 |
Zero Spam was initially built based on the work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
|
20 |
|
22 |
|
23 |
* **No captcha**, because spam is not users' problem
|
24 |
* **No moderation queues**, because spam is not administrators' problem
|
25 |
+
* **Blocks spam comments** with the use of JavaScript
|
26 |
+
* **Blocks spam registrations** with the use of JavaScript
|
27 |
|
28 |
**Languages:** English
|
29 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 1.3.0 =
|
48 |
+
* Removed Grunt creation of the trunk directory
|
49 |
+
* Added spam detection script to registration form
|
50 |
+
|
51 |
= 1.2.1 =
|
52 |
* Fixed some typos in the readme.txt file
|
53 |
|
zero-spam.js
CHANGED
@@ -13,13 +13,13 @@
|
|
13 |
( function( $ ) {
|
14 |
'use strict';
|
15 |
|
16 |
-
var
|
17 |
|
18 |
-
$(
|
19 |
$( "<input>" ).attr( "type", "hidden" )
|
20 |
.attr( "name", "zero-spam" )
|
21 |
.attr( "value", "1" )
|
22 |
-
.appendTo(
|
23 |
|
24 |
return true;
|
25 |
});
|
13 |
( function( $ ) {
|
14 |
'use strict';
|
15 |
|
16 |
+
var forms = "#commentform, #registerform";
|
17 |
|
18 |
+
$( forms ).submit( function() {
|
19 |
$( "<input>" ).attr( "type", "hidden" )
|
20 |
.attr( "name", "zero-spam" )
|
21 |
.attr( "value", "1" )
|
22 |
+
.appendTo( forms );
|
23 |
|
24 |
return true;
|
25 |
});
|
zero-spam.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(a){"use strict";var b=
|
1 |
+
!function(a){"use strict";var b="#commentform, #registerform";a(b).submit(function(){return a("<input>").attr("type","hidden").attr("name","zero-spam").attr("value","1").appendTo(b),!0})}(jQuery);
|
zero-spam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WordPress Zero Spam
|
4 |
* Plugin URI: http://www.benmarshall.me/wordpress-zero-spam-plugin
|
5 |
* Description: Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch. <strong>Just install, activate and say goodbye to spam.</strong> Based on work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
|
6 |
-
* Version: 1.
|
7 |
* Author: Ben Marshall
|
8 |
* Author URI: http://www.benmarshall.me
|
9 |
* License: GPL2
|
@@ -55,6 +55,7 @@ class Zero_Spam {
|
|
55 |
*/
|
56 |
private function _actions() {
|
57 |
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
|
|
|
58 |
add_action( 'preprocess_comment', array( $this, 'preprocess_comment' ) );
|
59 |
|
60 |
remove_action( 'wp_head', 'wp_generator' );
|
@@ -72,6 +73,7 @@ class Zero_Spam {
|
|
72 |
*/
|
73 |
private function _filters() {
|
74 |
add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -84,7 +86,7 @@ class Zero_Spam {
|
|
84 |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
|
85 |
*/
|
86 |
public function plugin_row_meta( $links, $file ) {
|
87 |
-
if ( strpos( $file, 'zero-spam.php' )
|
88 |
$links = array_merge( $links, array( '<a href="http://www.benmarshall.me/wordpress-zero-spam-plugin/">WordPress Zero Spam</a>' ) );
|
89 |
$links = array_merge( $links, array( '<a href="https://www.gittip.com/bmarshall511/">Donate</a>' ) );
|
90 |
}
|
@@ -92,21 +94,40 @@ class Zero_Spam {
|
|
92 |
}
|
93 |
|
94 |
/**
|
95 |
-
*
|
96 |
*
|
97 |
-
*
|
|
|
98 |
*
|
99 |
* @since 1.0.0
|
100 |
*
|
101 |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
|
102 |
*/
|
103 |
public function preprocess_comment( $commentdata ) {
|
104 |
-
if( ! isset ( $_POST['zero-spam'] )
|
105 |
-
die( __('There was a problem processing your comment.', 'zerospam') );
|
106 |
}
|
107 |
return $commentdata;
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
/**
|
111 |
* Add plugin scripts.
|
112 |
*
|
@@ -117,7 +138,7 @@ class Zero_Spam {
|
|
117 |
* @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
|
118 |
*/
|
119 |
public function wp_enqueue_scripts() {
|
120 |
-
wp_enqueue_script( 'zero-spam', plugins_url( '/zero-spam.min.js' , __FILE__ ), array( 'jquery' ), '1.
|
121 |
}
|
122 |
}
|
123 |
|
3 |
* Plugin Name: WordPress Zero Spam
|
4 |
* Plugin URI: http://www.benmarshall.me/wordpress-zero-spam-plugin
|
5 |
* Description: Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch. <strong>Just install, activate and say goodbye to spam.</strong> Based on work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
|
6 |
+
* Version: 1.3.0
|
7 |
* Author: Ben Marshall
|
8 |
* Author URI: http://www.benmarshall.me
|
9 |
* License: GPL2
|
55 |
*/
|
56 |
private function _actions() {
|
57 |
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
|
58 |
+
add_action( 'login_footer', array( $this, 'wp_enqueue_scripts' ) );
|
59 |
add_action( 'preprocess_comment', array( $this, 'preprocess_comment' ) );
|
60 |
|
61 |
remove_action( 'wp_head', 'wp_generator' );
|
73 |
*/
|
74 |
private function _filters() {
|
75 |
add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
|
76 |
+
add_filter( 'registration_errors', array( &$this, 'preprocess_registration' ), 10, 3 );
|
77 |
}
|
78 |
|
79 |
/**
|
86 |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
|
87 |
*/
|
88 |
public function plugin_row_meta( $links, $file ) {
|
89 |
+
if ( false !== strpos( $file, 'zero-spam.php' ) ) {
|
90 |
$links = array_merge( $links, array( '<a href="http://www.benmarshall.me/wordpress-zero-spam-plugin/">WordPress Zero Spam</a>' ) );
|
91 |
$links = array_merge( $links, array( '<a href="https://www.gittip.com/bmarshall511/">Donate</a>' ) );
|
92 |
}
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
+
* Preprocess comment fields.
|
98 |
*
|
99 |
+
* An action hook that is applied to the comment data prior to any other processing of the
|
100 |
+
* comment's information when saving a comment data to the database.
|
101 |
*
|
102 |
* @since 1.0.0
|
103 |
*
|
104 |
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
|
105 |
*/
|
106 |
public function preprocess_comment( $commentdata ) {
|
107 |
+
if ( ! isset ( $_POST['zero-spam'] ) && ! current_user_can( 'moderate_comments' ) ) {
|
108 |
+
die( __( 'There was a problem processing your comment.', 'zerospam' ) );
|
109 |
}
|
110 |
return $commentdata;
|
111 |
}
|
112 |
|
113 |
+
/**
|
114 |
+
* Preprocess registration fields.
|
115 |
+
*
|
116 |
+
* Used to create custom validation rules on user registration. This fires
|
117 |
+
* when the form is submitted but before user information is saved to the
|
118 |
+
* database.
|
119 |
+
*
|
120 |
+
* @since 1.3.0
|
121 |
+
*
|
122 |
+
* @link http://codex.wordpress.org/Plugin_API/Action_Reference/register_post
|
123 |
+
*/
|
124 |
+
public function preprocess_registration( $errors, $sanitized_user_login, $user_email ) {
|
125 |
+
if ( ! isset ( $_POST['zero-spam'] ) ) {
|
126 |
+
$errors->add( 'spam_error', __( '<strong>ERROR</strong>: There was a problem processing your registration.', 'zerospam' ) );
|
127 |
+
}
|
128 |
+
return $errors;
|
129 |
+
}
|
130 |
+
|
131 |
/**
|
132 |
* Add plugin scripts.
|
133 |
*
|
138 |
* @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
|
139 |
*/
|
140 |
public function wp_enqueue_scripts() {
|
141 |
+
wp_enqueue_script( 'zero-spam', plugins_url( '/zero-spam.min.js' , __FILE__ ), array( 'jquery' ), '1.1.0', true );
|
142 |
}
|
143 |
}
|
144 |
|