1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
<?php defined( 'ABSPATH' ) || exit;
use YayMail\Utils\TemplateHelpers;
if ( empty( $args['element'] ) ) { return; }
$element = $args['element']; $data = $element['data'];
$billing_address_html = wp_kses_post( do_shortcode( '[yaymail_billing_address]' ) ); $shipping_address_html = wp_kses_post( do_shortcode( '[yaymail_shipping_address]' ) ); $width = ! empty( $billing_address_html ) & ! empty( $shipping_address_html ) ? '50%' : '100%';
if ( empty( $billing_address_html ) && empty( $shipping_address_html ) ) : return ''; endif;
$wrapper_style = TemplateHelpers::get_style( [ 'word-break' => 'break-word', 'background-color' => $data['background_color'], 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ), ] );
$table_style = TemplateHelpers::get_style( [ 'width' => '100%', 'text-align' => yaymail_get_text_align(), 'border-collapse' => 'separate', 'border-spacing' => '5px', ] );
$column_style = TemplateHelpers::get_style( [ 'color' => isset( $data['text_color'] ) ? $data['text_color'] : 'inherit', 'padding' => '12px', 'font-size' => '14px', 'font-family' => TemplateHelpers::get_font_family_value( isset( $data['font_family'] ) ? $data['font_family'] : 'inherit' ), 'border' => 'solid 1px ' . $data['border_color'], ] );
$title_style = TemplateHelpers::get_style( [ 'text-align' => yaymail_get_text_align(), 'color' => isset( $data['title_color'] ) ? $data['title_color'] : 'inherit', 'margin-top' => '0', 'font-family' => TemplateHelpers::get_font_family_value( isset( $data['font_family'] ) ? $data['font_family'] : 'inherit' ), 'margin-bottom' => '7px', ] );
ob_start(); ?> <table class="yaymail-table-billing-shipping-address" cellpadding="0" cellspacing="0" border="0" style="<?php echo esc_attr( $table_style ); ?>"> <tbody> <tr> <?php if ( ! empty( $billing_address_html ) ) : ?> <td style="width: <?php echo esc_attr( $width ); ?>; vertical-align: top;"> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-spacing: 0;"> <tbody> <tr> <td> <div class="yaymail-billing-title" style="<?php echo esc_attr( $title_style ); ?>"><?php echo wp_kses_post( do_shortcode( $data['billing_title'] ) ); ?></div> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tbody> <tr> <td class="yaymail-billing-address-wrap" style="<?php echo esc_attr( $column_style ); ?>"> <div> <?php echo wp_kses_post( do_shortcode( '[yaymail_billing_address]' ) ); ?> </div> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> <?php endif; ?> <?php if ( ! empty( $shipping_address_html ) ) : ?> <td style="width: <?php echo esc_attr( $width ); ?>; vertical-align: top;"> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-spacing: 0;"> <tbody> <tr> <td> <div class="yaymail-shipping-title" style="<?php echo esc_attr( $title_style ); ?>"><?php echo wp_kses_post( do_shortcode( $data['shipping_title'] ) ); ?></div> </td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tbody> <tr> <td class="yaymail-shipping-address-wrap" style="<?php echo esc_attr( $column_style ); ?>"> <div> <?php echo wp_kses_post( do_shortcode( '[yaymail_shipping_address]' ) ); ?> </div> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> <?php endif; ?> </tr> </tbody> </table> <?php $element_content = ob_get_clean(); TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
|