Version Description
Provides backwards compatibility for pre-CF7 4.2, introduces ability to remove accessibility message.
Download this release
Release Info
Developer | DaoByDesign |
Plugin | Contact Form 7 Honeypot |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.7
- honeypot.php +114 -54
- readme.txt +7 -1
honeypot.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.daobydesign.com/free-plugins/honeypot-module-for-contact-
|
|
5 |
Description: Add honeypot anti-spam functionality to the popular Contact Form 7 plugin.
|
6 |
Author: Dao By Design
|
7 |
Author URI: http://www.daobydesign.com
|
8 |
-
Version: 1.
|
9 |
*/
|
10 |
|
11 |
/* Copyright 2015 Dao By Design (email : info@daobydesign.com)
|
@@ -64,17 +64,21 @@ function wpcf7_honeypot_shortcode_handler( $tag ) {
|
|
64 |
$validation_error = wpcf7_get_validation_error( $tag->name );
|
65 |
|
66 |
$class = wpcf7_form_controls_class( 'text' );
|
67 |
-
|
68 |
$atts = array();
|
69 |
$atts['class'] = $tag->get_class_option( $class );
|
70 |
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
71 |
$atts['message'] = __('Please leave this field empty.','wpcf7_honeypot');
|
72 |
$atts['name'] = $tag->name;
|
73 |
$atts['type'] = $tag->type;
|
|
|
74 |
$atts['validation_error'] = $validation_error;
|
75 |
$inputid = (!empty($atts['id'])) ? 'id="'.$atts['id'].'" ' : '';
|
76 |
$html = '<span class="wpcf7-form-control-wrap ' . $atts['name'] . '-wrap" style="display:none !important;visibility:hidden !important;">';
|
77 |
-
$html .= '<input ' . $inputid . 'class="' . $atts['class'] . '" type="text" name="' . $atts['name'] . '" value="" size="40" tabindex="-1"
|
|
|
|
|
|
|
78 |
$html .= $validation_error . '</span>';
|
79 |
|
80 |
// Hook for filtering finished Honeypot form element.
|
@@ -106,61 +110,117 @@ function wpcf7_honeypot_filter ( $result, $tag ) {
|
|
106 |
add_action( 'admin_init', 'wpcf7_add_tag_generator_honeypot', 35 );
|
107 |
|
108 |
function wpcf7_add_tag_generator_honeypot() {
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
|
113 |
function wpcf7_tg_pane_honeypot($contact_form, $args = '') {
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
<
|
120 |
-
<
|
121 |
-
|
122 |
-
|
123 |
-
<
|
124 |
-
<
|
125 |
-
<
|
126 |
-
|
127 |
-
|
128 |
-
<
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
<
|
135 |
-
<
|
136 |
-
|
137 |
-
|
138 |
-
<
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
<
|
144 |
-
<
|
145 |
-
|
146 |
-
|
147 |
-
<
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
160 |
</div>
|
161 |
|
162 |
-
<
|
163 |
-
|
164 |
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
5 |
Description: Add honeypot anti-spam functionality to the popular Contact Form 7 plugin.
|
6 |
Author: Dao By Design
|
7 |
Author URI: http://www.daobydesign.com
|
8 |
+
Version: 1.7
|
9 |
*/
|
10 |
|
11 |
/* Copyright 2015 Dao By Design (email : info@daobydesign.com)
|
64 |
$validation_error = wpcf7_get_validation_error( $tag->name );
|
65 |
|
66 |
$class = wpcf7_form_controls_class( 'text' );
|
67 |
+
|
68 |
$atts = array();
|
69 |
$atts['class'] = $tag->get_class_option( $class );
|
70 |
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
71 |
$atts['message'] = __('Please leave this field empty.','wpcf7_honeypot');
|
72 |
$atts['name'] = $tag->name;
|
73 |
$atts['type'] = $tag->type;
|
74 |
+
$atts['nomessage'] = $tag->get_option('nomessage');
|
75 |
$atts['validation_error'] = $validation_error;
|
76 |
$inputid = (!empty($atts['id'])) ? 'id="'.$atts['id'].'" ' : '';
|
77 |
$html = '<span class="wpcf7-form-control-wrap ' . $atts['name'] . '-wrap" style="display:none !important;visibility:hidden !important;">';
|
78 |
+
$html .= '<input ' . $inputid . 'class="' . $atts['class'] . '" type="text" name="' . $atts['name'] . '" value="" size="40" tabindex="-1" />';
|
79 |
+
if (!$atts['nomessage']) {
|
80 |
+
$html .= '<span class="hp-message">'.$atts['message'].'</span>';
|
81 |
+
}
|
82 |
$html .= $validation_error . '</span>';
|
83 |
|
84 |
// Hook for filtering finished Honeypot form element.
|
110 |
add_action( 'admin_init', 'wpcf7_add_tag_generator_honeypot', 35 );
|
111 |
|
112 |
function wpcf7_add_tag_generator_honeypot() {
|
113 |
+
if (class_exists('WPCF7_TagGenerator')) {
|
114 |
+
$tag_generator = WPCF7_TagGenerator::get_instance();
|
115 |
+
$tag_generator->add( 'honeypot', __( 'Honeypot', 'contact-form-7' ), 'wpcf7_tg_pane_honeypot' );
|
116 |
+
} else if (function_exists('wpcf7_add_tag_generator')) {
|
117 |
+
wpcf7_add_tag_generator( 'honeypot', __( 'Honeypot', 'wpcf7' ), 'wpcf7-tg-pane-honeypot', 'wpcf7_tg_pane_honeypot' );
|
118 |
+
}
|
119 |
}
|
120 |
|
121 |
function wpcf7_tg_pane_honeypot($contact_form, $args = '') {
|
122 |
+
if (class_exists('WPCF7_TagGenerator')) {
|
123 |
+
$args = wp_parse_args( $args, array() );
|
124 |
+
$description = __( "Generate a form-tag for a spam-stopping honeypot field. For more details, see %s.", 'wpcf7_honeypot' );
|
125 |
+
$desc_link = '<a href="https://wordpress.org/plugins/contact-form-7-honeypot/" target="_blank">'.__( 'CF7 Honeypot', 'wpcf7_honeypot' ).'</a>';
|
126 |
+
?>
|
127 |
+
<div class="control-box">
|
128 |
+
<fieldset>
|
129 |
+
<legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
|
130 |
+
|
131 |
+
<table class="form-table"><tbody>
|
132 |
+
<tr>
|
133 |
+
<th scope="row">
|
134 |
+
<label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label>
|
135 |
+
</th>
|
136 |
+
<td>
|
137 |
+
<input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /><br>
|
138 |
+
<em><?php echo esc_html( __( 'For better security, change "honeypot" to something less bot-recognizable.', 'wpcf7_honeypot' ) ); ?></em>
|
139 |
+
</td>
|
140 |
+
</tr>
|
141 |
+
|
142 |
+
<tr>
|
143 |
+
<th scope="row">
|
144 |
+
<label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'ID (optional)', 'contact-form-7' ) ); ?></label>
|
145 |
+
</th>
|
146 |
+
<td>
|
147 |
+
<input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" />
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
|
151 |
+
<tr>
|
152 |
+
<th scope="row">
|
153 |
+
<label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class (optional)', 'contact-form-7' ) ); ?></label>
|
154 |
+
</th>
|
155 |
+
<td>
|
156 |
+
<input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" />
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
|
160 |
+
<tr>
|
161 |
+
<th scope="row">
|
162 |
+
<label for="<?php echo esc_attr( $args['content'] . '-nomessage' ); ?>"><?php echo esc_html( __( 'Don\'t Use Useability Message (optional)', 'contact-form-7' ) ); ?></label>
|
163 |
+
</th>
|
164 |
+
<td>
|
165 |
+
<input type="checkbox" name="nomessage:true" id="<?php echo esc_attr( $args['content'] . '-nomessage' ); ?>" class="messagekillvalue option" /><br />
|
166 |
+
<em><small><?php echo __('If checked, the useability message will not be generated. <strong>This is not recommended</strong>. If you\'re unsure, leave this unchecked.','wpcf7_honeypot'); ?>"</small></em>
|
167 |
+
</td>
|
168 |
+
</tr>
|
169 |
+
|
170 |
+
</tbody></table>
|
171 |
+
</fieldset>
|
172 |
</div>
|
173 |
|
174 |
+
<div class="insert-box">
|
175 |
+
<input type="text" name="honeypot" class="tag code" readonly="readonly" onfocus="this.select()" />
|
176 |
|
177 |
+
<div class="submitbox">
|
178 |
+
<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
|
179 |
+
</div>
|
180 |
+
|
181 |
+
<br class="clear" />
|
182 |
+
</div>
|
183 |
+
<?php } else { ?>
|
184 |
+
<div id="wpcf7-tg-pane-honeypot" class="hidden">
|
185 |
+
<form action="">
|
186 |
+
<table>
|
187 |
+
<tr>
|
188 |
+
<td>
|
189 |
+
<?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?><br />
|
190 |
+
<input type="text" name="name" class="tg-name oneline" /><br />
|
191 |
+
<em><small><?php echo esc_html( __( 'For better security, change "honeypot" to something less bot-recognizable.', 'wpcf7_honeypot' ) ); ?></small></em>
|
192 |
+
</td>
|
193 |
+
<td></td>
|
194 |
+
</tr>
|
195 |
+
|
196 |
+
<tr>
|
197 |
+
<td colspan="2"><hr></td>
|
198 |
+
</tr>
|
199 |
+
|
200 |
+
<tr>
|
201 |
+
<td>
|
202 |
+
<?php echo esc_html( __( 'ID (optional)', 'contact-form-7' ) ); ?><br />
|
203 |
+
<input type="text" name="id" class="idvalue oneline option" />
|
204 |
+
</td>
|
205 |
+
<td>
|
206 |
+
<?php echo esc_html( __( 'Class (optional)', 'contact-form-7' ) ); ?><br />
|
207 |
+
<input type="text" name="class" class="classvalue oneline option" />
|
208 |
+
</td>
|
209 |
+
</tr>
|
210 |
+
<tr>
|
211 |
+
<td colspan="2">
|
212 |
+
<input type="checkbox" name="nomessage:true" id="nomessage" class="messagekillvalue option" /> <label for="nomessage"><?php echo esc_html( __( 'Don\'t Use Useability Message (optional)', 'contact-form-7' ) ); ?></label><br />
|
213 |
+
<em><small><?php echo __('If checked, the useability message will not be generated. <strong>This is not recommended</strong>. If you\'re unsure, leave this unchecked.','wpcf7_honeypot'); ?>"</small></em>
|
214 |
+
</td>
|
215 |
+
</tr>
|
216 |
+
|
217 |
+
<tr>
|
218 |
+
<td colspan="2"><hr></td>
|
219 |
+
</tr>
|
220 |
+
</table>
|
221 |
+
|
222 |
+
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7_honeypot' ) ); ?><br /><input type="text" name="honeypot" class="tag" readonly="readonly" onfocus="this.select()" /></div>
|
223 |
+
</form>
|
224 |
+
</div>
|
225 |
+
<?php }
|
226 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
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: 4.2
|
5 |
-
Stable tag: 1.
|
6 |
Contributors: DaoByDesign
|
7 |
Donate link: http://www.daobydesign.com/buy-us-a-coffee/
|
8 |
License: GPLv2 or later
|
@@ -62,6 +62,9 @@ add_filter('wpcf7_honeypot_html_output', 'my_honeypot_override', 10, 2 ); ?>`
|
|
62 |
* Yep! New in version 1.5 of the plugin you're able to adjust the HTML by hooking the output filter for the plugin. See the **Installation** section for more details.
|
63 |
|
64 |
== Changelog ==
|
|
|
|
|
|
|
65 |
= 1.6.4 =
|
66 |
Quick fix release to fix PHP error introduced in 1.6.3.
|
67 |
|
@@ -96,6 +99,9 @@ Small update for W3C compliance. Thanks <a href="http://wordpress.org/support/to
|
|
96 |
* Initial release.
|
97 |
|
98 |
== Upgrade Notice ==
|
|
|
|
|
|
|
99 |
= 1.6.3 =
|
100 |
Must update if running CF7 4.2 or above. If using less than CF7 4.2, use the v1.6.2 of this plugin.
|
101 |
|
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: 4.2
|
5 |
+
Stable tag: 1.7
|
6 |
Contributors: DaoByDesign
|
7 |
Donate link: http://www.daobydesign.com/buy-us-a-coffee/
|
8 |
License: GPLv2 or later
|
62 |
* Yep! New in version 1.5 of the plugin you're able to adjust the HTML by hooking the output filter for the plugin. See the **Installation** section for more details.
|
63 |
|
64 |
== Changelog ==
|
65 |
+
= 1.7 =
|
66 |
+
Provides backwards compatibility for pre-CF7 4.2, introduces ability to remove accessibility message.
|
67 |
+
|
68 |
= 1.6.4 =
|
69 |
Quick fix release to fix PHP error introduced in 1.6.3.
|
70 |
|
99 |
* Initial release.
|
100 |
|
101 |
== Upgrade Notice ==
|
102 |
+
= 1.7 =
|
103 |
+
Recommended update for all users using CF7 3.6 and above.
|
104 |
+
|
105 |
= 1.6.3 =
|
106 |
Must update if running CF7 4.2 or above. If using less than CF7 4.2, use the v1.6.2 of this plugin.
|
107 |
|