Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms - Version 1.6.2

Version Description

  • Bugfix: Date part validation was preventing valid submissions.
  • Bugfix: Number part was erroneously preventing valid empty submissions.
Download this release

Release Info

Developer thethemefoundry
Plugin Icon 128x128 Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

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.6.1
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.6.1' );
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.6.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.6.2' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
inc/classes/parts/class-part-date.php CHANGED
@@ -172,7 +172,27 @@ class HappyForms_Part_Date extends HappyForms_Form_Part {
172
 
173
  // Missing value components
174
  if ( 1 === $part['required'] ) {
175
- foreach( $validated_value as $component ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  if ( '' === $component ) {
177
  return new WP_Error( 'error', __( 'This field is required.', 'happyforms' ) );
178
  }
172
 
173
  // Missing value components
174
  if ( 1 === $part['required'] ) {
175
+ $components = array_keys( $validated_value );
176
+
177
+ switch( $part['date_type'] ) {
178
+ case 'date':
179
+ $components = array( 'year', 'month', 'day' );
180
+ break;
181
+ case 'datetime':
182
+ $components = ( '12' == $part['time_format'] ) ?
183
+ array( 'year', 'month', 'day', 'hour', 'minute', 'period' ) :
184
+ array( 'year', 'month', 'day', 'hour', 'minute' );
185
+ break;
186
+ case 'time':
187
+ $components = ( '12' == $part['time_format'] ) ?
188
+ array( 'hour', 'minute', 'period' ) :
189
+ array( 'hour', 'minute' );
190
+ break;
191
+ }
192
+
193
+ $validated_components = array_intersect_key( $validated_value, array_flip( $components ) );
194
+
195
+ foreach( $validated_components as $component ) {
196
  if ( '' === $component ) {
197
  return new WP_Error( 'error', __( 'This field is required.', 'happyforms' ) );
198
  }
inc/classes/parts/class-part-number.php CHANGED
@@ -146,12 +146,7 @@ class HappyForms_Part_Number extends HappyForms_Form_Part {
146
  $sanitized_value[1] = $_REQUEST[$part_name . '_confirmation'];
147
  }
148
 
149
- if ( ! $part_data['masked'] ) {
150
- $sanitized_value = array_map( 'intval' , $sanitized_value );
151
- } else {
152
- $sanitized_value = array_map( 'sanitize_text_field' , $sanitized_value );
153
- }
154
-
155
 
156
  return $sanitized_value;
157
  }
@@ -170,20 +165,29 @@ class HappyForms_Part_Number extends HappyForms_Form_Part {
170
  public function validate_value( $value, $part = array(), $form = array() ) {
171
  $validated_values = $value;
172
 
173
- if ( $part['required'] && empty( $validated_values ) ) {
174
  return new WP_Error( 'error', __( 'This field is required.', 'happyforms' ) );
175
  }
176
 
177
- if ( $part['required'] && ! isset( $validated_values[0] ) ) {
178
- return new WP_Error( 'error', __( 'This field is required.', 'happyforms' ) );
179
- }
 
 
 
180
 
181
- if ( isset( $validated_values[0] ) && ( $validated_values[0] < $part['min_value'] || $validated_values[0] > $part['max_value'] ) ) {
182
- return new WP_Error( 'error', __( 'This field does not match minimum and maximum allowed value.', 'happyforms' ) );
 
 
183
  }
184
 
185
- if ( isset( $validated_values[1] ) && $validated_values[0] !== $validated_values[1] ) {
186
- return new WP_Error( 'error', __( 'Number and confirmation number are not matching.', 'happyforms' ) );
 
 
 
 
187
  }
188
 
189
  return $validated_values[0];
146
  $sanitized_value[1] = $_REQUEST[$part_name . '_confirmation'];
147
  }
148
 
149
+ $sanitized_value = array_map( 'sanitize_text_field' , $sanitized_value );
 
 
 
 
 
150
 
151
  return $sanitized_value;
152
  }
165
  public function validate_value( $value, $part = array(), $form = array() ) {
166
  $validated_values = $value;
167
 
168
+ if ( $part['required'] && ( empty( $validated_values ) || '' === $validated_values[0] ) ) {
169
  return new WP_Error( 'error', __( 'This field is required.', 'happyforms' ) );
170
  }
171
 
172
+ // Non-masked, bounds check
173
+ if ( ! $part['masked'] ) {
174
+ if ( ! empty( $validated_values ) && '' !== $validated_values[0] ) {
175
+ $current_value = intval( $validated_values[0] );
176
+ $min_value = intval( $part['min_value'] );
177
+ $max_value = intval( $part['max_value'] );
178
 
179
+ if ( $current_value < $min_value || $current_value > $max_value ) {
180
+ return new WP_Error( 'error', __( 'This field does not match minimum and maximum allowed value.', 'happyforms' ) );
181
+ }
182
+ }
183
  }
184
 
185
+ // Check confirmation
186
+ if ( $part['confirmation_field'] ) {
187
+ if ( ! isset( $validated_values[1] )
188
+ || ( $validated_values[0] !== $validated_values[1] ) ) {
189
+ return new WP_Error( 'error', __( 'Number and confirmation number are not matching.', 'happyforms' ) );
190
+ }
191
  }
192
 
193
  return $validated_values[0];
languages/happyforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: HappyForms 1.6.1\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2018-09-11 14:11:26+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -934,15 +934,14 @@ msgstr ""
934
 
935
  #: inc/classes/parts/class-part-address.php:191
936
  #: inc/classes/parts/class-part-checkbox.php:166
937
- #: inc/classes/parts/class-part-date.php:177
938
  #: inc/classes/parts/class-part-email.php:141
939
  #: inc/classes/parts/class-part-email.php:145
940
  #: inc/classes/parts/class-part-legal.php:113
941
  #: inc/classes/parts/class-part-multi-line-text.php:142
942
  #: inc/classes/parts/class-part-narrative.php:125
943
  #: inc/classes/parts/class-part-narrative.php:130
944
- #: inc/classes/parts/class-part-number.php:174
945
- #: inc/classes/parts/class-part-number.php:178
946
  #: inc/classes/parts/class-part-phone.php:390
947
  #: inc/classes/parts/class-part-phone.php:394
948
  #: inc/classes/parts/class-part-radio.php:166
@@ -991,15 +990,15 @@ msgstr ""
991
  msgid "Date"
992
  msgstr ""
993
 
994
- #: inc/classes/parts/class-part-date.php:193
995
  msgid "Year input does not match maximum value allowed."
996
  msgstr ""
997
 
998
- #: inc/classes/parts/class-part-date.php:208
999
  msgid "Hour input does not match minimum and maximum value allowed."
1000
  msgstr ""
1001
 
1002
- #: inc/classes/parts/class-part-date.php:245
1003
  msgid "Not a valid date."
1004
  msgstr ""
1005
 
@@ -1071,11 +1070,11 @@ msgstr ""
1071
  msgid "Confirm Number"
1072
  msgstr ""
1073
 
1074
- #: inc/classes/parts/class-part-number.php:182
1075
  msgid "This field does not match minimum and maximum allowed value."
1076
  msgstr ""
1077
 
1078
- #: inc/classes/parts/class-part-number.php:186
1079
  #: inc/classes/parts/class-part-phone.php:398
1080
  msgid "Number and confirmation number are not matching."
1081
  msgstr ""
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: HappyForms 1.6.2\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2018-09-12 15:17:01+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
934
 
935
  #: inc/classes/parts/class-part-address.php:191
936
  #: inc/classes/parts/class-part-checkbox.php:166
937
+ #: inc/classes/parts/class-part-date.php:197
938
  #: inc/classes/parts/class-part-email.php:141
939
  #: inc/classes/parts/class-part-email.php:145
940
  #: inc/classes/parts/class-part-legal.php:113
941
  #: inc/classes/parts/class-part-multi-line-text.php:142
942
  #: inc/classes/parts/class-part-narrative.php:125
943
  #: inc/classes/parts/class-part-narrative.php:130
944
+ #: inc/classes/parts/class-part-number.php:169
 
945
  #: inc/classes/parts/class-part-phone.php:390
946
  #: inc/classes/parts/class-part-phone.php:394
947
  #: inc/classes/parts/class-part-radio.php:166
990
  msgid "Date"
991
  msgstr ""
992
 
993
+ #: inc/classes/parts/class-part-date.php:213
994
  msgid "Year input does not match maximum value allowed."
995
  msgstr ""
996
 
997
+ #: inc/classes/parts/class-part-date.php:228
998
  msgid "Hour input does not match minimum and maximum value allowed."
999
  msgstr ""
1000
 
1001
+ #: inc/classes/parts/class-part-date.php:265
1002
  msgid "Not a valid date."
1003
  msgstr ""
1004
 
1070
  msgid "Confirm Number"
1071
  msgstr ""
1072
 
1073
+ #: inc/classes/parts/class-part-number.php:180
1074
  msgid "This field does not match minimum and maximum allowed value."
1075
  msgstr ""
1076
 
1077
+ #: inc/classes/parts/class-part-number.php:189
1078
  #: inc/classes/parts/class-part-phone.php:398
1079
  msgid "Number and confirmation number are not matching."
1080
  msgstr ""
readme.txt CHANGED
@@ -5,16 +5,16 @@ Tags: contact, contact form, email, feedback form, form, form builder, custom fo
5
  Requires at least: 4.8
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
- Stable tag: 1.6.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  The WordPress form builder you need to manage and respond to conversations with customers. Easily create contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
13
 
14
- https://www.youtube.com/watch?v=X1snk2vJbXI
15
-
16
  == Description ==
17
 
 
 
18
  HappyForms is the simplest way for you to manage and respond to conversations with your website visitors. With over 10 years of experience here at The Theme Foundry, we've heard from nearly 1,000,000 business what they need from a form builder! We've heard about the wasted time trying to set up tricky forms; the frustration of emails not being delivered; and the let down of not hearing from leads. That’s why we created HappyForms: Your free and friendly drag and drop form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more! HappyForms is optimized to increase conversations with your website visitors, and to help you keep track of these conversations in a filterable archive. Have peace of mind knowing messages to-and-from are getting delivered without the hassle of spam. You'll be set up and going in 5 minutes or less.
19
 
20
  = HappyForms solves these struggles: =
@@ -79,6 +79,10 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
79
 
80
  == Changelog ==
81
 
 
 
 
 
82
  = 1.6.1 =
83
  * New feature: Single Line Text part can now be used as a subject of admin email notification.
84
  * New feature: Owner email alerts now include a "Reply and mark as read" link for easier lead followup.
@@ -254,6 +258,9 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
254
 
255
  == Upgrade Notice ==
256
 
 
 
 
257
  = 1.6.1 =
258
  * Use single line text part as email subject, reply and mark responses as read from email alert messages, bugfixes.
259
 
5
  Requires at least: 4.8
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
+ Stable tag: 1.6.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  The WordPress form builder you need to manage and respond to conversations with customers. Easily create contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
13
 
 
 
14
  == Description ==
15
 
16
+ https://www.youtube.com/watch?v=X1snk2vJbXI
17
+
18
  HappyForms is the simplest way for you to manage and respond to conversations with your website visitors. With over 10 years of experience here at The Theme Foundry, we've heard from nearly 1,000,000 business what they need from a form builder! We've heard about the wasted time trying to set up tricky forms; the frustration of emails not being delivered; and the let down of not hearing from leads. That’s why we created HappyForms: Your free and friendly drag and drop form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more! HappyForms is optimized to increase conversations with your website visitors, and to help you keep track of these conversations in a filterable archive. Have peace of mind knowing messages to-and-from are getting delivered without the hassle of spam. You'll be set up and going in 5 minutes or less.
19
 
20
  = HappyForms solves these struggles: =
79
 
80
  == Changelog ==
81
 
82
+ = 1.6.2 =
83
+ * Bugfix: Date part validation was preventing valid submissions.
84
+ * Bugfix: Number part was erroneously preventing valid empty submissions.
85
+
86
  = 1.6.1 =
87
  * New feature: Single Line Text part can now be used as a subject of admin email notification.
88
  * New feature: Owner email alerts now include a "Reply and mark as read" link for easier lead followup.
258
 
259
  == Upgrade Notice ==
260
 
261
+ = 1.6.2 =
262
+ * Bugfixes.
263
+
264
  = 1.6.1 =
265
  * Use single line text part as email subject, reply and mark responses as read from email alert messages, bugfixes.
266