WP Armour – Honeypot Anti Spam - Version 1.9

Version Description

  • Removed inline javascript for better performance.
Download this release

Release Info

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

Code changes from version 1.8.5 to 1.9

includes/js/wpa.js CHANGED
@@ -1,9 +1,36 @@
1
- jQuery(document).ready(function(){
2
- wpa_add_honeypot_field();
3
 
4
- if (wpa_add_test == 'yes'){
5
- wpa_add_test_block();
6
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  });
9
 
1
+ var wpa_field_name, wpa_unique_id, wpa_add_test, wpa_hidden_field;
 
2
 
3
+ jQuery(document).ready(function(){
4
+
5
+ jQuery.ajax({
6
+ url: wpa_admin_ajax_url,
7
+ data: {'action':'wpa_field_info'},
8
+ type: 'GET',
9
+ success: function(response){
10
+ returnData = JSON.parse(response);
11
+ wpa_field_name = returnData.wpa_field_name;
12
+ wpa_unique_id = returnData.wpa_field_value;
13
+ wpa_add_test = returnData.wpa_add_test;
14
+
15
+ wpa_hidden_field = "<span class='wpa_hidden_field' style='display:none;height:0;width:0;'><input type='text' name='"+wpa_field_name+"' value='"+wpa_unique_id+"' /></span>";
16
+
17
+ wpa_add_honeypot_field();
18
+
19
+ if (typeof wpae_add_honeypot_field == 'function') { // IF EXTENDED version exists.
20
+ wpae_add_honeypot_field();
21
+ }
22
+
23
+ if (wpa_add_test == 'yes'){
24
+ wpa_add_test_block();
25
+ }
26
+ },
27
+ error: function(response) {
28
+ if (console && console.error) {
29
+ console.error('Unable to add WP Armour Anti Spam protection.');
30
+ alert('Unable to add WP Armour Anti Spam protection.');
31
+ }
32
+ }
33
+ });
34
 
35
  });
36
 
includes/views/wpa_extended_version.php CHANGED
@@ -9,10 +9,14 @@
9
  <ul>
10
  <li><label>Additional Support</label>
11
  * WooCommerce & Easy Digital Downloads <br/>
12
- * QuForm<br/>
13
- * MC4WP: Mailchimp for WordPress<br/>
14
- * S2 Member<br/>
15
- * Gravity Forms (For Ajax enabled and multi page form)
 
 
 
 
16
  </li>
17
 
18
  <li><label>Record Spammer IP</label>
9
  <ul>
10
  <li><label>Additional Support</label>
11
  * WooCommerce & Easy Digital Downloads <br/>
12
+ * QuForm, MC4WP, HTMLform plugin<br/>
13
+ * BuddyPress, BuddyBoss<br/>
14
+ * NinjaForms, S2 Member, Avia Enfold Theme<br/>
15
+ * Gravity Forms (For Ajax enabled and multi page form) and more..
16
+ </li>
17
+
18
+ <li><label>2 Level Spam Check</label>
19
+ Our lite version should block most of the spam bot submission. But if you are still getting spam submission, you can enable 2 level spam check in Extended version from Extended Settings tab.
20
  </li>
21
 
22
  <li><label>Record Spammer IP</label>
includes/views/wpa_notice.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
- add_action('admin_notices', 'wpa_reviews_notice');
4
- add_action('admin_notices', 'wpa_extended_notice');
5
-
6
 
7
  if (isset($_GET['wpa_reviews_notice_hide']) == 1){
8
  update_option('wpa_reviews_notice_hide','yes');
@@ -12,7 +10,17 @@ if (isset($_GET['wpa_extended_notice_hide']) == 1){
12
  update_option('wpa_extended_notice_hide','yes');
13
  }
14
 
15
- function wpa_reviews_notice(){
 
 
 
 
 
 
 
 
 
 
16
  if (get_option('wpa_reviews_notice_hide') != 'yes'){
17
  $installedDate = strtotime(get_option('wpa_installed_date'));
18
  $todayDate = time();
@@ -23,7 +31,7 @@ function wpa_reviews_notice(){
23
 
24
  if ($installedDays > 30 && $all_spam_blocked > 30){
25
  echo '<div class="updated success" style="padding:10px; font-size:16px; line-height:1.6;color:#205225;">
26
- Hey, WP Armour Anti Spam has blocked <strong>'.$all_spam_blocked.'</strong> spam submissions till date - that’s awesome! Could you please do us a BIG favor and give it a 5-star rating on WordPress ? Just to help us spread the word and boost our motivation.<br/><br/>
27
 
28
  <ul style="padding-left:50px;list-style-type: square;">
29
  <li><a href="https://wordpress.org/support/plugin/honeypot/reviews/?filter=5" target="_blank">Ok, you deserve it</a></li>
@@ -35,9 +43,8 @@ function wpa_reviews_notice(){
35
  </div>';
36
  }
37
  }
38
- }
39
 
40
- function wpa_extended_notice(){
41
  if (get_option('wpa_extended_notice_hide') != 'yes' && !is_plugin_active('wp-armour-extended/wp-armour-extended.php') ){
42
  $installedDate = strtotime(get_option('wpa_installed_date'));
43
  $todayDate = time();
@@ -52,7 +59,7 @@ function wpa_extended_notice(){
52
 
53
  Can you help us by purchasing our Extended Version ? This will helps up maintain and support the plugin in upcoming days and make it even better. Our Extended version starts from 19.99 USD and comes with lifetime license (No monhtly or yearly recurring) and No API calls. <br/><br/>
54
 
55
- Also, it works with WooCommerce, Ajax and Multi page Gravity Forms, Easy Digital Downloads, QuForm, MC4WP: Mailchimp for WordPress and have Spammer blocking based on IP, Record Spam Submission and so on.
56
 
57
  <ul style="padding-left:50px;list-style-type: square;">
58
  <li><a href="https://dineshkarki.com.np/buy-wp-armour-extended" target="_blank">I will help</a></li>
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
+ add_action('admin_notices', 'wpa_admin_notices');
 
 
4
 
5
  if (isset($_GET['wpa_reviews_notice_hide']) == 1){
6
  update_option('wpa_reviews_notice_hide','yes');
10
  update_option('wpa_extended_notice_hide','yes');
11
  }
12
 
13
+ function wpa_admin_notices(){
14
+ // FOR OLD EXTENDED VERSION
15
+ if(is_plugin_active( 'wp-armour-extended/wp-armour-extended.php' ) ) {
16
+ if ($GLOBALS['wpae_version'] < 1.17 ){
17
+ echo '<div class="notice notice-error is-dismissible">
18
+ <p><strong style="color:#900;">IMPORTANT : </strong> Your are using older version of WP Armour Extended. Please update to 1.17 or above for it to work properly.</p>
19
+ </div>';
20
+ }
21
+ }
22
+
23
+ // FOR REVIEWS
24
  if (get_option('wpa_reviews_notice_hide') != 'yes'){
25
  $installedDate = strtotime(get_option('wpa_installed_date'));
26
  $todayDate = time();
31
 
32
  if ($installedDays > 30 && $all_spam_blocked > 30){
33
  echo '<div class="updated success" style="padding:10px; font-size:16px; line-height:1.6;color:#205225;">
34
+ Hey, WP Armour has blocked <strong>'.$all_spam_blocked.'</strong> spam submissions till date - that’s awesome! Could you please do us a BIG favor and give it a 5-star rating on WordPress ? Just to help us spread the word and boost our motivation.<br/><br/>
35
 
36
  <ul style="padding-left:50px;list-style-type: square;">
37
  <li><a href="https://wordpress.org/support/plugin/honeypot/reviews/?filter=5" target="_blank">Ok, you deserve it</a></li>
43
  </div>';
44
  }
45
  }
 
46
 
47
+ // UPSELLING EXTENDED VERSION
48
  if (get_option('wpa_extended_notice_hide') != 'yes' && !is_plugin_active('wp-armour-extended/wp-armour-extended.php') ){
49
  $installedDate = strtotime(get_option('wpa_installed_date'));
50
  $todayDate = time();
59
 
60
  Can you help us by purchasing our Extended Version ? This will helps up maintain and support the plugin in upcoming days and make it even better. Our Extended version starts from 19.99 USD and comes with lifetime license (No monhtly or yearly recurring) and No API calls. <br/><br/>
61
 
62
+ Also, it has 2 level spam check and additionally works with WooCommerce, Ajax and Multi page Gravity Forms, Easy Digital Downloads, QuForm, MC4WP: Mailchimp for WordPress and have Spammer blocking based on IP, Record Spam Submission and so on.
63
 
64
  <ul style="padding-left:50px;list-style-type: square;">
65
  <li><a href="https://dineshkarki.com.np/buy-wp-armour-extended" target="_blank">I will help</a></li>
includes/wpa_config.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
 
3
  $GLOBALS['wpa_field_name'] = get_option('wpa_field_name');
4
  $GLOBALS['wpa_error_message'] = get_option('wpa_error_message');
5
  $GLOBALS['wpa_disable_test_widget'] = get_option('wpa_disable_test_widget');
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
+ $GLOBALS['wpa_version'] = '1.9';
4
  $GLOBALS['wpa_field_name'] = get_option('wpa_field_name');
5
  $GLOBALS['wpa_error_message'] = get_option('wpa_error_message');
6
  $GLOBALS['wpa_disable_test_widget'] = get_option('wpa_disable_test_widget');
includes/wpa_functions.php CHANGED
@@ -1,19 +1,9 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
  function wpa_load_scripts(){
4
- if (current_user_can('activate_plugins') && (get_option('wpa_disable_test_widget') != 'yes')){
5
- $wpa_add_test = 'yes';
6
- } else {
7
- $wpa_add_test = 'no';
8
- }
9
-
10
- $wpa_unique_id = rand(111, 99999);
11
-
12
- $wpa_hidden_field = "<span class='wpa_hidden_field' style='display:none;height:0;width:0;'><input type='text' name='".$GLOBALS['wpa_field_name']."' value='".$wpa_unique_id."' /></span>";
13
-
14
- wp_enqueue_script( 'wpascript', plugins_url( '/js/wpa.js', __FILE__ ), array ( 'jquery' ), '1.8.5', true);
15
- wp_add_inline_script( 'wpascript', 'var wpa_hidden_field = "'.$wpa_hidden_field.'"; var wpa_add_test = "'.$wpa_add_test.'"; var wpa_field_name = "'.$GLOBALS['wpa_field_name'].'"; wpa_unique_id = "'.$wpa_unique_id.'"; ');
16
- wp_enqueue_style( 'wpa-css', plugins_url( '/css/wpa.css', __FILE__ ), array(), '1.8.5');
17
  }
18
 
19
  function wpa_plugin_menu(){
@@ -126,11 +116,39 @@ function wpa_unqiue_field_name(){
126
  return substr(str_shuffle($permitted_chars), 0, 6).rand(1,9999);
127
  }
128
 
 
 
 
 
 
 
 
 
129
  function wpa_check_is_spam($form_data){
130
  if (isset($form_data[$GLOBALS['wpa_field_name']])){
131
- //if (isset($form_data[$GLOBALS['wpa_field_name']]) && ($form_data[$GLOBALS['wpa_field_name']] == $_COOKIE['wpa_unique_id'])){
132
- return false;
 
 
 
 
 
 
 
 
 
 
 
133
  } else {
134
- return true;
135
  }
 
 
 
 
 
 
 
 
 
136
  }
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
  function wpa_load_scripts(){
4
+ wp_enqueue_script( 'wpascript', plugins_url( '/js/wpa.js?ver='.rand(2,9999), __FILE__ ), array ( 'jquery' ), $GLOBALS['wpa_version'], true);
5
+ wp_add_inline_script( 'wpascript', 'var wpa_admin_ajax_url = "'.admin_url("admin-ajax.php").'";');
6
+ wp_enqueue_style( 'wpa-css', plugins_url( '/css/wpa.css', __FILE__ ), array(), $GLOBALS['wpa_version']);
 
 
 
 
 
 
 
 
 
 
7
  }
8
 
9
  function wpa_plugin_menu(){
116
  return substr(str_shuffle($permitted_chars), 0, 6).rand(1,9999);
117
  }
118
 
119
+ function wpa_unqiue_field_value(){
120
+ if (function_exists('wpae_unqiue_field_value')){ // IF EXTENDED VERSION AVAILABLE
121
+ return wpae_unqiue_field_value();
122
+ } else {
123
+ return rand(1111, 999999);
124
+ }
125
+ }
126
+
127
  function wpa_check_is_spam($form_data){
128
  if (isset($form_data[$GLOBALS['wpa_field_name']])){
129
+ if (function_exists('wpae_2level_spam_check')){
130
+ return wpae_2level_spam_check($form_data[$GLOBALS['wpa_field_name']]);
131
+ } else {
132
+ return false; // FALSE MEANS NOT SPAM
133
+ }
134
+ } else {
135
+ return true; // TRUE MEANS SPAM
136
+ }
137
+ }
138
+
139
+ function wpa_field_info_ajax(){
140
+ if (current_user_can('activate_plugins') && (get_option('wpa_disable_test_widget') != 'yes')){
141
+ $wpa_add_test = 'yes';
142
  } else {
143
+ $wpa_add_test = 'no';
144
  }
145
+
146
+ $return = array(
147
+ 'wpa_field_name' => $GLOBALS['wpa_field_name'],
148
+ 'wpa_field_value' => wpa_unqiue_field_value(),
149
+ 'wpa_add_test' => $wpa_add_test
150
+ );
151
+
152
+ echo json_encode($return);
153
+ wp_die();
154
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dnesscarkey
3
  Donate link: https://dineshkarki.com.np/wp-armour-anti-spam
4
  Tags: anti spam, spam checker, spam filter, gravity forms, contact form 7
5
  Requires at least: 3.0
6
- Tested up to: 5.8
7
- Stable tag: 1.8.5
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -28,11 +28,12 @@ This plugins block spam submissions using honeypot anti spam technic. No Captcha
28
  * Fluent Forms (<a href="https://fluentforms.com">fluentforms.com</a>)
29
  * Divi Theme Contact Form (<a href="https://www.elegantthemes.com">elegantthemes.com</a>)
30
  * Theme My Login ( https://wordpress.org/plugins/theme-my-login/ )
31
- * WooCommerce Reviews Pro
32
- * WooCommerce Reviews (<a href="https://woocommerce.com">woocommerce.com</a>)
33
 
34
  <strong>WP Armour Extended (Paid Version) supports additional anti spam protection and features.</strong>
35
 
 
36
  * WooCommerce Checkout & Registration (<a href="https://woocommerce.com">woocommerce.com</a>)
37
  * Easy Digital Downloads Checkout and Registration (<a href="https://easydigitaldownloads.com">easydigitaldownloads.com</a>)
38
  * QuForm Contact Form (<a href="https://www.quform.com">quform.com</a>)
@@ -135,6 +136,9 @@ With WP Armour - Honeypot Anti Spam plugin it is No. But if you want you can use
135
 
136
  == Changelog ==
137
 
 
 
 
138
  = = 1.8.5 =
139
  * Added support for WooCommerce Reviews Pro.
140
  * Added support for Fluent Form Conversional Forms.
3
  Donate link: https://dineshkarki.com.np/wp-armour-anti-spam
4
  Tags: anti spam, spam checker, spam filter, gravity forms, contact form 7
5
  Requires at least: 3.0
6
+ Tested up to: 5.8.2
7
+ Stable tag: 1.9
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
28
  * Fluent Forms (<a href="https://fluentforms.com">fluentforms.com</a>)
29
  * Divi Theme Contact Form (<a href="https://www.elegantthemes.com">elegantthemes.com</a>)
30
  * Theme My Login ( https://wordpress.org/plugins/theme-my-login/ )
31
+ * WooCommerce Reviews Pro
32
+ * GDPR compliant. No tracking, cookie storage or external server calls.
33
 
34
  <strong>WP Armour Extended (Paid Version) supports additional anti spam protection and features.</strong>
35
 
36
+ * Added 2 level spam check. If you are still getting spam submission, you can enable 2 level spam check in Extended version from Extended Settings tab.
37
  * WooCommerce Checkout & Registration (<a href="https://woocommerce.com">woocommerce.com</a>)
38
  * Easy Digital Downloads Checkout and Registration (<a href="https://easydigitaldownloads.com">easydigitaldownloads.com</a>)
39
  * QuForm Contact Form (<a href="https://www.quform.com">quform.com</a>)
136
 
137
  == Changelog ==
138
 
139
+ = = 1.9 =
140
+ * Removed inline javascript for better performance.
141
+
142
  = = 1.8.5 =
143
  * Added support for WooCommerce Reviews Pro.
144
  * Added support for Fluent Form Conversional Forms.
wp-armour.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: WP Armour - Honeypot Anti Spam
5
  Plugin URI: http://wordpress.org/plugins/honeypot/
6
  Description: Add honeypot anti spam protection.
7
  Author: Dnesscarkey
8
- Version: 1.8.5
9
  Author URI: https://dineshkarki.com.np/wp-armour-anti-spam
10
  */
11
 
@@ -36,7 +36,8 @@ add_action('wp_enqueue_scripts','wpa_load_scripts');
36
  add_action('login_enqueue_scripts','wpa_load_scripts');
37
  add_action('admin_menu', 'wpa_plugin_menu');
38
  add_action('wpa_handle_spammers','wpa_save_stats',10,2);
39
-
 
40
 
41
  register_activation_hook( __FILE__, 'wpa_plugin_activation' );
42
 
5
  Plugin URI: http://wordpress.org/plugins/honeypot/
6
  Description: Add honeypot anti spam protection.
7
  Author: Dnesscarkey
8
+ Version: 1.9
9
  Author URI: https://dineshkarki.com.np/wp-armour-anti-spam
10
  */
11
 
36
  add_action('login_enqueue_scripts','wpa_load_scripts');
37
  add_action('admin_menu', 'wpa_plugin_menu');
38
  add_action('wpa_handle_spammers','wpa_save_stats',10,2);
39
+ add_action( 'wp_ajax_wpa_field_info', 'wpa_field_info_ajax' );
40
+ add_action( 'wp_ajax_nopriv_wpa_field_info', 'wpa_field_info_ajax' );
41
 
42
  register_activation_hook( __FILE__, 'wpa_plugin_activation' );
43