PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.1
YayMail – WooCommerce Email Customizer v4.4.1
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 / social-icon.php

social-icon.php in YayMail – WooCommerce Email Customizer 4.4.1, at templates/elements/social-icon.php

99 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 use YayMail\Utils\TemplateHelpers;
6
7 if ( empty( $args['element'] ) ) {
8 return;
9 }
10
11 $element = $args['element'];
12 $data = $element['data'];
13
14 if ( empty( $data['icon_list'] ) ) {
15 return;
16 }
17
18 $direction_rtl = yaymail_get_email_direction();
19
20 $wrapper_style = TemplateHelpers::get_style(
21 [
22 'word-break' => 'break-word',
23 'background-color' => $data['background_color'],
24 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
25 ]
26 );
27
28 $theme = [
29 'Colorful' => 'colorful',
30 'LineDark' => 'line-dark',
31 'LineLight' => 'line-light',
32 'SolidDark' => 'solid-dark',
33 'SolidLight' => 'solid-light',
34 ];
35
36 // Handle table alignment
37 $table_margin = '0 auto';
38 if ( isset( $data['align'] ) ) {
39 switch ( $data['align'] ) {
40 case 'center':
41 $table_margin = '0 auto';
42 break;
43 case 'right':
44 $table_margin = '0 0 0 auto';
45 break;
46 case 'left':
47 default:
48 $table_margin = '0';
49 break;
50 }
51 }
52
53 $item_style = TemplateHelpers::get_style(
54 [
55 'display' => 'inline-block',
56 'vertical-align' => 'top',
57 'text-align' => 'center',
58 'margin' => '5px 0',
59 'padding-left' => TemplateHelpers::get_dimension_value( max( ( $data['spacing'] ?? 0 ) - 5, 0 ) / 2 ),
60 'padding-right' => TemplateHelpers::get_dimension_value( max( ( $data['spacing'] ?? 0 ) - 5, 0 ) / 2 ),
61 'padding-top' => 0,
62 'padding-bottom' => 0,
63 ]
64 );
65
66 $a_style = TemplateHelpers::get_style(
67 [
68 'display' => 'inline-block',
69 'border' => 'none',
70 'text-decoration' => 'none',
71 ]
72 );
73
74 ob_start();
75 ?>
76 <table class="yaymail-customizer-element-social" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse: collapse; margin: <?php echo esc_attr( $table_margin ); ?>; width: 100%;">
77 <tr>
78 <td style="text-align: <?php echo esc_attr( $data['align'] ?? 'center' ); ?>;">
79 <?php foreach ( $data['icon_list'] as $key => $el ) : ?>
80 <?php
81 $img_url = YAYMAIL_PLUGIN_URL . 'assets/images/social-icons/' . $el['icon'] . '/' . $theme[ $data['theme'] ] . '.png';
82 $first_index = ( 'rtl' === $direction_rtl ) ? count( $data['icon_list'] ) - 1 : 0;
83 $spacing = ( $first_index === $key ) ? '0px' : $data['spacing'] . 'px';
84 $text_align = isset( $data['align'] ) ? $data['align'] : 'center';
85 ?>
86 <span class="yaymail-social-icon-item" style="<?php echo esc_attr( $item_style ); ?>">
87 <a href="<?php echo esc_attr( do_shortcode( $el['url'] ) ); ?>" target="_blank" style="<?php echo esc_attr( $a_style ); ?>">
88 <img border="0" tabindex="0" src="<?php echo esc_attr( $img_url ); ?>" height="<?php echo esc_attr( $data['width_icon'] ); ?>" width="<?php echo esc_attr( $data['width_icon'] ); ?>" style="display: block; border: 0; margin: 0; padding: 0; outline: none;" />
89 </a>
90 </span>
91 <?php endforeach; ?>
92 </td>
93 </tr>
94 </table>
95 <?php
96 $element_content = ob_get_clean();
97
98 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
99