Simple Google reCAPTCHA - Version 1.6

Version Description

  • Changed name of settings to avoid unwanted cancellation of settings (wasn't unique name of settings for this plugin in database)
Download this release

Release Info

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

Code changes from version 1.5 to 1.6

languages/sgr-cs_CZ.mo CHANGED
Binary file
languages/sgr-cs_CZ.po CHANGED
@@ -1,90 +1,90 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Simple Google reCAPTCHA\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: Thu Aug 04 2016 19:45:38 GMT+0200\n"
6
- "PO-Revision-Date: Thu Sep 01 2016 22:16:30 GMT+0200\n"
7
- "Last-Translator: Minor <blog@novami.cz>\n"
8
- "Language-Team: \n"
9
- "Language: Czech\n"
10
- "Plural-Forms: nplurals=3; plural=( n == 1 ) ? 0 : ( n >= 2 && n <= 4 ) ? 1 : "
11
- "2\n"
12
- "MIME-Version: 1.0\n"
13
- "Content-Type: text/plain; charset=UTF-8\n"
14
- "Content-Transfer-Encoding: 8bit\n"
15
- "X-Poedit-SourceCharset: UTF-8\n"
16
- "X-Poedit-Basepath: .\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
19
- "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
20
- "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
21
- "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
22
- "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
23
- "X-Generator: Loco - https://localise.biz/\n"
24
- "X-Loco-Target-Locale: cs_CZ"
25
-
26
- #: ../simple-google-recaptcha.php:37
27
- msgid "Disable reCAPTCHA in comment form for logged in users"
28
- msgstr "Zakázat reCAPTCHA ve formuláři pro komentář pro přihlášené uživatele"
29
-
30
- #. Name of the plugin
31
- msgid "Simple Google reCAPTCHA"
32
- msgstr "Simple Google reCAPTCHA"
33
-
34
- #. Description of the plugin
35
- msgid ""
36
- "Simply protect your WordPress against spam and brute-force attacks, thanks "
37
- "to Google reCAPTCHA!"
38
- msgstr ""
39
- "Jednoduše ochraňte svůj WordPress před spamem a brute-force útoky, díky "
40
- "Google reCAPTCHA!"
41
-
42
- #. Author of the plugin
43
- msgid "Michal Nov&aacute;k"
44
- msgstr "Michal Nov&aacute;k"
45
-
46
- #. Author URI of the plugin
47
- msgid "https://www.novami.cz"
48
- msgstr "https://www.novami.cz"
49
-
50
- #: ../simple-google-recaptcha.php:13
51
- msgid "Settings"
52
- msgstr "Nastavení"
53
-
54
- #: ../simple-google-recaptcha.php:19
55
- msgid "reCAPTCHA Options"
56
- msgstr "Nastavení reCAPTCHA"
57
-
58
- #: ../simple-google-recaptcha.php:34
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íč"
69
-
70
- #: ../simple-google-recaptcha.php:45
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 Google "
74
- "and save them bellow.</p>"
75
- msgstr ""
76
- "<p>Nejprve musíte <a href=\"https://www.google.com/recaptcha/admin\" "
77
- "rel=\"external\">zaregistrovat svou doménu</a>, získat potřebné klíče od "
78
- "Googlu a nastavit je níže.</p>"
79
-
80
- #: ../simple-google-recaptcha.php:89
81
- msgid "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>"
82
- msgstr "<p><strong>CHYBA</strong>: Selhalo ověření Google reCAPTCHA.</p>"
83
-
84
- #: ../simple-google-recaptcha.php:93
85
- msgid ""
86
- "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have "
87
- "JavaScript enabled?</p>"
88
- msgstr ""
89
- "<p><strong>CHYBA</strong>: Selhalo ověření Google reCAPTCHA. Máte povolený "
90
- "JavaScript?</p>"
1
+ 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 : "
11
+ "2\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-Basepath: .\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
19
+ "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
20
+ "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
21
+ "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
22
+ "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
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"
32
+ msgstr "Nastavení"
33
+
34
+ #: simple-google-recaptcha.php:19
35
+ msgid "reCAPTCHA Options"
36
+ msgstr "Nastavení reCAPTCHA"
37
+
38
+ #: simple-google-recaptcha.php:34
39
+ msgid "What first?"
40
+ msgstr "Co nejdříve?"
41
+
42
+ #: simple-google-recaptcha.php:36
43
+ msgid "Secret Key"
44
+ msgstr "Tajný klíč"
45
+
46
+ #: simple-google-recaptcha.php:37
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 "
54
+ "Google and save them bellow.</p>"
55
+ msgstr ""
56
+ "<p>Nejprve musíte <a href=\"https://www.google.com/recaptcha/admin\" "
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>"
68
+ msgstr ""
69
+ "<p><strong>CHYBA</strong>: Selhalo ověření Google reCAPTCHA. Máte povolený "
70
+ "JavaScript?</p>"
71
+
72
+ #. Name of the plugin
73
+ msgid "Simple Google reCAPTCHA"
74
+ msgstr "Simple Google reCAPTCHA"
75
+
76
+ #. Description of the plugin
77
+ msgid ""
78
+ "Simply protect your WordPress against spam comments and brute-force attacks, "
79
+ "thanks to Google reCAPTCHA!"
80
+ msgstr ""
81
+ "Jednoduše ochraňte svůj WordPress před spam komentáři a brute-force útoky, "
82
+ "díky Google reCAPTCHA!"
83
+
84
+ #. Author of the plugin
85
+ msgid "Michal Nov&aacute;k"
86
+ msgstr "Michal Nov&aacute;k"
87
+
88
+ #. Author URI of the plugin
89
+ msgid "https://www.novami.cz"
90
+ msgstr "https://www.novami.cz"
languages/sgr.pot CHANGED
@@ -1,84 +1,83 @@
1
- # Loco Gettext template
2
- #, fuzzy
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Simple Google reCAPTCHA\n"
6
- "Report-Msgid-Bugs-To: \n"
7
- "POT-Creation-Date: Thu Aug 04 2016 19:45:38 GMT+0200\n"
8
- "POT-Revision-Date: Thu Sep 01 2016 22:14:37 GMT+0200\n"
9
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
- "Last-Translator: \n"
11
- "Language-Team: \n"
12
- "Language: \n"
13
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n"
14
- "MIME-Version: 1.0\n"
15
- "Content-Type: text/plain; charset=UTF-8\n"
16
- "Content-Transfer-Encoding: 8bit\n"
17
- "X-Poedit-SourceCharset: UTF-8\n"
18
- "X-Poedit-Basepath: .\n"
19
- "X-Poedit-SearchPath-0: ..\n"
20
- "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
21
- "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
22
- "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
23
- "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
24
- "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
25
- "X-Generator: Loco - https://localise.biz/"
26
-
27
- #. Name of the plugin
28
- msgid "Simple Google reCAPTCHA"
29
- msgstr ""
30
-
31
- #. Description of the plugin
32
- msgid ""
33
- "Simply protect your WordPress against spam and brute-force attacks, thanks "
34
- "to Google reCAPTCHA!"
35
- msgstr ""
36
-
37
- #. Author of the plugin
38
- msgid "Michal Nov&aacute;k"
39
- msgstr ""
40
-
41
- #. Author URI of the plugin
42
- msgid "https://www.novami.cz"
43
- msgstr ""
44
-
45
- #: ../simple-google-recaptcha.php:13
46
- msgid "Settings"
47
- msgstr ""
48
-
49
- #: ../simple-google-recaptcha.php:19
50
- msgid "reCAPTCHA Options"
51
- msgstr ""
52
-
53
- #: ../simple-google-recaptcha.php:34
54
- msgid "What first?"
55
- msgstr ""
56
-
57
- #: ../simple-google-recaptcha.php:35
58
- msgid "Site Key"
59
- msgstr ""
60
-
61
- #: ../simple-google-recaptcha.php:36
62
- msgid "Secret Key"
63
- msgstr ""
64
-
65
- #: ../simple-google-recaptcha.php:37
66
- msgid "Disable reCAPTCHA in comment form for logged in users"
67
- msgstr ""
68
-
69
- #: ../simple-google-recaptcha.php:45
70
- msgid ""
71
- "<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" "
72
- "rel=\"external\">register your domain</a> first, get required keys from Google "
73
- "and save them bellow.</p>"
74
- msgstr ""
75
-
76
- #: ../simple-google-recaptcha.php:89
77
- msgid "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed.</p>"
78
- msgstr ""
79
-
80
- #: ../simple-google-recaptcha.php:93
81
- msgid ""
82
- "<p><strong>ERROR</strong>: Google reCAPTCHA verification failed. Do you have "
83
- "JavaScript enabled?</p>"
84
- msgstr ""
1
+ #, fuzzy
2
+ 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"
10
+ "Language-Team: \n"
11
+ "Language: \n"
12
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-Basepath: .\n"
18
+ "X-Poedit-SearchPath-0: ..\n"
19
+ "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
20
+ "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
21
+ "_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
22
+ "esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
23
+ "esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
24
+ "X-Generator: Loco - https://localise.biz/"
25
+
26
+ #: simple-google-recaptcha.php:13
27
+ msgid "Settings"
28
+ msgstr ""
29
+
30
+ #: simple-google-recaptcha.php:19
31
+ msgid "reCAPTCHA Options"
32
+ msgstr ""
33
+
34
+ #: simple-google-recaptcha.php:34
35
+ msgid "What first?"
36
+ msgstr ""
37
+
38
+ #: simple-google-recaptcha.php:35
39
+ msgid "Site Key"
40
+ msgstr ""
41
+
42
+ #: simple-google-recaptcha.php:36
43
+ msgid "Secret Key"
44
+ msgstr ""
45
+
46
+ #: simple-google-recaptcha.php:37
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>"
65
+ msgstr ""
66
+
67
+ #. Name of the plugin
68
+ msgid "Simple Google reCAPTCHA"
69
+ msgstr ""
70
+
71
+ #. Description of the plugin
72
+ msgid ""
73
+ "Simply protect your WordPress against spam comments and brute-force attacks, "
74
+ "thanks to Google reCAPTCHA!"
75
+ msgstr ""
76
+
77
+ #. Author of the plugin
78
+ msgid "Michal Nov&aacute;k"
79
+ msgstr ""
80
+
81
+ #. Author URI of the plugin
82
+ msgid "https://www.novami.cz"
83
+ msgstr ""
 
readme.txt CHANGED
@@ -1,19 +1,19 @@
1
  === Simple Google reCAPTCHA ===
2
  Contributors: Minor
3
- Tags: recaptcha, spam, block, captcha, bots, brute-force, protect, comments, secure
4
  Requires at least: 4.2.0
5
- Tested up to: 4.6
6
- Stable tag: 1.5
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
- Simply protect your WordPress against spam and brute-force attacks, thanks to Google reCAPTCHA!
11
 
12
  == Description ==
13
- Simple Google reCAPTCHA will protect your WordPress! No more spam and brute-force attacks against user accounts.
14
 
15
  = What is protected with Google reCAPTCHA? =
16
- * Comments
17
  * New password form
18
  * Registration form
19
  * Login form
@@ -25,7 +25,7 @@ Simple Google reCAPTCHA will protect your WordPress! No more spam and brute-forc
25
 
26
  == Frequently Asked Questions ==
27
  = Why to install this plugin? =
28
- Just pure protection - no bullshits like ads and any other unnecessary changes in the WordPress core.
29
 
30
  == Screenshots ==
31
  1. Simple Google reCAPTCHA - Add new comment form
@@ -35,6 +35,9 @@ Just pure protection - no bullshits like ads and any other unnecessary changes i
35
  5. Simple Google reCAPTCHA - Settings
36
 
37
  == Changelog ==
 
 
 
38
  = 1.5 =
39
  * Possibility to disable reCAPTCHA in comment form for logged in users
40
 
1
  === Simple Google reCAPTCHA ===
2
  Contributors: Minor
3
+ Tags: recaptcha, spam, block, captcha, bots, brute-force, protect, comments, secure, admin
4
  Requires at least: 4.2.0
5
+ Tested up to: 4.7
6
+ Stable tag: 1.6
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 7 KB to download!
14
 
15
  = What is protected with Google reCAPTCHA? =
16
+ * Comment form
17
  * New password form
18
  * Registration form
19
  * Login form
25
 
26
  == Frequently Asked Questions ==
27
  = Why to install this plugin? =
28
+ Just pure protection - no ads and any other unnecessary changes in the WordPress core.
29
 
30
  == Screenshots ==
31
  1. Simple Google reCAPTCHA - Add new comment form
35
  5. Simple Google reCAPTCHA - Settings
36
 
37
  == Changelog ==
38
+ = 1.6 =
39
+ * Changed name of settings to avoid unwanted cancellation of settings (wasn't unique name of settings for this plugin in database)
40
+
41
  = 1.5 =
42
  * Possibility to disable reCAPTCHA in comment form for logged in users
43
 
simple-google-recaptcha.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  /*
3
  * Plugin Name: Simple Google reCAPTCHA
4
- * Description: Simply protect your WordPress against spam and brute-force attacks, thanks to Google reCAPTCHA!
5
- * Version: 1.5
6
  * Author: Michal Nov&aacute;k
7
  * Author URI: https://www.novami.cz
8
  * License: GPL3
@@ -18,7 +18,7 @@ function sgr_options_page() {
18
  echo "<div class=\"wrap\">
19
  <h1>".__("reCAPTCHA Options", "sgr")."</h1>
20
  <form method=\"post\" action=\"options.php\">";
21
- settings_fields("header_section");
22
  do_settings_sections("sgr-options");
23
  submit_button();
24
  echo "</form>
@@ -30,34 +30,34 @@ function sgr_menu() {
30
  }
31
  add_action("admin_menu", "sgr_menu");
32
 
33
- function display_sgr_options() {
34
- add_settings_section("header_section", __("What first?", "sgr"), "display_sgr_content", "sgr-options");
35
- add_settings_field("sgr_site_key", __("Site Key", "sgr"), "display_sgr_site_key_element", "sgr-options", "header_section");
36
- add_settings_field("sgr_secret_key", __("Secret Key", "sgr"), "display_sgr_secret_key_element", "sgr-options", "header_section");
37
- add_settings_field("sgr_logged_users_comments_disable", __("Disable reCAPTCHA in comment form for logged in users", "sgr"), "display_sgr_logged_users_comments_disable", "sgr-options", "header_section");
38
 
39
- register_setting("header_section", "sgr_site_key");
40
- register_setting("header_section", "sgr_secret_key");
41
- register_setting("header_section", "sgr_logged_users_comments_disable");
42
  }
43
 
44
- function display_sgr_content() {
45
  echo __("<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" rel=\"external\">register your domain</a> first, get required keys from Google and save them bellow.</p>", "sgr");
46
  }
47
 
48
- function display_sgr_site_key_element() {
49
  echo "<input type=\"text\" name=\"sgr_site_key\" class=\"regular-text\" id=\"sgr_site_key\" value=\"".get_option("sgr_site_key")."\" />";
50
  }
51
 
52
- function display_sgr_secret_key_element() {
53
  echo "<input type=\"text\" name=\"sgr_secret_key\" class=\"regular-text\" id=\"sgr_secret_key\" value=\"".get_option("sgr_secret_key")."\" />";
54
  }
55
 
56
- function display_sgr_logged_users_comments_disable() {
57
  echo "<input type=\"checkbox\" name=\"sgr_logged_users_comments_disable\" id=\"sgr_logged_users_comments_disable\" value=\"1\" ".checked(1, get_option("sgr_logged_users_comments_disable"), false)." />";
58
  }
59
 
60
- add_action("admin_init", "display_sgr_options");
61
 
62
  function frontend_sgr_script() {
63
  wp_register_script("recaptcha", "https://www.google.com/recaptcha/api.js");
@@ -73,11 +73,11 @@ function load_language_sgr() {
73
  }
74
  add_action("plugins_loaded", "load_language_sgr");
75
 
76
- function display_sgr() {
77
  echo "<div class=\"g-recaptcha\" data-sitekey=\"".get_option("sgr_site_key")."\"></div>";
78
  }
79
 
80
- function verify_sgr($input) {
81
  if (isset($_POST["g-recaptcha-response"])) {
82
  $recaptcha_response = sanitize_text_field($_POST["g-recaptcha-response"]);
83
  $recaptcha_secret = get_option("sgr_secret_key");
@@ -98,27 +98,27 @@ function verify_sgr($input) {
98
  function sgr_check() {
99
  if (get_option("sgr_site_key") != "" && get_option("sgr_secret_key") != "") {
100
  if (get_option("sgr_logged_users_comments_disable") != "1") {
101
- add_action("comment_form_logged_in_after", "display_sgr");
102
  }
103
 
104
- add_action("comment_form_after_fields", "display_sgr");
105
- add_action("login_form", "display_sgr" );
106
- add_action("register_form", "display_sgr");
107
- add_action("lostpassword_form", "display_sgr");
108
 
109
  if ((is_user_logged_in() && get_option("sgr_logged_users_comments_disable") != "1") || !is_user_logged_in()) {
110
  do_action("preprocess_comment", $commentdata);
111
- add_action("preprocess_comment", "verify_sgr");
112
  }
113
 
114
  do_action("wp_authenticate_user", $user);
115
- add_action("wp_authenticate_user", "verify_sgr");
116
 
117
  do_action("registration_errors", $errors);
118
- add_action("registration_errors", "verify_sgr");
119
 
120
  do_action("lostpassword_post", $errors);
121
- add_action("lostpassword_post", "verify_sgr");
122
  }
123
  }
124
  add_action("init", "sgr_check");
1
  <?php
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.6
6
  * Author: Michal Nov&aacute;k
7
  * Author URI: https://www.novami.cz
8
  * License: GPL3
18
  echo "<div class=\"wrap\">
19
  <h1>".__("reCAPTCHA Options", "sgr")."</h1>
20
  <form method=\"post\" action=\"options.php\">";
21
+ settings_fields("sgr_header_section");
22
  do_settings_sections("sgr-options");
23
  submit_button();
24
  echo "</form>
30
  }
31
  add_action("admin_menu", "sgr_menu");
32
 
33
+ function sgr_display_options() {
34
+ add_settings_section("sgr_header_section", __("What first?", "sgr"), "sgr_display_content", "sgr-options");
35
+ add_settings_field("sgr_site_key", __("Site Key", "sgr"), "sgr_display_site_key_element", "sgr-options", "sgr_header_section");
36
+ add_settings_field("sgr_secret_key", __("Secret Key", "sgr"), "sgr_display_secret_key_element", "sgr-options", "sgr_header_section");
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
 
39
+ register_setting("sgr_header_section", "sgr_site_key");
40
+ register_setting("sgr_header_section", "sgr_secret_key");
41
+ register_setting("sgr_header_section", "sgr_logged_users_comments_disable");
42
  }
43
 
44
+ function sgr_display_content() {
45
  echo __("<p>You have to <a href=\"https://www.google.com/recaptcha/admin\" rel=\"external\">register your domain</a> first, get required keys from Google and save them bellow.</p>", "sgr");
46
  }
47
 
48
+ function sgr_display_site_key_element() {
49
  echo "<input type=\"text\" name=\"sgr_site_key\" class=\"regular-text\" id=\"sgr_site_key\" value=\"".get_option("sgr_site_key")."\" />";
50
  }
51
 
52
+ function sgr_display_secret_key_element() {
53
  echo "<input type=\"text\" name=\"sgr_secret_key\" class=\"regular-text\" id=\"sgr_secret_key\" value=\"".get_option("sgr_secret_key")."\" />";
54
  }
55
 
56
+ function sgr_display_logged_users_comments_disable() {
57
  echo "<input type=\"checkbox\" name=\"sgr_logged_users_comments_disable\" id=\"sgr_logged_users_comments_disable\" value=\"1\" ".checked(1, get_option("sgr_logged_users_comments_disable"), false)." />";
58
  }
59
 
60
+ add_action("admin_init", "sgr_display_options");
61
 
62
  function frontend_sgr_script() {
63
  wp_register_script("recaptcha", "https://www.google.com/recaptcha/api.js");
73
  }
74
  add_action("plugins_loaded", "load_language_sgr");
75
 
76
+ function sgr_display() {
77
  echo "<div class=\"g-recaptcha\" data-sitekey=\"".get_option("sgr_site_key")."\"></div>";
78
  }
79
 
80
+ function sgr_verify($input) {
81
  if (isset($_POST["g-recaptcha-response"])) {
82
  $recaptcha_response = sanitize_text_field($_POST["g-recaptcha-response"]);
83
  $recaptcha_secret = get_option("sgr_secret_key");
98
  function sgr_check() {
99
  if (get_option("sgr_site_key") != "" && get_option("sgr_secret_key") != "") {
100
  if (get_option("sgr_logged_users_comments_disable") != "1") {
101
+ add_action("comment_form_logged_in_after", "sgr_display");
102
  }
103
 
104
+ add_action("comment_form_after_fields", "sgr_display");
105
+ add_action("login_form", "sgr_display" );
106
+ add_action("register_form", "sgr_display");
107
+ add_action("lostpassword_form", "sgr_display");
108
 
109
  if ((is_user_logged_in() && get_option("sgr_logged_users_comments_disable") != "1") || !is_user_logged_in()) {
110
  do_action("preprocess_comment", $commentdata);
111
+ add_action("preprocess_comment", "sgr_verify");
112
  }
113
 
114
  do_action("wp_authenticate_user", $user);
115
+ add_action("wp_authenticate_user", "sgr_verify");
116
 
117
  do_action("registration_errors", $errors);
118
+ add_action("registration_errors", "sgr_verify");
119
 
120
  do_action("lostpassword_post", $errors);
121
+ add_action("lostpassword_post", "sgr_verify");
122
  }
123
  }
124
  add_action("init", "sgr_check");