PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.3
YayMail – WooCommerce Email Customizer v4.3.3
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 3.4.2 3.4.3 All 55 releases
yaymail / templates / elements / image-list.php

image-list.php in YayMail – WooCommerce Email Customizer 4.3.3, at templates/elements/image-list.php

169 lines 6.6 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 use YayMail\Utils\TemplateHelpers;
4
5 if ( empty( $args['element'] ) ) {
6 return;
7 }
8
9 $element = $args['element'];
10 $data = $element['data'];
11
12 $data_column_1 = [
13 'align' => 'center',
14 'width' => '100',
15 'url' => '#',
16 'image' => YAYMAIL_PLUGIN_URL . 'assets/images/woocommerce-logo.png',
17 'padding' => [
18 'top' => '10',
19 'right' => '10',
20 'bottom' => '10',
21 'left' => '50',
22 ],
23 ];
24
25 if ( is_array( $data['image_list']['column_1'] ) && ! empty( $data['image_list']['column_1'] ) ) {
26 $_data_column_1 = $data['image_list']['column_1'];
27 foreach ( $_data_column_1 as $key => $value ) {
28 $data_column_1[ $key ] = $value['value'];
29 }
30 }
31
32 $data_column_2 = [
33 'align' => 'center',
34 'width' => '100',
35 'url' => '#',
36 'image' => YAYMAIL_PLUGIN_URL . 'assets/images/woocommerce-logo.png',
37 'padding' => [
38 'top' => '10',
39 'right' => '30',
40 'bottom' => '10',
41 'left' => '30',
42 ],
43 ];
44
45 if ( is_array( $data['image_list']['column_2'] ) && ! empty( $data['image_list']['column_2'] ) ) {
46 $_data_column_2 = $data['image_list']['column_2'];
47 foreach ( $_data_column_2 as $key => $value ) {
48 $data_column_2[ $key ] = $value['value'];
49 }
50 }
51
52 $data_column_3 = [
53 'align' => 'center',
54 'width' => '100',
55 'url' => '#',
56 'image' => YAYMAIL_PLUGIN_URL . 'assets/images/woocommerce-logo.png',
57 'padding' => [
58 'top' => '10',
59 'right' => '50',
60 'bottom' => '10',
61 'left' => '10',
62 ],
63 ];
64
65 if ( is_array( $data['image_list']['column_3'] ) && ! empty( $data['image_list']['column_3'] ) ) {
66 $_data_column_3 = $data['image_list']['column_3'];
67 foreach ( $_data_column_3 as $key => $value ) {
68 $data_column_3[ $key ] = $value['value'];
69 }
70 }
71
72 $wrapper_style = TemplateHelpers::get_style(
73 [
74 'word-break' => 'break-word',
75 'background-color' => $data['background_color'],
76 ]
77 );
78
79 $column_1_style = TemplateHelpers::get_style(
80 [
81 'padding' => TemplateHelpers::get_spacing_value( isset( $data_column_1['padding'] ) ? $data_column_1['padding'] : [] ),
82 'text-align' => isset( $data_column_1['align'] ) ? $data_column_1['align'] : 'center',
83 'width' => '100%',
84 ]
85 );
86
87 $column_2_style = TemplateHelpers::get_style(
88 [
89 'padding' => TemplateHelpers::get_spacing_value( isset( $data_column_2['padding'] ) ? $data_column_2['padding'] : [] ),
90 'text-align' => isset( $data_column_2['align'] ) ? $data_column_2['align'] : 'center',
91 'width' => '100%',
92 ]
93 );
94
95 $column_3_style = TemplateHelpers::get_style(
96 [
97 'padding' => TemplateHelpers::get_spacing_value( isset( $data_column_3['padding'] ) ? $data_column_3['padding'] : [] ),
98 'text-align' => isset( $data_column_3['align'] ) ? $data_column_3['align'] : 'center',
99 'width' => '100%',
100 ]
101 );
102
103 $column_style = TemplateHelpers::get_style(
104 [
105 'width' => TemplateHelpers::get_dimension_value( 100 / $data['number_column'], '%' ),
106 'box-sizing' => 'border-box',
107 ]
108 );
109
110 ob_start();
111 ?>
112
113 <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100%; table-layout: fixed;">
114 <tbody>
115 <tr>
116 <!-- Column 1 -->
117 <td valign="top" style="<?php echo esc_attr( $column_style ); ?>">
118 <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100%; table-layout: fixed;">
119 <tbody>
120 <tr>
121 <td style="<?php echo esc_attr( $column_1_style ); ?>">
122 <a href="<?php echo esc_url( do_shortcode( $data_column_1['url'] ) ); ?>" target="_blank" rel="noreferrer" style="display: inline-block;">
123 <img alt="<?php echo esc_attr( $data_column_1['alt'] ?? '' ); ?>" src="<?php echo esc_url( $data_column_1['image'] ); ?>" style="width: <?php echo esc_attr( TemplateHelpers::get_dimension_value( $data_column_1['width'] ) ); ?>; display: block; max-width: 100%; height: auto;"/>
124 </a>
125 </td>
126 </tr>
127 </tbody>
128 </table>
129 </td>
130 <!-- Column 2 -->
131 <?php if ( 2 <= (int) $data['number_column'] ) : ?>
132 <td valign="top" style="<?php echo esc_attr( $column_style ); ?>">
133 <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100%; table-layout: fixed;">
134 <tbody>
135 <tr>
136 <td style="<?php echo esc_attr( $column_2_style ); ?>">
137 <a href="<?php echo esc_url( do_shortcode( $data_column_2['url'] ) ); ?>" target="_blank" rel="noreferrer" style="display: inline-block;">
138 <img alt="<?php echo esc_attr( $data_column_2['alt'] ?? '' ); ?>" src="<?php echo esc_url( $data_column_2['image'] ); ?>" style="width: <?php echo esc_attr( TemplateHelpers::get_dimension_value( $data_column_2['width'] ) ); ?>; display: block; max-width: 100%; height: auto;"/>
139 </a>
140 </td>
141 </tr>
142 </tbody>
143 </table>
144 </td>
145 <?php endif; ?>
146 <!-- Column 3 -->
147 <?php if ( 3 <= (int) $data['number_column'] ) : ?>
148 <td valign="top" style="<?php echo esc_attr( $column_style ); ?>">
149 <table width="100%" cellspacing="0" cellpadding="0" border="0" style="width: 100%; table-layout: fixed;">
150 <tbody>
151 <tr>
152 <td style="<?php echo esc_attr( $column_3_style ); ?>">
153 <a href="<?php echo esc_url( do_shortcode( $data_column_3['url'] ) ); ?>" target="_blank" rel="noreferrer" style="display: inline-block;">
154 <img alt="<?php echo esc_attr( $data_column_3['alt'] ?? '' ); ?>" src="<?php echo esc_url( $data_column_3['image'] ); ?>" style="width: <?php echo esc_attr( TemplateHelpers::get_dimension_value( $data_column_3['width'] ) ); ?>; display: block; max-width: 100%; height: auto;"/>
155 </a>
156 </td>
157 </tr>
158 </tbody>
159 </table>
160 </td>
161 <?php endif; ?>
162 </tr>
163 </tbody>
164 </table>
165 <?php
166 $element_content = ob_get_clean();
167
168 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
169