| @@ -3,14 +3,34 @@ | ||
| 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 | |
| 9 | 7 | |
| 10 | 8 | /** |
| 11 | - * @param int|string $id The id of the stylsheet or 'default' | |
| 9 | + * The meta name of default template style. | |
| 10 | + * | |
| 11 | + * @since 6.14 | |
| 12 | + * @var string | |
| 12 | 13 | */ |
| 14 | + private $default_template_style_meta_name = 'frm_style_default'; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * Unique ID number of the current instance. | |
| 18 | + * | |
| 19 | + * @var int | |
| 20 | + */ | |
| 21 | + public $number = false; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * The id of the post. | |
| 25 | + * | |
| 26 | + * @var int|string | |
| 27 | + */ | |
| 28 | + public $id = 0; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * @param int|string $id The id of the stylesheet or 'default'. | |
| 32 | + */ | |
| 13 | 33 | public function __construct( $id = 0 ) { |
| 14 | 34 | $this->id = $id; |
| 15 | 35 | } |
| 16 | 36 | |
| @@ -20,9 +40,10 @@ | ||
| 20 | 40 | public function get_new() { |
| 21 | 41 | $this->id = 0; |
| 22 | 42 | |
| 23 | 43 | $max_slug_value = 2147483647; |
| 24 | - $min_slug_value = 37; // we want to have at least 2 characters in the slug | |
| 44 | + // We want to have at least 2 characters in the slug. | |
| 45 | + $min_slug_value = 37; | |
| 25 | 46 | $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 ); |
| 26 | 47 | |
| 27 | 48 | $style = array( |
| 28 | 49 | 'post_type' => FrmStylesController::$post_type, |
| @@ -67,9 +88,9 @@ | ||
| 67 | 88 | } |
| 68 | 89 | |
| 69 | 90 | $action_ids = array(); |
| 70 | 91 | |
| 71 | - foreach ( $all_instances as $number => $new_instance ) { | |
| 92 | + foreach ( $all_instances as $new_instance ) { | |
| 72 | 93 | $new_instance = (array) $new_instance; |
| 73 | 94 | $this->id = $new_instance['ID']; |
| 74 | 95 | |
| 75 | 96 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| @@ -91,10 +112,10 @@ | ||
| 91 | 112 | $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 |
| 92 | 113 | $new_instance['post_content']['custom_css'] = $custom_css; |
| 93 | 114 | unset( $custom_css ); |
| 94 | 115 | |
| 95 | - $new_instance['post_type'] = FrmStylesController::$post_type; | |
| 96 | - $new_instance['post_status'] = 'publish'; | |
| 116 | + $new_instance['post_type'] = FrmStylesController::$post_type; | |
| 117 | + $new_instance['post_status'] = 'publish'; | |
| 97 | 118 | |
| 98 | 119 | if ( ! $id ) { |
| 99 | 120 | $new_instance['post_name'] = $new_instance['post_title']; |
| 100 | 121 | } |
| @@ -119,10 +140,12 @@ | ||
| 119 | 140 | $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
| 120 | 141 | } |
| 121 | 142 | } |
| 122 | 143 | |
| 144 | + $new_instance['post_content'] = FrmStylesHelper::update_base_font_size( $new_instance['post_content'], $this->get_defaults() ); | |
| 145 | + | |
| 123 | 146 | $action_ids[] = $this->save( $new_instance ); |
| 124 | - } | |
| 147 | + }//end foreach | |
| 125 | 148 | |
| 126 | 149 | $this->save_settings(); |
| 127 | 150 | |
| 128 | 151 | return $action_ids; |
| @@ -132,9 +155,9 @@ | ||
| 132 | 155 | * Sanitize custom color values and convert it to valid one filling missing values. |
| 133 | 156 | * |
| 134 | 157 | * @since 5.3.2 |
| 135 | 158 | * |
| 136 | - * @param string $color_val, The color value, by reference. | |
| 159 | + * @param string $color_val The color value, by reference. | |
| 137 | 160 | * @return void |
| 138 | 161 | */ |
| 139 | 162 | private function maybe_sanitize_rgba_value( &$color_val ) { |
| 140 | 163 | if ( preg_match( '/(rgb|rgba)\(/', $color_val ) !== 1 ) { |
| @@ -141,9 +164,10 @@ | ||
| 141 | 164 | return; |
| 142 | 165 | } |
| 143 | 166 | |
| 144 | 167 | $color_val = trim( $color_val ); |
| 145 | - $color_val = ltrim( $color_val, '(' ); // Remove leading braces so (rgba(1,1,1,1) doesn't cause inconsistent braces. | |
| 168 | + // Remove leading braces so (rgba(1,1,1,1) doesn't cause inconsistent braces. | |
| 169 | + $color_val = ltrim( $color_val, '(' ); | |
| 146 | 170 | $patterns = array( '/rgba\((\s*\d+\s*,){3}[[0-1]\.]+\)/', '/rgb\((\s*\d+\s*,){2}\s*[\d]+\)/' ); |
| 147 | 171 | foreach ( $patterns as $pattern ) { |
| 148 | 172 | if ( preg_match( $pattern, $color_val ) === 1 ) { |
| 149 | 173 | return; |
| @@ -153,10 +177,11 @@ | ||
| 153 | 177 | // Remove all leading ')' braces, then add one back. This way there's always a single brace. |
| 154 | 178 | $color_val = rtrim( $color_val, ')' ); |
| 155 | 179 | $color_val .= ')'; |
| 156 | 180 | |
| 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((. | |
| 181 | + $color_rgba = substr( $color_val, strpos( $color_val, '(' ) + 1, strlen( $color_val ) - strpos( $color_val, '(' ) - 2 ); | |
| 182 | + // Remove any excessive braces from the rgba like rgba((. | |
| 183 | + $color_rgba = trim( $color_rgba, '()' ); | |
| 159 | 184 | $length_of_color_codes = strpos( $color_val, '(' ); |
| 160 | 185 | $new_color_values = array(); |
| 161 | 186 | |
| 162 | 187 | // replace empty values by 0 or 1 (if alpha position). |
| @@ -183,12 +208,12 @@ | ||
| 183 | 208 | $new_value = 1; |
| 184 | 209 | } else { |
| 185 | 210 | $new_value = floatval( $value ); |
| 186 | 211 | } |
| 187 | - } | |
| 212 | + }//end if | |
| 188 | 213 | |
| 189 | 214 | $new_color_values[] = null === $new_value ? $value : $new_value; |
| 190 | - } | |
| 215 | + }//end foreach | |
| 191 | 216 | |
| 192 | 217 | // add more 0s and 1 (if alpha position) if needed. |
| 193 | 218 | $missing_values = $length_of_color_codes - count( $new_color_values ); |
| 194 | 219 | if ( $missing_values > 1 ) { |
| @@ -203,9 +228,10 @@ | ||
| 203 | 228 | } |
| 204 | 229 | |
| 205 | 230 | $new_color = implode( ',', $new_color_values ); |
| 206 | 231 | $prefix = substr( $color_val, 0, strpos( $color_val, '(' ) + 1 ); |
| 207 | - $prefix = rtrim( $prefix, '(' ) . '('; // Limit the number of opening braces after rgb/rgba. There should only be one. | |
| 232 | + // Limit the number of opening braces after rgb/rgba. There should only be one. | |
| 233 | + $prefix = rtrim( $prefix, '(' ) . '('; | |
| 208 | 234 | $new_color = $prefix . $new_color . ')'; |
| 209 | 235 | |
| 210 | 236 | $color_val = $new_color; |
| 211 | 237 | } |
| @@ -210,28 +236,13 @@ | ||
| 210 | 236 | $color_val = $new_color; |
| 211 | 237 | } |
| 212 | 238 | |
| 213 | 239 | /** |
| 214 | - * Unslash everything in post_content but custom_css | |
| 215 | - * | |
| 216 | 240 | * @since 5.0.13 |
| 217 | 241 | * |
| 218 | 242 | * @param array $settings |
| 219 | 243 | * @return array |
| 220 | 244 | */ |
| 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 | |
| 230 | - * | |
| 231 | - * @param array $settings | |
| 232 | - * @return array | |
| 233 | - */ | |
| 234 | 245 | public function sanitize_post_content( $settings ) { |
| 235 | 246 | $defaults = $this->get_defaults(); |
| 236 | 247 | $valid_keys = array_keys( $defaults ); |
| 237 | 248 | $sanitized_settings = array(); |
| @@ -300,12 +311,10 @@ | ||
| 300 | 311 | */ |
| 301 | 312 | private function trim_braces( $input ) { |
| 302 | 313 | $output = $input; |
| 303 | 314 | // Remove any ( from the start of the string as no CSS values expect at the first character. |
| 304 | - if ( $output ) { | |
| 305 | - if ( in_array( $output[0], array( '(', ')' ), true ) ) { | |
| 306 | - $output = ltrim( $output, '()' ); | |
| 307 | - } | |
| 315 | + if ( $output && in_array( $output[0], array( '(', ')' ), true ) ) { | |
| 316 | + $output = ltrim( $output, '()' ); | |
| 308 | 317 | } |
| 309 | 318 | // Remove extra braces from the end. |
| 310 | 319 | if ( in_array( substr( $output, -1 ), array( '(', ')' ), true ) ) { |
| 311 | 320 | $output = rtrim( $output, '()' ); |
| @@ -433,9 +442,9 @@ | ||
| 433 | 442 | /** |
| 434 | 443 | * Delete a style by its post ID. |
| 435 | 444 | * |
| 436 | 445 | * @param int $id |
| 437 | - * @return WP_Post|false|null | |
| 446 | + * @return false|WP_Post|null | |
| 438 | 447 | */ |
| 439 | 448 | public function destroy( $id ) { |
| 440 | 449 | if ( $id === $this->get_default_style()->ID ) { |
| 441 | 450 | return false; |
| @@ -443,9 +452,9 @@ | ||
| 443 | 452 | return wp_delete_post( $id ); |
| 444 | 453 | } |
| 445 | 454 | |
| 446 | 455 | /** |
| 447 | - * @return WP_Post|stdClass | |
| 456 | + * @return stdClass|WP_Post | |
| 448 | 457 | */ |
| 449 | 458 | public function get_one() { |
| 450 | 459 | if ( 'default' === $this->id ) { |
| 451 | 460 | $style = $this->get_default_style(); |
| @@ -570,9 +579,9 @@ | ||
| 570 | 579 | if ( ! is_array( $settings ) ) { |
| 571 | 580 | return $settings; |
| 572 | 581 | } |
| 573 | 582 | |
| 574 | - $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; | |
| 583 | + $settings['line_height'] = ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] === 'auto' ? 'normal' : $settings['field_height']; | |
| 575 | 584 | |
| 576 | 585 | if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
| 577 | 586 | $settings['form_desc_size'] = $settings['description_font_size']; |
| 578 | 587 | $settings['form_desc_color'] = $settings['description_color']; |
| @@ -601,142 +610,144 @@ | ||
| 601 | 610 | * @return array |
| 602 | 611 | */ |
| 603 | 612 | public function get_defaults() { |
| 604 | 613 | $defaults = array( |
| 605 | - 'theme_css' => 'ui-lightness', | |
| 606 | - 'theme_name' => 'UI Lightness', | |
| 614 | + 'theme_css' => 'ui-lightness', | |
| 615 | + 'theme_name' => 'UI Lightness', | |
| 607 | 616 | |
| 608 | - 'center_form' => '', | |
| 609 | - 'form_width' => '100%', | |
| 610 | - 'form_align' => 'left', | |
| 611 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', | |
| 612 | - 'fieldset' => '0px', | |
| 613 | - 'fieldset_color' => '000000', | |
| 614 | - 'fieldset_padding' => '0 0 15px 0', | |
| 615 | - 'fieldset_bg_color' => '', | |
| 617 | + 'center_form' => '', | |
| 618 | + 'form_width' => '100%', | |
| 619 | + 'form_align' => 'left', | |
| 620 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', | |
| 621 | + 'fieldset' => '0px', | |
| 622 | + 'fieldset_color' => '000000', | |
| 623 | + 'fieldset_padding' => '0px 0px 15px 0px', | |
| 624 | + 'fieldset_bg_color' => '', | |
| 616 | 625 | |
| 617 | - 'title_size' => '40px', | |
| 618 | - 'title_color' => '444444', | |
| 619 | - 'title_margin_top' => '10px', | |
| 620 | - 'title_margin_bottom' => '60px', | |
| 621 | - 'form_desc_size' => '14px', | |
| 622 | - 'form_desc_color' => '666666', | |
| 623 | - 'form_desc_margin_top' => '10px', | |
| 624 | - 'form_desc_margin_bottom' => '25px', | |
| 625 | - 'form_desc_padding' => '0', | |
| 626 | + 'title_size' => '40px', | |
| 627 | + 'title_color' => '444444', | |
| 628 | + 'title_margin_top' => '10px', | |
| 629 | + 'title_margin_bottom' => '60px', | |
| 630 | + 'form_desc_size' => '14px', | |
| 631 | + 'form_desc_color' => '98A2B3', | |
| 632 | + 'form_desc_margin_top' => '10px', | |
| 633 | + 'form_desc_margin_bottom' => '25px', | |
| 634 | + 'form_desc_padding' => '0px', | |
| 626 | 635 | |
| 627 | - 'font' => '', | |
| 628 | - 'font_size' => '15px', | |
| 629 | - 'label_color' => '3f4b5b', | |
| 630 | - 'weight' => 'normal', | |
| 631 | - 'position' => 'none', | |
| 632 | - 'align' => 'left', | |
| 633 | - 'width' => '150px', | |
| 634 | - 'required_color' => 'B94A48', | |
| 635 | - 'required_weight' => 'bold', | |
| 636 | - 'label_padding' => '0 0 3px 0', | |
| 636 | + 'font' => '', | |
| 637 | + 'font_size' => '15px', | |
| 638 | + 'label_color' => '344054', | |
| 639 | + 'weight' => 'normal', | |
| 640 | + 'position' => 'none', | |
| 641 | + 'align' => 'left', | |
| 642 | + 'width' => '150px', | |
| 643 | + 'required_color' => 'F04438', | |
| 644 | + 'required_weight' => 'bold', | |
| 645 | + 'label_padding' => '0px 0px 5px 0px', | |
| 637 | 646 | |
| 638 | - 'description_font_size' => '12px', | |
| 639 | - 'description_color' => '666666', | |
| 640 | - 'description_weight' => 'normal', | |
| 641 | - 'description_style' => 'normal', | |
| 642 | - 'description_align' => 'left', | |
| 643 | - 'description_margin' => '0', | |
| 647 | + 'description_font_size' => '12px', | |
| 648 | + 'description_color' => '667085', | |
| 649 | + 'description_weight' => 'normal', | |
| 650 | + 'description_style' => 'normal', | |
| 651 | + 'description_align' => 'left', | |
| 652 | + 'description_margin' => '0px', | |
| 644 | 653 | |
| 645 | - 'field_font_size' => '14px', | |
| 646 | - 'field_height' => '32px', | |
| 647 | - 'line_height' => 'normal', | |
| 648 | - 'field_width' => '100%', | |
| 649 | - 'auto_width' => false, | |
| 650 | - 'field_pad' => '6px 10px', | |
| 651 | - 'field_margin' => '20px', | |
| 652 | - 'field_weight' => 'normal', | |
| 653 | - 'text_color' => '555555', | |
| 654 | - //'border_color_hv' => 'cccccc', | |
| 655 | - 'border_color' => 'BFC3C8', | |
| 656 | - 'field_border_width' => '1px', | |
| 657 | - 'field_border_style' => 'solid', | |
| 654 | + 'field_font_size' => '14px', | |
| 655 | + 'field_height' => '36px', | |
| 656 | + 'line_height' => 'normal', | |
| 657 | + 'field_width' => '100%', | |
| 658 | + 'auto_width' => false, | |
| 659 | + 'field_pad' => '8px 12px', | |
| 660 | + 'field_margin' => '20px', | |
| 661 | + 'field_weight' => 'normal', | |
| 662 | + 'text_color' => '1D2939', | |
| 663 | + // 'border_color_hv' => 'cccccc', | |
| 664 | + 'border_color' => 'D0D5DD', | |
| 665 | + 'field_border_width' => '1px', | |
| 666 | + 'field_border_style' => 'solid', | |
| 658 | 667 | |
| 659 | - 'bg_color' => 'ffffff', | |
| 660 | - //'bg_color_hv' => 'ffffff', | |
| 661 | - 'remove_box_shadow' => '', | |
| 662 | - 'bg_color_active' => 'ffffff', | |
| 663 | - 'border_color_active' => '66afe9', | |
| 664 | - 'remove_box_shadow_active' => '', | |
| 665 | - 'text_color_error' => '444444', | |
| 666 | - 'bg_color_error' => 'ffffff', | |
| 667 | - 'border_color_error' => 'B94A48', | |
| 668 | - 'border_width_error' => '1px', | |
| 669 | - 'border_style_error' => 'solid', | |
| 670 | - 'bg_color_disabled' => 'ffffff', | |
| 671 | - 'border_color_disabled' => 'E5E5E5', | |
| 672 | - 'text_color_disabled' => 'A1A1A1', | |
| 668 | + 'bg_color' => 'ffffff', | |
| 669 | + // 'bg_color_hv' => 'ffffff', | |
| 670 | + 'remove_box_shadow' => '', | |
| 671 | + 'bg_color_active' => 'ffffff', | |
| 672 | + 'border_color_active' => '4199FD', | |
| 673 | + 'remove_box_shadow_active' => '', | |
| 674 | + 'text_color_error' => '444444', | |
| 675 | + 'bg_color_error' => 'ffffff', | |
| 676 | + 'border_color_error' => 'F04438', | |
| 677 | + 'border_width_error' => '1px', | |
| 678 | + 'border_style_error' => 'solid', | |
| 679 | + 'bg_color_disabled' => 'F9FAFB', | |
| 680 | + 'border_color_disabled' => 'D0D5DD', | |
| 681 | + 'text_color_disabled' => '667085', | |
| 673 | 682 | |
| 674 | - 'radio_align' => 'block', | |
| 675 | - 'check_align' => 'block', | |
| 676 | - 'check_font_size' => '13px', | |
| 677 | - 'check_label_color' => '444444', | |
| 678 | - 'check_weight' => 'normal', | |
| 683 | + 'radio_align' => 'block', | |
| 684 | + 'check_align' => 'block', | |
| 685 | + 'check_font_size' => '14px', | |
| 686 | + 'check_label_color' => '1D2939', | |
| 687 | + 'check_weight' => 'normal', | |
| 679 | 688 | |
| 680 | - 'section_font_size' => '18px', | |
| 681 | - 'section_color' => '444444', | |
| 682 | - 'section_weight' => 'bold', | |
| 683 | - 'section_pad' => '15px 0 3px 0', | |
| 684 | - 'section_mar_top' => '15px', | |
| 685 | - 'section_mar_bottom' => '30px', | |
| 686 | - 'section_bg_color' => '', | |
| 687 | - 'section_border_color' => 'e8e8e8', | |
| 688 | - 'section_border_width' => '2px', | |
| 689 | - 'section_border_style' => 'solid', | |
| 690 | - 'section_border_loc' => '-top', | |
| 691 | - 'collapse_icon' => '6', | |
| 692 | - 'collapse_pos' => 'after', | |
| 693 | - 'repeat_icon' => '1', | |
| 694 | - 'repeat_icon_color' => 'ffffff', | |
| 689 | + 'section_font_size' => '18px', | |
| 690 | + 'section_color' => '344054', | |
| 691 | + 'section_weight' => 'bold', | |
| 692 | + 'section_pad' => '32px 0px 3px 0px', | |
| 693 | + 'section_mar_top' => '30px', | |
| 694 | + 'section_mar_bottom' => '30px', | |
| 695 | + 'section_bg_color' => '', | |
| 696 | + 'section_border_color' => 'EAECF0', | |
| 697 | + 'section_border_width' => '1px', | |
| 698 | + 'section_border_style' => 'solid', | |
| 699 | + 'section_border_loc' => '-top', | |
| 700 | + 'collapse_icon' => '6', | |
| 701 | + 'collapse_pos' => 'after', | |
| 702 | + 'repeat_icon' => '1', | |
| 703 | + 'repeat_icon_color' => 'ffffff', | |
| 695 | 704 | |
| 696 | 705 | 'submit_style' => false, |
| 697 | - 'submit_font_size' => '15px', | |
| 706 | + 'submit_font_size' => '14px', | |
| 698 | 707 | 'submit_width' => 'auto', |
| 699 | 708 | 'submit_height' => 'auto', |
| 700 | - 'submit_bg_color' => '579AF6', | |
| 701 | - 'submit_border_color' => '579AF6', | |
| 709 | + 'submit_bg_color' => '4199FD', | |
| 710 | + 'submit_border_color' => '4199FD', | |
| 702 | 711 | 'submit_border_width' => '1px', |
| 703 | 712 | 'submit_text_color' => 'ffffff', |
| 704 | 713 | 'submit_weight' => 'normal', |
| 705 | - 'submit_border_radius' => '4px', | |
| 714 | + 'submit_border_radius' => '8px', | |
| 706 | 715 | 'submit_bg_img' => '', |
| 707 | 716 | 'submit_margin' => '10px', |
| 708 | - 'submit_padding' => '10px 20px', | |
| 717 | + 'submit_padding' => '8px 16px', | |
| 709 | 718 | 'submit_shadow_color' => 'eeeeee', |
| 710 | - 'submit_hover_bg_color' => 'efefef', | |
| 711 | - 'submit_hover_color' => '444444', | |
| 712 | - 'submit_hover_border_color' => 'cccccc', | |
| 713 | - 'submit_active_bg_color' => 'efefef', | |
| 714 | - 'submit_active_color' => '444444', | |
| 715 | - 'submit_active_border_color' => 'cccccc', | |
| 719 | + 'submit_hover_bg_color' => '3680D3', | |
| 720 | + 'submit_hover_color' => 'ffffff', | |
| 721 | + 'submit_hover_border_color' => '3680D3', | |
| 722 | + 'submit_active_bg_color' => '3680D3', | |
| 723 | + 'submit_active_color' => 'ffffff', | |
| 724 | + 'submit_active_border_color' => '3680D3', | |
| 716 | 725 | |
| 717 | - 'border_radius' => '4px', | |
| 718 | - 'error_bg' => 'F2DEDE', | |
| 719 | - 'error_border' => 'EBCCD1', | |
| 720 | - 'error_text' => 'B94A48', | |
| 721 | - 'error_font_size' => '14px', | |
| 726 | + 'border_radius' => '8px', | |
| 727 | + 'error_bg' => 'FEE4E2', | |
| 728 | + 'error_border' => 'F5B8AA', | |
| 729 | + 'error_text' => 'F04438', | |
| 730 | + 'error_font_size' => '14px', | |
| 722 | 731 | |
| 723 | - 'success_bg_color' => 'DFF0D8', | |
| 724 | - 'success_border_color' => 'D6E9C6', | |
| 725 | - 'success_text_color' => '468847', | |
| 726 | - 'success_font_size' => '14px', | |
| 732 | + 'success_bg_color' => 'DFF0D8', | |
| 733 | + 'success_border_color' => 'D6E9C6', | |
| 734 | + 'success_text_color' => '468847', | |
| 735 | + 'success_font_size' => '14px', | |
| 727 | 736 | |
| 728 | - 'important_style' => false, | |
| 737 | + 'important_style' => false, | |
| 729 | 738 | |
| 730 | - 'progress_bg_color' => 'eaeaea', | |
| 731 | - 'progress_active_color' => 'ffffff', | |
| 732 | - 'progress_active_bg_color' => '579AF6', | |
| 733 | - 'progress_color' => '3f4b5b', | |
| 734 | - 'progress_border_color' => 'E5E5E5', | |
| 735 | - 'progress_border_size' => '2px', | |
| 736 | - 'progress_size' => '24px', | |
| 737 | - | |
| 738 | - 'custom_css' => '', | |
| 739 | + 'progress_bg_color' => 'EAECF0', | |
| 740 | + 'progress_color' => '1D2939', | |
| 741 | + 'progress_active_bg_color' => '4199FD', | |
| 742 | + 'progress_active_color' => 'ffffff', | |
| 743 | + 'progress_border_color' => 'EAECF0', | |
| 744 | + 'progress_border_size' => '1px', | |
| 745 | + 'progress_size' => '30px', | |
| 746 | + 'custom_css' => '', | |
| 747 | + 'use_base_font_size' => false, | |
| 748 | + 'base_font_size' => '15px', | |
| 749 | + 'field_shape_type' => 'rounded-corner', | |
| 739 | 750 | ); |
| 740 | 751 | |
| 741 | 752 | return apply_filters( 'frm_default_style_settings', $defaults ); |
| 742 | 753 | } |
| @@ -756,17 +767,17 @@ | ||
| 756 | 767 | * @return array |
| 757 | 768 | */ |
| 758 | 769 | public static function get_bold_options() { |
| 759 | 770 | return array( |
| 760 | - 100 => 100, | |
| 761 | - 200 => 200, | |
| 762 | - 300 => 300, | |
| 763 | - 'normal' => __( 'normal', 'formidable' ), | |
| 764 | - 500 => 500, | |
| 765 | - 600 => 600, | |
| 766 | - 'bold' => __( 'bold', 'formidable' ), | |
| 767 | - 800 => 800, | |
| 768 | - 900 => 900, | |
| 771 | + 100 => __( 'Thin', 'formidable' ), | |
| 772 | + 200 => __( 'Extra Light', 'formidable' ), | |
| 773 | + 300 => __( 'Light', 'formidable' ), | |
| 774 | + 'normal' => __( 'Regular', 'formidable' ), | |
| 775 | + 500 => __( 'Medium', 'formidable' ), | |
| 776 | + 600 => __( 'Semi Bold', 'formidable' ), | |
| 777 | + 'bold' => __( 'Bold', 'formidable' ), | |
| 778 | + 800 => __( 'Extra Bold', 'formidable' ), | |
| 779 | + 900 => __( 'Black', 'formidable' ), | |
| 769 | 780 | ); |
| 770 | 781 | } |
| 771 | 782 | |
| 772 | 783 | /** |
| @@ -791,6 +802,22 @@ | ||
| 791 | 802 | $value .= $char; |
| 792 | 803 | } |
| 793 | 804 | } |
| 794 | 805 | return $value; |
| 806 | + } | |
| 807 | + | |
| 808 | + /** | |
| 809 | + * Get the default template style | |
| 810 | + * | |
| 811 | + * @since 6.14 | |
| 812 | + * @param int $style_id The post type "frm_styles" ID. | |
| 813 | + * | |
| 814 | + * @return string The json encoded template data | |
| 815 | + */ | |
| 816 | + public function get_default_template_style( $style_id ) { | |
| 817 | + $default_template = get_post_meta( (int) $style_id, $this->default_template_style_meta_name, true ); | |
| 818 | + if ( empty( $default_template ) ) { | |
| 819 | + return FrmAppHelper::prepare_and_encode( $this->get_defaults() ); | |
| 820 | + } | |
| 821 | + return $default_template; | |
| 795 | 822 | } |
| 796 | 823 | } |