Simple Google reCAPTCHA - Version 1.8

Version Description

  • New: reCAPTCHA verification on the BuddyPress registration page
  • Bugfix: Translatable back button "Zpt"
Download this release

Release Info

Developer Minor
Plugin Icon 128x128 Simple Google reCAPTCHA
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

languages/sgr-cs_CZ.mo CHANGED
Binary file
languages/sgr-cs_CZ.po CHANGED
@@ -2,9 +2,9 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Simple Google reCAPTCHA\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2016-11-28 19:12+0000\n"
6
- "PO-Revision-Date: 2016-11-28 19:12+0000\n"
7
- "Last-Translator: Minor <blog@novami.cz>\n"
8
  "Language-Team: Czech\n"
9
  "Language: cs-CZ\n"
10
  "Plural-Forms: nplurals=3; plural=( n == 1 ) ? 0 : ( n >= 2 && n <= 4 ) ? 1 : "
@@ -23,9 +23,29 @@ msgstr ""
23
  "X-Generator: Loco - https://localise.biz/\n"
24
  "X-Loco-Target-Locale: cs_CZ"
25
 
26
- #: simple-google-recaptcha.php:35
27
- msgid "Site Key"
28
- msgstr "Klíč stránky"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  #: simple-google-recaptcha.php:13
31
  msgid "Settings"
@@ -39,6 +59,10 @@ msgstr "Nastavení reCAPTCHA"
39
  msgid "What first?"
40
  msgstr "Co nejdříve?"
41
 
 
 
 
 
42
  #: simple-google-recaptcha.php:36
43
  msgid "Secret Key"
44
  msgstr "Tajný klíč"
@@ -47,7 +71,7 @@ msgstr "Tajný klíč"
47
  msgid "Disable reCAPTCHA in comment form for logged in users"
48
  msgstr "Zakázat reCAPTCHA ve formuláři pro komentář pro přihlášené uživatele"
49
 
50
- #: simple-google-recaptcha.php:45
51
  msgid ""
52
  "<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" "
53
  "rel=\"external\">register your domain</a> first, get required keys from "
@@ -57,11 +81,11 @@ msgstr ""
57
  "rel=\"external\">zaregistrovat svou doménu</a>, získat potřebné klíče od "
58
  "Googlu a nastavit je níže.</p>"
59
 
60
- #: simple-google-recaptcha.php:89
61
  msgid "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>"
62
  msgstr "<p><strong>CHYBA</strong>: Selhalo ověření Google reCAPTCHA.</p>"
63
 
64
- #: simple-google-recaptcha.php:93
65
  msgid ""
66
  "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have "
67
  "JavaScript enabled?</p>"
2
  msgstr ""
3
  "Project-Id-Version: Simple Google reCAPTCHA\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-12-19 22:11+0000\n"
6
+ "PO-Revision-Date: 2016-12-19 22:13+0000\n"
7
+ "Last-Translator: Michal <wordpress@csy.cz>\n"
8
  "Language-Team: Czech\n"
9
  "Language: cs-CZ\n"
10
  "Plural-Forms: nplurals=3; plural=( n == 1 ) ? 0 : ( n >= 2 && n <= 4 ) ? 1 : "
23
  "X-Generator: Loco - https://localise.biz/\n"
24
  "X-Loco-Target-Locale: cs_CZ"
25
 
26
+ #: simple-google-recaptcha.php:38
27
+ msgid "Disable reCAPTCHA for comments"
28
+ msgstr "Zakázat reCAPTCHA ve formuláři pro komentáře"
29
+
30
+ #: simple-google-recaptcha.php:39
31
+ msgid "Disable reCAPTCHA for login page"
32
+ msgstr "Zakázat reCAPTCHA ve formuláři pro přihlášení"
33
+
34
+ #: simple-google-recaptcha.php:40
35
+ msgid "Disable reCAPTCHA for registration page"
36
+ msgstr "Zakázat reCAPTCHA ve formuláři pro registraci"
37
+
38
+ #: simple-google-recaptcha.php:41
39
+ msgid "Disable reCAPTCHA for forgot password page"
40
+ msgstr "Zakázat reCAPTCHA ve formuláři pro zapomenuté heslo"
41
+
42
+ #: simple-google-recaptcha.php:42
43
+ msgid "Disable reCAPTCHA for BuddyPress registration page"
44
+ msgstr "Zakázat reCAPTCHA ve formuláři pro registraci přes BuddyPress"
45
+
46
+ #: simple-google-recaptcha.php:119 simple-google-recaptcha.php:123
47
+ msgid "Back"
48
+ msgstr "Zpět"
49
 
50
  #: simple-google-recaptcha.php:13
51
  msgid "Settings"
59
  msgid "What first?"
60
  msgstr "Co nejdříve?"
61
 
62
+ #: simple-google-recaptcha.php:35
63
+ msgid "Site Key"
64
+ msgstr "Klíč stránky"
65
+
66
  #: simple-google-recaptcha.php:36
67
  msgid "Secret Key"
68
  msgstr "Tajný klíč"
71
  msgid "Disable reCAPTCHA in comment form for logged in users"
72
  msgstr "Zakázat reCAPTCHA ve formuláři pro komentář pro přihlášené uživatele"
73
 
74
+ #: simple-google-recaptcha.php:55
75
  msgid ""
76
  "<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" "
77
  "rel=\"external\">register your domain</a> first, get required keys from "
81
  "rel=\"external\">zaregistrovat svou doménu</a>, získat potřebné klíče od "
82
  "Googlu a nastavit je níže.</p>"
83
 
84
+ #: simple-google-recaptcha.php:119
85
  msgid "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>"
86
  msgstr "<p><strong>CHYBA</strong>: Selhalo ověření Google reCAPTCHA.</p>"
87
 
88
+ #: simple-google-recaptcha.php:123
89
  msgid ""
90
  "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have "
91
  "JavaScript enabled?</p>"
languages/sgr.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Simple Google reCAPTCHA\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2016-11-28 19:12+0000\n"
7
  "POT-Revision-Date: Thu Sep 01 2016 22:14:37 GMT+0200\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: \n"
@@ -47,18 +47,42 @@ msgstr ""
47
  msgid "Disable reCAPTCHA in comment form for logged in users"
48
  msgstr ""
49
 
50
- #: simple-google-recaptcha.php:45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  msgid ""
52
  "<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" "
53
  "rel=\"external\">register your domain</a> first, get required keys from "
54
  "Google and save them bellow.</p>"
55
  msgstr ""
56
 
57
- #: simple-google-recaptcha.php:89
58
  msgid "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>"
59
  msgstr ""
60
 
61
- #: simple-google-recaptcha.php:93
 
 
 
 
62
  msgid ""
63
  "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have "
64
  "JavaScript enabled?</p>"
3
  msgstr ""
4
  "Project-Id-Version: Simple Google reCAPTCHA\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2016-12-19 22:11+0000\n"
7
  "POT-Revision-Date: Thu Sep 01 2016 22:14:37 GMT+0200\n"
8
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
9
  "Last-Translator: \n"
47
  msgid "Disable reCAPTCHA in comment form for logged in users"
48
  msgstr ""
49
 
50
+ #: simple-google-recaptcha.php:38
51
+ msgid "Disable reCAPTCHA for comments"
52
+ msgstr ""
53
+
54
+ #: simple-google-recaptcha.php:39
55
+ msgid "Disable reCAPTCHA for login page"
56
+ msgstr ""
57
+
58
+ #: simple-google-recaptcha.php:40
59
+ msgid "Disable reCAPTCHA for registration page"
60
+ msgstr ""
61
+
62
+ #: simple-google-recaptcha.php:41
63
+ msgid "Disable reCAPTCHA for forgot password page"
64
+ msgstr ""
65
+
66
+ #: simple-google-recaptcha.php:42
67
+ msgid "Disable reCAPTCHA for BuddyPress registration page"
68
+ msgstr ""
69
+
70
+ #: simple-google-recaptcha.php:55
71
  msgid ""
72
  "<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" "
73
  "rel=\"external\">register your domain</a> first, get required keys from "
74
  "Google and save them bellow.</p>"
75
  msgstr ""
76
 
77
+ #: simple-google-recaptcha.php:119
78
  msgid "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>"
79
  msgstr ""
80
 
81
+ #: simple-google-recaptcha.php:119 simple-google-recaptcha.php:123
82
+ msgid "Back"
83
+ msgstr ""
84
+
85
+ #: simple-google-recaptcha.php:123
86
  msgid ""
87
  "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have "
88
  "JavaScript enabled?</p>"
readme.txt CHANGED
@@ -1,21 +1,21 @@
1
  === Simple Google reCAPTCHA ===
2
  Contributors: Minor
3
- Tags: recaptcha, spam, block, captcha, bots, brute-force, protect, comments, secure, admin, attack
4
  Requires at least: 4.2.0
5
  Tested up to: 4.7
6
- Stable tag: 1.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
  Simply protect your WordPress against spam comments and brute-force attacks, thanks to Google reCAPTCHA!
11
 
12
  == Description ==
13
- Simple Google reCAPTCHA will protect your WordPress! No more spam comments and brute-force attacks against user accounts. Really lightweight plugin - just around 10 kB to download!
14
 
15
  = What is protected with Google reCAPTCHA? =
16
  * Comment form
17
  * New password form
18
- * Registration form
19
  * Login form
20
 
21
  You can choose where reCAPTCHA will be required.
@@ -40,6 +40,10 @@ Just pure protection - no ads and any other unnecessary changes in the WordPress
40
  5. Simple Google reCAPTCHA - Settings
41
 
42
  == Changelog ==
 
 
 
 
43
  = 1.7 =
44
  * Bugfix: reCAPCTHA will be required only If the form has been submitted
45
  * You can choose where reCAPTCHA will be required
1
  === Simple Google reCAPTCHA ===
2
  Contributors: Minor
3
+ Tags: recaptcha, spam, block, captcha, bots, brute-force, protect, comments, secure, admin, attack, buddypress, registration
4
  Requires at least: 4.2.0
5
  Tested up to: 4.7
6
+ Stable tag: 1.8
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
  Simply protect your WordPress against spam comments and brute-force attacks, thanks to Google reCAPTCHA!
11
 
12
  == Description ==
13
+ Simple Google reCAPTCHA will protect your WordPress! No more spam comments and brute-force attacks against user accounts. Really lightweight plugin - just around 8 KB to download!
14
 
15
  = What is protected with Google reCAPTCHA? =
16
  * Comment form
17
  * New password form
18
+ * Registration form (including BuddyPress)
19
  * Login form
20
 
21
  You can choose where reCAPTCHA will be required.
40
  5. Simple Google reCAPTCHA - Settings
41
 
42
  == Changelog ==
43
+ = 1.8 =
44
+ * New: reCAPTCHA verification on the BuddyPress registration page
45
+ * Bugfix: Translatable back button "Zpět"
46
+
47
  = 1.7 =
48
  * Bugfix: reCAPCTHA will be required only If the form has been submitted
49
  * You can choose where reCAPTCHA will be required
simple-google-recaptcha.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  * Plugin Name: Simple Google reCAPTCHA
4
  * Description: Simply protect your WordPress against spam comments and brute-force attacks, thanks to Google reCAPTCHA!
5
- * Version: 1.7
6
  * Author: Michal Nov&aacute;k
7
  * Author URI: https://www.novami.cz
8
  * License: GPL3
@@ -37,8 +37,9 @@ function sgr_display_options() {
37
  add_settings_field("sgr_logged_users_comments_disable", __("Disable reCAPTCHA in comment form for logged in users", "sgr"), "sgr_display_logged_users_comments_disable", "sgr-options", "sgr_header_section");
38
  add_settings_field("sgr_comment_form_disable", __("Disable reCAPTCHA for comments", "sgr"), "sgr_display_comment_form_disable", "sgr-options", "sgr_header_section");
39
  add_settings_field("sgr_login_form_disable", __("Disable reCAPTCHA for login page", "sgr"), "sgr_display_login_form_disable", "sgr-options", "sgr_header_section");
40
- add_settings_field("sgr_register_form_disable", __("Disable reCAPTCHA for register page", "sgr"), "sgr_display_register_form_disable", "sgr-options", "sgr_header_section");
41
  add_settings_field("sgr_forgot_form_disable", __("Disable reCAPTCHA for forgot password page", "sgr"), "sgr_display_forgot_form_disable", "sgr-options", "sgr_header_section");
 
42
 
43
  register_setting("sgr_header_section", "sgr_site_key");
44
  register_setting("sgr_header_section", "sgr_secret_key");
@@ -47,6 +48,7 @@ function sgr_display_options() {
47
  register_setting("sgr_header_section", "sgr_login_form_disable");
48
  register_setting("sgr_header_section", "sgr_register_form_disable");
49
  register_setting("sgr_header_section", "sgr_forgot_form_disable");
 
50
  }
51
 
52
  function sgr_display_content() {
@@ -81,6 +83,10 @@ function sgr_display_forgot_form_disable() {
81
  echo "<input type=\"checkbox\" name=\"sgr_forgot_form_disable\" id=\"sgr_forgot_form_disable\" value=\"1\" ".checked(1, get_option("sgr_forgot_form_disable"), false)." />";
82
  }
83
 
 
 
 
 
84
  add_action("admin_init", "sgr_display_options");
85
 
86
  function frontend_sgr_script() {
@@ -107,14 +113,16 @@ function sgr_verify($input) {
107
  $recaptcha_secret = get_option("sgr_secret_key");
108
  $response = wp_remote_get("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$recaptcha_response);
109
  $response = json_decode($response["body"], true);
 
110
  if ($response["success"] == true) {
111
  return $input;
112
  } else {
113
- wp_die(__("<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>", "sgr")."</p>\n\n<p><a href=".wp_get_referer().">&laquo; Zpět</a>");
114
  return null;
115
  }
 
116
  } else {
117
- wp_die(__("<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have JavaScript enabled?</p>", "sgr")."</p>\n\n<p><a href=".wp_get_referer().">&laquo; Zpět</a>");
118
  return null;
119
  }
120
  }
@@ -125,16 +133,16 @@ function sgr_check() {
125
  if (get_option("sgr_comment_form_disable") != "1" && ((is_user_logged_in() && get_option("sgr_logged_users_comments_disable") != "1") || !is_user_logged_in())) {
126
  add_action("comment_form_after_fields", "sgr_display");
127
  add_action("comment_form_logged_in_after", "sgr_display");
 
128
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
129
- do_action("preprocess_comment", $commentdata);
130
  add_action("preprocess_comment", "sgr_verify");
131
  }
132
  }
133
 
134
  if (get_option("sgr_login_form_disable") != "1") {
135
  add_action("login_form", "sgr_display" );
 
136
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
137
- do_action("wp_authenticate_user", $user);
138
  add_action("wp_authenticate_user", "sgr_verify");
139
  }
140
 
@@ -142,19 +150,27 @@ function sgr_check() {
142
 
143
  if (get_option("sgr_register_form_disable") != "1") {
144
  add_action("register_form", "sgr_display");
 
145
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
146
- do_action("registration_errors", $errors);
147
  add_action("registration_errors", "sgr_verify");
148
  }
149
  }
150
 
151
  if (get_option("sgr_forgot_form_disable") != "1") {
152
- add_action("lostpassword_form", "sgr_display");
 
153
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
154
- do_action("lostpassword_post", $errors);
155
  add_action("lostpassword_post", "sgr_verify");
156
  }
157
  }
 
 
 
 
 
 
 
 
158
  }
159
  }
160
  add_action("init", "sgr_check");
2
  /*
3
  * Plugin Name: Simple Google reCAPTCHA
4
  * Description: Simply protect your WordPress against spam comments and brute-force attacks, thanks to Google reCAPTCHA!
5
+ * Version: 1.8
6
  * Author: Michal Nov&aacute;k
7
  * Author URI: https://www.novami.cz
8
  * License: GPL3
37
  add_settings_field("sgr_logged_users_comments_disable", __("Disable reCAPTCHA in comment form for logged in users", "sgr"), "sgr_display_logged_users_comments_disable", "sgr-options", "sgr_header_section");
38
  add_settings_field("sgr_comment_form_disable", __("Disable reCAPTCHA for comments", "sgr"), "sgr_display_comment_form_disable", "sgr-options", "sgr_header_section");
39
  add_settings_field("sgr_login_form_disable", __("Disable reCAPTCHA for login page", "sgr"), "sgr_display_login_form_disable", "sgr-options", "sgr_header_section");
40
+ add_settings_field("sgr_register_form_disable", __("Disable reCAPTCHA for registration page", "sgr"), "sgr_display_register_form_disable", "sgr-options", "sgr_header_section");
41
  add_settings_field("sgr_forgot_form_disable", __("Disable reCAPTCHA for forgot password page", "sgr"), "sgr_display_forgot_form_disable", "sgr-options", "sgr_header_section");
42
+ add_settings_field("sgr_buddy_form_disable", __("Disable reCAPTCHA for BuddyPress registration page", "sgr"), "sgr_display_buddy_form_disable", "sgr-options", "sgr_header_section");
43
 
44
  register_setting("sgr_header_section", "sgr_site_key");
45
  register_setting("sgr_header_section", "sgr_secret_key");
48
  register_setting("sgr_header_section", "sgr_login_form_disable");
49
  register_setting("sgr_header_section", "sgr_register_form_disable");
50
  register_setting("sgr_header_section", "sgr_forgot_form_disable");
51
+ register_setting("sgr_header_section", "sgr_buddy_form_disable");
52
  }
53
 
54
  function sgr_display_content() {
83
  echo "<input type=\"checkbox\" name=\"sgr_forgot_form_disable\" id=\"sgr_forgot_form_disable\" value=\"1\" ".checked(1, get_option("sgr_forgot_form_disable"), false)." />";
84
  }
85
 
86
+ function sgr_display_buddy_form_disable() {
87
+ echo "<input type=\"checkbox\" name=\"sgr_buddy_form_disable\" id=\"sgr_buddy_form_disable\" value=\"1\" ".checked(1, get_option("sgr_buddy_form_disable"), false)." />";
88
+ }
89
+
90
  add_action("admin_init", "sgr_display_options");
91
 
92
  function frontend_sgr_script() {
113
  $recaptcha_secret = get_option("sgr_secret_key");
114
  $response = wp_remote_get("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$recaptcha_response);
115
  $response = json_decode($response["body"], true);
116
+
117
  if ($response["success"] == true) {
118
  return $input;
119
  } else {
120
+ wp_die(__("<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>", "sgr")."</p>\n\n<p><a href=".wp_get_referer().">&laquo; ".__("Back", "sgr")."</a>");
121
  return null;
122
  }
123
+
124
  } else {
125
+ wp_die(__("<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have JavaScript enabled?</p>", "sgr")."</p>\n\n<p><a href=".wp_get_referer().">&laquo; ".__("Back", "sgr")."</a>");
126
  return null;
127
  }
128
  }
133
  if (get_option("sgr_comment_form_disable") != "1" && ((is_user_logged_in() && get_option("sgr_logged_users_comments_disable") != "1") || !is_user_logged_in())) {
134
  add_action("comment_form_after_fields", "sgr_display");
135
  add_action("comment_form_logged_in_after", "sgr_display");
136
+
137
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
138
  add_action("preprocess_comment", "sgr_verify");
139
  }
140
  }
141
 
142
  if (get_option("sgr_login_form_disable") != "1") {
143
  add_action("login_form", "sgr_display" );
144
+
145
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
146
  add_action("wp_authenticate_user", "sgr_verify");
147
  }
148
 
150
 
151
  if (get_option("sgr_register_form_disable") != "1") {
152
  add_action("register_form", "sgr_display");
153
+
154
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
155
  add_action("registration_errors", "sgr_verify");
156
  }
157
  }
158
 
159
  if (get_option("sgr_forgot_form_disable") != "1") {
160
+ add_action("lostpassword_form", "sgr_display");
161
+
162
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
163
  add_action("lostpassword_post", "sgr_verify");
164
  }
165
  }
166
+
167
+ if (get_option("sgr_buddy_form_disable") != "1") {
168
+ add_action("bp_before_registration_submit_buttons", "sgr_display");
169
+
170
+ if ($_SERVER["REQUEST_METHOD"] == "POST") {
171
+ add_action("bp_signup_validate", "sgr_verify");
172
+ }
173
+ }
174
  }
175
  }
176
  add_action("init", "sgr_check");
style.css CHANGED
@@ -1,6 +1,8 @@
1
  .g-recaptcha {
2
  transform: scale(0.90);
3
  transform-origin: 0 0;
 
 
4
  }
5
 
6
  .login form {
1
  .g-recaptcha {
2
  transform: scale(0.90);
3
  transform-origin: 0 0;
4
+ clear: both;
5
+ padding: 10px 0;
6
  }
7
 
8
  .login form {