WordPress Zero Spam - Version 1.0.0

Version Description

  • Initial release.
Download this release

Release Info

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

Version 1.0.0

Files changed (4) hide show
  1. readme.txt +33 -0
  2. zero-spam.js +27 -0
  3. zero-spam.min.js +1 -0
  4. zero-spam.php +94 -0
readme.txt ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: bmarshall511
3
+ Donate link: https://www.gittip.com/bmarshall511/
4
+ Tags: comments, spam
5
+ Requires at least: 3.0.0
6
+ Tested up to: 3.9.1
7
+ Stable tag: 1.0.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Zero Spam makes blocking spam a cinch without all the bloated options. Just install, activate and say goodbye to spam. Based on work by David Walsh.
12
+
13
+ == Description ==
14
+
15
+ Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch without all the bloated options. <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>.
16
+
17
+ == Installation ==
18
+
19
+ 1. Upload the `zero-spam` folder to the `/wp-content/plugins/` directory
20
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
21
+
22
+ == Frequently Asked Questions ==
23
+
24
+ = I keep getting 'There was a problem processing your comment.' =
25
+
26
+ Be sure JavaScript is enabled and there are no JS errors.
27
+
28
+ == Screenshots ==
29
+
30
+ == Changelog ==
31
+
32
+ = 1.0.0 =
33
+ * Initial release.
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.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){"use strict";var b=a("#commentform");a(b).submit(function(){return a("<input>").attr("type","hidden").attr("name","zero-spam").attr("value","1").appendTo(b),!0})}(jQuery);
zero-spam.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
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 without all the bloated options. <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.0.0
7
+ * Author: Ben Marshall
8
+ * Author URI: http://www.benmarshall.me
9
+ * License: GPL2
10
+ */
11
+
12
+ /* Copyright 2014 Ben Marshall (email : me@benmarshall.me)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ /**
29
+ * Security Note: Blocks direct access to the plugin PHP files.
30
+ */
31
+ defined('ABSPATH') or die("No script kiddies please!");
32
+
33
+ class Zero_Spam {
34
+ /**
35
+ * Plugin initilization.
36
+ *
37
+ * Initializes the plugins functionality.
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ public function __construct() {
42
+ $this->_actions();
43
+ }
44
+
45
+ /**
46
+ * WordPress actions.
47
+ *
48
+ * Adds WordPress actions using the plugin API.
49
+ *
50
+ * @since 1.0.0
51
+ * @access private
52
+ *
53
+ * @link http://codex.wordpress.org/Plugin_API/Action_Reference
54
+ */
55
+ private function _actions() {
56
+ if ( function_exists( 'add_action' ) ) {
57
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
58
+ add_action( 'preprocess_comment', array( $this, 'preprocess_comment' ) );
59
+ }
60
+ }
61
+
62
+ /**
63
+ * WordPress actions.
64
+ *
65
+ * Adds WordPress actions using the plugin API.
66
+ *
67
+ * @since 1.0.0
68
+ *
69
+ * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
70
+ */
71
+ public function preprocess_comment( $commentdata ) {
72
+ if( ! isset ( $_POST['zero-spam'] ) ) {
73
+ die( __('There was a problem processing your comment.', 'zerospam') );
74
+ }
75
+ return $commentdata;
76
+ }
77
+
78
+ /**
79
+ * Add plugin scripts.
80
+ *
81
+ * Adds the plugins JS files.
82
+ *
83
+ * @since 1.0.0
84
+ *
85
+ * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
86
+ */
87
+ public function wp_enqueue_scripts() {
88
+ if ( function_exists( 'wp_enqueue_script' ) ) {
89
+ wp_enqueue_script( 'zero-spam', plugins_url( '/zero-spam.min.js' , __FILE__ ), array( 'jquery' ), '1.0.0', true );
90
+ }
91
+ }
92
+ }
93
+
94
+ $zero_spam = new Zero_Spam;