Growmap Anti Spambot Plugin - Version 1.1

Version Description

  • add ability to specify maximum number of names or urls in content of comment. (@dragonblogger)
  • choose where to send comment

=

Download this release

Release Info

Developer commentluv
Plugin Icon wp plugin Growmap Anti Spambot Plugin
Version 1.1
Comparing to
See all releases

Code changes from version 1.03 to 1.1

growmap-anti-spambot-plugin.php CHANGED
@@ -1,267 +1,328 @@
1
  <?php
2
- /*
3
- Plugin Name: Growmap Anti Spambot Plugin
4
- Plugin URI: http://www.growmap.com/growmap-anti-spambot-plugin/
5
- Description: Very simple plugin that adds a client side generated checkbox to the comment form requesting that the user clicks it to prove they are not a spammer. Bots wont see it so their spam comment will be discarded.
6
- Version: 1.03
7
- Author: Andy Bailey
8
- Author URI: http://ComLuv.com
9
- */
10
 
11
- /*********************************************
12
- * setup
13
- *********************************************/
14
- $gasp_plugin_dir = dirname(__FILE__);
15
- $gasp_plugin_url = WP_PLUGIN_URL.'/'.basename(dirname(__FILE__));
 
16
 
17
 
18
- /*********************************************
19
- * hooks
20
- *********************************************/
21
- if(is_admin()){
22
- // admin hooks
23
- add_action( 'admin_menu', 'gasp_admin_link' );
24
- add_action( 'admin_init', 'gasp_admin_init' );
25
- add_filter ( 'plugin_action_links', 'gasp_action' , - 10, 2 );
26
- } else {
27
- // public hooks
28
- add_action('comment_form','gasp_add_checkbox',1);
29
- add_filter('preprocess_comment','gasp_check_comment',1,1);
30
- }
31
- // everywhere hooks
32
- add_action('init','gasp_init');
33
-
34
- /*********************************************
35
- * internal functions
36
- *********************************************/
37
 
38
- /** gasp_init
39
- */
40
- function gasp_init(){
41
- load_plugin_textdomain( 'ab_gasp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
42
- }
43
- /** gasp_admin_init
44
- * Sets up the admin pages and settings
45
- */
46
- function gasp_admin_init(){
47
- register_setting( 'gasp_options_group', 'gasp_options' , 'gasp_options_sanitize');
48
- }
49
 
50
- /** gasp_admin_link
51
- * Add link to settings panel in dashboard
52
- */
53
- function gasp_admin_link(){
54
- // language
55
- load_plugin_textdomain( 'ab_gasp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
56
- add_options_page('Growmap Anti Spambot Plugin Settings','G.A.S.P.','manage_options','gasp','gasp_options_page');
57
- }
 
 
 
58
 
59
- /** gasp_action
60
- * adds a link on the plugins page next to activate/deactivate to go to the settings page
61
- * @param array $links - the links to be filtered
62
- *@param string $file - the file whos links are being filtered
63
- * return string $links - the new string of links
64
- */
65
- function gasp_action($links,$file){
66
- $this_plugin = plugin_basename ( __FILE__ );
67
- if ($file == $this_plugin) {
68
- $links [] = "<a href='options-general.php?page=gasp'>" . __ ( 'Settings', 'ab_gasp' ) . "</a>";
69
  }
70
- return $links;
71
- }
72
 
73
- /** gasp_get_options
74
- * Retrieves the options from the database.
75
- * Returns saved options or defaults if no options have been saved.
76
- */
77
- function gasp_get_options(){
78
- $default_options = array(
79
- 'checkbox_alert' => __('Please check the box to confirm that you are NOT a spammer','ab_gasp'),
80
- 'no_checkbox_message' => __('You may have disabled javascript. Please enable javascript before leaving a comment on this site.','ab_gasp'),
81
- 'hidden_email_message' => __('You appear to be a spambot. Contact admin another way if you feel this message is in error','ab_gasp'),
82
- 'checkbox_label' => __('Confirm you are NOT a spammer','ab_gasp'),
83
- 'trackbacks' => 'yes',
84
- 'version' => '1.03'
85
- );
86
- $options = get_option('gasp_options',$default_options);
87
- // update options with new defaults if upgrading from older version
88
- if((float)$options['version'] < 0.4 ){
89
- update_option('gasp_options',$default_options);
90
- return $default_options;
91
  }
92
- if((float)$options['version'] < 1.03){
93
- $options['version'] = '1.03';
94
- $options['trackbacks'] = 'yes';
95
- update_option('gasp_options',$options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
- return $options;
98
- }
99
 
100
- /** gasp_options_sanitize
101
- * checks the options before they are saved
102
- */
103
- function gasp_options_sanitize($newoptions){
104
- return $newoptions;
105
- }
 
 
 
 
106
 
107
- /** gasp_check_comment
108
- * Called by preprocess_comment filter
109
- * @param array $commentdata - array containing indices "comment_post_ID", "comment_author", "comment_author_email", "comment_author_url", "comment_content", "comment_type", and "user_ID"
110
- * Return array updated comment data array or wp_die()
111
- */
112
- function gasp_check_comment($commentdata){
113
- // DebugBreak();
114
- $options = gasp_get_options();
115
- if($commentdata['comment_type'] == 'pingback' || $commentdata['comment_type'] == 'trackback'){
116
- if($options['trackbacks'] == 'yes'){
 
 
 
 
 
 
 
117
  return $commentdata;
118
- } else {
119
- exit;
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
- if(is_user_logged_in()){
123
- return $commentdata;
124
- }
125
- if(!isset($_POST['gasp_checkbox'])){
126
- wp_die($options['no_checkbox_message']);
127
- } elseif (isset($_POST['gasp_email']) && $_POST['gasp_email'] !== ''){
128
- wp_die($options['hidden_email_message']);
129
- } elseif ($_POST['gasp_checkbox'] === 'on') {
130
- return $commentdata;
131
  }
132
- return $commentdata; // not needed but put it here anyway
133
- }
134
 
135
 
136
- /*********************************************
137
- * admin output
138
- *********************************************/
139
- /** gasp_options_page
140
- * This function handles the page for options
141
- */
142
- function gasp_options_page(){
143
- $options = gasp_get_options();
144
  ?>
145
  <div class="wrap">
146
- <h2>Growmap Anti Spambot Plugin Settings Page</h2> Version <?php echo $options['version'];?>
147
- <form method="post" action="options.php">
148
- <?php settings_fields( 'gasp_options_group' );?>
149
- <table class="form-table postbox">
150
- <tr valign="top" class="alt menu_option postbox">
151
- <td><?php _e('Checkbox Label','ab_gasp');?></td>
152
- <td><input type="text" size="60" name="gasp_options[checkbox_label]" value="<?php echo $options['checkbox_label'];?>"/></td>
153
- </tr>
154
- <tr valign="top" class="alt menu_option postbox">
155
- <td><?php _e('Allow Trackbacks?','ab_gasp');?></td>
156
- <td><input type="checkbox" name="gasp_options[trackbacks]" value="yes" <?php checked($options['trackbacks'],'yes');?>/>
157
- (<?php _e('Unchecking the box will prevent ALL trackbacks', 'ab_gasp'); ?>)
158
- <br/><?php _e('See this plugin if you want a trackback validation plugin that works well with GASP','ab_gasp');?>
159
- <a href="http://wordpress.org/extend/plugins/simple-trackback-validation/" target="_blank">Simple Trackback Validation</a>
160
- </td>
161
- </tr>
162
- <tr><td colspan="2"><p><?php _e('These are the messages you will show the user if they forget to check the checkbox or if the comment looks like it was submitted by a spambot','ab_gasp');?></p></td></tr>
163
- <tr><td width="30%">
164
- <?php _e('There is only 1 situation where this can happen','ab_gasp'); ?>
165
- <ol>
166
- <li><?php _e('The user forgot to check the checkbox','ab_gasp');?></li>
167
- </ol>
168
- </td>
169
- <td><h2><?php _e('Checkbox not checked alert','ab_gasp');?></h2>
170
- <input type="text" size = "95" name="gasp_options[checkbox_alert]" value="<?php echo $options['checkbox_alert'];?>" />
171
- </td>
172
- </tr>
173
- <tr><td width="30%">
174
- <?php _e('There is only 1 situation where this can happen','ab_gasp'); ?>
175
- <ol>
176
- <li><?php _e('The user does not have javascript enabled','ab_gasp');?></li>
177
- </ol>
178
- </td>
179
- <td><h2><?php _e('No checkbox','ab_gasp');?></h2>
180
- <textarea cols="60" rows="5" name="gasp_options[no_checkbox_message]" ><?php echo $options['no_checkbox_message'];?></textarea>
181
- </td>
182
- </tr>
183
- <tr>
184
- <td><?php _e('There is only one situation where this would happen','ab_gasp');?>
185
- <ol>
186
- <li><?php _e('The form has a hidden field added with a label that has a name value with the word "email" in it. A spam bot will usually try to fill in all fields on a form, if this field has been filled in then something is wrong','ab_gasp');?></li>
187
- </ol>
188
- </td>
189
- <td><h2><?php _e('Hidden email field completed','ab_gasp');?></h2>
190
- <textarea cols="60" rows="5" name="gasp_options[hidden_email_message]" ><?php echo $options['hidden_email_message'];?></textarea>
191
- </td>
192
- </tr>
193
- </table>
194
- <input type="hidden" name="action" value="update" />
195
- <input type="hidden" name="gasp_options[version]" value="<?php echo $options['version'];?>"/>
196
- <p class="submit">
197
- <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
198
- </p>
199
- </form>
200
- <table class="form-table postbox">
201
- <tr class="alt">
202
- <td valign="top" width="150px">
203
- This plugin was made by Andy Bailey (<a href="http://twitter.com/commentluv">@commentluv</a>)
204
- <br/><p style="float:left; margin: 5px 5px 5px 0px;"><?php echo get_avatar('admin@comluv.com',48);?></p>
205
- I make custom wordpress plugins for private sites and edit existing plugins to do what you need them to do!
206
- </td>
207
- <td>
208
- </td>
209
- <td valign="top" width="250px">
210
- Some of my other plugins :
211
- </td>
212
- <td>
213
- <ul><li><a href="http://wordpress.org/extend/plugins/commentluv/">CommentLuv</a>
214
- <br />An easy way to reward your readers and find out what they're posting about by automatically including a titled link to their latest blog post when they comment</li>
215
- <li><a href="http://wordpress.org/extend/plugins/twitterlink-comments/">TwitterLink Comments</a>
216
- <br />Add an extra field to your comment form to allow your visitors to leave their twitter username and have it displayed along with their comment. All without having to edit your theme.</li>
217
- <li><a href="http://wordpress.org/extend/plugins/easy-amember-protect-lite/">Easy aMember Protect Lite</a>
218
- <br />A very quick and simple way to protect individual posts and pages on your Wordpress site from being seen unless the person trying to view has an active subscription to one of your aMember products (requires <a href="http://ql2.me/1/amember">aMember</a>)</li>
219
- </ul>
220
- </td>
221
- </tr>
222
-
223
- </table>
224
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  </div>
226
  <?php
227
- }
228
 
229
- /*********************************************
230
- * public output
231
- *********************************************/
232
 
233
- /** gasp_add_checkbox
234
- * Called by comment_form action
235
- * Adds javascript to create a checkbox on the comment form
236
- */
237
- function gasp_add_checkbox(){
238
- if(!is_user_logged_in()){
239
- $options = gasp_get_options();
240
- echo '<p id="gasp_p" style="clear:both;"></p>';
241
- echo '<script type="text/javascript">
242
- //v1.01
243
- var gasp_p = document.getElementById("gasp_p");
244
- var gasp_cb = document.createElement("input");
245
- var gasp_text = document.createTextNode(" '.$options['checkbox_label'].'");
246
- gasp_cb.type = "checkbox";
247
- gasp_cb.id = "gasp_checkbox";
248
- gasp_cb.name = "gasp_checkbox";
249
- gasp_cb.style.width = "25px";
250
- gasp_p.appendChild(gasp_cb);
251
- gasp_p.appendChild(gasp_text);
252
- var frm = gasp_cb.form;
253
- frm.onsubmit = gasp_it;
254
- function gasp_it(){
255
- if(gasp_cb.checked != true){
256
- alert("'.$options['checkbox_alert'].'");
257
- return false;
258
- }
259
- return true;
260
- }
261
- </script>
262
- <input type="hidden" id="gasp_email" name="gasp_email" value="" />';
263
- } else {
264
- echo '<!-- no checkbox needed by Growmap Anti Spambot Plugin for logged on user -->';
 
265
  }
266
- }
267
  ?>
1
  <?php
2
+ /*
3
+ Plugin Name: Growmap Anti Spambot Plugin
4
+ Plugin URI: http://www.growmap.com/growmap-anti-spambot-plugin/
5
+ Description: Very simple plugin that adds a client side generated checkbox to the comment form requesting that the user clicks it to prove they are not a spammer. Bots wont see it so their spam comment will be discarded.
6
+ Version: 1.1
7
+ Author: Andy Bailey
8
+ Author URI: http://ComLuv.com
9
+ */
10
 
11
+ /*********************************************
12
+ * setup
13
+ *********************************************/
14
+ $gasp_plugin_dir = dirname(__FILE__);
15
+ $gasp_plugin_url = WP_PLUGIN_URL.'/'.basename(dirname(__FILE__));
16
+ $gasp_check == false;
17
 
18
 
19
+ /*********************************************
20
+ * hooks
21
+ *********************************************/
22
+ if(is_admin()){
23
+ // admin hooks
24
+ add_action( 'admin_menu', 'gasp_admin_link' );
25
+ add_action( 'admin_init', 'gasp_admin_init' );
26
+ add_filter ( 'plugin_action_links', 'gasp_action' , - 10, 2 );
27
+ } else {
28
+ // public hooks
29
+ add_action('comment_form','gasp_add_checkbox',1);
30
+ add_filter('preprocess_comment','gasp_check_comment',1,1);
31
+ add_filter('pre_comment_approved','gasp_autospam_comment_check',1,1);
32
+ }
33
+ // everywhere hooks
34
+ add_action('init','gasp_init');
 
 
 
35
 
36
+ /*********************************************
37
+ * internal functions
38
+ *********************************************/
 
 
 
 
 
 
 
 
39
 
40
+ /** gasp_init
41
+ */
42
+ function gasp_init(){
43
+ load_plugin_textdomain( 'ab_gasp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
44
+ }
45
+ /** gasp_admin_init
46
+ * Sets up the admin pages and settings
47
+ */
48
+ function gasp_admin_init(){
49
+ register_setting( 'gasp_options_group', 'gasp_options' , 'gasp_options_sanitize');
50
+ }
51
 
52
+ /** gasp_admin_link
53
+ * Add link to settings panel in dashboard
54
+ */
55
+ function gasp_admin_link(){
56
+ // language
57
+ load_plugin_textdomain( 'ab_gasp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
58
+ add_options_page('Growmap Anti Spambot Plugin Settings','G.A.S.P.','manage_options','gasp','gasp_options_page');
 
 
 
59
  }
 
 
60
 
61
+ /** gasp_action
62
+ * adds a link on the plugins page next to activate/deactivate to go to the settings page
63
+ * @param array $links - the links to be filtered
64
+ *@param string $file - the file whos links are being filtered
65
+ * return string $links - the new string of links
66
+ */
67
+ function gasp_action($links,$file){
68
+ $this_plugin = plugin_basename ( __FILE__ );
69
+ if ($file == $this_plugin) {
70
+ $links [] = "<a href='options-general.php?page=gasp'>" . __ ( 'Settings', 'ab_gasp' ) . "</a>";
71
+ }
72
+ return $links;
 
 
 
 
 
 
73
  }
74
+
75
+ /** gasp_get_options
76
+ * Retrieves the options from the database.
77
+ * Returns saved options or defaults if no options have been saved.
78
+ */
79
+ function gasp_get_options(){
80
+ $default_options = array(
81
+ 'checkbox_alert' => __('Please check the box to confirm that you are NOT a spammer','ab_gasp'),
82
+ 'no_checkbox_message' => __('You may have disabled javascript. Please enable javascript before leaving a comment on this site.','ab_gasp'),
83
+ 'hidden_email_message' => __('You appear to be a spambot. Contact admin another way if you feel this message is in error','ab_gasp'),
84
+ 'checkbox_label' => __('Confirm you are NOT a spammer','ab_gasp'),
85
+ 'trackbacks' => 'yes',
86
+ 'urls' => '0',
87
+ 'name_words' => '0',
88
+ 'send_to' => 'spam',
89
+ 'version' => '1.1'
90
+ );
91
+ $options = get_option('gasp_options',$default_options);
92
+ // update options with new defaults if upgrading from older version
93
+ if((float)$options['version'] < 0.4 ){
94
+ update_option('gasp_options',$default_options);
95
+ return $default_options;
96
+ }
97
+ if((float)$options['version'] < 1.1){
98
+ $options['version'] = '1.1';
99
+ $options['trackbacks'] = 'yes';
100
+ $options['urls'] = '0';
101
+ $options['name_words'] = '0';
102
+ $options['send_to'] = 'spam';
103
+ update_option('gasp_options',$options);
104
+ }
105
+ return $options;
106
  }
 
 
107
 
108
+ /** gasp_options_sanitize
109
+ * checks the options before they are saved
110
+ */
111
+ function gasp_options_sanitize($newoptions){
112
+ $urls = intval($newoptions['urls']);
113
+ $name_words = intval($newoptions['name_words']);
114
+ $newoptions['urls'] = (string)$urls;
115
+ $newoptions['name_words'] = (string)$name_words;
116
+ return $newoptions;
117
+ }
118
 
119
+ /** gasp_check_comment
120
+ * Called by preprocess_comment filter
121
+ * @param array $commentdata - array containing indices "comment_post_ID", "comment_author", "comment_author_email", "comment_author_url", "comment_content", "comment_type", and "user_ID"
122
+ * Return array updated comment data array or wp_die()
123
+ */
124
+ function gasp_check_comment($commentdata){
125
+ //DebugBreak();
126
+ global $gasp_check;
127
+ $options = gasp_get_options();
128
+ if($commentdata['comment_type'] == 'pingback' || $commentdata['comment_type'] == 'trackback'){
129
+ if($options['trackbacks'] == 'yes'){
130
+ return $commentdata;
131
+ } else {
132
+ exit;
133
+ }
134
+ }
135
+ if(is_user_logged_in()){
136
  return $commentdata;
 
 
137
  }
138
+ if(!isset($_POST['gasp_checkbox'])){
139
+ wp_die($options['no_checkbox_message']);
140
+ } elseif (isset($_POST['gasp_email']) && $_POST['gasp_email'] !== ''){
141
+ wp_die($options['hidden_email_message']);
142
+ }
143
+ // check optional heuritics
144
+ if($options['urls'] != '0'){
145
+ $count = (int)$options['urls'];
146
+ if(substr_count($commentdata['comment_content'], "http") > $count){
147
+ $gasp_check = $options['send_to'];
148
+ }
149
+ }
150
+ if($options['name_words'] != '0'){
151
+ $count = (int)$options['name_words'];
152
+ if(substr_count($commentdata['comment_author'],' ') >= $count){
153
+ $gasp_check = $options['send_to'];
154
+ }
155
+ }
156
+ return $commentdata; // send back commentdata, another filter will set comment as spam/pending if gasp is set
157
  }
158
+
159
+ function gasp_autospam_comment_check($approved){
160
+ //DebugBreak();
161
+ global $gasp_check;
162
+ if($gasp_check != NULL){
163
+ $approved = $gasp_check;
164
+ }
165
+ return $approved;
 
166
  }
 
 
167
 
168
 
169
+ /*********************************************
170
+ * admin output
171
+ *********************************************/
172
+ /** gasp_options_page
173
+ * This function handles the page for options
174
+ */
175
+ function gasp_options_page(){
176
+ $options = gasp_get_options();
177
  ?>
178
  <div class="wrap">
179
+ <h2>Growmap Anti Spambot Plugin Settings Page</h2> Version <?php echo $options['version'];?>
180
+ <form method="post" action="options.php">
181
+ <?php settings_fields( 'gasp_options_group' );?>
182
+ <table class="form-table postbox">
183
+ <tr valign="top" class="alt menu_option postbox">
184
+ <td><?php _e('Checkbox Label','ab_gasp');?></td>
185
+ <td><input type="text" size="60" name="gasp_options[checkbox_label]" value="<?php echo $options['checkbox_label'];?>"/></td>
186
+ </tr>
187
+ <tr valign="top" class="alt menu_option postbox">
188
+ <td><?php _e('Allow Trackbacks?','ab_gasp');?></td>
189
+ <td><input type="checkbox" name="gasp_options[trackbacks]" value="yes" <?php checked($options['trackbacks'],'yes');?>/>
190
+ (<?php _e('Unchecking the box will prevent ALL trackbacks', 'ab_gasp'); ?>)
191
+ <br/><?php _e('See this plugin if you want a trackback validation plugin that works well with GASP','ab_gasp');?>
192
+ <a href="http://wordpress.org/extend/plugins/simple-trackback-validation/" target="_blank">Simple Trackback Validation</a>
193
+ </td>
194
+ </tr>
195
+ <tr><td colspan="2"><p><?php _e('These are the messages you will show the user if they forget to check the checkbox or if the comment looks like it was submitted by a spambot','ab_gasp');?></p></td></tr>
196
+ <tr><td width="30%">
197
+ <?php _e('There is only 1 situation where this can happen','ab_gasp'); ?>
198
+ <ol>
199
+ <li><?php _e('The user forgot to check the checkbox','ab_gasp');?></li>
200
+ </ol>
201
+ </td>
202
+ <td><h2><?php _e('Checkbox not checked alert','ab_gasp');?></h2>
203
+ <input type="text" size = "95" name="gasp_options[checkbox_alert]" value="<?php echo $options['checkbox_alert'];?>" />
204
+ </td>
205
+ </tr>
206
+ <tr><td width="30%">
207
+ <?php _e('There is only 1 situation where this can happen','ab_gasp'); ?>
208
+ <ol>
209
+ <li><?php _e('The user does not have javascript enabled','ab_gasp');?></li>
210
+ </ol>
211
+ </td>
212
+ <td><h2><?php _e('No checkbox','ab_gasp');?></h2>
213
+ <textarea cols="60" rows="5" name="gasp_options[no_checkbox_message]" ><?php echo $options['no_checkbox_message'];?></textarea>
214
+ </td>
215
+ </tr>
216
+ <tr>
217
+ <td><?php _e('There is only one situation where this would happen','ab_gasp');?>
218
+ <ol>
219
+ <li><?php _e('The form has a hidden field added with a label that has a name value with the word "email" in it. A spam bot will usually try to fill in all fields on a form, if this field has been filled in then something is wrong','ab_gasp');?></li>
220
+ </ol>
221
+ </td>
222
+ <td><h2><?php _e('Hidden email field completed','ab_gasp');?></h2>
223
+ <textarea cols="60" rows="5" name="gasp_options[hidden_email_message]" ><?php echo $options['hidden_email_message'];?></textarea>
224
+ </td>
225
+ </tr>
226
+ </table>
227
+
228
+ <?php // heuristics ?>
229
+ <h2><?php _e('Heuristics (optional spam detection)','ab_gasp');?></h2>
230
+ <p><?php _e('You can have more advanced spam detection by setting these options. Many thanks to @dragonblogger for these suggestions','ab_gasp');?></p>
231
+ <table class="form-table postbox">
232
+ <tr valign="top" class="alt menu_option postbox">
233
+ <td width="30%"><?php _e('Maximum number of URLs allowed in comment text','ab_gasp');?></td>
234
+ <td><input type="text" size = "5" name="gasp_options[urls]" value="<?php echo $options['urls'];?>" />
235
+ (<?php _e('Use 0 (zero) to disable check', 'ab_gasp'); ?>)
236
+ </td>
237
+ </tr>
238
+ <tr valign="top" class="alt menu_option postbox">
239
+ <td width="30%"><?php _e('Maximum number of words allowed in name field','ab_gasp');?></td>
240
+ <td><input type="text" size = "5" name="gasp_options[name_words]" value="<?php echo $options['name_words'];?>" />
241
+ (<?php _e('Use 0 (zero) to disable check', 'ab_gasp'); ?>)
242
+ </td>
243
+ </tr>
244
+ <tr valign="top" class="alt menu_option postbox">
245
+ <td width="30%"><?php _e('Where to send suspicious comments?','ab_gasp');?></td>
246
+ <td>
247
+ <select name="gasp_options[send_to]">
248
+ <option value="spam" <?php selected($options['send_to'],'spam');?>><?php _e('spam','ab_gasp');?></option>
249
+ <option value="0" <?php selected($options['send_to'],'0');?>><?php _e('pending','ab_gasp');?></option>
250
+ </select>
251
+ </td>
252
+ </tr>
253
+
254
+ </table>
255
+ <input type="hidden" name="action" value="update" />
256
+ <input type="hidden" name="gasp_options[version]" value="<?php echo $options['version'];?>"/>
257
+ <p class="submit">
258
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
259
+ </p>
260
+ </form>
261
+ <table class="form-table postbox">
262
+ <tr class="alt">
263
+ <td valign="top" width="150px">
264
+ This plugin was made by Andy Bailey (<a href="http://twitter.com/commentluv">@commentluv</a>)
265
+ <br/><p style="float:left; margin: 5px 5px 5px 0px;"><?php echo get_avatar('admin@comluv.com',48);?></p>
266
+ I make custom wordpress plugins for private sites and edit existing plugins to do what you need them to do!
267
+ </td>
268
+ <td>
269
+ </td>
270
+ <td valign="top" width="250px">
271
+ Some of my other plugins :
272
+ </td>
273
+ <td>
274
+ <ul><li><a href="http://wordpress.org/extend/plugins/commentluv/">CommentLuv</a>
275
+ <br />An easy way to reward your readers and find out what they're posting about by automatically including a titled link to their latest blog post when they comment</li>
276
+ <li><a href="http://wordpress.org/extend/plugins/twitterlink-comments/">TwitterLink Comments</a>
277
+ <br />Add an extra field to your comment form to allow your visitors to leave their twitter username and have it displayed along with their comment. All without having to edit your theme.</li>
278
+ <li><a href="http://wordpress.org/extend/plugins/easy-amember-protect-lite/">Easy aMember Protect Lite</a>
279
+ <br />A very quick and simple way to protect individual posts and pages on your Wordpress site from being seen unless the person trying to view has an active subscription to one of your aMember products (requires <a href="http://ql2.me/1/amember">aMember</a>)</li>
280
+ </ul>
281
+ </td>
282
+ </tr>
283
+
284
+ </table>
285
+
286
  </div>
287
  <?php
288
+ }
289
 
290
+ /*********************************************
291
+ * public output
292
+ *********************************************/
293
 
294
+ /** gasp_add_checkbox
295
+ * Called by comment_form action
296
+ * Adds javascript to create a checkbox on the comment form
297
+ */
298
+ function gasp_add_checkbox(){
299
+ if(!is_user_logged_in()){
300
+ $options = gasp_get_options();
301
+ echo '<p id="gasp_p" style="clear:both;"></p>';
302
+ echo '<script type="text/javascript">
303
+ //v1.01
304
+ var gasp_p = document.getElementById("gasp_p");
305
+ var gasp_cb = document.createElement("input");
306
+ var gasp_text = document.createTextNode(" '.$options['checkbox_label'].'");
307
+ gasp_cb.type = "checkbox";
308
+ gasp_cb.id = "gasp_checkbox";
309
+ gasp_cb.name = "gasp_checkbox";
310
+ gasp_cb.style.width = "25px";
311
+ gasp_p.appendChild(gasp_cb);
312
+ gasp_p.appendChild(gasp_text);
313
+ var frm = gasp_cb.form;
314
+ frm.onsubmit = gasp_it;
315
+ function gasp_it(){
316
+ if(gasp_cb.checked != true){
317
+ alert("'.$options['checkbox_alert'].'");
318
+ return false;
319
+ }
320
+ return true;
321
+ }
322
+ </script>
323
+ <input type="hidden" id="gasp_email" name="gasp_email" value="" />';
324
+ } else {
325
+ echo '<!-- no checkbox needed by Growmap Anti Spambot Plugin for logged on user -->';
326
+ }
327
  }
 
328
  ?>
languages/ab_gasp.mo CHANGED
Binary file
languages/ab_gasp.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Growmap Anti Spambot Plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2010-10-13 16:53-0000\n"
6
- "PO-Revision-Date: 2010-10-13 16:55-0000\n"
7
  "Last-Translator: Andy Bailey <admin@comluv.com>\n"
8
  "Language-Team: ComLuv.com GrowMap.com FeedBlitz.com <admin@comluv.com>\n"
9
  "MIME-Version: 1.0\n"
@@ -15,68 +15,113 @@ msgstr ""
15
  "X-Poedit-Country: UNITED KINGDOM\n"
16
  "X-Poedit-SearchPath-0: ..\n"
17
 
18
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:68
19
  msgid "Settings"
20
  msgstr ""
21
 
22
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:79
23
  msgid "Please check the box to confirm that you are NOT a spammer"
24
  msgstr ""
25
 
26
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:80
27
  msgid "You may have disabled javascript. Please enable javascript before leaving a comment on this site."
28
  msgstr ""
29
 
30
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:81
31
  msgid "You appear to be a spambot. Contact admin another way if you feel this message is in error"
32
  msgstr ""
33
 
34
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:82
35
  msgid "Confirm you are NOT a spammer"
36
  msgstr ""
37
 
38
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:141
39
  msgid "Checkbox Label"
40
  msgstr ""
41
 
42
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:144
 
 
 
 
 
 
 
 
 
 
 
 
43
  msgid "These are the messages you will show the user if they forget to check the checkbox or if the comment looks like it was submitted by a spambot"
44
  msgstr ""
45
 
46
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:146
47
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:156
48
  msgid "There is only 1 situation where this can happen"
49
  msgstr ""
50
 
51
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:148
52
  msgid "The user forgot to check the checkbox"
53
  msgstr ""
54
 
55
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:151
56
  msgid "Checkbox not checked alert"
57
  msgstr ""
58
 
59
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:158
60
  msgid "The user does not have javascript enabled"
61
  msgstr ""
62
 
63
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:161
64
  msgid "No checkbox"
65
  msgstr ""
66
 
67
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:166
68
  msgid "There is only one situation where this would happen"
69
  msgstr ""
70
 
71
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:168
72
  msgid "The form has a hidden field added with a label that has a name value with the word \"email\" in it. A spam bot will usually try to fill in all fields on a form, if this field has been filled in then something is wrong"
73
  msgstr ""
74
 
75
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:171
76
  msgid "Hidden email field completed"
77
  msgstr ""
78
 
79
- #: Z:\firedwok_html\wordpress\wp-content\plugins\growmap-anti-spambot-plugin/growmap-anti-spambot-plugin.php:179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  msgid "Save Changes"
81
  msgstr ""
82
 
2
  msgstr ""
3
  "Project-Id-Version: Growmap Anti Spambot Plugin\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-11-29 14:23-0000\n"
6
+ "PO-Revision-Date: 2010-11-29 14:23-0000\n"
7
  "Last-Translator: Andy Bailey <admin@comluv.com>\n"
8
  "Language-Team: ComLuv.com GrowMap.com FeedBlitz.com <admin@comluv.com>\n"
9
  "MIME-Version: 1.0\n"
15
  "X-Poedit-Country: UNITED KINGDOM\n"
16
  "X-Poedit-SearchPath-0: ..\n"
17
 
18
+ #: ../growmap-anti-spambot-plugin.php:70
19
  msgid "Settings"
20
  msgstr ""
21
 
22
+ #: ../growmap-anti-spambot-plugin.php:81
23
  msgid "Please check the box to confirm that you are NOT a spammer"
24
  msgstr ""
25
 
26
+ #: ../growmap-anti-spambot-plugin.php:82
27
  msgid "You may have disabled javascript. Please enable javascript before leaving a comment on this site."
28
  msgstr ""
29
 
30
+ #: ../growmap-anti-spambot-plugin.php:83
31
  msgid "You appear to be a spambot. Contact admin another way if you feel this message is in error"
32
  msgstr ""
33
 
34
+ #: ../growmap-anti-spambot-plugin.php:84
35
  msgid "Confirm you are NOT a spammer"
36
  msgstr ""
37
 
38
+ #: ../growmap-anti-spambot-plugin.php:184
39
  msgid "Checkbox Label"
40
  msgstr ""
41
 
42
+ #: ../growmap-anti-spambot-plugin.php:188
43
+ msgid "Allow Trackbacks?"
44
+ msgstr ""
45
+
46
+ #: ../growmap-anti-spambot-plugin.php:190
47
+ msgid "Unchecking the box will prevent ALL trackbacks"
48
+ msgstr ""
49
+
50
+ #: ../growmap-anti-spambot-plugin.php:191
51
+ msgid "See this plugin if you want a trackback validation plugin that works well with GASP"
52
+ msgstr ""
53
+
54
+ #: ../growmap-anti-spambot-plugin.php:195
55
  msgid "These are the messages you will show the user if they forget to check the checkbox or if the comment looks like it was submitted by a spambot"
56
  msgstr ""
57
 
58
+ #: ../growmap-anti-spambot-plugin.php:197
59
+ #: ../growmap-anti-spambot-plugin.php:207
60
  msgid "There is only 1 situation where this can happen"
61
  msgstr ""
62
 
63
+ #: ../growmap-anti-spambot-plugin.php:199
64
  msgid "The user forgot to check the checkbox"
65
  msgstr ""
66
 
67
+ #: ../growmap-anti-spambot-plugin.php:202
68
  msgid "Checkbox not checked alert"
69
  msgstr ""
70
 
71
+ #: ../growmap-anti-spambot-plugin.php:209
72
  msgid "The user does not have javascript enabled"
73
  msgstr ""
74
 
75
+ #: ../growmap-anti-spambot-plugin.php:212
76
  msgid "No checkbox"
77
  msgstr ""
78
 
79
+ #: ../growmap-anti-spambot-plugin.php:217
80
  msgid "There is only one situation where this would happen"
81
  msgstr ""
82
 
83
+ #: ../growmap-anti-spambot-plugin.php:219
84
  msgid "The form has a hidden field added with a label that has a name value with the word \"email\" in it. A spam bot will usually try to fill in all fields on a form, if this field has been filled in then something is wrong"
85
  msgstr ""
86
 
87
+ #: ../growmap-anti-spambot-plugin.php:222
88
  msgid "Hidden email field completed"
89
  msgstr ""
90
 
91
+ #: ../growmap-anti-spambot-plugin.php:229
92
+ msgid "Heuristics (optional spam detection)"
93
+ msgstr ""
94
+
95
+ #: ../growmap-anti-spambot-plugin.php:230
96
+ msgid "You can have more advanced spam detection by setting these options. Many thanks to @dragonblogger for these suggestions"
97
+ msgstr ""
98
+
99
+ #: ../growmap-anti-spambot-plugin.php:233
100
+ msgid "Maximum number of URLs allowed in comment text"
101
+ msgstr ""
102
+
103
+ #: ../growmap-anti-spambot-plugin.php:235
104
+ #: ../growmap-anti-spambot-plugin.php:241
105
+ msgid "Use 0 (zero) to disable check"
106
+ msgstr ""
107
+
108
+ #: ../growmap-anti-spambot-plugin.php:239
109
+ msgid "Maximum number of words allowed in name field"
110
+ msgstr ""
111
+
112
+ #: ../growmap-anti-spambot-plugin.php:245
113
+ msgid "Where to send suspicious comments?"
114
+ msgstr ""
115
+
116
+ #: ../growmap-anti-spambot-plugin.php:248
117
+ msgid "spam"
118
+ msgstr ""
119
+
120
+ #: ../growmap-anti-spambot-plugin.php:249
121
+ msgid "pending"
122
+ msgstr ""
123
+
124
+ #: ../growmap-anti-spambot-plugin.php:258
125
  msgid "Save Changes"
126
  msgstr ""
127
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:http://comluv.com/about/donate
4
  Tags: comments, anti spam, spam, spambot, gasp
5
  Requires at least: 2.9.2
6
  Tested up to: 3.0.1
7
- Stable tag: 1.03
8
 
9
  Defeat automated spambots by adding a client side generated checkbox asking the comment author to confirm that they are not a spammer.
10
 
@@ -82,11 +82,15 @@ You can download any of the number of trackback validation plugins which will ch
82
  = 1.03 =
83
  * let blog owner to choose to allow trackbacks or not (@dragonblogger)
84
 
 
 
 
 
85
  == Upgrade Notice ==
86
 
87
- = 1.03 =
88
 
89
- * added - let blog owner choose to allow trackbacks or not
90
 
91
  == Configuration ==
92
 
4
  Tags: comments, anti spam, spam, spambot, gasp
5
  Requires at least: 2.9.2
6
  Tested up to: 3.0.1
7
+ Stable tag: 1.1
8
 
9
  Defeat automated spambots by adding a client side generated checkbox asking the comment author to confirm that they are not a spammer.
10
 
82
  = 1.03 =
83
  * let blog owner to choose to allow trackbacks or not (@dragonblogger)
84
 
85
+ = 1.1 =
86
+ * add ability to specify maximum number of names or urls in content of comment. (@dragonblogger)
87
+ * choose where to send comment
88
+
89
  == Upgrade Notice ==
90
 
91
+ = 1.1 =
92
 
93
+ * added - let blog owner choose maximum number of URLs and words in the name field and where to send comment (spam or pending)
94
 
95
  == Configuration ==
96