<?php

/**
 * Customer Trial Converted email (plain text)
 *
 * @package ArraySubs\Features\Emails\templates\plain
 * @version 1.0.0
 */

defined('ABSPATH') || exit;

echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
echo esc_html(wp_strip_all_tags($arraysubs_email_heading));
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";

printf(
    /* translators: %s: Customer first name */
    esc_html__('Hi %s,', 'arraysubs'),
    esc_html($arraysubs_customer['first_name'])
);
echo "\n\n";

printf(
    /* translators: %s: Product name */
    esc_html__('Great news! Your free trial for %s has ended and your subscription has been successfully converted to a paid subscription.', 'arraysubs'),
    esc_html($arraysubs_product ? $arraysubs_product->get_name() : __('N/A', 'arraysubs'))
);
echo "\n\n";

echo "----------\n";
echo esc_html__('SUBSCRIPTION DETAILS', 'arraysubs') . "\n";
echo "----------\n\n";

echo esc_html__('Subscription ID: ', 'arraysubs') . '#' . esc_html($arraysubs_subscription_id) . "\n";
echo esc_html__('Product: ', 'arraysubs') . esc_html($arraysubs_product ? $arraysubs_product->get_name() : __('N/A', 'arraysubs')) . "\n";
echo esc_html__('Status: ', 'arraysubs') . esc_html__('Active', 'arraysubs') . "\n";

if (!empty($arraysubs_subscription_price)) {
    echo esc_html__('Subscription Price: ', 'arraysubs') . esc_html(wp_strip_all_tags(wc_price($arraysubs_subscription_price))) . "\n";
}

if (!empty($arraysubs_next_payment_date)) {
    echo esc_html__('Next Payment Date: ', 'arraysubs') . esc_html(\arraysubs_format_date_local($arraysubs_next_payment_date)) . "\n";
}

echo "\n";
echo esc_html__('Thank you for continuing with your subscription! We appreciate your business.', 'arraysubs');
echo "\n\n";

echo esc_html__('View your subscription here: ', 'arraysubs');
echo esc_url(wc_get_endpoint_url('subscriptions', '', wc_get_page_permalink('myaccount')));
echo "\n\n";

/**
 * Show user-defined additional content - this is set in each email's settings.
 */
if ($arraysubs_additional_content) {
    echo "----------\n\n";
    echo esc_html(wp_strip_all_tags(wptexturize($arraysubs_additional_content)));
    echo "\n\n";
}

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook
echo wp_kses_post(apply_filters('woocommerce_email_footer_text', get_option('woocommerce_email_footer_text')));
