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

Version Description

  • Improvement: Form title is not rendered at all when set to "hidden".
  • Bugfix: Fields with prefix and suffix support where being validated as always filled.
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.9.27
Comparing to
See all releases

Code changes from version 1.9.26 to 1.9.27

core/classes/class-form-controller.php CHANGED
@@ -51,6 +51,7 @@ class HappyForms_Form_Controller {
51
  add_action( 'delete_post', array( $this, 'delete_post' ) );
52
 
53
  add_action( 'happyforms_form_before', array( $this, 'render_title' ) );
 
54
  }
55
 
56
  /**
@@ -804,6 +805,14 @@ class HappyForms_Form_Controller {
804
  do_action( 'happyforms_after_title', $form );
805
  }
806
 
 
 
 
 
 
 
 
 
807
  public function get_default_steps( $form ) {
808
  $steps = array(
809
  1000 => 'submit',
51
  add_action( 'delete_post', array( $this, 'delete_post' ) );
52
 
53
  add_action( 'happyforms_form_before', array( $this, 'render_title' ) );
54
+ add_filter( 'happyforms_the_form_title', array( $this, 'the_form_title' ), 10, 4 );
55
  }
56
 
57
  /**
805
  do_action( 'happyforms_after_title', $form );
806
  }
807
 
808
+ public function the_form_title( $form_title, $before, $after, $form ) {
809
+ if ( 'happyforms-form--hide-title' === happyforms_get_form_property( $form, 'form_title' ) ) {
810
+ $form_title = '';
811
+ }
812
+
813
+ return $form_title;
814
+ }
815
+
816
  public function get_default_steps( $form ) {
817
  $steps = array(
818
  1000 => 'submit',
core/classes/class-form-styles.php CHANGED
@@ -38,10 +38,10 @@ class HappyForms_Form_Styles {
38
  public function hook() {
39
  add_filter( 'happyforms_meta_fields', array( $this, 'meta_fields' ) );
40
  add_filter( 'happyforms_form_class', array( $this, 'form_html_class' ), 10, 2 );
 
41
  add_filter( 'happyforms_get_form_data', array( $this, 'control_global_label_settings') );
42
  add_filter( 'happyforms_get_form_data', array( $this, 'control_global_description_settings') );
43
  add_action( 'happyforms_do_style_control', array( $this, 'do_control' ), 10, 3 );
44
-
45
  }
46
 
47
  public function get_fields() {
@@ -90,7 +90,7 @@ class HappyForms_Form_Styles {
90
  '' => __( 'Show', 'happyforms' ),
91
  'happyforms-form--hide-title' => __( 'Hide', 'happyforms' )
92
  ),
93
- 'target' => 'form_class',
94
  'sanitize' => 'sanitize_text_field'
95
  ),
96
  'form_title_alignment' => array(
@@ -1059,6 +1059,14 @@ class HappyForms_Form_Styles {
1059
  return $class;
1060
  }
1061
 
 
 
 
 
 
 
 
 
1062
  public function form_html_styles( $form = array() ) {
1063
  $fields = $this->get_fields();
1064
  $styles = array_filter( $fields, array( $this, 'is_css_var_field' ) );
38
  public function hook() {
39
  add_filter( 'happyforms_meta_fields', array( $this, 'meta_fields' ) );
40
  add_filter( 'happyforms_form_class', array( $this, 'form_html_class' ), 10, 2 );
41
+ add_filter( 'happyforms_form_class', array( $this, 'form_html_class_title_display' ), 10, 2 );
42
  add_filter( 'happyforms_get_form_data', array( $this, 'control_global_label_settings') );
43
  add_filter( 'happyforms_get_form_data', array( $this, 'control_global_description_settings') );
44
  add_action( 'happyforms_do_style_control', array( $this, 'do_control' ), 10, 3 );
 
45
  }
46
 
47
  public function get_fields() {
90
  '' => __( 'Show', 'happyforms' ),
91
  'happyforms-form--hide-title' => __( 'Hide', 'happyforms' )
92
  ),
93
+ 'target' => '',
94
  'sanitize' => 'sanitize_text_field'
95
  ),
96
  'form_title_alignment' => array(
1059
  return $class;
1060
  }
1061
 
1062
+ public function form_html_class_title_display( $class, $form ) {
1063
+ if ( happyforms_is_preview() ) {
1064
+ $class[] = $form['form_title'];
1065
+ }
1066
+
1067
+ return $class;
1068
+ }
1069
+
1070
  public function form_html_styles( $form = array() ) {
1071
  $fields = $this->get_fields();
1072
  $styles = array_filter( $fields, array( $this, 'is_css_var_field' ) );
core/classes/parts/class-part-email.php CHANGED
@@ -110,7 +110,7 @@ class HappyForms_Part_Email extends HappyForms_Form_Part {
110
  return $part_data;
111
  }
112
 
113
- if ( ! ( empty( $part_data['prefix'] ) && empty( $part_data['suffix'] ) ) && 1 == $part_data['autocomplete_domains'] ) {
114
  $part_data['autocomplete_domains'] = 0;
115
  }
116
 
@@ -119,7 +119,7 @@ class HappyForms_Part_Email extends HappyForms_Form_Part {
119
 
120
  public function email_part_visible( $visible, $part, $form, $response ) {
121
  if ( $this->type === $part['type'] ) {
122
- if ( empty( $part['prefix'] ) && empty( $part['suffix'] ) ) {
123
  return $visible;
124
  }
125
 
@@ -211,11 +211,11 @@ class HappyForms_Part_Email extends HappyForms_Form_Part {
211
  $validation_value = $value[0];
212
  $validation_confirmation_value = '';
213
 
214
- if ( ! empty( $part['prefix'] ) ) {
215
  $validation_value = "{$part['prefix']}{$validation_value}";
216
  }
217
 
218
- if ( ! empty( $part['suffix'] ) ) {
219
  $validation_value = "{$validation_value}{$part['suffix']}";
220
  }
221
 
110
  return $part_data;
111
  }
112
 
113
+ if ( ! ( ( '' === $part_data['prefix'] ) && ( '' === $part_data['suffix'] ) ) && ( 1 == $part_data['autocomplete_domains'] ) ) {
114
  $part_data['autocomplete_domains'] = 0;
115
  }
116
 
119
 
120
  public function email_part_visible( $visible, $part, $form, $response ) {
121
  if ( $this->type === $part['type'] ) {
122
+ if ( ( '' === $part['prefix'] ) && ( '' === $part['suffix'] ) ) {
123
  return $visible;
124
  }
125
 
211
  $validation_value = $value[0];
212
  $validation_confirmation_value = '';
213
 
214
+ if ( ( '' !== $part['prefix'] ) ) {
215
  $validation_value = "{$part['prefix']}{$validation_value}";
216
  }
217
 
218
+ if ( ( '' !== $part['suffix'] ) ) {
219
  $validation_value = "{$validation_value}{$part['suffix']}";
220
  }
221
 
core/classes/parts/class-part-number.php CHANGED
@@ -139,7 +139,7 @@ class HappyForms_Part_Number extends HappyForms_Form_Part {
139
 
140
  public function email_part_visible( $visible, $part, $form, $response ) {
141
  if ( $this->type === $part['type'] ) {
142
- if ( empty( $part['mask_numeric_prefix'] ) && empty( $part['mask_numeric_suffix'] ) ) {
143
  return $visible;
144
  }
145
 
139
 
140
  public function email_part_visible( $visible, $part, $form, $response ) {
141
  if ( $this->type === $part['type'] ) {
142
+ if ( ( '' === $part['mask_numeric_prefix'] ) && ( '' === $part['mask_numeric_suffix'] ) ) {
143
  return $visible;
144
  }
145
 
core/classes/parts/class-part-single-line-text.php CHANGED
@@ -138,7 +138,7 @@ class HappyForms_Part_SingleLineText extends HappyForms_Form_Part {
138
  * @return string|object
139
  */
140
  public function validate_value( $value, $part = array(), $form = array() ) {
141
- if ( 1 === $part['required'] && empty( $value ) ) {
142
  return new WP_Error( 'error', happyforms_get_validation_message( 'field_empty' ) );
143
  }
144
 
@@ -147,13 +147,7 @@ class HappyForms_Part_SingleLineText extends HappyForms_Form_Part {
147
 
148
  public function stringify_value( $value, $part, $form ) {
149
  if ( $this->type === $part['type'] ) {
150
- if ( ! empty( $part['prefix'] ) ) {
151
- $value = "{$part['prefix']}{$value}";
152
- }
153
-
154
- if ( ! empty( $part['suffix'] ) ) {
155
- $value = "{$value}{$part['suffix']}";
156
- }
157
  }
158
 
159
  return $value;
@@ -183,10 +177,6 @@ class HappyForms_Part_SingleLineText extends HappyForms_Form_Part {
183
 
184
  public function email_part_visible( $visible, $part, $form, $response ) {
185
  if ( $this->type === $part['type'] ) {
186
- if ( empty( $part['prefix'] ) && empty( $part['suffix'] ) ) {
187
- return $visible;
188
- }
189
-
190
  $empty_value = $part['prefix'] . $part['suffix'];
191
  $value = happyforms_get_email_part_value( $response, $part, $form );
192
 
138
  * @return string|object
139
  */
140
  public function validate_value( $value, $part = array(), $form = array() ) {
141
+ if ( ( 1 === $part['required'] ) && ( '' === $value ) ) {
142
  return new WP_Error( 'error', happyforms_get_validation_message( 'field_empty' ) );
143
  }
144
 
147
 
148
  public function stringify_value( $value, $part, $form ) {
149
  if ( $this->type === $part['type'] ) {
150
+ $value = "{$part['prefix']}{$value}{$part['suffix']}";
 
 
 
 
 
 
151
  }
152
 
153
  return $value;
177
 
178
  public function email_part_visible( $visible, $part, $form, $response ) {
179
  if ( $this->type === $part['type'] ) {
 
 
 
 
180
  $empty_value = $part['prefix'] . $part['suffix'];
181
  $value = happyforms_get_email_part_value( $response, $part, $form );
182
 
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: HappyForms
8
- * Version: 1.9.26
9
  * Author URI: https://happyforms.me
10
  * Upgrade URI: https://happyforms.me/upgrade
11
  */
@@ -13,7 +13,7 @@
13
  /**
14
  * The current version of the plugin.
15
  */
16
- define( 'HAPPYFORMS_VERSION', '1.9.26' );
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: HappyForms
8
+ * Version: 1.9.27
9
  * Author URI: https://happyforms.me
10
  * Upgrade URI: https://happyforms.me/upgrade
11
  */
13
  /**
14
  * The current version of the plugin.
15
  */
16
+ define( 'HAPPYFORMS_VERSION', '1.9.27' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
inc/assets/js/customize.js CHANGED
@@ -1704,6 +1704,7 @@
1704
  'change [data-target="form_class"] input[type="checkbox"]': 'onFormClassCheckboxChange',
1705
  'change [data-target="css_var"] input[type=radio]': 'onRadioChange',
1706
  'keyup [data-target="attribute"] input[type=text]': 'onAttributeChange',
 
1707
  'change [data-attribute="part_description_mode"]': 'onChangeGlobalControls',
1708
  'change [data-attribute="part_title_label_placement"]': 'onChangeGlobalControls',
1709
  'navigate-to-group': 'navigateToGroup',
@@ -1878,6 +1879,24 @@
1878
  happyForms.form.set( attribute, value );
1879
  },
1880
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1881
  onGroupClick: function( e ) {
1882
  e.preventDefault();
1883
 
1704
  'change [data-target="form_class"] input[type="checkbox"]': 'onFormClassCheckboxChange',
1705
  'change [data-target="css_var"] input[type=radio]': 'onRadioChange',
1706
  'keyup [data-target="attribute"] input[type=text]': 'onAttributeChange',
1707
+ 'change [data-attribute="form_title"]': 'onFormTitleDisplayChange',
1708
  'change [data-attribute="part_description_mode"]': 'onChangeGlobalControls',
1709
  'change [data-attribute="part_title_label_placement"]': 'onChangeGlobalControls',
1710
  'navigate-to-group': 'navigateToGroup',
1879
  happyForms.form.set( attribute, value );
1880
  },
1881
 
1882
+ onFormTitleDisplayChange: function( e ) {
1883
+ e.preventDefault();
1884
+
1885
+ var $target = $( e.target );
1886
+ var attribute = $target.data( 'attribute' );
1887
+ var variable = $target.parents( '.happyforms-buttonset-control' ).data( 'variable' );
1888
+ var value = $target.val();
1889
+
1890
+ happyForms.form.set( attribute, value );
1891
+
1892
+ var data = {
1893
+ attribute: attribute,
1894
+ callback: 'onFormClassToggleCallback'
1895
+ };
1896
+
1897
+ happyForms.previewSend( 'happyforms-form-class-update', data );
1898
+ },
1899
+
1900
  onGroupClick: function( e ) {
1901
  e.preventDefault();
1902
 
inc/classes/class-message-controller.php CHANGED
@@ -426,8 +426,7 @@ class HappyForms_Message_Controller {
426
 
427
  public function email_part_visible( $visible, $part, $form, $response ) {
428
  $required = happyforms_is_truthy( $part['required'] );
429
- $message = array( 'parts' => $response );
430
- $value = happyforms_get_email_part_value( $message, $part, $form );
431
 
432
  if ( false === $required && empty( $value ) ) {
433
  $visible = false;
426
 
427
  public function email_part_visible( $visible, $part, $form, $response ) {
428
  $required = happyforms_is_truthy( $part['required'] );
429
+ $value = happyforms_get_email_part_value( $response, $part, $form );
 
430
 
431
  if ( false === $required && empty( $value ) ) {
432
  $visible = false;
inc/templates/email-owner.php CHANGED
@@ -9,9 +9,9 @@
9
  <?php $message = array( 'parts' => $response ); ?>
10
 
11
  <?php foreach( $form['parts'] as $part ) : ?>
12
- <?php if ( happyforms_email_is_part_visible( $part, $form, $response ) ) : ?>
13
 
14
- <b><?php echo happyforms_get_email_part_label( $response, $part, $form ); ?></b><br>
15
  <?php echo happyforms_get_email_part_value( $message, $part, $form ); ?>
16
  <br><br>
17
 
9
  <?php $message = array( 'parts' => $response ); ?>
10
 
11
  <?php foreach( $form['parts'] as $part ) : ?>
12
+ <?php if ( happyforms_email_is_part_visible( $part, $form, $message ) ) : ?>
13
 
14
+ <b><?php echo happyforms_get_email_part_label( $message, $part, $form ); ?></b><br>
15
  <?php echo happyforms_get_email_part_value( $message, $part, $form ); ?>
16
  <br><br>
17
 
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.9.26\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2020-12-02 14:32:32+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -46,7 +46,7 @@ msgid "Edit Form"
46
  msgstr ""
47
 
48
  #: core/classes/class-form-admin.php:155
49
- #: core/classes/class-form-controller.php:73
50
  msgid "View form"
51
  msgstr ""
52
 
@@ -158,57 +158,57 @@ msgstr ""
158
  msgid "Undo"
159
  msgstr ""
160
 
161
- #: core/classes/class-form-controller.php:67
162
  msgid "Forms"
163
  msgstr ""
164
 
165
- #: core/classes/class-form-controller.php:68
166
  msgid "Form"
167
  msgstr ""
168
 
169
- #: core/classes/class-form-controller.php:69
170
  #: core/classes/class-happyforms-core.php:187
171
  #: core/classes/class-happyforms-core.php:188
172
  msgid "Add New"
173
  msgstr ""
174
 
175
- #: core/classes/class-form-controller.php:70
176
- #: core/classes/class-form-controller.php:72
177
  msgid "Build form"
178
  msgstr ""
179
 
180
- #: core/classes/class-form-controller.php:71
181
  msgid "Edit form"
182
  msgstr ""
183
 
184
- #: core/classes/class-form-controller.php:74
185
  msgid "View forms"
186
  msgstr ""
187
 
188
- #: core/classes/class-form-controller.php:75
189
  msgid "Search Forms"
190
  msgstr ""
191
 
192
- #: core/classes/class-form-controller.php:76
193
  msgid "No forms found."
194
  msgstr ""
195
 
196
- #: core/classes/class-form-controller.php:77
197
  msgid "No forms found in Trash"
198
  msgstr ""
199
 
200
- #: core/classes/class-form-controller.php:78
201
  #: core/classes/class-form-controller.php:79
 
202
  #: core/classes/class-happyforms-core.php:179
203
  #: core/classes/class-happyforms-core.php:180
204
  msgid "All Forms"
205
  msgstr ""
206
 
207
- #: core/classes/class-form-controller.php:525
208
  msgid "(no title)"
209
  msgstr ""
210
 
211
- #: core/classes/class-form-controller.php:614
212
  msgid " Copy"
213
  msgstr ""
214
 
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: HappyForms 1.9.27\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2020-12-18 15:55:14+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
46
  msgstr ""
47
 
48
  #: core/classes/class-form-admin.php:155
49
+ #: core/classes/class-form-controller.php:74
50
  msgid "View form"
51
  msgstr ""
52
 
158
  msgid "Undo"
159
  msgstr ""
160
 
161
+ #: core/classes/class-form-controller.php:68
162
  msgid "Forms"
163
  msgstr ""
164
 
165
+ #: core/classes/class-form-controller.php:69
166
  msgid "Form"
167
  msgstr ""
168
 
169
+ #: core/classes/class-form-controller.php:70
170
  #: core/classes/class-happyforms-core.php:187
171
  #: core/classes/class-happyforms-core.php:188
172
  msgid "Add New"
173
  msgstr ""
174
 
175
+ #: core/classes/class-form-controller.php:71
176
+ #: core/classes/class-form-controller.php:73
177
  msgid "Build form"
178
  msgstr ""
179
 
180
+ #: core/classes/class-form-controller.php:72
181
  msgid "Edit form"
182
  msgstr ""
183
 
184
+ #: core/classes/class-form-controller.php:75
185
  msgid "View forms"
186
  msgstr ""
187
 
188
+ #: core/classes/class-form-controller.php:76
189
  msgid "Search Forms"
190
  msgstr ""
191
 
192
+ #: core/classes/class-form-controller.php:77
193
  msgid "No forms found."
194
  msgstr ""
195
 
196
+ #: core/classes/class-form-controller.php:78
197
  msgid "No forms found in Trash"
198
  msgstr ""
199
 
 
200
  #: core/classes/class-form-controller.php:79
201
+ #: core/classes/class-form-controller.php:80
202
  #: core/classes/class-happyforms-core.php:179
203
  #: core/classes/class-happyforms-core.php:180
204
  msgid "All Forms"
205
  msgstr ""
206
 
207
+ #: core/classes/class-form-controller.php:526
208
  msgid "(no title)"
209
  msgstr ""
210
 
211
+ #: core/classes/class-form-controller.php:615
212
  msgid " Copy"
213
  msgstr ""
214
 
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: 5.5.1
7
  Requires PHP: 5.3
8
- Stable tag: 1.9.26
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -97,6 +97,10 @@ Yep! HappyForms free isn't going anywhere but for those looking for even more yo
97
 
98
  == Changelog ==
99
 
 
 
 
 
100
  = 1.9.26 =
101
  * Improvement: Style → Additional CSS now updates preview in realtime.
102
  * Improvement: Added filter to force style output for compatibility with 3rd party plugins.
@@ -684,6 +688,9 @@ Yep! HappyForms free isn't going anywhere but for those looking for even more yo
684
 
685
  == Upgrade Notice ==
686
 
 
 
 
687
  = 1.9.26 =
688
  * Realtime Additional CSS preview, new filters and bugfixes.
689
 
5
  Requires at least: 4.8
6
  Tested up to: 5.5.1
7
  Requires PHP: 5.3
8
+ Stable tag: 1.9.27
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
97
 
98
  == Changelog ==
99
 
100
+ = 1.9.27 =
101
+ * Improvement: Form title is not rendered at all when set to "hidden".
102
+ * Bugfix: Fields with prefix and suffix support where being validated as always filled.
103
+
104
  = 1.9.26 =
105
  * Improvement: Style → Additional CSS now updates preview in realtime.
106
  * Improvement: Added filter to force style output for compatibility with 3rd party plugins.
688
 
689
  == Upgrade Notice ==
690
 
691
+ = 1.9.27 =
692
+ * Minor bugfixes and improvements.
693
+
694
  = 1.9.26 =
695
  * Realtime Additional CSS preview, new filters and bugfixes.
696