/var/www/html_fr/wp-content/plugins/yaymail/templates/elements/button.php


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
<?php
defined
'ABSPATH' ) || exit;
use 
YayMail\Utils\TemplateHelpers;

/**
 * $args includes
 * $element
 * $render_data
 * $is_nested
 */
if ( empty( $args['element'] ) ) {
    return;
}

$element $args['element'];
$data    $element['data'];

$wrapper_style TemplateHelpers::get_style(
    [
        
'width'            => '100%',
        
'text-align'       => 'center',
        
'background-color' => $data['background_color'],
    ]
);

$margin_value        = isset( $data['margin'] ) && 'center' === $data['margin'] ? '0 auto' 'auto';
$float_value         in_array$data['align'], [ 'left''right' ], true ) ? $data['align'] : 'unset';
$button_holder_style TemplateHelpers::get_style(
    [
        
'width'          => $data['width'] . '%',
        
'min-width'      => $data['width'] . '%',
        
'margin'         => $margin_value,
        
'padding'        => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
        
'float'          => $float_value,
        
'border-spacing' => '0',
    
// Make sure this will work when inject css not working
    
]
);


$border_radius $data['border_radius'];
$link_style    TemplateHelpers::get_style(
    [
        
'text-decoration'  => 'none',
        
'padding'          => '12px 20px',
        
'display'          => 'block',
        
'box-sizing'       => 'border-box',
        
'border-radius'    => TemplateHelpers::get_border_radius_value$border_radius'px' ),
        
'font-size'        => "{$data['font_size']}px",
        
'font-weight'      => $data['weight'],
        
'background-color' => $data['button_background_color'],
        
'word-break'       => 'break-word',
    ]
);

$text_style TemplateHelpers::get_style(
    [
        
'font-family' => TemplateHelpers::get_font_family_value$data['font_family'] ),
        
'line-height' => "{$data['height']}px",
        
'color'       => $data['text_color'],
    ]
);

ob_start();
?>

    <table style="<?php echo esc_attr$button_holder_style ); ?>">
        <tbody>
            <tr>
                <td style="padding: 0;">
                    <a
                        href="<?php echo esc_urldo_shortcode$data['url'] ) ); ?>"
                        style="<?php echo esc_attr$link_style ); ?>"
                        target="_blank"
                        rel="noreferrer"
                    >
                        <span style="<?php echo esc_attr$text_style ); ?>"><?php yaymail_kses_post_edo_shortcode$data['text'] ) ); ?></span>
                    </a>
                </td>
            </tr>
        </tbody>
    </table>

<?php
$element_content 
ob_get_clean();
TemplateHelpers::wrap_element_content$element_content$element$wrapper_style );