form-01--form-container.php
3 years ago
form-02--form-fields.php
3 years ago
form-03--input.php
5 months ago
form-04--select2.php
5 months ago
form-05--select2-dropdown.php
3 years ago
form-06--timepicker-dropdown.php
3 years ago
form-07--radio.php
5 months ago
form-08--checkbox.php
5 months ago
form-09--calendar.php
3 years ago
form-10--submit.php
5 months ago
form-11--options-container.php
3 years ago
form-12--options-title.php
5 months ago
form-13--gdpr.php
5 months ago
form-14--error-message.php
5 months ago
form-15--success-message.php
2 years ago
form-16--recaptcha.php
5 months ago
general-01--module-container.php
3 years ago
general-02--main-layout.php
1 month ago
general-03--layout-header.php
3 years ago
general-04--layout-content.php
3 years ago
general-05--layout-footer.php
3 years ago
general-06--image-size.php
5 months ago
general-07--image-fitting.php
3 years ago
general-08--image-position.php
5 months ago
general-09--content-wrapper.php
3 years ago
general-10--title.php
5 months ago
general-11--subtitle.php
5 months ago
general-12--content.php
5 months ago
general-13--cta-container.php
3 years ago
general-14--cta-button.php
5 months ago
general-15--cta-alignment.php
3 years ago
general-16--nsa-link.php
5 months ago
general-17--close-button.php
3 years ago
general-18--popup-mask.php
3 years ago
general-19--cta-helper-text.php
5 months ago
module-size-embed.php
5 months ago
module-size-popup.php
5 months ago
module-size-slidein.php
3 years ago
general-10--title.php
211 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Title custom settings. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | global $wp_locale; |
| 10 | |
| 11 | $is_rtl = $wp_locale->is_rtl(); |
| 12 | |
| 13 | $component = '.hustle-layout .hustle-title'; |
| 14 | |
| 15 | // SETTINGS: Margin. |
| 16 | $margin_top = ( '' !== $advanced['title_margin_top'] ) ? $advanced['title_margin_top'] . $advanced['title_margin_unit'] : '0'; |
| 17 | $margin_right = ( '' !== $advanced['title_margin_right'] ) ? $advanced['title_margin_right'] . $advanced['title_margin_unit'] : '0'; |
| 18 | $margin_bottom = ( '' !== $advanced['title_margin_bottom'] ) ? $advanced['title_margin_bottom'] . $advanced['title_margin_unit'] : '0'; |
| 19 | $margin_left = ( '' !== $advanced['title_margin_left'] ) ? $advanced['title_margin_left'] . $advanced['title_margin_unit'] : '0'; |
| 20 | |
| 21 | $margin = ( ! $is_rtl ) ? $margin_top . ' ' . $margin_right . ' ' . $margin_bottom . ' ' . $margin_left : $margin_top . ' ' . $margin_left . ' ' . $margin_bottom . ' ' . $margin_right; |
| 22 | |
| 23 | $mobile_margin_top = ( '' !== $advanced['title_margin_top_mobile'] ) ? $advanced['title_margin_top_mobile'] . $advanced['title_margin_unit_mobile'] : $margin_top; |
| 24 | $mobile_margin_right = ( '' !== $advanced['title_margin_right_mobile'] ) ? $advanced['title_margin_right_mobile'] . $advanced['title_margin_unit_mobile'] : $margin_right; |
| 25 | $mobile_margin_bottom = ( '' !== $advanced['title_margin_bottom_mobile'] ) ? $advanced['title_margin_bottom_mobile'] . $advanced['title_margin_unit_mobile'] : $margin_bottom; |
| 26 | $mobile_margin_left = ( '' !== $advanced['title_margin_left_mobile'] ) ? $advanced['title_margin_left_mobile'] . $advanced['title_margin_unit_mobile'] : $margin_left; |
| 27 | |
| 28 | $mobile_margin = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $margin : $mobile_margin_top . ' ' . $mobile_margin_right . ' ' . $mobile_margin_bottom . ' ' . $mobile_margin_left; |
| 29 | |
| 30 | // SETTINGS: Padding. |
| 31 | $padding_top = ( '' !== $advanced['title_padding_top'] ) ? $advanced['title_padding_top'] . $advanced['title_padding_unit'] : '0'; |
| 32 | $padding_right = ( '' !== $advanced['title_padding_right'] ) ? $advanced['title_padding_right'] . $advanced['title_padding_unit'] : '0'; |
| 33 | $padding_bottom = ( '' !== $advanced['title_padding_bottom'] ) ? $advanced['title_padding_bottom'] . $advanced['title_padding_unit'] : '0'; |
| 34 | $padding_left = ( '' !== $advanced['title_padding_left'] ) ? $advanced['title_padding_left'] . $advanced['title_padding_unit'] : '0'; |
| 35 | |
| 36 | $padding = $padding_top . ' ' . $padding_right . ' ' . $padding_bottom . ' ' . $padding_left; |
| 37 | |
| 38 | $mobile_padding_top = ( '' !== $advanced['title_padding_top_mobile'] ) ? $advanced['title_padding_top_mobile'] . $advanced['title_padding_unit_mobile'] : $padding_top; |
| 39 | $mobile_padding_right = ( '' !== $advanced['title_padding_right_mobile'] ) ? $advanced['title_padding_right_mobile'] . $advanced['title_padding_unit_mobile'] : $padding_right; |
| 40 | $mobile_padding_bottom = ( '' !== $advanced['title_padding_bottom_mobile'] ) ? $advanced['title_padding_bottom_mobile'] . $advanced['title_padding_unit_mobile'] : $padding_bottom; |
| 41 | $mobile_padding_left = ( '' !== $advanced['title_padding_left_mobile'] ) ? $advanced['title_padding_left_mobile'] . $advanced['title_padding_unit_mobile'] : $padding_left; |
| 42 | |
| 43 | $mobile_padding = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $padding : $mobile_padding_top . ' ' . $mobile_padding_right . ' ' . $mobile_padding_bottom . ' ' . $mobile_padding_left; |
| 44 | |
| 45 | // SETTINGS: Border. |
| 46 | $border_top = ( '' !== $advanced['title_border_top'] ) ? $advanced['title_border_top'] . $advanced['title_border_unit'] : '0'; |
| 47 | $border_right = ( '' !== $advanced['title_border_right'] ) ? $advanced['title_border_right'] . $advanced['title_border_unit'] : '0'; |
| 48 | $border_bottom = ( '' !== $advanced['title_border_bottom'] ) ? $advanced['title_border_bottom'] . $advanced['title_border_unit'] : '0'; |
| 49 | $border_left = ( '' !== $advanced['title_border_left'] ) ? $advanced['title_border_left'] . $advanced['title_border_unit'] : '0'; |
| 50 | |
| 51 | $border_width = $border_top . ' ' . $border_right . ' ' . $border_bottom . ' ' . $border_left; |
| 52 | $border_style = ( '' !== $advanced['title_border_type'] ) ? $advanced['title_border_type'] : 'solid'; |
| 53 | $border_color = $colors['title_border']; |
| 54 | |
| 55 | $mobile_border_top = ( '' !== $advanced['title_border_top_mobile'] ) ? $advanced['title_border_top_mobile'] . $advanced['title_border_unit_mobile'] : $border_top; |
| 56 | $mobile_border_right = ( '' !== $advanced['title_border_right_mobile'] ) ? $advanced['title_border_right_mobile'] . $advanced['title_border_unit_mobile'] : $border_right; |
| 57 | $mobile_border_bottom = ( '' !== $advanced['title_border_bottom_mobile'] ) ? $advanced['title_border_bottom_mobile'] . $advanced['title_border_unit_mobile'] : $border_bottom; |
| 58 | $mobile_border_left = ( '' !== $advanced['title_border_left_mobile'] ) ? $advanced['title_border_left_mobile'] . $advanced['title_border_unit_mobile'] : $border_left; |
| 59 | |
| 60 | $mobile_border_width = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_width : $mobile_border_top . ' ' . $mobile_border_right . ' ' . $mobile_border_bottom . ' ' . $mobile_border_left; |
| 61 | $mobile_border_style = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_style : $advanced['title_border_type_mobile']; |
| 62 | |
| 63 | // SETTINGS: Border Radius. |
| 64 | $radius_topleft = ( '' !== $advanced['title_radius_top_left'] ) ? $advanced['title_radius_top_left'] . $advanced['title_radius_unit'] : '0'; |
| 65 | $radius_topright = ( '' !== $advanced['title_radius_top_right'] ) ? $advanced['title_radius_top_right'] . $advanced['title_radius_unit'] : '0'; |
| 66 | $radius_bottomright = ( '' !== $advanced['title_radius_bottom_right'] ) ? $advanced['title_radius_bottom_right'] . $advanced['title_radius_unit'] : '0'; |
| 67 | $radius_bottomleft = ( '' !== $advanced['title_radius_bottom_left'] ) ? $advanced['title_radius_bottom_left'] . $advanced['title_radius_unit'] : '0'; |
| 68 | |
| 69 | $border_radius = $radius_topleft . ' ' . $radius_topright . ' ' . $radius_bottomright . ' ' . $radius_bottomleft; |
| 70 | |
| 71 | $mobile_radius_topleft = ( '' !== $advanced['title_radius_top_left_mobile'] ) ? $advanced['title_radius_top_left_mobile'] . $advanced['title_radius_unit_mobile'] : $radius_topleft; |
| 72 | $mobile_radius_topright = ( '' !== $advanced['title_radius_top_right_mobile'] ) ? $advanced['title_radius_top_right_mobile'] . $advanced['title_radius_unit_mobile'] : $radius_topright; |
| 73 | $mobile_radius_bottomright = ( '' !== $advanced['title_radius_bottom_right_mobile'] ) ? $advanced['title_radius_bottom_right_mobile'] . $advanced['title_radius_unit_mobile'] : $radius_bottomright; |
| 74 | $mobile_radius_bottomleft = ( '' !== $advanced['title_radius_bottom_left_mobile'] ) ? $advanced['title_radius_bottom_left_mobile'] . $advanced['title_radius_unit_mobile'] : $radius_bottomleft; |
| 75 | |
| 76 | $mobile_border_radius = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_radius : $mobile_radius_topleft . ' ' . $mobile_radius_topright . ' ' . $mobile_radius_bottomright . ' ' . $mobile_radius_bottomleft; |
| 77 | |
| 78 | // SETTINGS: Background. |
| 79 | $background = $colors['title_bg']; |
| 80 | |
| 81 | // SETTINGS: Box Shadow. |
| 82 | $shadow_offset_x = ( '' !== $advanced['title_drop_shadow_x'] ) ? $advanced['title_drop_shadow_x'] . $advanced['title_drop_shadow_unit'] : '0'; |
| 83 | $shadow_offset_y = ( '' !== $advanced['title_drop_shadow_y'] ) ? $advanced['title_drop_shadow_y'] . $advanced['title_drop_shadow_unit'] : '0'; |
| 84 | $shadow_blur = ( '' !== $advanced['title_drop_shadow_blur'] ) ? $advanced['title_drop_shadow_blur'] . $advanced['title_drop_shadow_unit'] : '0'; |
| 85 | $shadow_spread = ( '' !== $advanced['title_drop_shadow_spread'] ) ? $advanced['title_drop_shadow_spread'] . $advanced['title_drop_shadow_unit'] : '0'; |
| 86 | $shadow_color = $colors['title_drop_shadow']; |
| 87 | |
| 88 | $box_shadow = $shadow_offset_x . ' ' . $shadow_offset_y . ' ' . $shadow_blur . ' ' . $shadow_spread . ' ' . $shadow_color; |
| 89 | |
| 90 | $mobile_shadow_offset_x = ( '' !== $advanced['title_drop_shadow_x'] ) ? $advanced['title_drop_shadow_x'] . $advanced['title_drop_shadow_unit'] : $shadow_offset_x; |
| 91 | $mobile_shadow_offset_y = ( '' !== $advanced['title_drop_shadow_y'] ) ? $advanced['title_drop_shadow_y'] . $advanced['title_drop_shadow_unit'] : $shadow_offset_y; |
| 92 | $mobile_shadow_blur = ( '' !== $advanced['title_drop_shadow_blur'] ) ? $advanced['title_drop_shadow_blur'] . $advanced['title_drop_shadow_unit'] : $shadow_blur; |
| 93 | $mobile_shadow_spread = ( '' !== $advanced['title_drop_shadow_spread'] ) ? $advanced['title_drop_shadow_spread'] . $advanced['title_drop_shadow_unit'] : $shadow_spread; |
| 94 | |
| 95 | $mobile_box_shadow = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $box_shadow : $mobile_shadow_offset_x . ' ' . $mobile_shadow_offset_y . ' ' . $mobile_shadow_blur . ' ' . $mobile_shadow_spread . ' ' . $shadow_color; |
| 96 | |
| 97 | // SETTINGS: Font settings. |
| 98 | $color = $is_optin ? $colors['title_color'] : $colors['title_color_alt']; |
| 99 | $font_family = $typography['title_font_family']; |
| 100 | $font_size = $typography['title_font_size'] . $typography['title_font_size_unit']; |
| 101 | $font_weight = $typography['title_font_weight']; |
| 102 | $font_style = 'normal'; |
| 103 | $alignment = ( ! $is_rtl || 'center' === $typography['title_alignment'] ) ? $typography['title_alignment'] : 'right'; |
| 104 | $line_height = $typography['title_line_height'] . $typography['title_line_height_unit']; |
| 105 | $letter_spacing = $typography['title_letter_spacing'] . $typography['title_letter_spacing_unit']; |
| 106 | $text_transform = $typography['title_text_transform']; |
| 107 | $text_decoration = $typography['title_text_decoration']; |
| 108 | |
| 109 | if ( 'custom' === $font_family ) { |
| 110 | $font_family = ( '' !== $typography['title_custom_font_family'] ) ? $typography['title_custom_font_family'] : 'inherit'; |
| 111 | } |
| 112 | |
| 113 | if ( 'regular' === $font_weight ) { |
| 114 | $font_weight = 'normal'; |
| 115 | } elseif ( 'italic' === $font_weight ) { |
| 116 | $font_weight = 'normal'; |
| 117 | $font_style = 'italic'; |
| 118 | } elseif ( preg_match( '/(italic)/', $font_weight ) ) { // Check if font weight is italic. |
| 119 | $font_weight = str_replace( 'italic', '', $font_weight ); |
| 120 | $font_style = 'italic'; |
| 121 | } |
| 122 | |
| 123 | $mobile_font_size = ( '' !== $typography['title_font_size_mobile'] ) ? $typography['title_font_size_mobile'] . $typography['title_font_size_unit_mobile'] : $font_size; |
| 124 | $mobile_font_weight = $typography['title_font_weight_mobile']; |
| 125 | $mobile_font_style = 'normal'; |
| 126 | $mobile_alignment = ( ! $is_rtl || 'center' === $typography['title_alignment_mobile'] ) ? $typography['title_alignment_mobile'] : 'right'; |
| 127 | $mobile_line_height = ( '' !== $typography['title_line_height_mobile'] ) ? $typography['title_line_height_mobile'] . $typography['title_line_height_unit_mobile'] : $line_height; |
| 128 | $mobile_letter_spacing = ( '' !== $typography['title_letter_spacing_mobile'] ) ? $typography['title_letter_spacing_mobile'] . $typography['title_letter_spacing_unit_mobile'] : $letter_spacing; |
| 129 | $mobile_text_transform = $typography['title_text_transform_mobile']; |
| 130 | $mobile_text_decoration = $typography['title_text_decoration_mobile']; |
| 131 | |
| 132 | if ( 'regular' === $mobile_font_weight ) { |
| 133 | $mobile_font_weight = 'normal'; |
| 134 | } elseif ( 'italic' === $font_weight ) { |
| 135 | $font_weight = 'normal'; |
| 136 | $font_style = 'italic'; |
| 137 | } elseif ( preg_match( '/(italic)/', $mobile_font_weight ) ) { // Check if font weight is italic. |
| 138 | $mobile_font_weight = str_replace( 'italic', '', $mobile_font_weight ); |
| 139 | $mobile_font_style = 'italic'; |
| 140 | } |
| 141 | |
| 142 | if ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_typography ) ) { |
| 143 | $mobile_font_size = $font_size; |
| 144 | $mobile_font_weight = $font_weight; |
| 145 | $mobile_font_style = $font_style; |
| 146 | $mobile_alignment = $alignment; |
| 147 | $mobile_line_height = $line_height; |
| 148 | $mobile_letter_spacing = $letter_spacing; |
| 149 | $mobile_text_transform = $text_transform; |
| 150 | $mobile_text_decoration = $text_decoration; |
| 151 | } |
| 152 | |
| 153 | // ================================================== |
| 154 | // Check if title is not empty and exists. |
| 155 | if ( '' !== $content['title'] ) { |
| 156 | |
| 157 | $style .= ' '; |
| 158 | |
| 159 | // Mobile styles. |
| 160 | $style .= $prefix_mobile . $component . ' {'; |
| 161 | $style .= 'display: block;'; |
| 162 | $style .= 'margin: ' . $mobile_margin . ';'; |
| 163 | $style .= 'padding: ' . $mobile_padding . ';'; |
| 164 | $style .= 'border-width: ' . $mobile_border_width . ';'; |
| 165 | $style .= 'border-style: ' . $mobile_border_style . ';'; |
| 166 | $style .= ( ! $is_vanilla ) ? 'border-color: ' . $border_color . ';' : ''; |
| 167 | $style .= 'border-radius: ' . $mobile_border_radius . ';'; |
| 168 | $style .= ( ! $is_vanilla ) ? 'background-color: ' . $background . ';' : ''; |
| 169 | $style .= ( ! $is_vanilla ) ? 'box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 170 | $style .= ( ! $is_vanilla ) ? '-moz-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 171 | $style .= ( ! $is_vanilla ) ? '-webkit-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 172 | $style .= ( ! $is_vanilla ) ? 'color: ' . $color . ';' : ''; |
| 173 | $style .= ( 'inherit' !== $font_family ) ? 'font: ' . $mobile_font_weight . ' ' . $mobile_font_size . '/' . $mobile_line_height . ' ' . $font_family . ';' : ''; |
| 174 | $style .= ( 'inherit' === $font_family ) ? 'font-size: ' . $mobile_font_size . ';' : ''; |
| 175 | $style .= ( 'inherit' === $font_family ) ? 'line-height: ' . $mobile_line_height . ';' : ''; |
| 176 | $style .= ( 'inherit' === $font_family ) ? 'font-weight: ' . $mobile_font_weight . ';' : ''; |
| 177 | $style .= 'font-style: ' . $mobile_font_style . ';'; |
| 178 | $style .= 'letter-spacing: ' . $mobile_letter_spacing . ';'; |
| 179 | $style .= 'text-transform: ' . $mobile_text_transform . ';'; |
| 180 | $style .= 'text-decoration: ' . $mobile_text_decoration . ';'; |
| 181 | $style .= 'text-align: ' . $mobile_alignment . ';'; |
| 182 | $style .= '}'; |
| 183 | |
| 184 | // Desktop styles. |
| 185 | if ( $is_mobile_enabled ) { |
| 186 | |
| 187 | $style .= $breakpoint . ' {'; |
| 188 | $style .= $prefix_desktop . $component . ' {'; |
| 189 | $style .= 'margin: ' . $margin . ';'; |
| 190 | $style .= 'padding: ' . $padding . ';'; |
| 191 | $style .= 'border-width: ' . $border_width . ';'; |
| 192 | $style .= 'border-style: ' . $border_style . ';'; |
| 193 | $style .= 'border-radius: ' . $border_radius . ';'; |
| 194 | $style .= ( ! $is_vanilla ) ? 'box-shadow: ' . $box_shadow . ';' : ''; |
| 195 | $style .= ( ! $is_vanilla ) ? '-moz-box-shadow: ' . $box_shadow . ';' : ''; |
| 196 | $style .= ( ! $is_vanilla ) ? '-webkit-box-shadow: ' . $box_shadow . ';' : ''; |
| 197 | $style .= ( 'inherit' !== $font_family ) ? 'font: ' . $font_weight . ' ' . $font_size . '/' . $line_height . ' ' . $font_family . ';' : ''; |
| 198 | $style .= ( 'inherit' === $font_family ) ? 'font-size: ' . $font_size . ';' : ''; |
| 199 | $style .= ( 'inherit' === $font_family ) ? 'line-height: ' . $line_height . ';' : ''; |
| 200 | $style .= ( 'inherit' === $font_family ) ? 'font-weight: ' . $font_weight . ';' : ''; |
| 201 | $style .= 'font-style: ' . $font_style . ';'; |
| 202 | $style .= 'letter-spacing: ' . $letter_spacing . ';'; |
| 203 | $style .= 'text-transform: ' . $text_transform . ';'; |
| 204 | $style .= 'text-decoration: ' . $text_decoration . ';'; |
| 205 | $style .= 'text-align: ' . $alignment . ';'; |
| 206 | $style .= '}'; |
| 207 | $style .= '}'; |
| 208 | |
| 209 | } |
| 210 | } |
| 211 |