Version Description
- Comments: use filter
comment_form_submit_button
in WP >
Download this release
Release Info
Developer | podpirate |
Plugin | WordPress ReCaptcha Integration |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.3
inc/class-wp_recaptcha_contactform7.php
CHANGED
@@ -69,7 +69,7 @@ class WP_reCaptcha_ContactForm7 {
|
|
69 |
$validation_error = wpcf7_get_validation_error( $tag->name );
|
70 |
|
71 |
$html = sprintf(
|
72 |
-
'<span class="wpcf7-form-control-wrap %1$s">%2$s %3$s</span>',
|
73 |
$tag->name, $recaptcha_html, $validation_error );
|
74 |
|
75 |
return $html;
|
69 |
$validation_error = wpcf7_get_validation_error( $tag->name );
|
70 |
|
71 |
$html = sprintf(
|
72 |
+
apply_filters( 'wp_recaptcha_cf7_shortcode_wrap' ,'<span class="wpcf7-form-control-wrap %1$s">%2$s %3$s</span>' ),
|
73 |
$tag->name, $recaptcha_html, $validation_error );
|
74 |
|
75 |
return $html;
|
inc/class-wp_recaptcha_woocommerce.php
CHANGED
@@ -42,19 +42,20 @@ class WP_reCaptcha_WooCommerce {
|
|
42 |
$enable_order = $wp_recaptcha->get_option('recaptcha_enable_wc_order') ;
|
43 |
$enable_signup = $wp_recaptcha->get_option('recaptcha_enable_signup') ;
|
44 |
$enable_login = $wp_recaptcha->get_option('recaptcha_enable_login');
|
|
|
45 |
if ( $require_recaptcha ) {
|
46 |
// WooCommerce support
|
47 |
if ( $wp_recaptcha->get_option('recaptcha_flavor') == 'grecaptcha' && function_exists( 'wc_add_notice' ) ) {
|
48 |
if ( $enable_order ) {
|
49 |
add_action('woocommerce_review_order_before_submit' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
|
50 |
add_action('woocommerce_checkout_process', array( &$this , 'recaptcha_check' ) );
|
|
|
51 |
} else if ( $enable_signup ) {
|
52 |
add_filter( 'wp_recaptcha_required' , array( &$this , 'disable_on_checkout' ) );
|
53 |
}
|
54 |
if ( $enable_login ) {
|
55 |
add_action('woocommerce_login_form' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
|
56 |
add_filter('woocommerce_process_login_errors', array( &$this , 'login_errors' ) , 10 , 3 );
|
57 |
-
|
58 |
}
|
59 |
if ( $enable_signup ) {
|
60 |
// displaying the captcha at hook 'registration_form' already done by core plugin
|
@@ -64,8 +65,11 @@ class WP_reCaptcha_WooCommerce {
|
|
64 |
}
|
65 |
add_filter('woocommerce_form_field_recaptcha', array( $wp_recaptcha , 'recaptcha_html' ) , 10 , 3 );
|
66 |
/*
|
67 |
-
LOSTPW: Not possible yet. Needs https://github.com/woothemes/woocommerce/pull/
|
68 |
*/
|
|
|
|
|
|
|
69 |
}
|
70 |
}
|
71 |
}
|
42 |
$enable_order = $wp_recaptcha->get_option('recaptcha_enable_wc_order') ;
|
43 |
$enable_signup = $wp_recaptcha->get_option('recaptcha_enable_signup') ;
|
44 |
$enable_login = $wp_recaptcha->get_option('recaptcha_enable_login');
|
45 |
+
$enable_lostpw = $wp_recaptcha->get_option('recaptcha_enable_lostpw');
|
46 |
if ( $require_recaptcha ) {
|
47 |
// WooCommerce support
|
48 |
if ( $wp_recaptcha->get_option('recaptcha_flavor') == 'grecaptcha' && function_exists( 'wc_add_notice' ) ) {
|
49 |
if ( $enable_order ) {
|
50 |
add_action('woocommerce_review_order_before_submit' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
|
51 |
add_action('woocommerce_checkout_process', array( &$this , 'recaptcha_check' ) );
|
52 |
+
add_filter( 'wc_checkout_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
53 |
} else if ( $enable_signup ) {
|
54 |
add_filter( 'wp_recaptcha_required' , array( &$this , 'disable_on_checkout' ) );
|
55 |
}
|
56 |
if ( $enable_login ) {
|
57 |
add_action('woocommerce_login_form' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
|
58 |
add_filter('woocommerce_process_login_errors', array( &$this , 'login_errors' ) , 10 , 3 );
|
|
|
59 |
}
|
60 |
if ( $enable_signup ) {
|
61 |
// displaying the captcha at hook 'registration_form' already done by core plugin
|
65 |
}
|
66 |
add_filter('woocommerce_form_field_recaptcha', array( $wp_recaptcha , 'recaptcha_html' ) , 10 , 3 );
|
67 |
/*
|
68 |
+
LOSTPW: Not possible yet. Needs https://github.com/woothemes/woocommerce/pull/7786 being applied.
|
69 |
*/
|
70 |
+
if ( $enable_lostpw ) {
|
71 |
+
add_action( 'woocommerce_lostpassword_form' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
|
72 |
+
}
|
73 |
}
|
74 |
}
|
75 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: security, captcha, recaptcha, no captcha, login, signup, contact form 7, ninja forms, woocommerce
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -61,9 +61,8 @@ running under his/her own domain name.
|
|
61 |
- Old style reCaptcha does not work together with **WooCommerce**.
|
62 |
|
63 |
- In **WooCommerce** the reset password form can not be protected by a captcha. Woocommerce does
|
64 |
-
not fire any action in the lost password form, so there is no way for the plugin to hook in
|
65 |
-
|
66 |
-
in the official WC repository. Sadly it did not make into the WC core.
|
67 |
|
68 |
- Due to a lack of filters there is no (and as far as one can see, there will never be)
|
69 |
support for the **MailPoet** subscription form.
|
@@ -243,6 +242,12 @@ I will migrate all the translation stuff there.
|
|
243 |
|
244 |
== Changelog ==
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
= 1.1.2 =
|
247 |
- Fix: Was not possible to uncheck lockout setting.
|
248 |
- Fix: Potential JS error when 'Disable Submit Buttons' was enabled.
|
4 |
Tags: security, captcha, recaptcha, no captcha, login, signup, contact form 7, ninja forms, woocommerce
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 1.1.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
61 |
- Old style reCaptcha does not work together with **WooCommerce**.
|
62 |
|
63 |
- In **WooCommerce** the reset password form can not be protected by a captcha. Woocommerce does
|
64 |
+
not fire any action in the lost password form, so there is no way for the plugin to hook in.
|
65 |
+
This will propably be fixed with WooCommerce 2.3.8.
|
|
|
66 |
|
67 |
- Due to a lack of filters there is no (and as far as one can see, there will never be)
|
68 |
support for the **MailPoet** subscription form.
|
242 |
|
243 |
== Changelog ==
|
244 |
|
245 |
+
= 1.1.3 =
|
246 |
+
- Comments: use filter `comment_form_submit_button` in WP >= 4.2
|
247 |
+
- WooCommerce: Add action listener to `woocommerce_lostpassword_form` (probably functional in WC 2.3.8).
|
248 |
+
- Introduce `{$feature}recaptcha_html` filters for custom form integration.
|
249 |
+
- Introduce filter `wp_recaptcha_cf7_shortcode_wrap`.
|
250 |
+
|
251 |
= 1.1.2 =
|
252 |
- Fix: Was not possible to uncheck lockout setting.
|
253 |
- Fix: Potential JS error when 'Disable Submit Buttons' was enabled.
|
wp-recaptcha-integration.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP reCaptcha Integration
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-recaptcha-integration/
|
5 |
Description: Integrate reCaptcha in your blog. Supports no Captcha (new style recaptcha) as well as the old style reCaptcha. Provides of the box integration for signup, login, comment forms, lost password, Ninja Forms and contact form 7.
|
6 |
-
Version: 1.1.
|
7 |
Author: Jörn Lund
|
8 |
Author URI: https://github.com/mcguffin/
|
9 |
*/
|
@@ -149,11 +149,20 @@ class WP_reCaptcha {
|
|
149 |
/*
|
150 |
add_action('comment_form_after_fields',array($this,'print_recaptcha_html'),10,0);
|
151 |
/*/
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
//*/
|
154 |
add_action('pre_comment_on_post',array($this,'recaptcha_check_or_die'));
|
155 |
|
156 |
add_action( 'print_comments_recaptcha' , array( &$this , 'print_recaptcha_html' ) );
|
|
|
157 |
}
|
158 |
if ( $this->get_option('recaptcha_enable_signup') ) {
|
159 |
// buddypress suuport.
|
@@ -168,11 +177,13 @@ class WP_reCaptcha {
|
|
168 |
add_action( 'signup_extra_fields' , array($this,'print_recaptcha_html'));
|
169 |
add_filter('wpmu_validate_user_signup',array(&$this,'wpmu_validate_user_signup'));
|
170 |
}
|
|
|
171 |
|
172 |
}
|
173 |
if ( $this->get_option('recaptcha_enable_login') ) {
|
174 |
add_action('login_form',array(&$this,'print_recaptcha_html'));
|
175 |
add_filter('wp_authenticate_user',array(&$this,'deny_login'),99 );
|
|
|
176 |
}
|
177 |
if ( $this->get_option('recaptcha_enable_lostpw') ) {
|
178 |
add_action('lostpassword_form' , array($this,'print_recaptcha_html') );
|
@@ -181,6 +192,7 @@ class WP_reCaptcha {
|
|
181 |
/*/ // switch this when pull request accepted and included in official WC release.
|
182 |
add_filter('allow_password_reset' , array(&$this,'wp_error') );
|
183 |
//*/
|
|
|
184 |
}
|
185 |
if ( 'WPLANG' === $this->get_option( 'recaptcha_language' ) )
|
186 |
add_filter( 'wp_recaptcha_language' , array( &$this,'recaptcha_wplang' ) , 5 );
|
@@ -188,6 +200,7 @@ class WP_reCaptcha {
|
|
188 |
add_action( 'recaptcha_print' , array( &$this , 'print_recaptcha_html' ) );
|
189 |
add_filter( 'recaptcha_valid' , array( &$this , 'recaptcha_check' ) );
|
190 |
add_filter( 'recaptcha_error' , array( &$this , 'wp_error' ) );
|
|
|
191 |
}
|
192 |
}
|
193 |
|
@@ -319,6 +332,17 @@ class WP_reCaptcha {
|
|
319 |
return $this->captcha_instance()->get_html( $attr );
|
320 |
}
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
/**
|
323 |
* HTML comment with some notes (beginning)
|
324 |
*
|
3 |
Plugin Name: WP reCaptcha Integration
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-recaptcha-integration/
|
5 |
Description: Integrate reCaptcha in your blog. Supports no Captcha (new style recaptcha) as well as the old style reCaptcha. Provides of the box integration for signup, login, comment forms, lost password, Ninja Forms and contact form 7.
|
6 |
+
Version: 1.1.3
|
7 |
Author: Jörn Lund
|
8 |
Author URI: https://github.com/mcguffin/
|
9 |
*/
|
149 |
/*
|
150 |
add_action('comment_form_after_fields',array($this,'print_recaptcha_html'),10,0);
|
151 |
/*/
|
152 |
+
|
153 |
+
// WP 4.2 introduced `comment_form_submit_button` filter
|
154 |
+
// which is much more likely to work
|
155 |
+
global $wp_version;
|
156 |
+
if ( version_compare( $wp_version , '4.2' ) >= 0 )
|
157 |
+
add_filter('comment_form_submit_button',array($this,'prepend_recaptcha_html'),10,2);
|
158 |
+
else
|
159 |
+
add_filter('comment_form_defaults',array($this,'comment_form_defaults'),10);
|
160 |
+
|
161 |
//*/
|
162 |
add_action('pre_comment_on_post',array($this,'recaptcha_check_or_die'));
|
163 |
|
164 |
add_action( 'print_comments_recaptcha' , array( &$this , 'print_recaptcha_html' ) );
|
165 |
+
add_filter( 'comments_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
166 |
}
|
167 |
if ( $this->get_option('recaptcha_enable_signup') ) {
|
168 |
// buddypress suuport.
|
177 |
add_action( 'signup_extra_fields' , array($this,'print_recaptcha_html'));
|
178 |
add_filter('wpmu_validate_user_signup',array(&$this,'wpmu_validate_user_signup'));
|
179 |
}
|
180 |
+
add_filter( 'signup_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
181 |
|
182 |
}
|
183 |
if ( $this->get_option('recaptcha_enable_login') ) {
|
184 |
add_action('login_form',array(&$this,'print_recaptcha_html'));
|
185 |
add_filter('wp_authenticate_user',array(&$this,'deny_login'),99 );
|
186 |
+
add_filter( 'login_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
187 |
}
|
188 |
if ( $this->get_option('recaptcha_enable_lostpw') ) {
|
189 |
add_action('lostpassword_form' , array($this,'print_recaptcha_html') );
|
192 |
/*/ // switch this when pull request accepted and included in official WC release.
|
193 |
add_filter('allow_password_reset' , array(&$this,'wp_error') );
|
194 |
//*/
|
195 |
+
add_filter( 'lostpassword_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
196 |
}
|
197 |
if ( 'WPLANG' === $this->get_option( 'recaptcha_language' ) )
|
198 |
add_filter( 'wp_recaptcha_language' , array( &$this,'recaptcha_wplang' ) , 5 );
|
200 |
add_action( 'recaptcha_print' , array( &$this , 'print_recaptcha_html' ) );
|
201 |
add_filter( 'recaptcha_valid' , array( &$this , 'recaptcha_check' ) );
|
202 |
add_filter( 'recaptcha_error' , array( &$this , 'wp_error' ) );
|
203 |
+
add_filter( 'recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
204 |
}
|
205 |
}
|
206 |
|
332 |
return $this->captcha_instance()->get_html( $attr );
|
333 |
}
|
334 |
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Get recaptcha HTML.
|
338 |
+
*
|
339 |
+
* @param $html string
|
340 |
+
* @return string recaptcha html prepended to first parameter.
|
341 |
+
*/
|
342 |
+
function prepend_recaptcha_html( $html ) {
|
343 |
+
return $this->recaptcha_html() . $html;
|
344 |
+
}
|
345 |
+
|
346 |
/**
|
347 |
* HTML comment with some notes (beginning)
|
348 |
*
|