Version Description
- Fix: Layout issues on recaptcha nojs fallback (thanks to nurupo)
- Metadata: add plugin textdomain
Download this release
Release Info
Developer | podpirate |
Plugin | WordPress ReCaptcha Integration |
Version | 1.1.9 |
Comparing to | |
See all releases |
Code changes from version 1.1.5 to 1.1.9
- .svnignore +1 -0
- composer.json +17 -0
- inc/class-wp_recaptcha_awesome_support.php +90 -0
- inc/class-wp_recaptcha_bbpress.php +74 -0
- inc/class-wp_recaptcha_captcha.php +0 -3
- inc/class-wp_recaptcha_contactform7.php +108 -44
- inc/class-wp_recaptcha_ninjaforms.php +1 -1
- inc/class-wp_recaptcha_nocaptcha.php +16 -19
- inc/class-wp_recaptcha_options.php +121 -87
- inc/class-wp_recaptcha_recaptcha.php +12 -2
- languages/wp-recaptcha-integration-it_IT.mo +0 -0
- languages/wp-recaptcha-integration-it_IT.po +373 -0
- readme.txt +30 -9
- wp-recaptcha-integration.php +75 -67
.svnignore
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
.git
|
2 |
.gitignore
|
|
|
3 |
mkzip.sh
|
4 |
README.md
|
1 |
.git
|
2 |
.gitignore
|
3 |
+
composer.json
|
4 |
mkzip.sh
|
5 |
README.md
|
composer.json
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "mcguffin/wp-recaptcha-integration",
|
3 |
+
"type": "wordpress-plugin",
|
4 |
+
"license": "GPLv2",
|
5 |
+
"description": "WordPress reCaptcha integration supporting Ninja Forms and Contact Form 7",
|
6 |
+
"keywords": [
|
7 |
+
"wordpress",
|
8 |
+
"plugin",
|
9 |
+
"recaptcha",
|
10 |
+
"contact form 7",
|
11 |
+
"ninja forms",
|
12 |
+
"captcha"
|
13 |
+
],
|
14 |
+
"require": {
|
15 |
+
"php": ">=5.2.4"
|
16 |
+
}
|
17 |
+
}
|
inc/class-wp_recaptcha_awesome_support.php
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WP reCaptcha integration for Awesome Support
|
4 |
+
*
|
5 |
+
* @package WP reCaptcha
|
6 |
+
* @author Julien Liabeuf <julien@liabeuf.fr>
|
7 |
+
* @license GPL-2.0+
|
8 |
+
* @link http://themeavenue.net
|
9 |
+
* @copyright 2014 ThemeAvenue
|
10 |
+
*/
|
11 |
+
class WP_reCaptcha_Awesome_Support {
|
12 |
+
/**
|
13 |
+
* Holding the singleton instance
|
14 |
+
*/
|
15 |
+
private static $_instance = null;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @return WP_reCaptcha
|
19 |
+
*/
|
20 |
+
public static function instance(){
|
21 |
+
if ( is_null( self::$_instance ) )
|
22 |
+
self::$_instance = new self();
|
23 |
+
return self::$_instance;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Prevent from creating more instances
|
28 |
+
*/
|
29 |
+
private function __clone() { }
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prevent from creating more than one instance
|
33 |
+
*/
|
34 |
+
private function __construct() {
|
35 |
+
add_action( 'init', array( $this , 'init' ), 11 );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Init plugin component
|
40 |
+
* set hooks
|
41 |
+
*/
|
42 |
+
function init() {
|
43 |
+
|
44 |
+
$wp_recaptcha = WP_reCaptcha::instance();
|
45 |
+
$require_recaptcha = $wp_recaptcha->is_required();
|
46 |
+
$enable_login = $wp_recaptcha->get_option( 'recaptcha_enable_login' );
|
47 |
+
$enable_registration = $wp_recaptcha->get_option( 'recaptcha_enable_as_registration' );
|
48 |
+
|
49 |
+
if ( $require_recaptcha ) {
|
50 |
+
|
51 |
+
// Awesome Support support
|
52 |
+
|
53 |
+
if ( $enable_login ) {
|
54 |
+
add_action( 'wpas_after_login_fields', array( $wp_recaptcha, 'print_recaptcha_html' ), 10, 0 );
|
55 |
+
add_filter( 'wpas_try_login', array( &$this, 'recaptcha_check' ), 10, 1 );
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( $enable_registration ) {
|
59 |
+
add_action( 'wpas_after_registration_fields', array( $wp_recaptcha, 'print_recaptcha_html' ), 10, 0 );
|
60 |
+
add_filter( 'wpas_register_account_errors', array( $this, 'recaptcha_check' ), 10, 3 );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Check the Captcha after Awesome Support tried to log the user in
|
68 |
+
*
|
69 |
+
* If the user login failed we simply return the existing error.
|
70 |
+
*
|
71 |
+
* @param WP_Error|WP_User $signon The result of the login attempt
|
72 |
+
*
|
73 |
+
* @return WP_Error|WP_User
|
74 |
+
*/
|
75 |
+
function recaptcha_check( $signon ) {
|
76 |
+
|
77 |
+
if ( is_wp_error( $signon ) ) {
|
78 |
+
return $signon;
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( ! WP_reCaptcha::instance()->recaptcha_check() ) {
|
82 |
+
return new WP_Error( 'recaptcha_failed', __( 'The Captcha didn't verify', 'wp-recaptcha-integration' ) );
|
83 |
+
}
|
84 |
+
|
85 |
+
return $signon;
|
86 |
+
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
|
inc/class-wp_recaptcha_bbpress.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class to manage bbPress Support
|
5 |
+
*/
|
6 |
+
class WP_reCaptcha_bbPress {
|
7 |
+
/**
|
8 |
+
* Holding the singleton instance
|
9 |
+
*/
|
10 |
+
private static $_instance = null;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @return WP_reCaptcha
|
14 |
+
*/
|
15 |
+
public static function instance(){
|
16 |
+
if ( is_null( self::$_instance ) ) {
|
17 |
+
self::$_instance = new self();
|
18 |
+
}
|
19 |
+
|
20 |
+
return self::$_instance;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Prevent from creating more instances
|
25 |
+
*/
|
26 |
+
private function __clone() { }
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Prevent from creating more than one instance
|
30 |
+
*/
|
31 |
+
private function __construct() {
|
32 |
+
add_action('init' , array( &$this , 'init' ) , 0 );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Init plugin component
|
37 |
+
*
|
38 |
+
* set hooks
|
39 |
+
*/
|
40 |
+
function init() {
|
41 |
+
$wp_recaptcha = WP_reCaptcha::instance();
|
42 |
+
$require_recaptcha = $wp_recaptcha->is_required();
|
43 |
+
$enable_topic = $wp_recaptcha->get_option('recaptcha_enable_bbp_topic') ;
|
44 |
+
$enable_reply = $wp_recaptcha->get_option('recaptcha_enable_bbp_reply') ;
|
45 |
+
|
46 |
+
if ( $require_recaptcha ) {
|
47 |
+
|
48 |
+
// WooCommerce support
|
49 |
+
if ( $wp_recaptcha->get_option('recaptcha_flavor') == 'grecaptcha' ) {
|
50 |
+
|
51 |
+
if ( $enable_topic ) {
|
52 |
+
add_action( 'bbp_theme_before_topic_form_submit_wrapper' , array( $wp_recaptcha, 'print_recaptcha_html' ) );
|
53 |
+
add_action( 'bbp_new_topic_pre_extras', array( &$this , 'recaptcha_check' ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( $enable_reply ) {
|
57 |
+
add_action( 'bbp_theme_before_reply_form_submit_wrapper', array( $wp_recaptcha, 'print_recaptcha_html' ) );
|
58 |
+
add_filter( 'bbp_new_reply_pre_extras', array( &$this , 'recaptcha_check' ) );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* bbP recaptcha Check
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
function recaptcha_check() {
|
70 |
+
if ( ! WP_reCaptcha::instance()->recaptcha_check() ) {
|
71 |
+
bbp_add_error( 'bbp-recaptcha-error', __('<strong>Error:</strong> the Captcha didn’t verify.', 'wp-recaptcha-integration'), 'error' );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
}
|
inc/class-wp_recaptcha_captcha.php
CHANGED
@@ -92,6 +92,3 @@ abstract class WP_reCaptcha_Captcha {
|
|
92 |
|
93 |
}
|
94 |
|
95 |
-
|
96 |
-
WP_reCaptcha_Options::instance();
|
97 |
-
|
92 |
|
93 |
}
|
94 |
|
|
|
|
|
|
inc/class-wp_recaptcha_contactform7.php
CHANGED
@@ -92,59 +92,122 @@ class WP_reCaptcha_ContactForm7 {
|
|
92 |
|
93 |
|
94 |
|
95 |
-
function recaptcha_settings_callback( $contact_form ) {
|
|
|
96 |
$type = 'recaptcha';
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
<
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
$(this).next('[name="message"]').val( $(this).val() ).trigger('change');
|
126 |
-
});
|
127 |
-
|
128 |
-
})(jQuery)
|
129 |
-
</script><?php
|
130 |
-
}
|
131 |
-
?></td></tr>
|
132 |
-
</table>
|
133 |
-
<div class="tg-tag">
|
134 |
-
<?php echo esc_html( __( "Copy this code and paste it into the form left.", 'contact-form-7' ) ); ?><br />
|
135 |
-
<input type="text" name="<?php echo $type; ?>" class="tag wp-ui-text-highlight code" readonly="readonly" onfocus="this.select()" />
|
136 |
</div>
|
137 |
-
</form>
|
138 |
-
</div>
|
139 |
-
<?php
|
140 |
-
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
function recaptcha_validation_filter( $result, $tag ) {
|
145 |
if ( ! WP_reCaptcha::instance()->is_required() )
|
146 |
return $result;
|
147 |
-
|
148 |
$tag = new WPCF7_Shortcode( $tag );
|
149 |
$name = $tag->name;
|
150 |
|
@@ -159,6 +222,7 @@ class WP_reCaptcha_ContactForm7 {
|
|
159 |
$result['valid'] = false;
|
160 |
$result['reason'][$name] = $message;
|
161 |
}
|
|
|
162 |
}
|
163 |
return $result;
|
164 |
}
|
92 |
|
93 |
|
94 |
|
95 |
+
function recaptcha_settings_callback( $contact_form , $args = '' ) {
|
96 |
+
$args = wp_parse_args( $args, array() );
|
97 |
$type = 'recaptcha';
|
98 |
+
if ( defined( 'WPCF7_VERSION') && version_compare( WPCF7_VERSION , '4.2' ) >= 0 ) {
|
99 |
+
?>
|
100 |
+
<div class="control-box">
|
101 |
+
<fieldset>
|
102 |
+
<legend><?php _e( 'reCAPTCHA', 'wp-recaptcha-integration' ) ?></legend>
|
103 |
+
|
104 |
+
<table class="form-table">
|
105 |
+
<tbody>
|
106 |
+
|
107 |
+
<tr>
|
108 |
+
<th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
|
109 |
+
<td>
|
110 |
+
<fieldset>
|
111 |
+
<legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
|
112 |
+
<label><input type="checkbox" checked="checked" disabled="disabled" name="required" onclick="return false" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
|
113 |
+
</fieldset>
|
114 |
+
</td>
|
115 |
+
</tr>
|
116 |
+
|
117 |
+
<tr>
|
118 |
+
<th scope="row"><?php esc_html_e( __( 'Name', 'contact-form-7' ) ); ?></th>
|
119 |
+
<td>
|
120 |
+
<fieldset>
|
121 |
+
<legend class="screen-reader-text"><?php esc_html_e( __( 'Name', 'contact-form-7' ) ); ?></legend>
|
122 |
+
<label><input type="text" name="name" class="tg-name oneline" /></label>
|
123 |
+
</fieldset>
|
124 |
+
</td>
|
125 |
+
</tr><?php
|
126 |
+
|
127 |
+
if ( 'grecaptcha' === WP_reCaptcha::instance()->get_option('recaptcha_flavor') ) {
|
128 |
+
?><tr>
|
129 |
+
<th scope="row"><?php esc_html_e( __( 'Theme', 'wp-recaptcha-integration' ) ); ?></th>
|
130 |
+
<td>
|
131 |
+
<fieldset>
|
132 |
+
<legend class="screen-reader-text"><?php esc_html_e( __( 'Theme', 'wp-recaptcha-integration' ) ); ?></legend>
|
133 |
+
<label><?php
|
134 |
+
$this->_theme_select();
|
135 |
+
?></label>
|
136 |
+
</fieldset>
|
137 |
+
</td>
|
138 |
+
</tr><?php
|
139 |
}
|
140 |
+
?></tbody>
|
141 |
+
</table>
|
142 |
+
</fieldset>
|
143 |
+
</div>
|
144 |
+
<div class="insert-box">
|
145 |
+
<input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
|
146 |
+
|
147 |
+
<div class="submitbox">
|
148 |
+
<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
</div>
|
|
|
|
|
|
|
|
|
150 |
|
151 |
+
<br class="clear" />
|
152 |
+
|
153 |
+
<p class="description recaptcha-tag">
|
154 |
+
<label for="<?php echo esc_attr( $args['content'] . '-recaptchatag' ); ?>">
|
155 |
+
<?php /* esc_html_e( __( "Foobar", 'contact-form-7' ), '<strong><span class="recaptcha-tag"></span></strong>' );*/ ?>
|
156 |
+
<input type="text" class="recaptcha-tag code hidden" readonly="readonly" id="<?php echo esc_attr( $args['content'] . '-recaptchatag' ); ?>" />
|
157 |
+
</label>
|
158 |
+
</p>
|
159 |
+
</div>
|
160 |
+
<?php
|
161 |
+
} else {
|
162 |
+
?>
|
163 |
+
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="_hidden">
|
164 |
+
<form action="">
|
165 |
+
<table>
|
166 |
+
<tr><td><input type="checkbox" checked="checked" disabled="disabled" name="required" onclick="return false" /> <?php echo esc_html( __( 'Required field?', 'contact-form-7' ) ); ?></td></tr>
|
167 |
+
<tr><td>
|
168 |
+
<?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?><br />
|
169 |
+
<input type="text" name="name" class="tg-name oneline" />
|
170 |
+
</td><td><?php
|
171 |
+
if ( 'grecaptcha' === WP_reCaptcha::instance()->get_option('recaptcha_flavor') ) {
|
172 |
+
|
173 |
+
esc_html_e( __( 'Theme', 'wp-recaptcha-integration' ) ); ?><br /><?php
|
174 |
+
$this->_theme_select();
|
175 |
+
// cf7 does only allow literal <input>
|
176 |
+
}
|
177 |
+
?></td></tr>
|
178 |
+
</table>
|
179 |
+
<div class="tg-tag">
|
180 |
+
<?php echo esc_html( __( "Copy this code and paste it into the form left.", 'contact-form-7' ) ); ?><br />
|
181 |
+
<input type="text" name="<?php echo $type; ?>" class="tag wp-ui-text-highlight code" readonly="readonly" onfocus="this.select()" />
|
182 |
+
</div>
|
183 |
+
</form>
|
184 |
+
</div>
|
185 |
+
<?php
|
186 |
+
}
|
187 |
+
?><script type="text/javascript">
|
188 |
+
(function($){
|
189 |
+
$(document).on('change','[name="recaptcha-theme-ui"]',function(){
|
190 |
+
$(this).next('[name="theme"]').val( $(this).val() ).trigger('change');
|
191 |
+
});
|
192 |
+
})(jQuery)
|
193 |
+
</script><?php
|
194 |
+
}
|
195 |
|
196 |
+
private function _theme_select() {
|
197 |
+
$themes = WP_reCaptcha::instance()->captcha_instance()->get_supported_themes();
|
198 |
+
?><select name="recaptcha-theme-ui"><?php
|
199 |
+
?><option value=""><?php _e('Use default','wp-recaptcha-integration') ?></option><?php
|
200 |
+
foreach ( $themes as $theme_name => $theme ) {
|
201 |
+
?><option value="<?php echo $theme_name; ?>"><?php echo $theme['label'] ?></option><?php
|
202 |
+
}
|
203 |
+
?></select><?php
|
204 |
+
?><input type="hidden" name="theme" class="idvalue option" value="" /><?php
|
205 |
+
}
|
206 |
|
207 |
function recaptcha_validation_filter( $result, $tag ) {
|
208 |
if ( ! WP_reCaptcha::instance()->is_required() )
|
209 |
return $result;
|
210 |
+
|
211 |
$tag = new WPCF7_Shortcode( $tag );
|
212 |
$name = $tag->name;
|
213 |
|
222 |
$result['valid'] = false;
|
223 |
$result['reason'][$name] = $message;
|
224 |
}
|
225 |
+
// var_dump(WP_reCaptcha::instance()->captcha_instance()->get_last_result());
|
226 |
}
|
227 |
return $result;
|
228 |
}
|
inc/class-wp_recaptcha_ninjaforms.php
CHANGED
@@ -73,7 +73,7 @@ class WP_reCaptcha_NinjaForms {
|
|
73 |
'limit' => 1,
|
74 |
'edit_options' => array(
|
75 |
),
|
76 |
-
'req' =>
|
77 |
);
|
78 |
if ( 'grecaptcha' === WP_reCaptcha::instance()->get_option('recaptcha_flavor') ) {
|
79 |
$themes = WP_reCaptcha::instance()->captcha_instance()->get_supported_themes();
|
73 |
'limit' => 1,
|
74 |
'edit_options' => array(
|
75 |
),
|
76 |
+
'req' => false,
|
77 |
);
|
78 |
if ( 'grecaptcha' === WP_reCaptcha::instance()->get_option('recaptcha_flavor') ) {
|
79 |
$themes = WP_reCaptcha::instance()->captcha_instance()->get_supported_themes();
|
inc/class-wp_recaptcha_nocaptcha.php
CHANGED
@@ -215,28 +215,29 @@ class WP_reCaptcha_NoCaptcha extends WP_reCaptcha_Captcha {
|
|
215 |
$return = "<div {$attr_str}></div>";
|
216 |
$return .= '<noscript>';
|
217 |
if ( WP_reCaptcha::instance()->get_option('recaptcha_noscript') ) {
|
218 |
-
$return .= '<div style="width: 302px; height:
|
219 |
-
'<div style="width: 302px; height:
|
220 |
-
'<div style="width: 302px; height:
|
221 |
'<iframe src="https://www.google.com/recaptcha/api/fallback?k='.$attr['data-sitekey'].'"' .
|
222 |
' frameborder="0" scrolling="no"' .
|
223 |
-
' style="width: 302px; height:
|
224 |
'</iframe>' .
|
225 |
'</div>' .
|
226 |
-
'<div style="width: 250px; height: 80px; position: absolute; border-style: none;' .
|
227 |
-
' bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">' .
|
228 |
-
'<textarea id="g-recaptcha-response" name="g-recaptcha-response"' .
|
229 |
-
' class="g-recaptcha-response"' .
|
230 |
-
' style="width: 250px; height: 80px; border: 1px solid #c1c1c1;' .
|
231 |
-
' margin: 0px; padding: 0px; resize: none;" value="">' .
|
232 |
-
'</textarea>' .
|
233 |
-
'</div>' .
|
234 |
'</div>' .
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
} else {
|
237 |
$return .= __('Please enable JavaScript to submit this form.','wp-recaptcha-integration');
|
238 |
}
|
239 |
-
$return .= '
|
240 |
return $return;
|
241 |
}
|
242 |
/**
|
@@ -254,7 +255,7 @@ class WP_reCaptcha_NoCaptcha extends WP_reCaptcha_Captcha {
|
|
254 |
$response_data = wp_remote_retrieve_body( $response );
|
255 |
$this->_last_result = json_decode($response_data);
|
256 |
} else {
|
257 |
-
$this->_last_result = (object) array( 'success' => false );
|
258 |
}
|
259 |
}
|
260 |
do_action( 'wp_recaptcha_checked' , $this->_last_result->success );
|
@@ -265,7 +266,3 @@ class WP_reCaptcha_NoCaptcha extends WP_reCaptcha_Captcha {
|
|
265 |
|
266 |
|
267 |
}
|
268 |
-
|
269 |
-
|
270 |
-
WP_reCaptcha_Options::instance();
|
271 |
-
|
215 |
$return = "<div {$attr_str}></div>";
|
216 |
$return .= '<noscript>';
|
217 |
if ( WP_reCaptcha::instance()->get_option('recaptcha_noscript') ) {
|
218 |
+
$return .= '<div style="width: 302px; height: 462px;">' .
|
219 |
+
'<div style="width: 302px; height: 422px; position: relative;">' .
|
220 |
+
'<div style="width: 302px; height: 422px; position: absolute;">' .
|
221 |
'<iframe src="https://www.google.com/recaptcha/api/fallback?k='.$attr['data-sitekey'].'"' .
|
222 |
' frameborder="0" scrolling="no"' .
|
223 |
+
' style="width: 302px; height:422px; border-style: none;">' .
|
224 |
'</iframe>' .
|
225 |
'</div>' .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
'</div>' .
|
227 |
+
'<div style="width: 300px; height: 60px; border-style: none;' .
|
228 |
+
' bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px;' .
|
229 |
+
' background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;">' .
|
230 |
+
'<textarea id="g-recaptcha-response" name="g-recaptcha-response"' .
|
231 |
+
' class="g-recaptcha-response"' .
|
232 |
+
' style="width: 250px; height: 40px; border: 1px solid #c1c1c1;' .
|
233 |
+
' margin: 10px 25px; padding: 0px; resize: none;" value="">' .
|
234 |
+
'</textarea>' .
|
235 |
+
'</div>' .
|
236 |
+
'</div><br>';
|
237 |
} else {
|
238 |
$return .= __('Please enable JavaScript to submit this form.','wp-recaptcha-integration');
|
239 |
}
|
240 |
+
$return .= '<br></noscript>';
|
241 |
return $return;
|
242 |
}
|
243 |
/**
|
255 |
$response_data = wp_remote_retrieve_body( $response );
|
256 |
$this->_last_result = json_decode($response_data);
|
257 |
} else {
|
258 |
+
$this->_last_result = (object) array( 'success' => false , 'wp_error' => $response );
|
259 |
}
|
260 |
}
|
261 |
do_action( 'wp_recaptcha_checked' , $this->_last_result->success );
|
266 |
|
267 |
|
268 |
}
|
|
|
|
|
|
|
|
inc/class-wp_recaptcha_options.php
CHANGED
@@ -26,7 +26,7 @@ class WP_reCaptcha_Options {
|
|
26 |
*/
|
27 |
private function __clone() {
|
28 |
}
|
29 |
-
|
30 |
/**
|
31 |
* Prevent from creating more than one instance
|
32 |
*/
|
@@ -40,14 +40,14 @@ class WP_reCaptcha_Options {
|
|
40 |
add_action( "load-{$page_hook}", array( &$this , 'process_network_settings' ));
|
41 |
add_action( 'network_admin_menu', array( &$this , 'network_settings_menu' ));
|
42 |
}
|
43 |
-
|
44 |
add_action( 'pre_update_option_recaptcha_publickey' , array( &$this , 'update_option_recaptcha_apikey' ) , 10 , 2 );
|
45 |
add_action( 'pre_update_option_recaptcha_privatekey' , array( &$this , 'update_option_recaptcha_apikey' ) , 10 , 2 );
|
46 |
add_action( 'add_option_recaptcha_publickey' , array( &$this , 'add_option_recaptcha_apikey' ) , 10 , 2 );
|
47 |
add_action( 'add_option_recaptcha_privatekey' , array( &$this , 'add_option_recaptcha_apikey' ) , 10 , 2 );
|
48 |
}
|
49 |
-
|
50 |
-
|
51 |
/**
|
52 |
* Process network options
|
53 |
*/
|
@@ -85,21 +85,21 @@ class WP_reCaptcha_Options {
|
|
85 |
} else {
|
86 |
wp_die('Cheating, uh?');
|
87 |
}
|
88 |
-
// expecting api keys,
|
89 |
}
|
90 |
-
|
91 |
/**
|
92 |
* Network menu hook
|
93 |
*/
|
94 |
function network_settings_menu(){
|
95 |
-
add_submenu_page(
|
96 |
'settings.php',
|
97 |
-
__( 'reCaptcha Settings' , 'wp-recaptcha-integration' ),
|
98 |
-
__( 'reCaptcha' , 'wp-recaptcha-integration' ),
|
99 |
-
'manage_network', 'racaptcha-settings',
|
100 |
array(&$this , 'network_settings_page' ) );
|
101 |
}
|
102 |
-
|
103 |
/**
|
104 |
* Network Settings page
|
105 |
*/
|
@@ -114,7 +114,7 @@ class WP_reCaptcha_Options {
|
|
114 |
?></form><?php
|
115 |
?></div><?php
|
116 |
}
|
117 |
-
|
118 |
|
119 |
|
120 |
/**
|
@@ -139,7 +139,7 @@ class WP_reCaptcha_Options {
|
|
139 |
if ( in_array( $option , array('recaptcha_publickey','recaptcha_privatekey') ) )
|
140 |
add_filter( 'wp_redirect' , array( &$this , 'remove_new_apikey_url' ) );
|
141 |
}
|
142 |
-
|
143 |
/**
|
144 |
* Removes Update api key url params
|
145 |
* @param url URL
|
@@ -148,13 +148,13 @@ class WP_reCaptcha_Options {
|
|
148 |
function remove_new_apikey_url( $url = null ) {
|
149 |
return remove_query_arg( array('_wpnonce' , 'recaptcha-action' , 'settings-updated' ) , $url );
|
150 |
}
|
151 |
-
|
152 |
/**
|
153 |
* Admin Notices hook to show up when the api keys heve not been entered.
|
154 |
*/
|
155 |
function api_key_notice() {
|
156 |
-
?><div class="notice error above-h1"><p><?php
|
157 |
-
printf(
|
158 |
__( '<strong>reCaptcha needs your attention:</strong> To make it work You need to enter an api key. <br />You can do so at the <a href="%s">reCaptcha settings page</a>.' , 'wp-recaptcha-integration' ),
|
159 |
admin_url( add_query_arg( 'page' , 'recaptcha' , 'options-general.php' ) )
|
160 |
);
|
@@ -171,7 +171,7 @@ class WP_reCaptcha_Options {
|
|
171 |
}
|
172 |
|
173 |
$this->enter_api_key = ! $has_api_key || ( isset($_REQUEST['recaptcha-action']) && $_REQUEST['recaptcha-action'] == 'recaptcha-set-api-key');
|
174 |
-
|
175 |
if ( ! $this->enter_api_key ) {
|
176 |
add_settings_section( 'recaptcha_protection' , __( 'Protect' , 'wp-recaptcha-integration' ), array( &$this , 'explain_protection' ), 'recaptcha');
|
177 |
add_settings_section( 'recaptcha_styling' , __( 'Style' , 'wp-recaptcha-integration' ), array( &$this , 'explain_styling' ), 'recaptcha');
|
@@ -205,11 +205,11 @@ class WP_reCaptcha_Options {
|
|
205 |
register_setting( 'recaptcha_options', 'recaptcha_disable_submit' , 'intval');
|
206 |
|
207 |
register_setting( 'recaptcha_options', 'recaptcha_noscript' , 'intval');
|
208 |
-
|
209 |
|
210 |
-
|
|
|
211 |
array(&$this,'input_radio'), 'recaptcha', 'recaptcha_styling',
|
212 |
-
array(
|
213 |
'name' => 'recaptcha_flavor',
|
214 |
'items' => array(
|
215 |
array(
|
@@ -222,40 +222,40 @@ class WP_reCaptcha_Options {
|
|
222 |
),
|
223 |
),
|
224 |
) );
|
225 |
-
|
226 |
add_settings_field('recaptcha_language', __( 'Language Settings' ), array(&$this,'select_language'), 'recaptcha', 'recaptcha_styling');
|
227 |
-
|
228 |
add_settings_field('recaptcha_theme', __('Theme','wp-recaptcha-integration'), array(&$this,'select_theme'), 'recaptcha', 'recaptcha_styling');
|
229 |
|
230 |
-
add_settings_field('recaptcha_disable_submit', __('Disable Submit Button','wp-recaptcha-integration'),
|
231 |
-
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_styling' ,
|
232 |
-
array('name'=>'recaptcha_disable_submit','label'=>__( 'Disable Form Submit Button until no-captcha is entered.' ,'wp-recaptcha-integration' ) )
|
233 |
);
|
234 |
-
add_settings_field('recaptcha_noscript', __('Noscript Fallback','wp-recaptcha-integration'),
|
235 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_advanced' ,
|
236 |
-
array(
|
237 |
'name'=>'recaptcha_noscript',
|
238 |
'label'=>__( 'Provide a fallback for non javascript capable browsers.','wp-recaptcha-integration' ),
|
239 |
'description' => __( 'Leave this unchecked when your site requires JavaScript anyway.','wp-recaptcha-integration' ),
|
240 |
'class' => 'flavor-grecaptcha',
|
241 |
-
)
|
242 |
);
|
243 |
|
244 |
global $wp_version;
|
245 |
if ( version_compare( $wp_version , '4.2' ) >= 0 ) {
|
246 |
register_setting( 'recaptcha_options', 'recaptcha_comment_use_42_filter' , 'intval');
|
247 |
-
add_settings_field('recaptcha_comment_use_42_filter', __('Comment Form rendering','wp-recaptcha-integration'),
|
248 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_advanced' ,
|
249 |
-
array(
|
250 |
'name'=>'recaptcha_comment_use_42_filter',
|
251 |
'label'=>__( 'My Comment Form is WordPress 4.2 compatible.','wp-recaptcha-integration' ),
|
252 |
'description' => __( 'Enable this when your comment form uses the <code>comment_form_submit_button</code> filter. (Or just try if it works.)','wp-recaptcha-integration' ),
|
253 |
'class' => 'flavor-grecaptcha',
|
254 |
-
)
|
255 |
);
|
256 |
}
|
257 |
}
|
258 |
-
|
259 |
if ( ! WP_reCaptcha::is_network_activated() || is_network_admin() ) {
|
260 |
// network options
|
261 |
register_setting( 'recaptcha_options', 'recaptcha_enable_comments' , 'intval');
|
@@ -264,11 +264,19 @@ class WP_reCaptcha_Options {
|
|
264 |
register_setting( 'recaptcha_options', 'recaptcha_enable_lostpw' , 'intval');
|
265 |
register_setting( 'recaptcha_options', 'recaptcha_lockout' , 'intval');
|
266 |
|
267 |
-
if ( function_exists('WC') )
|
268 |
register_setting( 'recaptcha_options', 'recaptcha_enable_wc_order' , 'intval');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
register_setting( 'recaptcha_options', 'recaptcha_disable_for_known_users' , 'intval');
|
271 |
-
|
272 |
$protect_settings = array();
|
273 |
$protect_settings[] = array(
|
274 |
'name' => 'recaptcha_enable_comments',
|
@@ -290,6 +298,7 @@ class WP_reCaptcha_Options {
|
|
290 |
'label' => __('Lost Password Form','wp-recaptcha-integration'),
|
291 |
'class' => '',
|
292 |
);
|
|
|
293 |
if ( function_exists('WC') ) {
|
294 |
$wc_warn = WP_reCaptcha::instance()->get_option('recaptcha_enable_wc_order') && WP_reCaptcha::instance()->get_option('recaptcha_flavor') !== 'grecaptcha';
|
295 |
$protect_settings[] = array(
|
@@ -298,22 +307,47 @@ class WP_reCaptcha_Options {
|
|
298 |
'class' => 'flavor-grecaptcha',
|
299 |
);
|
300 |
}
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
array(&$this,'input_protect'), 'recaptcha', 'recaptcha_protection' ,
|
303 |
-
$protect_settings
|
304 |
);
|
305 |
-
|
306 |
-
add_settings_field('recaptcha_disable_for_known_users', __('Disable for known users','wp-recaptcha-integration'),
|
307 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_protection' ,
|
308 |
-
array('name'=>'recaptcha_disable_for_known_users','label'=>__( 'Disable reCaptcha verification for logged in users.','wp-recaptcha-integration' ))
|
309 |
);
|
310 |
-
|
|
|
311 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_protection' ,
|
312 |
-
array(
|
313 |
'name'=>'recaptcha_lockout',
|
314 |
'label'=>__( 'Allow administrator to log in if API keys do not work.','wp-recaptcha-integration' ),
|
315 |
'description' => __( 'When the captcha verification fails, and the private or public API key does not work the plugin will let you in anyway. Please note that with this option checked plus a broken keypair your site will be open to brute force attacks, that try to guess an administrator password.','wp-recaptcha-integration' ),
|
316 |
-
)
|
317 |
);
|
318 |
}
|
319 |
|
@@ -321,52 +355,52 @@ class WP_reCaptcha_Options {
|
|
321 |
add_settings_error('recaptcha',1,__('Please configure the public and private key. <a href="http://www.google.com/recaptcha/whyrecaptcha">What are you trying to tell me?</a>','wp-recaptcha-integration'),'updated');
|
322 |
}
|
323 |
}
|
324 |
-
|
325 |
/**
|
326 |
* Intro text for the api key setting
|
327 |
*/
|
328 |
public function explain_apikey( ) {
|
329 |
if ( $this->enter_api_key ) {
|
330 |
-
?><p class="description"><?php
|
331 |
$info_url = 'https://developers.google.com/recaptcha/intro';
|
332 |
$admin_url = 'https://www.google.com/recaptcha/admin';
|
333 |
printf(
|
334 |
__( 'Please register your blog through the <a href="%s">Google reCAPTCHA admin page</a> and enter the public and private key in the fields below. <a href="%s">What is this all about?</a>', 'wp-recaptcha-integration' ) ,
|
335 |
-
$admin_url , $info_url
|
336 |
);
|
337 |
?></p><?php
|
338 |
?><input type="hidden" name="recaptcha-action" value="recaptcha-set-api-key" /><?php
|
339 |
} else {
|
340 |
?><div class="recaptcha-explain"><?php
|
341 |
-
?><p class="description"><?php
|
342 |
_e( 'You already entered an API Key. Use the button below to enter it again.','wp-recaptcha-integration');
|
343 |
?></p><?php
|
344 |
$action = 'recaptcha-set-api-key';
|
345 |
$nonce = wp_create_nonce( $action );
|
346 |
$new_url = add_query_arg( array('_wpnonce' => $nonce , 'recaptcha-action' => $action ) );
|
347 |
-
|
348 |
$action = 'recaptcha-test-api-key';
|
349 |
$nonce = wp_create_nonce( $action );
|
350 |
$test_url = add_query_arg( array('_wpnonce' => $nonce , 'action' => $action ) , admin_url( 'admin-ajax.php' ) );
|
351 |
-
|
352 |
$action = 'recaptcha-init-test-api-key';
|
353 |
$nonce = wp_create_nonce( $action );
|
354 |
$init_test_url = add_query_arg( array('_wpnonce' => $nonce , 'action' => $action ) , admin_url( 'admin-ajax.php' ) );
|
355 |
-
|
356 |
-
?><p class="submit"><?php
|
357 |
?><a class="button" href="<?php echo $new_url ?>"><?php _e('New API Key' , 'wp-recaptcha-integration') ?></a><?php
|
358 |
?><a id="test-api-key" class="button" data-init-href="<?php echo $init_test_url ?>" href="<?php echo $test_url ?>"><?php _e('Test API Key' , 'wp-recaptcha-integration') ?></a><?php
|
359 |
?></p><?php
|
360 |
?></div><?php
|
361 |
}
|
362 |
}
|
363 |
-
|
364 |
/**
|
365 |
* Intro text for the Protection setting
|
366 |
*/
|
367 |
public function explain_protection() {
|
368 |
?><div class="recaptcha-explain"><?php
|
369 |
-
?><p class="description"><?php
|
370 |
_e( 'Select which forms you want to protect with a captcha.' , 'wp-recaptcha-integration' );
|
371 |
?></p><?php
|
372 |
?></div><?php
|
@@ -383,13 +417,13 @@ class WP_reCaptcha_Options {
|
|
383 |
*/
|
384 |
public function explain_styling() {
|
385 |
?><div class="recaptcha-explain"><?php
|
386 |
-
?><p class="description"><?php
|
387 |
_e( 'Choose a flavor and theme for your Captcha. Please note that with the old style reCaptcha you cannot have more than one captcha per page.' , 'wp-recaptcha-integration' );
|
388 |
?></p><?php
|
389 |
?></div><?php
|
390 |
}
|
391 |
-
|
392 |
-
|
393 |
/**
|
394 |
* Test api key ajax response.
|
395 |
* Returns reCaptcha HTML
|
@@ -446,7 +480,7 @@ class WP_reCaptcha_Options {
|
|
446 |
}
|
447 |
exit(0);
|
448 |
}
|
449 |
-
|
450 |
/**
|
451 |
* Link for canceling api key entering
|
452 |
* checks the verification process and shows an error on fail.
|
@@ -455,7 +489,7 @@ class WP_reCaptcha_Options {
|
|
455 |
$url = $this->remove_new_apikey_url( add_query_arg(null,null) );
|
456 |
?><a class="button" href="<?php echo $url ?>"><?php _e( 'Cancel' ) ?></a><?php
|
457 |
}
|
458 |
-
|
459 |
/**
|
460 |
* Radio buttons
|
461 |
*
|
@@ -482,7 +516,7 @@ class WP_reCaptcha_Options {
|
|
482 |
?></label><br /><?php
|
483 |
}
|
484 |
}
|
485 |
-
|
486 |
/**
|
487 |
* A Checkbox
|
488 |
*
|
@@ -511,7 +545,7 @@ class WP_reCaptcha_Options {
|
|
511 |
}
|
512 |
?></label><?php
|
513 |
}
|
514 |
-
|
515 |
/**
|
516 |
* On/off switch. Basically A Checkbox
|
517 |
*
|
@@ -540,14 +574,14 @@ class WP_reCaptcha_Options {
|
|
540 |
?></label><?php
|
541 |
?></div><?php
|
542 |
}
|
543 |
-
|
544 |
public function input_protect( $switches ) {
|
545 |
-
foreach ( $switches as $switch )
|
546 |
$this->input_check_onoff( $switch );
|
547 |
}
|
548 |
-
|
549 |
/**
|
550 |
-
* A Text field.
|
551 |
* Used for api key input.
|
552 |
*
|
553 |
* @param args array(
|
@@ -570,7 +604,7 @@ class WP_reCaptcha_Options {
|
|
570 |
'recaptcha' => WP_reCaptcha_ReCaptcha::instance()->get_supported_languages(),
|
571 |
'grecaptcha' => WP_reCaptcha_NoCaptcha::instance()->get_supported_languages(),
|
572 |
);
|
573 |
-
|
574 |
?><div class="recaptcha-select-language flavor-<?php echo $option_flavor ?>"><?php
|
575 |
foreach( $all_available_langs as $flavor => $available_langs ) {
|
576 |
?><select class="flavor-<?php echo $flavor ?>" name="<?php echo $option_name ?>[<?php echo $flavor ?>]"><?php
|
@@ -590,26 +624,26 @@ class WP_reCaptcha_Options {
|
|
590 |
*/
|
591 |
public function select_theme() {
|
592 |
$option_name = 'recaptcha_theme';
|
593 |
-
|
594 |
$grecaptcha_themes = WP_reCaptcha_NoCaptcha::instance()->get_supported_themes();
|
595 |
$grecaptcha_themes = array_map( array( $this , '_map_grecaptcha' ) , $grecaptcha_themes );
|
596 |
-
|
597 |
$recaptcha_themes = WP_reCaptcha_ReCaptcha::instance()->get_supported_themes();
|
598 |
$recaptcha_themes = array_map( array( $this , '_map_recaptcha' ) , $recaptcha_themes );
|
599 |
-
|
600 |
$themes = $grecaptcha_themes + $recaptcha_themes;
|
601 |
|
602 |
$option_theme = WP_reCaptcha::instance()->get_option($option_name);
|
603 |
$option_flavor = WP_reCaptcha::instance()->get_option( 'recaptcha_flavor' );
|
604 |
-
|
605 |
?><div class="recaptcha-select-theme"><?php
|
606 |
-
|
607 |
foreach ( $themes as $value => $theme ) {
|
608 |
extract( $theme ); // label, flavor
|
609 |
?><div class="theme-item flavor-<?php echo $flavor ?>"><?php
|
610 |
?><input <?php checked($value,$option_theme,true); ?> id="<?php echo "$option_name-$value" ?>" type="radio" name="<?php echo $option_name ?>" value="<?php echo $value ?>" /><?php
|
611 |
?><label for="<?php echo "$option_name-$value" ?>"><?php
|
612 |
-
?><span class="title"><?php
|
613 |
echo $label;
|
614 |
?></span><?php
|
615 |
if ( $value == 'custom' ) {
|
@@ -622,27 +656,27 @@ class WP_reCaptcha_Options {
|
|
622 |
}
|
623 |
?></label><?php
|
624 |
?></div><?php
|
625 |
-
|
626 |
}
|
627 |
?></div><?php
|
628 |
?></div><?php
|
629 |
}
|
630 |
-
|
631 |
/**
|
632 |
* @usage select_theme()
|
633 |
*/
|
634 |
private function _map_grecaptcha( $val ) {
|
635 |
-
$val['flavor'] = 'grecaptcha';
|
636 |
return $val;
|
637 |
}
|
638 |
/**
|
639 |
* @usage select_theme()
|
640 |
*/
|
641 |
private function _map_recaptcha( $val ) {
|
642 |
-
$val['flavor'] = 'recaptcha';
|
643 |
return $val;
|
644 |
}
|
645 |
-
|
646 |
/**
|
647 |
* Check if language is supported by current recaptcha flavor
|
648 |
*/
|
@@ -651,7 +685,7 @@ class WP_reCaptcha_Options {
|
|
651 |
|
652 |
if ( isset( $language[$flavor] ) )
|
653 |
$language = $language[$flavor];
|
654 |
-
|
655 |
if ( $language != 'WPLANG' )
|
656 |
$language = WP_reCaptcha::instance()->captcha_instance_by_flavor( $flavor )->get_language( $language );
|
657 |
return $language;
|
@@ -665,14 +699,14 @@ class WP_reCaptcha_Options {
|
|
665 |
'grecaptcha' => array( 'light','dark' ),
|
666 |
);
|
667 |
$flavor = WP_reCaptcha::instance()->get_option('recaptcha_flavor');
|
668 |
-
|
669 |
if ( isset($themes_available[$flavor] ) && in_array($theme,$themes_available[$flavor]) )
|
670 |
return $theme;
|
671 |
else if ( isset($themes_available[$flavor] ) )
|
672 |
return $themes_available[$flavor][0];
|
673 |
return 'light';
|
674 |
}
|
675 |
-
|
676 |
/**
|
677 |
* Check valid flavor
|
678 |
*/
|
@@ -686,12 +720,12 @@ class WP_reCaptcha_Options {
|
|
686 |
* Admin menu hook, adds blogs local options page
|
687 |
*/
|
688 |
public function add_options_page() {
|
689 |
-
$page_slug = add_options_page(
|
690 |
-
__('ReCaptcha','wp-recaptcha-integration'), __('ReCaptcha','wp-recaptcha-integration'),
|
691 |
-
'manage_options', 'recaptcha',
|
692 |
array(&$this,'render_options_page')
|
693 |
);
|
694 |
-
|
695 |
add_action( "load-$page_slug" , array( &$this , 'enqueue_styles' ) );
|
696 |
}
|
697 |
|
@@ -709,20 +743,20 @@ class WP_reCaptcha_Options {
|
|
709 |
public function render_options_page() {
|
710 |
$option_flavor = WP_reCaptcha::instance()->get_option( 'recaptcha_flavor' );
|
711 |
?><div class="wrap flavor-<?php echo $option_flavor ?>"><?php
|
712 |
-
?><h2><?php /*icon*/
|
713 |
_e('Settings');
|
714 |
-
echo ' › ';
|
715 |
-
_e( 'ReCaptcha' , 'wp-recaptcha-integration' );
|
716 |
?></h2><?php
|
717 |
/* ?><p><?php _e( '...' , 'googlefont' ); ?></p><?php */
|
718 |
?><form action="options.php" method="post"><?php
|
719 |
settings_fields( 'recaptcha_options' );
|
720 |
-
do_settings_sections( 'recaptcha' );
|
721 |
submit_button( null , 'primary' , null, null, array('autocomplete'=>'off'));
|
722 |
?></form><?php
|
723 |
?></div><?php
|
724 |
}
|
725 |
-
|
726 |
}
|
727 |
|
728 |
|
26 |
*/
|
27 |
private function __clone() {
|
28 |
}
|
29 |
+
|
30 |
/**
|
31 |
* Prevent from creating more than one instance
|
32 |
*/
|
40 |
add_action( "load-{$page_hook}", array( &$this , 'process_network_settings' ));
|
41 |
add_action( 'network_admin_menu', array( &$this , 'network_settings_menu' ));
|
42 |
}
|
43 |
+
|
44 |
add_action( 'pre_update_option_recaptcha_publickey' , array( &$this , 'update_option_recaptcha_apikey' ) , 10 , 2 );
|
45 |
add_action( 'pre_update_option_recaptcha_privatekey' , array( &$this , 'update_option_recaptcha_apikey' ) , 10 , 2 );
|
46 |
add_action( 'add_option_recaptcha_publickey' , array( &$this , 'add_option_recaptcha_apikey' ) , 10 , 2 );
|
47 |
add_action( 'add_option_recaptcha_privatekey' , array( &$this , 'add_option_recaptcha_apikey' ) , 10 , 2 );
|
48 |
}
|
49 |
+
|
50 |
+
|
51 |
/**
|
52 |
* Process network options
|
53 |
*/
|
85 |
} else {
|
86 |
wp_die('Cheating, uh?');
|
87 |
}
|
88 |
+
// expecting api keys,
|
89 |
}
|
90 |
+
|
91 |
/**
|
92 |
* Network menu hook
|
93 |
*/
|
94 |
function network_settings_menu(){
|
95 |
+
add_submenu_page(
|
96 |
'settings.php',
|
97 |
+
__( 'reCaptcha Settings' , 'wp-recaptcha-integration' ),
|
98 |
+
__( 'reCaptcha' , 'wp-recaptcha-integration' ),
|
99 |
+
'manage_network', 'racaptcha-settings',
|
100 |
array(&$this , 'network_settings_page' ) );
|
101 |
}
|
102 |
+
|
103 |
/**
|
104 |
* Network Settings page
|
105 |
*/
|
114 |
?></form><?php
|
115 |
?></div><?php
|
116 |
}
|
117 |
+
|
118 |
|
119 |
|
120 |
/**
|
139 |
if ( in_array( $option , array('recaptcha_publickey','recaptcha_privatekey') ) )
|
140 |
add_filter( 'wp_redirect' , array( &$this , 'remove_new_apikey_url' ) );
|
141 |
}
|
142 |
+
|
143 |
/**
|
144 |
* Removes Update api key url params
|
145 |
* @param url URL
|
148 |
function remove_new_apikey_url( $url = null ) {
|
149 |
return remove_query_arg( array('_wpnonce' , 'recaptcha-action' , 'settings-updated' ) , $url );
|
150 |
}
|
151 |
+
|
152 |
/**
|
153 |
* Admin Notices hook to show up when the api keys heve not been entered.
|
154 |
*/
|
155 |
function api_key_notice() {
|
156 |
+
?><div class="notice error above-h1"><p><?php
|
157 |
+
printf(
|
158 |
__( '<strong>reCaptcha needs your attention:</strong> To make it work You need to enter an api key. <br />You can do so at the <a href="%s">reCaptcha settings page</a>.' , 'wp-recaptcha-integration' ),
|
159 |
admin_url( add_query_arg( 'page' , 'recaptcha' , 'options-general.php' ) )
|
160 |
);
|
171 |
}
|
172 |
|
173 |
$this->enter_api_key = ! $has_api_key || ( isset($_REQUEST['recaptcha-action']) && $_REQUEST['recaptcha-action'] == 'recaptcha-set-api-key');
|
174 |
+
|
175 |
if ( ! $this->enter_api_key ) {
|
176 |
add_settings_section( 'recaptcha_protection' , __( 'Protect' , 'wp-recaptcha-integration' ), array( &$this , 'explain_protection' ), 'recaptcha');
|
177 |
add_settings_section( 'recaptcha_styling' , __( 'Style' , 'wp-recaptcha-integration' ), array( &$this , 'explain_styling' ), 'recaptcha');
|
205 |
register_setting( 'recaptcha_options', 'recaptcha_disable_submit' , 'intval');
|
206 |
|
207 |
register_setting( 'recaptcha_options', 'recaptcha_noscript' , 'intval');
|
|
|
208 |
|
209 |
+
|
210 |
+
add_settings_field('recaptcha_flavor', __('Flavor','wp-recaptcha-integration'),
|
211 |
array(&$this,'input_radio'), 'recaptcha', 'recaptcha_styling',
|
212 |
+
array(
|
213 |
'name' => 'recaptcha_flavor',
|
214 |
'items' => array(
|
215 |
array(
|
222 |
),
|
223 |
),
|
224 |
) );
|
225 |
+
|
226 |
add_settings_field('recaptcha_language', __( 'Language Settings' ), array(&$this,'select_language'), 'recaptcha', 'recaptcha_styling');
|
227 |
+
|
228 |
add_settings_field('recaptcha_theme', __('Theme','wp-recaptcha-integration'), array(&$this,'select_theme'), 'recaptcha', 'recaptcha_styling');
|
229 |
|
230 |
+
add_settings_field('recaptcha_disable_submit', __('Disable Submit Button','wp-recaptcha-integration'),
|
231 |
+
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_styling' ,
|
232 |
+
array('name'=>'recaptcha_disable_submit','label'=>__( 'Disable Form Submit Button until no-captcha is entered.' ,'wp-recaptcha-integration' ) )
|
233 |
);
|
234 |
+
add_settings_field('recaptcha_noscript', __('Noscript Fallback','wp-recaptcha-integration'),
|
235 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_advanced' ,
|
236 |
+
array(
|
237 |
'name'=>'recaptcha_noscript',
|
238 |
'label'=>__( 'Provide a fallback for non javascript capable browsers.','wp-recaptcha-integration' ),
|
239 |
'description' => __( 'Leave this unchecked when your site requires JavaScript anyway.','wp-recaptcha-integration' ),
|
240 |
'class' => 'flavor-grecaptcha',
|
241 |
+
)
|
242 |
);
|
243 |
|
244 |
global $wp_version;
|
245 |
if ( version_compare( $wp_version , '4.2' ) >= 0 ) {
|
246 |
register_setting( 'recaptcha_options', 'recaptcha_comment_use_42_filter' , 'intval');
|
247 |
+
add_settings_field('recaptcha_comment_use_42_filter', __('Comment Form rendering','wp-recaptcha-integration'),
|
248 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_advanced' ,
|
249 |
+
array(
|
250 |
'name'=>'recaptcha_comment_use_42_filter',
|
251 |
'label'=>__( 'My Comment Form is WordPress 4.2 compatible.','wp-recaptcha-integration' ),
|
252 |
'description' => __( 'Enable this when your comment form uses the <code>comment_form_submit_button</code> filter. (Or just try if it works.)','wp-recaptcha-integration' ),
|
253 |
'class' => 'flavor-grecaptcha',
|
254 |
+
)
|
255 |
);
|
256 |
}
|
257 |
}
|
258 |
+
|
259 |
if ( ! WP_reCaptcha::is_network_activated() || is_network_admin() ) {
|
260 |
// network options
|
261 |
register_setting( 'recaptcha_options', 'recaptcha_enable_comments' , 'intval');
|
264 |
register_setting( 'recaptcha_options', 'recaptcha_enable_lostpw' , 'intval');
|
265 |
register_setting( 'recaptcha_options', 'recaptcha_lockout' , 'intval');
|
266 |
|
267 |
+
if ( function_exists('WC') ) {
|
268 |
register_setting( 'recaptcha_options', 'recaptcha_enable_wc_order' , 'intval');
|
269 |
+
}
|
270 |
+
if ( class_exists( 'Awesome_Support' ) ) {
|
271 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_as_registration' , 'intval');
|
272 |
+
}
|
273 |
+
if ( class_exists( 'bbPress' ) ) {
|
274 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_bbp_topic' , 'intval');
|
275 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_bbp_reply' , 'intval');
|
276 |
+
}
|
277 |
|
278 |
register_setting( 'recaptcha_options', 'recaptcha_disable_for_known_users' , 'intval');
|
279 |
+
|
280 |
$protect_settings = array();
|
281 |
$protect_settings[] = array(
|
282 |
'name' => 'recaptcha_enable_comments',
|
298 |
'label' => __('Lost Password Form','wp-recaptcha-integration'),
|
299 |
'class' => '',
|
300 |
);
|
301 |
+
|
302 |
if ( function_exists('WC') ) {
|
303 |
$wc_warn = WP_reCaptcha::instance()->get_option('recaptcha_enable_wc_order') && WP_reCaptcha::instance()->get_option('recaptcha_flavor') !== 'grecaptcha';
|
304 |
$protect_settings[] = array(
|
307 |
'class' => 'flavor-grecaptcha',
|
308 |
);
|
309 |
}
|
310 |
+
|
311 |
+
if ( class_exists( 'Awesome_Support' ) ) {
|
312 |
+
|
313 |
+
$protect_settings[] = array(
|
314 |
+
'name'=>'recaptcha_enable_as_registration',
|
315 |
+
'label'=>__( 'Awesome Support Registration','wp-recaptcha-integration' ),
|
316 |
+
'class' => '',
|
317 |
+
);
|
318 |
+
}
|
319 |
+
|
320 |
+
if ( class_exists( 'bbPress' ) ) {
|
321 |
+
$protect_settings[] = array(
|
322 |
+
'name' => 'recaptcha_enable_bbp_topic',
|
323 |
+
'label' => __( 'bbPress New Topic','wp-recaptcha-integration' ),
|
324 |
+
'class' => 'flavor-grecaptcha',
|
325 |
+
);
|
326 |
+
|
327 |
+
$protect_settings[] = array(
|
328 |
+
'name' => 'recaptcha_enable_bbp_reply',
|
329 |
+
'label' => __( 'bbPress New Reply','wp-recaptcha-integration' ),
|
330 |
+
'class' => 'flavor-grecaptcha',
|
331 |
+
);
|
332 |
+
}
|
333 |
+
|
334 |
+
add_settings_field('recaptcha_protection', __('Forms to protect','wp-recaptcha-integration'),
|
335 |
array(&$this,'input_protect'), 'recaptcha', 'recaptcha_protection' ,
|
336 |
+
$protect_settings
|
337 |
);
|
338 |
+
|
339 |
+
add_settings_field('recaptcha_disable_for_known_users', __('Disable for known users','wp-recaptcha-integration'),
|
340 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_protection' ,
|
341 |
+
array('name'=>'recaptcha_disable_for_known_users','label'=>__( 'Disable reCaptcha verification for logged in users.','wp-recaptcha-integration' ))
|
342 |
);
|
343 |
+
|
344 |
+
add_settings_field('recaptcha_lockout', __('Prevent lockout','wp-recaptcha-integration'),
|
345 |
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_protection' ,
|
346 |
+
array(
|
347 |
'name'=>'recaptcha_lockout',
|
348 |
'label'=>__( 'Allow administrator to log in if API keys do not work.','wp-recaptcha-integration' ),
|
349 |
'description' => __( 'When the captcha verification fails, and the private or public API key does not work the plugin will let you in anyway. Please note that with this option checked plus a broken keypair your site will be open to brute force attacks, that try to guess an administrator password.','wp-recaptcha-integration' ),
|
350 |
+
)
|
351 |
);
|
352 |
}
|
353 |
|
355 |
add_settings_error('recaptcha',1,__('Please configure the public and private key. <a href="http://www.google.com/recaptcha/whyrecaptcha">What are you trying to tell me?</a>','wp-recaptcha-integration'),'updated');
|
356 |
}
|
357 |
}
|
358 |
+
|
359 |
/**
|
360 |
* Intro text for the api key setting
|
361 |
*/
|
362 |
public function explain_apikey( ) {
|
363 |
if ( $this->enter_api_key ) {
|
364 |
+
?><p class="description"><?php
|
365 |
$info_url = 'https://developers.google.com/recaptcha/intro';
|
366 |
$admin_url = 'https://www.google.com/recaptcha/admin';
|
367 |
printf(
|
368 |
__( 'Please register your blog through the <a href="%s">Google reCAPTCHA admin page</a> and enter the public and private key in the fields below. <a href="%s">What is this all about?</a>', 'wp-recaptcha-integration' ) ,
|
369 |
+
$admin_url , $info_url
|
370 |
);
|
371 |
?></p><?php
|
372 |
?><input type="hidden" name="recaptcha-action" value="recaptcha-set-api-key" /><?php
|
373 |
} else {
|
374 |
?><div class="recaptcha-explain"><?php
|
375 |
+
?><p class="description"><?php
|
376 |
_e( 'You already entered an API Key. Use the button below to enter it again.','wp-recaptcha-integration');
|
377 |
?></p><?php
|
378 |
$action = 'recaptcha-set-api-key';
|
379 |
$nonce = wp_create_nonce( $action );
|
380 |
$new_url = add_query_arg( array('_wpnonce' => $nonce , 'recaptcha-action' => $action ) );
|
381 |
+
|
382 |
$action = 'recaptcha-test-api-key';
|
383 |
$nonce = wp_create_nonce( $action );
|
384 |
$test_url = add_query_arg( array('_wpnonce' => $nonce , 'action' => $action ) , admin_url( 'admin-ajax.php' ) );
|
385 |
+
|
386 |
$action = 'recaptcha-init-test-api-key';
|
387 |
$nonce = wp_create_nonce( $action );
|
388 |
$init_test_url = add_query_arg( array('_wpnonce' => $nonce , 'action' => $action ) , admin_url( 'admin-ajax.php' ) );
|
389 |
+
|
390 |
+
?><p class="submit"><?php
|
391 |
?><a class="button" href="<?php echo $new_url ?>"><?php _e('New API Key' , 'wp-recaptcha-integration') ?></a><?php
|
392 |
?><a id="test-api-key" class="button" data-init-href="<?php echo $init_test_url ?>" href="<?php echo $test_url ?>"><?php _e('Test API Key' , 'wp-recaptcha-integration') ?></a><?php
|
393 |
?></p><?php
|
394 |
?></div><?php
|
395 |
}
|
396 |
}
|
397 |
+
|
398 |
/**
|
399 |
* Intro text for the Protection setting
|
400 |
*/
|
401 |
public function explain_protection() {
|
402 |
?><div class="recaptcha-explain"><?php
|
403 |
+
?><p class="description"><?php
|
404 |
_e( 'Select which forms you want to protect with a captcha.' , 'wp-recaptcha-integration' );
|
405 |
?></p><?php
|
406 |
?></div><?php
|
417 |
*/
|
418 |
public function explain_styling() {
|
419 |
?><div class="recaptcha-explain"><?php
|
420 |
+
?><p class="description"><?php
|
421 |
_e( 'Choose a flavor and theme for your Captcha. Please note that with the old style reCaptcha you cannot have more than one captcha per page.' , 'wp-recaptcha-integration' );
|
422 |
?></p><?php
|
423 |
?></div><?php
|
424 |
}
|
425 |
+
|
426 |
+
|
427 |
/**
|
428 |
* Test api key ajax response.
|
429 |
* Returns reCaptcha HTML
|
480 |
}
|
481 |
exit(0);
|
482 |
}
|
483 |
+
|
484 |
/**
|
485 |
* Link for canceling api key entering
|
486 |
* checks the verification process and shows an error on fail.
|
489 |
$url = $this->remove_new_apikey_url( add_query_arg(null,null) );
|
490 |
?><a class="button" href="<?php echo $url ?>"><?php _e( 'Cancel' ) ?></a><?php
|
491 |
}
|
492 |
+
|
493 |
/**
|
494 |
* Radio buttons
|
495 |
*
|
516 |
?></label><br /><?php
|
517 |
}
|
518 |
}
|
519 |
+
|
520 |
/**
|
521 |
* A Checkbox
|
522 |
*
|
545 |
}
|
546 |
?></label><?php
|
547 |
}
|
548 |
+
|
549 |
/**
|
550 |
* On/off switch. Basically A Checkbox
|
551 |
*
|
574 |
?></label><?php
|
575 |
?></div><?php
|
576 |
}
|
577 |
+
|
578 |
public function input_protect( $switches ) {
|
579 |
+
foreach ( $switches as $switch )
|
580 |
$this->input_check_onoff( $switch );
|
581 |
}
|
582 |
+
|
583 |
/**
|
584 |
+
* A Text field.
|
585 |
* Used for api key input.
|
586 |
*
|
587 |
* @param args array(
|
604 |
'recaptcha' => WP_reCaptcha_ReCaptcha::instance()->get_supported_languages(),
|
605 |
'grecaptcha' => WP_reCaptcha_NoCaptcha::instance()->get_supported_languages(),
|
606 |
);
|
607 |
+
|
608 |
?><div class="recaptcha-select-language flavor-<?php echo $option_flavor ?>"><?php
|
609 |
foreach( $all_available_langs as $flavor => $available_langs ) {
|
610 |
?><select class="flavor-<?php echo $flavor ?>" name="<?php echo $option_name ?>[<?php echo $flavor ?>]"><?php
|
624 |
*/
|
625 |
public function select_theme() {
|
626 |
$option_name = 'recaptcha_theme';
|
627 |
+
|
628 |
$grecaptcha_themes = WP_reCaptcha_NoCaptcha::instance()->get_supported_themes();
|
629 |
$grecaptcha_themes = array_map( array( $this , '_map_grecaptcha' ) , $grecaptcha_themes );
|
630 |
+
|
631 |
$recaptcha_themes = WP_reCaptcha_ReCaptcha::instance()->get_supported_themes();
|
632 |
$recaptcha_themes = array_map( array( $this , '_map_recaptcha' ) , $recaptcha_themes );
|
633 |
+
|
634 |
$themes = $grecaptcha_themes + $recaptcha_themes;
|
635 |
|
636 |
$option_theme = WP_reCaptcha::instance()->get_option($option_name);
|
637 |
$option_flavor = WP_reCaptcha::instance()->get_option( 'recaptcha_flavor' );
|
638 |
+
|
639 |
?><div class="recaptcha-select-theme"><?php
|
640 |
+
|
641 |
foreach ( $themes as $value => $theme ) {
|
642 |
extract( $theme ); // label, flavor
|
643 |
?><div class="theme-item flavor-<?php echo $flavor ?>"><?php
|
644 |
?><input <?php checked($value,$option_theme,true); ?> id="<?php echo "$option_name-$value" ?>" type="radio" name="<?php echo $option_name ?>" value="<?php echo $value ?>" /><?php
|
645 |
?><label for="<?php echo "$option_name-$value" ?>"><?php
|
646 |
+
?><span class="title"><?php
|
647 |
echo $label;
|
648 |
?></span><?php
|
649 |
if ( $value == 'custom' ) {
|
656 |
}
|
657 |
?></label><?php
|
658 |
?></div><?php
|
659 |
+
|
660 |
}
|
661 |
?></div><?php
|
662 |
?></div><?php
|
663 |
}
|
664 |
+
|
665 |
/**
|
666 |
* @usage select_theme()
|
667 |
*/
|
668 |
private function _map_grecaptcha( $val ) {
|
669 |
+
$val['flavor'] = 'grecaptcha';
|
670 |
return $val;
|
671 |
}
|
672 |
/**
|
673 |
* @usage select_theme()
|
674 |
*/
|
675 |
private function _map_recaptcha( $val ) {
|
676 |
+
$val['flavor'] = 'recaptcha';
|
677 |
return $val;
|
678 |
}
|
679 |
+
|
680 |
/**
|
681 |
* Check if language is supported by current recaptcha flavor
|
682 |
*/
|
685 |
|
686 |
if ( isset( $language[$flavor] ) )
|
687 |
$language = $language[$flavor];
|
688 |
+
|
689 |
if ( $language != 'WPLANG' )
|
690 |
$language = WP_reCaptcha::instance()->captcha_instance_by_flavor( $flavor )->get_language( $language );
|
691 |
return $language;
|
699 |
'grecaptcha' => array( 'light','dark' ),
|
700 |
);
|
701 |
$flavor = WP_reCaptcha::instance()->get_option('recaptcha_flavor');
|
702 |
+
|
703 |
if ( isset($themes_available[$flavor] ) && in_array($theme,$themes_available[$flavor]) )
|
704 |
return $theme;
|
705 |
else if ( isset($themes_available[$flavor] ) )
|
706 |
return $themes_available[$flavor][0];
|
707 |
return 'light';
|
708 |
}
|
709 |
+
|
710 |
/**
|
711 |
* Check valid flavor
|
712 |
*/
|
720 |
* Admin menu hook, adds blogs local options page
|
721 |
*/
|
722 |
public function add_options_page() {
|
723 |
+
$page_slug = add_options_page(
|
724 |
+
__('ReCaptcha','wp-recaptcha-integration'), __('ReCaptcha','wp-recaptcha-integration'),
|
725 |
+
'manage_options', 'recaptcha',
|
726 |
array(&$this,'render_options_page')
|
727 |
);
|
728 |
+
|
729 |
add_action( "load-$page_slug" , array( &$this , 'enqueue_styles' ) );
|
730 |
}
|
731 |
|
743 |
public function render_options_page() {
|
744 |
$option_flavor = WP_reCaptcha::instance()->get_option( 'recaptcha_flavor' );
|
745 |
?><div class="wrap flavor-<?php echo $option_flavor ?>"><?php
|
746 |
+
?><h2><?php /*icon*/
|
747 |
_e('Settings');
|
748 |
+
echo ' › ';
|
749 |
+
_e( 'ReCaptcha' , 'wp-recaptcha-integration' );
|
750 |
?></h2><?php
|
751 |
/* ?><p><?php _e( '...' , 'googlefont' ); ?></p><?php */
|
752 |
?><form action="options.php" method="post"><?php
|
753 |
settings_fields( 'recaptcha_options' );
|
754 |
+
do_settings_sections( 'recaptcha' );
|
755 |
submit_button( null , 'primary' , null, null, array('autocomplete'=>'off'));
|
756 |
?></form><?php
|
757 |
?></div><?php
|
758 |
}
|
759 |
+
|
760 |
}
|
761 |
|
762 |
|
inc/class-wp_recaptcha_recaptcha.php
CHANGED
@@ -17,12 +17,18 @@ class WP_reCaptcha_ReCaptcha extends WP_reCaptcha_Captcha {
|
|
17 |
'es' => 'Spanish',
|
18 |
'tr' => 'Turkish',
|
19 |
);
|
|
|
20 |
|
21 |
/**
|
22 |
* Holding the singleton instance
|
23 |
*/
|
24 |
private static $_instance = null;
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
/**
|
27 |
* @return WP_reCaptcha_Options The options manager instance
|
28 |
*/
|
@@ -41,7 +47,7 @@ class WP_reCaptcha_ReCaptcha extends WP_reCaptcha_Captcha {
|
|
41 |
* Prevent from creating more than one instance
|
42 |
*/
|
43 |
private function __construct() {
|
44 |
-
if ( !
|
45 |
require_once dirname(__FILE__).'/recaptchalib.php';
|
46 |
}
|
47 |
|
@@ -101,6 +107,11 @@ class WP_reCaptcha_ReCaptcha extends WP_reCaptcha_Captcha {
|
|
101 |
|
102 |
};
|
103 |
</script><?php
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
}
|
106 |
/**
|
@@ -197,5 +208,4 @@ class WP_reCaptcha_ReCaptcha extends WP_reCaptcha_Captcha {
|
|
197 |
}
|
198 |
|
199 |
|
200 |
-
WP_reCaptcha_Options::instance();
|
201 |
|
17 |
'es' => 'Spanish',
|
18 |
'tr' => 'Turkish',
|
19 |
);
|
20 |
+
|
21 |
|
22 |
/**
|
23 |
* Holding the singleton instance
|
24 |
*/
|
25 |
private static $_instance = null;
|
26 |
|
27 |
+
/**
|
28 |
+
* Last error message.
|
29 |
+
*/
|
30 |
+
private $last_error = null;
|
31 |
+
|
32 |
/**
|
33 |
* @return WP_reCaptcha_Options The options manager instance
|
34 |
*/
|
47 |
* Prevent from creating more than one instance
|
48 |
*/
|
49 |
private function __construct() {
|
50 |
+
if ( ! function_exists( 'recaptcha_get_html' ) )
|
51 |
require_once dirname(__FILE__).'/recaptchalib.php';
|
52 |
}
|
53 |
|
107 |
|
108 |
};
|
109 |
</script><?php
|
110 |
+
?><style type="text/css">
|
111 |
+
.recaptchatable {
|
112 |
+
table-layout:auto;
|
113 |
+
}
|
114 |
+
</style><?php
|
115 |
}
|
116 |
}
|
117 |
/**
|
208 |
}
|
209 |
|
210 |
|
|
|
211 |
|
languages/wp-recaptcha-integration-it_IT.mo
ADDED
Binary file
|
languages/wp-recaptcha-integration-it_IT.po
ADDED
@@ -0,0 +1,373 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP reCaptcha Integration v1.1.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2015-02-01 17:51+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-08-29 11:53+0100\n"
|
7 |
+
"Last-Translator: Jörn Lund <joern@podpirate.org>\n"
|
8 |
+
"Language-Team: Ivan <ivan@yivoff.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"Language: it_IT\n"
|
14 |
+
"X-Generator: Poedit 1.8.1\n"
|
15 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-Basepath: ..\n"
|
18 |
+
"X-Textdomain-Support: yes\n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
|
21 |
+
# @ wp-recaptcha-integration
|
22 |
+
#: inc/class-wp_recaptcha_contactform7.php:78
|
23 |
+
#: inc/class-wp_recaptcha_ninjaforms.php:36
|
24 |
+
msgid "reCAPTCHA"
|
25 |
+
msgstr "reCAPTCHA"
|
26 |
+
|
27 |
+
# @ contact-form-7
|
28 |
+
#: inc/class-wp_recaptcha_contactform7.php:91
|
29 |
+
msgid "Required field?"
|
30 |
+
msgstr "Campo richiesto?"
|
31 |
+
|
32 |
+
# @ contact-form-7
|
33 |
+
#: inc/class-wp_recaptcha_contactform7.php:93
|
34 |
+
msgid "Name"
|
35 |
+
msgstr "Nome"
|
36 |
+
|
37 |
+
# @ contact-form-7
|
38 |
+
#: inc/class-wp_recaptcha_contactform7.php:119
|
39 |
+
msgid "Copy this code and paste it into the form left."
|
40 |
+
msgstr "Copiare questo codice e incollarlo nel modulo/form a sinistra."
|
41 |
+
|
42 |
+
# @ wp-recaptcha-integration
|
43 |
+
#: inc/class-wp_recaptcha_contactform7.php:137
|
44 |
+
msgid "The Captcha didn’t verify."
|
45 |
+
msgstr "Il codice di verifica è sbagliato"
|
46 |
+
|
47 |
+
# @ wp-recaptcha-integration
|
48 |
+
#: inc/class-wp_recaptcha_ninjaforms.php:134
|
49 |
+
#: inc/class-wp_recaptcha_woocommerce.php:83
|
50 |
+
#: inc/class-wp_recaptcha_woocommerce.php:92 wp-recaptcha-integration.php:372
|
51 |
+
#: wp-recaptcha-integration.php:418 wp-recaptcha-integration.php:432
|
52 |
+
#: wp-recaptcha-integration.php:444
|
53 |
+
msgid "<strong>Error:</strong> the Captcha didn’t verify."
|
54 |
+
msgstr "<strong>Error:</strong> Il codice di verifica è sbagliato"
|
55 |
+
|
56 |
+
# @ wp-recaptcha-integration
|
57 |
+
#: inc/class-wp_recaptcha_nocaptcha.php:198
|
58 |
+
msgid "Please enable JavaScript to submit this form."
|
59 |
+
msgstr "Si prega di abilitare JavaScript per inviare questo modulo."
|
60 |
+
|
61 |
+
# @ wp-recaptcha-integration
|
62 |
+
#: inc/class-wp_recaptcha_options.php:94
|
63 |
+
#: inc/class-wp_recaptcha_options.php:106
|
64 |
+
msgid "reCaptcha Settings"
|
65 |
+
msgstr "Impostazioni reCaptcha"
|
66 |
+
|
67 |
+
# @ wp-recaptcha-integration
|
68 |
+
#: inc/class-wp_recaptcha_options.php:95
|
69 |
+
msgid "reCaptcha"
|
70 |
+
msgstr "reCAPTCHA"
|
71 |
+
|
72 |
+
# @ wp-recaptcha-integration
|
73 |
+
#: inc/class-wp_recaptcha_options.php:155
|
74 |
+
#, php-format
|
75 |
+
msgid "<strong>reCaptcha needs your attention:</strong> To make it work You need to enter an api key. <br />You can do so at the <a href=\"%s\">reCaptcha settings page</a>."
|
76 |
+
msgstr "<strong>reCaptcha ha bisogno della tua attenzione:</strong> per farlo funzionare, è necessario immettere una chiave API. <br /> Puoi farlo in <a href=\"%s\">pagina delle impostazioni di reCaptcha</a> ."
|
77 |
+
|
78 |
+
# @ wp-recaptcha-integration
|
79 |
+
#: inc/class-wp_recaptcha_options.php:183
|
80 |
+
msgid "Site key"
|
81 |
+
msgstr "Chiave sito"
|
82 |
+
|
83 |
+
# @ wp-recaptcha-integration
|
84 |
+
#: inc/class-wp_recaptcha_options.php:184
|
85 |
+
msgid "Secret key"
|
86 |
+
msgstr "Chiave segreta"
|
87 |
+
|
88 |
+
# @ default
|
89 |
+
#: inc/class-wp_recaptcha_options.php:220
|
90 |
+
msgid "Language Settings"
|
91 |
+
msgstr "Impostazioni di lingua"
|
92 |
+
|
93 |
+
# @ wp-recaptcha-integration
|
94 |
+
#: inc/class-wp_recaptcha_options.php:204
|
95 |
+
msgid "Flavor"
|
96 |
+
msgstr "Il tipo"
|
97 |
+
|
98 |
+
# @ wp-recaptcha-integration
|
99 |
+
#: inc/class-wp_recaptcha_options.php:211
|
100 |
+
msgid "No Captcha where you just click a button"
|
101 |
+
msgstr "No Captcha dove basta cliccare su un pulsante"
|
102 |
+
|
103 |
+
# @ wp-recaptcha-integration
|
104 |
+
#: inc/class-wp_recaptcha_options.php:215
|
105 |
+
msgid "Old style reCAPTCHA where you type some cryptic text"
|
106 |
+
msgstr "reCAPTCHA vecchio stile, dove si deve interpretare e poi digitare una scritta deformata"
|
107 |
+
|
108 |
+
# @ contact-form-7
|
109 |
+
# @ wp-recaptcha-integration
|
110 |
+
#: inc/class-wp_recaptcha_contactform7.php:98
|
111 |
+
#: inc/class-wp_recaptcha_ninjaforms.php:72
|
112 |
+
#: inc/class-wp_recaptcha_options.php:222
|
113 |
+
msgid "Theme"
|
114 |
+
msgstr "Tema"
|
115 |
+
|
116 |
+
# @ wp-recaptcha-integration
|
117 |
+
#: inc/class-wp_recaptcha_options.php:224
|
118 |
+
msgid "Disable Submit Button"
|
119 |
+
msgstr "Disattiva tasto Invio"
|
120 |
+
|
121 |
+
# @ wp-recaptcha-integration
|
122 |
+
#: inc/class-wp_recaptcha_options.php:226
|
123 |
+
msgid "Disable Form Submit Button until no-captcha is entered."
|
124 |
+
msgstr "Disattivare il tasto Invio del form finché il captcha non è inserito."
|
125 |
+
|
126 |
+
# @ wp-recaptcha-integration
|
127 |
+
#: inc/class-wp_recaptcha_options.php:313
|
128 |
+
msgid "Disable for known users"
|
129 |
+
msgstr "Disabilitare per gli utenti conosciuti"
|
130 |
+
|
131 |
+
# @ wp-recaptcha-integration
|
132 |
+
#: inc/class-wp_recaptcha_options.php:315
|
133 |
+
msgid "Disable reCaptcha verification for logged in users."
|
134 |
+
msgstr "Disabilita il reCAPTCHA per gli utenti loggati."
|
135 |
+
|
136 |
+
# @ wp-recaptcha-integration
|
137 |
+
#: inc/class-wp_recaptcha_options.php:328
|
138 |
+
msgid "Please configure the public and private key. <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
|
139 |
+
msgstr "Configurare la chiave pubblica e privata. <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">Cosa vuol dire questa cosa?</a>"
|
140 |
+
|
141 |
+
# @ wp-recaptcha-integration
|
142 |
+
#: inc/class-wp_recaptcha_options.php:341
|
143 |
+
#, php-format
|
144 |
+
msgid "Please register your blog through the <a href=\"%s\">Google reCAPTCHA admin page</a> and enter the public and private key in the fields below. <a href=\"%s\">What is this all about?</a>"
|
145 |
+
msgstr "Registra il tuo blog tramite <a href=\"%s\">la pagine di amministrazione di reCAPTCHA</a> e inserisci la chiave pubblica e privata nei campi qui sotto. <a href=\"%s\">Di cosa si tratta?</a>"
|
146 |
+
|
147 |
+
# @ wp-recaptcha-integration
|
148 |
+
#: inc/class-wp_recaptcha_options.php:349
|
149 |
+
msgid "You already entered an API Key. Use the button below to enter it again."
|
150 |
+
msgstr "È già stata immessa una chiave API. Utilizza il pulsante sotto per inserirlo di nuovo."
|
151 |
+
|
152 |
+
# @ wp-recaptcha-integration
|
153 |
+
#: inc/class-wp_recaptcha_options.php:364
|
154 |
+
msgid "New API Key"
|
155 |
+
msgstr "Nuova chiave API"
|
156 |
+
|
157 |
+
# @ wp-recaptcha-integration
|
158 |
+
#: inc/class-wp_recaptcha_options.php:365
|
159 |
+
msgid "Test API Key"
|
160 |
+
msgstr "Prova la chiave API"
|
161 |
+
|
162 |
+
# @ wp-recaptcha-integration
|
163 |
+
#: inc/class-wp_recaptcha_options.php:419
|
164 |
+
msgid "Test verfication"
|
165 |
+
msgstr "Prova la verifica"
|
166 |
+
|
167 |
+
# @ wp-recaptcha-integration
|
168 |
+
#: inc/class-wp_recaptcha_options.php:432
|
169 |
+
msgid "The secret Key is missing."
|
170 |
+
msgstr "Manca la chiave segreta"
|
171 |
+
|
172 |
+
# @ wp-recaptcha-integration
|
173 |
+
#: inc/class-wp_recaptcha_options.php:433
|
174 |
+
msgid "The secret Key is invalid. You better check your domain configuration and enter it again."
|
175 |
+
msgstr "La chiave segreta non è valida. È meglio controllare la configurazione del dominio e immetterla nuovamente."
|
176 |
+
|
177 |
+
# @ wp-recaptcha-integration
|
178 |
+
#: inc/class-wp_recaptcha_options.php:434
|
179 |
+
msgid "The user response was missing"
|
180 |
+
msgstr "Mancava la risposta dell'utente"
|
181 |
+
|
182 |
+
# @ wp-recaptcha-integration
|
183 |
+
#: inc/class-wp_recaptcha_options.php:435
|
184 |
+
msgid "Invalid user response"
|
185 |
+
msgstr "Risposta sbagliata dell'utente "
|
186 |
+
|
187 |
+
# @ wp-recaptcha-integration
|
188 |
+
#: inc/class-wp_recaptcha_options.php:444
|
189 |
+
msgid "Works! All good!"
|
190 |
+
msgstr "Funziona! Tutto bene!"
|
191 |
+
|
192 |
+
# @ default
|
193 |
+
#: inc/class-wp_recaptcha_options.php:456
|
194 |
+
msgid "Cancel"
|
195 |
+
msgstr "Annulla"
|
196 |
+
|
197 |
+
# @ wp-recaptcha-integration
|
198 |
+
#: inc/class-wp_recaptcha_options.php:577
|
199 |
+
msgid "Automatic"
|
200 |
+
msgstr "Automatico"
|
201 |
+
|
202 |
+
# @ default
|
203 |
+
#: inc/class-wp_recaptcha_options.php:578
|
204 |
+
msgid "Site Language"
|
205 |
+
msgstr "Lingua del sito web"
|
206 |
+
|
207 |
+
# @ default
|
208 |
+
#: inc/class-wp_recaptcha_options.php:579
|
209 |
+
msgid "Other"
|
210 |
+
msgstr "Altro"
|
211 |
+
|
212 |
+
# @ wp-recaptcha-integration
|
213 |
+
#: inc/class-wp_recaptcha_nocaptcha.php:88
|
214 |
+
msgid "Light"
|
215 |
+
msgstr "Chiaro"
|
216 |
+
|
217 |
+
# @ wp-recaptcha-integration
|
218 |
+
#: inc/class-wp_recaptcha_nocaptcha.php:91
|
219 |
+
msgid "Dark"
|
220 |
+
msgstr "Scuro"
|
221 |
+
|
222 |
+
# @ wp-recaptcha-integration
|
223 |
+
#: inc/class-wp_recaptcha_recaptcha.php:51
|
224 |
+
msgid "Red"
|
225 |
+
msgstr "Rosso"
|
226 |
+
|
227 |
+
# @ wp-recaptcha-integration
|
228 |
+
#: inc/class-wp_recaptcha_recaptcha.php:54
|
229 |
+
msgid "White"
|
230 |
+
msgstr "Bianco"
|
231 |
+
|
232 |
+
# @ wp-recaptcha-integration
|
233 |
+
#: inc/class-wp_recaptcha_recaptcha.php:57
|
234 |
+
msgid "Black Glass"
|
235 |
+
msgstr "Vetro nero"
|
236 |
+
|
237 |
+
# @ wp-recaptcha-integration
|
238 |
+
#: inc/class-wp_recaptcha_recaptcha.php:60
|
239 |
+
msgid "Clean"
|
240 |
+
msgstr "Pulito"
|
241 |
+
|
242 |
+
# @ wp-recaptcha-integration
|
243 |
+
#: inc/class-wp_recaptcha_recaptcha.php:63
|
244 |
+
msgid "Custom"
|
245 |
+
msgstr "Personalizzato"
|
246 |
+
|
247 |
+
# @ wp-recaptcha-integration
|
248 |
+
#: inc/class-wp_recaptcha_options.php:617
|
249 |
+
msgid "Unstyled HTML to apply your own Stylesheets."
|
250 |
+
msgstr "HTML senza stile per applicare I tuoi fogli di stile."
|
251 |
+
|
252 |
+
# @ wp-recaptcha-integration
|
253 |
+
#: inc/class-wp_recaptcha_options.php:690
|
254 |
+
#: inc/class-wp_recaptcha_options.php:715
|
255 |
+
msgid "ReCaptcha"
|
256 |
+
msgstr "reCAPTCHA"
|
257 |
+
|
258 |
+
# @ default
|
259 |
+
#: inc/class-wp_recaptcha_options.php:713
|
260 |
+
msgid "Settings"
|
261 |
+
msgstr "Impostazioni"
|
262 |
+
|
263 |
+
# @ wp-recaptcha-integration
|
264 |
+
#: inc/class-wp_recaptcha_recaptcha.php:146
|
265 |
+
msgid "Incorrect please try again"
|
266 |
+
msgstr "Sbagliato! Riprova per favore"
|
267 |
+
|
268 |
+
# @ wp-recaptcha-integration
|
269 |
+
#: inc/class-wp_recaptcha_recaptcha.php:148
|
270 |
+
msgid "Enter the words above:"
|
271 |
+
msgstr "Inserisci le parole sovraindicate:"
|
272 |
+
|
273 |
+
# @ wp-recaptcha-integration
|
274 |
+
#: inc/class-wp_recaptcha_recaptcha.php:149
|
275 |
+
msgid "Enter the numbers you hear:"
|
276 |
+
msgstr "Inserisci i numeri che senti:"
|
277 |
+
|
278 |
+
# @ wp-recaptcha-integration
|
279 |
+
#: inc/class-wp_recaptcha_recaptcha.php:153
|
280 |
+
msgid "Get another CAPTCHA"
|
281 |
+
msgstr "Richiedi un altro CAPTCHA"
|
282 |
+
|
283 |
+
# @ wp-recaptcha-integration
|
284 |
+
#: inc/class-wp_recaptcha_recaptcha.php:154
|
285 |
+
msgid "Get an audio CAPTCHA"
|
286 |
+
msgstr "Ottieni un audio CAPTCHA"
|
287 |
+
|
288 |
+
# @ wp-recaptcha-integration
|
289 |
+
#: inc/class-wp_recaptcha_recaptcha.php:155
|
290 |
+
msgid "Get an image CAPTCHA"
|
291 |
+
msgstr "Ottieni un immagine CAPTCHA"
|
292 |
+
|
293 |
+
# @ wp-recaptcha-integration
|
294 |
+
#: inc/class-wp_recaptcha_contactform7.php:100
|
295 |
+
#: inc/class-wp_recaptcha_ninjaforms.php:64
|
296 |
+
msgid "Use default"
|
297 |
+
msgstr "Usa predefinito"
|
298 |
+
|
299 |
+
# @ wp-recaptcha-integration
|
300 |
+
#: inc/class-wp_recaptcha_options.php:173
|
301 |
+
#: inc/class-wp_recaptcha_options.php:177
|
302 |
+
msgid "Connect"
|
303 |
+
msgstr "Connetti"
|
304 |
+
|
305 |
+
# @ wp-recaptcha-integration
|
306 |
+
#: inc/class-wp_recaptcha_options.php:174
|
307 |
+
msgid "Protect"
|
308 |
+
msgstr "Proteggi"
|
309 |
+
|
310 |
+
# @ wp-recaptcha-integration
|
311 |
+
#: inc/class-wp_recaptcha_options.php:175
|
312 |
+
msgid "Style"
|
313 |
+
msgstr "Stile"
|
314 |
+
|
315 |
+
# @ wp-recaptcha-integration
|
316 |
+
#: inc/class-wp_recaptcha_options.php:282
|
317 |
+
msgid "Comment Form"
|
318 |
+
msgstr "Modulo dei commenti"
|
319 |
+
|
320 |
+
# @ wp-recaptcha-integration
|
321 |
+
#: inc/class-wp_recaptcha_options.php:287
|
322 |
+
msgid "Signup Form"
|
323 |
+
msgstr "Modulo di iscrizione"
|
324 |
+
|
325 |
+
# @ wp-recaptcha-integration
|
326 |
+
#: inc/class-wp_recaptcha_options.php:292
|
327 |
+
msgid "Login Form"
|
328 |
+
msgstr "Form di login"
|
329 |
+
|
330 |
+
# @ wp-recaptcha-integration
|
331 |
+
#: inc/class-wp_recaptcha_options.php:297
|
332 |
+
msgid "Lost Password Form"
|
333 |
+
msgstr "Form password dimenticata"
|
334 |
+
|
335 |
+
# @ wp-recaptcha-integration
|
336 |
+
#: inc/class-wp_recaptcha_options.php:304
|
337 |
+
msgid "woocommerce Checkout"
|
338 |
+
msgstr "Woocommerce: Cassa"
|
339 |
+
|
340 |
+
# @ wp-recaptcha-integration
|
341 |
+
#: inc/class-wp_recaptcha_options.php:308
|
342 |
+
msgid "Forms to protect"
|
343 |
+
msgstr "I form da proteggere"
|
344 |
+
|
345 |
+
# @ wp-recaptcha-integration
|
346 |
+
#: inc/class-wp_recaptcha_options.php:317
|
347 |
+
msgid "Prevent lockout"
|
348 |
+
msgstr "Prevenire il blocco"
|
349 |
+
|
350 |
+
# @ wp-recaptcha-integration
|
351 |
+
#: inc/class-wp_recaptcha_options.php:321
|
352 |
+
msgid "Allow administrator to log in if API keys do not work."
|
353 |
+
msgstr "Consentire all'amministratore di accedere se le chiavi API non funzionano."
|
354 |
+
|
355 |
+
# @ wp-recaptcha-integration
|
356 |
+
#: inc/class-wp_recaptcha_options.php:322
|
357 |
+
msgid "When the captcha verification fails, and the private or public API key does not work the plugin will let you in anyway. Please note that with this option checked plus a broken keypair your site will be open to brute force attacks, that try to guess an administrator password."
|
358 |
+
msgstr "Quando la verifica di captcha non riesce, e la chiave API pubblica o privata non funziona il plugin permettera comunque di effettuare il login. Si prega di notare che con questa opzione selezionata e le chiavi non valide il sito sarà aperto agli attacchi di tipo brute force, con i quali si cerca di indovinare la password dell'utente amministratore."
|
359 |
+
|
360 |
+
# @ wp-recaptcha-integration
|
361 |
+
#: inc/class-wp_recaptcha_options.php:377
|
362 |
+
msgid "Select which forms you want to protect with a captcha."
|
363 |
+
msgstr "Segli quali form devono essere protetti con un captcha."
|
364 |
+
|
365 |
+
# @ wp-recaptcha-integration
|
366 |
+
#: inc/class-wp_recaptcha_options.php:387
|
367 |
+
msgid "Choose a flavor and theme for your Captcha. Please note that with the old style reCaptcha you cannot have more than one captcha per page."
|
368 |
+
msgstr "Scegli il tipo e il tema per il vostro Captcha. Si prega di notare che con il reCaptcha vecchio stile non si può avere più di un captcha per pagina."
|
369 |
+
|
370 |
+
# @ wp-recaptcha-integration
|
371 |
+
#: inc/class-wp_recaptcha_woocommerce.php:72
|
372 |
+
msgid "Are you human"
|
373 |
+
msgstr "sei umano?"
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: podpirate
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=F8NKC6TCASUXE
|
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.
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -17,18 +17,23 @@ Provides of the box integration for signup, login, comment forms, Ninja Forms an
|
|
17 |
form 7 as well as a plugin API for your own integrations.
|
18 |
|
19 |
= Features: =
|
20 |
-
- Secures login, signup
|
21 |
- Supports old as well as new reCaptcha.
|
22 |
-
-
|
23 |
-
-
|
24 |
-
-
|
25 |
-
-
|
26 |
-
- [
|
27 |
-
-
|
|
|
|
|
|
|
|
|
28 |
|
29 |
= Localizations =
|
30 |
- Brazilian Portuguese (thanks to [Vinícius Ferraz](http://www.viniciusferraz.com))
|
31 |
- Spanish (thanks to [Ivan Yivoff](https://github.com/yivi))
|
|
|
32 |
- German
|
33 |
|
34 |
Latest Files on GitHub: [https://github.com/mcguffin/wp-recaptcha-integration](https://github.com/mcguffin/wp-recaptcha-integration)
|
@@ -247,6 +252,22 @@ I will migrate all the translation stuff there.
|
|
247 |
|
248 |
== Changelog ==
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
= 1.1.5 =
|
251 |
- Feature: Noscript fallback option for noCaptcha
|
252 |
- Feature: Option for WP 4.2 compatible hook on comment form.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=F8NKC6TCASUXE
|
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.3
|
7 |
+
Stable tag: 1.1.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
17 |
form 7 as well as a plugin API for your own integrations.
|
18 |
|
19 |
= Features: =
|
20 |
+
- Secures login, signup und comments with a recaptcha.
|
21 |
- Supports old as well as new reCaptcha.
|
22 |
+
- Works together with
|
23 |
+
- WP Multisite
|
24 |
+
- bbPress (thanks to [Tareq Hasan](http://tareq.wedevs.com/)
|
25 |
+
- BuddyPress
|
26 |
+
- AwesomeSupport (thanks to [Julien Liabeuf](http://julienliabeuf.com/)
|
27 |
+
- WooCommerce (Only checkout, registration and login form. Not password reset)
|
28 |
+
- [Ninja Forms](http://ninjaforms.com/)
|
29 |
+
- [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
|
30 |
+
|
31 |
+
- For integration in your self-coded forms see this [wiki article](https://github.com/mcguffin/wp-recaptcha-integration/wiki/Custom-Themes-and-Forms) for details.
|
32 |
|
33 |
= Localizations =
|
34 |
- Brazilian Portuguese (thanks to [Vinícius Ferraz](http://www.viniciusferraz.com))
|
35 |
- Spanish (thanks to [Ivan Yivoff](https://github.com/yivi))
|
36 |
+
- Italian (thanks to [Salaros](http://blog.salaros.com/))
|
37 |
- German
|
38 |
|
39 |
Latest Files on GitHub: [https://github.com/mcguffin/wp-recaptcha-integration](https://github.com/mcguffin/wp-recaptcha-integration)
|
252 |
|
253 |
== Changelog ==
|
254 |
|
255 |
+
= 1.1.9 =
|
256 |
+
- Fix: Layout issues on recaptcha nojs fallback (thanks to [nurupo](https://github.com/nurupo))
|
257 |
+
- Metadata: add plugin textdomain
|
258 |
+
|
259 |
+
= 1.1.8 =
|
260 |
+
- Feature: Support AwesomeSupport
|
261 |
+
- Feature: Support bbPress new Topics and posts
|
262 |
+
- L10n: italian
|
263 |
+
- Fix: Layout issue on theme twenty fifteen (recaptcha)
|
264 |
+
|
265 |
+
= 1.1.7 =
|
266 |
+
- Fix: Compatibility with CF7 4.2 User Interface
|
267 |
+
|
268 |
+
= 1.1.6 =
|
269 |
+
- Fix: Skip Ninja Forms required check
|
270 |
+
|
271 |
= 1.1.5 =
|
272 |
- Feature: Noscript fallback option for noCaptcha
|
273 |
- Feature: Option for WP 4.2 compatible hook on comment form.
|
wp-recaptcha-integration.php
CHANGED
@@ -3,15 +3,16 @@
|
|
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 |
*/
|
10 |
|
11 |
/* Copyright 2014 Jörn Lund (email : joern AT podpirate DOT org)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
-
it under the terms of the GNU General Public License, version 2, as
|
15 |
published by the Free Software Foundation.
|
16 |
|
17 |
This program is distributed in the hope that it will be useful,
|
@@ -37,11 +38,11 @@ class WP_reCaptcha {
|
|
37 |
|
38 |
private $last_error = '';
|
39 |
private $_last_result;
|
40 |
-
|
41 |
private $_counter = 0;
|
42 |
|
43 |
private $_captcha_instance = null;
|
44 |
-
|
45 |
/**
|
46 |
* Holding the singleton instance
|
47 |
*/
|
@@ -77,7 +78,7 @@ class WP_reCaptcha {
|
|
77 |
if ( WP_reCaptcha::is_network_activated() ) {
|
78 |
add_site_option('recaptcha_publickey',''); // 1st global -> then local
|
79 |
add_site_option('recaptcha_privatekey',''); // 1st global -> then local
|
80 |
-
|
81 |
add_site_option('recaptcha_enable_comments' , true); // global
|
82 |
add_site_option('recaptcha_enable_signup' , true); // global
|
83 |
add_site_option('recaptcha_enable_login' , false); // global
|
@@ -105,7 +106,7 @@ class WP_reCaptcha {
|
|
105 |
register_deactivation_hook( __FILE__ , array( __CLASS__ , 'deactivate' ) );
|
106 |
register_uninstall_hook( __FILE__ , array( __CLASS__ , 'uninstall' ) );
|
107 |
}
|
108 |
-
|
109 |
/**
|
110 |
* Load ninja/cf7 php files if necessary
|
111 |
* Hooks into 'plugins_loaded'
|
@@ -127,6 +128,13 @@ class WP_reCaptcha {
|
|
127 |
if ( function_exists('WC') || class_exists('WooCommerce') )
|
128 |
WP_reCaptcha_WooCommerce::instance();
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
}
|
132 |
/**
|
@@ -136,11 +144,11 @@ class WP_reCaptcha {
|
|
136 |
function init() {
|
137 |
load_plugin_textdomain( 'wp-recaptcha-integration', false , dirname( plugin_basename( __FILE__ ) ).'/languages/' );
|
138 |
$require_recaptcha = $this->is_required();
|
139 |
-
|
140 |
if ( $require_recaptcha ) {
|
141 |
add_action( 'wp_head' , array($this,'recaptcha_head') );
|
142 |
add_action( 'wp_footer' , array($this,'recaptcha_foot') );
|
143 |
-
|
144 |
if ( $this->get_option('recaptcha_enable_signup') || $this->get_option('recaptcha_enable_login') || $this->get_option('recaptcha_enable_lostpw') ) {
|
145 |
add_action( 'login_head' , array(&$this,'recaptcha_head') );
|
146 |
add_action( 'login_head' , array(&$this,'recaptcha_login_head') );
|
@@ -150,17 +158,17 @@ class WP_reCaptcha {
|
|
150 |
/*
|
151 |
add_filter('comment_form_defaults',array($this,'comment_form_defaults'),10);
|
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 && $this->get_option('recaptcha_comment_use_42_filter') )
|
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 |
}
|
@@ -178,7 +186,7 @@ class WP_reCaptcha {
|
|
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'));
|
@@ -194,7 +202,7 @@ class WP_reCaptcha {
|
|
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 );
|
199 |
|
200 |
add_action( 'recaptcha_print' , array( &$this , 'print_recaptcha_html' ) );
|
@@ -203,10 +211,10 @@ class WP_reCaptcha {
|
|
203 |
}
|
204 |
add_filter( 'recaptcha_valid' , array( &$this , 'recaptcha_check' ) );
|
205 |
}
|
206 |
-
|
207 |
/**
|
208 |
* Set current captcha instance and return it.
|
209 |
-
*
|
210 |
* @return object WP_reCaptcha_Captcha
|
211 |
*/
|
212 |
public function captcha_instance() {
|
@@ -214,10 +222,10 @@ class WP_reCaptcha {
|
|
214 |
$this->_captcha_instance = $this->captcha_instance_by_flavor( $this->get_option( 'recaptcha_flavor' ) );
|
215 |
return $this->_captcha_instance;
|
216 |
}
|
217 |
-
|
218 |
/**
|
219 |
* Set current captcha instance and return it.
|
220 |
-
*
|
221 |
* @param string captcha flavor. 'grecaptcha' (noCaptcha) or 'recaptcha' (reCaptcha)
|
222 |
* @return object WP_reCaptcha_Captcha
|
223 |
*/
|
@@ -229,7 +237,7 @@ class WP_reCaptcha {
|
|
229 |
return WP_reCaptcha_ReCaptcha::instance();
|
230 |
}
|
231 |
}
|
232 |
-
|
233 |
/**
|
234 |
* returns if recaptcha is required.
|
235 |
*
|
@@ -239,13 +247,13 @@ class WP_reCaptcha {
|
|
239 |
$is_required = ! ( $this->get_option('recaptcha_disable_for_known_users') && current_user_can( 'read' ) );
|
240 |
return apply_filters( 'wp_recaptcha_required' , $is_required );
|
241 |
}
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
//////////////////////////////////
|
247 |
// Displaying
|
248 |
-
//
|
249 |
|
250 |
/**
|
251 |
* print recaptcha stylesheets
|
@@ -258,7 +266,7 @@ class WP_reCaptcha {
|
|
258 |
$this->end_inject( );
|
259 |
}
|
260 |
}
|
261 |
-
|
262 |
/**
|
263 |
* print recaptcha login form stylesheets
|
264 |
* hooks into `wp_head`
|
@@ -270,7 +278,7 @@ class WP_reCaptcha {
|
|
270 |
$this->end_inject( );
|
271 |
}
|
272 |
}
|
273 |
-
|
274 |
/**
|
275 |
* Print recaptcha scripts
|
276 |
* hooks into `wp_footer`
|
@@ -279,15 +287,15 @@ class WP_reCaptcha {
|
|
279 |
function recaptcha_foot( ) {
|
280 |
if ( apply_filters( 'wp_recaptcha_do_scripts' , true ) ) {
|
281 |
$this->begin_inject( );
|
282 |
-
|
283 |
// getting submit buttons of an elements form
|
284 |
-
if ( $this->get_option( 'recaptcha_disable_submit' ) ) {
|
285 |
?><script type="text/javascript">
|
286 |
function get_form_submits(el){
|
287 |
var form,current=el,ui,type,slice = Array.prototype.slice,self=this;
|
288 |
this.submits=[];
|
289 |
this.form=false;
|
290 |
-
|
291 |
this.setEnabled=function(e){
|
292 |
for ( var s=0;s<self.submits.length;s++ ) {
|
293 |
if (e) self.submits[s].removeAttribute('disabled');
|
@@ -298,7 +306,7 @@ class WP_reCaptcha {
|
|
298 |
while ( current && current.nodeName != 'BODY' && current.nodeName != 'FORM' ) {
|
299 |
current = current.parentNode;
|
300 |
}
|
301 |
-
if ( !current || current.nodeName != 'FORM' )
|
302 |
return false;
|
303 |
this.form=current;
|
304 |
ui=slice.call(this.form.getElementsByTagName('input')).concat(slice.call(this.form.getElementsByTagName('button')));
|
@@ -308,11 +316,11 @@ class WP_reCaptcha {
|
|
308 |
</script><?php
|
309 |
}
|
310 |
$this->captcha_instance()->print_foot();
|
311 |
-
|
312 |
$this->end_inject( );
|
313 |
}
|
314 |
}
|
315 |
-
|
316 |
/**
|
317 |
* Print recaptcha HTML. Use inside a form.
|
318 |
*
|
@@ -322,7 +330,7 @@ class WP_reCaptcha {
|
|
322 |
echo $this->recaptcha_html( $attr );
|
323 |
echo $this->end_inject( );
|
324 |
}
|
325 |
-
|
326 |
/**
|
327 |
* Get recaptcha HTML.
|
328 |
*
|
@@ -345,7 +353,7 @@ class WP_reCaptcha {
|
|
345 |
|
346 |
/**
|
347 |
* HTML comment with some notes (beginning)
|
348 |
-
*
|
349 |
* @param $return bool Whether to print or to return the comment
|
350 |
* @param $moretext string Additional information being included in the comment
|
351 |
* @return null|string HTML-Comment
|
@@ -357,7 +365,7 @@ class WP_reCaptcha {
|
|
357 |
}
|
358 |
/**
|
359 |
* HTML comment with some notes (ending)
|
360 |
-
*
|
361 |
* @param $return bool Whether to print or to return the comment
|
362 |
* @return null|string HTML-Comment
|
363 |
*/
|
@@ -366,7 +374,7 @@ class WP_reCaptcha {
|
|
366 |
if ( $return ) return $html;
|
367 |
echo $html;
|
368 |
}
|
369 |
-
|
370 |
/**
|
371 |
* Display recaptcha on comments form.
|
372 |
* filter function for `comment_form_defaults`
|
@@ -380,7 +388,7 @@ class WP_reCaptcha {
|
|
380 |
|
381 |
//////////////////////////////////
|
382 |
// Verification
|
383 |
-
//
|
384 |
|
385 |
/**
|
386 |
* Get last result of recaptcha check
|
@@ -389,7 +397,7 @@ class WP_reCaptcha {
|
|
389 |
function get_last_result() {
|
390 |
return $this->captcha_instance()->get_last_result();
|
391 |
}
|
392 |
-
|
393 |
/**
|
394 |
* Check recaptcha
|
395 |
*
|
@@ -400,7 +408,7 @@ class WP_reCaptcha {
|
|
400 |
return $this->captcha_instance()->check();
|
401 |
return true;
|
402 |
}
|
403 |
-
|
404 |
/**
|
405 |
* check recaptcha on login
|
406 |
* filter function for `wp_authenticate_user`
|
@@ -420,7 +428,7 @@ class WP_reCaptcha {
|
|
420 |
}
|
421 |
return $user;
|
422 |
}
|
423 |
-
|
424 |
/**
|
425 |
* check recaptcha on registration
|
426 |
* filter function for `registration_errors`
|
@@ -433,7 +441,7 @@ class WP_reCaptcha {
|
|
433 |
$errors = $this->wp_error_add( $errors );
|
434 |
return $errors;
|
435 |
}
|
436 |
-
|
437 |
/**
|
438 |
* check recaptcha WPMU signup
|
439 |
* filter function for `wpmu_validate_user_signup`
|
@@ -445,8 +453,8 @@ class WP_reCaptcha {
|
|
445 |
$result['errors'] = $this->wp_error_add( $result['errors'] , 'generic' );
|
446 |
return $result;
|
447 |
}
|
448 |
-
|
449 |
-
|
450 |
/**
|
451 |
* check recaptcha and return WP_Error on failure.
|
452 |
* filter function for `allow_password_reset`
|
@@ -475,7 +483,7 @@ class WP_reCaptcha {
|
|
475 |
return $param;
|
476 |
}
|
477 |
}
|
478 |
-
|
479 |
/**
|
480 |
* Check recaptcha and wp_die() on fail
|
481 |
* hooks into `pre_comment_on_post`, `lostpassword_post`
|
@@ -486,15 +494,15 @@ class WP_reCaptcha {
|
|
486 |
wp_die( $err );
|
487 |
}
|
488 |
}
|
489 |
-
|
490 |
-
|
491 |
//////////////////////////////////
|
492 |
// Options
|
493 |
-
//
|
494 |
|
495 |
/**
|
496 |
* Get plugin option by name.
|
497 |
-
*
|
498 |
* @param $option_name string
|
499 |
* @return bool false if check does not validate
|
500 |
*/
|
@@ -503,7 +511,7 @@ class WP_reCaptcha {
|
|
503 |
case 'recaptcha_publickey': // first try local, then global
|
504 |
case 'recaptcha_privatekey':
|
505 |
$option_value = get_option($option_name);
|
506 |
-
if ( ! $option_value && WP_reCaptcha::is_network_activated() )
|
507 |
$option_value = get_site_option( $option_name );
|
508 |
return $option_value;
|
509 |
case 'recaptcha_enable_comments': // global on network. else local
|
@@ -519,14 +527,14 @@ class WP_reCaptcha {
|
|
519 |
return get_option($option_name);
|
520 |
}
|
521 |
}
|
522 |
-
|
523 |
/**
|
524 |
* @return bool return if google api is configured
|
525 |
*/
|
526 |
function has_api_key() {
|
527 |
return $this->_has_api_key;
|
528 |
}
|
529 |
-
|
530 |
/**
|
531 |
* Test public and private key
|
532 |
*
|
@@ -536,15 +544,15 @@ class WP_reCaptcha {
|
|
536 |
// if ( ! ( $keys_okay = get_transient( 'recaptcha_keys_okay' ) ) ) {
|
537 |
$pub_okay = $this->test_public_key();
|
538 |
$prv_okay = $this->test_private_key();
|
539 |
-
|
540 |
// $keys_okay = ( $prv_okay && $pub_okay ) ? 'yes' : 'no';
|
541 |
-
|
542 |
//cache the result
|
543 |
// set_transient( 'recaptcha_keys_okay' , $keys_okay , 15 * MINUTE_IN_SECONDS );
|
544 |
// }
|
545 |
return $prv_okay && $pub_okay;
|
546 |
}
|
547 |
-
|
548 |
/**
|
549 |
* Test public key
|
550 |
*
|
@@ -573,11 +581,11 @@ class WP_reCaptcha {
|
|
573 |
$prv_rspbody = wp_remote_retrieve_body( $prv_response );
|
574 |
return ! is_wp_error( $prv_response ) && ! strpos(wp_remote_retrieve_body( $prv_response ),'invalid-site-private-key');
|
575 |
}
|
576 |
-
|
577 |
|
578 |
//////////////////////////////////
|
579 |
// Activation
|
580 |
-
//
|
581 |
|
582 |
/**
|
583 |
* Fired on plugin activation
|
@@ -603,7 +611,7 @@ class WP_reCaptcha {
|
|
603 |
delete_site_option( 'recaptcha_enable_wc_checkout' );
|
604 |
delete_site_option( 'recaptcha_disable_for_known_users' );
|
605 |
delete_site_option( 'recaptcha_lockout' );
|
606 |
-
|
607 |
foreach ( wp_get_sites() as $site) {
|
608 |
switch_to_blog( $site["blog_id"] );
|
609 |
delete_option( 'recaptcha_publickey' );
|
@@ -618,7 +626,7 @@ class WP_reCaptcha {
|
|
618 |
} else {
|
619 |
delete_option( 'recaptcha_publickey' );
|
620 |
delete_option( 'recaptcha_privatekey' );
|
621 |
-
|
622 |
delete_option( 'recaptcha_flavor' );
|
623 |
delete_option( 'recaptcha_theme' );
|
624 |
delete_option( 'recaptcha_language' );
|
@@ -630,10 +638,10 @@ class WP_reCaptcha {
|
|
630 |
delete_option( 'recaptcha_lockout' );
|
631 |
}
|
632 |
}
|
633 |
-
|
634 |
/**
|
635 |
* Get plugin option by name.
|
636 |
-
*
|
637 |
* @return bool true if plugin is activated on network
|
638 |
*/
|
639 |
static function is_network_activated() {
|
@@ -647,14 +655,14 @@ class WP_reCaptcha {
|
|
647 |
}
|
648 |
return self::$_is_network_activated;
|
649 |
}
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
|
654 |
//////////////////////////////////
|
655 |
// Language
|
656 |
-
//
|
657 |
-
|
658 |
/**
|
659 |
* Rewrite WP get_locale() to recaptcha lang param.
|
660 |
*
|
@@ -666,7 +674,7 @@ class WP_reCaptcha {
|
|
666 |
}
|
667 |
/**
|
668 |
* Get recaptcha language code that matches input language code
|
669 |
-
*
|
670 |
* @param $lang string language code
|
671 |
* @return string recaptcha language code if supported by current flavor, empty string otherwise
|
672 |
*/
|
@@ -682,7 +690,7 @@ class WP_reCaptcha {
|
|
682 |
function get_supported_languages( ) {
|
683 |
return $this->captcha_instance()->get_supported_languages();
|
684 |
}
|
685 |
-
|
686 |
}
|
687 |
|
688 |
/**
|
@@ -691,7 +699,7 @@ class WP_reCaptcha {
|
|
691 |
* @param string $classname
|
692 |
*/
|
693 |
function wp_recaptcha_integration_autoload( $classname ) {
|
694 |
-
$class_path = dirname(__FILE__). sprintf('/inc/class-%s.php' , strtolower( $classname ) ) ;
|
695 |
if ( file_exists($class_path) )
|
696 |
require_once $class_path;
|
697 |
}
|
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.9
|
7 |
Author: Jörn Lund
|
8 |
Author URI: https://github.com/mcguffin/
|
9 |
+
Text Domain: wp-recaptcha-integration
|
10 |
*/
|
11 |
|
12 |
/* Copyright 2014 Jörn Lund (email : joern AT podpirate DOT org)
|
13 |
|
14 |
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License, version 2, as
|
16 |
published by the Free Software Foundation.
|
17 |
|
18 |
This program is distributed in the hope that it will be useful,
|
38 |
|
39 |
private $last_error = '';
|
40 |
private $_last_result;
|
41 |
+
|
42 |
private $_counter = 0;
|
43 |
|
44 |
private $_captcha_instance = null;
|
45 |
+
|
46 |
/**
|
47 |
* Holding the singleton instance
|
48 |
*/
|
78 |
if ( WP_reCaptcha::is_network_activated() ) {
|
79 |
add_site_option('recaptcha_publickey',''); // 1st global -> then local
|
80 |
add_site_option('recaptcha_privatekey',''); // 1st global -> then local
|
81 |
+
|
82 |
add_site_option('recaptcha_enable_comments' , true); // global
|
83 |
add_site_option('recaptcha_enable_signup' , true); // global
|
84 |
add_site_option('recaptcha_enable_login' , false); // global
|
106 |
register_deactivation_hook( __FILE__ , array( __CLASS__ , 'deactivate' ) );
|
107 |
register_uninstall_hook( __FILE__ , array( __CLASS__ , 'uninstall' ) );
|
108 |
}
|
109 |
+
|
110 |
/**
|
111 |
* Load ninja/cf7 php files if necessary
|
112 |
* Hooks into 'plugins_loaded'
|
128 |
if ( function_exists('WC') || class_exists('WooCommerce') )
|
129 |
WP_reCaptcha_WooCommerce::instance();
|
130 |
|
131 |
+
if ( class_exists( 'Awesome_Support' ) )
|
132 |
+
WP_reCaptcha_Awesome_Support::instance();
|
133 |
+
|
134 |
+
if ( class_exists( 'bbPress' ) ) {
|
135 |
+
WP_reCaptcha_bbPress::instance();
|
136 |
+
}
|
137 |
+
|
138 |
}
|
139 |
}
|
140 |
/**
|
144 |
function init() {
|
145 |
load_plugin_textdomain( 'wp-recaptcha-integration', false , dirname( plugin_basename( __FILE__ ) ).'/languages/' );
|
146 |
$require_recaptcha = $this->is_required();
|
147 |
+
|
148 |
if ( $require_recaptcha ) {
|
149 |
add_action( 'wp_head' , array($this,'recaptcha_head') );
|
150 |
add_action( 'wp_footer' , array($this,'recaptcha_foot') );
|
151 |
+
|
152 |
if ( $this->get_option('recaptcha_enable_signup') || $this->get_option('recaptcha_enable_login') || $this->get_option('recaptcha_enable_lostpw') ) {
|
153 |
add_action( 'login_head' , array(&$this,'recaptcha_head') );
|
154 |
add_action( 'login_head' , array(&$this,'recaptcha_login_head') );
|
158 |
/*
|
159 |
add_filter('comment_form_defaults',array($this,'comment_form_defaults'),10);
|
160 |
/*/
|
161 |
+
// WP 4.2 introduced `comment_form_submit_button` filter
|
162 |
// which is much more likely to work
|
163 |
global $wp_version;
|
164 |
if ( version_compare( $wp_version , '4.2' ) >= 0 && $this->get_option('recaptcha_comment_use_42_filter') )
|
165 |
add_filter('comment_form_submit_button',array($this,'prepend_recaptcha_html'),10,2);
|
166 |
+
else
|
167 |
add_filter('comment_form_defaults',array($this,'comment_form_defaults'),10);
|
168 |
|
169 |
//*/
|
170 |
add_action('pre_comment_on_post',array($this,'recaptcha_check_or_die'));
|
171 |
+
|
172 |
add_action( 'print_comments_recaptcha' , array( &$this , 'print_recaptcha_html' ) );
|
173 |
add_filter( 'comments_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
174 |
}
|
186 |
add_filter('wpmu_validate_user_signup',array(&$this,'wpmu_validate_user_signup'));
|
187 |
}
|
188 |
add_filter( 'signup_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
189 |
+
|
190 |
}
|
191 |
if ( $this->get_option('recaptcha_enable_login') ) {
|
192 |
add_action('login_form',array(&$this,'print_recaptcha_html'));
|
202 |
//*/
|
203 |
add_filter( 'lostpassword_recaptcha_html' , array( &$this , 'recaptcha_html' ) );
|
204 |
}
|
205 |
+
if ( 'WPLANG' === $this->get_option( 'recaptcha_language' ) )
|
206 |
add_filter( 'wp_recaptcha_language' , array( &$this,'recaptcha_wplang' ) , 5 );
|
207 |
|
208 |
add_action( 'recaptcha_print' , array( &$this , 'print_recaptcha_html' ) );
|
211 |
}
|
212 |
add_filter( 'recaptcha_valid' , array( &$this , 'recaptcha_check' ) );
|
213 |
}
|
214 |
+
|
215 |
/**
|
216 |
* Set current captcha instance and return it.
|
217 |
+
*
|
218 |
* @return object WP_reCaptcha_Captcha
|
219 |
*/
|
220 |
public function captcha_instance() {
|
222 |
$this->_captcha_instance = $this->captcha_instance_by_flavor( $this->get_option( 'recaptcha_flavor' ) );
|
223 |
return $this->_captcha_instance;
|
224 |
}
|
225 |
+
|
226 |
/**
|
227 |
* Set current captcha instance and return it.
|
228 |
+
*
|
229 |
* @param string captcha flavor. 'grecaptcha' (noCaptcha) or 'recaptcha' (reCaptcha)
|
230 |
* @return object WP_reCaptcha_Captcha
|
231 |
*/
|
237 |
return WP_reCaptcha_ReCaptcha::instance();
|
238 |
}
|
239 |
}
|
240 |
+
|
241 |
/**
|
242 |
* returns if recaptcha is required.
|
243 |
*
|
247 |
$is_required = ! ( $this->get_option('recaptcha_disable_for_known_users') && current_user_can( 'read' ) );
|
248 |
return apply_filters( 'wp_recaptcha_required' , $is_required );
|
249 |
}
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
|
254 |
//////////////////////////////////
|
255 |
// Displaying
|
256 |
+
//
|
257 |
|
258 |
/**
|
259 |
* print recaptcha stylesheets
|
266 |
$this->end_inject( );
|
267 |
}
|
268 |
}
|
269 |
+
|
270 |
/**
|
271 |
* print recaptcha login form stylesheets
|
272 |
* hooks into `wp_head`
|
278 |
$this->end_inject( );
|
279 |
}
|
280 |
}
|
281 |
+
|
282 |
/**
|
283 |
* Print recaptcha scripts
|
284 |
* hooks into `wp_footer`
|
287 |
function recaptcha_foot( ) {
|
288 |
if ( apply_filters( 'wp_recaptcha_do_scripts' , true ) ) {
|
289 |
$this->begin_inject( );
|
290 |
+
|
291 |
// getting submit buttons of an elements form
|
292 |
+
if ( $this->get_option( 'recaptcha_disable_submit' ) ) {
|
293 |
?><script type="text/javascript">
|
294 |
function get_form_submits(el){
|
295 |
var form,current=el,ui,type,slice = Array.prototype.slice,self=this;
|
296 |
this.submits=[];
|
297 |
this.form=false;
|
298 |
+
|
299 |
this.setEnabled=function(e){
|
300 |
for ( var s=0;s<self.submits.length;s++ ) {
|
301 |
if (e) self.submits[s].removeAttribute('disabled');
|
306 |
while ( current && current.nodeName != 'BODY' && current.nodeName != 'FORM' ) {
|
307 |
current = current.parentNode;
|
308 |
}
|
309 |
+
if ( !current || current.nodeName != 'FORM' )
|
310 |
return false;
|
311 |
this.form=current;
|
312 |
ui=slice.call(this.form.getElementsByTagName('input')).concat(slice.call(this.form.getElementsByTagName('button')));
|
316 |
</script><?php
|
317 |
}
|
318 |
$this->captcha_instance()->print_foot();
|
319 |
+
|
320 |
$this->end_inject( );
|
321 |
}
|
322 |
}
|
323 |
+
|
324 |
/**
|
325 |
* Print recaptcha HTML. Use inside a form.
|
326 |
*
|
330 |
echo $this->recaptcha_html( $attr );
|
331 |
echo $this->end_inject( );
|
332 |
}
|
333 |
+
|
334 |
/**
|
335 |
* Get recaptcha HTML.
|
336 |
*
|
353 |
|
354 |
/**
|
355 |
* HTML comment with some notes (beginning)
|
356 |
+
*
|
357 |
* @param $return bool Whether to print or to return the comment
|
358 |
* @param $moretext string Additional information being included in the comment
|
359 |
* @return null|string HTML-Comment
|
365 |
}
|
366 |
/**
|
367 |
* HTML comment with some notes (ending)
|
368 |
+
*
|
369 |
* @param $return bool Whether to print or to return the comment
|
370 |
* @return null|string HTML-Comment
|
371 |
*/
|
374 |
if ( $return ) return $html;
|
375 |
echo $html;
|
376 |
}
|
377 |
+
|
378 |
/**
|
379 |
* Display recaptcha on comments form.
|
380 |
* filter function for `comment_form_defaults`
|
388 |
|
389 |
//////////////////////////////////
|
390 |
// Verification
|
391 |
+
//
|
392 |
|
393 |
/**
|
394 |
* Get last result of recaptcha check
|
397 |
function get_last_result() {
|
398 |
return $this->captcha_instance()->get_last_result();
|
399 |
}
|
400 |
+
|
401 |
/**
|
402 |
* Check recaptcha
|
403 |
*
|
408 |
return $this->captcha_instance()->check();
|
409 |
return true;
|
410 |
}
|
411 |
+
|
412 |
/**
|
413 |
* check recaptcha on login
|
414 |
* filter function for `wp_authenticate_user`
|
428 |
}
|
429 |
return $user;
|
430 |
}
|
431 |
+
|
432 |
/**
|
433 |
* check recaptcha on registration
|
434 |
* filter function for `registration_errors`
|
441 |
$errors = $this->wp_error_add( $errors );
|
442 |
return $errors;
|
443 |
}
|
444 |
+
|
445 |
/**
|
446 |
* check recaptcha WPMU signup
|
447 |
* filter function for `wpmu_validate_user_signup`
|
453 |
$result['errors'] = $this->wp_error_add( $result['errors'] , 'generic' );
|
454 |
return $result;
|
455 |
}
|
456 |
+
|
457 |
+
|
458 |
/**
|
459 |
* check recaptcha and return WP_Error on failure.
|
460 |
* filter function for `allow_password_reset`
|
483 |
return $param;
|
484 |
}
|
485 |
}
|
486 |
+
|
487 |
/**
|
488 |
* Check recaptcha and wp_die() on fail
|
489 |
* hooks into `pre_comment_on_post`, `lostpassword_post`
|
494 |
wp_die( $err );
|
495 |
}
|
496 |
}
|
497 |
+
|
498 |
+
|
499 |
//////////////////////////////////
|
500 |
// Options
|
501 |
+
//
|
502 |
|
503 |
/**
|
504 |
* Get plugin option by name.
|
505 |
+
*
|
506 |
* @param $option_name string
|
507 |
* @return bool false if check does not validate
|
508 |
*/
|
511 |
case 'recaptcha_publickey': // first try local, then global
|
512 |
case 'recaptcha_privatekey':
|
513 |
$option_value = get_option($option_name);
|
514 |
+
if ( ! $option_value && WP_reCaptcha::is_network_activated() )
|
515 |
$option_value = get_site_option( $option_name );
|
516 |
return $option_value;
|
517 |
case 'recaptcha_enable_comments': // global on network. else local
|
527 |
return get_option($option_name);
|
528 |
}
|
529 |
}
|
530 |
+
|
531 |
/**
|
532 |
* @return bool return if google api is configured
|
533 |
*/
|
534 |
function has_api_key() {
|
535 |
return $this->_has_api_key;
|
536 |
}
|
537 |
+
|
538 |
/**
|
539 |
* Test public and private key
|
540 |
*
|
544 |
// if ( ! ( $keys_okay = get_transient( 'recaptcha_keys_okay' ) ) ) {
|
545 |
$pub_okay = $this->test_public_key();
|
546 |
$prv_okay = $this->test_private_key();
|
547 |
+
|
548 |
// $keys_okay = ( $prv_okay && $pub_okay ) ? 'yes' : 'no';
|
549 |
+
|
550 |
//cache the result
|
551 |
// set_transient( 'recaptcha_keys_okay' , $keys_okay , 15 * MINUTE_IN_SECONDS );
|
552 |
// }
|
553 |
return $prv_okay && $pub_okay;
|
554 |
}
|
555 |
+
|
556 |
/**
|
557 |
* Test public key
|
558 |
*
|
581 |
$prv_rspbody = wp_remote_retrieve_body( $prv_response );
|
582 |
return ! is_wp_error( $prv_response ) && ! strpos(wp_remote_retrieve_body( $prv_response ),'invalid-site-private-key');
|
583 |
}
|
584 |
+
|
585 |
|
586 |
//////////////////////////////////
|
587 |
// Activation
|
588 |
+
//
|
589 |
|
590 |
/**
|
591 |
* Fired on plugin activation
|
611 |
delete_site_option( 'recaptcha_enable_wc_checkout' );
|
612 |
delete_site_option( 'recaptcha_disable_for_known_users' );
|
613 |
delete_site_option( 'recaptcha_lockout' );
|
614 |
+
|
615 |
foreach ( wp_get_sites() as $site) {
|
616 |
switch_to_blog( $site["blog_id"] );
|
617 |
delete_option( 'recaptcha_publickey' );
|
626 |
} else {
|
627 |
delete_option( 'recaptcha_publickey' );
|
628 |
delete_option( 'recaptcha_privatekey' );
|
629 |
+
|
630 |
delete_option( 'recaptcha_flavor' );
|
631 |
delete_option( 'recaptcha_theme' );
|
632 |
delete_option( 'recaptcha_language' );
|
638 |
delete_option( 'recaptcha_lockout' );
|
639 |
}
|
640 |
}
|
641 |
+
|
642 |
/**
|
643 |
* Get plugin option by name.
|
644 |
+
*
|
645 |
* @return bool true if plugin is activated on network
|
646 |
*/
|
647 |
static function is_network_activated() {
|
655 |
}
|
656 |
return self::$_is_network_activated;
|
657 |
}
|
658 |
+
|
659 |
+
|
660 |
+
|
661 |
|
662 |
//////////////////////////////////
|
663 |
// Language
|
664 |
+
//
|
665 |
+
|
666 |
/**
|
667 |
* Rewrite WP get_locale() to recaptcha lang param.
|
668 |
*
|
674 |
}
|
675 |
/**
|
676 |
* Get recaptcha language code that matches input language code
|
677 |
+
*
|
678 |
* @param $lang string language code
|
679 |
* @return string recaptcha language code if supported by current flavor, empty string otherwise
|
680 |
*/
|
690 |
function get_supported_languages( ) {
|
691 |
return $this->captcha_instance()->get_supported_languages();
|
692 |
}
|
693 |
+
|
694 |
}
|
695 |
|
696 |
/**
|
699 |
* @param string $classname
|
700 |
*/
|
701 |
function wp_recaptcha_integration_autoload( $classname ) {
|
702 |
+
$class_path = dirname(__FILE__). sprintf('/inc/class-%s.php' , strtolower( $classname ) ) ;
|
703 |
if ( file_exists($class_path) )
|
704 |
require_once $class_path;
|
705 |
}
|