WordPress Zero Spam - Version 1.2.0

Version Description

  • Removed testing for core function testing
  • Fix for adding comments from admin (thanks @afragen)
  • Removed unneeded WP svn trunk and tags folders from the git repo (thanks @afragen)
Download this release

Release Info

Developer bmarshall511
Plugin Icon 128x128 WordPress Zero Spam
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.0 to 1.2.0

Files changed (10) hide show
  1. Gruntfile.js +9 -0
  2. grunt/aliases.yaml +5 -0
  3. grunt/copy.js +6 -0
  4. grunt/jshint.js +4 -0
  5. grunt/uglify.js +7 -0
  6. grunt/watch.js +14 -0
  7. package.json +19 -0
  8. readme.txt +16 -6
  9. zero-spam.js +27 -0
  10. zero-spam.php +7 -15
Gruntfile.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ module.exports = function(grunt) {
2
+
3
+ // measures the time each task takes
4
+ require('time-grunt')(grunt);
5
+
6
+ // load grunt config
7
+ require('load-grunt-config')(grunt);
8
+
9
+ };
grunt/aliases.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ default:
2
+ - 'jshint'
3
+ - 'uglify'
4
+ - 'copy'
5
+ - 'watch'
grunt/copy.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ module.exports = {
2
+ truck: {
3
+ src: ['zero-spam.min.js', 'zero-spam.php', 'readme.txt'],
4
+ dest: 'trunk/'
5
+ }
6
+ };
grunt/jshint.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ module.exports = {
2
+ gruntfile: ['Gruntfile.js'],
3
+ src: ['zero-spam.js']
4
+ };
grunt/uglify.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ src: {
3
+ files: {
4
+ 'zero-spam.min.js': ['zero-spam.js']
5
+ }
6
+ }
7
+ };
grunt/watch.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ gruntfile: {
3
+ files: ['Gruntfile.js'],
4
+ tasks: ['jshint:gruntfile']
5
+ },
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
+ };
package.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "zero-spam",
3
+ "version": "1.0.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git://github.com/bmarshall511/wordpress-zero-spam.git"
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",
14
+ "load-grunt-config": "*"
15
+ },
16
+ "dependencies": {
17
+ "time-grunt": "*"
18
+ }
19
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WordPress Zero Spam ===
2
- Contributors: bmarshall511
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.1
7
- Stable tag: 1.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,9 +12,11 @@ Zero Spam makes blocking spam comments a cinch. Install, activate and enjoy a sp
12
 
13
  == Description ==
14
 
15
- **Why should your users prove that they are humans by filling captchas? Lets bots prove their are not bots 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, actiavte and enjoy a spam-free site. Initially built based on the work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
 
 
18
 
19
  Major features in WordPress Zero Spam include:
20
 
@@ -24,7 +26,7 @@ Major features in WordPress Zero Spam include:
24
 
25
  **Languages:** English
26
 
27
- <a href="http://www.benmarshall.me" target="_blank">Follow me on Twitter</a> to keep up with the latest updates.
28
 
29
  == Installation ==
30
 
@@ -41,6 +43,11 @@ Be sure JavaScript is enabled and there are no JS errors.
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 1.1.0 =
45
  * Updated theme documentation.
46
  * WordPress generator meta tag removed to help hide WordPress sites from spambots.
@@ -50,3 +57,6 @@ Be sure JavaScript is enabled and there are no JS errors.
50
 
51
  == Credits ==
52
  * Thanks to [David Walsh](http://davidwalsh.name) [@davidwalshblog](https://twitter.com/davidwalshblog) for the inspiration behind this plugin.
 
 
 
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.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ **Why should your users prove that they are humans by filling captchas? Let bots prove their are not bots 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
 
21
  Major features in WordPress Zero Spam include:
22
 
26
 
27
  **Languages:** English
28
 
29
+ If you have suggestions for a new add-on, feel free to email me at me@benmarshall.me. Want regular updates? Follow me on Twitter <a href="http://www.benmarshall.me" target="_blank">Ben Marshall</a>.
30
 
31
  == Installation ==
32
 
43
 
44
  == Changelog ==
45
 
46
+ = 1.2.0 =
47
+ * Removed testing for core function testing
48
+ * Fix for adding comments from admin (thanks @afragen)
49
+ * Removed unneeded WP svn trunk and tags folders from the git repo (thanks @afragen)
50
+
51
  = 1.1.0 =
52
  * Updated theme documentation.
53
  * WordPress generator meta tag removed to help hide WordPress sites from spambots.
57
 
58
  == Credits ==
59
  * Thanks to [David Walsh](http://davidwalsh.name) [@davidwalshblog](https://twitter.com/davidwalshblog) for the inspiration behind this plugin.
60
+
61
+ == Contributors ==
62
+ * [Andy Fragen](https://github.com/afragen)
zero-spam.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WordPress Zero Spam JS
3
+ *
4
+ * Required JS for the WordPress Zero Spam plugin to work properly.
5
+ *
6
+ * @link http://www.benmarshall.me/wordpress-zero-spam-plugin
7
+ * @since 1.0.0
8
+ *
9
+ * @package WordPress
10
+ * @subpackage Zero Spam
11
+ */
12
+
13
+ ( function( $ ) {
14
+ 'use strict';
15
+
16
+ var form = $( "#commentform" );
17
+
18
+ $( form ).submit( function() {
19
+ $( "<input>" ).attr( "type", "hidden" )
20
+ .attr( "name", "zero-spam" )
21
+ .attr( "value", "1" )
22
+ .appendTo( form );
23
+
24
+ return true;
25
+ });
26
+
27
+ })( 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.1.0
7
  * Author: Ben Marshall
8
  * Author URI: http://www.benmarshall.me
9
  * License: GPL2
@@ -54,14 +54,10 @@ class Zero_Spam {
54
  * @link http://codex.wordpress.org/Plugin_API/Action_Reference
55
  */
56
  private function _actions() {
57
- if ( function_exists( 'add_action' ) ) {
58
- add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
59
- add_action( 'preprocess_comment', array( $this, 'preprocess_comment' ) );
60
- }
61
 
62
- if ( function_exists( 'remove_action' ) ) {
63
- remove_action( 'wp_head', 'wp_generator' );
64
- }
65
  }
66
 
67
  /**
@@ -75,9 +71,7 @@ class Zero_Spam {
75
  * @link http://codex.wordpress.org/Function_Reference/add_filter
76
  */
77
  private function _filters() {
78
- if ( function_exists( 'add_filter' ) ) {
79
- add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
80
- }
81
  }
82
 
83
  /**
@@ -107,7 +101,7 @@ class Zero_Spam {
107
  * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
108
  */
109
  public function preprocess_comment( $commentdata ) {
110
- if( ! isset ( $_POST['zero-spam'] ) ) {
111
  die( __('There was a problem processing your comment.', 'zerospam') );
112
  }
113
  return $commentdata;
@@ -123,9 +117,7 @@ class Zero_Spam {
123
  * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
124
  */
125
  public function wp_enqueue_scripts() {
126
- if ( function_exists( 'wp_enqueue_script' ) ) {
127
- wp_enqueue_script( 'zero-spam', plugins_url( '/zero-spam.min.js' , __FILE__ ), array( 'jquery' ), '1.0.0', true );
128
- }
129
  }
130
  }
131
 
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.2.0
7
  * Author: Ben Marshall
8
  * Author URI: http://www.benmarshall.me
9
  * License: GPL2
54
  * @link http://codex.wordpress.org/Plugin_API/Action_Reference
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' );
 
 
61
  }
62
 
63
  /**
71
  * @link http://codex.wordpress.org/Function_Reference/add_filter
72
  */
73
  private function _filters() {
74
+ add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
 
 
75
  }
76
 
77
  /**
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'] ) || ! current_user_can( 'moderate_comments' ) ) {
105
  die( __('There was a problem processing your comment.', 'zerospam') );
106
  }
107
  return $commentdata;
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.0.0', true );
 
 
121
  }
122
  }
123