WP Armour – Honeypot Anti Spam - Version 1.3

Version Description

  • Rebranding
Download this release

Release Info

Developer dnesscarkey
Plugin Icon 128x128 WP Armour – Honeypot Anti Spam
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

honeypot.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: WP Armour - Honeypot Anti Spam
4
- Plugin URI: http://wordpress.org/plugins/honeypot/
5
- Description: Add Honey Pot spam protection.
6
- Author: Dinesh Karki
7
- Version: 1.2
8
- Author URI: https://dineshkarki.com.np
9
- */
10
-
11
- include 'includes/hp_config.php';
12
- include 'includes/hp_functions.php';
13
- include 'includes/integration/hp_bbpress.php';
14
- include 'includes/integration/hp_wpcomment.php';
15
- include 'includes/integration/hp_wpregistration.php';
16
- include 'includes/integration/hp_contactform7.php';
17
- include 'includes/integration/hp_wpforms.php';
18
- include 'includes/integration/hp_gravityforms.php';
19
-
20
- add_action('wp_enqueue_scripts','hp_load_scripts');
21
- add_action('login_enqueue_scripts','hp_load_scripts');
22
- add_action('admin_menu', 'hp_plugin_menu');
23
-
24
- register_activation_hook( __FILE__, 'hp_plugin_activation' );
25
-
26
- function hp_plugin_activation(){
27
- add_option('honeypot_installed_date',date('Ymd'));
28
- add_option('honeypot_field_name','field'.rand(1,9999));
29
- add_option('honeypot_error_message',' Spamming or your Javascript is disabled !!');
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/hp_config.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
-
3
- $GLOBALS['honeypot_field_name'] = get_option('honeypot_field_name');
4
- $GLOBALS['honeypot_hidden_field'] = "<span style='display:none;height:0;width:0;'><input type='text' name='".$GLOBALS['honeypot_field_name']."' value='1' style='' /></span>";
5
- $GLOBALS['honeypot_error_message'] = get_option('honeypot_error_message');
 
 
 
 
 
includes/hp_functions.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- function hp_load_scripts(){
3
- echo '<script>var honeypot_hidden_field = "'.$GLOBALS['honeypot_hidden_field'].'";</script>';
4
- wp_enqueue_script( 'hpscript', plugins_url( '/js/hp.js', __FILE__ ), array ( 'jquery' ), 1.1, true);
5
- }
6
-
7
- function hp_plugin_menu(){
8
- add_menu_page( 'WP Armour', 'WP Armour', 'manage_options', 'honeypot', 'hp_options','dashicons-shield');
9
- }
10
-
11
- function hp_options(){
12
- $hp_tabs = array(
13
- 'settings' => array('name'=>'Settings','path'=>'hp_settings.php'),
14
- 'extended_version' => array('name'=>"What's in WP Armour Extended ?",'path'=>'hp_extended_version.php')
15
-
16
- );
17
-
18
- $hp_tabs = apply_filters( 'hp_tabs_filter', $hp_tabs);
19
-
20
- include 'views/hp_main.php';
21
- }
22
-
23
- function hp_save_settings(){
24
- $all_fields = $_POST;
25
- unset($all_fields['submit-hp-general-settings']); // REMOVE submit field
26
-
27
- foreach ($all_fields as $fieldname => $fieldvalue) {
28
- update_option($fieldname,$fieldvalue);
29
- }
30
-
31
- $GLOBALS['honeypot_field_name'] = get_option('honeypot_field_name');
32
- $GLOBALS['honeypot_error_message'] = get_option('honeypot_error_message');
33
-
34
- $return['status'] = 'ok';
35
- $return['body'] = 'Settings Saved';
36
- return $return;
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/integration/hp_bbpress.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- /* BB PRESS */
3
- add_action( 'bbp_new_topic_pre_extras','hp_bbp_extra_validation');
4
- add_action( 'bbp_new_reply_pre_extras','hp_bbp_extra_validation');
5
-
6
- function hp_bbp_extra_validation(){
7
- if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
8
- do_action('hp_handle_spammers','bbpress');
9
- bbp_add_error( 'bbp_extra_email', __( $GLOBALS['honeypot_error_message'], 'bbpress' ) );
10
- }
11
- }
 
 
 
 
 
 
 
 
 
 
 
includes/integration/hp_contactform7.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- add_filter( 'wpcf7_validate', 'hp_contactform7_extra_validation', 10, 2 );
3
-
4
- function hp_contactform7_extra_validation($result, $tags){
5
- if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
- do_action('hp_handle_spammers','contactform7');
7
- die($GLOBALS['honeypot_error_message']);
8
- }
9
- return $result;
10
- }
 
 
 
 
 
 
 
 
 
 
includes/integration/hp_gravityforms.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- add_action( 'gform_pre_submission', 'hp_gravityforms_extra_validation');
3
-
4
- function hp_gravityforms_extra_validation($form){
5
- if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
- do_action('hp_handle_spammers','gravityforms');
7
- die($GLOBALS['honeypot_error_message']);
8
- }
9
- }
 
 
 
 
 
 
 
 
 
includes/integration/hp_wpcomment.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- // WP Comments
3
- add_filter( 'preprocess_comment', 'hp_wpcomment_extra_validation' );
4
-
5
- function hp_wpcomment_extra_validation( $commentdata ) {
6
- if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
7
- do_action('hp_handle_spammers','wpcomment');
8
- wp_die( __( $GLOBALS['honeypot_error_message'] ) );
9
- }
10
- return $commentdata;
11
- }
 
 
 
 
 
 
 
 
 
 
 
includes/integration/hp_wpforms.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- add_filter( 'wpforms_process_before', 'hp_wpforms_extra_validation', 10, 2 );
3
-
4
- function hp_wpforms_extra_validation($entry, $form_data){
5
- if (!isset($_POST[ $GLOBALS['honeypot_field_name']] )){
6
- do_action('hp_handle_spammers','wpforms');
7
- wpforms()->process->errors[ $form_data['id'] ][ '0' ] = $GLOBALS['honeypot_error_message'];
8
- }
9
- }
 
 
 
 
 
 
 
 
 
includes/integration/wpa_bbpress.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* BB PRESS */
3
+ add_action( 'bbp_new_topic_pre_extras','wpa_bbp_extra_validation');
4
+ add_action( 'bbp_new_reply_pre_extras','wpa_bbp_extra_validation');
5
+
6
+ function wpa_bbp_extra_validation(){
7
+ if (!isset($_POST[ $GLOBALS['wpa_field_name']] )){
8
+ do_action('wpa_handle_spammers','bbpress');
9
+ bbp_add_error( 'bbp_extra_email', __( $GLOBALS['wpa_error_message'], 'bbpress' ) );
10
+ }
11
+ }
includes/integration/wpa_contactform7.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_filter( 'wpcf7_validate', 'wpa_contactform7_extra_validation', 10, 2 );
3
+
4
+ function wpa_contactform7_extra_validation($result, $tags){
5
+ if (!isset($_POST[ $GLOBALS['wpa_field_name']] )){
6
+ do_action('wpa_handle_spammers','contactform7');
7
+ die($GLOBALS['wpa_error_message']);
8
+ }
9
+ return $result;
10
+ }
includes/integration/wpa_gravityforms.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action( 'gform_pre_submission', 'wpa_gravityforms_extra_validation');
3
+
4
+ function wpa_gravityforms_extra_validation($form){
5
+ if (!isset($_POST[ $GLOBALS['wpa_field_name']] )){
6
+ do_action('wpa_handle_spammers','gravityforms');
7
+ die($GLOBALS['wpa_error_message']);
8
+ }
9
+ }
includes/integration/wpa_wpcomment.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // WP Comments
3
+ add_filter( 'preprocess_comment', 'wpa_wpcomment_extra_validation' );
4
+
5
+ function wpa_wpcomment_extra_validation( $commentdata ) {
6
+ if (!isset($_POST[ $GLOBALS['wpa_field_name']] )){
7
+ do_action('wpa_handle_spammers','wpcomment');
8
+ wp_die( __( $GLOBALS['wpa_error_message'] ) );
9
+ }
10
+ return $commentdata;
11
+ }
includes/integration/wpa_wpforms.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_filter( 'wpforms_process_before', 'wpa_wpforms_extra_validation', 10, 2 );
3
+
4
+ function wpa_wpforms_extra_validation($entry, $form_data){
5
+ if (!isset($_POST[ $GLOBALS['wpa_field_name']] )){
6
+ do_action('wpa_handle_spammers','wpforms');
7
+ wpforms()->process->errors[ $form_data['id'] ][ '0' ] = $GLOBALS['wpa_error_message'];
8
+ }
9
+ }
includes/integration/{hp_wpregistration.php → wpa_wpregistration.php} RENAMED
File without changes
includes/js/hp.js DELETED
@@ -1,19 +0,0 @@
1
- jQuery(document).ready(function(){
2
-
3
- //alert('2');
4
-
5
- jQuery('.bbp-topic-form form').append(honeypot_hidden_field); // BBPRESS TOPIC
6
- jQuery('.bbp-reply-form form').append(honeypot_hidden_field); // BBPRESS REPLY
7
- jQuery('form#commentform').append(honeypot_hidden_field); // WP COMMENT
8
- jQuery('form#registerform').append(honeypot_hidden_field); // WP REGISTRATION
9
- jQuery('form.wpcf7-form').append(honeypot_hidden_field); // CONTACT FORM 7
10
- jQuery('form.wpforms-form').append(honeypot_hidden_field); // WPFFORMS
11
-
12
- jQuery('.gform_wrapper form').append(honeypot_hidden_field); // GRAVITY FORMS
13
-
14
-
15
-
16
-
17
- });
18
-
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/js/wpa.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+
3
+ //alert('2');
4
+
5
+ jQuery('.bbp-topic-form form').append(wpa_hidden_field); // BBPRESS TOPIC
6
+ jQuery('.bbp-reply-form form').append(wpa_hidden_field); // BBPRESS REPLY
7
+ jQuery('form#commentform').append(wpa_hidden_field); // WP COMMENT
8
+ jQuery('form#registerform').append(wpa_hidden_field); // WP REGISTRATION
9
+ jQuery('form.wpcf7-form').append(wpa_hidden_field); // CONTACT FORM 7
10
+ jQuery('form.wpforms-form').append(wpa_hidden_field); // WPFFORMS
11
+
12
+ jQuery('.gform_wrapper form').append(wpa_hidden_field); // GRAVITY FORMS
13
+
14
+
15
+
16
+
17
+ });
18
+
19
+
includes/views/{hp_extended_version.php → wpa_extended_version.php} RENAMED
File without changes
includes/views/{hp_main.php → wpa_main.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
- if (isset($_POST['submit-hp-general-settings'])){
3
- $saveReturn = hp_save_settings();
4
  }
5
 
6
  if (isset($_GET['tab'])){
@@ -20,8 +20,8 @@ if (isset($_GET['tab'])){
20
  <h1>WP Armour - HoneyPot Anti Spam</h1>
21
 
22
  <nav class="nav-tab-wrapper">
23
- <?php foreach ($hp_tabs as $tabKey => $tabData) { ?>
24
- <a href="?page=honeypot&tab=<?php echo $tabKey; ?>" class="nav-tab <?php echo $currentTab == $tabKey?'nav-tab-active':''; ?>"><?php echo $tabData['name']; ?></a>
25
  <?php } ?>
26
  </nav>
27
 
@@ -29,10 +29,10 @@ if (isset($_GET['tab'])){
29
  <table width="100%">
30
  <tr>
31
  <td valign="top">
32
- <?php include($hp_tabs[$currentTab]['path']); ?>
33
  </td>
34
  <td width="15">&nbsp;</td>
35
- <td width="250" valign="top"><?php include('hp_sidebar.php'); ?></td>
36
  </tr>
37
  </table>
38
  </div>
1
  <?php
2
+ if (isset($_POST['submit-wpa-general-settings'])){
3
+ $saveReturn = wpa_save_settings();
4
  }
5
 
6
  if (isset($_GET['tab'])){
20
  <h1>WP Armour - HoneyPot Anti Spam</h1>
21
 
22
  <nav class="nav-tab-wrapper">
23
+ <?php foreach ($wpa_tabs as $tabKey => $tabData) { ?>
24
+ <a href="?page=wp-armour&tab=<?php echo $tabKey; ?>" class="nav-tab <?php echo $currentTab == $tabKey?'nav-tab-active':''; ?>"><?php echo $tabData['name']; ?></a>
25
  <?php } ?>
26
  </nav>
27
 
29
  <table width="100%">
30
  <tr>
31
  <td valign="top">
32
+ <?php include($wpa_tabs[$currentTab]['path']); ?>
33
  </td>
34
  <td width="15">&nbsp;</td>
35
+ <td width="250" valign="top"><?php include('wpa_sidebar.php'); ?></td>
36
  </tr>
37
  </table>
38
  </div>
includes/views/{hp_settings.php → wpa_settings.php} RENAMED
@@ -14,19 +14,19 @@
14
  <tr>
15
  <td width="250">Honey Pot Field Name</td>
16
  <td>
17
- <input name="honeypot_field_name" style="width:300px;" value="<?php echo get_option('honeypot_field_name');?>" type="text" /><br/>
18
  <em>Changing the field name regularly is a good idea. Should definately do if you are getting spam.</em>
19
  </td>
20
  </tr>
21
  <tr>
22
  <td>Honey Pot Error Message</td>
23
  <td>
24
- <input name="honeypot_error_message" style="width:300px;" value="<?php echo get_option('honeypot_error_message');?>" type="text" /><br/><em>Mesage for bots. No average human users will see though.</em>
25
  </td>
26
  </tr>
27
 
28
  <tr>
29
- <td colspan="2"><input type="submit" name="submit-hp-general-settings" class="button-primary" value="Save General Settings" /></td>
30
  </tr>
31
  </form>
32
 
14
  <tr>
15
  <td width="250">Honey Pot Field Name</td>
16
  <td>
17
+ <input name="wpa_field_name" style="width:300px;" value="<?php echo get_option('wpa_field_name');?>" type="text" /><br/>
18
  <em>Changing the field name regularly is a good idea. Should definately do if you are getting spam.</em>
19
  </td>
20
  </tr>
21
  <tr>
22
  <td>Honey Pot Error Message</td>
23
  <td>
24
+ <input name="wpa_error_message" style="width:300px;" value="<?php echo get_option('wpa_error_message');?>" type="text" /><br/><em>Mesage for bots. No average human users will see though.</em>
25
  </td>
26
  </tr>
27
 
28
  <tr>
29
+ <td colspan="2"><input type="submit" name="submit-wpa-general-settings" class="button-primary" value="Save General Settings" /></td>
30
  </tr>
31
  </form>
32
 
includes/views/{hp_sidebar.php → wpa_sidebar.php} RENAMED
File without changes
includes/wpa_config.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ $GLOBALS['wpa_field_name'] = get_option('wpa_field_name');
4
+ $GLOBALS['wpa_hidden_field'] = "<span style='display:none;height:0;width:0;'><input type='text' name='".$GLOBALS['wpa_field_name']."' value='1' style='' /></span>";
5
+ $GLOBALS['wpa_error_message'] = get_option('wpa_error_message');
includes/wpa_functions.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wpa_load_scripts(){
3
+ echo '<script>var wpa_hidden_field = "'.$GLOBALS['wpa_hidden_field'].'";</script>';
4
+ wp_enqueue_script( 'wpascript', plugins_url( '/js/wpa.js', __FILE__ ), array ( 'jquery' ), 1.1, true);
5
+ }
6
+
7
+ function wpa_plugin_menu(){
8
+ add_menu_page( 'WP Armour', 'WP Armour', 'manage_options', 'wp-armour', 'wpa_options','dashicons-shield');
9
+ }
10
+
11
+ function wpa_options(){
12
+ $wpa_tabs = array(
13
+ 'settings' => array('name'=>'Settings','path'=>'wpa_settings.php'),
14
+ 'extended_version' => array('name'=>"What's in WP Armour Extended ?",'path'=>'wpa_extended_version.php')
15
+
16
+ );
17
+
18
+ $wpa_tabs = apply_filters( 'wpa_tabs_filter', $wpa_tabs);
19
+
20
+ include 'views/wpa_main.php';
21
+ }
22
+
23
+ function wpa_save_settings(){
24
+ $all_fields = $_POST;
25
+ unset($all_fields['submit-wpa-general-settings']); // REMOVE submit field
26
+
27
+ foreach ($all_fields as $fieldname => $fieldvalue) {
28
+ update_option($fieldname,$fieldvalue);
29
+ }
30
+
31
+ $GLOBALS['wpa_field_name'] = get_option('wpa_field_name');
32
+ $GLOBALS['wpa_error_message'] = get_option('wpa_error_message');
33
+
34
+ $return['status'] = 'ok';
35
+ $return['body'] = 'Settings Saved';
36
+ return $return;
37
+ }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: dnesscarkey
3
  Tags: anti-spam, block spam, gravity forms, bbpress, contact form 7
4
  Requires at least: 3.0
5
  Tested up to: 5.4.2
6
- Stable tag: 1.2
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -59,7 +59,7 @@ No, with this plugin you don't need Captcha. Lets avoid hassle for common users.
59
  1. Screenshot #1. WP Armour - Honeypot Anti Spam Settings.
60
 
61
  == Changelog ==
62
- = = 1.2 =
63
  * Rebranding
64
 
65
  = = 1.1 =
3
  Tags: anti-spam, block spam, gravity forms, bbpress, contact form 7
4
  Requires at least: 3.0
5
  Tested up to: 5.4.2
6
+ Stable tag: 1.3
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
59
  1. Screenshot #1. WP Armour - Honeypot Anti Spam Settings.
60
 
61
  == Changelog ==
62
+ = = 1.3 =
63
  * Rebranding
64
 
65
  = = 1.1 =
wp-armour.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP Armour - Honeypot Anti Spam
4
+ Plugin URI: http://wordpress.org/plugins/honeypot/
5
+ Description: Add Honey Pot spam protection.
6
+ Author: Dinesh Karki
7
+ Version: 1.3
8
+ Author URI: https://dineshkarki.com.np
9
+ */
10
+
11
+ include 'includes/wpa_config.php';
12
+ include 'includes/wpa_functions.php';
13
+ include 'includes/integration/wpa_bbpress.php';
14
+ include 'includes/integration/wpa_wpcomment.php';
15
+ include 'includes/integration/wpa_wpregistration.php';
16
+ include 'includes/integration/wpa_contactform7.php';
17
+ include 'includes/integration/wpa_wpforms.php';
18
+ include 'includes/integration/wpa_gravityforms.php';
19
+
20
+ add_action('wp_enqueue_scripts','wpa_load_scripts');
21
+ add_action('login_enqueue_scripts','wpa_load_scripts');
22
+ add_action('admin_menu', 'wpa_plugin_menu');
23
+
24
+ register_activation_hook( __FILE__, 'wpa_plugin_activation' );
25
+
26
+ function wpa_plugin_activation(){
27
+ add_option('wpa_installed_date',date('Ymd'));
28
+ add_option('wpa_field_name','field'.rand(1,9999));
29
+ add_option('wpa_error_message',' Spamming or your Javascript is disabled !!');
30
+ }