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-02--main-layout.php
214 lines
| 1 | <?php |
| 2 | /** |
| 3 | * "Main Layout" 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 = ( ! $is_optin && ( 'cabriolet' !== $layout_info ) ) ? '.hustle-layout' : '.hustle-layout .hustle-layout-body'; |
| 14 | |
| 15 | $shadow_y = ( '' !== $advanced['module_cont_drop_shadow_y'] ) ? ( ( ! $is_rtl ) ? (int) $advanced['module_cont_drop_shadow_y'] : ( -1 * (int) $advanced['module_cont_drop_shadow_y'] ) ) : 0; |
| 16 | $mobile_shadow_y = ( '' !== $advanced['module_cont_drop_shadow_y_mobile'] ) ? (int) $advanced['module_cont_drop_shadow_y_mobile'] : $shadow_y; |
| 17 | |
| 18 | // SETTINGS: Margin. |
| 19 | $margin_top = ( '' !== $advanced['module_cont_margin_top'] ) ? $advanced['module_cont_margin_top'] . $advanced['module_cont_margin_unit'] : '0'; |
| 20 | $margin_right = ( '' !== $advanced['module_cont_margin_right'] ) ? $advanced['module_cont_margin_right'] . $advanced['module_cont_margin_unit'] : '0'; |
| 21 | if ( |
| 22 | $is_embed && |
| 23 | $shadow_y > 0 |
| 24 | ) { |
| 25 | $shadow_offset_y = $shadow_y . $advanced['module_cont_drop_shadow_unit']; |
| 26 | // Add the shadow offset to the margin to prevent the shadow from overlapping other elements when the layout is embedded. |
| 27 | $margin_bottom = ( '' !== $advanced['module_cont_margin_bottom'] ) ? 'calc(' . $advanced['module_cont_margin_bottom'] . $advanced['module_cont_margin_unit'] . ' + ' . $shadow_offset_y . ')' : '0'; |
| 28 | } else { |
| 29 | $margin_bottom = ( '' !== $advanced['module_cont_margin_bottom'] ) ? $advanced['module_cont_margin_bottom'] . $advanced['module_cont_margin_unit'] : '0'; |
| 30 | } |
| 31 | $margin_left = ( '' !== $advanced['module_cont_margin_left'] ) ? $advanced['module_cont_margin_left'] . $advanced['module_cont_margin_unit'] : '0'; |
| 32 | |
| 33 | $margin = $margin_top . ' ' . $margin_right . ' ' . $margin_bottom . ' ' . $margin_left; |
| 34 | |
| 35 | |
| 36 | $mobile_margin_top = ( '' !== $advanced['module_cont_margin_top_mobile'] ) ? $advanced['module_cont_margin_top_mobile'] . $advanced['module_cont_margin_unit_mobile'] : $margin_top; |
| 37 | $mobile_margin_right = ( '' !== $advanced['module_cont_margin_right_mobile'] ) ? $advanced['module_cont_margin_right_mobile'] . $advanced['module_cont_margin_unit_mobile'] : $margin_right; |
| 38 | if ( |
| 39 | $is_embed && |
| 40 | $mobile_shadow_y > 0 |
| 41 | ) { |
| 42 | $mobile_shadow_offset_y = $mobile_shadow_y . $advanced['module_cont_drop_shadow_unit_mobile']; |
| 43 | // Add the shadow offset to the margin to prevent the shadow from overlapping other elements when the layout is embedded. |
| 44 | $mobile_margin_bottom = ( '' !== $advanced['module_cont_margin_bottom_mobile'] ) ? 'calc(' . $advanced['module_cont_margin_bottom_mobile'] . $advanced['module_cont_margin_unit_mobile'] . ' + ' . $mobile_shadow_offset_y . ')' : $margin_bottom; |
| 45 | } else { |
| 46 | $mobile_margin_bottom = ( '' !== $advanced['module_cont_margin_bottom_mobile'] ) ? $advanced['module_cont_margin_bottom_mobile'] . $advanced['module_cont_margin_unit_mobile'] : $margin_bottom; |
| 47 | } |
| 48 | $mobile_margin_left = ( '' !== $advanced['module_cont_margin_left_mobile'] ) ? $advanced['module_cont_margin_left_mobile'] . $advanced['module_cont_margin_unit_mobile'] : $margin_left; |
| 49 | |
| 50 | $mobile_margin = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $margin : $mobile_margin_top . ' ' . $mobile_margin_right . ' ' . $mobile_margin_bottom . ' ' . $mobile_margin_left; |
| 51 | |
| 52 | // SETTINGS: Padding. |
| 53 | $padding_top = ( '' !== $advanced['module_cont_padding_top'] ) ? $advanced['module_cont_padding_top'] . $advanced['module_cont_padding_unit'] : '0'; |
| 54 | $padding_right = ( '' !== $advanced['module_cont_padding_right'] ) ? $advanced['module_cont_padding_right'] . $advanced['module_cont_padding_unit'] : '0'; |
| 55 | $padding_bottom = ( '' !== $advanced['module_cont_padding_bottom'] ) ? $advanced['module_cont_padding_bottom'] . $advanced['module_cont_padding_unit'] : '0'; |
| 56 | $padding_left = ( '' !== $advanced['module_cont_padding_left'] ) ? $advanced['module_cont_padding_left'] . $advanced['module_cont_padding_unit'] : '0'; |
| 57 | |
| 58 | $padding = ( ! $is_rtl ) ? $padding_top . ' ' . $padding_right . ' ' . $padding_bottom . ' ' . $padding_left : $padding_top . ' ' . $padding_left . ' ' . $padding_bottom . ' ' . $padding_right; |
| 59 | |
| 60 | $mobile_padding_top = ( '' !== $advanced['module_cont_padding_top_mobile'] ) ? $advanced['module_cont_padding_top_mobile'] . $advanced['module_cont_padding_unit_mobile'] : $padding_top; |
| 61 | $mobile_padding_right = ( '' !== $advanced['module_cont_padding_right_mobile'] ) ? $advanced['module_cont_padding_right_mobile'] . $advanced['module_cont_padding_unit_mobile'] : $padding_right; |
| 62 | $mobile_padding_bottom = ( '' !== $advanced['module_cont_padding_bottom_mobile'] ) ? $advanced['module_cont_padding_bottom_mobile'] . $advanced['module_cont_padding_unit_mobile'] : $padding_bottom; |
| 63 | $mobile_padding_left = ( '' !== $advanced['module_cont_padding_left_mobile'] ) ? $advanced['module_cont_padding_left_mobile'] . $advanced['module_cont_padding_unit_mobile'] : $padding_left; |
| 64 | |
| 65 | $mobile_padding = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $padding : $mobile_padding_top . ' ' . $mobile_padding_right . ' ' . $mobile_padding_bottom . ' ' . $mobile_padding_left; |
| 66 | |
| 67 | // SETTINGS: Border. |
| 68 | $border_top = ( '' !== $advanced['module_cont_border_top'] ) ? $advanced['module_cont_border_top'] . $advanced['module_cont_border_unit'] : '0'; |
| 69 | $border_right = ( '' !== $advanced['module_cont_border_right'] ) ? $advanced['module_cont_border_right'] . $advanced['module_cont_border_unit'] : '0'; |
| 70 | $border_bottom = ( '' !== $advanced['module_cont_border_bottom'] ) ? $advanced['module_cont_border_bottom'] . $advanced['module_cont_border_unit'] : '0'; |
| 71 | $border_left = ( '' !== $advanced['module_cont_border_left'] ) ? $advanced['module_cont_border_left'] . $advanced['module_cont_border_unit'] : '0'; |
| 72 | |
| 73 | $border_width = $border_top . ' ' . $border_right . ' ' . $border_bottom . ' ' . $border_left; |
| 74 | $border_style = $advanced['module_cont_border_type']; |
| 75 | $border_color = $colors['module_cont_border']; |
| 76 | |
| 77 | $mobile_border_top = ( '' !== $advanced['module_cont_border_top_mobile'] ) ? $advanced['module_cont_border_top_mobile'] . $advanced['module_cont_border_unit_mobile'] : $border_top; |
| 78 | $mobile_border_right = ( '' !== $advanced['module_cont_border_right_mobile'] ) ? $advanced['module_cont_border_right_mobile'] . $advanced['module_cont_border_unit_mobile'] : $border_right; |
| 79 | $mobile_border_bottom = ( '' !== $advanced['module_cont_border_bottom_mobile'] ) ? $advanced['module_cont_border_bottom_mobile'] . $advanced['module_cont_border_unit_mobile'] : $border_bottom; |
| 80 | $mobile_border_left = ( '' !== $advanced['module_cont_border_left_mobile'] ) ? $advanced['module_cont_border_left_mobile'] . $advanced['module_cont_border_unit_mobile'] : $border_left; |
| 81 | |
| 82 | $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; |
| 83 | $mobile_border_style = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_style : $advanced['module_cont_border_type_mobile']; |
| 84 | |
| 85 | // SETTINGS: Border Radius. |
| 86 | $radius_topleft = ( '' !== $advanced['module_cont_radius_top_left'] ) ? $advanced['module_cont_radius_top_left'] . $advanced['module_cont_radius_unit'] : '0'; |
| 87 | $radius_topright = ( '' !== $advanced['module_cont_radius_top_right'] ) ? $advanced['module_cont_radius_top_right'] . $advanced['module_cont_radius_unit'] : '0'; |
| 88 | $radius_bottomright = ( '' !== $advanced['module_cont_radius_bottom_right'] ) ? $advanced['module_cont_radius_bottom_right'] . $advanced['module_cont_radius_unit'] : '0'; |
| 89 | $radius_bottomleft = ( '' !== $advanced['module_cont_radius_bottom_left'] ) ? $advanced['module_cont_radius_bottom_left'] . $advanced['module_cont_radius_unit'] : '0'; |
| 90 | |
| 91 | $border_radius = $radius_topleft . ' ' . $radius_topright . ' ' . $radius_bottomright . ' ' . $radius_bottomleft; |
| 92 | |
| 93 | $mobile_radius_topleft = ( '' !== $advanced['module_cont_radius_top_left_mobile'] ) ? $advanced['module_cont_radius_top_left_mobile'] . $advanced['module_cont_radius_unit_mobile'] : $radius_topleft; |
| 94 | $mobile_radius_topright = ( '' !== $advanced['module_cont_radius_top_right_mobile'] ) ? $advanced['module_cont_radius_top_right_mobile'] . $advanced['module_cont_radius_unit_mobile'] : $radius_topright; |
| 95 | $mobile_radius_bottomright = ( '' !== $advanced['module_cont_radius_bottom_right_mobile'] ) ? $advanced['module_cont_radius_bottom_right_mobile'] . $advanced['module_cont_radius_unit_mobile'] : $radius_bottomright; |
| 96 | $mobile_radius_bottomleft = ( '' !== $advanced['module_cont_radius_bottom_left_mobile'] ) ? $advanced['module_cont_radius_bottom_left_mobile'] . $advanced['module_cont_radius_unit_mobile'] : $radius_bottomleft; |
| 97 | |
| 98 | $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; |
| 99 | |
| 100 | // SETTINGS: Box Shadow. |
| 101 | $shadow_offset_x = ( '' !== $advanced['module_cont_drop_shadow_x'] ) ? ( ( ! $is_rtl ) ? $advanced['module_cont_drop_shadow_x'] : ( -1 * $advanced['module_cont_drop_shadow_x'] ) ) . $advanced['module_cont_drop_shadow_unit'] : '0'; |
| 102 | $shadow_offset_y = ( '' !== $advanced['module_cont_drop_shadow_y'] ) ? ( ( ! $is_rtl ) ? $advanced['module_cont_drop_shadow_y'] : ( -1 * $advanced['module_cont_drop_shadow_y'] ) ) . $advanced['module_cont_drop_shadow_unit'] : '0'; |
| 103 | $shadow_blur = ( '' !== $advanced['module_cont_drop_shadow_blur'] ) ? $advanced['module_cont_drop_shadow_blur'] . $advanced['module_cont_drop_shadow_unit'] : '0'; |
| 104 | $shadow_spread = ( '' !== $advanced['module_cont_drop_shadow_spread'] ) ? $advanced['module_cont_drop_shadow_spread'] . $advanced['module_cont_drop_shadow_unit'] : '0'; |
| 105 | $shadow_color = $colors['module_cont_drop_shadow']; |
| 106 | |
| 107 | $box_shadow = $shadow_offset_x . ' ' . $shadow_offset_y . ' ' . $shadow_blur . ' ' . $shadow_spread . ' ' . $shadow_color; |
| 108 | |
| 109 | $mobile_shadow_offset_x = ( '' !== $advanced['module_cont_drop_shadow_x_mobile'] ) ? $advanced['module_cont_drop_shadow_x_mobile'] . $advanced['module_cont_drop_shadow_unit_mobile'] : $shadow_offset_x; |
| 110 | $mobile_shadow_offset_y = ( '' !== $advanced['module_cont_drop_shadow_y_mobile'] ) ? $advanced['module_cont_drop_shadow_y_mobile'] . $advanced['module_cont_drop_shadow_unit_mobile'] : $shadow_offset_y; |
| 111 | $mobile_shadow_blur = ( '' !== $advanced['module_cont_drop_shadow_blur_mobile'] ) ? $advanced['module_cont_drop_shadow_blur_mobile'] . $advanced['module_cont_drop_shadow_unit_mobile'] : $shadow_blur; |
| 112 | $mobile_shadow_spread = ( '' !== $advanced['module_cont_drop_shadow_spread_mobile'] ) ? $advanced['module_cont_drop_shadow_spread_mobile'] . $advanced['module_cont_drop_shadow_unit_mobile'] : $shadow_spread; |
| 113 | |
| 114 | $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; |
| 115 | |
| 116 | // SETTINGS: Background. |
| 117 | $background_color = $colors['main_bg_color']; |
| 118 | $background_image = $content['background_image']; |
| 119 | $background_size = $design['background_image_fit']; |
| 120 | $background_width = ( '' !== $design['background_image_width'] ) ? $design['background_image_width'] . $design['background_image_width_unit'] : 'auto'; |
| 121 | $background_height = ( '' !== $design['background_image_height'] ) ? $design['background_image_height'] . $design['background_image_height_unit'] : 'auto'; |
| 122 | $background_size = ( 'custom' === $background_size ) ? $background_width . ' ' . $background_height : $background_size; |
| 123 | $background_repeat = $design['background_image_repeat']; |
| 124 | $background_position_x = ( ! $is_rtl || 'center' === $design['background_image_horizontal_position'] ) ? $design['background_image_horizontal_position'] : ( 'right' === $design['background_image_horizontal_position'] ? 'left' : 'right' ); |
| 125 | $background_position_y = $design['background_image_vertical_position']; |
| 126 | |
| 127 | if ( 'custom' === $background_position_x ) { |
| 128 | $horizontal_value = $design['background_image_horizontal_value']; |
| 129 | $horizontal_unit = $design['background_image_horizontal_unit']; |
| 130 | $background_position_x = ( '' !== $horizontal_value ) ? $horizontal_value . $horizontal_unit : '0'; |
| 131 | } |
| 132 | |
| 133 | if ( 'custom' === $background_position_y ) { |
| 134 | $vertical_value = $design['background_image_vertical_value']; |
| 135 | $vertical_unit = $design['background_image_vertical_unit']; |
| 136 | $background_position_y = ( '' !== $vertical_value ) ? $vertical_value . $vertical_unit : '0'; |
| 137 | } |
| 138 | |
| 139 | $mobile_background_size = $design['background_image_fit_mobile']; |
| 140 | $mobile_background_width = $design['background_image_width_mobile']; |
| 141 | $mobile_background_width = ( '' !== $mobile_background_width ) ? $mobile_background_width . $design['background_image_width_unit_mobile'] : 'auto'; |
| 142 | $mobile_background_height = $design['background_image_height_mobile']; |
| 143 | $mobile_background_height = ( '' !== $mobile_background_height ) ? $mobile_background_height . $design['background_image_height_unit_mobile'] : 'auto'; |
| 144 | $mobile_background_size = ( 'custom' === $mobile_background_size ) ? $mobile_background_width . ' ' . $mobile_background_height : $mobile_background_size; |
| 145 | $mobile_background_repeat = $design['background_image_repeat_mobile']; |
| 146 | $mobile_background_position_x = $design['background_image_horizontal_position_mobile']; |
| 147 | $mobile_background_position_y = $design['background_image_vertical_position_mobile']; |
| 148 | $mobile_background_position_y = $mobile_background_position_y; |
| 149 | |
| 150 | if ( 'custom' === $mobile_background_position_x ) { |
| 151 | $mobile_horizontal_value = $design['background_image_horizontal_value_mobile']; |
| 152 | $mobile_horizontal_unit = $design['background_image_horizontal_unit_mobile']; |
| 153 | $mobile_background_position_x = ( '' !== $mobile_horizontal_value ) ? $mobile_horizontal_value . $mobile_horizontal_unit : '0'; |
| 154 | } |
| 155 | |
| 156 | if ( 'custom' === $mobile_background_position_y ) { |
| 157 | $mobile_vertical_value = $design['background_image_vertical_value_mobile']; |
| 158 | $mobile_vertical_unit = $design['background_image_vertical_unit_mobile']; |
| 159 | $mobile_background_position_y = ( '' !== $mobile_vertical_value ) ? $mobile_vertical_value . $mobile_vertical_unit : '0'; |
| 160 | } |
| 161 | |
| 162 | if ( ! $is_mobile_enabled ) { |
| 163 | $mobile_background_size = $background_size; |
| 164 | $mobile_background_width = $background_width; |
| 165 | $mobile_background_height = $background_height; |
| 166 | $mobile_background_size = $background_size; |
| 167 | $mobile_background_repeat = $background_repeat; |
| 168 | $mobile_background_position_x = $background_position_x; |
| 169 | $mobile_background_position_y = $background_position_y; |
| 170 | } |
| 171 | |
| 172 | // ================================================== |
| 173 | // Mobile styles. |
| 174 | $style .= ' '; |
| 175 | $style .= $prefix_mobile . $component . ' {'; |
| 176 | $style .= 'margin: ' . $mobile_margin . ';'; |
| 177 | $style .= 'padding: ' . $mobile_padding . ';'; |
| 178 | $style .= 'border-width: ' . $mobile_border_width . ';'; |
| 179 | $style .= 'border-style: ' . $mobile_border_style . ';'; |
| 180 | $style .= ( ! $is_vanilla ) ? 'border-color: ' . $border_color . ';' : ''; |
| 181 | $style .= 'border-radius: ' . $mobile_border_radius . ';'; |
| 182 | // A style overflow hidden for the outsidest layer to prevent elements from overlapping the outside. |
| 183 | $style .= 'overflow: hidden;'; |
| 184 | $style .= ( ! $is_vanilla ) ? 'background-color: ' . $background_color . ';' : ''; |
| 185 | $style .= ( ! $is_slidein && ! $is_vanilla ) ? '-moz-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 186 | $style .= ( ! $is_slidein && ! $is_vanilla ) ? '-webkit-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 187 | $style .= ( ! $is_slidein && ! $is_vanilla ) ? 'box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 188 | $style .= ( '' !== $background_image ) ? 'background-image: url(' . $background_image . ');' : ''; |
| 189 | $style .= ( '' !== $background_image ) ? 'background-repeat: ' . $mobile_background_repeat . ';' : ''; |
| 190 | $style .= ( '' !== $background_image ) ? 'background-size: ' . $mobile_background_size . ';' : ''; |
| 191 | $style .= ( '' !== $background_image ) ? 'background-position: ' . $mobile_background_position_x . ' ' . $mobile_background_position_y . ';' : ''; |
| 192 | // avoid borders overlap the background image. |
| 193 | $style .= ( '' !== $background_image ) ? 'background-clip: padding-box;' : ''; |
| 194 | $style .= '}'; |
| 195 | |
| 196 | // Desktop styles. |
| 197 | if ( $is_mobile_enabled ) { |
| 198 | $style .= $breakpoint . ' {'; |
| 199 | $style .= $prefix_desktop . $component . ' {'; |
| 200 | $style .= 'margin: ' . $margin . ';'; |
| 201 | $style .= 'padding: ' . $padding . ';'; |
| 202 | $style .= 'border-width: ' . $border_width . ';'; |
| 203 | $style .= 'border-style: ' . $border_style . ';'; |
| 204 | $style .= 'border-radius: ' . $border_radius . ';'; |
| 205 | $style .= ( ! $is_slidein && ! $is_vanilla ) ? '-moz-box-shadow: ' . $box_shadow . ';' : ''; |
| 206 | $style .= ( ! $is_slidein && ! $is_vanilla ) ? '-webkit-box-shadow: ' . $box_shadow . ';' : ''; |
| 207 | $style .= ( ! $is_slidein && ! $is_vanilla ) ? 'box-shadow: ' . $box_shadow . ';' : ''; |
| 208 | $style .= ( '' !== $background_image ) ? 'background-repeat: ' . $background_repeat . ';' : ''; |
| 209 | $style .= ( '' !== $background_image ) ? 'background-size: ' . $background_size . ';' : ''; |
| 210 | $style .= ( '' !== $background_image ) ? 'background-position: ' . $background_position_x . ' ' . $background_position_y . ';' : ''; |
| 211 | $style .= '}'; |
| 212 | $style .= '}'; |
| 213 | } |
| 214 |