/** * Email Template Preview * * @access private * @global $edd_options Array of all the EDD Options * @since 1.0.8.2 */ function edd_email_template_preview() { global $edd_options; $default_email_body = __("Dear", "edd") . " {name},\n\n"; $default_email_body .= __("Thank you for your purchase. Please click on the link(s) below to download your files.", "edd") . "\n\n"; $default_email_body .= "{download_list}\n\n"; $default_email_body .= "{sitename}"; $email_body = isset($edd_options['purchase_receipt']) ? $edd_options['purchase_receipt'] : $default_email_body; ob_start(); ?> <a href="#email-preview" id="open-email-preview" class="button-secondary" title="<?php _e('Purchase Receipt Preview', 'edd'); ?> "><?php _e('Preview Purchase Receipt', 'edd'); ?> </a> <a href="<?php echo wp_nonce_url(add_query_arg(array('edd_action' => 'send_test_email')), 'edd-test-email'); ?> " title="<?php _e('This will send a demo purchase receipt to the emails listed below.', 'edd'); ?> " class="button-secondary"><?php _e('Send Test Email', 'edd'); ?> </a> <div id="email-preview-wrap" style="display:none;"> <div id="email-preview"> <?php echo edd_apply_email_template($email_body, null, null); ?> </div> </div> <?php echo ob_get_clean(); }
/** * Email the product update test email to the admin account * * @global $edd_options Array of all the EDD Options * @return void */ function edd_pup_test_email($email_id, $to = null) { $email = get_post($email_id); $emailmeta = get_post_custom($email_id); $from_name = isset($emailmeta['_edd_pup_from_name'][0]) ? $emailmeta['_edd_pup_from_name'][0] : get_bloginfo('name'); $from_email = isset($emailmeta['_edd_pup_from_email'][0]) ? $emailmeta['_edd_pup_from_email'][0] : get_option('admin_email'); $subject = apply_filters('edd_pup_test_subject', isset($email->post_excerpt) ? trim($email->post_excerpt) : __('(no subject)', 'edd-pup'), 0); $subject = strip_tags(edd_email_preview_template_tags($subject)); $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n"; $headers .= "Reply-To: " . $from_email . "\r\n"; $headers .= "Content-Type: text/html; charset=utf-8\r\n"; $headers = apply_filters('edd_pup_test_headers', $headers); add_filter('edd_email_template', 'edd_pup_template'); if (version_compare(get_option('edd_version'), '2.1') >= 0) { $edd_emails = new EDD_emails(); $message = edd_email_preview_template_tags($email->post_content); $edd_emails->__set('from_name', $from_name); $edd_emails->__set('from_address', $from_email); // Send the email foreach ($to as $recipient) { $edd_emails->send($recipient, $subject, $message); } //$edd_emails = new EDD_Emails; //$message = $edd_emails->build_email( edd_email_preview_template_tags( $email->post_content ) ); } else { $message = edd_get_email_body_header(); $message .= apply_filters('edd_pup_test_message', edd_apply_email_template($email->post_content, null, null), $email_id); $message .= edd_get_email_body_footer(); foreach ($to as $recipient) { wp_mail($recipient, $subject, $message, $headers); } } return $to; }
/** * Email Template Preview * * @access private * @since 1.0.8.2 * @echo string */ function edd_email_template_preview() { global $edd_options; $default_email_body = __("Dear", "edd") . " {name},\n\n"; $default_email_body .= __("Thank you for your purchase. Please click on the link(s) below to download your files.", "edd") . "\n\n"; $default_email_body .= "{download_list}\n\n"; $default_email_body .= "{sitename}"; $email_body = isset($edd_options['purchase_receipt']) ? $edd_options['purchase_receipt'] : $default_email_body; ob_start(); ?> <a href="#email-preview" id="open-email-preview" class="button-secondary" title="<?php _e('Purchase Receipt Preview', 'edd'); ?> "><?php _e('Preview Purchase Receipt', 'edd'); ?> </a> <div id="email-preview-wrap" style="display:none;"> <div id="email-preview"> <?php echo edd_apply_email_template($email_body, null, null); ?> </div> </div> <?php echo ob_get_clean(); }
/** * Email Template Preview * * @access private * @since 1.0.8.2 * @echo string */ function edd_email_template_preview() { global $edd_options; ob_start(); ?> <a href="#email-preview" id="open-email-preview" class="button-secondary" title="<?php _e('Purchase Receipt Preview', 'edd'); ?> "><?php _e('Preview Purchase Receipt', 'edd'); ?> </a> <div id="email-preview-wrap" style="display:none;"> <div id="email-preview"> <?php echo edd_apply_email_template($edd_options['purchase_receipt'], null, null); ?> </div> </div> <?php echo ob_get_clean(); }