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 | 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 +0 -0
- languages/sgr-cs_CZ.po +90 -90
- languages/sgr.pot +83 -84
- readme.txt +10 -7
- simple-google-recaptcha.php +27 -27
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:
|
6 |
-
"PO-Revision-Date:
|
7 |
-
"Last-Translator: Minor <blog@novami.cz>\n"
|
8 |
-
"Language-Team: \n"
|
9 |
-
"Language:
|
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 |
-
#:
|
27 |
-
msgid "
|
28 |
-
msgstr "
|
29 |
-
|
30 |
-
|
31 |
-
msgid "
|
32 |
-
msgstr "
|
33 |
-
|
34 |
-
|
35 |
-
msgid ""
|
36 |
-
"
|
37 |
-
|
38 |
-
|
39 |
-
"
|
40 |
-
"
|
41 |
-
|
42 |
-
|
43 |
-
msgid "
|
44 |
-
msgstr "
|
45 |
-
|
46 |
-
|
47 |
-
msgid "
|
48 |
-
msgstr "
|
49 |
-
|
50 |
-
#:
|
51 |
-
msgid "
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
msgstr "
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
"
|
74 |
-
"
|
75 |
-
|
76 |
-
|
77 |
-
"
|
78 |
-
"
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
msgid ""
|
86 |
-
"
|
87 |
-
|
88 |
-
|
89 |
-
"
|
90 |
-
"
|
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ák"
|
86 |
+
msgstr "Michal Nová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 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
"
|
6 |
-
"
|
7 |
-
"POT-
|
8 |
-
"
|
9 |
-
"
|
10 |
-
"
|
11 |
-
"Language
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"Content-
|
16 |
-
"
|
17 |
-
"X-Poedit-
|
18 |
-
"X-Poedit-
|
19 |
-
"X-Poedit-
|
20 |
-
"
|
21 |
-
"
|
22 |
-
"
|
23 |
-
"
|
24 |
-
"
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
msgstr ""
|
56 |
-
|
57 |
-
#:
|
58 |
-
msgid "
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#:
|
62 |
-
msgid "
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
"
|
73 |
-
"and
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
"
|
83 |
-
|
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á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 |
-
Stable tag: 1.
|
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 |
-
*
|
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
|
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.
|
6 |
* Author: Michal Nová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("
|
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
|
34 |
-
add_settings_section("
|
35 |
-
add_settings_field("sgr_site_key", __("Site Key", "sgr"), "
|
36 |
-
add_settings_field("sgr_secret_key", __("Secret Key", "sgr"), "
|
37 |
-
add_settings_field("sgr_logged_users_comments_disable", __("Disable reCAPTCHA in comment form for logged in users", "sgr"), "
|
38 |
|
39 |
-
register_setting("
|
40 |
-
register_setting("
|
41 |
-
register_setting("
|
42 |
}
|
43 |
|
44 |
-
function
|
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
|
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
|
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
|
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", "
|
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
|
77 |
echo "<div class=\"g-recaptcha\" data-sitekey=\"".get_option("sgr_site_key")."\"></div>";
|
78 |
}
|
79 |
|
80 |
-
function
|
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", "
|
102 |
}
|
103 |
|
104 |
-
add_action("comment_form_after_fields", "
|
105 |
-
add_action("login_form", "
|
106 |
-
add_action("register_form", "
|
107 |
-
add_action("lostpassword_form", "
|
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", "
|
112 |
}
|
113 |
|
114 |
do_action("wp_authenticate_user", $user);
|
115 |
-
add_action("wp_authenticate_user", "
|
116 |
|
117 |
do_action("registration_errors", $errors);
|
118 |
-
add_action("registration_errors", "
|
119 |
|
120 |
do_action("lostpassword_post", $errors);
|
121 |
-
add_action("lostpassword_post", "
|
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á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");
|