PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
yaymail / templates / elements / billing-shipping-address.php

billing-shipping-address.php in YayMail – WooCommerce Email Customizer 4.4.5, at templates/elements/billing-shipping-address.php

183 lines 9.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 use YayMail\Utils\TemplateHelpers;
5 use YayMail\Utils\Helpers;
6
7 if ( empty( $args['element'] ) ) {
8 return;
9 }
10
11 $element = $args['element'];
12 $data = $element['data'];
13
14 $shipping_content_format = [
15 'bold' => isset( $data['shipping_content_text_format']['bold'] ) ? filter_var( $data['shipping_content_text_format']['bold'], FILTER_VALIDATE_BOOLEAN ) : false,
16 'italic' => isset( $data['shipping_content_text_format']['italic'] ) ? filter_var( $data['shipping_content_text_format']['italic'], FILTER_VALIDATE_BOOLEAN ) : true,
17 'underline' => isset( $data['shipping_content_text_format']['underline'] ) ? filter_var( $data['shipping_content_text_format']['underline'], FILTER_VALIDATE_BOOLEAN ) : false,
18 ];
19
20 $billing_content_format = [
21 'bold' => isset( $data['billing_content_text_format']['bold'] ) ? filter_var( $data['billing_content_text_format']['bold'], FILTER_VALIDATE_BOOLEAN ) : false,
22 'italic' => isset( $data['billing_content_text_format']['italic'] ) ? filter_var( $data['billing_content_text_format']['italic'], FILTER_VALIDATE_BOOLEAN ) : true,
23 'underline' => isset( $data['billing_content_text_format']['underline'] ) ? filter_var( $data['billing_content_text_format']['underline'], FILTER_VALIDATE_BOOLEAN ) : false,
24 ];
25
26 $shipping_content_alignment = isset( $data['shipping_content_alignment'] ) ? $data['shipping_content_alignment'] : 'left';
27 $billing_content_alignment = isset( $data['billing_content_alignment'] ) ? $data['billing_content_alignment'] : 'left';
28
29 $billing_address_html = wp_kses_post( do_shortcode( '[yaymail_billing_address]' ) );
30 $shipping_address_html = wp_kses_post( do_shortcode( '[yaymail_shipping_address]' ) );
31 $width = ! empty( $billing_address_html ) & ! empty( $shipping_address_html ) ? '50%' : '100%';
32
33 if ( empty( $billing_address_html ) && empty( $shipping_address_html ) ) :
34 return '';
35 endif;
36
37 $wrapper_style = TemplateHelpers::get_style(
38 [
39 'word-break' => 'break-word',
40 'background-color' => $data['background_color'],
41 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
42 ]
43 );
44
45 $table_style = TemplateHelpers::get_style(
46 [
47 'width' => '100%',
48 'text-align' => yaymail_get_text_align(),
49 'border-collapse' => 'separate',
50 'border-spacing' => '5px',
51 ]
52 );
53
54 $column_style = TemplateHelpers::get_style(
55 [
56 'color' => isset( $data['text_color'] ) ? $data['text_color'] : 'inherit',
57 'padding' => '12px',
58 'font-family' => TemplateHelpers::get_font_family_value( isset( $data['font_family'] ) ? $data['font_family'] : 'inherit' ),
59 'border' => 'solid 1px ' . $data['border_color'],
60 ]
61 );
62
63 $title_style = TemplateHelpers::get_style(
64 [
65 'text-align' => yaymail_get_text_align(),
66 'color' => isset( $data['title_color'] ) ? $data['title_color'] : 'inherit',
67 'margin-top' => '0',
68 'font-family' => TemplateHelpers::get_font_family_value( isset( $data['font_family'] ) ? $data['font_family'] : 'inherit' ),
69 'margin-bottom' => '7px',
70 ]
71 );
72
73 $is_layout_type_modern = isset( $data['layout_type'] ) && 'modern' === $data['layout_type'];
74 $is_responsive_on_mobile = Helpers::is_true( $data['responsive_on_mobile'] ?? false );
75
76 ob_start();
77 ?>
78 <style>
79 /* Modern layout */
80 <?php if ( $is_layout_type_modern ) { ?>
81 .yaymail-element-<?php echo esc_attr( $element['id'] ); ?> .yaymail-billing-address-wrap,
82 .yaymail-element-<?php echo esc_attr( $element['id'] ); ?> .yaymail-shipping-address-wrap {
83 border: 0 !important;
84 padding-left: 0 !important;
85 padding-right: 0 !important;
86 }
87 <?php } ?>
88
89 /* Responsive layout: stack columns on smaller screens */
90 <?php if ( $is_responsive_on_mobile ) { ?>
91 @media only screen and (max-width: 400px) {
92 .yaymail-element-<?php echo esc_attr( $element['id'] ); ?> .yaymail-billing-address-column,
93 .yaymail-element-<?php echo esc_attr( $element['id'] ); ?> .yaymail-shipping-address-column {
94 display: block;
95 width: 100% !important;
96 margin-bottom: 10px;
97 }
98 }
99 <?php } ?>
100
101 .yaymail-element-<?php echo esc_attr( $element['id'] ); ?> .yaymail-shipping-address-wrap address {
102 font-weight: <?php echo esc_attr( $shipping_content_format['bold'] ?? false ? 'bold' : 'normal' ); ?> !important;
103 font-style: <?php echo esc_attr( $shipping_content_format['italic'] ?? false ? 'italic' : 'normal' ); ?> !important;
104 text-decoration: <?php echo esc_attr( $shipping_content_format['underline'] ?? false ? 'underline' : 'none' ); ?> !important;
105 font-size: <?php echo esc_attr( TemplateHelpers::get_dimension_value( $data['shipping_content_font_size'] ?? 14 ) ); ?> !important;
106 text-align: <?php echo esc_attr( $shipping_content_alignment ); ?> !important;
107 }
108
109 .yaymail-element-<?php echo esc_attr( $element['id'] ); ?> .yaymail-billing-address-wrap address {
110 font-weight: <?php echo esc_attr( $billing_content_format['bold'] ?? false ? 'bold' : 'normal' ); ?> !important;
111 font-style: <?php echo esc_attr( $billing_content_format['italic'] ?? false ? 'italic' : 'normal' ); ?> !important;
112 text-decoration: <?php echo esc_attr( $billing_content_format['underline'] ?? false ? 'underline' : 'none' ); ?> !important;
113 font-size: <?php echo esc_attr( TemplateHelpers::get_dimension_value( $data['billing_content_font_size'] ?? 14 ) ); ?> !important;
114 text-align: <?php echo esc_attr( $billing_content_alignment ); ?> !important;
115 }
116 </style>
117 <table class="yaymail-table-billing-shipping-address" cellpadding="0" cellspacing="0" border="0" style="<?php echo esc_attr( $table_style ); ?>"<?php echo $is_responsive_on_mobile ? ' data-responsive-type="true"' : ''; ?>>
118 <tbody>
119 <tr>
120 <?php if ( ! empty( $billing_address_html ) ) : ?>
121 <td class="yaymail-billing-address-column" style="width: <?php echo esc_attr( $width ); ?>; vertical-align: top;">
122 <table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-spacing: 0;">
123 <tbody>
124 <tr>
125 <td>
126 <div class="yaymail-billing-title" style="<?php echo esc_attr( $title_style ); ?>"><?php echo wp_kses_post( do_shortcode( $data['billing_title'] ) ); ?></div>
127 </td>
128 </tr>
129 <tr>
130 <td>
131 <table cellpadding="0" cellspacing="0" border="0" width="100%">
132 <tbody>
133 <tr>
134 <td class="yaymail-billing-address-wrap" style="<?php echo esc_attr( $column_style ); ?>">
135 <div>
136 <?php echo wp_kses_post( do_shortcode( '[yaymail_billing_address]' ) ); ?>
137 </div>
138 </td>
139 </tr>
140 </tbody>
141 </table>
142 </td>
143 </tr>
144 </tbody>
145 </table>
146 </td>
147 <?php endif; ?>
148 <?php if ( ! empty( $shipping_address_html ) ) : ?>
149 <td class="yaymail-shipping-address-column" style="width: <?php echo esc_attr( $width ); ?>; vertical-align: top;">
150 <table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-spacing: 0;">
151 <tbody>
152 <tr>
153 <td>
154 <div class="yaymail-shipping-title" style="<?php echo esc_attr( $title_style ); ?>"><?php echo wp_kses_post( do_shortcode( $data['shipping_title'] ) ); ?></div>
155 </td>
156 </tr>
157 <tr>
158 <td>
159 <table cellpadding="0" cellspacing="0" border="0" width="100%">
160 <tbody>
161 <tr>
162 <td class="yaymail-shipping-address-wrap" style="<?php echo esc_attr( $column_style ); ?>">
163 <div>
164 <?php echo wp_kses_post( do_shortcode( '[yaymail_shipping_address]' ) ); ?>
165 </div>
166 </td>
167 </tr>
168 </tbody>
169 </table>
170 </td>
171 </tr>
172 </tbody>
173 </table>
174 </td>
175 <?php endif; ?>
176 </tr>
177 </tbody>
178 </table>
179 <?php
180 $element_content = ob_get_clean();
181 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
182
183