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