PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.2.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.2.2
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmStyle.php +188 -352 6.276.2.2 View file →
@@ -3,35 +3,14 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 class FrmStyle {
7 + public $number = false; // Unique ID number of the current instance.
8 + public $id = 0; // the id of the post
7 9
8 10 /**
9 - * The meta name of default template style.
10 - *
11 - * @since 6.14
12 - *
13 - * @var string
11 + * @param int|string $id The id of the stylsheet or 'default'
14 12 */
15 - private $default_template_style_meta_name = 'frm_style_default';
16 -
17 - /**
18 - * Unique ID number of the current instance.
19 - *
20 - * @var int
21 - */
22 - public $number = false;
23 -
24 - /**
25 - * The id of the post.
26 - *
27 - * @var int|string
28 - */
29 - public $id = 0;
30 -
31 - /**
32 - * @param int|string $id The id of the stylesheet or 'default'.
33 - */
34 13 public function __construct( $id = 0 ) {
35 14 $this->id = $id;
36 15 }
37 16
@@ -41,11 +20,10 @@
41 20 public function get_new() {
42 21 $this->id = 0;
43 22
44 23 $max_slug_value = 2147483647;
45 - // We want to have at least 2 characters in the slug.
46 - $min_slug_value = 37;
47 - $key = base_convert( random_int( $min_slug_value, $max_slug_value ), 10, 36 );
24 + $min_slug_value = 37; // we want to have at least 2 characters in the slug
25 + $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
48 26
49 27 $style = array(
50 28 'post_type' => FrmStylesController::$post_type,
51 29 'ID' => '',
@@ -60,9 +38,8 @@
60 38 }
61 39
62 40 /**
63 41 * @param array $settings
64 - *
65 42 * @return int|WP_Error
66 43 */
67 44 public function save( $settings ) {
68 45 return FrmDb::save_settings( $settings, 'frm_styles' );
@@ -68,10 +45,8 @@
68 45 return FrmDb::save_settings( $settings, 'frm_styles' );
69 46 }
70 47
71 48 /**
72 - * @param int|string $id The id of the stylesheet or 'default'.
73 - *
74 49 * @return void
75 50 */
76 51 public function duplicate( $id ) {
77 52 // Duplicating is a pro feature. This is handled in FrmProStyle::duplicate instead.
@@ -80,14 +55,12 @@
80 55 /**
81 56 * Handle save actions in the visual styler edit page.
82 57 *
83 58 * @param mixed $id
84 - *
85 59 * @return array<int|WP_Error>
86 60 */
87 61 public function update( $id = 'default' ) {
88 - $all_instances = $this->get_all();
89 - $css_scope_helper = new FrmCssScopeHelper();
62 + $all_instances = $this->get_all();
90 63
91 64 if ( ! $id ) {
92 65 $new_style = (array) $this->get_new();
93 66 $all_instances[] = $new_style;
@@ -94,14 +67,13 @@
94 67 }
95 68
96 69 $action_ids = array();
97 70
98 - foreach ( $all_instances as $new_instance ) {
71 + foreach ( $all_instances as $number => $new_instance ) {
99 72 $new_instance = (array) $new_instance;
100 73 $this->id = $new_instance['ID'];
101 74
102 - // phpcs:ignore WordPress.Security.NonceVerification.Missing, Universal.Operators.StrictComparisons
103 - if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) {
75 + if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
104 76 // Don't continue if not saving this style.
105 77 continue;
106 78 }
107 79
@@ -106,9 +78,9 @@
106 78 }
107 79
108 80 // Custom CSS is no longer used from the default style, but it is still checked if the Global Setting is missing.
109 81 // Preserve the previous value in case Custom CSS has not been saved as a Global Setting yet.
110 - $custom_css = $new_instance['post_content']['custom_css'] ?? '';
82 + $custom_css = isset( $new_instance['post_content']['custom_css'] ) ? $new_instance['post_content']['custom_css'] : '';
111 83
112 84 // phpcs:ignore WordPress.Security.NonceVerification.Missing
113 85 if ( ! empty( $_POST['frm_style_setting']['post_title'] ) ) {
114 86 // The nonce check happens in FrmStylesController::save_style before this is called.
@@ -115,20 +87,15 @@
115 87 // phpcs:ignore WordPress.Security.NonceVerification.Missing
116 88 $new_instance['post_title'] = sanitize_text_field( wp_unslash( $_POST['frm_style_setting']['post_title'] ) );
117 89 }
118 90
119 - $new_instance['post_content'] = isset( $_POST['frm_style_setting']['post_content'] ) ? $this->sanitize_post_content( wp_unslash( $_POST['frm_style_setting']['post_content'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing, SlevomatCodingStandard.Files.LineLength.LineTooLong
91 + $new_instance['post_content'] = isset( $_POST['frm_style_setting']['post_content'] ) ? $this->sanitize_post_content( wp_unslash( $_POST['frm_style_setting']['post_content'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
120 92 $new_instance['post_content']['custom_css'] = $custom_css;
121 93 unset( $custom_css );
122 94
123 - if ( ! empty( $new_instance['post_content']['single_style_custom_css'] ) ) {
124 - $css_scope = 'frm_style_' . $new_instance['post_name'];
125 - $new_instance['post_content']['single_style_custom_css'] = $css_scope_helper->nest( $new_instance['post_content']['single_style_custom_css'], $css_scope );
126 - }
95 + $new_instance['post_type'] = FrmStylesController::$post_type;
96 + $new_instance['post_status'] = 'publish';
127 97
128 - $new_instance['post_type'] = FrmStylesController::$post_type;
129 - $new_instance['post_status'] = 'publish';
130 -
131 98 if ( ! $id ) {
132 99 $new_instance['post_name'] = $new_instance['post_title'];
133 100 }
134 101
@@ -140,10 +107,9 @@
140 107 }
141 108
142 109 if ( $this->is_color( $setting ) ) {
143 110 $color_val = $new_instance['post_content'][ $setting ];
144 -
145 - if ( $color_val !== '' && str_contains( $color_val, 'rgb' ) ) {
111 + if ( $color_val !== '' && false !== strpos( $color_val, 'rgb' ) ) {
146 112 // Maybe sanitize if invalid rgba value is entered.
147 113 $this->maybe_sanitize_rgba_value( $color_val );
148 114 }
149 115 $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val );
@@ -153,11 +119,10 @@
153 119 $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] );
154 120 }
155 121 }
156 122
157 - $new_instance['post_content'] = FrmStylesHelper::update_base_font_size( $new_instance['post_content'], $this->get_defaults() );
158 - $action_ids[] = $this->save( $new_instance );
159 - }//end foreach
123 + $action_ids[] = $this->save( $new_instance );
124 + }
160 125
161 126 $this->save_settings();
162 127
163 128 return $action_ids;
@@ -167,22 +132,19 @@
167 132 * Sanitize custom color values and convert it to valid one filling missing values.
168 133 *
169 134 * @since 5.3.2
170 135 *
171 - * @param string $color_val The color value, by reference.
172 - *
136 + * @param string $color_val, The color value, by reference.
173 137 * @return void
174 138 */
175 - private function maybe_sanitize_rgba_value( &$color_val ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh
139 + private function maybe_sanitize_rgba_value( &$color_val ) {
176 140 if ( preg_match( '/(rgb|rgba)\(/', $color_val ) !== 1 ) {
177 141 return;
178 142 }
179 143
180 144 $color_val = trim( $color_val );
181 - // Remove leading braces so (rgba(1,1,1,1) doesn't cause inconsistent braces.
182 - $color_val = ltrim( $color_val, '(' );
145 + $color_val = ltrim( $color_val, '(' ); // Remove leading braces so (rgba(1,1,1,1) doesn't cause inconsistent braces.
183 146 $patterns = array( '/rgba\((\s*\d+\s*,){3}[[0-1]\.]+\)/', '/rgb\((\s*\d+\s*,){2}\s*[\d]+\)/' );
184 -
185 147 foreach ( $patterns as $pattern ) {
186 148 if ( preg_match( $pattern, $color_val ) === 1 ) {
187 149 return;
188 150 }
@@ -191,11 +153,10 @@
191 153 // Remove all leading ')' braces, then add one back. This way there's always a single brace.
192 154 $color_val = rtrim( $color_val, ')' );
193 155 $color_val .= ')';
194 156
195 - $color_rgba = substr( $color_val, strpos( $color_val, '(' ) + 1, strlen( $color_val ) - strpos( $color_val, '(' ) - 2 );
196 - // Remove any excessive braces from the rgba like rgba((.
197 - $color_rgba = trim( $color_rgba, '()' );
157 + $color_rgba = substr( $color_val, strpos( $color_val, '(' ) + 1, strlen( $color_val ) - strpos( $color_val, '(' ) - 2 );
158 + $color_rgba = trim( $color_rgba, '()' ); // Remove any excessive braces from the rgba like rgba((.
198 159 $length_of_color_codes = strpos( $color_val, '(' );
199 160 $new_color_values = array();
200 161
201 162 // replace empty values by 0 or 1 (if alpha position).
@@ -222,16 +183,15 @@
222 183 $new_value = 1;
223 184 } else {
224 185 $new_value = floatval( $value );
225 186 }
226 - }//end if
187 + }
227 188
228 - $new_color_values[] = $new_value;
229 - }//end foreach
189 + $new_color_values[] = null === $new_value ? $value : $new_value;
190 + }
230 191
231 192 // add more 0s and 1 (if alpha position) if needed.
232 193 $missing_values = $length_of_color_codes - count( $new_color_values );
233 -
234 194 if ( $missing_values > 1 ) {
235 195 $insert_values = array_fill( 0, $missing_values - 1, 0 );
236 196 $last_value = 4 === $length_of_color_codes ? 1 : 0;
237 197 array_push( $insert_values, $last_value );
@@ -237,9 +197,8 @@
237 197 array_push( $insert_values, $last_value );
238 198 } elseif ( $missing_values === 1 ) {
239 199 $insert_values = 4 === $length_of_color_codes ? array( 1 ) : array( 0 );
240 200 }
241 -
242 201 if ( ! empty( $insert_values ) ) {
243 202 $new_color_values = array_merge( $new_color_values, $insert_values );
244 203 }
245 204
@@ -244,19 +203,33 @@
244 203 }
245 204
246 205 $new_color = implode( ',', $new_color_values );
247 206 $prefix = substr( $color_val, 0, strpos( $color_val, '(' ) + 1 );
248 - // Limit the number of opening braces after rgb/rgba. There should only be one.
249 - $prefix = rtrim( $prefix, '(' ) . '(';
207 + $prefix = rtrim( $prefix, '(' ) . '('; // Limit the number of opening braces after rgb/rgba. There should only be one.
250 208 $new_color = $prefix . $new_color . ')';
209 +
251 210 $color_val = $new_color;
252 211 }
253 212
254 213 /**
214 + * Unslash everything in post_content but custom_css
215 + *
255 216 * @since 5.0.13
256 217 *
257 218 * @param array $settings
219 + * @return array
220 + */
221 + private function unslash_post_content( $settings ) {
222 + $custom_css = isset( $settings['custom_css'] ) ? $settings['custom_css'] : '';
223 + $settings = wp_unslash( $settings );
224 + $settings['custom_css'] = $custom_css;
225 + return $settings;
226 + }
227 +
228 + /**
229 + * @since 5.0.13
258 230 *
231 + * @param array $settings
259 232 * @return array
260 233 */
261 234 public function sanitize_post_content( $settings ) {
262 235 $defaults = $this->get_defaults();
@@ -261,128 +234,27 @@
261 234 public function sanitize_post_content( $settings ) {
262 235 $defaults = $this->get_defaults();
263 236 $valid_keys = array_keys( $defaults );
264 237 $sanitized_settings = array();
265 -
266 238 foreach ( $valid_keys as $key ) {
267 - $sanitized_settings[ $key ] = isset( $settings[ $key ] ) ? sanitize_textarea_field( $settings[ $key ] ) : $defaults[ $key ];
268 -
269 - if ( 'custom_css' !== $key && 'single_style_custom_css' !== $key ) {
270 - $sanitized_settings[ $key ] = $this->strip_invalid_characters( $sanitized_settings[ $key ] );
239 + if ( isset( $settings[ $key ] ) ) {
240 + $sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] );
241 + } else {
242 + $sanitized_settings[ $key ] = $defaults[ $key ];
271 243 }
272 244 }
273 -
274 245 return $sanitized_settings;
275 246 }
276 247
277 248 /**
278 - * Remove any characters that should not be used in CSS.
279 - *
280 - * @since 6.2.3
281 - *
282 - * @param string $setting
283 - *
284 - * @return string
285 - */
286 - private function strip_invalid_characters( $setting ) {
287 - $characters_to_remove = array( '{', '}', ';', '[', ']' );
288 -
289 - // RGB is handled instead in self::maybe_sanitize_rgba_value.
290 - if ( ! str_starts_with( $setting, 'rgb' ) ) {
291 - $setting = $this->maybe_fix_braces( $setting, $characters_to_remove );
292 - }
293 -
294 - return str_replace( $characters_to_remove, '', $setting );
295 - }
296 -
297 - /**
298 - * @since 6.2.3
299 - *
300 - * @param string $setting
301 - * @param array $characters_to_remove
302 - *
303 - * @return string
304 - */
305 - private function maybe_fix_braces( $setting, &$characters_to_remove ) {
306 - $number_of_opening_braces = substr_count( $setting, '(' );
307 - $number_of_closing_braces = substr_count( $setting, ')' );
308 -
309 - if ( $number_of_opening_braces === $number_of_closing_braces ) {
310 - return $this->trim_braces( $setting );
311 - }
312 -
313 - if ( $this->should_remove_every_brace( $setting ) ) {
314 - // Add to $characters_to_remove to remove when str_replace is called.
315 - array_push( $characters_to_remove, '(', ')' );
316 - return $setting;
317 - }
318 -
319 - return $this->trim_braces( $setting );
320 - }
321 -
322 - /**
323 - * @since 6.2.3
324 - *
325 - * @param string $input
326 - *
327 - * @return string
328 - */
329 - private function trim_braces( $input ) {
330 - $output = $input;
331 -
332 - // Remove any ( from the start of the string as no CSS values expect at the first character.
333 - if ( $output && in_array( $output[0], array( '(', ')' ), true ) ) {
334 - $output = ltrim( $output, '()' );
335 - }
336 -
337 - // Remove extra braces from the end.
338 - if ( in_array( substr( $output, -1 ), array( '(', ')' ), true ) ) {
339 - $output = rtrim( $output, '()' );
340 -
341 - if ( str_contains( $output, '(' ) ) {
342 - $output .= ')';
343 - }
344 - }
345 -
346 - return $output;
347 - }
348 -
349 - /**
350 - * @since 6.2.3
351 - *
352 - * @param string $setting
353 - *
354 - * @return bool
355 - */
356 - private function should_remove_every_brace( $setting ) {
357 - if ( str_starts_with( trim( $setting, '()' ), 'calc' ) ) {
358 - // Support calc() sizes. We do not want to remove all braces when calc is used.
359 - return false;
360 - }
361 -
362 - // Matches hex values but also checks for unexpected ( and ).
363 - $looks_like_a_hex_value = preg_match( '/^(?:\()?(?!#?[a-fA-F0-9]*[^\(#\)\da-fA-F])[a-fA-F0-9\(\)]*(?:\))?$/', $setting );
364 -
365 - if ( $looks_like_a_hex_value ) {
366 - return true;
367 - }
368 -
369 - // Matches size values but also checks for unexpected ( and ).
370 - // This is case insensitive so it will catch PX, PT, etc, as well.
371 - $looks_like_a_size = preg_match( '/\(?[+-]?\d*\.?\d+(?:px|%|em|rem|ex|pt|pc|mm|cm|in)\)?/i', $setting );
372 - return (bool) $looks_like_a_size;
373 - }
374 -
375 - /**
376 249 * @since 3.01.01
377 250 *
378 251 * @param string $setting
379 - *
380 252 * @return bool
381 253 */
382 254 private function is_color( $setting ) {
383 255 $extra_colors = array( 'error_bg', 'error_border', 'error_text' );
384 - return str_contains( $setting, 'color' ) || in_array( $setting, $extra_colors, true );
256 + return strpos( $setting, 'color' ) !== false || in_array( $setting, $extra_colors, true );
385 257 }
386 258
387 259 /**
388 260 * @since 3.01.01
@@ -425,19 +297,20 @@
425 297 }
426 298
427 299 /**
428 300 * @param string $filename
429 - *
430 301 * @return string
431 302 */
432 303 private function get_css_content( $filename ) {
433 - $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n";
304 + $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n";
305 +
434 306 $saving = true;
435 307 $frm_style = $this;
436 308
437 309 ob_start();
438 310 include $filename;
439 - $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_clean() ) );
311 + $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) );
312 + ob_end_clean();
440 313
441 314 return FrmStylesController::replace_relative_url( $css );
442 315 }
443 316
@@ -461,10 +334,9 @@
461 334 /**
462 335 * Delete a style by its post ID.
463 336 *
464 337 * @param int $id
465 - *
466 - * @return false|WP_Post|null
338 + * @return WP_Post|false|null
467 339 */
468 340 public function destroy( $id ) {
469 341 if ( $id === $this->get_default_style()->ID ) {
470 342 return false;
@@ -472,16 +344,19 @@
472 344 return wp_delete_post( $id );
473 345 }
474 346
475 347 /**
476 - * @return stdClass|WP_Post
348 + * @return WP_Post|stdClass
477 349 */
478 350 public function get_one() {
479 351 if ( 'default' === $this->id ) {
480 352 $style = $this->get_default_style();
353 + if ( $style ) {
354 + $this->id = $style->ID;
355 + } else {
356 + $this->id = 0;
357 + }
481 358
482 - $this->id = $style ? $style->ID : 0;
483 -
484 359 return $style;
485 360 }
486 361
487 362 $style = get_post( $this->id );
@@ -504,9 +379,8 @@
504 379 /**
505 380 * @param string $orderby
506 381 * @param string $order
507 382 * @param int $limit
508 - *
509 383 * @return array
510 384 */
511 385 public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) {
512 386 $post_atts = array(
@@ -518,15 +392,15 @@
518 392 );
519 393
520 394 $temp_styles = FrmDb::check_cache( json_encode( $post_atts ), 'frm_styles', $post_atts, 'get_posts' );
521 395
522 - if ( ! $temp_styles ) {
396 + if ( empty( $temp_styles ) ) {
523 397 global $wpdb;
524 398 // make sure there wasn't a conflict with the query
525 - $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
399 + $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' );
526 400 $temp_styles = FrmDb::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' );
527 401
528 - if ( ! $temp_styles ) {
402 + if ( empty( $temp_styles ) ) {
529 403 // create a new style if there are none
530 404 $new = $this->get_new();
531 405 $new->post_title = __( 'Formidable Style', 'formidable' );
532 406 $new->post_name = $new->post_title;
@@ -534,19 +408,19 @@
534 408 $new = $this->save( (array) $new );
535 409 $this->update( 'default' );
536 410
537 411 $post_atts['include'] = $new;
538 - $temp_styles = get_posts( $post_atts );
412 +
413 + $temp_styles = get_posts( $post_atts );
539 414 }
540 415 }
541 416
542 417 $default_values = $this->get_defaults();
543 418 $default_style = false;
544 - $styles = array();
545 419
420 + $styles = array();
546 421 foreach ( $temp_styles as $style ) {
547 422 $this->id = $style->ID;
548 -
549 423 if ( $style->menu_order ) {
550 424 if ( $default_style ) {
551 425 // only return one default
552 426 $style->menu_order = 0;
@@ -562,12 +436,13 @@
562 436 $style->post_content = $this->override_defaults( $style->post_content );
563 437 $style->post_content = wp_parse_args( $style->post_content, $default_values );
564 438
565 439 $styles[ $style->ID ] = $style;
566 - }//end foreach
440 + }
567 441
568 442 if ( ! $default_style ) {
569 - $default_style = reset( $styles );
443 + $default_style = reset( $styles );
444 +
570 445 $styles[ $default_style->ID ]->menu_order = 1;
571 446 }
572 447
573 448 return $styles;
@@ -574,10 +449,8 @@
574 449 }
575 450
576 451 /**
577 452 * @param array|null $styles
578 - *
579 - * @return object|null
580 453 */
581 454 public function get_default_style( $styles = null ) {
582 455 if ( ! isset( $styles ) ) {
583 456 $styles = $this->get_all( 'menu_order', 'DESC', 1 );
@@ -587,15 +460,12 @@
587 460 if ( $style->menu_order ) {
588 461 return $style;
589 462 }
590 463 }
591 -
592 - return null;
593 464 }
594 465
595 466 /**
596 467 * @param mixed $settings
597 - *
598 468 * @return mixed
599 469 */
600 470 public function override_defaults( $settings ) {
601 471 if ( ! is_array( $settings ) ) {
@@ -601,9 +471,9 @@
601 471 if ( ! is_array( $settings ) ) {
602 472 return $settings;
603 473 }
604 474
605 - $settings['line_height'] = ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] === 'auto' ? 'normal' : $settings['field_height']; // phpcs:ignore Universal.Operators.StrictComparisons, SlevomatCodingStandard.Files.LineLength.LineTooLong
475 + $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height'];
606 476
607 477 if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) {
608 478 $settings['form_desc_size'] = $settings['description_font_size'];
609 479 $settings['form_desc_color'] = $settings['description_color'];
@@ -632,147 +502,142 @@
632 502 * @return array
633 503 */
634 504 public function get_defaults() {
635 505 $defaults = array(
636 - 'theme_css' => 'ui-lightness',
637 - 'theme_name' => 'UI Lightness',
506 + 'theme_css' => 'ui-lightness',
507 + 'theme_name' => 'UI Lightness',
638 508
639 - 'center_form' => '',
640 - 'form_width' => '100%',
641 - 'form_align' => 'left',
642 - 'direction' => is_rtl() ? 'rtl' : 'ltr',
643 - 'fieldset' => '0px',
644 - 'fieldset_color' => '000000',
645 - 'fieldset_padding' => '0px 0px 15px 0px',
646 - 'fieldset_bg_color' => '',
509 + 'center_form' => '',
510 + 'form_width' => '100%',
511 + 'form_align' => 'left',
512 + 'direction' => is_rtl() ? 'rtl' : 'ltr',
513 + 'fieldset' => '0px',
514 + 'fieldset_color' => '000000',
515 + 'fieldset_padding' => '0 0 15px 0',
516 + 'fieldset_bg_color' => '',
647 517
648 - 'title_size' => '40px',
649 - 'title_color' => '444444',
650 - 'title_margin_top' => '10px',
651 - 'title_margin_bottom' => '60px',
652 - 'form_desc_size' => '14px',
653 - 'form_desc_color' => '98A2B3',
654 - 'form_desc_margin_top' => '10px',
655 - 'form_desc_margin_bottom' => '25px',
656 - 'form_desc_padding' => '0px',
518 + 'title_size' => '40px',
519 + 'title_color' => '444444',
520 + 'title_margin_top' => '10px',
521 + 'title_margin_bottom' => '60px',
522 + 'form_desc_size' => '14px',
523 + 'form_desc_color' => '666666',
524 + 'form_desc_margin_top' => '10px',
525 + 'form_desc_margin_bottom' => '25px',
526 + 'form_desc_padding' => '0',
657 527
658 - 'font' => '',
659 - 'font_size' => '15px',
660 - 'label_color' => '344054',
661 - 'weight' => 'normal',
662 - 'position' => 'none',
663 - 'align' => 'left',
664 - 'width' => '150px',
665 - 'required_color' => 'F04438',
666 - 'required_weight' => 'bold',
667 - 'label_padding' => '0px 0px 5px 0px',
528 + 'font' => '',
529 + 'font_size' => '15px',
530 + 'label_color' => '3f4b5b',
531 + 'weight' => 'normal',
532 + 'position' => 'none',
533 + 'align' => 'left',
534 + 'width' => '150px',
535 + 'required_color' => 'B94A48',
536 + 'required_weight' => 'bold',
537 + 'label_padding' => '0 0 3px 0',
668 538
669 - 'description_font_size' => '12px',
670 - 'description_color' => '667085',
671 - 'description_weight' => 'normal',
672 - 'description_style' => 'normal',
673 - 'description_align' => 'left',
674 - 'description_margin' => '0px',
539 + 'description_font_size' => '12px',
540 + 'description_color' => '666666',
541 + 'description_weight' => 'normal',
542 + 'description_style' => 'normal',
543 + 'description_align' => 'left',
544 + 'description_margin' => '0',
675 545
676 - 'field_font_size' => '14px',
677 - 'field_height' => '36px',
678 - 'line_height' => 'normal',
679 - 'field_width' => '100%',
680 - 'auto_width' => false,
681 - 'field_pad' => '8px 12px',
682 - 'field_margin' => '20px',
683 - 'field_weight' => 'normal',
684 - 'text_color' => '1D2939',
685 - // 'border_color_hv' => 'cccccc',
686 - 'border_color' => 'D0D5DD',
687 - 'field_border_width' => '1px',
688 - 'field_border_style' => 'solid',
546 + 'field_font_size' => '14px',
547 + 'field_height' => '32px',
548 + 'line_height' => 'normal',
549 + 'field_width' => '100%',
550 + 'auto_width' => false,
551 + 'field_pad' => '6px 10px',
552 + 'field_margin' => '20px',
553 + 'field_weight' => 'normal',
554 + 'text_color' => '555555',
555 + //'border_color_hv' => 'cccccc',
556 + 'border_color' => 'BFC3C8',
557 + 'field_border_width' => '1px',
558 + 'field_border_style' => 'solid',
689 559
690 - 'bg_color' => 'ffffff',
691 - // 'bg_color_hv' => 'ffffff',
692 - 'remove_box_shadow' => '',
693 - 'bg_color_active' => 'ffffff',
694 - 'border_color_active' => '4199FD',
695 - 'remove_box_shadow_active' => '',
696 - 'text_color_error' => '444444',
697 - 'bg_color_error' => 'ffffff',
698 - 'border_color_error' => 'F04438',
699 - 'border_width_error' => '1px',
700 - 'border_style_error' => 'solid',
701 - 'bg_color_disabled' => 'F9FAFB',
702 - 'border_color_disabled' => 'D0D5DD',
703 - 'text_color_disabled' => '667085',
560 + 'bg_color' => 'ffffff',
561 + //'bg_color_hv' => 'ffffff',
562 + 'remove_box_shadow' => '',
563 + 'bg_color_active' => 'ffffff',
564 + 'border_color_active' => '66afe9',
565 + 'remove_box_shadow_active' => '',
566 + 'text_color_error' => '444444',
567 + 'bg_color_error' => 'ffffff',
568 + 'border_color_error' => 'B94A48',
569 + 'border_width_error' => '1px',
570 + 'border_style_error' => 'solid',
571 + 'bg_color_disabled' => 'ffffff',
572 + 'border_color_disabled' => 'E5E5E5',
573 + 'text_color_disabled' => 'A1A1A1',
704 574
705 - 'radio_align' => 'block',
706 - 'check_align' => 'block',
707 - 'check_font_size' => '14px',
708 - 'check_label_color' => '1D2939',
709 - 'check_weight' => 'normal',
575 + 'radio_align' => 'block',
576 + 'check_align' => 'block',
577 + 'check_font_size' => '13px',
578 + 'check_label_color' => '444444',
579 + 'check_weight' => 'normal',
710 580
711 - 'section_font_size' => '18px',
712 - 'section_color' => '344054',
713 - 'section_weight' => 'bold',
714 - 'section_pad' => '32px 0px 3px 0px',
715 - 'section_mar_top' => '30px',
716 - 'section_mar_bottom' => '30px',
717 - 'section_bg_color' => '',
718 - 'section_border_color' => 'EAECF0',
719 - 'section_border_width' => '1px',
720 - 'section_border_style' => 'solid',
721 - 'section_border_loc' => '-top',
722 - 'collapse_icon' => '6',
723 - 'collapse_pos' => 'after',
724 - 'repeat_icon' => '1',
725 - 'repeat_icon_color' => 'ffffff',
581 + 'section_font_size' => '18px',
582 + 'section_color' => '444444',
583 + 'section_weight' => 'bold',
584 + 'section_pad' => '15px 0 3px 0',
585 + 'section_mar_top' => '15px',
586 + 'section_mar_bottom' => '30px',
587 + 'section_bg_color' => '',
588 + 'section_border_color' => 'e8e8e8',
589 + 'section_border_width' => '2px',
590 + 'section_border_style' => 'solid',
591 + 'section_border_loc' => '-top',
592 + 'collapse_icon' => '6',
593 + 'collapse_pos' => 'after',
594 + 'repeat_icon' => '1',
595 + 'repeat_icon_color' => 'ffffff',
726 596
727 597 'submit_style' => false,
728 - 'submit_font_size' => '14px',
598 + 'submit_font_size' => '15px',
729 599 'submit_width' => 'auto',
730 600 'submit_height' => 'auto',
731 - 'submit_bg_color' => '4199FD',
732 - 'submit_border_color' => '4199FD',
601 + 'submit_bg_color' => '579AF6',
602 + 'submit_border_color' => '579AF6',
733 603 'submit_border_width' => '1px',
734 604 'submit_text_color' => 'ffffff',
735 605 'submit_weight' => 'normal',
736 - 'submit_border_radius' => '8px',
606 + 'submit_border_radius' => '4px',
737 607 'submit_bg_img' => '',
738 608 'submit_margin' => '10px',
739 - 'submit_padding' => '8px 16px',
609 + 'submit_padding' => '10px 20px',
740 610 'submit_shadow_color' => 'eeeeee',
741 - 'submit_hover_bg_color' => '3680D3',
742 - 'submit_hover_color' => 'ffffff',
743 - 'submit_hover_border_color' => '3680D3',
744 - 'submit_active_bg_color' => '3680D3',
745 - 'submit_active_color' => 'ffffff',
746 - 'submit_active_border_color' => '3680D3',
611 + 'submit_hover_bg_color' => 'efefef',
612 + 'submit_hover_color' => '444444',
613 + 'submit_hover_border_color' => 'cccccc',
614 + 'submit_active_bg_color' => 'efefef',
615 + 'submit_active_color' => '444444',
616 + 'submit_active_border_color' => 'cccccc',
747 617
748 - 'border_radius' => '8px',
749 - 'error_bg' => 'FEE4E2',
750 - 'error_border' => 'F5B8AA',
751 - 'error_text' => 'F04438',
752 - 'error_font_size' => '14px',
618 + 'border_radius' => '4px',
619 + 'error_bg' => 'F2DEDE',
620 + 'error_border' => 'EBCCD1',
621 + 'error_text' => 'B94A48',
622 + 'error_font_size' => '14px',
753 623
754 - 'success_bg_color' => 'DFF0D8',
755 - 'success_border_color' => 'D6E9C6',
756 - 'success_text_color' => '468847',
757 - 'success_font_size' => '14px',
624 + 'success_bg_color' => 'DFF0D8',
625 + 'success_border_color' => 'D6E9C6',
626 + 'success_text_color' => '468847',
627 + 'success_font_size' => '14px',
758 628
759 - 'important_style' => false,
629 + 'important_style' => false,
760 630
761 - 'progress_bg_color' => 'EAECF0',
762 - 'progress_color' => '1D2939',
763 - 'progress_active_bg_color' => '4199FD',
764 - 'progress_active_color' => 'ffffff',
765 - 'progress_border_color' => 'EAECF0',
766 - 'progress_border_size' => '1px',
767 - 'progress_size' => '30px',
768 - 'custom_css' => '',
769 - 'use_base_font_size' => false,
770 - 'base_font_size' => '15px',
771 - 'field_shape_type' => 'rounded-corner',
631 + 'progress_bg_color' => 'eaeaea',
632 + 'progress_active_color' => 'ffffff',
633 + 'progress_active_bg_color' => '579AF6',
634 + 'progress_color' => '3f4b5b',
635 + 'progress_border_color' => 'E5E5E5',
636 + 'progress_border_size' => '2px',
637 + 'progress_size' => '24px',
772 638
773 - 'enable_style_custom_css' => false,
774 - 'single_style_custom_css' => '',
639 + 'custom_css' => '',
775 640 );
776 641
777 642 return apply_filters( 'frm_default_style_settings', $defaults );
778 643 }
@@ -781,9 +646,8 @@
781 646 * Get a name attribute value for a style setting input.
782 647 *
783 648 * @param string $field_name
784 649 * @param string $post_field
785 - *
786 650 * @return string
787 651 */
788 652 public function get_field_name( $field_name, $post_field = 'post_content' ) {
789 653 return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']';
@@ -793,63 +657,35 @@
793 657 * @return array
794 658 */
795 659 public static function get_bold_options() {
796 660 return array(
797 - 100 => __( 'Thin', 'formidable' ),
798 - 200 => __( 'Extra Light', 'formidable' ),
799 - 300 => __( 'Light', 'formidable' ),
800 - 'normal' => __( 'Regular', 'formidable' ),
801 - 500 => __( 'Medium', 'formidable' ),
802 - 600 => __( 'Semi Bold', 'formidable' ),
803 - 'bold' => __( 'Bold', 'formidable' ),
804 - 800 => __( 'Extra Bold', 'formidable' ),
805 - 900 => __( 'Black', 'formidable' ),
661 + 100 => 100,
662 + 200 => 200,
663 + 300 => 300,
664 + 'normal' => __( 'normal', 'formidable' ),
665 + 500 => 500,
666 + 600 => 600,
667 + 'bold' => __( 'bold', 'formidable' ),
668 + 800 => 800,
669 + 900 => 900,
806 670 );
807 671 }
808 672
809 673 /**
810 - * Don't let imbalanced font families ruin the whole stylesheet.
674 + * Don't let imbalanced font families ruin the whole stylesheet
811 675 *
812 676 * @param string $value
813 - *
814 677 * @return string
815 678 */
816 679 public function force_balanced_quotation( $value ) {
817 680 $balanced_characters = array( '"', "'" );
818 -
819 681 foreach ( $balanced_characters as $char ) {
820 682 $char_count = substr_count( $value, $char );
821 - $is_balanced = $char_count % 2 === 0;
822 -
823 - if ( $is_balanced ) {
824 - continue;
825 - }
826 -
827 - if ( $value && $char === $value[ strlen( $value ) - 1 ] ) {
828 - $value = $char . $value;
829 - } else {
683 + $is_balanced = $char_count % 2 == 0;
684 + if ( ! $is_balanced ) {
830 685 $value .= $char;
831 686 }
832 687 }
833 688
834 689 return $value;
835 - }
836 -
837 - /**
838 - * Get the default template style
839 - *
840 - * @since 6.14
841 - *
842 - * @param int|string $style_id The post type "frm_styles" ID.
843 - *
844 - * @return string The json encoded template data
845 - */
846 - public function get_default_template_style( $style_id ) {
847 - $default_template = get_post_meta( (int) $style_id, $this->default_template_style_meta_name, true );
848 -
849 - if ( ! $default_template ) {
850 - return FrmAppHelper::prepare_and_encode( $this->get_defaults() );
851 - }
852 -
853 - return $default_template;
854 690 }
855 691 }