PluginProbe
YayMail – WooCommerce Email Customizer / 1.9.6
YayMail – WooCommerce Email Customizer v1.9.6
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 / views / templates / single-mail-template.php

single-mail-template.php in YayMail – WooCommerce Email Customizer 1.9.6, at views/templates/single-mail-template.php

49 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 use YayMail\Page\Source\CustomPostType;
8
9 $template = $args['email']->id;
10 $custom_shortcode = new YayMail\MailBuilder\Shortcodes( $template );
11
12 if ( CustomPostType::postIDByTemplate( $template ) ) {
13 $postID = CustomPostType::postIDByTemplate( $template );
14 $html = get_post_meta( $postID, '_yaymail_html', true );
15 } else {
16 $html = '';
17 }
18 if ( isset( $args['email'] ) && isset( $args['email']->id ) && ! empty( $args['email']->id ) && isset( $args['order'] ) && $args['order']->get_id() ) {
19 $custom_shortcode->setOrderId( $args['order']->get_id(), $args['sent_to_admin'] );
20 if ( isset( $args['sent_to_admin'] ) ) {
21 $custom_shortcode->shortCodesOrderDefined( $args['sent_to_admin'] );
22 } else {
23 $custom_shortcode->shortCodesOrderDefined();
24 }
25 $html = do_shortcode( $html );
26 } elseif ( isset( $args['email'] ) && isset( $args['email']->id ) ) {
27 if ( 'customer_new_account' === $args['email']->id || 'customer_new_account_activation' === $args['email']->id || 'customer_reset_password' === $args['email']->id ) {
28 $custom_shortcode->setOrderId( 0, $args['sent_to_admin'] );
29 $custom_shortcode->shortCodesOrderDefined( $args['sent_to_admin'], $args );
30 $html = do_shortcode( $html );
31 }
32 if ( 'cancelled_subscription' === $args['email']->id || 'expired_subscription' === $args['email']->id || 'suspended_subscription' === $args['email']->id ) {
33 $custom_shortcode->setOrderId( $args['subscription']->data['parent_id'], $args['sent_to_admin'] );
34 $custom_shortcode->shortCodesOrderDefined( $args['sent_to_admin'], $args );
35 $html = do_shortcode( $html );
36 }
37 if ( 'ywsbs_subscription_admin_mail' === $args['email']->id || 'ywsbs_customer_subscription_cancelled' === $args['email']->id || 'ywsbs_customer_subscription_suspended' === $args['email']->id || 'ywsbs_customer_subscription_expired' === $args['email']->id || 'ywsbs_customer_subscription_before_expired' === $args['email']->id || 'ywsbs_customer_subscription_paused' === $args['email']->id || 'ywsbs_customer_subscription_resumed' === $args['email']->id || 'ywsbs_customer_subscription_request_payment' === $args['email']->id || 'ywsbs_customer_subscription_renew_reminder' === $args['email']->id || 'ywsbs_customer_subscription_payment_done' === $args['email']->id || 'ywsbs_customer_subscription_payment_failed' === $args['email']->id ) {
38 $custom_shortcode->setOrderId( $args['subscription']->order->id, $args['sent_to_admin'] );
39 $custom_shortcode->shortCodesOrderDefined( $args['sent_to_admin'], $args );
40 $html = do_shortcode( $html );
41 }
42 }
43
44 // Replace shortcode cannot do_shortcode
45 $reg = '/\[yaymail.*?\]/m';
46 $html = preg_replace( $reg, '', $html );
47
48 echo html_entity_decode( $html, ENT_QUOTES, 'UTF-8' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
49