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-09--content-wrapper.php
158 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Content main wrapper for opt-ins. |
| 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 | $container = '.hustle-layout .hustle-content'; |
| 14 | $component = $container . ' .hustle-content-wrap'; |
| 15 | |
| 16 | $has_title = ( '' !== $content['title'] ); |
| 17 | $has_subtitle = ( '' !== $content['sub_title'] ); |
| 18 | $has_content = ( '' !== $content['main_content'] ); |
| 19 | $has_cta_button = ( '1' === $content['show_cta'] && '' !== $content['cta_label'] && '' !== $content['cta_url'] ); |
| 20 | |
| 21 | // SETTINGS: Margin. |
| 22 | $margin_top = ( '' !== $advanced['content_wrap_margin_top'] ) ? $advanced['content_wrap_margin_top'] . $advanced['content_wrap_margin_unit'] : '0'; |
| 23 | $margin_right = ( '' !== $advanced['content_wrap_margin_right'] ) ? $advanced['content_wrap_margin_right'] . $advanced['content_wrap_margin_unit'] : '0'; |
| 24 | $margin_bottom = ( '' !== $advanced['content_wrap_margin_bottom'] ) ? $advanced['content_wrap_margin_bottom'] . $advanced['content_wrap_margin_unit'] : '0'; |
| 25 | $margin_left = ( '' !== $advanced['content_wrap_margin_left'] ) ? $advanced['content_wrap_margin_left'] . $advanced['content_wrap_margin_unit'] : '0'; |
| 26 | |
| 27 | $margin = $margin_top . ' ' . $margin_right . ' ' . $margin_bottom . ' ' . $margin_left; |
| 28 | |
| 29 | $mobile_margin_top = ( '' !== $advanced['content_wrap_margin_top_mobile'] ) ? $advanced['content_wrap_margin_top_mobile'] . $advanced['content_wrap_margin_unit_mobile'] : $margin_top; |
| 30 | $mobile_margin_right = ( '' !== $advanced['content_wrap_margin_right_mobile'] ) ? $advanced['content_wrap_margin_right_mobile'] . $advanced['content_wrap_margin_unit_mobile'] : $margin_right; |
| 31 | $mobile_margin_bottom = ( '' !== $advanced['content_wrap_margin_bottom_mobile'] ) ? $advanced['content_wrap_margin_bottom_mobile'] . $advanced['content_wrap_margin_unit_mobile'] : $margin_bottom; |
| 32 | $mobile_margin_left = ( '' !== $advanced['content_wrap_margin_left_mobile'] ) ? $advanced['content_wrap_margin_left_mobile'] . $advanced['content_wrap_margin_unit_mobile'] : $margin_left; |
| 33 | |
| 34 | $mobile_margin = $mobile_margin_top . ' ' . $mobile_margin_right . ' ' . $mobile_margin_bottom . ' ' . $mobile_margin_left; |
| 35 | $mobile_margin = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $margin : $mobile_margin; |
| 36 | |
| 37 | // SETTINGS: Padding. |
| 38 | $padding_top = ( '' !== $advanced['content_wrap_padding_top'] ) ? $advanced['content_wrap_padding_top'] . $advanced['content_wrap_padding_unit'] : '0'; |
| 39 | $padding_right = ( '' !== $advanced['content_wrap_padding_right'] ) ? ( ! $is_rtl ) ? $advanced['content_wrap_padding_right'] . $advanced['content_wrap_padding_unit'] : $advanced['content_wrap_padding_left'] . $advanced['content_wrap_padding_unit'] : '0'; |
| 40 | $padding_bottom = ( '' !== $advanced['content_wrap_padding_bottom'] ) ? $advanced['content_wrap_padding_bottom'] . $advanced['content_wrap_padding_unit'] : '0'; |
| 41 | $padding_left = ( '' !== $advanced['content_wrap_padding_left'] ) ? ( ! $is_rtl ) ? $advanced['content_wrap_padding_left'] . $advanced['content_wrap_padding_unit'] : $advanced['content_wrap_padding_right'] . $advanced['content_wrap_padding_unit'] : '0'; |
| 42 | |
| 43 | $padding = $padding_top . ' ' . $padding_right . ' ' . $padding_bottom . ' ' . $padding_left; |
| 44 | |
| 45 | $mobile_padding_top = ( '' !== $advanced['content_wrap_padding_top_mobile'] ) ? $advanced['content_wrap_padding_top_mobile'] . $advanced['content_wrap_padding_unit_mobile'] : $padding_top; |
| 46 | $mobile_padding_right = ( '' !== $advanced['content_wrap_padding_right_mobile'] ) ? $advanced['content_wrap_padding_right_mobile'] . $advanced['content_wrap_padding_unit_mobile'] : $padding_right; |
| 47 | $mobile_padding_bottom = ( '' !== $advanced['content_wrap_padding_bottom_mobile'] ) ? $advanced['content_wrap_padding_bottom_mobile'] . $advanced['content_wrap_padding_unit_mobile'] : $padding_bottom; |
| 48 | $mobile_padding_left = ( '' !== $advanced['content_wrap_padding_left_mobile'] ) ? $advanced['content_wrap_padding_left_mobile'] . $advanced['content_wrap_padding_unit_mobile'] : $padding_left; |
| 49 | |
| 50 | $mobile_padding = $mobile_padding_top . ' ' . $mobile_padding_right . ' ' . $mobile_padding_bottom . ' ' . $mobile_padding_left; |
| 51 | $mobile_padding = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $padding : $mobile_padding; |
| 52 | |
| 53 | if ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) { |
| 54 | $mobile_padding_top = $padding_top; |
| 55 | $mobile_padding_right = $padding_right; |
| 56 | $mobile_padding_bottom = $padding_bottom; |
| 57 | $mobile_padding_left = $padding_left; |
| 58 | } |
| 59 | |
| 60 | // SETTINGS: Border. |
| 61 | $border_top = ( '' !== $advanced['content_wrap_border_top'] ) ? $advanced['content_wrap_border_top'] . $advanced['content_wrap_border_unit'] : '0'; |
| 62 | $border_right = ( '' !== $advanced['content_wrap_border_right'] ) ? $advanced['content_wrap_border_right'] . $advanced['content_wrap_border_unit'] : '0'; |
| 63 | $border_bottom = ( '' !== $advanced['content_wrap_border_bottom'] ) ? $advanced['content_wrap_border_bottom'] . $advanced['content_wrap_border_unit'] : '0'; |
| 64 | $border_left = ( '' !== $advanced['content_wrap_border_left'] ) ? $advanced['content_wrap_border_left'] . $advanced['content_wrap_border_unit'] : '0'; |
| 65 | |
| 66 | $border_width = ( ! $is_rtl ) ? $border_top . ' ' . $border_right . ' ' . $border_bottom . ' ' . $border_left : $border_top . ' ' . $border_left . ' ' . $border_bottom . ' ' . $border_right; |
| 67 | $border_style = $advanced['content_wrap_border_type']; |
| 68 | $border_color = $colors['content_wrap_border']; |
| 69 | |
| 70 | $mobile_border_top = ( '' !== $advanced['content_wrap_border_top_mobile'] ) ? $advanced['content_wrap_border_top_mobile'] . $advanced['content_wrap_border_unit_mobile'] : $border_top; |
| 71 | $mobile_border_right = ( '' !== $advanced['content_wrap_border_right_mobile'] ) ? $advanced['content_wrap_border_right_mobile'] . $advanced['content_wrap_border_unit_mobile'] : $border_right; |
| 72 | $mobile_border_bottom = ( '' !== $advanced['content_wrap_border_bottom_mobile'] ) ? $advanced['content_wrap_border_bottom_mobile'] . $advanced['content_wrap_border_unit_mobile'] : $border_bottom; |
| 73 | $mobile_border_left = ( '' !== $advanced['content_wrap_border_left_mobile'] ) ? $advanced['content_wrap_border_left_mobile'] . $advanced['content_wrap_border_unit_mobile'] : $border_left; |
| 74 | |
| 75 | $mobile_border_width = $mobile_border_top . ' ' . $mobile_border_right . ' ' . $mobile_border_bottom . ' ' . $mobile_border_left; |
| 76 | $mobile_border_width = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_width : $mobile_border_width; |
| 77 | $mobile_border_style = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_style : $advanced['content_wrap_border_type_mobile']; |
| 78 | |
| 79 | // SETTINGS: Border Radius. |
| 80 | $radius_topleft = ( '' !== $advanced['content_wrap_radius_top_left'] ) ? $advanced['content_wrap_radius_top_left'] . $advanced['content_wrap_radius_unit'] : '0'; |
| 81 | $radius_topright = ( '' !== $advanced['content_wrap_radius_top_right'] ) ? $advanced['content_wrap_radius_top_right'] . $advanced['content_wrap_radius_unit'] : '0'; |
| 82 | $radius_bottomright = ( '' !== $advanced['content_wrap_radius_bottom_right'] ) ? $advanced['content_wrap_radius_bottom_right'] . $advanced['content_wrap_radius_unit'] : '0'; |
| 83 | $radius_bottomleft = ( '' !== $advanced['content_wrap_radius_bottom_left'] ) ? $advanced['content_wrap_radius_bottom_left'] . $advanced['content_wrap_radius_unit'] : '0'; |
| 84 | |
| 85 | $border_radius = ( ! $is_rtl ) ? $radius_topleft . ' ' . $radius_topright . ' ' . $radius_bottomright . ' ' . $radius_bottomleft : $radius_topright . ' ' . $radius_topleft . ' ' . $radius_bottomleft . ' ' . $radius_bottomright; |
| 86 | |
| 87 | $mobile_radius_topleft = ( '' !== $advanced['content_wrap_radius_top_left_mobile'] ) ? $advanced['content_wrap_radius_top_left_mobile'] . $advanced['content_wrap_radius_unit_mobile'] : $radius_topleft; |
| 88 | $mobile_radius_topright = ( '' !== $advanced['content_wrap_radius_top_right_mobile'] ) ? $advanced['content_wrap_radius_top_right_mobile'] . $advanced['content_wrap_radius_unit_mobile'] : $radius_topright; |
| 89 | $mobile_radius_bottomright = ( '' !== $advanced['content_wrap_radius_bottom_right_mobile'] ) ? $advanced['content_wrap_radius_bottom_right_mobile'] . $advanced['content_wrap_radius_unit_mobile'] : $radius_bottomright; |
| 90 | $mobile_radius_bottomleft = ( '' !== $advanced['content_wrap_radius_bottom_left_mobile'] ) ? $advanced['content_wrap_radius_bottom_left_mobile'] . $advanced['content_wrap_radius_unit_mobile'] : $radius_bottomleft; |
| 91 | |
| 92 | $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; |
| 93 | |
| 94 | // SETTINGS: Box Shadow. |
| 95 | $shadow_offset_x = ( '' !== $advanced['content_wrap_drop_shadow_x'] ) ? $advanced['content_wrap_drop_shadow_x'] . $advanced['content_wrap_drop_shadow_unit'] : '0'; |
| 96 | $shadow_offset_y = ( '' !== $advanced['content_wrap_drop_shadow_y'] ) ? $advanced['content_wrap_drop_shadow_y'] . $advanced['content_wrap_drop_shadow_unit'] : '0'; |
| 97 | $shadow_blur = ( '' !== $advanced['content_wrap_drop_shadow_blur'] ) ? $advanced['content_wrap_drop_shadow_blur'] . $advanced['content_wrap_drop_shadow_unit'] : '0'; |
| 98 | $shadow_spread = ( '' !== $advanced['content_wrap_drop_shadow_spread'] ) ? $advanced['content_wrap_drop_shadow_spread'] . $advanced['content_wrap_drop_shadow_unit'] : '0'; |
| 99 | $shadow_color = $colors['content_wrap_drop_shadow']; |
| 100 | |
| 101 | $box_shadow = $shadow_offset_x . ' ' . $shadow_offset_y . ' ' . $shadow_blur . ' ' . $shadow_spread . ' ' . $shadow_color; |
| 102 | |
| 103 | $mobile_shadow_offset_x = ( '' !== $advanced['content_wrap_drop_shadow_x_mobile'] ) ? $advanced['content_wrap_drop_shadow_x_mobile'] . $advanced['content_wrap_drop_shadow_unit_mobile'] : $shadow_offset_x; |
| 104 | $mobile_shadow_offset_y = ( '' !== $advanced['content_wrap_drop_shadow_y_mobile'] ) ? $advanced['content_wrap_drop_shadow_y_mobile'] . $advanced['content_wrap_drop_shadow_unit_mobile'] : $shadow_offset_y; |
| 105 | $mobile_shadow_blur = ( '' !== $advanced['content_wrap_drop_shadow_blur_mobile'] ) ? $advanced['content_wrap_drop_shadow_blur_mobile'] . $advanced['content_wrap_drop_shadow_unit_mobile'] : $shadow_blur; |
| 106 | $mobile_shadow_spread = ( '' !== $advanced['content_wrap_drop_shadow_spread_mobile'] ) ? $advanced['content_wrap_drop_shadow_spread_mobile'] . $advanced['content_wrap_drop_shadow_unit_mobile'] : $shadow_spread; |
| 107 | |
| 108 | $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; |
| 109 | |
| 110 | // SETTINGS: Background. |
| 111 | $background_color = $colors['content_wrap_bg']; |
| 112 | |
| 113 | // ================================================== |
| 114 | // Check if is an opt-in layout. |
| 115 | if ( $has_title || $has_subtitle || $has_content || $has_cta_button ) { |
| 116 | |
| 117 | $style .= ' '; |
| 118 | |
| 119 | // Mobile styles. |
| 120 | $style .= ' '; |
| 121 | $style .= $prefix_mobile . $container . ' {'; |
| 122 | $style .= 'margin: ' . $mobile_margin . ';'; |
| 123 | $style .= 'padding: ' . $mobile_padding . ';'; |
| 124 | $style .= 'border-width: ' . $mobile_border_width . ';'; |
| 125 | $style .= 'border-style: ' . $mobile_border_style . ';'; |
| 126 | $style .= 'border-radius: ' . $mobile_border_radius . ';'; |
| 127 | $style .= ( ! $is_vanilla ) ? 'border-color: ' . $border_color . ';' : ''; |
| 128 | $style .= ( ! $is_vanilla ) ? 'background-color: ' . $background_color . ';' : ''; |
| 129 | $style .= ( ! $is_vanilla ) ? '-moz-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 130 | $style .= ( ! $is_vanilla ) ? '-webkit-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 131 | $style .= ( ! $is_vanilla ) ? 'box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 132 | $style .= '}'; |
| 133 | $style .= $prefix_mobile . $component . ' {'; |
| 134 | $style .= 'padding: ' . $mobile_padding_top . ' 0 ' . $mobile_padding_bottom . ' 0;'; |
| 135 | $style .= '}'; |
| 136 | |
| 137 | // Desktop styles. |
| 138 | if ( $is_mobile_enabled ) { |
| 139 | |
| 140 | $style .= $breakpoint . ' {'; |
| 141 | $style .= $prefix_desktop . $container . ' {'; |
| 142 | $style .= 'margin: ' . $margin . ';'; |
| 143 | $style .= 'padding: ' . $padding . ';'; |
| 144 | $style .= 'border-width: ' . $border_width . ';'; |
| 145 | $style .= 'border-style: ' . $border_style . ';'; |
| 146 | $style .= 'border-radius: ' . $border_radius . ';'; |
| 147 | $style .= ( ! $is_vanilla ) ? '-moz-box-shadow: ' . $box_shadow . ';' : ''; |
| 148 | $style .= ( ! $is_vanilla ) ? '-webkit-box-shadow: ' . $box_shadow . ';' : ''; |
| 149 | $style .= ( ! $is_vanilla ) ? 'box-shadow: ' . $box_shadow . ';' : ''; |
| 150 | $style .= '}'; |
| 151 | $style .= $prefix_desktop . $component . ' {'; |
| 152 | $style .= 'padding: ' . $padding_top . ' 0 ' . $padding_bottom . ' 0;'; |
| 153 | $style .= '}'; |
| 154 | $style .= '}'; |
| 155 | |
| 156 | } |
| 157 | } |
| 158 |