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
form-10--submit.php
217 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Form Submit. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | $component = '.hustle-form button.hustle-button-submit'; |
| 10 | |
| 11 | // Component States. |
| 12 | $state_default = $component; |
| 13 | $state_hover = $component . ':hover'; |
| 14 | $state_focus = $component . ':focus'; |
| 15 | |
| 16 | // SETTINGS: Background. |
| 17 | $background_default = $colors['optin_submit_button_static_bg']; |
| 18 | $background_hover = $colors['optin_submit_button_hover_bg']; |
| 19 | $background_focus = $colors['optin_submit_button_active_bg']; |
| 20 | |
| 21 | // SETTINGS: Padding. |
| 22 | $padding_top = ( '' !== $advanced['submit_button_padding_top'] ) ? $advanced['submit_button_padding_top'] . $advanced['submit_button_padding_unit'] : '0'; |
| 23 | $padding_right = ( '' !== $advanced['submit_button_padding_right'] ) ? $advanced['submit_button_padding_right'] . $advanced['submit_button_padding_unit'] : '0'; |
| 24 | $padding_bottom = ( '' !== $advanced['submit_button_padding_bottom'] ) ? $advanced['submit_button_padding_bottom'] . $advanced['submit_button_padding_unit'] : '0'; |
| 25 | $padding_left = ( '' !== $advanced['submit_button_padding_left'] ) ? $advanced['submit_button_padding_left'] . $advanced['submit_button_padding_unit'] : '0'; |
| 26 | |
| 27 | $padding = $padding_top . ' ' . $padding_right . ' ' . $padding_bottom . ' ' . $padding_left; |
| 28 | |
| 29 | $mobile_padding_top = ( '' !== $advanced['submit_button_padding_top_mobile'] ) ? $advanced['submit_button_padding_top_mobile'] . $advanced['submit_button_padding_unit_mobile'] : $padding_top; |
| 30 | $mobile_padding_right = ( '' !== $advanced['submit_button_padding_right_mobile'] ) ? $advanced['submit_button_padding_right_mobile'] . $advanced['submit_button_padding_unit_mobile'] : $padding_right; |
| 31 | $mobile_padding_bottom = ( '' !== $advanced['submit_button_padding_bottom_mobile'] ) ? $advanced['submit_button_padding_bottom_mobile'] . $advanced['submit_button_padding_unit_mobile'] : $padding_bottom; |
| 32 | $mobile_padding_left = ( '' !== $advanced['submit_button_padding_left_mobile'] ) ? $advanced['submit_button_padding_left_mobile'] . $advanced['submit_button_padding_unit_mobile'] : $padding_left; |
| 33 | |
| 34 | $mobile_padding = $mobile_padding_top . ' ' . $mobile_padding_right . ' ' . $mobile_padding_bottom . ' ' . $mobile_padding_left; |
| 35 | $mobile_padding = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $padding : $mobile_padding; |
| 36 | |
| 37 | // SETTINGS: Border. |
| 38 | $border_color_default = $colors['optin_submit_button_static_bo']; |
| 39 | $border_color_hover = $colors['optin_submit_button_hover_bo']; |
| 40 | $border_color_focus = $colors['optin_submit_button_active_bo']; |
| 41 | |
| 42 | $border_top = ( '' !== $advanced['submit_button_border_top'] ) ? $advanced['submit_button_border_top'] . $advanced['submit_button_border_unit'] : '0'; |
| 43 | $border_right = ( '' !== $advanced['submit_button_border_right'] ) ? $advanced['submit_button_border_right'] . $advanced['submit_button_border_unit'] : '0'; |
| 44 | $border_bottom = ( '' !== $advanced['submit_button_border_bottom'] ) ? $advanced['submit_button_border_bottom'] . $advanced['submit_button_border_unit'] : '0'; |
| 45 | $border_left = ( '' !== $advanced['submit_button_border_left'] ) ? $advanced['submit_button_border_left'] . $advanced['submit_button_border_unit'] : '0'; |
| 46 | |
| 47 | $border_width = $border_top . ' ' . $border_right . ' ' . $border_bottom . ' ' . $border_left; |
| 48 | $border_style = ( '' !== $advanced['submit_button_border_type'] ) ? $advanced['submit_button_border_type'] : 'solid'; |
| 49 | |
| 50 | $mobile_border_top = ( '' !== $advanced['submit_button_border_top_mobile'] ) ? $advanced['submit_button_border_top_mobile'] . $advanced['submit_button_border_unit_mobile'] : $border_top; |
| 51 | $mobile_border_right = ( '' !== $advanced['submit_button_border_right_mobile'] ) ? $advanced['submit_button_border_right_mobile'] . $advanced['submit_button_border_unit_mobile'] : $border_right; |
| 52 | $mobile_border_bottom = ( '' !== $advanced['submit_button_border_bottom_mobile'] ) ? $advanced['submit_button_border_bottom_mobile'] . $advanced['submit_button_border_unit_mobile'] : $border_bottom; |
| 53 | $mobile_border_left = ( '' !== $advanced['submit_button_border_left_mobile'] ) ? $advanced['submit_button_border_left_mobile'] . $advanced['submit_button_border_unit_mobile'] : $border_left; |
| 54 | |
| 55 | $mobile_border_width = $mobile_border_top . ' ' . $mobile_border_right . ' ' . $mobile_border_bottom . ' ' . $mobile_border_left; |
| 56 | $mobile_border_width = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_width : $mobile_border_width; |
| 57 | $mobile_border_style = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_style : $advanced['submit_button_border_type_mobile']; |
| 58 | |
| 59 | // SETTINGS: Border Radius. |
| 60 | $radius_topleft = ( '' !== $advanced['submit_button_radius_top_left'] ) ? $advanced['submit_button_radius_top_left'] . $advanced['submit_button_radius_unit'] : '0'; |
| 61 | $radius_topright = ( '' !== $advanced['submit_button_radius_top_right'] ) ? $advanced['submit_button_radius_top_right'] . $advanced['submit_button_radius_unit'] : '0'; |
| 62 | $radius_bottomright = ( '' !== $advanced['submit_button_radius_bottom_right'] ) ? $advanced['submit_button_radius_bottom_right'] . $advanced['submit_button_radius_unit'] : '0'; |
| 63 | $radius_bottomleft = ( '' !== $advanced['submit_button_radius_bottom_left'] ) ? $advanced['submit_button_radius_bottom_left'] . $advanced['submit_button_radius_unit'] : '0'; |
| 64 | |
| 65 | $border_radius = ( ! $is_rtl ) ? $radius_topleft . ' ' . $radius_topright . ' ' . $radius_bottomright . ' ' . $radius_bottomleft : $radius_topright . ' ' . $radius_topleft . ' ' . $radius_bottomleft . ' ' . $radius_bottomright; |
| 66 | |
| 67 | $mobile_radius_topleft = ( '' !== $advanced['submit_button_radius_top_left_mobile'] ) ? $advanced['submit_button_radius_top_left_mobile'] . $advanced['submit_button_radius_unit_mobile'] : $radius_topleft; |
| 68 | $mobile_radius_topright = ( '' !== $advanced['submit_button_radius_top_right_mobile'] ) ? $advanced['submit_button_radius_top_right_mobile'] . $advanced['submit_button_radius_unit_mobile'] : $radius_topright; |
| 69 | $mobile_radius_bottomright = ( '' !== $advanced['submit_button_radius_bottom_right_mobile'] ) ? $advanced['submit_button_radius_bottom_right_mobile'] . $advanced['submit_button_radius_unit_mobile'] : $radius_bottomright; |
| 70 | $mobile_radius_bottomleft = ( '' !== $advanced['submit_button_radius_bottom_left_mobile'] ) ? $advanced['submit_button_radius_bottom_left_mobile'] . $advanced['submit_button_radius_unit_mobile'] : $radius_bottomleft; |
| 71 | |
| 72 | $mobile_border_radius = $mobile_radius_topleft . ' ' . $mobile_radius_topright . ' ' . $mobile_radius_bottomright . ' ' . $mobile_radius_bottomleft; |
| 73 | $mobile_border_radius = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $border_radius : $mobile_border_radius; |
| 74 | |
| 75 | // SETTINGS: Box Shadow. |
| 76 | $shadow_offset_x = ( '' !== $advanced['submit_button_drop_shadow_x'] ) ? $advanced['submit_button_drop_shadow_x'] . $advanced['submit_button_drop_shadow_unit'] : '0'; |
| 77 | $shadow_offset_y = ( '' !== $advanced['submit_button_drop_shadow_y'] ) ? $advanced['submit_button_drop_shadow_y'] . $advanced['submit_button_drop_shadow_unit'] : '0'; |
| 78 | $shadow_blur = ( '' !== $advanced['submit_button_drop_shadow_blur'] ) ? $advanced['submit_button_drop_shadow_blur'] . $advanced['submit_button_drop_shadow_unit'] : '0'; |
| 79 | $shadow_spread = ( '' !== $advanced['submit_button_drop_shadow_spread'] ) ? $advanced['submit_button_drop_shadow_spread'] . $advanced['submit_button_drop_shadow_unit'] : '0'; |
| 80 | $shadow_color = $colors['submit_button_static_drop_shadow']; |
| 81 | |
| 82 | $box_shadow = $shadow_offset_x . ' ' . $shadow_offset_y . ' ' . $shadow_blur . ' ' . $shadow_spread . ' ' . $shadow_color; |
| 83 | |
| 84 | $mobile_shadow_offset_x = ( '' !== $advanced['submit_button_drop_shadow_x'] ) ? $advanced['submit_button_drop_shadow_x'] . $advanced['submit_button_drop_shadow_unit'] : $shadow_offset_x; |
| 85 | $mobile_shadow_offset_y = ( '' !== $advanced['submit_button_drop_shadow_y'] ) ? $advanced['submit_button_drop_shadow_y'] . $advanced['submit_button_drop_shadow_unit'] : $shadow_offset_y; |
| 86 | $mobile_shadow_blur = ( '' !== $advanced['submit_button_drop_shadow_blur'] ) ? $advanced['submit_button_drop_shadow_blur'] . $advanced['submit_button_drop_shadow_unit'] : $shadow_blur; |
| 87 | $mobile_shadow_spread = ( '' !== $advanced['submit_button_drop_shadow_spread'] ) ? $advanced['submit_button_drop_shadow_spread'] . $advanced['submit_button_drop_shadow_unit'] : $shadow_spread; |
| 88 | |
| 89 | $mobile_box_shadow = $mobile_shadow_offset_x . ' ' . $mobile_shadow_offset_y . ' ' . $mobile_shadow_blur . ' ' . $mobile_shadow_spread . ' ' . $shadow_color; |
| 90 | $mobile_box_shadow = ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_advanced ) ) ? $box_shadow : $mobile_box_shadow; |
| 91 | |
| 92 | // SETTINGS: Font settings. |
| 93 | $color_default = $colors['optin_submit_button_static_color']; |
| 94 | $color_hover = $colors['optin_submit_button_hover_color']; |
| 95 | $color_focus = $colors['optin_submit_button_active_color']; |
| 96 | |
| 97 | $font_family = $typography['submit_button_font_family']; |
| 98 | $font_size = $typography['submit_button_font_size'] . $typography['submit_button_font_size_unit']; |
| 99 | $font_weight = $typography['submit_button_font_weight']; |
| 100 | $font_style = 'normal'; |
| 101 | $line_height = $typography['submit_button_line_height'] . $typography['submit_button_line_height_unit']; |
| 102 | $letter_spacing = $typography['submit_button_letter_spacing'] . $typography['submit_button_letter_spacing_unit']; |
| 103 | $text_transform = $typography['submit_button_text_transform']; |
| 104 | $text_decoration = $typography['submit_button_text_decoration']; |
| 105 | |
| 106 | if ( 'custom' === $font_family ) { |
| 107 | $font_family = ( '' !== $typography['submit_button_custom_font_family'] ) ? $typography['submit_button_custom_font_family'] : 'inherit'; |
| 108 | } |
| 109 | |
| 110 | if ( 'regular' === $font_weight ) { |
| 111 | $font_weight = 'normal'; |
| 112 | } elseif ( 'italic' === $font_weight ) { |
| 113 | $font_weight = 'normal'; |
| 114 | $font_style = 'italic'; |
| 115 | } elseif ( preg_match( '/(italic)/', $font_weight ) ) { // Check if font weight is italic. |
| 116 | $font_weight = str_replace( 'italic', '', $font_weight ); |
| 117 | $font_style = 'italic'; |
| 118 | } |
| 119 | |
| 120 | $mobile_font_size = ( '' !== $typography['submit_button_font_size_mobile'] ) ? $typography['submit_button_font_size_mobile'] . $typography['submit_button_font_size_unit_mobile'] : $font_size; |
| 121 | $mobile_font_weight = $typography['submit_button_font_weight_mobile']; |
| 122 | $mobile_font_style = 'normal'; |
| 123 | $mobile_line_height = ( '' !== $typography['submit_button_line_height_mobile'] ) ? $typography['submit_button_line_height_mobile'] . $typography['submit_button_line_height_unit_mobile'] : $line_height; |
| 124 | $mobile_letter_spacing = ( '' !== $typography['submit_button_letter_spacing_mobile'] ) ? $typography['submit_button_letter_spacing_mobile'] . $typography['submit_button_letter_spacing_unit_mobile'] : $letter_spacing; |
| 125 | $mobile_text_transform = $typography['submit_button_text_transform']; |
| 126 | $mobile_text_decoration = $typography['submit_button_text_decoration_mobile']; |
| 127 | |
| 128 | if ( 'regular' === $mobile_font_weight ) { |
| 129 | $mobile_font_weight = 'normal'; |
| 130 | } elseif ( 'italic' === $font_weight ) { |
| 131 | $font_weight = 'normal'; |
| 132 | $font_style = 'italic'; |
| 133 | } elseif ( preg_match( '/(italic)/', $mobile_font_weight ) ) { // Check if font weight is italic. |
| 134 | $mobile_font_weight = str_replace( 'italic', '', $mobile_font_weight ); |
| 135 | $mobile_font_style = 'italic'; |
| 136 | } |
| 137 | |
| 138 | if ( ! $is_mobile_enabled || ( $is_mobile_enabled && $default_typography ) ) { |
| 139 | $mobile_font_size = $font_size; |
| 140 | $mobile_font_weight = $font_weight; |
| 141 | $mobile_font_style = $font_style; |
| 142 | $mobile_line_height = $line_height; |
| 143 | $mobile_letter_spacing = $letter_spacing; |
| 144 | $mobile_text_transform = $text_transform; |
| 145 | $mobile_text_decoration = $text_decoration; |
| 146 | } |
| 147 | |
| 148 | // ================================================== |
| 149 | // Check if "Call to Action" button is enabled. |
| 150 | if ( $is_optin ) { |
| 151 | |
| 152 | $style .= ' '; |
| 153 | |
| 154 | // Mobile styles. |
| 155 | $style .= $prefix_mobile . $state_default . ' {'; |
| 156 | $style .= 'padding: ' . $mobile_padding . ';'; |
| 157 | $style .= 'border-width: ' . $mobile_border_width . ';'; |
| 158 | $style .= 'border-style: ' . $mobile_border_style . ';'; |
| 159 | $style .= ( ! $is_vanilla ) ? 'border-color: ' . $border_color_default . ';' : ''; |
| 160 | $style .= 'border-radius: ' . $mobile_border_radius . ';'; |
| 161 | $style .= ( ! $is_vanilla ) ? 'background-color: ' . $background_default . ';' : ''; |
| 162 | $style .= ( ! $is_vanilla ) ? '-moz-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 163 | $style .= ( ! $is_vanilla ) ? '-webkit-box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 164 | $style .= ( ! $is_vanilla ) ? 'box-shadow: ' . $mobile_box_shadow . ';' : ''; |
| 165 | $style .= ( ! $is_vanilla ) ? 'color: ' . $color_default . ';' : ''; |
| 166 | $style .= ( 'inherit' !== $font_family ) ? 'font: ' . $mobile_font_weight . ' ' . $mobile_font_size . '/' . $mobile_line_height . ' ' . $font_family . ';' : ''; |
| 167 | $style .= ( 'inherit' === $font_family ) ? 'font-size: ' . $mobile_font_size . ';' : ''; |
| 168 | $style .= ( 'inherit' === $font_family ) ? 'line-height: ' . $mobile_line_height . ';' : ''; |
| 169 | $style .= ( 'inherit' === $font_family ) ? 'font-weight: ' . $mobile_font_weight . ';' : ''; |
| 170 | $style .= 'font-style: ' . $mobile_font_style . ';'; |
| 171 | $style .= 'letter-spacing: ' . $mobile_letter_spacing . ';'; |
| 172 | $style .= 'text-transform: ' . $mobile_text_transform . ';'; |
| 173 | $style .= 'text-decoration: ' . $mobile_text_decoration . ';'; |
| 174 | $style .= '}'; |
| 175 | |
| 176 | if ( ! $is_vanilla ) { |
| 177 | |
| 178 | $style .= $prefix_mobile . $state_hover . ' {'; |
| 179 | $style .= 'border-color: ' . $border_color_hover . ';'; |
| 180 | $style .= 'background-color: ' . $background_hover . ';'; |
| 181 | $style .= 'color: ' . $color_hover . ';'; |
| 182 | $style .= '}'; |
| 183 | |
| 184 | $style .= $prefix_mobile . $state_focus . ' {'; |
| 185 | $style .= 'border-color: ' . $border_color_focus . ';'; |
| 186 | $style .= 'background-color: ' . $background_focus . ';'; |
| 187 | $style .= 'color: ' . $color_focus . ';'; |
| 188 | $style .= '}'; |
| 189 | |
| 190 | } |
| 191 | |
| 192 | // Desktop styles. |
| 193 | if ( $is_mobile_enabled ) { |
| 194 | |
| 195 | $style .= $breakpoint . ' {'; |
| 196 | $style .= $prefix_desktop . $state_default . ' {'; |
| 197 | $style .= 'padding: ' . $padding . ';'; |
| 198 | $style .= 'border-width: ' . $border_width . ';'; |
| 199 | $style .= 'border-style: ' . $border_style . ';'; |
| 200 | $style .= 'border-radius: ' . $border_radius . ';'; |
| 201 | $style .= 'box-shadow: ' . $box_shadow . ';'; |
| 202 | $style .= '-moz-box-shadow: ' . $box_shadow . ';'; |
| 203 | $style .= '-webkit-box-shadow: ' . $box_shadow . ';'; |
| 204 | $style .= ( 'inherit' !== $font_family ) ? 'font: ' . $font_weight . ' ' . $font_size . '/' . $line_height . ' ' . $font_family . ';' : ''; |
| 205 | $style .= ( 'inherit' === $font_family ) ? 'font-size: ' . $font_size . ';' : ''; |
| 206 | $style .= ( 'inherit' === $font_family ) ? 'line-height: ' . $line_height . ';' : ''; |
| 207 | $style .= ( 'inherit' === $font_family ) ? 'font-weight: ' . $font_weight . ';' : ''; |
| 208 | $style .= 'font-style: ' . $font_style . ';'; |
| 209 | $style .= 'letter-spacing: ' . $letter_spacing . ';'; |
| 210 | $style .= 'text-transform: ' . $text_transform . ';'; |
| 211 | $style .= 'text-decoration: ' . $text_decoration . ';'; |
| 212 | $style .= '}'; |
| 213 | $style .= '}'; |
| 214 | |
| 215 | } |
| 216 | } |
| 217 |