Fix 2.3 plain text emails

This commit is contained in:
Mike Jolley 2014-10-21 16:18:59 +01:00
parent 0bc3ad868d
commit e917f10b91
2 changed files with 5 additions and 15 deletions

View File

@ -309,7 +309,7 @@ class WC_Emails {
*/
public function low_stock( $product ) {
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product low in stock', 'woocommerce' ) );
$message = sprintf( __( '%s is low in stock.', 'woocommerce' ), html_entity_decode( $product->get_formatted_name() ) );
$message = sprintf( __( '%s is low in stock.', 'woocommerce' ), html_entity_decode( strip_tags( $product->get_formatted_name() ) ) );
wp_mail(
apply_filters( 'woocommerce_email_recipient_low_stock', get_option( 'woocommerce_stock_email_recipient' ), $product ),
@ -327,7 +327,7 @@ class WC_Emails {
*/
public function no_stock( $product ) {
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product out of stock', 'woocommerce' ) );
$message = sprintf( __( '%s is out of stock.', 'woocommerce' ), html_entity_decode( $product->get_formatted_name() ) );
$message = sprintf( __( '%s is out of stock.', 'woocommerce' ), html_entity_decode( strip_tags( $product->get_formatted_name() ) ) );
wp_mail(
apply_filters( 'woocommerce_email_recipient_no_stock', get_option( 'woocommerce_stock_email_recipient' ), $product ),
@ -357,7 +357,7 @@ class WC_Emails {
}
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product Backorder', 'woocommerce' ) );
$message = sprintf( __( '%s units of %s have been backordered in order %s.', 'woocommerce' ), $quantity, html_entity_decode( $product->get_formatted_name() ), $order->get_order_number() );
$message = sprintf( __( '%s units of %s have been backordered in order %s.', 'woocommerce' ), $quantity, html_entity_decode( strip_tags( $product->get_formatted_name() ) ), $order->get_order_number() );
wp_mail(
apply_filters( 'woocommerce_email_recipient_backorder', get_option( 'woocommerce_stock_email_recipient' ), $args ),

View File

@ -157,9 +157,6 @@ class WC_Email extends WC_Settings_API {
// For multipart messages
add_filter( 'phpmailer_init', array( $this, 'handle_multipart' ) );
// Inline CSS styles for html emails
add_filter( 'woocommerce_mail_content', array( $this, 'style_inline' ), 10 );
}
/**
@ -317,7 +314,6 @@ class WC_Email extends WC_Settings_API {
* @return string
*/
public function style_inline( $content ) {
// make sure we only inline CSS for html emails
if ( 'text/html' == $this->get_content_type() ) {
@ -382,14 +378,8 @@ class WC_Email extends WC_Settings_API {
add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
/**
* Filter all WooCommerce mail content
*
* @hooked inline_styles - 10
*/
$message = apply_filters( 'woocommerce_mail_content', $message );
$return = wp_mail( $to, $subject, $message, $headers, $attachments );
$message = apply_filters( 'woocommerce_mail_content', $this->style_inline( $message ) );
$return = wp_mail( $to, $subject, $message, $headers, $attachments );
remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );