Advanced noCaptcha & invisible Captcha - Version 2.4

Version Description

  • Bug fix: WooCommerce lostpassword corrupted link
Download this release

Release Info

Developer shamim51
Plugin Icon 128x128 Advanced noCaptcha & invisible Captcha
Version 2.4
Comparing to
See all releases

Code changes from version 2.1 to 2.4

admin/anr-admin-class.php CHANGED
@@ -115,6 +115,7 @@ if (!class_exists('anr_admin_class'))
115
  __( 'Comment Form', 'advanced-nocaptcha-recaptcha' ) => 'comment',
116
  __( 'bbPress New topic', 'advanced-nocaptcha-recaptcha' ) => 'bb_new',
117
  __( 'bbPress reply to topic', 'advanced-nocaptcha-recaptcha' ) => 'bb_reply',
 
118
 
119
  );
120
 
@@ -140,14 +141,14 @@ if (!class_exists('anr_admin_class'))
140
  <thead>
141
  <tr><th width = '50%'>".__("Setting", 'advanced-nocaptcha-recaptcha')."</th><th width = '50%'>".__("Value", 'advanced-nocaptcha-recaptcha')."</th></tr>
142
  </thead>
143
- <tr><td>".__("Site Key", 'advanced-nocaptcha-recaptcha')."<br/><small><a href='https://www.google.com/recaptcha/admin' target='_blank'>Get From Google</a></small></td><td><input type='text' size = '40' name='site_key' value='".anr_get_option('site_key')."' /></td></tr>
144
- <tr><td>".__("Secret key", 'advanced-nocaptcha-recaptcha')."<br/><small><a href='https://www.google.com/recaptcha/admin' target='_blank'>Get From Google</a></small></td><td><input type='text' size = '40' name='secret_key' value='".anr_get_option('secret_key')."' /></td></tr>
145
 
146
  <tr><td>".__("Language", 'advanced-nocaptcha-recaptcha')."</td><td><select name='language'>";
147
 
148
  foreach ( $languages as $language => $code ) {
149
 
150
- echo "<option value='$code' ".selected(anr_get_option('language'), $code,false).">$language</option>";
151
 
152
  }
153
 
@@ -164,19 +165,21 @@ if (!class_exists('anr_admin_class'))
164
  <option value='compact' ".selected(anr_get_option('size'), 'compact',false).">Compact</option>
165
 
166
  </select></td></tr>
167
- <tr><td>".__("Error Message", 'advanced-nocaptcha-recaptcha')."</td><td><input type='text' size = '40' name='error_message' value='".anr_get_option('error_message', '<strong>ERROR</strong>: Please solve Captcha correctly.')."' /></td></tr>
168
 
169
  <tr><td>".__("Show Captcha on", 'advanced-nocaptcha-recaptcha')."</td><td>";
170
 
171
  foreach ( $locations as $location => $slug ) {
172
 
173
- echo "<ul colspan='2'><label><input type='checkbox' name='$slug' value='1' ".checked(anr_get_option($slug), '1', false)." /> $location</label></ul>";
174
 
175
  }
 
176
  if ( function_exists('fepcf_plugin_activate'))
177
  echo "<ul colspan='2'><label><input type='checkbox' name='fep_contact_form' value='1' ".checked(anr_get_option('fep_contact_form'), '1', false)." /> FEP Contact Form</label></ul>";
178
  else
179
  echo "<ul colspan='2'><label><input type='checkbox' name='fep_contact_form' disabled value='1' ".checked(anr_get_option('fep_contact_form'), '1', false)." /> FEP Contact Form (is not installed) <a href='https://wordpress.org/plugins/fep-contact-form/' target='_blank'>Install Now</a></label></ul>";
 
180
 
181
  echo "<ul colspan='2'> For other forms see <a href='".esc_url(admin_url( 'admin.php?page=anr-instruction' ))."'>Instruction</a></ul>";
182
  echo "</td></tr>";
115
  __( 'Comment Form', 'advanced-nocaptcha-recaptcha' ) => 'comment',
116
  __( 'bbPress New topic', 'advanced-nocaptcha-recaptcha' ) => 'bb_new',
117
  __( 'bbPress reply to topic', 'advanced-nocaptcha-recaptcha' ) => 'bb_reply',
118
+ __( 'WooCommerce Checkout', 'advanced-nocaptcha-recaptcha' ) => 'wc_checkout',
119
 
120
  );
121
 
141
  <thead>
142
  <tr><th width = '50%'>".__("Setting", 'advanced-nocaptcha-recaptcha')."</th><th width = '50%'>".__("Value", 'advanced-nocaptcha-recaptcha')."</th></tr>
143
  </thead>
144
+ <tr><td>".__("Site Key", 'advanced-nocaptcha-recaptcha')."<br/><small><a href='https://www.google.com/recaptcha/admin' target='_blank'>Get From Google</a></small></td><td><input type='text' size = '40' name='site_key' value='".esc_attr( anr_get_option('site_key') )."' /></td></tr>
145
+ <tr><td>".__("Secret key", 'advanced-nocaptcha-recaptcha')."<br/><small><a href='https://www.google.com/recaptcha/admin' target='_blank'>Get From Google</a></small></td><td><input type='text' size = '40' name='secret_key' value='".esc_attr( anr_get_option('secret_key') )."' /></td></tr>
146
 
147
  <tr><td>".__("Language", 'advanced-nocaptcha-recaptcha')."</td><td><select name='language'>";
148
 
149
  foreach ( $languages as $language => $code ) {
150
 
151
+ echo "<option value='". esc_attr( $code ) ."' ".selected(anr_get_option('language'), $code,false).">".esc_html( $language )."</option>";
152
 
153
  }
154
 
165
  <option value='compact' ".selected(anr_get_option('size'), 'compact',false).">Compact</option>
166
 
167
  </select></td></tr>
168
+ <tr><td>".__("Error Message", 'advanced-nocaptcha-recaptcha')."</td><td><input type='text' size = '40' name='error_message' value='".wp_kses_post( anr_get_option('error_message', '<strong>ERROR</strong>: Please solve Captcha correctly.') )."' /></td></tr>
169
 
170
  <tr><td>".__("Show Captcha on", 'advanced-nocaptcha-recaptcha')."</td><td>";
171
 
172
  foreach ( $locations as $location => $slug ) {
173
 
174
+ echo "<ul colspan='2'><label><input type='checkbox' name='" . esc_attr( $slug ) . "' value='1' ".checked(anr_get_option($slug), '1', false)." /> ". esc_html( $location ) ."</label></ul>";
175
 
176
  }
177
+ /**
178
  if ( function_exists('fepcf_plugin_activate'))
179
  echo "<ul colspan='2'><label><input type='checkbox' name='fep_contact_form' value='1' ".checked(anr_get_option('fep_contact_form'), '1', false)." /> FEP Contact Form</label></ul>";
180
  else
181
  echo "<ul colspan='2'><label><input type='checkbox' name='fep_contact_form' disabled value='1' ".checked(anr_get_option('fep_contact_form'), '1', false)." /> FEP Contact Form (is not installed) <a href='https://wordpress.org/plugins/fep-contact-form/' target='_blank'>Install Now</a></label></ul>";
182
+ */
183
 
184
  echo "<ul colspan='2'> For other forms see <a href='".esc_url(admin_url( 'admin.php?page=anr-instruction' ))."'>Instruction</a></ul>";
185
  echo "</td></tr>";
advanced-nocaptcha-recaptcha.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced noCaptcha reCaptcha
4
  Plugin URI: https://shamimbiplob.wordpress.com/contact-us/
5
  Description: Show noCaptcha in Comment Form (after Comment textarea before submit button), Contact Form 7, bbPress, Login, Register, Lost Password, Reset Password. Also can implement in any other form easily.
6
- Version: 2.1
7
  Author: Shamim
8
  Author URI: https://shamimbiplob.wordpress.com/contact-us/
9
  Text Domain: advanced-nocaptcha-recaptcha
3
  Plugin Name: Advanced noCaptcha reCaptcha
4
  Plugin URI: https://shamimbiplob.wordpress.com/contact-us/
5
  Description: Show noCaptcha in Comment Form (after Comment textarea before submit button), Contact Form 7, bbPress, Login, Register, Lost Password, Reset Password. Also can implement in any other form easily.
6
+ Version: 2.4
7
  Author: Shamim
8
  Author URI: https://shamimbiplob.wordpress.com/contact-us/
9
  Text Domain: advanced-nocaptcha-recaptcha
anr-captcha-class.php CHANGED
@@ -28,11 +28,18 @@ if (!class_exists('anr_captcha_class'))
28
  add_action ('woocommerce_login_form', array($this, 'form_field'), 99);
29
  add_filter ('authenticate', array($this, 'login_verify'), 999 );
30
  }
 
 
 
 
 
31
 
32
  if ( '1' == anr_get_option( 'registration' )) {
33
  add_action ('register_form', array($this, 'form_field'), 99);
 
34
  add_filter ('registration_errors', array($this, 'registration_verify'), 10, 3 );
35
  add_filter ('woocommerce_registration_errors', array($this, 'registration_verify'), 10, 3 );
 
36
  }
37
 
38
  if ( '1' == anr_get_option( 'ms_user_signup' )) {
@@ -43,7 +50,8 @@ if (!class_exists('anr_captcha_class'))
43
  if ( '1' == anr_get_option( 'lost_password' )) {
44
  add_action ('lostpassword_form', array($this, 'form_field'), 99);
45
  add_action ('woocommerce_lostpassword_form', array($this, 'form_field'), 99);
46
- add_action ('allow_password_reset', array($this, 'lostpassword_verify'), 10, 2); //lostpassword_post does not return wp_error
 
47
  }
48
 
49
  if ( '1' == anr_get_option( 'reset_password' )) {
@@ -53,7 +61,11 @@ if (!class_exists('anr_captcha_class'))
53
  }
54
 
55
  if ( '1' == anr_get_option( 'comment' )) {
56
- add_filter ('comment_form_field_comment', array($this, 'comment_form_field') );
 
 
 
 
57
  add_filter ('preprocess_comment', array($this, 'comment_verify') );
58
  }
59
 
@@ -85,7 +97,7 @@ if (!class_exists('anr_captcha_class'))
85
  $site_key = trim(anr_get_option( 'site_key' ));
86
  $number = $this->total_captcha();
87
 
88
- $field = '<div id="anr_captcha_field_' . $number . '"></div>';
89
 
90
  if ( 1 == $no_js )
91
  {
@@ -169,6 +181,18 @@ if (!class_exists('anr_captcha_class'))
169
 
170
  }
171
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  function ms_form_field( $errors )
173
 
174
  {
@@ -192,7 +216,7 @@ if (!class_exists('anr_captcha_class'))
192
  if ( is_user_logged_in() && $loggedin_hide )
193
  return $defaults;
194
 
195
- $defaults = $defaults. '<p>' .anr_captcha_form_field( false ). '</p>';
196
  return $defaults;
197
 
198
 
@@ -259,6 +283,14 @@ if (!class_exists('anr_captcha_class'))
259
 
260
  return $result;
261
  }
 
 
 
 
 
 
 
 
262
 
263
 
264
  function reset_password_verify( $errors, $user )
@@ -330,7 +362,19 @@ if (!class_exists('anr_captcha_class'))
330
  bbp_add_error('anr_error', $error_message);
331
  }
332
  }
 
 
 
 
 
 
 
 
333
 
 
 
 
 
334
 
335
 
336
  } //END CLASS
28
  add_action ('woocommerce_login_form', array($this, 'form_field'), 99);
29
  add_filter ('authenticate', array($this, 'login_verify'), 999 );
30
  }
31
+
32
+ if ( '1' == anr_get_option( 'wc_checkout' )) {
33
+ add_action( 'woocommerce_after_checkout_validation', array($this, 'wc_checkout_verify') );
34
+ add_action ('woocommerce_checkout_after_order_review', array($this, 'wc_form_field') );
35
+ }
36
 
37
  if ( '1' == anr_get_option( 'registration' )) {
38
  add_action ('register_form', array($this, 'form_field'), 99);
39
+ add_action ('woocommerce_register_form', array($this, 'form_field'), 99);
40
  add_filter ('registration_errors', array($this, 'registration_verify'), 10, 3 );
41
  add_filter ('woocommerce_registration_errors', array($this, 'registration_verify'), 10, 3 );
42
+ add_action ('woocommerce_checkout_after_order_review', array($this, 'wc_form_field') );
43
  }
44
 
45
  if ( '1' == anr_get_option( 'ms_user_signup' )) {
50
  if ( '1' == anr_get_option( 'lost_password' )) {
51
  add_action ('lostpassword_form', array($this, 'form_field'), 99);
52
  add_action ('woocommerce_lostpassword_form', array($this, 'form_field'), 99);
53
+ //add_action ('allow_password_reset', array($this, 'lostpassword_verify'), 10, 2); //lostpassword_post does not return wp_error( prior WP 4.4 )
54
+ add_action('lostpassword_post', array($this, 'lostpassword_verify_44'));
55
  }
56
 
57
  if ( '1' == anr_get_option( 'reset_password' )) {
61
  }
62
 
63
  if ( '1' == anr_get_option( 'comment' )) {
64
+ if( ! is_user_logged_in() ) {
65
+ add_action ('comment_form_after_fields', array($this, 'form_field'), 99);
66
+ } else {
67
+ add_filter ('comment_form_field_comment', array($this, 'comment_form_field'), 99 );
68
+ }
69
  add_filter ('preprocess_comment', array($this, 'comment_verify') );
70
  }
71
 
97
  $site_key = trim(anr_get_option( 'site_key' ));
98
  $number = $this->total_captcha();
99
 
100
+ $field = '<div class="anr_captcha_field"><div id="anr_captcha_field_' . $number . '"></div></div>';
101
 
102
  if ( 1 == $no_js )
103
  {
181
 
182
  }
183
 
184
+ function wc_form_field()
185
+ {
186
+
187
+ if( ! is_user_logged_in() && 'yes' == get_option( 'woocommerce_enable_signup_and_login_from_checkout', 'yes' ) && '1' == anr_get_option( 'registration' ) ){
188
+ $this->form_field();
189
+
190
+ } elseif( '1' == anr_get_option( 'wc_checkout' ) ){
191
+ $this->form_field();
192
+ }
193
+
194
+ }
195
+
196
  function ms_form_field( $errors )
197
 
198
  {
216
  if ( is_user_logged_in() && $loggedin_hide )
217
  return $defaults;
218
 
219
+ $defaults = $defaults . anr_captcha_form_field( false );
220
  return $defaults;
221
 
222
 
283
 
284
  return $result;
285
  }
286
+
287
+ function lostpassword_verify_44( $errors )
288
+ {
289
+ if ( ! $this->verify() ) {
290
+ $error_message = anr_get_option( 'error_message' );
291
+ $errors->add('anr_error', $error_message);
292
+ }
293
+ }
294
 
295
 
296
  function reset_password_verify( $errors, $user )
362
  bbp_add_error('anr_error', $error_message);
363
  }
364
  }
365
+
366
+ function wc_checkout_verify()
367
+ {
368
+
369
+ if( ! is_user_logged_in() && 'yes' == get_option( 'woocommerce_enable_signup_and_login_from_checkout', 'yes' ) && '1' == anr_get_option( 'registration' ) ){
370
+ // verification done during ragistration, So no need any more verification
371
+
372
+ } elseif( ! $this->verify() ){
373
 
374
+ $error_message = anr_get_option( 'error_message' );
375
+ wc_add_notice( $error_message, 'error' );
376
+ }
377
+ }
378
 
379
 
380
  } //END CLASS
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: shamim51
3
  Tags: recaptcha,nocaptcha,no captcha,bot,spam,captcha,contact form 7 captcha,woocommerce captcha,woocommerce nocaptcha, woocommerce,widget,plugin,sidebar,shortcode,page,posts,comments,google,bbpress,multisite,multiple
4
  Donate link: https://www.paypal.me/hasanshamim
5
- Requires at least: 2.8
6
- Tested up to: 4.5.2
7
- Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,21 @@ Yes. You can show unlimited number of captcha in same page.
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  = 2.1 =
70
 
71
  * Captcha in WooCommerce added (WooCommerce Login, Registration, Lost password, Reset password forms).
@@ -93,6 +108,21 @@ Yes. You can show unlimited number of captcha in same page.
93
 
94
  == Upgrade Notice ==
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  = 2.1 =
97
 
98
  * Captcha in WooCommerce added (WooCommerce Login, Registration, Lost password, Reset password forms).
2
  Contributors: shamim51
3
  Tags: recaptcha,nocaptcha,no captcha,bot,spam,captcha,contact form 7 captcha,woocommerce captcha,woocommerce nocaptcha, woocommerce,widget,plugin,sidebar,shortcode,page,posts,comments,google,bbpress,multisite,multiple
4
  Donate link: https://www.paypal.me/hasanshamim
5
+ Requires at least: 4.4
6
+ Tested up to: 4.8.2
7
+ Stable tag: 2.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
 
67
  == Changelog ==
68
 
69
+ = 2.4 =
70
+
71
+ * Bug fix: WooCommerce lostpassword corrupted link
72
+
73
+ = 2.3 =
74
+
75
+ * Comment form captcha issue fixed.
76
+ * Captcha now wraped in anr_captcha_field div class.
77
+ * Comment form captcha p tag removed.
78
+
79
+ = 2.2 =
80
+
81
+ * Security update.
82
+ * WooCommerce checkout form issue fixed.
83
+
84
  = 2.1 =
85
 
86
  * Captcha in WooCommerce added (WooCommerce Login, Registration, Lost password, Reset password forms).
108
 
109
  == Upgrade Notice ==
110
 
111
+ = 2.4 =
112
+
113
+ * Bug fix: WooCommerce lostpassword corrupted link
114
+
115
+ = 2.3 =
116
+
117
+ * Comment form captcha issue fixed.
118
+ * Captcha now wraped in anr_captcha_field div class.
119
+ * Comment form captcha p tag removed.
120
+
121
+ = 2.2 =
122
+
123
+ * Security update.
124
+ * WooCommerce checkout form issue fixed.
125
+
126
  = 2.1 =
127
 
128
  * Captcha in WooCommerce added (WooCommerce Login, Registration, Lost password, Reset password forms).