Version Description
(2019-12-23) = * Added extra failsafe should CF7 reCaptcha not be removed. * Added PHP constant checks against the Contact Form 7 consts. Future proofing.
Download this release
Release Info
Developer | IQComputing |
Plugin | Contact Form 7 – reCaptcha v2 |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.2.4
- changelog.txt +8 -0
- readme.txt +6 -5
- recaptcha-v2.php +4 -4
- wpcf7-recaptcha.php +20 -10
changelog.txt
CHANGED
@@ -2,6 +2,14 @@
|
|
2 |
|
3 |
This is to keep track of all changes the plugin undertakes. The readme.txt should only contain the most recent 3.
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
= 1.2.3 =
|
6 |
|
7 |
Release Date: November 13, 2019
|
2 |
|
3 |
This is to keep track of all changes the plugin undertakes. The readme.txt should only contain the most recent 3.
|
4 |
|
5 |
+
= 1.2.4 =
|
6 |
+
|
7 |
+
Release Date: December 23, 2019
|
8 |
+
|
9 |
+
* Overview
|
10 |
+
* Added lower priority to the reCaptcha enqueue hook so we can reserve the `google-recaptcha` handle before Contact Form 7 can. This shouldn't be needed but is an additional failsafe should the Conact Form 7 enqueue hook not be removed properly.
|
11 |
+
* Added constant checks against the Contact Form 7 constants. This will ensure the plugin does not break should those change or be removed in future versions of Contact Form 7. Future-proofing.
|
12 |
+
|
13 |
= 1.2.3 =
|
14 |
|
15 |
Release Date: November 13, 2019
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: iqcomputing
|
|
3 |
Tags: contact-form-7, contact-form-7-recaptcha, recaptcha, spam
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 1.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -60,13 +60,14 @@ Should the above be correct, at this point it's time to open a support thread fo
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
63 |
= 1.2.3 (2019-10-13) =
|
64 |
* Added support for wp-config Contact Form 7 key constants.
|
65 |
* Added support for reCaptcha alignment.
|
66 |
* Fixed an issue with google response logging should the api return an error.
|
67 |
|
68 |
= 1.2.2 (2019-09-17) =
|
69 |
-
* Fixed translation function to include plugin slug. Thanks @alexclassroom !
|
70 |
-
|
71 |
-
= 1.2.1 (2019-09-09) =
|
72 |
-
* Updated the plugin name to fix Trademark infringement.
|
3 |
Tags: contact-form-7, contact-form-7-recaptcha, recaptcha, spam
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 1.2.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 1.2.4 (2019-12-23) =
|
64 |
+
* Added extra failsafe should CF7 reCaptcha not be removed.
|
65 |
+
* Added PHP constant checks against the Contact Form 7 consts. Future proofing.
|
66 |
+
|
67 |
= 1.2.3 (2019-10-13) =
|
68 |
* Added support for wp-config Contact Form 7 key constants.
|
69 |
* Added support for reCaptcha alignment.
|
70 |
* Fixed an issue with google response logging should the api return an error.
|
71 |
|
72 |
= 1.2.2 (2019-09-17) =
|
73 |
+
* Fixed translation function to include plugin slug. Thanks @alexclassroom !
|
|
|
|
|
|
recaptcha-v2.php
CHANGED
@@ -21,7 +21,7 @@ function iqfix_wpcf7_manage_hooks() {
|
|
21 |
|
22 |
// reCaptcha Enqueues
|
23 |
remove_action( 'wp_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts', 10 );
|
24 |
-
add_action( 'wp_enqueue_scripts', 'iqfix_wpcf7_recaptcha_enqueue_scripts',
|
25 |
|
26 |
// reCaptcha Footer Javascript
|
27 |
remove_action( 'wp_footer', 'wpcf7_recaptcha_onload_script', 40 );
|
@@ -72,8 +72,8 @@ function iqfix_wpcf7_recaptcha_enqueue_scripts() {
|
|
72 |
|
73 |
wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
|
74 |
wp_localize_script( 'google-recaptcha', 'wpcf7iqfix', array(
|
75 |
-
|
76 |
-
|
77 |
|
78 |
}
|
79 |
// See `iqfix_wpcf7_manage_hooks` callback above
|
@@ -176,7 +176,7 @@ document.addEventListener( 'wpcf7spam', function( event ) {
|
|
176 |
*/
|
177 |
function iqfix_wpcf7_recaptcha_form_tag_handler( $tag ) {
|
178 |
|
179 |
-
if ( ! wp_script_is( 'google-recaptcha', 'registered' ) ) {
|
180 |
wpcf7_recaptcha_enqueue_scripts();
|
181 |
}
|
182 |
|
21 |
|
22 |
// reCaptcha Enqueues
|
23 |
remove_action( 'wp_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts', 10 );
|
24 |
+
add_action( 'wp_enqueue_scripts', 'iqfix_wpcf7_recaptcha_enqueue_scripts', 9 );
|
25 |
|
26 |
// reCaptcha Footer Javascript
|
27 |
remove_action( 'wp_footer', 'wpcf7_recaptcha_onload_script', 40 );
|
72 |
|
73 |
wp_register_script( 'google-recaptcha', $url, array(), '2.0', true );
|
74 |
wp_localize_script( 'google-recaptcha', 'wpcf7iqfix', array(
|
75 |
+
'recaptcha_empty' => esc_html__( 'Please verify that you are not a robot.', 'wpcf7-recaptcha' ),
|
76 |
+
) );
|
77 |
|
78 |
}
|
79 |
// See `iqfix_wpcf7_manage_hooks` callback above
|
176 |
*/
|
177 |
function iqfix_wpcf7_recaptcha_form_tag_handler( $tag ) {
|
178 |
|
179 |
+
if ( ! wp_script_is( 'google-recaptcha', 'registered' ) && function_exists( 'wpcf7_recaptcha_enqueue_scripts' ) ) {
|
180 |
wpcf7_recaptcha_enqueue_scripts();
|
181 |
}
|
182 |
|
wpcf7-recaptcha.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: ReCaptcha v2 for Contact Form 7
|
4 |
* Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later.
|
5 |
-
* Version: 1.2.
|
6 |
* Author: IQComputing
|
7 |
* Author URI: http://www.iqcomputing.com/
|
8 |
* License: GPL2
|
@@ -18,7 +18,13 @@ defined( 'ABSPATH' ) or die( 'You cannot be here.' );
|
|
18 |
*/
|
19 |
Class IQFix_WPCF7_Deity {
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
|
24 |
/**
|
@@ -61,13 +67,14 @@ Class IQFix_WPCF7_Deity {
|
|
61 |
* @return void
|
62 |
*/
|
63 |
private function include_files() {
|
64 |
-
|
65 |
-
$selection
|
|
|
66 |
|
67 |
// Prevent update from v2 to v3 notice.
|
68 |
WPCF7::update_option( 'recaptcha_v2_v3_warning', false );
|
69 |
|
70 |
-
if( empty( $selection ) || version_compare(
|
71 |
return;
|
72 |
}
|
73 |
|
@@ -159,12 +166,14 @@ Class IQFix_WPCF7_Deity {
|
|
159 |
* @return void
|
160 |
*/
|
161 |
public function register_submenus() {
|
162 |
-
|
|
|
|
|
163 |
add_submenu_page(
|
164 |
'wpcf7',
|
165 |
esc_html__( 'reCaptcha Version', 'wpcf7-recaptcha' ),
|
166 |
esc_html__( 'reCaptcha Version', 'wpcf7-recaptcha' ),
|
167 |
-
|
168 |
'recaptcha-version',
|
169 |
array( $this, 'display_recaptcha_version_subpage' )
|
170 |
);
|
@@ -197,8 +206,9 @@ Class IQFix_WPCF7_Deity {
|
|
197 |
* @return void
|
198 |
*/
|
199 |
public function display_recaptcha_version_subpage() {
|
200 |
-
|
201 |
-
$updated
|
|
|
202 |
|
203 |
// Grab Network Settings
|
204 |
if( is_network_admin() ) {
|
@@ -218,7 +228,7 @@ Class IQFix_WPCF7_Deity {
|
|
218 |
}
|
219 |
|
220 |
// Show simple message
|
221 |
-
if( version_compare(
|
222 |
printf(
|
223 |
'<div class="wrap"><h1>%1$s</h1><p>%2$s</p></div>',
|
224 |
esc_html__( 'ReCaptcha v2 for Contact Form 7', 'wpcf7-recaptcha' ),
|
2 |
/**
|
3 |
* Plugin Name: ReCaptcha v2 for Contact Form 7
|
4 |
* Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later.
|
5 |
+
* Version: 1.2.4
|
6 |
* Author: IQComputing
|
7 |
* Author URI: http://www.iqcomputing.com/
|
8 |
* License: GPL2
|
18 |
*/
|
19 |
Class IQFix_WPCF7_Deity {
|
20 |
|
21 |
+
|
22 |
+
/**
|
23 |
+
* WPCF7 ReCaptcha Plugin Version
|
24 |
+
*
|
25 |
+
* @var String
|
26 |
+
*/
|
27 |
+
public static $version = '1.2.4';
|
28 |
|
29 |
|
30 |
/**
|
67 |
* @return void
|
68 |
*/
|
69 |
private function include_files() {
|
70 |
+
|
71 |
+
$selection = WPCF7::get_option( 'iqfix_recaptcha' );
|
72 |
+
$cf7_version = ( defined( 'WPCF7_VERSION' ) ) ? WPCF7_VERSION : WPCF7::get_option( 'version', '0' );
|
73 |
|
74 |
// Prevent update from v2 to v3 notice.
|
75 |
WPCF7::update_option( 'recaptcha_v2_v3_warning', false );
|
76 |
|
77 |
+
if( empty( $selection ) || version_compare( $cf7_version, '5.1', '<' ) ) {
|
78 |
return;
|
79 |
}
|
80 |
|
166 |
* @return void
|
167 |
*/
|
168 |
public function register_submenus() {
|
169 |
+
|
170 |
+
$cf7_admin_cap = ( defined( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY' ) ) ? WPCF7_ADMIN_READ_WRITE_CAPABILITY : 'publish_pages';
|
171 |
+
|
172 |
add_submenu_page(
|
173 |
'wpcf7',
|
174 |
esc_html__( 'reCaptcha Version', 'wpcf7-recaptcha' ),
|
175 |
esc_html__( 'reCaptcha Version', 'wpcf7-recaptcha' ),
|
176 |
+
$cf7_admin_cap,
|
177 |
'recaptcha-version',
|
178 |
array( $this, 'display_recaptcha_version_subpage' )
|
179 |
);
|
206 |
* @return void
|
207 |
*/
|
208 |
public function display_recaptcha_version_subpage() {
|
209 |
+
|
210 |
+
$updated = $this->save_recaptcha_settings();
|
211 |
+
$cf7_version = ( defined( 'WPCF7_VERSION' ) ) ? WPCF7_VERSION : WPCF7::get_option( 'version', '0' );
|
212 |
|
213 |
// Grab Network Settings
|
214 |
if( is_network_admin() ) {
|
228 |
}
|
229 |
|
230 |
// Show simple message
|
231 |
+
if( version_compare( $cf7_version, '5.1', '<' ) ) {
|
232 |
printf(
|
233 |
'<div class="wrap"><h1>%1$s</h1><p>%2$s</p></div>',
|
234 |
esc_html__( 'ReCaptcha v2 for Contact Form 7', 'wpcf7-recaptcha' ),
|