Version Description
Added do-not-store for when forms are stored in the DB (i.e. Flamingo). Improved wrapper ID masking and customization.
Download this release
Release Info
Developer | DaoByDesign |
Plugin | Contact Form 7 Honeypot |
Version | 1.14 |
Comparing to | |
See all releases |
Code changes from version 1.13 to 1.14
- honeypot.php +32 -11
- readme.txt +5 -2
honeypot.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nocean.ca/plugins/honeypot-module-for-contact-form-7-word
|
|
5 |
Description: Add honeypot anti-spam functionality to the popular Contact Form 7 plugin.
|
6 |
Author: Nocean
|
7 |
Author URI: http://www.nocean.ca
|
8 |
-
Version: 1.
|
9 |
Text Domain: contact-form-7-honeypot
|
10 |
Domain Path: /languages/
|
11 |
*/
|
@@ -84,7 +84,15 @@ function wpcf7_add_form_tag_honeypot() {
|
|
84 |
|
85 |
// Test if new 4.6+ functions exists
|
86 |
if (function_exists('wpcf7_add_form_tag')) {
|
87 |
-
wpcf7_add_form_tag(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
} else {
|
89 |
wpcf7_add_shortcode( 'honeypot', 'wpcf7_honeypot_formtag_handler', true );
|
90 |
}
|
@@ -108,10 +116,13 @@ function wpcf7_honeypot_formtag_handler( $tag ) {
|
|
108 |
$validation_error = wpcf7_get_validation_error( $tag->name );
|
109 |
|
110 |
$class = wpcf7_form_controls_class( 'text' );
|
111 |
-
$unique_id = uniqid('hp');
|
112 |
$atts = array();
|
113 |
$atts['class'] = $tag->get_class_option( $class );
|
114 |
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
|
|
|
|
|
|
|
|
115 |
$atts['message'] = apply_filters('wpcf7_honeypot_accessibility_message', __('Please leave this field empty.','contact-form-7-honeypot'));
|
116 |
$atts['name'] = $tag->name;
|
117 |
$atts['type'] = $tag->type;
|
@@ -124,18 +135,18 @@ function wpcf7_honeypot_formtag_handler( $tag ) {
|
|
124 |
$inputid_for = ($inputid) ? 'for="'.$atts['id'].'" ' : '';
|
125 |
$autocomplete_value = ($atts['validautocomplete']) ? 'off' : 'nope';
|
126 |
|
127 |
-
// Check if we should move the CSS off the element and into the footer
|
128 |
-
if (!empty($atts['move_inline_css'])) {
|
129 |
-
$hp_css = '#'.$
|
130 |
-
wp_register_style( 'wpcf7-'.$
|
131 |
-
wp_enqueue_style( 'wpcf7-'.$
|
132 |
-
wp_add_inline_style( 'wpcf7-'.$
|
133 |
$el_css = '';
|
134 |
} else {
|
135 |
$el_css = 'style="'.$atts['css'].'"';
|
136 |
}
|
137 |
|
138 |
-
$html = '<span id="'.$
|
139 |
if (!$atts['nomessage']) {
|
140 |
$html .= '<label ' . $inputid_for . ' class="hp-message">'.$atts['message'].'</label>';
|
141 |
}
|
@@ -229,6 +240,16 @@ function wpcf7_tg_pane_honeypot($contact_form, $args = '') {
|
|
229 |
</td>
|
230 |
</tr>
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
<tr>
|
233 |
<th scope="row">
|
234 |
<label for="<?php echo esc_attr( $args['content'] . '-validautocomplete' ); ?>"><?php echo esc_html( __( 'Use W3C Valid Autocomplete (optional)', 'contact-form-7-honeypot' ) ); ?></label>
|
@@ -255,7 +276,7 @@ function wpcf7_tg_pane_honeypot($contact_form, $args = '') {
|
|
255 |
</th>
|
256 |
<td>
|
257 |
<input type="checkbox" name="nomessage:true" id="<?php echo esc_attr( $args['content'] . '-nomessage' ); ?>" class="messagekillvalue option" /><br />
|
258 |
-
<em><?php echo __('If checked, the accessibility label will not be generated.
|
259 |
</td>
|
260 |
</tr>
|
261 |
|
5 |
Description: Add honeypot anti-spam functionality to the popular Contact Form 7 plugin.
|
6 |
Author: Nocean
|
7 |
Author URI: http://www.nocean.ca
|
8 |
+
Version: 1.14
|
9 |
Text Domain: contact-form-7-honeypot
|
10 |
Domain Path: /languages/
|
11 |
*/
|
84 |
|
85 |
// Test if new 4.6+ functions exists
|
86 |
if (function_exists('wpcf7_add_form_tag')) {
|
87 |
+
wpcf7_add_form_tag(
|
88 |
+
'honeypot',
|
89 |
+
'wpcf7_honeypot_formtag_handler',
|
90 |
+
array(
|
91 |
+
'name-attr' => true,
|
92 |
+
'do-not-store' => true,
|
93 |
+
'not-for-mail' => true
|
94 |
+
)
|
95 |
+
);
|
96 |
} else {
|
97 |
wpcf7_add_shortcode( 'honeypot', 'wpcf7_honeypot_formtag_handler', true );
|
98 |
}
|
116 |
$validation_error = wpcf7_get_validation_error( $tag->name );
|
117 |
|
118 |
$class = wpcf7_form_controls_class( 'text' );
|
|
|
119 |
$atts = array();
|
120 |
$atts['class'] = $tag->get_class_option( $class );
|
121 |
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
122 |
+
|
123 |
+
$atts['wrapper_id'] = $tag->get_option('wrapper-id');
|
124 |
+
$wrapper_id = (!empty($atts['wrapper_id'])) ? reset($atts['wrapper_id']) : uniqid('wpcf7-');
|
125 |
+
|
126 |
$atts['message'] = apply_filters('wpcf7_honeypot_accessibility_message', __('Please leave this field empty.','contact-form-7-honeypot'));
|
127 |
$atts['name'] = $tag->name;
|
128 |
$atts['type'] = $tag->type;
|
135 |
$inputid_for = ($inputid) ? 'for="'.$atts['id'].'" ' : '';
|
136 |
$autocomplete_value = ($atts['validautocomplete']) ? 'off' : 'nope';
|
137 |
|
138 |
+
// Check if we should move the CSS off the element and into the footer
|
139 |
+
if (!empty($atts['move_inline_css']) && $atts['move_inline_css'][0] === 'true') {
|
140 |
+
$hp_css = '#'.$wrapper_id.' {'.$atts['css'].'}';
|
141 |
+
wp_register_style( 'wpcf7-'.$wrapper_id.'-inline', false);
|
142 |
+
wp_enqueue_style( 'wpcf7-'.$wrapper_id.'-inline' );
|
143 |
+
wp_add_inline_style( 'wpcf7-'.$wrapper_id.'-inline', $hp_css );
|
144 |
$el_css = '';
|
145 |
} else {
|
146 |
$el_css = 'style="'.$atts['css'].'"';
|
147 |
}
|
148 |
|
149 |
+
$html = '<span id="'.$wrapper_id.'" class="wpcf7-form-control-wrap ' . $atts['name'] . '-wrap" '.$el_css.'>';
|
150 |
if (!$atts['nomessage']) {
|
151 |
$html .= '<label ' . $inputid_for . ' class="hp-message">'.$atts['message'].'</label>';
|
152 |
}
|
240 |
</td>
|
241 |
</tr>
|
242 |
|
243 |
+
<tr>
|
244 |
+
<th scope="row">
|
245 |
+
<label for="<?php echo esc_attr( $args['content'] . '-wrapper-id' ); ?>"><?php echo esc_html( __( 'Wrapper ID (optional)', 'contact-form-7-honeypot' ) ); ?></label>
|
246 |
+
</th>
|
247 |
+
<td>
|
248 |
+
<input type="text" name="wrapper-id" class="wrapper-id-value oneline option" id="<?php echo esc_attr( $args['content'] . '-wrapper-id' ); ?>" /><br>
|
249 |
+
<em><?php echo esc_html( __( 'By default the markup that wraps this form item has a random ID. You can customize it here. If you\'re unsure, leave blank.', 'contact-form-7-honeypot' ) ); ?></em>
|
250 |
+
</td>
|
251 |
+
</tr>
|
252 |
+
|
253 |
<tr>
|
254 |
<th scope="row">
|
255 |
<label for="<?php echo esc_attr( $args['content'] . '-validautocomplete' ); ?>"><?php echo esc_html( __( 'Use W3C Valid Autocomplete (optional)', 'contact-form-7-honeypot' ) ); ?></label>
|
276 |
</th>
|
277 |
<td>
|
278 |
<input type="checkbox" name="nomessage:true" id="<?php echo esc_attr( $args['content'] . '-nomessage' ); ?>" class="messagekillvalue option" /><br />
|
279 |
+
<em><?php echo __('If checked, the accessibility label will not be generated. This is not recommended, but may improve spam blocking. If you\'re unsure, leave this unchecked.','contact-form-7-honeypot'); ?></em>
|
280 |
</td>
|
281 |
</tr>
|
282 |
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Contact Form 7 Honeypot ===
|
2 |
Tags: honeypot, antispam, captcha, spam, form, forms, contact form 7, contactform7, contact form, cf7, cforms, Contact Forms 7, Contact Forms, contacts
|
3 |
Requires at least: 3.5
|
4 |
-
Tested up to:
|
5 |
-
Stable tag: 1.
|
6 |
Contributors: DaoByDesign
|
7 |
Donate link: http://www.nocean.ca/buy-us-a-coffee/
|
8 |
License: GPLv2 or later
|
@@ -68,6 +68,9 @@ For examples of the above, please see this [recipe Gist](https://gist.github.com
|
|
68 |
* This is by design, and we recommend leaving this validation error for enhanced improvement of the plugin. However, there is a simple work around. See [here](https://wordpress.org/support/topic/w3c-validation-in-1-11-explanation-and-work-arounds/) for details.
|
69 |
|
70 |
== Changelog ==
|
|
|
|
|
|
|
71 |
= 1.13 =
|
72 |
Additional functionality to improve spam-stopping power.
|
73 |
|
1 |
=== Contact Form 7 Honeypot ===
|
2 |
Tags: honeypot, antispam, captcha, spam, form, forms, contact form 7, contactform7, contact form, cf7, cforms, Contact Forms 7, Contact Forms, contacts
|
3 |
Requires at least: 3.5
|
4 |
+
Tested up to: 5.0
|
5 |
+
Stable tag: 1.14
|
6 |
Contributors: DaoByDesign
|
7 |
Donate link: http://www.nocean.ca/buy-us-a-coffee/
|
8 |
License: GPLv2 or later
|
68 |
* This is by design, and we recommend leaving this validation error for enhanced improvement of the plugin. However, there is a simple work around. See [here](https://wordpress.org/support/topic/w3c-validation-in-1-11-explanation-and-work-arounds/) for details.
|
69 |
|
70 |
== Changelog ==
|
71 |
+
= 1.14 =
|
72 |
+
Added do-not-store for when forms are stored in the DB (i.e. Flamingo). Improved wrapper ID masking and customization.
|
73 |
+
|
74 |
= 1.13 =
|
75 |
Additional functionality to improve spam-stopping power.
|
76 |
|