Version Description
- Various bug fixes.
Download this release
Release Info
Developer | thethemefoundry |
Plugin | Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.2.2
- assets/css/frontend.css +1 -2
- happyforms.php +2 -2
- inc/classes/class-happyforms-plugin.php +5 -0
- inc/classes/class-message-controller.php +25 -19
- inc/classes/parts/class-part-address.php +4 -2
- inc/classes/parts/class-part-checkbox.php +6 -2
- inc/classes/parts/class-part-date.php +4 -0
- inc/classes/parts/class-part-radio.php +1 -1
- inc/helpers/helper-form-templates.php +35 -65
- inc/templates/frontend-form.php +3 -4
- readme.txt +18 -1
assets/css/frontend.css
CHANGED
@@ -457,8 +457,7 @@
|
|
457 |
|
458 |
.happyforms-part--radio .option-label input,
|
459 |
.happyforms-part--checkbox .option-label input {
|
460 |
-
|
461 |
-
visibility: hidden;
|
462 |
}
|
463 |
|
464 |
.happyforms-part--radio input:checked ~ .border,
|
457 |
|
458 |
.happyforms-part--radio .option-label input,
|
459 |
.happyforms-part--checkbox .option-label input {
|
460 |
+
top: 3px;
|
|
|
461 |
}
|
462 |
|
463 |
.happyforms-part--radio input:checked ~ .border,
|
happyforms.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Plugin URI: https://happyforms.me
|
6 |
* Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
|
7 |
* Author: The Theme Foundry
|
8 |
-
* Version: 1.2
|
9 |
* Author URI: https://thethemefoundry.com
|
10 |
* Upgrade URI: https://thethemefoundry.com
|
11 |
*/
|
@@ -13,7 +13,7 @@
|
|
13 |
/**
|
14 |
* The current version of the plugin.
|
15 |
*/
|
16 |
-
define( 'HAPPYFORMS_VERSION', '1.2' );
|
17 |
|
18 |
if ( ! function_exists( 'happyforms_plugin_file' ) ):
|
19 |
/**
|
5 |
* Plugin URI: https://happyforms.me
|
6 |
* Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
|
7 |
* Author: The Theme Foundry
|
8 |
+
* Version: 1.2.2
|
9 |
* Author URI: https://thethemefoundry.com
|
10 |
* Upgrade URI: https://thethemefoundry.com
|
11 |
*/
|
13 |
/**
|
14 |
* The current version of the plugin.
|
15 |
*/
|
16 |
+
define( 'HAPPYFORMS_VERSION', '1.2.2' );
|
17 |
|
18 |
if ( ! function_exists( 'happyforms_plugin_file' ) ):
|
19 |
/**
|
inc/classes/class-happyforms-plugin.php
CHANGED
@@ -383,6 +383,11 @@ class HappyForms_Plugin {
|
|
383 |
|
384 |
foreach ( $shortcodes as $shortcode ) {
|
385 |
$attrs = shortcode_parse_atts( $shortcode );
|
|
|
|
|
|
|
|
|
|
|
386 |
$form_id = $attrs['id'];
|
387 |
$form = $form_controller->get( $form_id );
|
388 |
|
383 |
|
384 |
foreach ( $shortcodes as $shortcode ) {
|
385 |
$attrs = shortcode_parse_atts( $shortcode );
|
386 |
+
|
387 |
+
if ( false === strpos( $attrs[0], 'happyforms' ) ) {
|
388 |
+
continue;
|
389 |
+
}
|
390 |
+
|
391 |
$form_id = $attrs['id'];
|
392 |
$form = $form_controller->get( $form_id );
|
393 |
|
inc/classes/class-message-controller.php
CHANGED
@@ -68,6 +68,15 @@ class HappyForms_Message_Controller {
|
|
68 |
*/
|
69 |
public $unread_transient = 'happyforms_unread_messages';
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* The singleton constructor.
|
73 |
*
|
@@ -183,16 +192,18 @@ class HappyForms_Message_Controller {
|
|
183 |
}
|
184 |
|
185 |
$nonce = $_REQUEST[$this->nonce_name];
|
|
|
186 |
$form_id = intval( $_REQUEST[$this->submit_parameter] );
|
|
|
187 |
|
188 |
-
if ( !
|
189 |
wp_die( $bad_request_error );
|
190 |
}
|
191 |
|
192 |
$form = happyforms_get_form_controller()->get( $form_id );
|
193 |
|
194 |
if ( happyforms_get_form_controller()->has_spam_protection( $form ) ) {
|
195 |
-
if ( ! $this->validate_honeypot( $
|
196 |
$redirect_url = home_url( wp_get_raw_referer() );
|
197 |
|
198 |
// Redirect silently, like everything's good.
|
@@ -282,17 +293,12 @@ class HappyForms_Message_Controller {
|
|
282 |
*
|
283 |
* @since 1.0
|
284 |
*
|
285 |
-
* @param string $nonce The submitted nonce value.
|
286 |
-
*
|
287 |
* @return boolean
|
288 |
*/
|
289 |
-
private function validate_honeypot( $
|
290 |
-
$
|
291 |
-
$
|
292 |
-
$
|
293 |
-
|
294 |
-
$validated = isset( $_REQUEST[$honeypot_part_id] )
|
295 |
-
&& empty( $_REQUEST[$honeypot_part_id] );
|
296 |
|
297 |
return $validated;
|
298 |
}
|
@@ -338,15 +344,17 @@ class HappyForms_Message_Controller {
|
|
338 |
return $error;
|
339 |
}
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
$result = wp_insert_post( wp_slash( $attrs ), true );
|
344 |
-
}
|
345 |
|
346 |
-
if ( ! is_wp_error( $
|
347 |
-
$message = $this->get( $
|
348 |
$this->email_owner_confirmation( $form, $message );
|
349 |
$this->email_user_confirmation( $form, $message );
|
|
|
|
|
|
|
|
|
350 |
}
|
351 |
}
|
352 |
|
@@ -529,8 +537,6 @@ class HappyForms_Message_Controller {
|
|
529 |
* @return boolean
|
530 |
*/
|
531 |
private function send_mail( $recipient, $subject, $content ) {
|
532 |
-
$original_content_type = apply_filters( 'wp_mail_content_type' );
|
533 |
-
|
534 |
add_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
535 |
$result = wp_mail( $recipient, $subject, $content );
|
536 |
remove_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
68 |
*/
|
69 |
public $unread_transient = 'happyforms_unread_messages';
|
70 |
|
71 |
+
/**
|
72 |
+
* The honeypot part type.
|
73 |
+
*
|
74 |
+
* @since 1.1
|
75 |
+
*
|
76 |
+
* @var string
|
77 |
+
*/
|
78 |
+
public $honeypot_part_type = 'single_line_text';
|
79 |
+
|
80 |
/**
|
81 |
* The singleton constructor.
|
82 |
*
|
192 |
}
|
193 |
|
194 |
$nonce = $_REQUEST[$this->nonce_name];
|
195 |
+
$prefix = happyforms_get_message_controller()->nonce_prefix;
|
196 |
$form_id = intval( $_REQUEST[$this->submit_parameter] );
|
197 |
+
$action = "{$prefix}{$form_id}";
|
198 |
|
199 |
+
if ( ! wp_verify_nonce( $nonce, $action ) ) {
|
200 |
wp_die( $bad_request_error );
|
201 |
}
|
202 |
|
203 |
$form = happyforms_get_form_controller()->get( $form_id );
|
204 |
|
205 |
if ( happyforms_get_form_controller()->has_spam_protection( $form ) ) {
|
206 |
+
if ( ! $this->validate_honeypot( $form_id ) ) {
|
207 |
$redirect_url = home_url( wp_get_raw_referer() );
|
208 |
|
209 |
// Redirect silently, like everything's good.
|
293 |
*
|
294 |
* @since 1.0
|
295 |
*
|
|
|
|
|
296 |
* @return boolean
|
297 |
*/
|
298 |
+
private function validate_honeypot( $form_id ) {
|
299 |
+
$part_id = md5( $form_id );
|
300 |
+
$honeypot_name = "happyforms-{$form_id}_single_line_text_{$part_id}";
|
301 |
+
$validated = isset( $_REQUEST[$honeypot_name] ) && empty( $_REQUEST[$honeypot_name] );
|
|
|
|
|
|
|
302 |
|
303 |
return $validated;
|
304 |
}
|
344 |
return $error;
|
345 |
}
|
346 |
|
347 |
+
$attrs = $defaults['post'] + array( 'meta_input' => $message_meta );
|
348 |
+
$message_id = wp_insert_post( wp_slash( $attrs ), true );
|
|
|
|
|
349 |
|
350 |
+
if ( ! is_wp_error( $message_id ) ) {
|
351 |
+
$message = $this->get( $message_id );
|
352 |
$this->email_owner_confirmation( $form, $message );
|
353 |
$this->email_user_confirmation( $form, $message );
|
354 |
+
|
355 |
+
if ( ! $form['save_entries'] ) {
|
356 |
+
wp_delete_post( $message_id, true);
|
357 |
+
}
|
358 |
}
|
359 |
}
|
360 |
|
537 |
* @return boolean
|
538 |
*/
|
539 |
private function send_mail( $recipient, $subject, $content ) {
|
|
|
|
|
540 |
add_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
541 |
$result = wp_mail( $recipient, $subject, $content );
|
542 |
remove_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
inc/classes/parts/class-part-address.php
CHANGED
@@ -196,7 +196,7 @@ class HappyForms_Part_Address extends HappyForms_Form_Part {
|
|
196 |
<?php if ( 'simple' === $part_data['mode'] ) : ?>
|
197 |
<div class="happyforms-part__el-wrap">
|
198 |
<div class="happyforms-part__el">
|
199 |
-
<input class="happyforms-part__el--text-input happyforms-part__el--address" type="text" placeholder="<?php echo esc_attr( $part_data['placeholder'] ); ?>" <?php if ( 1 === $part_data['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
200 |
</div>
|
201 |
</div>
|
202 |
<?php elseif ( 'autocomplete' === $part_data['mode'] ) : ?>
|
@@ -224,7 +224,9 @@ class HappyForms_Part_Address extends HappyForms_Form_Part {
|
|
224 |
</div>
|
225 |
</div>
|
226 |
<?php endif; ?>
|
227 |
-
|
|
|
|
|
228 |
<?php
|
229 |
if ( $form_data ) :
|
230 |
happyforms_message_notices( $form_data, $part_data['id'] );
|
196 |
<?php if ( 'simple' === $part_data['mode'] ) : ?>
|
197 |
<div class="happyforms-part__el-wrap">
|
198 |
<div class="happyforms-part__el">
|
199 |
+
<input name="<?php echo esc_attr( happyforms_get_part_name( $part_data['id'], $form_data['ID'] ) ); ?>" class="happyforms-part__el--text-input happyforms-part__el--address" type="text" placeholder="<?php echo esc_attr( $part_data['placeholder'] ); ?>" <?php if ( 1 === $part_data['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
200 |
</div>
|
201 |
</div>
|
202 |
<?php elseif ( 'autocomplete' === $part_data['mode'] ) : ?>
|
224 |
</div>
|
225 |
</div>
|
226 |
<?php endif; ?>
|
227 |
+
<?php if ( 'simple' !== $part_data['mode'] ) : ?>
|
228 |
+
<input type="hidden" name="<?php echo esc_attr( happyforms_get_part_name( $part_data['id'], $form_data['ID'] ) ); ?>" id="<?php echo esc_attr( $html_id ); ?>">
|
229 |
+
<?php endif; ?>
|
230 |
<?php
|
231 |
if ( $form_data ) :
|
232 |
happyforms_message_notices( $form_data, $part_data['id'] );
|
inc/classes/parts/class-part-checkbox.php
CHANGED
@@ -258,7 +258,7 @@ class HappyForms_Part_Checkbox extends HappyForms_Form_Part {
|
|
258 |
public function frontend_item_template( $part_data, $option, $required, $form_data = array() ) {
|
259 |
?>
|
260 |
<label class="option-label" id="<?php echo esc_attr( $option['id'] ); ?>">
|
261 |
-
<input type="checkbox" name="<?php echo esc_attr( happyforms_get_part_name( $part_data['id'], $form_data['ID'] ) ); ?>[]" value="<?php echo esc_attr( $option['label'] ); ?>"<?php if ( $option['is_default'] == 1 ) : ?> checked<?php endif; ?><?php if ( 1 === intval( $required ) ) : ?> required aria-required="true"<?php endif; ?>>
|
262 |
<span class="checkmark"></span>
|
263 |
|
264 |
<span class="label"><?php echo esc_attr( $option['label'] ); ?></span>
|
@@ -276,7 +276,7 @@ class HappyForms_Part_Checkbox extends HappyForms_Form_Part {
|
|
276 |
public function preview_option_template() {
|
277 |
?>
|
278 |
<label class="option-label" id="<%= id %>">
|
279 |
-
<input type="checkbox" name="" value="<%= label %>">
|
280 |
<span class="checkmark"></span>
|
281 |
<span class="label"><%= label %></span>
|
282 |
</label>
|
@@ -322,6 +322,10 @@ class HappyForms_Part_Checkbox extends HappyForms_Form_Part {
|
|
322 |
);
|
323 |
}
|
324 |
|
|
|
|
|
|
|
|
|
325 |
/**
|
326 |
* Sanitize submitted value before storing it.
|
327 |
*
|
258 |
public function frontend_item_template( $part_data, $option, $required, $form_data = array() ) {
|
259 |
?>
|
260 |
<label class="option-label" id="<?php echo esc_attr( $option['id'] ); ?>">
|
261 |
+
<input type="checkbox" class="happyforms-visuallyhidden" name="<?php echo esc_attr( happyforms_get_part_name( $part_data['id'], $form_data['ID'] ) ); ?>[]" value="<?php echo esc_attr( $option['label'] ); ?>"<?php if ( $option['is_default'] == 1 ) : ?> checked<?php endif; ?><?php if ( 1 === intval( $required ) ) : ?> required aria-required="true"<?php endif; ?>>
|
262 |
<span class="checkmark"></span>
|
263 |
|
264 |
<span class="label"><?php echo esc_attr( $option['label'] ); ?></span>
|
276 |
public function preview_option_template() {
|
277 |
?>
|
278 |
<label class="option-label" id="<%= id %>">
|
279 |
+
<input type="checkbox" name="" value="<%= label %>">
|
280 |
<span class="checkmark"></span>
|
281 |
<span class="label"><%= label %></span>
|
282 |
</label>
|
322 |
);
|
323 |
}
|
324 |
|
325 |
+
public function get_default_value() {
|
326 |
+
return array();
|
327 |
+
}
|
328 |
+
|
329 |
/**
|
330 |
* Sanitize submitted value before storing it.
|
331 |
*
|
inc/classes/parts/class-part-date.php
CHANGED
@@ -295,6 +295,10 @@ class HappyForms_Part_Date extends HappyForms_Form_Part {
|
|
295 |
);
|
296 |
}
|
297 |
|
|
|
|
|
|
|
|
|
298 |
/**
|
299 |
* Sanitize submitted value before storing it.
|
300 |
*
|
295 |
);
|
296 |
}
|
297 |
|
298 |
+
public function get_default_value() {
|
299 |
+
return array();
|
300 |
+
}
|
301 |
+
|
302 |
/**
|
303 |
* Sanitize submitted value before storing it.
|
304 |
*
|
inc/classes/parts/class-part-radio.php
CHANGED
@@ -264,7 +264,7 @@ class HappyForms_Part_Radio extends HappyForms_Form_Part {
|
|
264 |
?>
|
265 |
<div class="happyforms-part__option happyforms-part-option" id="<?php echo esc_attr( $option['id'] ); ?>">
|
266 |
<label class="option-label">
|
267 |
-
<input type="radio" name="<?php echo esc_attr( happyforms_get_part_name( $part_data['id'], $form_data['ID'] ) ); ?>" value="<?php echo esc_attr( $option['label'] ); ?>"<?php if ( $option['is_default'] == 1 ) : ?> checked<?php endif; ?><?php if ( 1 === intval( $required ) ) : ?> required aria-required="true"<?php endif; ?>>
|
268 |
<span class="checkmark"></span>
|
269 |
<span class="border"></span>
|
270 |
|
264 |
?>
|
265 |
<div class="happyforms-part__option happyforms-part-option" id="<?php echo esc_attr( $option['id'] ); ?>">
|
266 |
<label class="option-label">
|
267 |
+
<input type="radio" class="happyforms-visuallyhidden" name="<?php echo esc_attr( happyforms_get_part_name( $part_data['id'], $form_data['ID'] ) ); ?>" value="<?php echo esc_attr( $option['label'] ); ?>"<?php if ( $option['is_default'] == 1 ) : ?> checked<?php endif; ?><?php if ( 1 === intval( $required ) ) : ?> required aria-required="true"<?php endif; ?>>
|
268 |
<span class="checkmark"></span>
|
269 |
<span class="border"></span>
|
270 |
|
inc/helpers/helper-form-templates.php
CHANGED
@@ -62,32 +62,6 @@ function happyforms_redirect_field( $form_data ) {
|
|
62 |
|
63 |
endif;
|
64 |
|
65 |
-
if ( ! function_exists( 'happyforms_get_honeypot' ) ):
|
66 |
-
/**
|
67 |
-
* Get honeypot metadata to be used through the current
|
68 |
-
* form rendering and submission routines.
|
69 |
-
*
|
70 |
-
* @since 1.0
|
71 |
-
*
|
72 |
-
* @param array $form Current form data.
|
73 |
-
*
|
74 |
-
* @return array $honeypot The honeypot metadata.
|
75 |
-
*/
|
76 |
-
function happyforms_get_honeypot( $form ) {
|
77 |
-
$id = rand( 16, 32 );
|
78 |
-
$part_id = "single_line_text_{$id}";
|
79 |
-
$position = rand( 0, count( $form['parts'] ) - 1 );
|
80 |
-
$honeypot = array(
|
81 |
-
'id' => $id,
|
82 |
-
'part_id' => $part_id,
|
83 |
-
'position' => $position,
|
84 |
-
);
|
85 |
-
|
86 |
-
return $honeypot;
|
87 |
-
}
|
88 |
-
|
89 |
-
endif;
|
90 |
-
|
91 |
if ( ! function_exists( 'happyforms_honeypot_styles' ) ):
|
92 |
/**
|
93 |
* Output honeypot styles to push the
|
@@ -100,10 +74,11 @@ if ( ! function_exists( 'happyforms_honeypot_styles' ) ):
|
|
100 |
*
|
101 |
* @return void
|
102 |
*/
|
103 |
-
function happyforms_honeypot_styles( $
|
|
|
104 |
?>
|
105 |
<style>
|
106 |
-
|
107 |
position: absolute;
|
108 |
top: -99999px;
|
109 |
left: -99999px;
|
@@ -121,64 +96,59 @@ if ( ! function_exists( 'happyforms_nonce_field' ) ):
|
|
121 |
* @since 1.0
|
122 |
*
|
123 |
* @param array $form Current form data.
|
124 |
-
* @param array $honeypot Current honeypot metadata.
|
125 |
*
|
126 |
* @return void
|
127 |
*/
|
128 |
-
function happyforms_nonce_field( $form
|
129 |
$prefix = happyforms_get_message_controller()->nonce_prefix;
|
130 |
$name = happyforms_get_message_controller()->nonce_name;
|
131 |
$form_id = $form['ID'];
|
132 |
$action = "{$prefix}{$form_id}";
|
133 |
-
$honeypot_id = dechex( $honeypot['id'] );
|
134 |
-
$nonce = wp_create_nonce( $action );
|
135 |
-
$nonce = "{$nonce}{$honeypot_id}";
|
136 |
|
137 |
-
|
138 |
-
|
|
|
|
|
139 |
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
endif;
|
144 |
|
145 |
-
if ( ! function_exists( '
|
146 |
/**
|
147 |
-
* Output the honeypot field
|
148 |
-
* position in the form parts loop.
|
149 |
*
|
150 |
-
* @since 1.
|
151 |
*
|
152 |
-
* @param array $
|
153 |
-
* @param int $current_position Current position in the form parts loop.
|
154 |
-
* @param array $part Current part data.
|
155 |
-
* @param array $form Current form data.
|
156 |
*
|
157 |
* @return void
|
158 |
*/
|
159 |
-
function
|
160 |
-
|
161 |
-
|
162 |
-
if ( $position !== $current_position ) {
|
163 |
return;
|
164 |
}
|
165 |
|
166 |
-
$
|
167 |
-
|
168 |
-
$type =
|
169 |
-
|
170 |
-
$part = array(
|
171 |
-
'id' => $part_id,
|
172 |
-
'label' => $label,
|
173 |
-
'type' => $type,
|
174 |
-
'required' => false,
|
175 |
-
);
|
176 |
-
|
177 |
-
$template = happyforms_get_part_library()->get_part_template( $part, $form );
|
178 |
-
|
179 |
-
$template = str_replace( 'input', 'input readonly', $template );
|
180 |
-
|
181 |
-
echo $template;
|
182 |
}
|
183 |
|
184 |
endif;
|
@@ -189,7 +159,7 @@ if ( ! function_exists( 'happyforms_submit' ) ):
|
|
189 |
*
|
190 |
* @since 1.0
|
191 |
*
|
192 |
-
* @param array $form
|
193 |
*
|
194 |
* @return void
|
195 |
*/
|
62 |
|
63 |
endif;
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
if ( ! function_exists( 'happyforms_honeypot_styles' ) ):
|
66 |
/**
|
67 |
* Output honeypot styles to push the
|
74 |
*
|
75 |
* @return void
|
76 |
*/
|
77 |
+
function happyforms_honeypot_styles( $form ) {
|
78 |
+
$honeypot_id = happyforms_get_honeypot( $form );
|
79 |
?>
|
80 |
<style>
|
81 |
+
#<?php echo $honeypot_id; ?> {
|
82 |
position: absolute;
|
83 |
top: -99999px;
|
84 |
left: -99999px;
|
96 |
* @since 1.0
|
97 |
*
|
98 |
* @param array $form Current form data.
|
|
|
99 |
*
|
100 |
* @return void
|
101 |
*/
|
102 |
+
function happyforms_nonce_field( $form ) {
|
103 |
$prefix = happyforms_get_message_controller()->nonce_prefix;
|
104 |
$name = happyforms_get_message_controller()->nonce_name;
|
105 |
$form_id = $form['ID'];
|
106 |
$action = "{$prefix}{$form_id}";
|
|
|
|
|
|
|
107 |
|
108 |
+
wp_nonce_field( $action, $name );
|
109 |
+
}
|
110 |
+
|
111 |
+
endif;
|
112 |
|
113 |
+
if ( ! function_exists( 'happyforms_get_honeypot' ) ):
|
114 |
+
/**
|
115 |
+
* Returns the honeypot field name.
|
116 |
+
*
|
117 |
+
* @since 1.2.2
|
118 |
+
*
|
119 |
+
* @param array $form Current form data.
|
120 |
+
*
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
function happyforms_get_honeypot( $form ) {
|
124 |
+
$form_id = $form['ID'];
|
125 |
+
$part_id = md5( $form_id );
|
126 |
+
$honeypot_id = "happyforms-{$form_id}_single_line_text_{$part_id}";
|
127 |
+
|
128 |
+
return $honeypot_id;
|
129 |
}
|
130 |
|
131 |
endif;
|
132 |
|
133 |
+
if ( ! function_exists( 'happyforms_honeypot' ) ):
|
134 |
/**
|
135 |
+
* Output the honeypot field.
|
|
|
136 |
*
|
137 |
+
* @since 1.2.2
|
138 |
*
|
139 |
+
* @param array $form Current form data.
|
|
|
|
|
|
|
140 |
*
|
141 |
* @return void
|
142 |
*/
|
143 |
+
function happyforms_honeypot( $form ) {
|
144 |
+
if ( 1 !== intval( $form['spam_prevention'] ) ) {
|
|
|
|
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
+
$honeypot_id = happyforms_get_honeypot( $form );
|
149 |
+
?>
|
150 |
+
<input id="<?php echo esc_attr( $honeypot_id ); ?>" type="text" name="<?php echo esc_attr( $honeypot_id ); ?>" placeholder="" readonly>
|
151 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
|
154 |
endif;
|
159 |
*
|
160 |
* @since 1.0
|
161 |
*
|
162 |
+
* @param array $form Current form data.
|
163 |
*
|
164 |
* @return void
|
165 |
*/
|
inc/templates/frontend-form.php
CHANGED
@@ -2,14 +2,13 @@
|
|
2 |
|
3 |
<?php do_action( 'happyforms_print_css', $form ); ?>
|
4 |
|
5 |
-
<?php
|
6 |
-
<?php happyforms_honeypot_styles( $honeypot, $form ); ?>
|
7 |
|
8 |
<form action="<?php happyforms_form_action( $form['ID'] ); ?>" id="happyforms-form-<?php echo esc_attr( $form['ID'] ); ?>" method="post">
|
9 |
<?php happyforms_action_field(); ?>
|
10 |
<?php happyforms_redirect_field( $form ); ?>
|
11 |
<?php happyforms_form_field( $form['ID'] ); ?>
|
12 |
-
<?php happyforms_nonce_field( $form
|
13 |
|
14 |
<h3 class="happyforms-form__title"><?php echo esc_html( $form['post_title'] ); ?></h3>
|
15 |
|
@@ -17,10 +16,10 @@
|
|
17 |
|
18 |
<div class="happyforms-flex">
|
19 |
<?php foreach ( $form['parts'] as $p => $part ) {
|
20 |
-
happyforms_maybe_output_honeypot( $honeypot, $p, $part, $form );
|
21 |
echo happyforms_get_part_library()->get_part_template( $part, $form );
|
22 |
} ?>
|
23 |
|
|
|
24 |
<?php happyforms_submit( $form ); ?>
|
25 |
</div>
|
26 |
|
2 |
|
3 |
<?php do_action( 'happyforms_print_css', $form ); ?>
|
4 |
|
5 |
+
<?php happyforms_honeypot_styles( $form ); ?>
|
|
|
6 |
|
7 |
<form action="<?php happyforms_form_action( $form['ID'] ); ?>" id="happyforms-form-<?php echo esc_attr( $form['ID'] ); ?>" method="post">
|
8 |
<?php happyforms_action_field(); ?>
|
9 |
<?php happyforms_redirect_field( $form ); ?>
|
10 |
<?php happyforms_form_field( $form['ID'] ); ?>
|
11 |
+
<?php happyforms_nonce_field( $form ); ?>
|
12 |
|
13 |
<h3 class="happyforms-form__title"><?php echo esc_html( $form['post_title'] ); ?></h3>
|
14 |
|
16 |
|
17 |
<div class="happyforms-flex">
|
18 |
<?php foreach ( $form['parts'] as $p => $part ) {
|
|
|
19 |
echo happyforms_get_part_library()->get_part_template( $part, $form );
|
20 |
} ?>
|
21 |
|
22 |
+
<?php happyforms_honeypot( $form ); ?>
|
23 |
<?php happyforms_submit( $form ); ?>
|
24 |
</div>
|
25 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: contact, contact form, email, feedback form, form, form builder, custom fo
|
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 4.9.2
|
7 |
Requires PHP: 5.2.4
|
8 |
-
Stable tag: 1.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -70,6 +70,12 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
|
|
70 |
|
71 |
== Changelog ==
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
= 1.2.0 =
|
74 |
* Bug fix: an error during the example form creation was preventing plugin activation.
|
75 |
|
@@ -94,6 +100,17 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
|
|
94 |
|
95 |
== Upgrade Notice ==
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
= 1.2.0 =
|
98 |
* Bug fix: an error during the example form creation was preventing plugin activation.
|
99 |
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 4.9.2
|
7 |
Requires PHP: 5.2.4
|
8 |
+
Stable tag: 1.2.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 1.2.2 =
|
74 |
+
* Various bug fixes.
|
75 |
+
|
76 |
+
= 1.2.1 =
|
77 |
+
* Bug fix: a misnamed field was preventing Address part simple mode from working correctly.
|
78 |
+
|
79 |
= 1.2.0 =
|
80 |
* Bug fix: an error during the example form creation was preventing plugin activation.
|
81 |
|
100 |
|
101 |
== Upgrade Notice ==
|
102 |
|
103 |
+
= 1.2.2 =
|
104 |
+
* Bug fix: Date and multiple option parts sanitization caused errors on PHP 7.
|
105 |
+
* Improvement: simplified Honeypot protection to avoid corner-cases.
|
106 |
+
* Bug fix: an unset variable caused errors on PHP 7 during message submission storage.
|
107 |
+
* Bug fix: unset, required checkboxes would prevent forms from submitting correctly.
|
108 |
+
* Bug fix: removed misused filter causing fatal error on PHP 7.
|
109 |
+
* Bug fix: mixed shortcodes were causing notices.
|
110 |
+
|
111 |
+
= 1.2.1 =
|
112 |
+
* Bug fix: Address part bug fix.
|
113 |
+
|
114 |
= 1.2.0 =
|
115 |
* Bug fix: an error during the example form creation was preventing plugin activation.
|
116 |
|