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-box.php

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

102 lines 3.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' => '242',
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_box']['column_1'] ) && ! empty( $data['image_box']['column_1'] ) ) {
26 $_data_column_1 = $data['image_box']['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 'rich_text' => '<p><span style="font-size: 18px;"><strong>This is a title</strong></span></p><p><span> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy.</span></p><p><span>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</span></p>',
34 'font_family' => YAYMAIL_DEFAULT_FAMILY,
35 'padding' => [
36 'top' => '10',
37 'right' => '50',
38 'bottom' => '10',
39 'left' => '10',
40 ],
41 ];
42
43 if ( is_array( $data['image_box']['column_2'] ) && ! empty( $data['image_box']['column_2'] ) ) {
44 $_data_column_2 = $data['image_box']['column_2'];
45 foreach ( $_data_column_2 as $key => $value ) {
46 $data_column_2[ $key ] = $value['value'];
47 }
48 }
49
50 $wrapper_style = TemplateHelpers::get_style(
51 [
52 'word-break' => 'break-word',
53 'background-color' => $data['background_color'],
54 ]
55 );
56
57 $column_1_style = TemplateHelpers::get_style(
58 [
59 'padding' => TemplateHelpers::get_spacing_value( isset( $data_column_1['padding'] ) ? $data_column_1['padding'] : [] ),
60 ]
61 );
62
63 $column_2_style = TemplateHelpers::get_style(
64 [
65 'padding' => TemplateHelpers::get_spacing_value( isset( $data_column_2['padding'] ) ? $data_column_2['padding'] : [] ),
66 ]
67 );
68
69
70 $text_style = TemplateHelpers::get_style(
71 [
72 'color' => $data['text_color'],
73 'text-align' => 'left',
74 'font-family' => TemplateHelpers::get_font_family_value( $data_column_2['font_family'] ),
75 ]
76 );
77
78 ob_start();
79 ?>
80 <table style="width: 100%;">
81 <tbody>
82 <tr>
83 <td class="yaymail-table-image-box-column" align="<?php echo esc_attr( $data_column_1['align'] ); ?>" width="50%" style="<?php echo esc_attr( $column_1_style ); ?>">
84 <div>
85 <a href="<?php echo esc_html( do_shortcode( $data_column_1['url'] ) ); ?>" target="_blank" rel="noreferrer">
86 <img alt="<?php echo esc_attr( $data_column_1['alt'] ?? '' ); ?>" src="<?php echo esc_html( $data_column_1['image'] ); ?>" style="width: <?php echo esc_attr( TemplateHelpers::get_dimension_value( $data_column_1['width'] ) ); ?>"/>
87 </a>
88 </div>
89 </td>
90 <td class="yaymail-table-image-box-column" width="50%" style="<?php echo esc_attr( $column_2_style ); ?>" >
91 <div style="<?php echo esc_attr( $text_style ); ?>">
92 <?php echo wp_kses_post( do_shortcode( $data_column_2['rich_text'] ) ); ?>
93 </div>
94 </td>
95 </tr>
96 </tbody>
97 </table>
98 <?php
99 $element_content = ob_get_clean();
100
101 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
102