Version Description
- Warning: Removed javascript function which disabling/enabling submit button If reCAPTCHA was passed, because of incompatibility with some websites in specific cases
- Bugfix: WooCommerce - If you have activated login and register form on one page, reCAPTCHA verification is require too for register
- New: Added uninstall script which clean settings from DB while uninstall process
- New: If you activate plugin and site or secret key is empty, you will be redirect to settings page
Download this release
Release Info
Developer | Minor |
Plugin | Simple Google reCAPTCHA |
Version | 2.5 |
Comparing to | |
See all releases |
Code changes from version 2.4 to 2.5
- check.js +0 -10
- main.js +6 -0
- readme.txt +16 -13
- simple-google-recaptcha.php +20 -10
- uninstall.php +13 -0
check.js
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
window.onload = function () {
|
2 |
-
button = document.querySelector("[id*='submit']").id;
|
3 |
-
document.getElementById(button).disabled = true;
|
4 |
-
document.getElementById(button).title = sgr_recaptcha_trans.title;
|
5 |
-
}
|
6 |
-
|
7 |
-
function enableBtn() {
|
8 |
-
document.getElementById(button).disabled = false;
|
9 |
-
document.getElementById(button).removeAttribute("title");
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function sgr() {
|
2 |
+
var recaptcha = document.getElementsByClassName("g-recaptcha");
|
3 |
+
for (var i = 0; i < recaptcha.length; i++) {
|
4 |
+
grecaptcha.render(recaptcha.item(i), {"sitekey" : sgr_recaptcha.site_key});
|
5 |
+
}
|
6 |
+
};
|
readme.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
=== Simple Google reCAPTCHA ===
|
2 |
Contributors: Minor
|
3 |
-
Tags: recaptcha, spam, block, captcha, bots, brute, force, protect, comments, secure, attack, registration, reset, form, buddypress, woocommerce
|
4 |
Requires at least: 4.2.0
|
5 |
-
Tested up to: 4.8
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Donate link: https://www.paypal.me/NovaMi
|
10 |
|
11 |
-
Simply protect your WordPress against spam comments and brute-force attacks
|
12 |
|
13 |
== Description ==
|
14 |
-
Simple Google reCAPTCHA will protect your WordPress! No more spam comments and brute-force attacks against user accounts. Lightweight plugin - just few KBs to download and no ads!
|
15 |
|
16 |
= What is protected with reCAPTCHA? =
|
17 |
* Comment form
|
@@ -19,20 +19,17 @@ Simple Google reCAPTCHA will protect your WordPress! No more spam comments and b
|
|
19 |
* Registration form
|
20 |
* Login form
|
21 |
* Reset password form
|
22 |
-
* BuddyPress and WooCommerce support
|
23 |
|
24 |
-
|
25 |
|
26 |
-
|
27 |
-
Thanks all of you, who are using this plugin I really appreciate it! WordPress is amazing open-source software which I'm using for free (for business too) so this plugin is my way how to say thank you!
|
28 |
If you write to me (on support center etc.) and expect an answer, be patient, please. I'm working on this plugin in my free time, it's my hobby.
|
29 |
|
30 |
|
31 |
== Installation ==
|
32 |
1. Upload Simple Google reCAPTCHA files to the "/wp-content/plugins/simple-google-recaptcha" directory, or install Simple Google reCAPTCHA through the WordPress Plugins page directly.
|
33 |
-
|
34 |
2. Activate Simple Google reCAPTCHA through the WordPress Plugins page.
|
35 |
-
|
36 |
3. Use the menu Settings => reCAPTCHA to configure Simple Google reCAPTCHA.
|
37 |
|
38 |
== Frequently Asked Questions ==
|
@@ -50,8 +47,14 @@ Just use standard Plugin overview page in WordPress admin section and deactivate
|
|
50 |
5. Simple Google reCAPTCHA - Settings
|
51 |
|
52 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
= 2.4 =
|
54 |
-
* New:
|
55 |
|
56 |
= 2.3 =
|
57 |
* New: Added donate link, you can buy me a coffee now :-)
|
@@ -70,7 +73,7 @@ Just use standard Plugin overview page in WordPress admin section and deactivate
|
|
70 |
= 2.0 =
|
71 |
* Warning: reCAPTCHA verification on the BuddyPress registration page has been removed
|
72 |
* Warning: reCAPTCHA verification on the Add new comment form for logged in users has been removed
|
73 |
-
* Warning: Due to keep Simple Google
|
74 |
* New: Language settings of reCAPTCHA is based on WordPress locale now
|
75 |
* New: Default WordPress submit buttons are disabled until reCAPTCHA isn't solved
|
76 |
* New: Added reCAPTCHA for Resset password form
|
1 |
=== Simple Google reCAPTCHA ===
|
2 |
Contributors: Minor
|
3 |
+
Tags: recaptcha, spam, block, captcha, bots, brute, force, protect, comments, secure, attack, registration, reset, form, buddypress, woocommerce, google
|
4 |
Requires at least: 4.2.0
|
5 |
+
Tested up to: 4.8.1
|
6 |
+
Stable tag: 2.5
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Donate link: https://www.paypal.me/NovaMi
|
10 |
|
11 |
+
Simply protect your WordPress against spam comments and brute-force attacks thanks to Google reCAPTCHA for free and without ads!
|
12 |
|
13 |
== Description ==
|
14 |
+
Simple Google reCAPTCHA will protect your WordPress! No more spam comments and brute-force attacks against user accounts. Lightweight plugin - just few KBs to download and no ads! BuddyPress and WooCommerce support.
|
15 |
|
16 |
= What is protected with reCAPTCHA? =
|
17 |
* Comment form
|
19 |
* Registration form
|
20 |
* Login form
|
21 |
* Reset password form
|
|
|
22 |
|
23 |
+
reCAPTCHA verification will be required just for not registered users!
|
24 |
|
25 |
+
= Thank you! =
|
26 |
+
Thanks all of you, who are using this plugin. I really appreciate it! WordPress is amazing open-source software which I'm using for free (for business too) so this plugin is my way how to say thank you!
|
27 |
If you write to me (on support center etc.) and expect an answer, be patient, please. I'm working on this plugin in my free time, it's my hobby.
|
28 |
|
29 |
|
30 |
== Installation ==
|
31 |
1. Upload Simple Google reCAPTCHA files to the "/wp-content/plugins/simple-google-recaptcha" directory, or install Simple Google reCAPTCHA through the WordPress Plugins page directly.
|
|
|
32 |
2. Activate Simple Google reCAPTCHA through the WordPress Plugins page.
|
|
|
33 |
3. Use the menu Settings => reCAPTCHA to configure Simple Google reCAPTCHA.
|
34 |
|
35 |
== Frequently Asked Questions ==
|
47 |
5. Simple Google reCAPTCHA - Settings
|
48 |
|
49 |
== Changelog ==
|
50 |
+
= 2.5 =
|
51 |
+
* Warning: Removed javascript function which disabling/enabling submit button If reCAPTCHA was passed, because of incompatibility with some websites in specific cases
|
52 |
+
* Bugfix: WooCommerce - If you have activated login and register form on one page, reCAPTCHA verification is require too for register
|
53 |
+
* New: Added uninstall script which clean settings from DB while uninstall process
|
54 |
+
* New: If you activate plugin and site or secret key is empty, you will be redirect to settings page
|
55 |
+
|
56 |
= 2.4 =
|
57 |
+
* New: reCAPTCHA verification added on every page that allows comments (not bothering registered users)
|
58 |
|
59 |
= 2.3 =
|
60 |
* New: Added donate link, you can buy me a coffee now :-)
|
73 |
= 2.0 =
|
74 |
* Warning: reCAPTCHA verification on the BuddyPress registration page has been removed
|
75 |
* Warning: reCAPTCHA verification on the Add new comment form for logged in users has been removed
|
76 |
+
* Warning: Due to keep Simple Google reCAPTCHA as simple as possible some configuration options were removed
|
77 |
* New: Language settings of reCAPTCHA is based on WordPress locale now
|
78 |
* New: Default WordPress submit buttons are disabled until reCAPTCHA isn't solved
|
79 |
* New: Added reCAPTCHA for Resset password form
|
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: 2.
|
6 |
* Author: Michal Novák
|
7 |
* Author URI: https://www.novami.cz
|
8 |
* License: GPL3
|
@@ -15,9 +15,16 @@ function sgr_add_plugin_action_links($links) {
|
|
15 |
}
|
16 |
add_filter("plugin_action_links_".plugin_basename(__FILE__), "sgr_add_plugin_action_links");
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
function sgr_options_page() {
|
19 |
echo "<div class=\"wrap\">
|
20 |
-
<h1>".__("reCAPTCHA Options", "simple-google-recaptcha")."</h1>
|
21 |
<form method=\"post\" action=\"options.php\">";
|
22 |
settings_fields("sgr_header_section");
|
23 |
do_settings_sections("sgr-options");
|
@@ -32,7 +39,7 @@ function sgr_menu() {
|
|
32 |
add_action("admin_menu", "sgr_menu");
|
33 |
|
34 |
function sgr_display_content() {
|
35 |
-
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.", "simple-google-recaptcha")."</p>";
|
36 |
}
|
37 |
|
38 |
function sgr_display_site_key_element() {
|
@@ -60,12 +67,12 @@ function load_language_sgr() {
|
|
60 |
add_action("plugins_loaded", "load_language_sgr");
|
61 |
|
62 |
function frontend_sgr_script() {
|
63 |
-
if (did_action("login_init") > 0 || function_exists(
|
64 |
-
wp_register_script("sgr_recaptcha", "https://www.google.com/recaptcha/api.js?hl=".get_locale());
|
65 |
wp_enqueue_script("sgr_recaptcha");
|
66 |
-
wp_register_script("
|
67 |
-
wp_enqueue_script("
|
68 |
-
wp_localize_script("
|
69 |
wp_enqueue_style("style", plugin_dir_url(__FILE__)."style.css");
|
70 |
|
71 |
add_action("comment_form_after_fields", "sgr_display");
|
@@ -76,13 +83,14 @@ function frontend_sgr_script() {
|
|
76 |
add_action("retrieve_password", "sgr_display");
|
77 |
add_action("resetpass_form", "sgr_display");
|
78 |
add_action("woocommerce_login_form", "sgr_display");
|
|
|
79 |
add_action("woocommerce_lostpassword_form", "sgr_display");
|
80 |
add_action("bp_after_signup_profile_fields", "sgr_display");
|
81 |
}
|
82 |
}
|
83 |
|
84 |
function sgr_display() {
|
85 |
-
echo "<div class=\"g-recaptcha\"
|
86 |
}
|
87 |
|
88 |
function sgr_verify($input) {
|
@@ -98,6 +106,7 @@ function sgr_verify($input) {
|
|
98 |
wp_die("<p><strong>".__("ERROR:", "simple-google-recaptcha")."</strong> ".__("Google reCAPTCHA verification failed.", "simple-google-recaptcha")."</p>\n\n<p><a href=".wp_get_referer().">« ".__("Back", "simple-google-recaptcha")."</a>");
|
99 |
return null;
|
100 |
}
|
|
|
101 |
} else {
|
102 |
wp_die("<p><strong>".__("ERROR:", "simple-google-recaptcha")."</strong> ".__("Google reCAPTCHA verification failed.", "simple-google-recaptcha")." ".__("Do you have JavaScript enabled?", "simple-google-recaptcha")."</p>\n\n<p><a href=".wp_get_referer().">« ".__("Back", "simple-google-recaptcha")."</a>");
|
103 |
return null;
|
@@ -105,7 +114,7 @@ function sgr_verify($input) {
|
|
105 |
}
|
106 |
|
107 |
function sgr_check() {
|
108 |
-
if (get_option("sgr_site_key")
|
109 |
|
110 |
add_action("login_enqueue_scripts", "frontend_sgr_script");
|
111 |
add_action("wp_enqueue_scripts", "frontend_sgr_script");
|
@@ -119,6 +128,7 @@ function sgr_check() {
|
|
119 |
add_action("lostpassword_post", "sgr_verify");
|
120 |
add_action("resetpass_post", "sgr_verify");
|
121 |
add_action("bp_signup_validate", "sgr_verify");
|
|
|
122 |
}
|
123 |
}
|
124 |
|
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: 2.5
|
6 |
* Author: Michal Novák
|
7 |
* Author URI: https://www.novami.cz
|
8 |
* License: GPL3
|
15 |
}
|
16 |
add_filter("plugin_action_links_".plugin_basename(__FILE__), "sgr_add_plugin_action_links");
|
17 |
|
18 |
+
function sgr_activation($plugin) {
|
19 |
+
if ($plugin == plugin_basename(__FILE__) && (empty(get_option("sgr_site_key")) || empty(get_option("sgr_secret_key")))) {
|
20 |
+
exit(wp_redirect(admin_url("options-general.php?page=sgr-options")));
|
21 |
+
}
|
22 |
+
}
|
23 |
+
add_action("activated_plugin", "sgr_activation");
|
24 |
+
|
25 |
function sgr_options_page() {
|
26 |
echo "<div class=\"wrap\">
|
27 |
+
<h1>".__("Simple Google reCAPTCHA Options", "simple-google-recaptcha")."</h1>
|
28 |
<form method=\"post\" action=\"options.php\">";
|
29 |
settings_fields("sgr_header_section");
|
30 |
do_settings_sections("sgr-options");
|
39 |
add_action("admin_menu", "sgr_menu");
|
40 |
|
41 |
function sgr_display_content() {
|
42 |
+
echo "<p>".__("You have to <a href=\"https://www.google.com/recaptcha/admin\" rel=\"external\">register your domain</a> first, get required keys (reCAPTCHA V2) from Google and save them bellow.", "simple-google-recaptcha")."</p>";
|
43 |
}
|
44 |
|
45 |
function sgr_display_site_key_element() {
|
67 |
add_action("plugins_loaded", "load_language_sgr");
|
68 |
|
69 |
function frontend_sgr_script() {
|
70 |
+
if (did_action("login_init") > 0 || function_exists("is_account_page") || function_exists("bp_get_signup_page") || (is_singular() && comments_open()) && !is_user_logged_in()) {
|
71 |
+
wp_register_script("sgr_recaptcha", "https://www.google.com/recaptcha/api.js?hl=".get_locale()."&onload=sgr&render=explicit");
|
72 |
wp_enqueue_script("sgr_recaptcha");
|
73 |
+
wp_register_script("sgr_recaptcha_main", plugin_dir_url(__FILE__)."main.js");
|
74 |
+
wp_enqueue_script("sgr_recaptcha_main");
|
75 |
+
wp_localize_script("sgr_recaptcha_main", "sgr_recaptcha", array("site_key" => get_option("sgr_site_key")));
|
76 |
wp_enqueue_style("style", plugin_dir_url(__FILE__)."style.css");
|
77 |
|
78 |
add_action("comment_form_after_fields", "sgr_display");
|
83 |
add_action("retrieve_password", "sgr_display");
|
84 |
add_action("resetpass_form", "sgr_display");
|
85 |
add_action("woocommerce_login_form", "sgr_display");
|
86 |
+
add_action("woocommerce_register_form", "sgr_display");
|
87 |
add_action("woocommerce_lostpassword_form", "sgr_display");
|
88 |
add_action("bp_after_signup_profile_fields", "sgr_display");
|
89 |
}
|
90 |
}
|
91 |
|
92 |
function sgr_display() {
|
93 |
+
echo "<div class=\"g-recaptcha\"></div>";
|
94 |
}
|
95 |
|
96 |
function sgr_verify($input) {
|
106 |
wp_die("<p><strong>".__("ERROR:", "simple-google-recaptcha")."</strong> ".__("Google reCAPTCHA verification failed.", "simple-google-recaptcha")."</p>\n\n<p><a href=".wp_get_referer().">« ".__("Back", "simple-google-recaptcha")."</a>");
|
107 |
return null;
|
108 |
}
|
109 |
+
|
110 |
} else {
|
111 |
wp_die("<p><strong>".__("ERROR:", "simple-google-recaptcha")."</strong> ".__("Google reCAPTCHA verification failed.", "simple-google-recaptcha")." ".__("Do you have JavaScript enabled?", "simple-google-recaptcha")."</p>\n\n<p><a href=".wp_get_referer().">« ".__("Back", "simple-google-recaptcha")."</a>");
|
112 |
return null;
|
114 |
}
|
115 |
|
116 |
function sgr_check() {
|
117 |
+
if (!empty(get_option("sgr_site_key")) && !empty(get_option("sgr_secret_key"))) {
|
118 |
|
119 |
add_action("login_enqueue_scripts", "frontend_sgr_script");
|
120 |
add_action("wp_enqueue_scripts", "frontend_sgr_script");
|
128 |
add_action("lostpassword_post", "sgr_verify");
|
129 |
add_action("resetpass_post", "sgr_verify");
|
130 |
add_action("bp_signup_validate", "sgr_verify");
|
131 |
+
add_action("woocommerce_register_post", "sgr_verify");
|
132 |
}
|
133 |
}
|
134 |
|
uninstall.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!defined("WP_UNINSTALL_PLUGIN")) {
|
3 |
+
exit();
|
4 |
+
}
|
5 |
+
|
6 |
+
function sgr_delete() {
|
7 |
+
global $wpdb;
|
8 |
+
delete_option("sgr_site_key");
|
9 |
+
delete_option("sgr_secret_key");
|
10 |
+
}
|
11 |
+
|
12 |
+
sgr_delete();
|
13 |
+
?>
|