WordPress ReCaptcha Integration - Version 1.0.4

Version Description

  • Add WooCommerce Support (checkout page)
  • Multisite: protect signup form as well.
  • Reset noCaptcha after ajax calls (enhance compatibility with Comment Form Ajax plugin)
  • Fix: incorrect redirect after saving Network settings
Download this release

Release Info

Developer podpirate
Plugin Icon 128x128 WordPress ReCaptcha Integration
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

css/recaptcha-options.css CHANGED
@@ -43,4 +43,7 @@
43
  .recaptcha-select-theme.flavor-grecaptcha .flavor-recaptcha,
44
  .recaptcha-select-theme.flavor-recaptcha .flavor-grecaptcha {
45
  display:none;
 
 
 
46
  }
43
  .recaptcha-select-theme.flavor-grecaptcha .flavor-recaptcha,
44
  .recaptcha-select-theme.flavor-recaptcha .flavor-grecaptcha {
45
  display:none;
46
+ }
47
+ .warning {
48
+ color:red;
49
  }
inc/class-wp-recaptcha-options.php CHANGED
@@ -59,6 +59,7 @@ class WP_reCaptcha_Options {
59
  'recaptcha_enable_signup' => 'intval',
60
  'recaptcha_enable_login' => 'intval',
61
  'recaptcha_enable_lostpw' => 'intval',
 
62
  'recaptcha_disable_for_known_users' => 'intval',
63
  );
64
  if ( array_intersect( array_keys( $_POST ) , array_keys( $opts ) ) )
@@ -75,7 +76,8 @@ class WP_reCaptcha_Options {
75
  }
76
  }
77
  if ( $updated ) {
78
- wp_redirect(add_query_arg('updated','true'));
 
79
  }
80
  } else {
81
  wp_die('Cheating, uh?');
@@ -219,6 +221,10 @@ class WP_reCaptcha_Options {
219
  register_setting( 'recaptcha_options', 'recaptcha_enable_signup', 'intval' );
220
  register_setting( 'recaptcha_options', 'recaptcha_enable_login' , 'intval');
221
  register_setting( 'recaptcha_options', 'recaptcha_enable_lostpw' , 'intval');
 
 
 
 
222
  register_setting( 'recaptcha_options', 'recaptcha_disable_for_known_users' , 'intval');
223
 
224
  add_settings_field('recaptcha_enable_comments', __('Protect Comments','wp-recaptcha-integration'),
@@ -240,7 +246,22 @@ class WP_reCaptcha_Options {
240
  array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
241
  array('name'=>'recaptcha_enable_lostpw','label'=>__( 'Protect Lost Password form with recaptcha.','wp-recaptcha-integration' ))
242
  );
243
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  add_settings_field('recaptcha_disable_for_known_users', __('Disable for known users','wp-recaptcha-integration'),
245
  array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
246
  array('name'=>'recaptcha_disable_for_known_users','label'=>__( 'Disable reCaptcha verification for logged in users.','wp-recaptcha-integration' ))
@@ -378,14 +399,24 @@ class WP_reCaptcha_Options {
378
  * )
379
  */
380
  public function input_checkbox($args) {
 
 
 
 
 
 
381
  extract($args);
382
  $value = WP_reCaptcha::instance()->get_option( $name );
383
- ?><label for="<?php echo $name ?>"><?php
 
384
  ?><input type="hidden" name="<?php echo $name ?>" value="0" /><?php
385
  ?><input id="<?php echo $name ?>" type="checkbox" name="<?php echo $name ?>" value="1" <?php checked($value,1,true) ?> />
386
  <?php
387
  echo $label;
388
  ?></label><?php
 
 
 
389
  }
390
  /**
391
  * A Text field.
59
  'recaptcha_enable_signup' => 'intval',
60
  'recaptcha_enable_login' => 'intval',
61
  'recaptcha_enable_lostpw' => 'intval',
62
+ 'recaptcha_enable_wc_order' => 'intval',
63
  'recaptcha_disable_for_known_users' => 'intval',
64
  );
65
  if ( array_intersect( array_keys( $_POST ) , array_keys( $opts ) ) )
76
  }
77
  }
78
  if ( $updated ) {
79
+ $redirect = $this->remove_new_apikey_url(add_query_arg(array('updated'=>'true') ) );
80
+ wp_redirect( $redirect );
81
  }
82
  } else {
83
  wp_die('Cheating, uh?');
221
  register_setting( 'recaptcha_options', 'recaptcha_enable_signup', 'intval' );
222
  register_setting( 'recaptcha_options', 'recaptcha_enable_login' , 'intval');
223
  register_setting( 'recaptcha_options', 'recaptcha_enable_lostpw' , 'intval');
224
+
225
+ if ( function_exists('WC') )
226
+ register_setting( 'recaptcha_options', 'recaptcha_enable_wc_order' , 'intval');
227
+
228
  register_setting( 'recaptcha_options', 'recaptcha_disable_for_known_users' , 'intval');
229
 
230
  add_settings_field('recaptcha_enable_comments', __('Protect Comments','wp-recaptcha-integration'),
246
  array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
247
  array('name'=>'recaptcha_enable_lostpw','label'=>__( 'Protect Lost Password form with recaptcha.','wp-recaptcha-integration' ))
248
  );
249
+ // woocommerce integration
250
+ if ( function_exists('WC') ) {
251
+ $wc_warn = WP_reCaptcha::instance()->get_option('recaptcha_enable_wc_order') && WP_reCaptcha::instance()->get_option('recaptcha_flavor') !== 'grecaptcha';
252
+ add_settings_field('recaptcha_enable_wc_order', __('Protect WooCommerce Checkout','wp-recaptcha-integration'),
253
+ array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
254
+ array(
255
+ 'name'=>'recaptcha_enable_wc_order',
256
+ 'label'=>__( 'Protect wooCommerce Checkout with a recaptcha.','wp-recaptcha-integration' ),
257
+ 'description' => __( 'This will only work with No Captcha flavor.','wp-recaptcha-integration' ),
258
+ 'class' => $wc_warn ? 'warning dashicons-before dashicons-no' : '',
259
+ )
260
+ );
261
+ if ( $wc_warn ) {
262
+ add_settings_error('recaptcha',2,__( 'The Old Style recaptcha doesn‘t work together with the WooCommerce checkout form. The Captcha will not be displayed,' ,'wp-recaptcha-integration' ) );
263
+ }
264
+ }
265
  add_settings_field('recaptcha_disable_for_known_users', __('Disable for known users','wp-recaptcha-integration'),
266
  array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
267
  array('name'=>'recaptcha_disable_for_known_users','label'=>__( 'Disable reCaptcha verification for logged in users.','wp-recaptcha-integration' ))
399
  * )
400
  */
401
  public function input_checkbox($args) {
402
+ $args = wp_parse_args($args,array(
403
+ 'name' => '',
404
+ 'label' => '',
405
+ 'description' => '',
406
+ 'class' => '',
407
+ ));
408
  extract($args);
409
  $value = WP_reCaptcha::instance()->get_option( $name );
410
+ $class_attr = $class ? "class=\"{$class}\"" : '';
411
+ ?><label <?php echo $class_attr ?> for="<?php echo $name ?>"><?php
412
  ?><input type="hidden" name="<?php echo $name ?>" value="0" /><?php
413
  ?><input id="<?php echo $name ?>" type="checkbox" name="<?php echo $name ?>" value="1" <?php checked($value,1,true) ?> />
414
  <?php
415
  echo $label;
416
  ?></label><?php
417
+ if ( $description ) {
418
+ ?><p class="description"><?php echo $description ?></p><?php
419
+ }
420
  }
421
  /**
422
  * A Text field.
inc/class-wp-recaptcha-woocommerce.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+ /**
6
+ * Class to manage WooCommerce Support
7
+ */
8
+ class WP_reCaptcha_WooCommerce {
9
+ /**
10
+ * Holding the singleton instance
11
+ */
12
+ private static $_instance = null;
13
+
14
+ /**
15
+ * @return WP_reCaptcha
16
+ */
17
+ public static function instance(){
18
+ if ( is_null( self::$_instance ) )
19
+ self::$_instance = new self();
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
+ * set hooks
38
+ */
39
+ function init() {
40
+ $wp_recaptcha = WP_reCaptcha::instance();
41
+ $require_recaptcha = $wp_recaptcha->is_required();
42
+
43
+ if ( $require_recaptcha ) {
44
+ // WooCommerce support
45
+ if ( $wp_recaptcha->get_option('recaptcha_flavor') == 'grecaptcha' && function_exists( 'wc_add_notice' ) ) {
46
+ if ( $wp_recaptcha->get_option('recaptcha_enable_wc_order') ) {
47
+ add_action('woocommerce_review_order_before_submit' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
48
+ add_action('woocommerce_checkout_process', array( &$this , 'recaptcha_check' ) );
49
+ }
50
+ if ( $wp_recaptcha->get_option('recaptcha_enable_login') ) {
51
+ add_action('woocommerce_login_form' , array($wp_recaptcha,'print_recaptcha_html'),10,0);
52
+ add_filter('woocommerce_process_login_errors', array( &$this , 'login_errors' ) , 10 , 3 );
53
+
54
+ }
55
+ if ( $wp_recaptcha->get_option('recaptcha_enable_signup') ) {
56
+ // displaying the captcha at hook 'registration_form' already done by core plugin
57
+ add_filter('woocommerce_registration_errors', array( &$this , 'login_errors' ) , 10 , 3 );
58
+ }
59
+ /*
60
+ LOSTPW: Not possible yet. Needs https://github.com/woothemes/woocommerce/pull/7029 being applied.
61
+ */
62
+ }
63
+ }
64
+ }
65
+ /**
66
+ * WooCommerce recaptcha Check
67
+ * hooks into action `woocommerce_checkout_process`
68
+ */
69
+ function recaptcha_check() {
70
+ if ( ! $this->recaptcha_check() )
71
+ wc_add_notice( __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration'), 'error' );
72
+ }
73
+
74
+ /**
75
+ * WooCommerce recaptcha Check
76
+ * hooks into actions `woocommerce_process_login_errors` and `woocommerce_registration_errors`
77
+ */
78
+ function login_errors( $validation_error ) {
79
+ if ( ! WP_reCaptcha::instance()->recaptcha_check() )
80
+ $validation_error->add( 'captcha_error' , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
81
+ return $validation_error;
82
+ }
83
+ }
84
+
85
+ WP_reCaptcha_WooCommerce::instance();
inc/ninja_forms_field_recaptcha.php CHANGED
@@ -61,8 +61,10 @@ function ninja_forms_recaptcha_script($id) {
61
  // reload recaptcha after failed ajax form submit
62
  (function($){
63
  $(document).on("submitResponse.default", function(e, response){
64
- var wid = $(\'#ninja_forms_form_\'+response.form_id).find(\'.g-recaptcha\').data(\'widget-id\');
65
- grecaptcha.reset(wid);
 
 
66
  });
67
  })(jQuery);
68
  </script>';
61
  // reload recaptcha after failed ajax form submit
62
  (function($){
63
  $(document).on("submitResponse.default", function(e, response){
64
+ if ( grecaptcha ) {
65
+ var wid = $(\'#ninja_forms_form_\'+response.form_id).find(\'.g-recaptcha\').data(\'widget-id\');
66
+ grecaptcha.reset(wid);
67
+ }
68
  });
69
  })(jQuery);
70
  </script>';
languages/wp-recaptcha-integration-de_DE.mo CHANGED
Binary file
languages/wp-recaptcha-integration-de_DE.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP reCaptcha Integration v1.0.3\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2014-12-31 12:41:25+0000\n"
7
  "Last-Translator: admin <joern@flyingletters.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -20,44 +20,42 @@ msgstr ""
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Textdomain-Support: yes"
22
 
23
- #: inc/ninja_forms_field_recaptcha.php:85
24
- #: wp-recaptcha-integration.php:196
25
- #: wp-recaptcha-integration.php:208
 
 
 
26
  #@ wp-recaptcha-integration
27
  msgid "<strong>Error:</strong> the Captcha didn’t verify."
28
  msgstr "<strong>Fehler:</strong> Sicherheitstest nicht bestanden"
29
 
30
- #: wp-recaptcha-integration.php:338
31
- #@ wp-recaptcha-integration
32
- msgid "Sorry, the Captcha didn’t verify."
33
- msgstr "Tut uns leid, aber Sie haben den Sicherheitstest nicht bestanden."
34
-
35
- #: wp-recaptcha-integration.php:412
36
  #@ wp-recaptcha-integration
37
  msgid "Incorrect please try again"
38
  msgstr "Falsch. Bitte noch einmal versuchen"
39
 
40
- #: wp-recaptcha-integration.php:414
41
  #@ wp-recaptcha-integration
42
  msgid "Enter the words above:"
43
  msgstr "Geben Sie die Wörten oben ein."
44
 
45
- #: wp-recaptcha-integration.php:415
46
  #@ wp-recaptcha-integration
47
  msgid "Enter the numbers you hear:"
48
  msgstr "Geben Sie die Zahlen ein, die Sie hören:"
49
 
50
- #: wp-recaptcha-integration.php:419
51
  #@ wp-recaptcha-integration
52
  msgid "Get another CAPTCHA"
53
  msgstr "Anderes CAPTCHA."
54
 
55
- #: wp-recaptcha-integration.php:420
56
  #@ wp-recaptcha-integration
57
  msgid "Get an audio CAPTCHA"
58
  msgstr "Audio CAPTCHA"
59
 
60
- #: wp-recaptcha-integration.php:421
61
  #@ wp-recaptcha-integration
62
  msgid "Get an image CAPTCHA"
63
  msgstr "Bild CAPTCHA"
@@ -88,7 +86,7 @@ msgstr ""
88
  msgid "The Captcha didn’t verify."
89
  msgstr "Sicherheitstest nicht bestanden"
90
 
91
- #: inc/class-wp-recaptcha-options.php:151
92
  #, php-format
93
  #@ wp-recaptcha-integration
94
  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>."
@@ -97,88 +95,88 @@ msgstr ""
97
  "braucht Deine Aufmerksamkeit:</strong> Damit das reCaptch funktioniert, mußt Du einen API-Schlüssel eintragen. <br />Zu den <a \n"
98
  "href=\"%s\">reCaptcha Einstellungen</a>."
99
 
100
- #: inc/class-wp-recaptcha-options.php:172
101
  #@ wp-recaptcha-integration
102
  msgid "Public Key"
103
  msgstr "Public Key"
104
 
105
- #: inc/class-wp-recaptcha-options.php:173
106
  #@ wp-recaptcha-integration
107
  msgid "Private Key"
108
  msgstr "Private Key"
109
 
110
- #: inc/class-wp-recaptcha-options.php:174
111
- #: inc/class-wp-recaptcha-options.php:180
112
  #@ wp-recaptcha-integration
113
  msgid "Connecting"
114
  msgstr "Verbindung"
115
 
116
- #: inc/class-wp-recaptcha-options.php:249
117
  #@ wp-recaptcha-integration
118
  msgid "Features"
119
  msgstr "Funktionen"
120
 
121
- #: inc/class-wp-recaptcha-options.php:192
122
  #@ wp-recaptcha-integration
123
  msgid "Flavor"
124
  msgstr "Geschmacksrichtung"
125
 
126
- #: inc/class-wp-recaptcha-options.php:203
127
  #@ wp-recaptcha-integration
128
  msgid "Old style reCAPTCHA where you type some cryptic text"
129
  msgstr "Klassisch, man muß kryptische Wörter eingeben"
130
 
131
- #: inc/class-wp-recaptcha-options.php:208
132
  #@ wp-recaptcha-integration
133
  msgid "Theme"
134
  msgstr "Theme"
135
 
136
- #: inc/class-wp-recaptcha-options.php:224
137
  #@ wp-recaptcha-integration
138
  msgid "Protect Comments"
139
  msgstr "Kommentare schützen"
140
 
141
- #: inc/class-wp-recaptcha-options.php:226
142
  #@ wp-recaptcha-integration
143
  msgid "Protect comment forms with recaptcha."
144
  msgstr "Das Kommentarformular mit einem reCaptcha schützen"
145
 
146
- #: inc/class-wp-recaptcha-options.php:229
147
  #@ wp-recaptcha-integration
148
  msgid "Protect Signup"
149
  msgstr "Registrierung schützen"
150
 
151
- #: inc/class-wp-recaptcha-options.php:231
152
  #@ wp-recaptcha-integration
153
  msgid "Protect signup form with recaptcha."
154
  msgstr "Die Registrierung mit einem reCaptcha schützen."
155
 
156
- #: inc/class-wp-recaptcha-options.php:234
157
  #@ wp-recaptcha-integration
158
  msgid "Protect Login"
159
  msgstr "Login schützen"
160
 
161
- #: inc/class-wp-recaptcha-options.php:236
162
  #@ wp-recaptcha-integration
163
  msgid "Protect Login form with recaptcha."
164
  msgstr "Das Anmeldeformular mit einem reCaptcha schützen"
165
 
166
- #: inc/class-wp-recaptcha-options.php:244
167
  #@ wp-recaptcha-integration
168
  msgid "Disable for known users"
169
  msgstr "Abschalten bei bekannten Benutzern"
170
 
171
- #: inc/class-wp-recaptcha-options.php:246
172
  #@ wp-recaptcha-integration
173
  msgid "Disable reCaptcha verification for logged in users."
174
  msgstr "Die reCaptcha-Verifizierung für eingeloggte Benutzer deaktivieren"
175
 
176
- #: inc/class-wp-recaptcha-options.php:252
177
  #@ wp-recaptcha-integration
178
  msgid "Please configure the public and private key. <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
179
  msgstr "Bitte konfigurieren Sie den privaten und den Öffentlichen Schlüssel (private &amp; public key). <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">Was willst Du mir damit zu sagen?</a>"
180
 
181
- #: inc/class-wp-recaptcha-options.php:265
182
  #, php-format
183
  #@ wp-recaptcha-integration
184
  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>"
@@ -187,145 +185,165 @@ msgstr ""
187
  "und trage unten den öffentlichen und privaten Schüssel ein. <a \n"
188
  "href=\"%s\">Was erzählst Du mir da?</a>"
189
 
190
- #: inc/class-wp-recaptcha-options.php:273
191
  #@ wp-recaptcha-integration
192
  msgid "You already entered an API Key. Use the button below to enter it again."
193
  msgstr "Du hast schon einen API-Schlüssel eingetragen. Klick den Button unten, um es nochmal zu tun."
194
 
195
- #: inc/class-wp-recaptcha-options.php:284
196
  #@ wp-recaptcha-integration
197
  msgid "New API Key"
198
  msgstr "Neuer API-Schlüssel"
199
 
200
- #: inc/class-wp-recaptcha-options.php:342
201
  #@ default
202
  msgid "Cancel"
203
  msgstr ""
204
 
205
- #: inc/class-wp-recaptcha-options.php:412
206
  #@ wp-recaptcha-integration
207
  msgid "Light"
208
  msgstr "Hell"
209
 
210
- #: inc/class-wp-recaptcha-options.php:416
211
  #@ wp-recaptcha-integration
212
  msgid "Dark"
213
  msgstr "Dunkel"
214
 
215
- #: inc/class-wp-recaptcha-options.php:421
216
  #@ wp-recaptcha-integration
217
  msgid "Red"
218
  msgstr "Rot"
219
 
220
- #: inc/class-wp-recaptcha-options.php:425
221
  #@ wp-recaptcha-integration
222
  msgid "White"
223
  msgstr "Weiß"
224
 
225
- #: inc/class-wp-recaptcha-options.php:429
226
  #@ wp-recaptcha-integration
227
  msgid "Black Glass"
228
  msgstr "Schwarzes Glas"
229
 
230
- #: inc/class-wp-recaptcha-options.php:433
231
  #@ wp-recaptcha-integration
232
  msgid "Clean"
233
  msgstr "Clean"
234
 
235
- #: inc/class-wp-recaptcha-options.php:437
236
  #@ wp-recaptcha-integration
237
  msgid "Custom"
238
  msgstr "Eigenes"
239
 
240
- #: inc/class-wp-recaptcha-options.php:457
241
  #@ wp-recaptcha-integration
242
  msgid "Unstyled HTML to apply your own Stylesheets."
243
  msgstr "Pures HTML für Deine eigenen Stylessheets"
244
 
245
- #: inc/class-wp-recaptcha-options.php:501
246
- #: inc/class-wp-recaptcha-options.php:525
247
  #@ wp-recaptcha-integration
248
  msgid "ReCaptcha"
249
  msgstr "ReCaptcha"
250
 
251
- #: inc/class-wp-recaptcha-options.php:523
252
  #@ default
253
  msgid "Settings"
254
  msgstr ""
255
 
256
- #: inc/class-wp-recaptcha-options.php:199
257
  #@ wp-recaptcha-integration
258
  msgid "No Captcha where you just click a button"
259
  msgstr "No Captcha. Einfach Checkbox anklicken."
260
 
261
- #: inc/class-wp-recaptcha-options.php:239
262
  #@ wp-recaptcha-integration
263
  msgid "Protect Lost Password"
264
  msgstr "Passwort verloren schützen"
265
 
266
- #: inc/class-wp-recaptcha-options.php:241
267
  #@ wp-recaptcha-integration
268
  msgid "Protect Lost Password form with recaptcha."
269
  msgstr "Das Passwort Verloren Formular mit einem reCaptcha schützen"
270
 
271
- #: inc/class-wp-recaptcha-options.php:92
272
- #: inc/class-wp-recaptcha-options.php:104
273
  #@ wp-recaptcha-integration
274
  msgid "reCaptcha Settings"
275
  msgstr "reCaptcha Einstellungen"
276
 
277
- #: inc/class-wp-recaptcha-options.php:93
278
  #@ wp-recaptcha-integration
279
  msgid "reCaptcha"
280
  msgstr "reCaptcha"
281
 
282
- #: inc/class-wp-recaptcha-options.php:285
283
  #@ wp-recaptcha-integration
284
  msgid "Test API Key"
285
  msgstr "API Schlüssel testen"
286
 
287
- #: inc/class-wp-recaptcha-options.php:305
288
  #@ wp-recaptcha-integration
289
  msgid "Test verfication"
290
  msgstr "Captcha-Prüfung testen"
291
 
292
- #: inc/class-wp-recaptcha-options.php:318
293
  #@ wp-recaptcha-integration
294
  msgid "The secret Key is missing."
295
  msgstr "Der geheime Schlüssel fehlt."
296
 
297
- #: inc/class-wp-recaptcha-options.php:319
298
  #@ wp-recaptcha-integration
299
  msgid "The secret Key is invalid. You better check your domain configuration and enter it again."
300
  msgstr "Der geheime Schlüssel ist ungültig. Am besten prüfst Du Deine Domain.-Konfiguration und trägst ihn nochmal ein."
301
 
302
- #: inc/class-wp-recaptcha-options.php:321
303
  #@ wp-recaptcha-integration
304
  msgid "Invalid user response"
305
  msgstr "Ungültige Antwort"
306
 
307
- #: inc/class-wp-recaptcha-options.php:330
308
  #@ wp-recaptcha-integration
309
  msgid "Works! All good!"
310
  msgstr "Läuft! Sehr gut."
311
 
312
- #: inc/class-wp-recaptcha-options.php:210
313
  #@ wp-recaptcha-integration
314
  msgid "Disable Submit Button"
315
  msgstr "Absendebutton deaktivieren"
316
 
317
- #: inc/class-wp-recaptcha-options.php:212
318
  #@ wp-recaptcha-integration
319
  msgid "Disable Form Submit Button until no-captcha is entered."
320
  msgstr "Den Absendenbutton deaktivieren, bis das Captcha gelöst wurde."
321
 
322
- #: wp-recaptcha-integration.php:399
323
  #@ wp-recaptcha-integration
324
  msgid "Please enable JavaScript to submit this form."
325
  msgstr "Bitte aktiveren Sie JavaScript, um dieses Formular abschicken zu können."
326
 
327
- #: inc/class-wp-recaptcha-options.php:320
328
  #@ wp-recaptcha-integration
329
  msgid "The user response was missing"
330
  msgstr "Fehlende Antwort"
331
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: WP reCaptcha Integration v1.0.4\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2015-01-01 20:09:44+0000\n"
7
  "Last-Translator: admin <joern@flyingletters.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
  "X-Textdomain-Support: yes"
22
 
23
+ #: inc/class-wp-recaptcha-woocommerce.php:71
24
+ #: inc/class-wp-recaptcha-woocommerce.php:80
25
+ #: inc/ninja_forms_field_recaptcha.php:87
26
+ #: wp-recaptcha-integration.php:260
27
+ #: wp-recaptcha-integration.php:274
28
+ #: wp-recaptcha-integration.php:286
29
  #@ wp-recaptcha-integration
30
  msgid "<strong>Error:</strong> the Captcha didn’t verify."
31
  msgstr "<strong>Fehler:</strong> Sicherheitstest nicht bestanden"
32
 
33
+ #: wp-recaptcha-integration.php:502
 
 
 
 
 
34
  #@ wp-recaptcha-integration
35
  msgid "Incorrect please try again"
36
  msgstr "Falsch. Bitte noch einmal versuchen"
37
 
38
+ #: wp-recaptcha-integration.php:504
39
  #@ wp-recaptcha-integration
40
  msgid "Enter the words above:"
41
  msgstr "Geben Sie die Wörten oben ein."
42
 
43
+ #: wp-recaptcha-integration.php:505
44
  #@ wp-recaptcha-integration
45
  msgid "Enter the numbers you hear:"
46
  msgstr "Geben Sie die Zahlen ein, die Sie hören:"
47
 
48
+ #: wp-recaptcha-integration.php:509
49
  #@ wp-recaptcha-integration
50
  msgid "Get another CAPTCHA"
51
  msgstr "Anderes CAPTCHA."
52
 
53
+ #: wp-recaptcha-integration.php:510
54
  #@ wp-recaptcha-integration
55
  msgid "Get an audio CAPTCHA"
56
  msgstr "Audio CAPTCHA"
57
 
58
+ #: wp-recaptcha-integration.php:511
59
  #@ wp-recaptcha-integration
60
  msgid "Get an image CAPTCHA"
61
  msgstr "Bild CAPTCHA"
86
  msgid "The Captcha didn’t verify."
87
  msgstr "Sicherheitstest nicht bestanden"
88
 
89
+ #: inc/class-wp-recaptcha-options.php:152
90
  #, php-format
91
  #@ wp-recaptcha-integration
92
  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>."
95
  "braucht Deine Aufmerksamkeit:</strong> Damit das reCaptch funktioniert, mußt Du einen API-Schlüssel eintragen. <br />Zu den <a \n"
96
  "href=\"%s\">reCaptcha Einstellungen</a>."
97
 
98
+ #: inc/class-wp-recaptcha-options.php:173
99
  #@ wp-recaptcha-integration
100
  msgid "Public Key"
101
  msgstr "Public Key"
102
 
103
+ #: inc/class-wp-recaptcha-options.php:174
104
  #@ wp-recaptcha-integration
105
  msgid "Private Key"
106
  msgstr "Private Key"
107
 
108
+ #: inc/class-wp-recaptcha-options.php:175
109
+ #: inc/class-wp-recaptcha-options.php:181
110
  #@ wp-recaptcha-integration
111
  msgid "Connecting"
112
  msgstr "Verbindung"
113
 
114
+ #: inc/class-wp-recaptcha-options.php:269
115
  #@ wp-recaptcha-integration
116
  msgid "Features"
117
  msgstr "Funktionen"
118
 
119
+ #: inc/class-wp-recaptcha-options.php:193
120
  #@ wp-recaptcha-integration
121
  msgid "Flavor"
122
  msgstr "Geschmacksrichtung"
123
 
124
+ #: inc/class-wp-recaptcha-options.php:204
125
  #@ wp-recaptcha-integration
126
  msgid "Old style reCAPTCHA where you type some cryptic text"
127
  msgstr "Klassisch, man muß kryptische Wörter eingeben"
128
 
129
+ #: inc/class-wp-recaptcha-options.php:209
130
  #@ wp-recaptcha-integration
131
  msgid "Theme"
132
  msgstr "Theme"
133
 
134
+ #: inc/class-wp-recaptcha-options.php:229
135
  #@ wp-recaptcha-integration
136
  msgid "Protect Comments"
137
  msgstr "Kommentare schützen"
138
 
139
+ #: inc/class-wp-recaptcha-options.php:231
140
  #@ wp-recaptcha-integration
141
  msgid "Protect comment forms with recaptcha."
142
  msgstr "Das Kommentarformular mit einem reCaptcha schützen"
143
 
144
+ #: inc/class-wp-recaptcha-options.php:234
145
  #@ wp-recaptcha-integration
146
  msgid "Protect Signup"
147
  msgstr "Registrierung schützen"
148
 
149
+ #: inc/class-wp-recaptcha-options.php:236
150
  #@ wp-recaptcha-integration
151
  msgid "Protect signup form with recaptcha."
152
  msgstr "Die Registrierung mit einem reCaptcha schützen."
153
 
154
+ #: inc/class-wp-recaptcha-options.php:239
155
  #@ wp-recaptcha-integration
156
  msgid "Protect Login"
157
  msgstr "Login schützen"
158
 
159
+ #: inc/class-wp-recaptcha-options.php:241
160
  #@ wp-recaptcha-integration
161
  msgid "Protect Login form with recaptcha."
162
  msgstr "Das Anmeldeformular mit einem reCaptcha schützen"
163
 
164
+ #: inc/class-wp-recaptcha-options.php:264
165
  #@ wp-recaptcha-integration
166
  msgid "Disable for known users"
167
  msgstr "Abschalten bei bekannten Benutzern"
168
 
169
+ #: inc/class-wp-recaptcha-options.php:266
170
  #@ wp-recaptcha-integration
171
  msgid "Disable reCaptcha verification for logged in users."
172
  msgstr "Die reCaptcha-Verifizierung für eingeloggte Benutzer deaktivieren"
173
 
174
+ #: inc/class-wp-recaptcha-options.php:272
175
  #@ wp-recaptcha-integration
176
  msgid "Please configure the public and private key. <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
177
  msgstr "Bitte konfigurieren Sie den privaten und den Öffentlichen Schlüssel (private &amp; public key). <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">Was willst Du mir damit zu sagen?</a>"
178
 
179
+ #: inc/class-wp-recaptcha-options.php:285
180
  #, php-format
181
  #@ wp-recaptcha-integration
182
  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>"
185
  "und trage unten den öffentlichen und privaten Schüssel ein. <a \n"
186
  "href=\"%s\">Was erzählst Du mir da?</a>"
187
 
188
+ #: inc/class-wp-recaptcha-options.php:293
189
  #@ wp-recaptcha-integration
190
  msgid "You already entered an API Key. Use the button below to enter it again."
191
  msgstr "Du hast schon einen API-Schlüssel eingetragen. Klick den Button unten, um es nochmal zu tun."
192
 
193
+ #: inc/class-wp-recaptcha-options.php:304
194
  #@ wp-recaptcha-integration
195
  msgid "New API Key"
196
  msgstr "Neuer API-Schlüssel"
197
 
198
+ #: inc/class-wp-recaptcha-options.php:362
199
  #@ default
200
  msgid "Cancel"
201
  msgstr ""
202
 
203
+ #: inc/class-wp-recaptcha-options.php:442
204
  #@ wp-recaptcha-integration
205
  msgid "Light"
206
  msgstr "Hell"
207
 
208
+ #: inc/class-wp-recaptcha-options.php:446
209
  #@ wp-recaptcha-integration
210
  msgid "Dark"
211
  msgstr "Dunkel"
212
 
213
+ #: inc/class-wp-recaptcha-options.php:451
214
  #@ wp-recaptcha-integration
215
  msgid "Red"
216
  msgstr "Rot"
217
 
218
+ #: inc/class-wp-recaptcha-options.php:455
219
  #@ wp-recaptcha-integration
220
  msgid "White"
221
  msgstr "Weiß"
222
 
223
+ #: inc/class-wp-recaptcha-options.php:459
224
  #@ wp-recaptcha-integration
225
  msgid "Black Glass"
226
  msgstr "Schwarzes Glas"
227
 
228
+ #: inc/class-wp-recaptcha-options.php:463
229
  #@ wp-recaptcha-integration
230
  msgid "Clean"
231
  msgstr "Clean"
232
 
233
+ #: inc/class-wp-recaptcha-options.php:467
234
  #@ wp-recaptcha-integration
235
  msgid "Custom"
236
  msgstr "Eigenes"
237
 
238
+ #: inc/class-wp-recaptcha-options.php:487
239
  #@ wp-recaptcha-integration
240
  msgid "Unstyled HTML to apply your own Stylesheets."
241
  msgstr "Pures HTML für Deine eigenen Stylessheets"
242
 
243
+ #: inc/class-wp-recaptcha-options.php:531
244
+ #: inc/class-wp-recaptcha-options.php:555
245
  #@ wp-recaptcha-integration
246
  msgid "ReCaptcha"
247
  msgstr "ReCaptcha"
248
 
249
+ #: inc/class-wp-recaptcha-options.php:553
250
  #@ default
251
  msgid "Settings"
252
  msgstr ""
253
 
254
+ #: inc/class-wp-recaptcha-options.php:200
255
  #@ wp-recaptcha-integration
256
  msgid "No Captcha where you just click a button"
257
  msgstr "No Captcha. Einfach Checkbox anklicken."
258
 
259
+ #: inc/class-wp-recaptcha-options.php:244
260
  #@ wp-recaptcha-integration
261
  msgid "Protect Lost Password"
262
  msgstr "Passwort verloren schützen"
263
 
264
+ #: inc/class-wp-recaptcha-options.php:246
265
  #@ wp-recaptcha-integration
266
  msgid "Protect Lost Password form with recaptcha."
267
  msgstr "Das Passwort Verloren Formular mit einem reCaptcha schützen"
268
 
269
+ #: inc/class-wp-recaptcha-options.php:93
270
+ #: inc/class-wp-recaptcha-options.php:105
271
  #@ wp-recaptcha-integration
272
  msgid "reCaptcha Settings"
273
  msgstr "reCaptcha Einstellungen"
274
 
275
+ #: inc/class-wp-recaptcha-options.php:94
276
  #@ wp-recaptcha-integration
277
  msgid "reCaptcha"
278
  msgstr "reCaptcha"
279
 
280
+ #: inc/class-wp-recaptcha-options.php:305
281
  #@ wp-recaptcha-integration
282
  msgid "Test API Key"
283
  msgstr "API Schlüssel testen"
284
 
285
+ #: inc/class-wp-recaptcha-options.php:325
286
  #@ wp-recaptcha-integration
287
  msgid "Test verfication"
288
  msgstr "Captcha-Prüfung testen"
289
 
290
+ #: inc/class-wp-recaptcha-options.php:338
291
  #@ wp-recaptcha-integration
292
  msgid "The secret Key is missing."
293
  msgstr "Der geheime Schlüssel fehlt."
294
 
295
+ #: inc/class-wp-recaptcha-options.php:339
296
  #@ wp-recaptcha-integration
297
  msgid "The secret Key is invalid. You better check your domain configuration and enter it again."
298
  msgstr "Der geheime Schlüssel ist ungültig. Am besten prüfst Du Deine Domain.-Konfiguration und trägst ihn nochmal ein."
299
 
300
+ #: inc/class-wp-recaptcha-options.php:341
301
  #@ wp-recaptcha-integration
302
  msgid "Invalid user response"
303
  msgstr "Ungültige Antwort"
304
 
305
+ #: inc/class-wp-recaptcha-options.php:350
306
  #@ wp-recaptcha-integration
307
  msgid "Works! All good!"
308
  msgstr "Läuft! Sehr gut."
309
 
310
+ #: inc/class-wp-recaptcha-options.php:211
311
  #@ wp-recaptcha-integration
312
  msgid "Disable Submit Button"
313
  msgstr "Absendebutton deaktivieren"
314
 
315
+ #: inc/class-wp-recaptcha-options.php:213
316
  #@ wp-recaptcha-integration
317
  msgid "Disable Form Submit Button until no-captcha is entered."
318
  msgstr "Den Absendenbutton deaktivieren, bis das Captcha gelöst wurde."
319
 
320
+ #: wp-recaptcha-integration.php:489
321
  #@ wp-recaptcha-integration
322
  msgid "Please enable JavaScript to submit this form."
323
  msgstr "Bitte aktiveren Sie JavaScript, um dieses Formular abschicken zu können."
324
 
325
+ #: inc/class-wp-recaptcha-options.php:340
326
  #@ wp-recaptcha-integration
327
  msgid "The user response was missing"
328
  msgstr "Fehlende Antwort"
329
 
330
+ #: inc/class-wp-recaptcha-options.php:251
331
+ #@ wp-recaptcha-integration
332
+ msgid "Protect WooCommerce Checkout"
333
+ msgstr "WooCommerce Kasse schützen"
334
+
335
+ #: inc/class-wp-recaptcha-options.php:255
336
+ #@ wp-recaptcha-integration
337
+ msgid "Protect wooCommerce Checkout with a recaptcha."
338
+ msgstr "Die WooCommerce Kasse mit einem Captcha schützen."
339
+
340
+ #: inc/class-wp-recaptcha-options.php:256
341
+ #@ wp-recaptcha-integration
342
+ msgid "This will only work with No Captcha flavor."
343
+ msgstr "Das wird nur zusammen mit dem neuen No Captcha funktionieren."
344
+
345
+ #: inc/class-wp-recaptcha-options.php:261
346
+ #@ wp-recaptcha-integration
347
+ msgid "The Old Style recaptcha doesn‘t work together with the WooCommerce checkout form. The Captcha will not be displayed,"
348
+ msgstr "Das alte reCaptcha funkctioneirt nicht zusammen mit dem WooCommerce Kassenformular. Das Captcha wird nicht angezeigt."
349
+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: security, captcha, recaptcha, no captcha, login, signup, contact form 7, ninja forms
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
- Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -21,14 +21,15 @@ form 7 as well as a plugin API for your own integrations.
21
  - Supports old as well as new reCaptcha.
22
  - Multisite Support
23
  - BuddyPress Support
 
24
  - [Ninja Forms](http://ninjaforms.com/) integration
25
  - [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) integration
26
 
27
  Latest Files on GitHub: [https://github.com/mcguffin/wp-recaptcha-integration](https://github.com/mcguffin/wp-recaptcha-integration)
28
 
29
- = Multisite support =
30
 
31
- On a WP Multisite support you can either activate the plugin network wide or on a single site.
32
 
33
  Activated on a single site everything works as usual.
34
 
@@ -41,12 +42,18 @@ if necessary.
41
  - You can't have more than one old style reCaptcha on a page. This is a limitiation of
42
  reCaptcha itself. If that's an issue for you, you should use the no Captcha Form.
43
 
44
- - On a Contact Form 7 when the reCaptcha is disabled (e.g. for logged in users) the field
45
  label will be still visible. This is due to CF7 Shortcode architecture, and can't be fixed.
46
 
47
  To handle this there is a filter `recaptcha_disabled_html`. You can return a message for your logged-in
48
  users here. Check out the [GitHub Repo](https://github.com/mcguffin/wp-recaptcha-integration) for details.
49
 
 
 
 
 
 
 
50
  == Installation ==
51
 
52
  First follow the standard [WordPress plugin installation procedere](http://codex.wordpress.org/Managing_Plugins).
@@ -61,6 +68,23 @@ On the plugin settings page check out if the option “Disable for known users
61
  Then log out (or open your page in a private browser window) and try again.
62
  If the problem still persist, Houson really has a problem, and you are welcome to post a support request.
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  = I found a bug. Where should I post it? =
65
 
66
  I personally prefer GitHub but you can post it in the forum as well. The plugin code is here: [GitHub](https://github.com/mcguffin/wp-recaptcha-integration)
@@ -103,6 +127,12 @@ I will migrate all the translation stuff there.
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
 
106
  = 1.0.3 =
107
  - Add BuddyPress support
108
  - Action hook for wp_recaptcha_checked
4
  Tags: security, captcha, recaptcha, no captcha, login, signup, contact form 7, ninja forms
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
21
  - Supports old as well as new reCaptcha.
22
  - Multisite Support
23
  - BuddyPress Support
24
+ - WooCommerce Support (Only checkout, registration and login form. Not password reset)
25
  - [Ninja Forms](http://ninjaforms.com/) integration
26
  - [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) integration
27
 
28
  Latest Files on GitHub: [https://github.com/mcguffin/wp-recaptcha-integration](https://github.com/mcguffin/wp-recaptcha-integration)
29
 
30
+ = Compatibility =
31
 
32
+ On a **WP Multisite** you can either activate the plugin network wide or on a single site.
33
 
34
  Activated on a single site everything works as usual.
35
 
42
  - You can't have more than one old style reCaptcha on a page. This is a limitiation of
43
  reCaptcha itself. If that's an issue for you, you should use the no Captcha Form.
44
 
45
+ - On a **Contact Form 7** when the reCaptcha is disabled (e.g. for logged in users) the field
46
  label will be still visible. This is due to CF7 Shortcode architecture, and can't be fixed.
47
 
48
  To handle this there is a filter `recaptcha_disabled_html`. You can return a message for your logged-in
49
  users here. Check out the [GitHub Repo](https://github.com/mcguffin/wp-recaptcha-integration) for details.
50
 
51
+ - Old style reCaptchas do not work together with **WooCommerce**.
52
+
53
+ - In **WooCommerce** the reset password form can not be protected by a captcha. To
54
+ overcome this restriction I requested a little change in the official WC repository, so there
55
+ is hope for a future version. See: (https://github.com/woothemes/woocommerce/pull/7029)
56
+
57
  == Installation ==
58
 
59
  First follow the standard [WordPress plugin installation procedere](http://codex.wordpress.org/Managing_Plugins).
68
  Then log out (or open your page in a private browser window) and try again.
69
  If the problem still persist, Houson really has a problem, and you are welcome to post a support request.
70
 
71
+ = Disabled submit buttons should be grey! Why aren't they? =
72
+
73
+ Very likely the Author of your Theme didn't care that a non functinal form element should
74
+ look different than a functional one. This how you can overcome that issue:
75
+
76
+ - Go to (https://gist.github.com/mcguffin/7cbfb0dab73eb32cb4a2)
77
+ - Click the "Download Gist" button
78
+ - Unpack the `.tar.gz` file.
79
+ - Create a zip Archive out of the included file `grey-out-disabled.php` and name it `grey-out-disabled.zip`.
80
+ - Install and activate it like any other WordPress plugin
81
+
82
+ = I want my visitors to solve only one Captcha and then never again. Is that possible? =
83
+
84
+ Yes. You can store in a session if a captcha was solved, and use the `wp_recaptcha_required`
85
+ filter to supress further captchas. See (https://github.com/mcguffin/wp-recaptcha-integration#real-world-example)
86
+ for a code example.
87
+
88
  = I found a bug. Where should I post it? =
89
 
90
  I personally prefer GitHub but you can post it in the forum as well. The plugin code is here: [GitHub](https://github.com/mcguffin/wp-recaptcha-integration)
127
 
128
  == Changelog ==
129
 
130
+ = 1.0.4 =
131
+ - Add WooCommerce Support (checkout page)
132
+ - Multisite: protect signup form as well.
133
+ - Reset noCaptcha after ajax calls (enhance compatibility with Comment Form Ajax plugin)
134
+ - Fix: incorrect redirect after saving Network settings
135
+
136
  = 1.0.3 =
137
  - Add BuddyPress support
138
  - Action hook for wp_recaptcha_checked
wp-recaptcha-integration.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
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 stle reCaptcha. Provides of the box integration for signup, login, comment forms, lost password, Ninja Forms and contact form 7.
6
- Version: 1.0.3
7
  Author: Jörn Lund
8
  Author URI: https://github.com/mcguffin/
9
  */
@@ -90,7 +90,7 @@ class WP_reCaptcha {
90
 
91
  if ( $this->_has_api_key ) {
92
 
93
- add_action('init' , array(&$this,'init') );
94
  add_action('plugins_loaded' , array(&$this,'plugins_loaded') );
95
 
96
  }
@@ -114,13 +114,21 @@ class WP_reCaptcha {
114
  */
115
  function plugins_loaded() {
116
  if ( $this->_has_api_key ) {
 
117
  // check if ninja forms is present
118
  if ( class_exists('Ninja_Forms') || function_exists('ninja_forms_register_field') )
119
  include_once dirname(__FILE__).'/inc/ninja_forms_field_recaptcha.php';
120
 
 
121
  // check if contact form 7 forms is present
122
  if ( function_exists('wpcf7') )
123
  include_once dirname(__FILE__).'/inc/contact_form_7_recaptcha.php';
 
 
 
 
 
 
124
  }
125
  }
126
  /**
@@ -155,8 +163,13 @@ class WP_reCaptcha {
155
  add_filter('bp_signup_pre_validate',array(&$this,'recaptcha_check_or_die'),99 );
156
  } else {
157
  add_action('register_form',array($this,'print_recaptcha_html'),10,0);
158
- add_filter('registration_errors',array(&$this,'login_errors'));
 
 
 
 
159
  }
 
160
  }
161
  if ( $this->get_option('recaptcha_enable_login') ) {
162
  add_action('login_form',array($this,'print_recaptcha_html'),10,0);
@@ -164,14 +177,20 @@ class WP_reCaptcha {
164
  }
165
  if ( $this->get_option('recaptcha_enable_lostpw') ) {
166
  add_action('lostpassword_form' , array($this,'print_recaptcha_html'),10,0);
167
- add_filter('lostpassword_post' , array(&$this,'recaptcha_check_or_die'),99 );
 
 
 
 
168
  }
169
  }
170
  }
 
171
  /**
172
  * Display recaptcha on comments form.
173
  * filter function for `comment_form_defaults`
174
- * set hooks
 
175
  */
176
  function comment_form_defaults( $defaults ) {
177
  $defaults['comment_notes_after'] .= '<p>' . $this->recaptcha_html() . '</p>';
@@ -179,6 +198,7 @@ class WP_reCaptcha {
179
  }
180
  /**
181
  * returns if recaptcha is required.
 
182
  * @return bool
183
  */
184
  function is_required() {
@@ -186,29 +206,87 @@ class WP_reCaptcha {
186
  return apply_filters( 'wp_recaptcha_required' , $is_required );
187
  }
188
 
 
 
189
  /**
190
  * check recaptcha on login
191
  * filter function for `wp_authenticate_user`
192
- * @return object user or wp error
 
 
193
  */
194
  function deny_login( $user ) {
195
- if ( isset( $_POST["log"] ) && ! $this->recaptcha_check() ) {
196
- return new WP_Error( 'captcha_error' , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
197
- } else {
198
- return $user;
199
- }
200
  }
 
201
  /**
202
  * check recaptcha on registration
203
  * filter function for `registration_errors`
204
- * @return object errors
 
 
205
  */
206
- function login_errors( $errors ) {
207
- if ( isset( $_POST["log"] ) && ! $this->recaptcha_check() ) {
208
- $errors->add( 'captcha_error' , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
209
- }
210
  return $errors;
211
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
  /**
214
  * print recaptcha stylesheets
@@ -246,9 +324,12 @@ class WP_reCaptcha {
246
  }
247
  $this->end_inject( );
248
  }
 
249
  /**
250
  * Print recaptcha scripts
251
  * hooks into `wp_footer`
 
 
252
  */
253
  function recaptcha_foot( $flavor = '' ) {
254
  if ( empty( $flavor ) )
@@ -287,26 +368,41 @@ class WP_reCaptcha {
287
  ?><script type="text/javascript">
288
  var recaptcha_widgets={};
289
  function recaptchaLoadCallback(){
 
 
 
 
 
290
  var e=document.getElementsByClassName('g-recaptcha'),form_submits;
291
-
292
  for (var i=0;i<e.length;i++) {
293
  (function(el){
294
  <?php if ( $this->get_option( 'recaptcha_disable_submit' ) ) { ?>
295
  var form_submits = get_form_submits(el).setEnabled(false),wid;
296
  <?php } ?>
297
-
298
- wid = grecaptcha.render(el,{
299
- 'sitekey':'<?php echo $this->get_option('recaptcha_publickey'); ?>',
300
- 'theme':'<?php echo $this->get_option('recaptcha_theme'); ?>'
 
301
  <?php if ( $this->get_option( 'recaptcha_disable_submit' ) ) { ?>
302
- ,
303
- 'callback' : function(r){ get_form_submits(el).setEnabled(true); /* enable submit buttons */ }
304
  <?php } ?>
305
- });
306
- el.setAttribute('data-widget-id',wid);
 
 
 
 
307
  })(e[i]);
308
  }
309
  }
 
 
 
 
 
310
  </script><?php
311
  ?><script src="https://www.google.com/recaptcha/api.js?onload=recaptchaLoadCallback&render=explicit" async defer></script><?php
312
  break;
@@ -329,19 +425,10 @@ class WP_reCaptcha {
329
  }
330
  $this->end_inject( );
331
  }
332
- /**
333
- * Check recaptcha and wp_die() on fail
334
- * hooks into `pre_comment_on_post`, `lostpassword_post`
335
- */
336
- function recaptcha_check_or_die( ) {
337
- if ( ! $this->recaptcha_check() ) {
338
- $err = new WP_Error('comment_err', __("Sorry, the Captcha didn’t verify.",'wp-recaptcha-integration') );
339
- wp_die( $err );
340
- }
341
- }
342
-
343
  /**
344
  * Print recaptcha HTML. Use inside a form.
 
 
345
  */
346
  function print_recaptcha_html( $flavor = '' ) {
347
  echo $this->recaptcha_html( $flavor );
@@ -349,6 +436,8 @@ class WP_reCaptcha {
349
 
350
  /**
351
  * Get recaptcha HTML.
 
 
352
  * @return string recaptcha html
353
  */
354
  function recaptcha_html( $flavor = '' ) {
@@ -444,6 +533,8 @@ class WP_reCaptcha {
444
 
445
  /**
446
  * Check recaptcha
 
 
447
  * @return bool false if check does not validate
448
  */
449
  function recaptcha_check( $flavor = '' ) {
@@ -462,6 +553,7 @@ class WP_reCaptcha {
462
  }
463
  /**
464
  * Check no captcha
 
465
  * @return bool false if check does not validate
466
  */
467
  function grecaptcha_check() {
@@ -482,6 +574,7 @@ class WP_reCaptcha {
482
  }
483
  /**
484
  * Check old style recaptcha
 
485
  * @return bool false if check does not validate
486
  */
487
  function old_recaptcha_check() {
@@ -518,6 +611,7 @@ class WP_reCaptcha {
518
  case 'recaptcha_enable_login':
519
  case 'recaptcha_enable_lostpw':
520
  case 'recaptcha_disable_for_known_users':
 
521
  if ( WP_reCaptcha::is_network_activated() )
522
  return get_site_option($option_name);
523
  return get_option( $option_name );
@@ -547,6 +641,7 @@ class WP_reCaptcha {
547
  delete_site_option( 'recaptcha_enable_comments' );
548
  delete_site_option( 'recaptcha_enable_signup' );
549
  delete_site_option( 'recaptcha_enable_login' );
 
550
  delete_site_option( 'recaptcha_disable_for_known_users' );
551
 
552
  foreach ( wp_get_sites() as $site) {
@@ -566,6 +661,7 @@ class WP_reCaptcha {
566
  delete_option( 'recaptcha_enable_comments' );
567
  delete_option( 'recaptcha_enable_signup' );
568
  delete_option( 'recaptcha_enable_login' );
 
569
  delete_option( 'recaptcha_disable_for_known_users' );
570
  }
571
  }
2
  /*
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.0.4
7
  Author: Jörn Lund
8
  Author URI: https://github.com/mcguffin/
9
  */
90
 
91
  if ( $this->_has_api_key ) {
92
 
93
+ add_action('init' , array(&$this,'init') , 9 );
94
  add_action('plugins_loaded' , array(&$this,'plugins_loaded') );
95
 
96
  }
114
  */
115
  function plugins_loaded() {
116
  if ( $this->_has_api_key ) {
117
+ // NinjaForms support
118
  // check if ninja forms is present
119
  if ( class_exists('Ninja_Forms') || function_exists('ninja_forms_register_field') )
120
  include_once dirname(__FILE__).'/inc/ninja_forms_field_recaptcha.php';
121
 
122
+ // CF7 support
123
  // check if contact form 7 forms is present
124
  if ( function_exists('wpcf7') )
125
  include_once dirname(__FILE__).'/inc/contact_form_7_recaptcha.php';
126
+
127
+ // WooCommerce support
128
+ // check if contact form 7 forms is present
129
+ if ( function_exists('WC') || class_exists('WooCommerce') )
130
+ include_once dirname(__FILE__).'/inc/class-wp-recaptcha-woocommerce.php';
131
+
132
  }
133
  }
134
  /**
163
  add_filter('bp_signup_pre_validate',array(&$this,'recaptcha_check_or_die'),99 );
164
  } else {
165
  add_action('register_form',array($this,'print_recaptcha_html'),10,0);
166
+ add_filter('registration_errors',array(&$this,'registration_errors'));
167
+ }
168
+ if ( is_multisite() ) {
169
+ add_action( 'signup_extra_fields' , array($this,'print_recaptcha_html'),10,0);
170
+ add_filter('wpmu_validate_user_signup',array(&$this,'wpmu_validate_user_signup'));
171
  }
172
+
173
  }
174
  if ( $this->get_option('recaptcha_enable_login') ) {
175
  add_action('login_form',array($this,'print_recaptcha_html'),10,0);
177
  }
178
  if ( $this->get_option('recaptcha_enable_lostpw') ) {
179
  add_action('lostpassword_form' , array($this,'print_recaptcha_html'),10,0);
180
+ //*
181
+ add_filter('lostpassword_post' , array(&$this,'recaptcha_check_or_die') , 99 );
182
+ /*/ // switch this when pull request accepted and included in official WC release.
183
+ add_filter('allow_password_reset' , array(&$this,'wp_error') );
184
+ //*/
185
  }
186
  }
187
  }
188
+
189
  /**
190
  * Display recaptcha on comments form.
191
  * filter function for `comment_form_defaults`
192
+ *
193
+ * @see filter doc `comment_form_defaults`
194
  */
195
  function comment_form_defaults( $defaults ) {
196
  $defaults['comment_notes_after'] .= '<p>' . $this->recaptcha_html() . '</p>';
198
  }
199
  /**
200
  * returns if recaptcha is required.
201
+ *
202
  * @return bool
203
  */
204
  function is_required() {
206
  return apply_filters( 'wp_recaptcha_required' , $is_required );
207
  }
208
 
209
+
210
+
211
  /**
212
  * check recaptcha on login
213
  * filter function for `wp_authenticate_user`
214
+ *
215
+ * @param $user WP_User
216
+ * @return object user or wp_error
217
  */
218
  function deny_login( $user ) {
219
+ if ( isset( $_POST["log"]) )
220
+ $user = $this->wp_error( $user );
221
+ return $user;
 
 
222
  }
223
+
224
  /**
225
  * check recaptcha on registration
226
  * filter function for `registration_errors`
227
+ *
228
+ * @param $errors WP_Error
229
+ * @return WP_Error with captcha error added if test fails.
230
  */
231
+ function registration_errors( $errors ) {
232
+ if ( isset( $_POST["user_login"]) )
233
+ $errors = $this->wp_error_add( $errors );
 
234
  return $errors;
235
  }
236
+
237
+ /**
238
+ * check recaptcha WPMU signup
239
+ * filter function for `wpmu_validate_user_signup`
240
+ *
241
+ * @see filter hook `wpmu_validate_user_signup`
242
+ */
243
+ function wpmu_validate_user_signup( $result ) {
244
+ if ( isset( $_POST['stage'] ) && $_POST['stage'] == 'validate-user-signup' )
245
+ $result['errors'] = $this->wp_error_add( $result['errors'] , 'generic' );
246
+ return $result;
247
+ }
248
+
249
+
250
+ /**
251
+ * check recaptcha and return WP_Error on failure.
252
+ * filter function for `allow_password_reset`
253
+ *
254
+ * @param $param mixed return value of funtion when captcha validates
255
+ * @return mixed will return argument $param an success, else WP_Error
256
+ */
257
+ function wp_error( $param , $error_code = 'captcha_error' ) {
258
+ if ( ! $this->recaptcha_check() ) {
259
+ return new WP_Error( $error_code , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
260
+ } else {
261
+ return $param;
262
+ }
263
+ }
264
+ /**
265
+ * check recaptcha and return WP_Error on failure.
266
+ * filter function for `allow_password_reset`
267
+ *
268
+ * @param $param mixed return value of funtion when captcha validates
269
+ * @return mixed will return argument $param an success, else WP_Error
270
+ */
271
+ function wp_error_add( $param , $error_code = 'captcha_error' ) {
272
+ if ( ! $this->recaptcha_check() ) {
273
+ return new WP_Error( $error_code , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
274
+ } else {
275
+ return $param;
276
+ }
277
+ }
278
+
279
+ /**
280
+ * Check recaptcha and wp_die() on fail
281
+ * hooks into `pre_comment_on_post`, `lostpassword_post`
282
+ */
283
+ function recaptcha_check_or_die( ) {
284
+ if ( ! $this->recaptcha_check() ) {
285
+ $err = new WP_Error('comment_err', __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
286
+ wp_die( $err );
287
+ }
288
+ }
289
+
290
 
291
  /**
292
  * print recaptcha stylesheets
324
  }
325
  $this->end_inject( );
326
  }
327
+
328
  /**
329
  * Print recaptcha scripts
330
  * hooks into `wp_footer`
331
+ *
332
+ * @param $flavor string force recaptcha | greaptcha flavor. falls back to `get_option( 'recaptcha_flavor' )`.
333
  */
334
  function recaptcha_foot( $flavor = '' ) {
335
  if ( empty( $flavor ) )
368
  ?><script type="text/javascript">
369
  var recaptcha_widgets={};
370
  function recaptchaLoadCallback(){
371
+ try {
372
+ grecaptcha;
373
+ } catch(err){
374
+ return;
375
+ }
376
  var e=document.getElementsByClassName('g-recaptcha'),form_submits;
377
+
378
  for (var i=0;i<e.length;i++) {
379
  (function(el){
380
  <?php if ( $this->get_option( 'recaptcha_disable_submit' ) ) { ?>
381
  var form_submits = get_form_submits(el).setEnabled(false),wid;
382
  <?php } ?>
383
+ // check if captcha element is unrendered
384
+ if ( ! el.childNodes.length) {
385
+ wid = grecaptcha.render(el,{
386
+ 'sitekey':'<?php echo $this->get_option('recaptcha_publickey'); ?>',
387
+ 'theme':'<?php echo $this->get_option('recaptcha_theme'); ?>'
388
  <?php if ( $this->get_option( 'recaptcha_disable_submit' ) ) { ?>
389
+ ,
390
+ 'callback' : function(r){ get_form_submits(el).setEnabled(true); /* enable submit buttons */ }
391
  <?php } ?>
392
+ });
393
+ el.setAttribute('data-widget-id',wid);
394
+ } else {
395
+ wid = el.getAttribute('data-widget-id');
396
+ grecaptcha.reset(wid);
397
+ }
398
  })(e[i]);
399
  }
400
  }
401
+
402
+ // if jquery present re-render jquery/ajax loaded captcha elements
403
+ if ( !!jQuery )
404
+ jQuery(document).ajaxComplete( recaptchaLoadCallback );
405
+
406
  </script><?php
407
  ?><script src="https://www.google.com/recaptcha/api.js?onload=recaptchaLoadCallback&render=explicit" async defer></script><?php
408
  break;
425
  }
426
  $this->end_inject( );
427
  }
 
 
 
 
 
 
 
 
 
 
 
428
  /**
429
  * Print recaptcha HTML. Use inside a form.
430
+ *
431
+ * @param $flavor string force recaptcha | greaptcha flavor. falls back to `get_option( 'recaptcha_flavor' )`.
432
  */
433
  function print_recaptcha_html( $flavor = '' ) {
434
  echo $this->recaptcha_html( $flavor );
436
 
437
  /**
438
  * Get recaptcha HTML.
439
+ *
440
+ * @param $flavor string force recaptcha | greaptcha flavor. falls back to `get_option( 'recaptcha_flavor' )`.
441
  * @return string recaptcha html
442
  */
443
  function recaptcha_html( $flavor = '' ) {
533
 
534
  /**
535
  * Check recaptcha
536
+ *
537
+ * @param $flavor string force recaptcha | greaptcha flavor. falls back to `get_option( 'recaptcha_flavor' )`.
538
  * @return bool false if check does not validate
539
  */
540
  function recaptcha_check( $flavor = '' ) {
553
  }
554
  /**
555
  * Check no captcha
556
+ *
557
  * @return bool false if check does not validate
558
  */
559
  function grecaptcha_check() {
574
  }
575
  /**
576
  * Check old style recaptcha
577
+ *
578
  * @return bool false if check does not validate
579
  */
580
  function old_recaptcha_check() {
611
  case 'recaptcha_enable_login':
612
  case 'recaptcha_enable_lostpw':
613
  case 'recaptcha_disable_for_known_users':
614
+ case 'recaptcha_enable_wc_order':
615
  if ( WP_reCaptcha::is_network_activated() )
616
  return get_site_option($option_name);
617
  return get_option( $option_name );
641
  delete_site_option( 'recaptcha_enable_comments' );
642
  delete_site_option( 'recaptcha_enable_signup' );
643
  delete_site_option( 'recaptcha_enable_login' );
644
+ delete_site_option( 'recaptcha_enable_wc_checkout' );
645
  delete_site_option( 'recaptcha_disable_for_known_users' );
646
 
647
  foreach ( wp_get_sites() as $site) {
661
  delete_option( 'recaptcha_enable_comments' );
662
  delete_option( 'recaptcha_enable_signup' );
663
  delete_option( 'recaptcha_enable_login' );
664
+ delete_option( 'recaptcha_enable_wc_checkout' );
665
  delete_option( 'recaptcha_disable_for_known_users' );
666
  }
667
  }