Google Captcha (reCAPTCHA) by BestWebSoft - Version 1.41

Version Description

  • 13.02.2019 =
  • PRO : The compatibility with Ninja Forms has been added.
  • Update : The user interface has been updated.
  • Bugfix : The code refactoring was performed.
Download this release

Release Info

Developer bestwebsoft
Plugin Icon 128x128 Google Captcha (reCAPTCHA) by BestWebSoft
Version 1.41
Comparing to
See all releases

Code changes from version 1.40 to 1.41

google-captcha.php CHANGED
@@ -6,7 +6,7 @@ Description: Protect WordPress website forms from spam entries with Google Captc
6
  Author: BestWebSoft
7
  Text Domain: google-captcha
8
  Domain Path: /languages
9
- Version: 1.40
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv3 or later
12
  */
@@ -65,7 +65,7 @@ if ( ! function_exists( 'gglcptch_plugins_loaded' ) ) {
65
 
66
  if ( ! function_exists( 'gglcptch_init' ) ) {
67
  function gglcptch_init() {
68
- global $gglcptch_plugin_info, $gglcptch_options, $gglcptch_ip_in_whitelist;;
69
 
70
  require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' );
71
  bws_include_init( plugin_basename( __FILE__ ) );
@@ -86,10 +86,6 @@ if ( ! function_exists( 'gglcptch_init' ) ) {
86
  register_gglcptch_settings();
87
  }
88
 
89
- if ( ! isset( $gglcptch_ip_in_whitelist ) ) {
90
- $gglcptch_ip_in_whitelist = gglcptch_whitelisted_ip();
91
- }
92
-
93
  /* Add hooks */
94
  if ( ! $is_admin && ! empty( $gglcptch_options['public_key'] ) && ! empty( $gglcptch_options['private_key'] ) ) {
95
  gglcptch_add_actions();
@@ -353,7 +349,7 @@ if ( ! function_exists( 'gglcptch_get_default_options' ) ) {
353
  'whitelist_message' => __( 'You are in the whitelist', 'google-captcha' ),
354
  'public_key' => '',
355
  'private_key' => '',
356
- 'login_form' => 1,
357
  'registration_form' => 0,
358
  'reset_pwd_form' => 1,
359
  'comments_form' => 0,
@@ -510,17 +506,13 @@ if ( ! function_exists( 'gglcptch_is_hidden_for_role' ) ) {
510
  /* Display google captcha via shortcode */
511
  if ( ! function_exists( 'gglcptch_display' ) ) {
512
  function gglcptch_display( $content = false ) {
513
- global $gglcptch_options, $gglcptch_count, $gglcptch_ip_in_whitelist, $gglcptch_plugin_info;
514
 
515
  if ( empty( $gglcptch_options ) ) {
516
  register_gglcptch_settings();
517
  }
518
 
519
- if ( ! isset( $gglcptch_ip_in_whitelist ) ) {
520
- $gglcptch_ip_in_whitelist = gglcptch_whitelisted_ip();
521
- }
522
-
523
- if ( ! $gglcptch_ip_in_whitelist ) {
524
 
525
  if ( ! $gglcptch_count ) {
526
  $gglcptch_count = 1;
@@ -618,7 +610,7 @@ if ( ! function_exists( 'gglcptch_display' ) ) {
618
  gglcptch_add_styles();
619
  }
620
  } elseif ( ! empty( $gglcptch_options['whitelist_message'] ) ) {
621
- $content .= '<label class="gglcptch_whitelist_message">' . $gglcptch_options['whitelist_message'] . '</label>';
622
  }
623
 
624
  return $content;
@@ -674,6 +666,14 @@ if ( ! function_exists( 'gglcptch_check' ) ) {
674
  function gglcptch_check( $form = 'general', $debug = false ) {
675
  global $gglcptch_options;
676
 
 
 
 
 
 
 
 
 
677
  if ( empty( $gglcptch_options ) ) {
678
  register_gglcptch_settings();
679
  }
@@ -1021,7 +1021,7 @@ if ( ! function_exists( 'gglcptch_is_woocommerce_page' ) ) {
1021
 
1022
  if ( ! function_exists( 'gglcptch_test_keys' ) ) {
1023
  function gglcptch_test_keys() {
1024
- global $gglcptch_ip_in_whitelist, $gglcptch_options;
1025
  if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'] , $_REQUEST['action'] ) ) {
1026
  header( 'Content-Type: text/html' );
1027
  register_gglcptch_settings(); ?>
@@ -1032,8 +1032,7 @@ if ( ! function_exists( 'gglcptch_test_keys' ) ) {
1032
  _e( 'Please complete the captcha and submit "Test verification"', 'google-captcha' );
1033
  } ?>
1034
  </p>
1035
- <?php $gglcptch_ip_in_whitelist = false;
1036
- echo gglcptch_display(); ?>
1037
  <p>
1038
  <input type="hidden" name="gglcptch_test_keys_verification-nonce" value="<?php echo wp_create_nonce( 'gglcptch_test_keys_verification' ); ?>" />
1039
  <button id="gglcptch_test_keys_verification" name="action" class="button-primary" value="gglcptch_test_keys_verification" disabled="disabled"><?php _e( 'Test verification', 'google-captcha' ); ?></button>
@@ -1046,7 +1045,7 @@ if ( ! function_exists( 'gglcptch_test_keys' ) ) {
1046
  if ( ! function_exists( 'gglcptch_test_keys_verification' ) ) {
1047
  function gglcptch_test_keys_verification() {
1048
  if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'] , $_REQUEST['action'] ) ) {
1049
- $result = gglcptch_check( 'general', true );
1050
 
1051
  if ( ! $result['response'] ) {
1052
  if ( isset( $result['reason'] ) ) {
6
  Author: BestWebSoft
7
  Text Domain: google-captcha
8
  Domain Path: /languages
9
+ Version: 1.41
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv3 or later
12
  */
65
 
66
  if ( ! function_exists( 'gglcptch_init' ) ) {
67
  function gglcptch_init() {
68
+ global $gglcptch_plugin_info, $gglcptch_options;
69
 
70
  require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' );
71
  bws_include_init( plugin_basename( __FILE__ ) );
86
  register_gglcptch_settings();
87
  }
88
 
 
 
 
 
89
  /* Add hooks */
90
  if ( ! $is_admin && ! empty( $gglcptch_options['public_key'] ) && ! empty( $gglcptch_options['private_key'] ) ) {
91
  gglcptch_add_actions();
349
  'whitelist_message' => __( 'You are in the whitelist', 'google-captcha' ),
350
  'public_key' => '',
351
  'private_key' => '',
352
+ 'login_form' => 0,
353
  'registration_form' => 0,
354
  'reset_pwd_form' => 1,
355
  'comments_form' => 0,
506
  /* Display google captcha via shortcode */
507
  if ( ! function_exists( 'gglcptch_display' ) ) {
508
  function gglcptch_display( $content = false ) {
509
+ global $gglcptch_options, $gglcptch_count, $gglcptch_plugin_info;
510
 
511
  if ( empty( $gglcptch_options ) ) {
512
  register_gglcptch_settings();
513
  }
514
 
515
+ if ( ! gglcptch_whitelisted_ip() || ( isset( $_GET['action'] ) && 'gglcptch-test-keys' == $_GET['action'] ) ) {
 
 
 
 
516
 
517
  if ( ! $gglcptch_count ) {
518
  $gglcptch_count = 1;
610
  gglcptch_add_styles();
611
  }
612
  } elseif ( ! empty( $gglcptch_options['whitelist_message'] ) ) {
613
+ $content .= '<label class="gglcptch_whitelist_message" style="display: block;">' . $gglcptch_options['whitelist_message'] . '</label>';
614
  }
615
 
616
  return $content;
666
  function gglcptch_check( $form = 'general', $debug = false ) {
667
  global $gglcptch_options;
668
 
669
+ if ( gglcptch_whitelisted_ip() && 'gglcptch_test' != $form ) {
670
+ $result = array(
671
+ 'response' => true,
672
+ 'reason' => ''
673
+ );
674
+ return $result;
675
+ }
676
+
677
  if ( empty( $gglcptch_options ) ) {
678
  register_gglcptch_settings();
679
  }
1021
 
1022
  if ( ! function_exists( 'gglcptch_test_keys' ) ) {
1023
  function gglcptch_test_keys() {
1024
+ global $gglcptch_options;
1025
  if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'] , $_REQUEST['action'] ) ) {
1026
  header( 'Content-Type: text/html' );
1027
  register_gglcptch_settings(); ?>
1032
  _e( 'Please complete the captcha and submit "Test verification"', 'google-captcha' );
1033
  } ?>
1034
  </p>
1035
+ <?php echo gglcptch_display(); ?>
 
1036
  <p>
1037
  <input type="hidden" name="gglcptch_test_keys_verification-nonce" value="<?php echo wp_create_nonce( 'gglcptch_test_keys_verification' ); ?>" />
1038
  <button id="gglcptch_test_keys_verification" name="action" class="button-primary" value="gglcptch_test_keys_verification" disabled="disabled"><?php _e( 'Test verification', 'google-captcha' ); ?></button>
1045
  if ( ! function_exists( 'gglcptch_test_keys_verification' ) ) {
1046
  function gglcptch_test_keys_verification() {
1047
  if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'] , $_REQUEST['action'] ) ) {
1048
+ $result = gglcptch_check( 'gglcptch_test', true );
1049
 
1050
  if ( ! $result['response'] ) {
1051
  if ( isset( $result['reason'] ) ) {
includes/class-gglcptch-settings-tabs.php CHANGED
@@ -173,6 +173,19 @@ if ( ! class_exists( 'Gglcptch_Settings_Tabs' ) ) {
173
  </table>
174
  <div class="bws_tab_sub_label"><?php _e( 'General', 'google-captcha' ); ?></div>
175
  <table class="form-table">
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  <tr valign="top">
177
  <th scope="row"><?php _e( 'Enable reCAPTCHA for', 'google-captcha' ); ?></th>
178
  <td>
@@ -246,19 +259,6 @@ if ( ! class_exists( 'Gglcptch_Settings_Tabs' ) ) {
246
  </fieldset>
247
  </td>
248
  </tr>
249
- <tr valign="top">
250
- <th scope="row"><?php _e( 'reCAPTCHA Version', 'google-captcha' ); ?></th>
251
- <td>
252
- <fieldset>
253
- <?php foreach ( $this->versions as $version => $version_name ) { ?>
254
- <label>
255
- <input type="radio" name="gglcptch_recaptcha_version" value="<?php echo $version; ?>" <?php checked( $version, $this->options['recaptcha_version'] ); ?>> <?php echo $version_name; ?>
256
- </label>
257
- <br/>
258
- <?php } ?>
259
- </fieldset>
260
- </td>
261
- </tr>
262
  <tr class="gglcptch_theme_v2" valign="top">
263
  <th scope="row">
264
  <?php _e( 'Theme', 'google-captcha' ); ?>
173
  </table>
174
  <div class="bws_tab_sub_label"><?php _e( 'General', 'google-captcha' ); ?></div>
175
  <table class="form-table">
176
+ <tr valign="top">
177
+ <th scope="row"><?php _e( 'reCAPTCHA Version', 'google-captcha' ); ?></th>
178
+ <td>
179
+ <fieldset>
180
+ <?php foreach ( $this->versions as $version => $version_name ) { ?>
181
+ <label>
182
+ <input type="radio" name="gglcptch_recaptcha_version" value="<?php echo $version; ?>" <?php checked( $version, $this->options['recaptcha_version'] ); ?>> <?php echo $version_name; ?>
183
+ </label>
184
+ <br/>
185
+ <?php } ?>
186
+ </fieldset>
187
+ </td>
188
+ </tr>
189
  <tr valign="top">
190
  <th scope="row"><?php _e( 'Enable reCAPTCHA for', 'google-captcha' ); ?></th>
191
  <td>
259
  </fieldset>
260
  </td>
261
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  <tr class="gglcptch_theme_v2" valign="top">
263
  <th scope="row">
264
  <?php _e( 'Theme', 'google-captcha' ); ?>
includes/forms.php CHANGED
@@ -158,7 +158,7 @@ if ( ! function_exists( 'gglcptch_get_form_notice' ) ) {
158
 
159
  if ( ! function_exists( 'gglcptch_add_actions' ) ) {
160
  function gglcptch_add_actions() {
161
- global $gglcptch_options, $wp_version, $gglcptch_ip_in_whitelist;
162
 
163
  $is_user_logged_in = is_user_logged_in();
164
 
@@ -166,32 +166,23 @@ if ( ! function_exists( 'gglcptch_add_actions' ) ) {
166
 
167
  if ( gglcptch_is_recaptcha_required( 'login_form', $is_user_logged_in ) ) {
168
  add_action( 'login_form', 'gglcptch_login_display' );
169
- if ( ! $gglcptch_ip_in_whitelist ) {
170
- add_action( 'authenticate', 'gglcptch_login_check', 21, 1 );
171
- }
172
  }
173
 
174
  if ( gglcptch_is_recaptcha_required( 'registration_form', $is_user_logged_in ) ) {
175
  if ( ! is_multisite() ) {
176
  add_action( 'register_form', 'gglcptch_login_display', 99 );
177
- if ( ! $gglcptch_ip_in_whitelist ) {
178
- add_action( 'registration_errors', 'gglcptch_register_check', 10, 1 );
179
- }
180
  } else {
181
  add_action( 'signup_extra_fields', 'gglcptch_signup_display' );
182
  add_action( 'signup_blogform', 'gglcptch_signup_display' );
183
- if ( ! $gglcptch_ip_in_whitelist ) {
184
- add_filter( 'wpmu_validate_user_signup', 'gglcptch_signup_check', 10, 3 );
185
- }
186
  }
187
  }
188
 
189
  if ( gglcptch_is_recaptcha_required( 'reset_pwd_form', $is_user_logged_in ) ) {
190
  add_action( 'lostpassword_form', 'gglcptch_login_display' );
191
-
192
- if ( ! $gglcptch_ip_in_whitelist ) {
193
- add_action( 'allow_password_reset', 'gglcptch_lostpassword_check' );
194
- }
195
  }
196
  }
197
 
@@ -199,17 +190,13 @@ if ( ! function_exists( 'gglcptch_add_actions' ) ) {
199
  if ( gglcptch_is_recaptcha_required( 'comments_form', $is_user_logged_in ) ) {
200
  add_action( 'comment_form_after_fields', 'gglcptch_commentform_display' );
201
  add_action( 'comment_form_logged_in_after', 'gglcptch_commentform_display' );
202
- if ( ! $gglcptch_ip_in_whitelist ) {
203
- add_action( 'pre_comment_on_post', 'gglcptch_commentform_check' );
204
- }
205
  }
206
 
207
  /* Add Google Captcha to Contact Form by BestWebSoft */
208
  if ( gglcptch_is_recaptcha_required( 'contact_form', $is_user_logged_in ) ) {
209
  add_filter( 'cntctfrm_display_captcha', 'gglcptch_display', 10, 1 );
210
- if ( ! $gglcptch_ip_in_whitelist ) {
211
- add_filter( 'cntctfrm_check_form', 'gglcptch_contact_form_check' );
212
- }
213
  }
214
 
215
  /* Add Google Captcha to Testimonials by BestWebSoft */
158
 
159
  if ( ! function_exists( 'gglcptch_add_actions' ) ) {
160
  function gglcptch_add_actions() {
161
+ global $gglcptch_options, $wp_version;
162
 
163
  $is_user_logged_in = is_user_logged_in();
164
 
166
 
167
  if ( gglcptch_is_recaptcha_required( 'login_form', $is_user_logged_in ) ) {
168
  add_action( 'login_form', 'gglcptch_login_display' );
169
+ add_action( 'authenticate', 'gglcptch_login_check', 21, 1 );
 
 
170
  }
171
 
172
  if ( gglcptch_is_recaptcha_required( 'registration_form', $is_user_logged_in ) ) {
173
  if ( ! is_multisite() ) {
174
  add_action( 'register_form', 'gglcptch_login_display', 99 );
175
+ add_action( 'registration_errors', 'gglcptch_register_check', 10, 1 );
 
 
176
  } else {
177
  add_action( 'signup_extra_fields', 'gglcptch_signup_display' );
178
  add_action( 'signup_blogform', 'gglcptch_signup_display' );
179
+ add_filter( 'wpmu_validate_user_signup', 'gglcptch_signup_check', 10, 3 );
 
 
180
  }
181
  }
182
 
183
  if ( gglcptch_is_recaptcha_required( 'reset_pwd_form', $is_user_logged_in ) ) {
184
  add_action( 'lostpassword_form', 'gglcptch_login_display' );
185
+ add_action( 'allow_password_reset', 'gglcptch_lostpassword_check' );
 
 
 
186
  }
187
  }
188
 
190
  if ( gglcptch_is_recaptcha_required( 'comments_form', $is_user_logged_in ) ) {
191
  add_action( 'comment_form_after_fields', 'gglcptch_commentform_display' );
192
  add_action( 'comment_form_logged_in_after', 'gglcptch_commentform_display' );
193
+ add_action( 'pre_comment_on_post', 'gglcptch_commentform_check' );
 
 
194
  }
195
 
196
  /* Add Google Captcha to Contact Form by BestWebSoft */
197
  if ( gglcptch_is_recaptcha_required( 'contact_form', $is_user_logged_in ) ) {
198
  add_filter( 'cntctfrm_display_captcha', 'gglcptch_display', 10, 1 );
199
+ add_filter( 'cntctfrm_check_form', 'gglcptch_contact_form_check' );
 
 
200
  }
201
 
202
  /* Add Google Captcha to Testimonials by BestWebSoft */
includes/pro_banners.php CHANGED
@@ -65,7 +65,8 @@ if ( ! function_exists( 'gglcptch_supported_plugins_banner' ) ) {
65
  'wpforo_login_form' => array( 'form_name' => __( 'wpForo Login form', 'google-captcha' ) ),
66
  'wpforo_register_form' => array( 'form_name' => __( 'wpForo Registration form', 'google-captcha' ) ),
67
  'wpforo_new_topic_form' => array( 'form_name' => __( 'wpForo New Topic form', 'google-captcha' ) ),
68
- 'wpforo_reply_form' => array( 'form_name' => __( 'wpForo Reply form', 'google-captcha') )
 
69
  );
70
  $pro_sections = array(
71
  'external' => array(
@@ -76,6 +77,7 @@ if ( ! function_exists( 'gglcptch_supported_plugins_banner' ) ) {
76
  'jetpack_contact_form',
77
  'sbscrbr',
78
  'mailchimp',
 
79
  )
80
  ),
81
  'bbpress' => array(
65
  'wpforo_login_form' => array( 'form_name' => __( 'wpForo Login form', 'google-captcha' ) ),
66
  'wpforo_register_form' => array( 'form_name' => __( 'wpForo Registration form', 'google-captcha' ) ),
67
  'wpforo_new_topic_form' => array( 'form_name' => __( 'wpForo New Topic form', 'google-captcha' ) ),
68
+ 'wpforo_reply_form' => array( 'form_name' => __( 'wpForo Reply form', 'google-captcha') ),
69
+ 'ninja_form' => array( 'form_name' => __( 'Ninja Forms', 'google-captcha' ) )
70
  );
71
  $pro_sections = array(
72
  'external' => array(
77
  'jetpack_contact_form',
78
  'sbscrbr',
79
  'mailchimp',
80
+ 'ninja_form',
81
  )
82
  ),
83
  'bbpress' => array(
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://bestwebsoft.com/donate/
4
  Tags: anti-spam security, antispam, recaptcha, captcha, captha, Invisible reCaptcha, Invisible captcha, Invisibl reCaptcha, comment, cpatcha, google catcha, Invisible re captcha, recaptcha version3
5
  Requires at least: 3.9
6
  Tested up to: 5.0.3
7
- Stable tag: 1.40
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -64,6 +64,7 @@ http://www.youtube.com/watch?v=qwHsW3IJ7gQ
64
  > * Jetpack contact form
65
  > * Fast Secure Contact Form
66
  > * MailChimp for WordPress
 
67
  > * Compatible with WooCommerce:
68
  > * Login form
69
  > * Register form
@@ -259,6 +260,11 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
259
 
260
  == Changelog ==
261
 
 
 
 
 
 
262
  = V1.40 - 18.01.2019 =
263
  * Update : All functionality was updated for WordPress 5.0.3.
264
  * Update : The enqueueing of styles and scripts has been improved.
@@ -438,6 +444,11 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
438
 
439
  == Upgrade Notice ==
440
 
 
 
 
 
 
441
  = V1.40 =
442
  * The compatibility with new WordPress version updated.
443
  * Functionality improved.
4
  Tags: anti-spam security, antispam, recaptcha, captcha, captha, Invisible reCaptcha, Invisible captcha, Invisibl reCaptcha, comment, cpatcha, google catcha, Invisible re captcha, recaptcha version3
5
  Requires at least: 3.9
6
  Tested up to: 5.0.3
7
+ Stable tag: 1.41
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
64
  > * Jetpack contact form
65
  > * Fast Secure Contact Form
66
  > * MailChimp for WordPress
67
+ > * Ninja Forms [NEW]
68
  > * Compatible with WooCommerce:
69
  > * Login form
70
  > * Register form
260
 
261
  == Changelog ==
262
 
263
+ = V1.41 - 13.02.2019 =
264
+ * PRO : The compatibility with Ninja Forms has been added.
265
+ * Update : The user interface has been updated.
266
+ * Bugfix : The code refactoring was performed.
267
+
268
  = V1.40 - 18.01.2019 =
269
  * Update : All functionality was updated for WordPress 5.0.3.
270
  * Update : The enqueueing of styles and scripts has been improved.
444
 
445
  == Upgrade Notice ==
446
 
447
+ = V1.41 =
448
+ * Functionality expanded.
449
+ * Usability improved.
450
+ * Bugs fixed.
451
+
452
  = V1.40 =
453
  * The compatibility with new WordPress version updated.
454
  * Functionality improved.
screenshot-7.png CHANGED
Binary file