Formidable Forms – Form Builder for WordPress - Version 5.3.2

Version Description

  • New: RGB and RGBA color values will now be fixed automatically on save if incomplete to avoid broken CSS.
Download this release

Release Info

Developer formidableforms
Plugin Icon 128x128 Formidable Forms – Form Builder for WordPress
Version 5.3.2
Comparing to
See all releases

Code changes from version 5.3.1 to 5.3.2

classes/helpers/FrmAppHelper.php CHANGED
@@ -16,7 +16,7 @@ class FrmAppHelper {
16
  /**
17
  * @since 2.0
18
  */
19
- public static $plug_version = '5.3.1';
20
 
21
  /**
22
  * @since 1.07.02
16
  /**
17
  * @since 2.0
18
  */
19
+ public static $plug_version = '5.3.2';
20
 
21
  /**
22
  * @since 1.07.02
classes/models/FrmStyle.php CHANGED
@@ -88,7 +88,12 @@ class FrmStyle {
88
  }
89
 
90
  if ( $this->is_color( $setting ) ) {
91
- $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] );
 
 
 
 
 
92
  } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) )
93
  && ! isset( $new_instance['post_content'][ $setting ] )
94
  ) {
@@ -109,6 +114,81 @@ class FrmStyle {
109
  return $action_ids;
110
  }
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  /**
113
  * Unslash everything in post_content but custom_css
114
  *
88
  }
89
 
90
  if ( $this->is_color( $setting ) ) {
91
+ $color_val = $new_instance['post_content'][ $setting ];
92
+ if ( $color_val !== '' && 0 === strpos( $color_val, 'rgb' ) ) {
93
+ // maybe sanitize if invalid rgba value is entered
94
+ $this->maybe_sanitize_rgba_value( $color_val );
95
+ }
96
+ $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val );
97
  } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) )
98
  && ! isset( $new_instance['post_content'][ $setting ] )
99
  ) {
114
  return $action_ids;
115
  }
116
 
117
+ /**
118
+ * Sanitize custom color values and convert it to valid one filling missing values.
119
+ *
120
+ * @since 5.3.2
121
+ *
122
+ * @param string $color_val, The color value, by reference.
123
+ * @return void
124
+ */
125
+ private function maybe_sanitize_rgba_value( &$color_val ) {
126
+ if ( preg_match( '/(rgb|rgba)\(/', $color_val ) !== 1 ) {
127
+ return;
128
+ }
129
+
130
+ $color_val = trim( $color_val );
131
+ $patterns = array( '/rgba\((\s*\d+\s*,){3}[[0-1]\.]+\)/', '/rgb\((\s*\d+\s*,){2}\s*[\d]+\)/' );
132
+ foreach ( $patterns as $pattern ) {
133
+ if ( preg_match( $pattern, $color_val ) === 1 ) {
134
+ return;
135
+ }
136
+ }
137
+
138
+ if ( substr( $color_val, -1 ) !== ')' ) {
139
+ $color_val .= ')';
140
+ }
141
+
142
+ $color_rgba = substr( $color_val, strpos( $color_val, '(' ) + 1, strlen( $color_val ) - strpos( $color_val, '(' ) - 2 );
143
+ $length_of_color_codes = strpos( $color_val, '(' );
144
+ $new_color_values = array();
145
+
146
+ // replace empty values by 0 or 1 (if alpha position).
147
+ foreach ( explode( ',', $color_rgba ) as $index => $value ) {
148
+ $new_value = null;
149
+ $value_is_empty_string = '' === trim( $value ) || '' === $value;
150
+
151
+ if ( 3 === $length_of_color_codes || ( $index !== $length_of_color_codes - 1 ) ) {
152
+ // insert a value for r, g, or b
153
+ if ( $value < 0 ) {
154
+ $new_value = 0;
155
+ } elseif ( $value > 255 ) {
156
+ $new_value = 255;
157
+ } elseif ( $value_is_empty_string ) {
158
+ $new_value = 0;
159
+ }
160
+ } else {
161
+ // insert a value for alpha
162
+ if ( $value_is_empty_string ) {
163
+ $new_value = 4 === $length_of_color_codes ? 1 : 0;
164
+ } elseif ( $value > 1 || $value < 0 ) {
165
+ $new_value = 1;
166
+ }
167
+ }
168
+
169
+ $new_color_values[] = null === $new_value ? $value : $new_value;
170
+ }
171
+
172
+ // add more 0s and 1 (if alpha position) if needed.
173
+ $missing_values = $length_of_color_codes - count( $new_color_values );
174
+ if ( $missing_values > 1 ) {
175
+ $insert_values = array_fill( 0, $missing_values - 1, 0 );
176
+ $last_value = 4 === $length_of_color_codes ? 1 : 0;
177
+ array_push( $insert_values, $last_value );
178
+ } elseif ( $missing_values === 1 ) {
179
+ $insert_values = 4 === $length_of_color_codes ? array( 1 ) : array( 0 );
180
+ }
181
+ if ( ! empty( $insert_values ) ) {
182
+ $new_color_values = array_merge( $new_color_values, $insert_values );
183
+ }
184
+
185
+ $new_color = implode( ',', $new_color_values );
186
+ $prefix = substr( $color_val, 0, strpos( $color_val, '(' ) + 1 );
187
+ $new_color = $prefix . $new_color . ')';
188
+
189
+ $color_val = $new_color;
190
+ }
191
+
192
  /**
193
  * Unslash everything in post_content but custom_css
194
  *
formidable.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Formidable Forms
4
  Description: Quickly and easily create drag-and-drop forms
5
- Version: 5.3.1
6
  Plugin URI: https://formidableforms.com/
7
  Author URI: https://formidableforms.com/
8
  Author: Strategy11
2
  /*
3
  Plugin Name: Formidable Forms
4
  Description: Quickly and easily create drag-and-drop forms
5
+ Version: 5.3.2
6
  Plugin URI: https://formidableforms.com/
7
  Author URI: https://formidableforms.com/
8
  Author: Strategy11
languages/formidable.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Formidable Forms plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Formidable Forms 5.3.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/formidable\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-06-02T14:47:48+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: formidable\n"
@@ -4351,20 +4351,20 @@ msgstr ""
4351
  msgid "New Style"
4352
  msgstr ""
4353
 
4354
- #: classes/models/FrmStyle.php:194
4355
  msgid "WARNING: Any changes made to this file will be lost when your Formidable settings are updated"
4356
  msgstr ""
4357
 
4358
- #: classes/models/FrmStyle.php:274
4359
  msgid "Formidable Style"
4360
  msgstr ""
4361
 
4362
- #: classes/models/FrmStyle.php:513
4363
  #: classes/views/styles/_field-description.php:22
4364
  msgid "normal"
4365
  msgstr ""
4366
 
4367
- #: classes/models/FrmStyle.php:516
4368
  msgid "bold"
4369
  msgstr ""
4370
 
2
  # This file is distributed under the same license as the Formidable Forms plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Formidable Forms 5.3.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/formidable\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-06-07T18:34:35+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: formidable\n"
4351
  msgid "New Style"
4352
  msgstr ""
4353
 
4354
+ #: classes/models/FrmStyle.php:274
4355
  msgid "WARNING: Any changes made to this file will be lost when your Formidable settings are updated"
4356
  msgstr ""
4357
 
4358
+ #: classes/models/FrmStyle.php:354
4359
  msgid "Formidable Style"
4360
  msgstr ""
4361
 
4362
+ #: classes/models/FrmStyle.php:593
4363
  #: classes/views/styles/_field-description.php:22
4364
  msgid "normal"
4365
  msgstr ""
4366
 
4367
+ #: classes/models/FrmStyle.php:596
4368
  msgid "bold"
4369
  msgstr ""
4370
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: forms, contact form, form builder, survey, free, form maker, form creator,
5
  Requires at least: 5.2
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 5.3.1
9
 
10
  The most advanced WordPress forms plugin. Go beyond contact forms with our drag & drop form builder for surveys, quizzes, and more.
11
 
@@ -438,6 +438,9 @@ Using our Zapier integration, you can easily connect Formidable with over 1000+
438
  See all <a href="https://zapier.com/apps/formidable/integrations">Formidable Zapier Integrations</a>.
439
 
440
  == Changelog ==
 
 
 
441
  = 5.3.1 =
442
  * New: Unlocked application templates now appear at the top of the list of templates.
443
  * New: Improved the responsiveness of the cards on the Application dashboard page.
@@ -451,7 +454,4 @@ See all <a href="https://zapier.com/apps/formidable/integrations">Formidable Zap
451
  * New: Imported forms will now replace the old field ids with new field ids when the id is used in a field_id shortcode option.
452
  * Fix: Field id values were not always properly updating when duplicating a form depending on the order of the fields.
453
 
454
- = 5.2.07 =
455
- * Fix: Step value validation was occasionally breaking in some cases due to rounding precision issues.
456
-
457
  <a href="https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt">See changelog for all versions</a>
5
  Requires at least: 5.2
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 5.3.2
9
 
10
  The most advanced WordPress forms plugin. Go beyond contact forms with our drag & drop form builder for surveys, quizzes, and more.
11
 
438
  See all <a href="https://zapier.com/apps/formidable/integrations">Formidable Zapier Integrations</a>.
439
 
440
  == Changelog ==
441
+ = 5.3.2 =
442
+ * New: RGB and RGBA color values will now be fixed automatically on save if incomplete to avoid broken CSS.
443
+
444
  = 5.3.1 =
445
  * New: Unlocked application templates now appear at the top of the list of templates.
446
  * New: Improved the responsiveness of the cards on the Application dashboard page.
454
  * New: Imported forms will now replace the old field ids with new field ids when the id is used in a field_id shortcode option.
455
  * Fix: Field id values were not always properly updating when duplicating a form depending on the order of the fields.
456
 
 
 
 
457
  <a href="https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt">See changelog for all versions</a>