Пример #1
0
/**
 * Email the donation confirmation to the admin accounts for testing.
 *
 * @since 1.0
 * @global $give_options Array of all the Give Options
 * @return void
 */
function give_email_test_donation_receipt()
{
    $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
    $from_email = give_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
    $subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
    $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
    $subject = give_do_email_tags($subject, 0);
    $attachments = apply_filters('give_receipt_attachments', array(), 0, array());
    $message = give_email_preview_template_tags(give_get_email_body_content(0, array()), 0);
    $emails = Give()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', __('Donation Receipt', 'give'));
    $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
    $emails->__set('headers', $headers);
    $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
}
Пример #2
0
/**
 * Displays the email preview
 *
 * @since 1.0
 * @return void
 */
function give_display_email_template_preview()
{
    if (empty($_GET['give_action'])) {
        return;
    }
    if ('preview_email' !== $_GET['give_action']) {
        return;
    }
    if (!current_user_can('manage_give_settings')) {
        return;
    }
    Give()->emails->heading = __('Donation Receipt', 'give');
    echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array())));
    exit;
}
Пример #3
0
/**
 * Displays the email preview
 *
 * @since 1.0
 * @return void
 */
function give_display_email_template_preview()
{
    if (empty($_GET['give_action'])) {
        return;
    }
    if ('preview_email' !== $_GET['give_action']) {
        return;
    }
    if (!current_user_can('manage_give_settings')) {
        return;
    }
    Give()->emails->heading = esc_html__('Donation Receipt', 'give');
    $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
    echo give_get_preview_email_header();
    //Are we previewing an actual payment?
    if (!empty($payment_id)) {
        $content = give_get_email_body_content($payment_id);
        $preview_content = give_do_email_tags($content, $payment_id);
    } else {
        //No payment ID, use sample preview content
        $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
    }
    echo Give()->emails->build_email($preview_content);
    exit;
}