Better handling for sent to admin/plain text args Closes #4359

This commit is contained in:
Mike Jolley 2014-01-08 15:04:49 +00:00
parent 8a73715c1f
commit e15c572465
16 changed files with 70 additions and 42 deletions

View File

@ -104,7 +104,9 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
ob_start();
wc_get_template( $this->template_html, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
@ -119,7 +121,9 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
ob_start();
wc_get_template( $this->template_plain, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -110,7 +110,9 @@ class WC_Email_Customer_Invoice extends WC_Email {
ob_start();
wc_get_template( $this->template_html, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
@ -125,7 +127,9 @@ class WC_Email_Customer_Invoice extends WC_Email {
ob_start();
wc_get_template( $this->template_plain, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -80,7 +80,9 @@ class WC_Email_Customer_New_Account extends WC_Email {
'user_login' => $this->user_login,
'user_pass' => $this->user_pass,
'blogname' => $this->get_blogname(),
'password_generated' => $this->password_generated
'password_generated' => $this->password_generated,
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
@ -98,7 +100,9 @@ class WC_Email_Customer_New_Account extends WC_Email {
'user_login' => $this->user_login,
'user_pass' => $this->user_pass,
'blogname' => $this->get_blogname(),
'password_generated' => $this->password_generated
'password_generated' => $this->password_generated,
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -91,7 +91,9 @@ class WC_Email_Customer_Note extends WC_Email {
wc_get_template( $this->template_html, array(
'order' => $this->object,
'email_heading' => $this->get_heading(),
'customer_note' => $this->customer_note
'customer_note' => $this->customer_note,
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
@ -107,7 +109,9 @@ class WC_Email_Customer_Note extends WC_Email {
wc_get_template( $this->template_plain, array(
'order' => $this->object,
'email_heading' => $this->get_heading(),
'customer_note' => $this->customer_note
'customer_note' => $this->customer_note,
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -75,7 +75,9 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
ob_start();
wc_get_template( $this->template_html, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
@ -89,8 +91,10 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
function get_content_plain() {
ob_start();
wc_get_template( $this->template_plain, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'order' => $this->object,
'email_heading' => $this->get_heading(),
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -86,7 +86,9 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
'email_heading' => $this->get_heading(),
'user_login' => $this->user_login,
'reset_key' => $this->reset_key,
'blogname' => $this->get_blogname()
'blogname' => $this->get_blogname(),
'sent_to_admin' => false,
'plain_text' => false
) );
return ob_get_clean();
}
@ -103,7 +105,9 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
'email_heading' => $this->get_heading(),
'user_login' => $this->user_login,
'reset_key' => $this->reset_key,
'blogname' => $this->get_blogname()
'blogname' => $this->get_blogname(),
'sent_to_admin' => false,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -84,7 +84,9 @@ class WC_Email_New_Order extends WC_Email {
ob_start();
wc_get_template( $this->template_html, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => true,
'plain_text' => false
) );
return ob_get_clean();
}
@ -99,7 +101,9 @@ class WC_Email_New_Order extends WC_Email {
ob_start();
wc_get_template( $this->template_plain, array(
'order' => $this->object,
'email_heading' => $this->get_heading()
'email_heading' => $this->get_heading(),
'sent_to_admin' => true,
'plain_text' => true
) );
return ob_get_clean();
}

View File

@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<p><?php printf( __( "Hi there. Your recent order on %s has been completed. Your order details are shown below for your reference:", 'woocommerce' ), get_option( 'blogname' ) ); ?></p>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php echo __( 'Order:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?></h2>
@ -44,9 +44,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
</tfoot>
</table>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>

View File

@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php endif; ?>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php echo __( 'Order:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?> (<?php printf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2>
@ -60,8 +60,8 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
</tfoot>
</table>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action('woocommerce_email_footer'); ?>

View File

@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<p><?php _e("For your reference, your order details are shown below.", 'woocommerce'); ?></p>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php echo __( 'Order:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?></h2>
@ -48,9 +48,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
</tfoot>
</table>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>

View File

@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<p><?php _e( "Your order has been received and is now being processed. Your order details are shown below for your reference:", 'woocommerce' ); ?></p>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php echo __( 'Order:', 'woocommerce' ) . ' ' . $order->get_order_number(); ?></h2>
@ -44,9 +44,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
</tfoot>
</table>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action('woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = false ); ?>
<?php do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text ); ?>
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>

View File

@ -14,13 +14,13 @@ echo sprintf( __( 'You have received an order from %s. Their order is as follows
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin = true, $plain_text = true );
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order link: %s', 'woocommerce'), admin_url( 'post.php?post=' . $order->id . '&action=edit' ) ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( __( 'jS F Y', 'woocommerce' ), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = true, $plain_text = true );
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( false, true, '', '', '', true );
@ -34,7 +34,7 @@ if ( $totals = $order->get_order_item_totals() ) {
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin = true, $plain_text = true );
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo __( 'Customer details', 'woocommerce' ) . "\n";

View File

@ -14,12 +14,12 @@ echo sprintf( __( "Hi there. Your recent order on %s has been completed. Your or
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( true, false, true, '', '', true );
@ -33,7 +33,7 @@ if ( $totals = $order->get_order_item_totals() ) {
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo __( 'Your details', 'woocommerce' ) . "\n\n";

View File

@ -15,12 +15,12 @@ if ( $order->status == 'pending' )
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n";
@ -46,6 +46,6 @@ if ( $totals = $order->get_order_item_totals() ) {
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) );

View File

@ -22,12 +22,12 @@ echo __( "For your reference, your order details are shown below.", 'woocommerce
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( $order->is_download_permitted(), true, '', '', '', true );
@ -41,7 +41,7 @@ if ( $totals = $order->get_order_item_totals() ) {
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo __( 'Your details', 'woocommerce' ) . "\n\n";

View File

@ -14,12 +14,12 @@ echo __( "Your order has been received and is now being processed. Your order de
echo "****************************************************\n\n";
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
echo sprintf( __( 'Order number: %s', 'woocommerce'), $order->get_order_number() ) . "\n";
echo sprintf( __( 'Order date: %s', 'woocommerce'), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ) . "\n";
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
echo "\n" . $order->email_order_items_table( $order->is_download_permitted(), true, ($order->status=='processing') ? true : false, '', '', true );
@ -33,7 +33,7 @@ if ( $totals = $order->get_order_item_totals() ) {
echo "\n****************************************************\n\n";
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin = false, $plain_text = true );
do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
echo __( 'Your details', 'woocommerce' ) . "\n\n";