WordPress ReCaptcha Integration - Version 1.0.5

Version Description

  • Add Language option
  • Brasilian Portuguese localization
  • Fix: conditionally load recaptcha lib.
  • Fix: js error after cf7 validation error.
Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.5

inc/class-wp-recaptcha-options.php CHANGED
@@ -160,7 +160,6 @@ class WP_reCaptcha_Options {
160
  * admin init hook. Setup settings according.
161
  */
162
  function admin_init( ) {
163
-
164
  $has_api_key = WP_reCaptcha::instance()->has_api_key();
165
  if ( ! $has_api_key && current_user_can( 'manage_options' ) ) {
166
  add_action('admin_notices',array( &$this , 'api_key_notice'));
@@ -187,9 +186,13 @@ class WP_reCaptcha_Options {
187
  if ( $has_api_key ) {
188
  if ( ! WP_reCaptcha::is_network_activated() || ! is_network_admin() ) {
189
  // local options
 
190
  register_setting( 'recaptcha_options', 'recaptcha_flavor' , array( &$this , 'sanitize_flavor' ) );
191
  register_setting( 'recaptcha_options', 'recaptcha_theme' , array( &$this , 'sanitize_theme' ) );
192
  register_setting( 'recaptcha_options', 'recaptcha_disable_submit' , 'intval');
 
 
 
193
 
194
  add_settings_field('recaptcha_flavor', __('Flavor','wp-recaptcha-integration'),
195
  array(&$this,'input_radio'), 'recaptcha', 'recaptcha_options',
@@ -431,73 +434,102 @@ class WP_reCaptcha_Options {
431
  $value = WP_reCaptcha::instance()->get_option( $name );
432
  ?><input type="text" class="regular-text ltr" name="<?php echo $name ?>" value="<?php //echo $value ?>" /><?php
433
  }
 
 
 
 
 
 
 
 
434
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  /**
436
  * Selector for recaptcha theme
437
  */
438
  public function select_theme() {
439
  $option_name = 'recaptcha_theme';
440
 
441
- $themes = array(
442
- 'light' => array(
443
- 'label' => __('Light','wp-recaptcha-integration') ,
444
- 'flavor' => 'grecaptcha',
445
- ),
446
- 'dark' => array(
447
- 'label' => __('Dark','wp-recaptcha-integration') ,
448
- 'flavor' => 'grecaptcha',
449
- ),
450
 
451
- 'red' => array(
452
- 'label' => __('Red','wp-recaptcha-integration') ,
453
- 'flavor' => 'recaptcha',
454
- ),
455
- 'white' => array(
456
- 'label' => __('White','wp-recaptcha-integration') ,
457
- 'flavor' => 'recaptcha',
458
- ),
459
- 'blackglass' => array(
460
- 'label' => __('Black Glass','wp-recaptcha-integration') ,
461
- 'flavor' => 'recaptcha',
462
- ),
463
- 'clean' => array(
464
- 'label' => __('Clean','wp-recaptcha-integration') ,
465
- 'flavor' => 'recaptcha',
466
- ),
467
- 'custom' => array(
468
- 'label' => __('Custom','wp-recaptcha-integration') ,
469
- 'flavor' => 'recaptcha',
470
- ),
471
- );
472
 
473
- $option_theme = WP_reCaptcha::instance()->get_option($option_name);
474
- $option_flavor = WP_reCaptcha::instance()->get_option( 'recaptcha_flavor' );
475
-
476
- ?><div class="recaptcha-select-theme flavor-<?php echo $option_flavor ?>"><?php
477
-
478
- foreach ( $themes as $value => $theme ) {
479
- extract( $theme ); // label, flavor
480
- ?><div class="theme-item flavor-<?php echo $flavor ?>"><?php
481
- ?><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
482
- ?><label for="<?php echo "$option_name-$value" ?>"><?php
483
- ?><span class="title"><?php
484
- echo $label;
 
 
 
 
485
  ?></span><?php
486
- if ( $value == 'custom' ) {
487
- ?><span class="visual"><?php
488
- _e( 'Unstyled HTML to apply your own Stylesheets.' , 'wp-recaptcha-integration' );
489
- ?></span><?php
490
- } else {
491
- $src = plugins_url( "images/{$flavor}-theme-{$value}.png" , dirname(__FILE__));
492
- printf( '<img src="%s" alt="%s" />' , $src , $label );
493
- }
494
- ?></label><?php
495
- ?></div><?php
496
 
497
  }
498
  ?></div><?php
499
  ?></div><?php
500
  }
 
 
 
 
 
 
 
 
 
501
  /**
502
  * Check valid recaptcha theme, check if theme fits to flavor
503
  */
160
  * admin init hook. Setup settings according.
161
  */
162
  function admin_init( ) {
 
163
  $has_api_key = WP_reCaptcha::instance()->has_api_key();
164
  if ( ! $has_api_key && current_user_can( 'manage_options' ) ) {
165
  add_action('admin_notices',array( &$this , 'api_key_notice'));
186
  if ( $has_api_key ) {
187
  if ( ! WP_reCaptcha::is_network_activated() || ! is_network_admin() ) {
188
  // local options
189
+ register_setting( 'recaptcha_options', 'recaptcha_language' , array( &$this , 'sanitize_language' ) );
190
  register_setting( 'recaptcha_options', 'recaptcha_flavor' , array( &$this , 'sanitize_flavor' ) );
191
  register_setting( 'recaptcha_options', 'recaptcha_theme' , array( &$this , 'sanitize_theme' ) );
192
  register_setting( 'recaptcha_options', 'recaptcha_disable_submit' , 'intval');
193
+
194
+ add_settings_field('recaptcha_language', __( 'Language Settings' ), array(&$this,'select_language'), 'recaptcha', 'recaptcha_options');
195
+
196
 
197
  add_settings_field('recaptcha_flavor', __('Flavor','wp-recaptcha-integration'),
198
  array(&$this,'input_radio'), 'recaptcha', 'recaptcha_options',
434
  $value = WP_reCaptcha::instance()->get_option( $name );
435
  ?><input type="text" class="regular-text ltr" name="<?php echo $name ?>" value="<?php //echo $value ?>" /><?php
436
  }
437
+ /**
438
+ * Selector for recaptcha theme
439
+ */
440
+ public function select_language() {
441
+ $option_name = 'recaptcha_language';
442
+ $option_value = WP_reCaptcha::instance()->get_option( $option_name );
443
+
444
+ $available_langs = WP_reCaptcha::instance()->get_supported_languages();
445
 
446
+ ?><div class="recaptcha-select-language flavor-<?php echo $option_flavor ?>"><?php
447
+ ?><select name="<?php echo $option_name ?>"><?php
448
+ ?><option <?php selected($option_value,'',true); ?> value=""><?php _e( 'Automatic','wp-recaptcha-integration' ); ?></option><?php
449
+ ?><option <?php selected($option_value,'WPLANG',true); ?> value="WPLANG"><?php _e( 'Site Language' ); ?></option><?php
450
+ ?><optgroup label="<?php _e('Other') ?>"><?php
451
+ foreach ( $available_langs as $lang => $lang_name ) {
452
+ ?><option <?php selected($option_value,$lang,true); ?> value="<?php echo $lang; ?>"><?php _e( $lang_name ); ?></option><?php
453
+ }
454
+ ?></optgroup><?php
455
+ ?></select><?php
456
+ ?></div><?php
457
+ }
458
  /**
459
  * Selector for recaptcha theme
460
  */
461
  public function select_theme() {
462
  $option_name = 'recaptcha_theme';
463
 
464
+ $themes = array(
465
+ 'light' => array(
466
+ 'label' => __('Light','wp-recaptcha-integration') ,
467
+ 'flavor' => 'grecaptcha',
468
+ ),
469
+ 'dark' => array(
470
+ 'label' => __('Dark','wp-recaptcha-integration') ,
471
+ 'flavor' => 'grecaptcha',
472
+ ),
473
 
474
+ 'red' => array(
475
+ 'label' => __('Red','wp-recaptcha-integration') ,
476
+ 'flavor' => 'recaptcha',
477
+ ),
478
+ 'white' => array(
479
+ 'label' => __('White','wp-recaptcha-integration') ,
480
+ 'flavor' => 'recaptcha',
481
+ ),
482
+ 'blackglass' => array(
483
+ 'label' => __('Black Glass','wp-recaptcha-integration') ,
484
+ 'flavor' => 'recaptcha',
485
+ ),
486
+ 'clean' => array(
487
+ 'label' => __('Clean','wp-recaptcha-integration') ,
488
+ 'flavor' => 'recaptcha',
489
+ ),
490
+ 'custom' => array(
491
+ 'label' => __('Custom','wp-recaptcha-integration') ,
492
+ 'flavor' => 'recaptcha',
493
+ ),
494
+ );
495
 
496
+ $option_theme = WP_reCaptcha::instance()->get_option($option_name);
497
+ $option_flavor = WP_reCaptcha::instance()->get_option( 'recaptcha_flavor' );
498
+
499
+ ?><div class="recaptcha-select-theme flavor-<?php echo $option_flavor ?>"><?php
500
+
501
+ foreach ( $themes as $value => $theme ) {
502
+ extract( $theme ); // label, flavor
503
+ ?><div class="theme-item flavor-<?php echo $flavor ?>"><?php
504
+ ?><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
505
+ ?><label for="<?php echo "$option_name-$value" ?>"><?php
506
+ ?><span class="title"><?php
507
+ echo $label;
508
+ ?></span><?php
509
+ if ( $value == 'custom' ) {
510
+ ?><span class="visual"><?php
511
+ _e( 'Unstyled HTML to apply your own Stylesheets.' , 'wp-recaptcha-integration' );
512
  ?></span><?php
513
+ } else {
514
+ $src = plugins_url( "images/{$flavor}-theme-{$value}.png" , dirname(__FILE__));
515
+ printf( '<img src="%s" alt="%s" />' , $src , $label );
516
+ }
517
+ ?></label><?php
518
+ ?></div><?php
 
 
 
 
519
 
520
  }
521
  ?></div><?php
522
  ?></div><?php
523
  }
524
+
525
+ /**
526
+ * Check valid recaptcha theme, check if theme fits to flavor
527
+ */
528
+ public function sanitize_language( $language ) {
529
+ if ( $language != 'WPLANG' )
530
+ $language = WP_reCaptcha::instance()->recaptcha_language( $language );
531
+ return $language;
532
+ }
533
  /**
534
  * Check valid recaptcha theme, check if theme fits to flavor
535
  */
js/wpcf7.js CHANGED
@@ -6,7 +6,9 @@
6
  $.wpcf7AjaxSuccess = function(data) {
7
  wpcf7AjaxSuccess.apply( this , arguments );
8
  // reload recaptcha on invalid form.
9
- if ( data.invalids && Recaptcha )
10
- Recaptcha.reload();
 
 
11
  }
12
  })(jQuery);
6
  $.wpcf7AjaxSuccess = function(data) {
7
  wpcf7AjaxSuccess.apply( this , arguments );
8
  // reload recaptcha on invalid form.
9
+ if ( data.invalids ) {
10
+ ( typeof Recaptcha != 'undefined' && Recaptcha.reload() );
11
+ ( typeof grecaptcha != 'undefined' && grecaptcha.reset() );
12
+ }
13
  }
14
  })(jQuery);
languages/wp-recaptcha-integration-pt_BR.mo CHANGED
Binary file
languages/wp-recaptcha-integration-pt_BR.po CHANGED
@@ -1,198 +1,343 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WordPress reCaptcha Integration\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2014-11-16 19:55-0300\n"
7
- "Last-Translator: Vinicius R T Ferraz <contato@viniciusferraz.com>\n"
8
- "Language-Team: \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
- "X-Generator: Poedit 1.5.4\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
16
- "_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
  "Language: pt_BR\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
 
22
- # @ ninja-forms
23
- #: inc/ninja_forms_field_recaptcha.php:7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  msgid "reCAPTCHA"
25
- msgstr ""
26
 
27
- # @ recaptcha
28
- #: inc/ninja_forms_field_recaptcha.php:84 wp-recaptcha-integration.php:75
29
- #: wp-recaptcha-integration.php:82
30
- msgid "<strong>Error:</strong> the Captcha didn’t verify."
31
- msgstr "<strong>Erro:</strong> o Captcha digitado está incorreto."
32
 
33
- # @ recaptcha
34
- #: inc/recaptcha-options.php:27 inc/recaptcha-options.php:97
35
- msgid "ReCaptcha Settings"
36
- msgstr "Configurações do ReCaptcha"
37
 
38
- # @ recaptcha
39
- #: inc/recaptcha-options.php:28
40
- msgid "ReCaptcha Modules"
41
- msgstr "Módulo ReCaptcha"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
- # @ recaptcha
44
- #: inc/recaptcha-options.php:30
45
  msgid "Public Key"
46
  msgstr "Chave pública (Public Key)"
47
 
48
- # @ recaptcha
49
- #: inc/recaptcha-options.php:31
50
  msgid "Private Key"
51
  msgstr "Chave privada (Private Key)"
52
 
53
- # @ recaptcha
54
- #: inc/recaptcha-options.php:32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  msgid "Theme"
56
  msgstr "Tema"
57
 
58
- # @ recaptcha
59
- #: inc/recaptcha-options.php:35
60
  msgid "Protect Comments"
61
  msgstr "Proteger Comentários"
62
 
63
- # @ recaptcha
64
- #: inc/recaptcha-options.php:37
65
  msgid "Protect comment forms with recaptcha."
66
  msgstr "Protege o formulário dos comentários com o reCAPTCHA."
67
 
68
- # @ recaptcha
69
- #: inc/recaptcha-options.php:40
70
  msgid "Protect Signup"
71
  msgstr "Proteger Cadastro"
72
 
73
- # @ recaptcha
74
- #: inc/recaptcha-options.php:42
75
  msgid "Protect signup form with recaptcha."
76
- msgstr "Protege o formulário de cadastro de usuários com o reCAPTCHA."
77
 
78
- # @ recaptcha
79
- #: inc/recaptcha-options.php:45
80
  msgid "Protect Login"
81
  msgstr "Proteger Login"
82
 
83
- # @ recaptcha
84
- #: inc/recaptcha-options.php:47
85
  msgid "Protect Login form with recaptcha."
86
  msgstr "Protege o formulário de login com o reCAPTCHA."
87
 
88
- # @ recaptcha
89
- #: inc/recaptcha-options.php:50
90
  msgid "Disable for known users"
91
  msgstr "Desabilitar para usuários logados."
92
 
93
- # @ recaptcha
94
- #: inc/recaptcha-options.php:52
95
  msgid "Disable reCaptcha verification for logged in users."
96
  msgstr "Se o usuário estiver logado, não exigir o reCAPTCHA nos formulários."
97
 
98
- # @ recaptcha
99
- #: inc/recaptcha-options.php:56
100
- msgid ""
101
- "Please configure the public and private key. <a href=\"http://www.google.com/"
102
- "recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
103
- msgstr ""
104
- "Por favor, configure as chaves pública (Public Key) e privada (Private Key). "
105
- "<a href=\"http://www.google.com/recaptcha/whyrecaptcha\">O que isso "
106
- "significa?</a>"
107
 
108
- # @ recaptcha
109
- #: inc/recaptcha-options.php:61
110
- msgid ""
111
- "Please enter the public and private key that you got from <a href=\"http://"
112
- "www.google.com/recaptcha\">Google raCAPTCHA</a>."
113
  msgstr ""
114
- "Por favor, entre com as chaves pública (Public Key) e privada (Private Key) "
115
- "fornecidos pelo <a href=\"http://www.google.com/recaptcha\">Google "
116
- "raCAPTCHA</a>."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
- # @ recaptcha
119
- #: inc/recaptcha-options.php:82
 
 
 
 
 
120
  msgid "Red"
121
  msgstr "Vermelho"
122
 
123
- # @ recaptcha
124
- #: inc/recaptcha-options.php:83
125
  msgid "White"
126
  msgstr "Branco"
127
 
128
- # @ recaptcha
129
- #: inc/recaptcha-options.php:84
130
  msgid "Black Glass"
131
- msgstr "Escuro"
132
 
133
- # @ recaptcha
134
- #: inc/recaptcha-options.php:85
135
  msgid "Clean"
136
  msgstr "Clean"
137
 
138
- # @ recaptcha
139
- #: inc/recaptcha-options.php:97 inc/recaptcha-options.php:107
 
 
 
 
 
 
 
 
 
 
 
140
  msgid "ReCaptcha"
141
- msgstr "ReCaptcha"
142
 
143
  # @ default
144
- #: inc/recaptcha-options.php:105
145
  msgid "Settings"
146
  msgstr "Configurações"
147
 
148
- # @ default
149
- #: inc/recaptcha-options.php:113
150
- msgid "Save Changes"
151
- msgstr "Salvar Configurações"
152
-
153
- # @ recaptcha
154
- #. translators: plugin header field 'Name'
155
- #: wp-recaptcha-integration.php:0
156
- msgid "WordPress reCaptcha Integration"
157
- msgstr ""
158
 
159
- # @ recaptcha
160
- #. translators: plugin header field 'PluginURI'
161
- #: wp-recaptcha-integration.php:0
162
- msgid "https://github.com/mcguffin/wp-recaptcha-integration"
163
- msgstr ""
164
 
165
- # @ recaptcha
166
- #. translators: plugin header field 'Description'
167
- #: wp-recaptcha-integration.php:0
168
- msgid ""
169
- "Integrate reCaptcha in Your blog. Provides of the box integration for "
170
- "Signup, login and comment forms as well as a plugin API for your own "
171
- "integrations."
172
- msgstr ""
173
- "Integre o reCaptcha com o seu blog. Inclui integração com cadastro, login e "
174
- "comentários, bem como uma API para você desenvolver suas próprias "
175
- "integrações."
176
-
177
- # @ recaptcha
178
- #. translators: plugin header field 'Author'
179
- #: wp-recaptcha-integration.php:0
180
- msgid "Jörn Lund"
181
- msgstr ""
182
 
183
- # @ recaptcha
184
- #. translators: plugin header field 'AuthorURI'
185
- #: wp-recaptcha-integration.php:0
186
- msgid "https://github.com/mcguffin/"
187
- msgstr ""
188
 
189
- # @ recaptcha
190
- #. translators: plugin header field 'Version'
191
- #: wp-recaptcha-integration.php:0
192
- msgid "0.0.3"
193
- msgstr ""
194
 
195
- # @ recaptcha
196
- #: wp-recaptcha-integration.php:96
197
- msgid "Sorry, the Captcha didn’t verify."
198
- msgstr "Desculpe, o CAPTCHA digitado está incorreto."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-14 21:23-0300\n"
7
+ "Last-Translator: Vinícius Ferraz <contato@viniciusferraz.com>\n"
8
+ "Language-Team: Lenura Soluções Web Sustentáveis <contato@lenura.com.br>\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
+ "X-Generator: Poedit 1.7.3\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
+ "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"
 
16
  "X-Poedit-Basepath: ../\n"
17
  "X-Textdomain-Support: yes\n"
18
  "Language: pt_BR\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
+ # @ wp-recaptcha-integration
22
+ #: inc/class-wp-recaptcha-woocommerce.php:71
23
+ #: inc/class-wp-recaptcha-woocommerce.php:80
24
+ #: inc/ninja_forms_field_recaptcha.php:87 wp-recaptcha-integration.php:260
25
+ #: wp-recaptcha-integration.php:274 wp-recaptcha-integration.php:286
26
+ msgid "<strong>Error:</strong> the Captcha didn’t verify."
27
+ msgstr "<strong>Erro:</strong> o CAPTCHA digitado está incorreto."
28
+
29
+ # @ wp-recaptcha-integration
30
+ #: wp-recaptcha-integration.php:502
31
+ msgid "Incorrect please try again"
32
+ msgstr "Desculpe, o CAPTCHA digitado está incorreto."
33
+
34
+ # @ wp-recaptcha-integration
35
+ #: wp-recaptcha-integration.php:504
36
+ msgid "Enter the words above:"
37
+ msgstr "Digite as palavras acima:"
38
+
39
+ # @ wp-recaptcha-integration
40
+ #: wp-recaptcha-integration.php:505
41
+ msgid "Enter the numbers you hear:"
42
+ msgstr "Digite os números que você ouviu:"
43
+
44
+ # @ wp-recaptcha-integration
45
+ #: wp-recaptcha-integration.php:509
46
+ msgid "Get another CAPTCHA"
47
+ msgstr "Obter um novo CAPTCHA"
48
+
49
+ # @ wp-recaptcha-integration
50
+ #: wp-recaptcha-integration.php:510
51
+ msgid "Get an audio CAPTCHA"
52
+ msgstr "Ouvir o CAPTCHA"
53
+
54
+ # @ wp-recaptcha-integration
55
+ #: wp-recaptcha-integration.php:511
56
+ msgid "Get an image CAPTCHA"
57
+ msgstr "Obter um CAPTCHA"
58
+
59
+ # @ wp-recaptcha-integration
60
+ #: inc/contact_form_7_recaptcha.php:36 inc/ninja_forms_field_recaptcha.php:7
61
  msgid "reCAPTCHA"
62
+ msgstr "reCAPTCHA"
63
 
64
+ # @ contact-form-7
65
+ #: inc/contact_form_7_recaptcha.php:49
66
+ msgid "Required field?"
67
+ msgstr "Campo obrigatório?"
 
68
 
69
+ # @ contact-form-7
70
+ #: inc/contact_form_7_recaptcha.php:50
71
+ msgid "Name"
72
+ msgstr "Nome"
73
 
74
+ # @ contact-form-7
75
+ #: inc/contact_form_7_recaptcha.php:53
76
+ msgid "Copy this code and paste it into the form left."
77
+ msgstr "Copie e cole este código no formulário."
78
+
79
+ # @ wp-recaptcha-integration
80
+ #: inc/contact_form_7_recaptcha.php:73
81
+ msgid "The Captcha didn’t verify."
82
+ msgstr "O CAPTCHA digitado está incorreto.Sicherheitstest nicht bestanden"
83
+
84
+ # @ wp-recaptcha-integration
85
+ #: inc/class-wp-recaptcha-options.php:152
86
+ #, php-format
87
+ 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>."
88
+ msgstr ""
89
+ "<strong>O reCAPTCHA \n"
90
+ "precisa da sua atenção:</strong> Para que o reCaptcha funcione corretamente você deverá obter uma Chave de API. <br />Você poderá fazer isto na <a \n"
91
+ "href=\"%s\">página de configurações do reCaptcha</a>."
92
 
93
+ # @ wp-recaptcha-integration
94
+ #: inc/class-wp-recaptcha-options.php:173
95
  msgid "Public Key"
96
  msgstr "Chave pública (Public Key)"
97
 
98
+ # @ wp-recaptcha-integration
99
+ #: inc/class-wp-recaptcha-options.php:174
100
  msgid "Private Key"
101
  msgstr "Chave privada (Private Key)"
102
 
103
+ # @ wp-recaptcha-integration
104
+ #: inc/class-wp-recaptcha-options.php:175
105
+ #: inc/class-wp-recaptcha-options.php:181
106
+ msgid "Connecting"
107
+ msgstr "Conectando"
108
+
109
+ # @ wp-recaptcha-integration
110
+ #: inc/class-wp-recaptcha-options.php:269
111
+ msgid "Features"
112
+ msgstr "Configurações"
113
+
114
+ # @ wp-recaptcha-integration
115
+ #: inc/class-wp-recaptcha-options.php:193
116
+ msgid "Flavor"
117
+ msgstr "Tipo de CAPTCHA"
118
+
119
+ # @ wp-recaptcha-integration
120
+ #: inc/class-wp-recaptcha-options.php:204
121
+ msgid "Old style reCAPTCHA where you type some cryptic text"
122
+ msgstr "reCAPTCHA \"Classico\", no qual o usuário digita um texto legível para humanos"
123
+
124
+ # @ wp-recaptcha-integration
125
+ #: inc/class-wp-recaptcha-options.php:209
126
  msgid "Theme"
127
  msgstr "Tema"
128
 
129
+ # @ wp-recaptcha-integration
130
+ #: inc/class-wp-recaptcha-options.php:229
131
  msgid "Protect Comments"
132
  msgstr "Proteger Comentários"
133
 
134
+ # @ wp-recaptcha-integration
135
+ #: inc/class-wp-recaptcha-options.php:231
136
  msgid "Protect comment forms with recaptcha."
137
  msgstr "Protege o formulário dos comentários com o reCAPTCHA."
138
 
139
+ # @ wp-recaptcha-integration
140
+ #: inc/class-wp-recaptcha-options.php:234
141
  msgid "Protect Signup"
142
  msgstr "Proteger Cadastro"
143
 
144
+ # @ wp-recaptcha-integration
145
+ #: inc/class-wp-recaptcha-options.php:236
146
  msgid "Protect signup form with recaptcha."
147
+ msgstr "Protege o formulário de cadastro de novos usuários com o reCAPTCHA."
148
 
149
+ # @ wp-recaptcha-integration
150
+ #: inc/class-wp-recaptcha-options.php:239
151
  msgid "Protect Login"
152
  msgstr "Proteger Login"
153
 
154
+ # @ wp-recaptcha-integration
155
+ #: inc/class-wp-recaptcha-options.php:241
156
  msgid "Protect Login form with recaptcha."
157
  msgstr "Protege o formulário de login com o reCAPTCHA."
158
 
159
+ # @ wp-recaptcha-integration
160
+ #: inc/class-wp-recaptcha-options.php:264
161
  msgid "Disable for known users"
162
  msgstr "Desabilitar para usuários logados."
163
 
164
+ # @ wp-recaptcha-integration
165
+ #: inc/class-wp-recaptcha-options.php:266
166
  msgid "Disable reCaptcha verification for logged in users."
167
  msgstr "Se o usuário estiver logado, não exigir o reCAPTCHA nos formulários."
168
 
169
+ # @ wp-recaptcha-integration
170
+ #: inc/class-wp-recaptcha-options.php:272
171
+ msgid "Please configure the public and private key. <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
172
+ msgstr "Por favor, configure as chaves pública (Public Key) e privada (Private Key). <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">O que isso significa?</a>"
 
 
 
 
 
173
 
174
+ # @ wp-recaptcha-integration
175
+ #: inc/class-wp-recaptcha-options.php:285
176
+ #, php-format
177
+ 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>"
 
178
  msgstr ""
179
+ "Por favor, registre seu site através do <a href=\"%s\">site do Google reCAPTCHA</a> \n"
180
+ "e entre com as chaves pública (Public Key) e privada (Private Key) nos campos abaixo. <a \n"
181
+ "href=\"%s\">O que isso significa?</a>"
182
+
183
+ # @ wp-recaptcha-integration
184
+ #: inc/class-wp-recaptcha-options.php:293
185
+ msgid "You already entered an API Key. Use the button below to enter it again."
186
+ msgstr "Você já forneceu uma Chave de API. Utilize o botão abaixo para fornecer outra."
187
+
188
+ # @ wp-recaptcha-integration
189
+ #: inc/class-wp-recaptcha-options.php:304
190
+ msgid "New API Key"
191
+ msgstr "Nova Chave de API"
192
+
193
+ # @ default
194
+ #: inc/class-wp-recaptcha-options.php:362
195
+ msgid "Cancel"
196
+ msgstr "Cancelar"
197
+
198
+ # @ wp-recaptcha-integration
199
+ #: inc/class-wp-recaptcha-options.php:442
200
+ msgid "Light"
201
+ msgstr "Light"
202
 
203
+ # @ wp-recaptcha-integration
204
+ #: inc/class-wp-recaptcha-options.php:446
205
+ msgid "Dark"
206
+ msgstr "Escuro"
207
+
208
+ # @ wp-recaptcha-integration
209
+ #: inc/class-wp-recaptcha-options.php:451
210
  msgid "Red"
211
  msgstr "Vermelho"
212
 
213
+ # @ wp-recaptcha-integration
214
+ #: inc/class-wp-recaptcha-options.php:455
215
  msgid "White"
216
  msgstr "Branco"
217
 
218
+ # @ wp-recaptcha-integration
219
+ #: inc/class-wp-recaptcha-options.php:459
220
  msgid "Black Glass"
221
+ msgstr "Preto"
222
 
223
+ # @ wp-recaptcha-integration
224
+ #: inc/class-wp-recaptcha-options.php:463
225
  msgid "Clean"
226
  msgstr "Clean"
227
 
228
+ # @ wp-recaptcha-integration
229
+ #: inc/class-wp-recaptcha-options.php:467
230
+ msgid "Custom"
231
+ msgstr "Personalizado"
232
+
233
+ # @ wp-recaptcha-integration
234
+ #: inc/class-wp-recaptcha-options.php:487
235
+ msgid "Unstyled HTML to apply your own Stylesheets."
236
+ msgstr "HTML puro para que você aplique seu estilo."
237
+
238
+ # @ wp-recaptcha-integration
239
+ #: inc/class-wp-recaptcha-options.php:531
240
+ #: inc/class-wp-recaptcha-options.php:555
241
  msgid "ReCaptcha"
242
+ msgstr "reCAPTCHA"
243
 
244
  # @ default
245
+ #: inc/class-wp-recaptcha-options.php:553
246
  msgid "Settings"
247
  msgstr "Configurações"
248
 
249
+ # @ wp-recaptcha-integration
250
+ #: inc/class-wp-recaptcha-options.php:200
251
+ msgid "No Captcha where you just click a button"
252
+ msgstr "\"Sem CAPTCHA\", no qual o usuário apenas clica em um botão"
 
 
 
 
 
 
253
 
254
+ # @ wp-recaptcha-integration
255
+ #: inc/class-wp-recaptcha-options.php:244
256
+ msgid "Protect Lost Password"
257
+ msgstr "Proteger Recuperação de Senha"
 
258
 
259
+ # @ wp-recaptcha-integration
260
+ #: inc/class-wp-recaptcha-options.php:246
261
+ msgid "Protect Lost Password form with recaptcha."
262
+ msgstr "Protege o formulário de recuperação de senhas."
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
+ # @ wp-recaptcha-integration
265
+ #: inc/class-wp-recaptcha-options.php:93
266
+ #: inc/class-wp-recaptcha-options.php:105
267
+ msgid "reCaptcha Settings"
268
+ msgstr "Configurações do reCAPTCHA"
269
 
270
+ # @ wp-recaptcha-integration
271
+ #: inc/class-wp-recaptcha-options.php:94
272
+ msgid "reCaptcha"
273
+ msgstr "reCAPTCHA"
 
274
 
275
+ # @ wp-recaptcha-integration
276
+ #: inc/class-wp-recaptcha-options.php:305
277
+ msgid "Test API Key"
278
+ msgstr "Testar Chave de API"
279
+
280
+ # @ wp-recaptcha-integration
281
+ #: inc/class-wp-recaptcha-options.php:325
282
+ msgid "Test verfication"
283
+ msgstr "Verificação do Teste"
284
+
285
+ # @ wp-recaptcha-integration
286
+ #: inc/class-wp-recaptcha-options.php:338
287
+ msgid "The secret Key is missing."
288
+ msgstr "A chave privada não foi encontrada."
289
+
290
+ # @ wp-recaptcha-integration
291
+ #: inc/class-wp-recaptcha-options.php:339
292
+ msgid "The secret Key is invalid. You better check your domain configuration and enter it again."
293
+ msgstr "A chave privada é inválida. Verifique as configurações de domínio no site do Google reCAPTCHA e tente novamente."
294
+
295
+ # @ wp-recaptcha-integration
296
+ #: inc/class-wp-recaptcha-options.php:341
297
+ msgid "Invalid user response"
298
+ msgstr "Resposta de usuário inválida"
299
+
300
+ # @ wp-recaptcha-integration
301
+ #: inc/class-wp-recaptcha-options.php:350
302
+ msgid "Works! All good!"
303
+ msgstr "Funcionou! Tudo bem!"
304
+
305
+ # @ wp-recaptcha-integration
306
+ #: inc/class-wp-recaptcha-options.php:211
307
+ msgid "Disable Submit Button"
308
+ msgstr "Desabilitar Botão Enviar"
309
+
310
+ # @ wp-recaptcha-integration
311
+ #: inc/class-wp-recaptcha-options.php:213
312
+ msgid "Disable Form Submit Button until no-captcha is entered."
313
+ msgstr "Desabilitar o botão Enviar enquanto o usuário não digita nada."
314
+
315
+ # @ wp-recaptcha-integration
316
+ #: wp-recaptcha-integration.php:489
317
+ msgid "Please enable JavaScript to submit this form."
318
+ msgstr "Por favor, habilite o JavaScript para enviar este formulário."
319
+
320
+ # @ wp-recaptcha-integration
321
+ #: inc/class-wp-recaptcha-options.php:340
322
+ msgid "The user response was missing"
323
+ msgstr "Nenhum CAPTCHA foi digitado"
324
+
325
+ # @ wp-recaptcha-integration
326
+ #: inc/class-wp-recaptcha-options.php:251
327
+ msgid "Protect WooCommerce Checkout"
328
+ msgstr "Proteger Checkout do WooCommerce"
329
+
330
+ # @ wp-recaptcha-integration
331
+ #: inc/class-wp-recaptcha-options.php:255
332
+ msgid "Protect wooCommerce Checkout with a recaptcha."
333
+ msgstr "Protege o checkout (Finalizar Compra) do WooCommerce com reCAPTCHA."
334
+
335
+ # @ wp-recaptcha-integration
336
+ #: inc/class-wp-recaptcha-options.php:256
337
+ msgid "This will only work with No Captcha flavor."
338
+ msgstr "Isto somente funcionará corretamente com o tipo \"Sem CAPTCHA\" do reCAPTCHA."
339
+
340
+ # @ wp-recaptcha-integration
341
+ #: inc/class-wp-recaptcha-options.php:261
342
+ msgid "The Old Style recaptcha doesn‘t work together with the WooCommerce checkout form. The Captcha will not be displayed,"
343
+ msgstr "O tipo \"Clássico\" do reCAPTCHA não funciona com o formulário de checkout (Finalizar Compra) do WooCommerce. O CAPTCHA não será exibido,"
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.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -25,6 +25,10 @@ form 7 as well as a plugin API for your own integrations.
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 =
@@ -66,7 +70,20 @@ Then go to the [Google Recaptcha Site](http://www.google.com/recaptcha), sign up
66
 
67
  On the plugin settings page check out if the option “Disable for known users” is activated (it is by default).
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
 
@@ -127,6 +144,12 @@ I will migrate all the translation stuff there.
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
 
130
  = 1.0.4 =
131
  - Add WooCommerce Support (checkout page)
132
  - Multisite: protect signup form as well.
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.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
25
  - [Ninja Forms](http://ninjaforms.com/) integration
26
  - [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) integration
27
 
28
+ = Localizations =
29
+ - Brazilian Portuguese (thanks to [Vinícius Ferraz](http://www.viniciusferraz.com))
30
+ - German
31
+
32
  Latest Files on GitHub: [https://github.com/mcguffin/wp-recaptcha-integration](https://github.com/mcguffin/wp-recaptcha-integration)
33
 
34
  = Compatibility =
70
 
71
  On the plugin settings page check out if the option “Disable for known users” is activated (it is by default).
72
  Then log out (or open your page in a private browser window) and try again.
73
+
74
+ If only the comment form is affected, it is very likely that your Theme does not use the
75
+ `comment_form_defaults` filter. (That‘s where I add the captcha HTML, to make it appear
76
+ right before the submit button.) You will have to use another hook, e.g. `comment_form_after_fields`.
77
+
78
+ Here is some code that will fix it:
79
+
80
+ - Go to (https://gist.github.com/mcguffin/97d7f442ee3e92b7412e)
81
+ - Click the "Download Gist" button
82
+ - Unpack the `.tar.gz` file.
83
+ - Create a zip Archive out of the included file `recaptcha-comment-form-fix.php` and name it `recaptcha-comment-form-fix.zip`.
84
+ - Install and activate it like any other WordPress plugin
85
+
86
+ If the problem still persist, Houston really has a problem, and you are welcome to post a support request.
87
 
88
  = Disabled submit buttons should be grey! Why aren't they? =
89
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.0.5 =
148
+ - Add Language option
149
+ - Brasilian Portuguese localization
150
+ - Fix: conditionally load recaptcha lib.
151
+ - Fix: js error after cf7 validation error.
152
+
153
  = 1.0.4 =
154
  - Add WooCommerce Support (checkout page)
155
  - Multisite: protect signup form as well.
wp-recaptcha-integration.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP reCaptcha Integration
4
  Plugin URI: https://wordpress.org/plugins/wp-recaptcha-integration/
5
  Description: Integrate reCaptcha in your blog. Supports no Captcha (new style recaptcha) as well as the old style reCaptcha. Provides of the box integration for signup, login, comment forms, lost password, Ninja Forms and contact form 7.
6
- Version: 1.0.4
7
  Author: Jörn Lund
8
  Author URI: https://github.com/mcguffin/
9
  */
@@ -40,6 +40,64 @@ class WP_reCaptcha {
40
 
41
  private $_counter = 0;
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  /**
44
  * Holding the singleton instance
45
  */
@@ -68,6 +126,7 @@ class WP_reCaptcha {
68
  add_option('recaptcha_disable_submit',false); // local
69
  add_option('recaptcha_publickey',''); // 1st global -> then local
70
  add_option('recaptcha_privatekey',''); // 1st global -> then local
 
71
 
72
  if ( WP_reCaptcha::is_network_activated() ) {
73
  add_site_option('recaptcha_publickey',''); // 1st global -> then local
@@ -137,7 +196,6 @@ class WP_reCaptcha {
137
  */
138
  function init() {
139
  load_plugin_textdomain( 'wp-recaptcha-integration', false , dirname( plugin_basename( __FILE__ ) ).'/languages/' );
140
-
141
  $require_recaptcha = $this->is_required();
142
 
143
  if ( $require_recaptcha ) {
@@ -172,7 +230,7 @@ class WP_reCaptcha {
172
 
173
  }
174
  if ( $this->get_option('recaptcha_enable_login') ) {
175
- add_action('login_form',array($this,'print_recaptcha_html'),10,0);
176
  add_filter('wp_authenticate_user',array(&$this,'deny_login'),99 );
177
  }
178
  if ( $this->get_option('recaptcha_enable_lostpw') ) {
@@ -183,6 +241,8 @@ class WP_reCaptcha {
183
  add_filter('allow_password_reset' , array(&$this,'wp_error') );
184
  //*/
185
  }
 
 
186
  }
187
  }
188
 
@@ -287,6 +347,7 @@ class WP_reCaptcha {
287
  }
288
  }
289
 
 
290
 
291
  /**
292
  * print recaptcha stylesheets
@@ -316,7 +377,13 @@ class WP_reCaptcha {
316
  } else {
317
  ?><script type="text/javascript">
318
  var RecaptchaOptions = {
 
 
 
 
 
319
  theme : '<?php echo $recaptcha_theme ?>'
 
320
  };
321
  </script><?php
322
  }
@@ -365,6 +432,11 @@ class WP_reCaptcha {
365
  }
366
  switch ( $flavor ) {
367
  case 'grecaptcha':
 
 
 
 
 
368
  ?><script type="text/javascript">
369
  var recaptcha_widgets={};
370
  function recaptchaLoadCallback(){
@@ -404,7 +476,7 @@ class WP_reCaptcha {
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;
409
  case 'recaptcha':
410
  if ( $this->get_option( 'recaptcha_disable_submit' ) ) {
@@ -463,7 +535,7 @@ class WP_reCaptcha {
463
  * @return string recaptcha html
464
  */
465
  function old_recaptcha_html() {
466
- require_once dirname(__FILE__).'/recaptchalib.php';
467
  $public_key = $this->get_option( 'recaptcha_publickey' );
468
  $recaptcha_theme = $this->get_option('recaptcha_theme');
469
 
@@ -484,7 +556,7 @@ class WP_reCaptcha {
484
  function grecaptcha_html() {
485
  $public_key = $this->get_option( 'recaptcha_publickey' );
486
  $theme = $this->get_option('recaptcha_theme');
487
- $return = sprintf( '<div id="g-recaptcha-%d" class="g-recaptcha" data-sitekey="%s" data-theme="%s"></div>',$this->_counter++,$public_key,$theme);
488
  $return .= '<noscript>'.__('Please enable JavaScript to submit this form.','wp-recaptcha-integration').'</noscript>';
489
  return $return;
490
  }
@@ -523,6 +595,9 @@ class WP_reCaptcha {
523
  return $return;
524
  }
525
 
 
 
 
526
  /**
527
  * Get last result of recaptcha check
528
  * @return string recaptcha html
@@ -578,7 +653,7 @@ class WP_reCaptcha {
578
  * @return bool false if check does not validate
579
  */
580
  function old_recaptcha_check() {
581
- require_once dirname(__FILE__).'/recaptchalib.php';
582
  $private_key = $this->get_option( 'recaptcha_privatekey' );
583
  $this->_last_result = recaptcha_check_answer( $private_key,
584
  $_SERVER["REMOTE_ADDR"],
@@ -650,6 +725,7 @@ class WP_reCaptcha {
650
  delete_option( 'recaptcha_privatekey' );
651
  delete_option( 'recaptcha_flavor' );
652
  delete_option( 'recaptcha_theme' );
 
653
  restore_current_blog();
654
  }
655
  } else {
@@ -658,6 +734,7 @@ class WP_reCaptcha {
658
 
659
  delete_option( 'recaptcha_flavor' );
660
  delete_option( 'recaptcha_theme' );
 
661
  delete_option( 'recaptcha_enable_comments' );
662
  delete_option( 'recaptcha_enable_signup' );
663
  delete_option( 'recaptcha_enable_login' );
@@ -705,6 +782,73 @@ class WP_reCaptcha {
705
  if ( $return ) return $html;
706
  echo $html;
707
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  }
709
 
710
  WP_reCaptcha::instance();
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.5
7
  Author: Jörn Lund
8
  Author URI: https://github.com/mcguffin/
9
  */
40
 
41
  private $_counter = 0;
42
 
43
+ private $grecaptcha_languages = array(
44
+ 'ar' => 'Arabic',
45
+ 'bg' => 'Bulgarian',
46
+ 'ca' => 'Catalan',
47
+ 'zh-CN' => 'Chinese (Simplified)',
48
+ 'zh-TW' => 'Chinese (Traditional)',
49
+ 'hr' => 'Croatian',
50
+ 'cs' => 'Czech',
51
+ 'da' => 'Danish',
52
+ 'nl' => 'Dutch',
53
+ 'en-GB' => 'English (UK)',
54
+ 'en' => 'English (US)',
55
+ 'fil' => 'Filipino',
56
+ 'fi' => 'Finnish',
57
+ 'fr' => 'French',
58
+ 'fr-CA' => 'French (Canadian)',
59
+ 'de' => 'German',
60
+ 'de-AT' => 'German (Austria)',
61
+ 'de-CH' => 'German (Switzerland)',
62
+ 'el' => 'Greek',
63
+ 'iw' => 'Hebrew',
64
+ 'hi' => 'Hindi',
65
+ 'hu' => 'Hungarain',
66
+ 'id' => 'Indonesian',
67
+ 'it' => 'Italian',
68
+ 'ja' => 'Japanese',
69
+ 'ko' => 'Korean',
70
+ 'lv' => 'Latvian',
71
+ 'lt' => 'Lithuanian',
72
+ 'no' => 'Norwegian',
73
+ 'fa' => 'Persian',
74
+ 'pl' => 'Polish',
75
+ 'pt' => 'Portuguese',
76
+ 'pt-BR' => 'Portuguese (Brazil)',
77
+ 'pt-PT' => 'Portuguese (Portugal)',
78
+ 'ro' => 'Romanian',
79
+ 'ru' => 'Russian',
80
+ 'sr' => 'Serbian',
81
+ 'sk' => 'Slovak',
82
+ 'sl' => 'Slovenian',
83
+ 'es' => 'Spanish',
84
+ 'es-419' => 'Spanish (Latin America)',
85
+ 'sv' => 'Swedish',
86
+ 'th' => 'Thai',
87
+ 'tr' => 'Turkish',
88
+ 'uk' => 'Ukrainian',
89
+ 'vi' => 'Vietnamese',
90
+ );
91
+ private $recaptcha_languages = array(
92
+ 'en' => 'English',
93
+ 'nl' => 'Dutch',
94
+ 'fr' => 'French',
95
+ 'de' => 'German',
96
+ 'pt' => 'Portuguese',
97
+ 'ru' => 'Russian',
98
+ 'es' => 'Spanish',
99
+ 'tr' => 'Turkish',
100
+ );
101
  /**
102
  * Holding the singleton instance
103
  */
126
  add_option('recaptcha_disable_submit',false); // local
127
  add_option('recaptcha_publickey',''); // 1st global -> then local
128
  add_option('recaptcha_privatekey',''); // 1st global -> then local
129
+ add_option('recaptcha_language',''); // 1st global -> then local
130
 
131
  if ( WP_reCaptcha::is_network_activated() ) {
132
  add_site_option('recaptcha_publickey',''); // 1st global -> then local
196
  */
197
  function init() {
198
  load_plugin_textdomain( 'wp-recaptcha-integration', false , dirname( plugin_basename( __FILE__ ) ).'/languages/' );
 
199
  $require_recaptcha = $this->is_required();
200
 
201
  if ( $require_recaptcha ) {
230
 
231
  }
232
  if ( $this->get_option('recaptcha_enable_login') ) {
233
+ add_action('login_form',array(&$this,'print_recaptcha_html'),10,0);
234
  add_filter('wp_authenticate_user',array(&$this,'deny_login'),99 );
235
  }
236
  if ( $this->get_option('recaptcha_enable_lostpw') ) {
241
  add_filter('allow_password_reset' , array(&$this,'wp_error') );
242
  //*/
243
  }
244
+ if ( 'WPLANG' === $this->get_option( 'recaptcha_language' ) )
245
+ add_filter( 'wp_recaptcha_language' , array( &$this,'recaptcha_wplang' ) );
246
  }
247
  }
248
 
347
  }
348
  }
349
 
350
+
351
 
352
  /**
353
  * print recaptcha stylesheets
377
  } else {
378
  ?><script type="text/javascript">
379
  var RecaptchaOptions = {
380
+ <?php
381
+ $language_code = apply_filters( 'wp_recaptcha_language' , $this->get_option( 'recaptcha_language' ) );
382
+ if ( $language_code ) { ?>
383
+ lang : '<?php echo $language_code ?>',
384
+ <?php } ?>
385
  theme : '<?php echo $recaptcha_theme ?>'
386
+
387
  };
388
  </script><?php
389
  }
432
  }
433
  switch ( $flavor ) {
434
  case 'grecaptcha':
435
+
436
+ $language_param = '';
437
+ if ( $language_code = apply_filters( 'wp_recaptcha_language' , $this->get_option( 'recaptcha_language' ) ) )
438
+ $language_param = "&hl=$language_code";
439
+
440
  ?><script type="text/javascript">
441
  var recaptcha_widgets={};
442
  function recaptchaLoadCallback(){
476
  jQuery(document).ajaxComplete( recaptchaLoadCallback );
477
 
478
  </script><?php
479
+ ?><script src="https://www.google.com/recaptcha/api.js?onload=recaptchaLoadCallback&render=explicit<?php echo $language_param ?>" async defer></script><?php
480
  break;
481
  case 'recaptcha':
482
  if ( $this->get_option( 'recaptcha_disable_submit' ) ) {
535
  * @return string recaptcha html
536
  */
537
  function old_recaptcha_html() {
538
+ $this->load_recaptchalib();
539
  $public_key = $this->get_option( 'recaptcha_publickey' );
540
  $recaptcha_theme = $this->get_option('recaptcha_theme');
541
 
556
  function grecaptcha_html() {
557
  $public_key = $this->get_option( 'recaptcha_publickey' );
558
  $theme = $this->get_option('recaptcha_theme');
559
+ $return = sprintf( '<div id="g-recaptcha-%d" class="g-recaptcha" data-sitekey="%s" data-theme="%s"></div>' , $this->_counter++ , $public_key , $theme );
560
  $return .= '<noscript>'.__('Please enable JavaScript to submit this form.','wp-recaptcha-integration').'</noscript>';
561
  return $return;
562
  }
595
  return $return;
596
  }
597
 
598
+
599
+
600
+
601
  /**
602
  * Get last result of recaptcha check
603
  * @return string recaptcha html
653
  * @return bool false if check does not validate
654
  */
655
  function old_recaptcha_check() {
656
+ $this->load_recaptchalib();
657
  $private_key = $this->get_option( 'recaptcha_privatekey' );
658
  $this->_last_result = recaptcha_check_answer( $private_key,
659
  $_SERVER["REMOTE_ADDR"],
725
  delete_option( 'recaptcha_privatekey' );
726
  delete_option( 'recaptcha_flavor' );
727
  delete_option( 'recaptcha_theme' );
728
+ delete_option( 'recaptcha_language' );
729
  restore_current_blog();
730
  }
731
  } else {
734
 
735
  delete_option( 'recaptcha_flavor' );
736
  delete_option( 'recaptcha_theme' );
737
+ delete_option( 'recaptcha_language' );
738
  delete_option( 'recaptcha_enable_comments' );
739
  delete_option( 'recaptcha_enable_signup' );
740
  delete_option( 'recaptcha_enable_login' );
782
  if ( $return ) return $html;
783
  echo $html;
784
  }
785
+
786
+
787
+ /**
788
+ * Rewrite WP get_locale() to recaptcha lang param.
789
+ *
790
+ * @return string recaptcha language
791
+ */
792
+ function recaptcha_wplang( ) {
793
+ $locale = get_locale();
794
+ /* Sometimes WP uses different locales the the ones supported by nocaptcha. */
795
+ $mapping = array(
796
+ 'es_MX' => 'es-419',
797
+ 'es_PE' => 'es-419',
798
+ 'es_CL' => 'es-419',
799
+ 'he_IL' => 'iw',
800
+ );
801
+ if ( isset( $mapping[$locale] ) )
802
+ $locale = $mapping[$locale];
803
+ return $this->recaptcha_language( $locale );
804
+ }
805
+ /**
806
+ * Rewrite WP get_locale() to recaptcha lang param.
807
+ *
808
+ * @return string recaptcha language
809
+ */
810
+ function recaptcha_language( $lang ) {
811
+ $lang = str_replace( '_' , '-' , $lang );
812
+
813
+ $langs = $this->get_supported_languages();
814
+ // direct hit: return it.
815
+ if ( isset($langs[$lang]) )
816
+ return $lang;
817
+
818
+ // remove countrycode
819
+ $lang = preg_replace('/-(.*)$/','',$lang);
820
+ if ( isset($langs[$lang]) )
821
+ return $lang;
822
+
823
+ // lang does not exist.
824
+ return '';
825
+ }
826
+
827
+ /**
828
+ * Get languages supported by current recaptcha flavor.
829
+ *
830
+ * @return array languages supported by recaptcha.
831
+ */
832
+ function get_supported_languages( $flavor = null ) {
833
+ if ( is_null( $flavor ) )
834
+ $flavor = $this->get_option( 'recaptcha_flavor' );
835
+ switch( $flavor ) {
836
+ case 'recaptcha':
837
+ return $this->recaptcha_languages;
838
+ case 'grecaptcha':
839
+ return $this->grecaptcha_languages;
840
+ }
841
+ return array();
842
+ }
843
+
844
+ /**
845
+ * Load reCaptcha Library (3rd Party) if needed.
846
+ *
847
+ */
848
+ private function load_recaptchalib() {
849
+ if ( ! defined( 'RECAPTCHA_API_SERVER' ) || ! function_exists( 'recaptcha_get_html' ) )
850
+ require_once dirname(__FILE__).'/recaptchalib.php';
851
+ }
852
  }
853
 
854
  WP_reCaptcha::instance();