| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
$sent_to_admin = ( isset( $sent_to_admin ) ? true : false ); |
| 5 |
$nextDayActive = date_i18n( wc_date_format(), get_post_meta( $subscription, 'payment_due_date', true ) ); |
| 6 |
$orderIds = get_post_meta( $subscription, 'order_ids', true ); |
| 7 |
$nextActivity = ywsbs_get_suspension_time() ? __( 'suspended', 'yith-woocommerce-subscription' ) : __( 'cancelled', 'yith-woocommerce-subscription' ); |
| 8 |
$next_activity_date = false != get_post_meta( $subscription, 'payment_due_date', true ) ? (int) get_post_meta( $subscription, 'payment_due_date', true ) + ywsbs_get_overdue_time() : 0; |
| 9 |
$subscriptionStatus = get_post_meta( $subscription, 'status', true ); |
| 10 |
$beforeText = esc_html__( 'Hi ', 'woocommerce' ) . esc_html( $order->data['billing']['first_name'] ) . wp_kses_post( ',<br><br>' ); |
| 11 |
$headerContent = ''; |
| 12 |
$headerContent = '<span style="color: inherit;font-size: 14px;" class="yaymail_subscription_header">'; |
| 13 |
$headerContent .= $beforeText; |
| 14 |
if ( 'ywsbs_customer_subscription_expired' == $this->template ) { |
| 15 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' has expired.', 'woocommerce' ); |
| 16 |
} |
| 17 |
if ( 'ywsbs_customer_subscription_before_expired' == $this->template ) { |
| 18 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' is going to expire.', 'woocommerce' ); |
| 19 |
} |
| 20 |
if ( 'ywsbs_customer_subscription_suspended' == $this->template ) { |
| 21 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' has been suspended.', 'woocommerce' ); |
| 22 |
} |
| 23 |
if ( 'ywsbs_customer_subscription_cancelled' == $this->template ) { |
| 24 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' has been cancelled.', 'woocommerce' ); |
| 25 |
} |
| 26 |
if ( 'ywsbs_customer_subscription_paused' == $this->template ) { |
| 27 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' has been paused.', 'woocommerce' ); |
| 28 |
} |
| 29 |
if ( 'ywsbs_customer_subscription_resumed' == $this->template ) { |
| 30 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' has been resumed.', 'woocommerce' ); |
| 31 |
} |
| 32 |
if ( 'ywsbs_customer_subscription_renew_reminder' == $this->template ) { |
| 33 |
$headerContent .= esc_html__( 'Subscription #', 'woocommerce' ) . $subscription . esc_html__( ' is going to renew on ', 'woocommerce' ) . $nextDayActive; |
| 34 |
} |
| 35 |
if ( 'ywsbs_customer_subscription_request_payment' == $this->template ) { |
| 36 |
$headerContent .= esc_html__( 'Your recent subscription renewal order on ', 'woocommerce' ) . wp_kses_post( get_option( 'blogname' ) ) . esc_html__( ' is late for payment.', 'woocommerce' ) . wp_kses_post( '<br>' ); |
| 37 |
// translators: 1. date of event, 2 is the subscription id, 3 next subscription status. |
| 38 |
$headerContent .= sprintf( wp_kses_post( __( 'If you do not pay it by <strong>%1$s</strong>, your subscription #%2$d will be <strong>%3$s</strong>.', 'yith-woocommerce-subscription' ) ), esc_html( date_i18n( wc_date_format(), $next_activity_date ) ), esc_html( $subscription ), esc_html( $nextActivity ) ); |
| 39 |
} |
| 40 |
if ( 'ywsbs_customer_subscription_payment_failed' == $this->template ) { |
| 41 |
$headerContent .= esc_html__( 'The payment to renew your subscription failed. Please, verify your available funds for the card specified during subscription and/or verify that your card is not expired.', 'woocommerce' ); |
| 42 |
} |
| 43 |
if ( 'ywsbs_customer_subscription_payment_done' == $this->template ) { |
| 44 |
if ( is_array( $orderIds ) && count( $orderIds ) > 1 ) { |
| 45 |
$headerContent .= esc_html__( 'Your subscription renewal order is now being processed. Your order details are shown below for your reference: ', 'woocommerce' ) . wp_kses_post( get_option( 'blogname' ) ); |
| 46 |
} else { |
| 47 |
$headerContent .= esc_html__( 'Your subscription order is now being processed. Your order details are shown below for your reference: ', 'woocommerce' ) . wp_kses_post( get_option( 'blogname' ) ); |
| 48 |
} |
| 49 |
} |
| 50 |
if ( 'ywsbs_subscription_admin_mail' == $this->template ) { |
| 51 |
// translators: placeholder 1 subscription id 2 new status. |
| 52 |
$headerContent .= sprintf( wp_kses_post( _x( 'The status of subscription #%1$d has changed to <strong>%2$s</strong>', 'placeholder 1 subscription id, 2 new status', 'yith-woocommerce-subscription' ) ), esc_html( $subscription ), esc_html( $subscriptionStatus ) ); |
| 53 |
} |
| 54 |
$headerContent .= '</span>'; |
| 55 |
echo wp_kses_post( $headerContent ); |
| 56 |
|
| 57 |
|