Google Captcha (reCAPTCHA) by BestWebSoft - Version 1.47

Version Description

  • 18.07.2019 =
  • Update : The bug with the reCAPTCHA verification in version 1.46 has been fixed.
Download this release

Release Info

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

Code changes from version 1.46 to 1.47

Files changed (4) hide show
  1. google-captcha.php +3 -7
  2. js/admin_script.js +8 -30
  3. js/script.js +13 -20
  4. readme.txt +7 -1
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.45
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv3 or later
12
  */
@@ -162,10 +162,6 @@ if ( ! function_exists( 'gglcptch_add_admin_script_styles' ) ) {
162
  if ( isset( $_REQUEST['page'] ) && ( 'google-captcha.php' == $_REQUEST['page'] || 'google-captcha-whitelist.php' == $_REQUEST['page'] ) ) {
163
  wp_enqueue_style( 'gglcptch_stylesheet', plugins_url( 'css/style.css', __FILE__ ), array(), $gglcptch_plugin_info['Version'] );
164
  wp_enqueue_script( 'gglcptch_admin_script', plugins_url( 'js/admin_script.js', __FILE__ ), array( 'jquery', 'jquery-ui-accordion' ), $gglcptch_plugin_info['Version'] );
165
- wp_localize_script( 'gglcptch_admin_script', 'gglcptchScriptVars', array(
166
- 'version' => $gglcptch_options['recaptcha_version'],
167
- 'disable' => $gglcptch_options['disable_submit_button']
168
- ) );
169
 
170
  bws_enqueue_settings_scripts();
171
  bws_plugins_include_codemirror();
@@ -562,7 +558,7 @@ if ( ! function_exists( 'gglcptch_display' ) ) {
562
 
563
  if ( $gglcptch_options['hide_badge'] && 'v2' != $gglcptch_options['recaptcha_version'] ) {
564
  $content .= sprintf(
565
- '<div>%s<a href="https://policies.google.com/privacy" target="_blank">%s</a>%s<a href="https://policies.google.com/terms" target="_blank">%s</a>%s</div>',
566
  __( 'This site is protected by reCAPTCHA and the Google ', 'google-captcha' ),
567
  __( 'Privacy Policy', 'google-captcha' ),
568
  __( ' and ', 'google-captcha' ),
@@ -1202,4 +1198,4 @@ add_filter( 'plugin_row_meta', 'gglcptch_links', 10, 2 );
1202
  add_action( 'admin_notices', 'gglcptch_plugin_banner' );
1203
 
1204
  add_action( 'wp_ajax_gglcptch-test-keys', 'gglcptch_test_keys' );
1205
- add_action( 'wp_ajax_gglcptch_test_keys_verification', 'gglcptch_test_keys_verification' );
6
  Author: BestWebSoft
7
  Text Domain: google-captcha
8
  Domain Path: /languages
9
+ Version: 1.47
10
  Author URI: https://bestwebsoft.com/
11
  License: GPLv3 or later
12
  */
162
  if ( isset( $_REQUEST['page'] ) && ( 'google-captcha.php' == $_REQUEST['page'] || 'google-captcha-whitelist.php' == $_REQUEST['page'] ) ) {
163
  wp_enqueue_style( 'gglcptch_stylesheet', plugins_url( 'css/style.css', __FILE__ ), array(), $gglcptch_plugin_info['Version'] );
164
  wp_enqueue_script( 'gglcptch_admin_script', plugins_url( 'js/admin_script.js', __FILE__ ), array( 'jquery', 'jquery-ui-accordion' ), $gglcptch_plugin_info['Version'] );
 
 
 
 
165
 
166
  bws_enqueue_settings_scripts();
167
  bws_plugins_include_codemirror();
558
 
559
  if ( $gglcptch_options['hide_badge'] && 'v2' != $gglcptch_options['recaptcha_version'] ) {
560
  $content .= sprintf(
561
+ '<div class="google-captcha-notice">%s<a href="https://policies.google.com/privacy" target="_blank">%s</a>%s<a href="https://policies.google.com/terms" target="_blank">%s</a>%s</div>',
562
  __( 'This site is protected by reCAPTCHA and the Google ', 'google-captcha' ),
563
  __( 'Privacy Policy', 'google-captcha' ),
564
  __( ' and ', 'google-captcha' ),
1198
  add_action( 'admin_notices', 'gglcptch_plugin_banner' );
1199
 
1200
  add_action( 'wp_ajax_gglcptch-test-keys', 'gglcptch_test_keys' );
1201
+ add_action( 'wp_ajax_gglcptch_test_keys_verification', 'gglcptch_test_keys_verification' );
js/admin_script.js CHANGED
@@ -70,14 +70,7 @@
70
  $( '.gglcptch-test-results' ).remove();
71
  $( '#gglcptch-test-block' ).load( $( this ).prop( 'href' ), function() {
72
  $( '.gglcptch_v1, .gglcptch_v2, .gglcptch_invisible' ).each( function() {
73
- var container = $( this ).find( '.gglcptch_recaptcha' ).attr( 'id' ),
74
- containerData = $( this ).find( '.gglcptch_recaptcha' );
75
-
76
- // add data-callback to disable submit
77
- if ( 'v2' === gglcptchScriptVars.version && '1' === gglcptchScriptVars.disable ) {
78
- containerData.attr( 'data-callback', 'recaptchaCallback' );
79
- }
80
-
81
  if ( $( this ).is( ':visible' ) ) {
82
  gglcptch.display( container );
83
  if ( $( this ).hasClass( 'gglcptch_invisible' ) ) {
@@ -90,27 +83,12 @@
90
 
91
  e.stopPropagation();
92
  $( '#gglcptch-test-keys' ).hide();
93
-
94
- // get callback for option disabled submit
95
- function recaptchaCallback() {
96
- $( 'form input:submit, form button' ).prop( 'disabled', false );
97
- }
98
-
99
- // remove disabled attr
100
- function removeDisabled() {
101
- if ( $( '#gglcptch_test_keys_verification' ).length > 0 ) {
102
- $( '#gglcptch_test_keys_verification' ).removeAttr( 'disabled' );
103
- }
104
- }
105
-
106
- if ( 'v2' === gglcptchScriptVars.version ) {
107
- if ( '1' === gglcptchScriptVars.disable ) {
108
- window.recaptchaCallback = recaptchaCallback;
109
- } else {
110
- setTimeout( removeDisabled, 8000 );
111
- }
112
- }
113
-
114
  return false;
115
  } );
116
 
@@ -151,4 +129,4 @@
151
  e.stopPropagation();
152
  return false;
153
  } );
154
- } )( jQuery );
70
  $( '.gglcptch-test-results' ).remove();
71
  $( '#gglcptch-test-block' ).load( $( this ).prop( 'href' ), function() {
72
  $( '.gglcptch_v1, .gglcptch_v2, .gglcptch_invisible' ).each( function() {
73
+ var container = $( this ).find( '.gglcptch_recaptcha' ).attr( 'id' );
 
 
 
 
 
 
 
74
  if ( $( this ).is( ':visible' ) ) {
75
  gglcptch.display( container );
76
  if ( $( this ).hasClass( 'gglcptch_invisible' ) ) {
83
 
84
  e.stopPropagation();
85
  $( '#gglcptch-test-keys' ).hide();
86
+ setTimeout( function(){
87
+ if( $( '#gglcptch_test_keys_verification' ).length > 0 ) {
88
+ $( '#gglcptch_test_keys_verification' ).removeAttr('disabled');
89
+ $( '.bws_form input[type="submit"]' ).removeAttr( 'disabled' );
90
+ }
91
+ }, 8000 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  return false;
93
  } );
94
 
129
  e.stopPropagation();
130
  return false;
131
  } );
132
+ } )( jQuery );
js/script.js CHANGED
@@ -9,11 +9,6 @@
9
 
10
  var container = $( this ).find( '.gglcptch_recaptcha' );
11
 
12
- // add data-callback to disable submit
13
- if ( 'v2' === gglcptch.options.version ) {
14
- container.attr( 'data-callback', 'recaptchaCallback' );
15
- }
16
-
17
  if (
18
  container.is( ':empty' ) &&
19
  ( gglcptch.vars.visibility || $( this ).is( ':visible' ) === $( this ).is( ':not(:hidden)' ) )
@@ -101,7 +96,7 @@
101
  }
102
 
103
  // add attribute disable to the submit
104
- if ( 'v2' === gglcptch.options.version && '1' == gglcptch.options.disable ) {
105
  $( '#' + container ).closest( 'form' ).find( 'input:submit, button' ).prop( 'disabled', true );
106
  }
107
 
@@ -165,12 +160,6 @@
165
  var gglcptch_version = gglcptch.options.version;
166
  v1_add_to_last_element = v1_add_to_last_element || false;
167
 
168
- if ( 'v1' == gglcptch_version ) {
169
- if ( Recaptcha.widget == null || v1_add_to_last_element == true ) {
170
- Recaptcha.create( gglcptch.options.sitekey, container, { 'theme' : gglcptch.options.theme } );
171
- }
172
- }
173
-
174
  if ( 'v2' == gglcptch_version ) {
175
  if ( $( '#' + container ).parent().width() <= 300 ) {
176
  var size = 'compact';
@@ -178,7 +167,17 @@
178
  var size = 'normal';
179
  }
180
  var parameters = params ? params : { 'sitekey' : gglcptch.options.sitekey, 'theme' : gglcptch.options.theme, 'size' : size },
181
- gglcptch_index = grecaptcha.render( container, parameters );
 
 
 
 
 
 
 
 
 
 
182
  $( '#' + container ).data( 'gglcptch_index', gglcptch_index );
183
  }
184
 
@@ -225,12 +224,6 @@
225
  }
226
  };
227
 
228
- // get callback and remove disabled attribute from submit
229
- function recaptchaCallback() {
230
- $( 'form input:submit, form button' ).prop( 'disabled', false );
231
- }
232
- window.recaptchaCallback = recaptchaCallback;
233
-
234
  $( document ).ready( function() {
235
  var tryCounter = 0,
236
  /* launching timer so that the function keeps trying to display the reCAPTCHA again and again until google js api is loaded */
@@ -283,4 +276,4 @@
283
  }
284
  }
285
 
286
- } )( jQuery, gglcptch );
9
 
10
  var container = $( this ).find( '.gglcptch_recaptcha' );
11
 
 
 
 
 
 
12
  if (
13
  container.is( ':empty' ) &&
14
  ( gglcptch.vars.visibility || $( this ).is( ':visible' ) === $( this ).is( ':not(:hidden)' ) )
96
  }
97
 
98
  // add attribute disable to the submit
99
+ if ( 'v2' === gglcptch.options.version && gglcptch.options.disable ) {
100
  $( '#' + container ).closest( 'form' ).find( 'input:submit, button' ).prop( 'disabled', true );
101
  }
102
 
160
  var gglcptch_version = gglcptch.options.version;
161
  v1_add_to_last_element = v1_add_to_last_element || false;
162
 
 
 
 
 
 
 
163
  if ( 'v2' == gglcptch_version ) {
164
  if ( $( '#' + container ).parent().width() <= 300 ) {
165
  var size = 'compact';
167
  var size = 'normal';
168
  }
169
  var parameters = params ? params : { 'sitekey' : gglcptch.options.sitekey, 'theme' : gglcptch.options.theme, 'size' : size },
170
+ block = $( '#' + container ),
171
+ form = block.closest( 'form' );
172
+
173
+ /* Callback function works only in frontend */
174
+ if ( ! $( 'body' ).hasClass( 'wp-admin' ) ) {
175
+ parameters['callback'] = function() {
176
+ form.find( 'button, input:submit' ).prop( 'disabled', false );
177
+ };
178
+ }
179
+
180
+ var gglcptch_index = grecaptcha.render( container, parameters );
181
  $( '#' + container ).data( 'gglcptch_index', gglcptch_index );
182
  }
183
 
224
  }
225
  };
226
 
 
 
 
 
 
 
227
  $( document ).ready( function() {
228
  var tryCounter = 0,
229
  /* launching timer so that the function keeps trying to display the reCAPTCHA again and again until google js api is loaded */
276
  }
277
  }
278
 
279
+ } )( jQuery, gglcptch );
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.2.2
7
- Stable tag: 1.46
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -266,6 +266,9 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
266
 
267
  == Changelog ==
268
 
 
 
 
269
  = V1.46 - 16.07.2019 =
270
  * Update : All functionality was updated for WordPress 5.2.2.
271
 
@@ -470,6 +473,9 @@ Please make sure that the problem hasn't been discussed yet on our forum (<https
470
 
471
  == Upgrade Notice ==
472
 
 
 
 
473
  = V1.46 =
474
  * The compatibility with new WordPress version updated.
475
 
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.2.2
7
+ Stable tag: 1.47
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
266
 
267
  == Changelog ==
268
 
269
+ = V1.47 - 18.07.2019 =
270
+ * Update : The bug with the reCAPTCHA verification in version 1.46 has been fixed.
271
+
272
  = V1.46 - 16.07.2019 =
273
  * Update : All functionality was updated for WordPress 5.2.2.
274
 
473
 
474
  == Upgrade Notice ==
475
 
476
+ = V1.47 =
477
+ * Bugs fixed.
478
+
479
  = V1.46 =
480
  * The compatibility with new WordPress version updated.
481