Revert "Drop repeated conditions for rtl aligning, use variable instead"
This reverts commit a894e7b241
.
This commit is contained in:
parent
a894e7b241
commit
af55947f87
|
@ -177,27 +177,6 @@ class WC_Emails {
|
|||
* Init email classes.
|
||||
*/
|
||||
public function init() {
|
||||
// Global variable for aligning to be used in email templates
|
||||
global $_align;
|
||||
|
||||
if ( is_rtl() ) {
|
||||
$_align = array(
|
||||
'left' => 'right',
|
||||
'right' => 'left',
|
||||
'rtl' => 'ltr',
|
||||
'ltr' => 'rtl',
|
||||
);
|
||||
} else {
|
||||
$_align = array(
|
||||
'left' => 'left',
|
||||
'right' => 'right',
|
||||
'rtl' => 'rtl',
|
||||
'ltr' => 'ltr',
|
||||
);
|
||||
}
|
||||
|
||||
$_align = apply_filters( 'woocommerce_email_aligning', $_align );
|
||||
|
||||
// Include email classes
|
||||
include_once( dirname( __FILE__ ) . '/emails/class-wc-email.php' );
|
||||
|
||||
|
|
|
@ -20,17 +20,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
global $_align;
|
||||
|
||||
?><table id="addresses" cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top;" border="0">
|
||||
<tr>
|
||||
<td class="td" style="text-align:<?php echo $_align['left']; ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" valign="top" width="50%">
|
||||
<td class="td" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" valign="top" width="50%">
|
||||
<h3><?php _e( 'Billing address', 'woocommerce' ); ?></h3>
|
||||
|
||||
<p class="text"><?php echo $order->get_formatted_billing_address(); ?></p>
|
||||
</td>
|
||||
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && ( $shipping = $order->get_formatted_shipping_address() ) ) : ?>
|
||||
<td class="td" style="text-align:<?php echo $_align['left']; ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" valign="top" width="50%">
|
||||
<td class="td" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" valign="top" width="50%">
|
||||
<h3><?php _e( 'Shipping address', 'woocommerce' ); ?></h3>
|
||||
|
||||
<p class="text"><?php echo $shipping; ?></p>
|
||||
|
|
|
@ -20,8 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
global $_align;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
|
@ -29,8 +27,8 @@ global $_align;
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
|
||||
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
|
||||
</head>
|
||||
<body <?php echo $_align['left']; ?>margin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
|
||||
<div id="wrapper" dir="<?php echo $_align['ltr']; ?>">
|
||||
<body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
|
||||
<div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>">
|
||||
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
|
|
|
@ -31,9 +31,9 @@ do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plai
|
|||
<table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="td" scope="col" style="text-align:<?php echo $_align['left']; ?>;"><?php _e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo $_align['left']; ?>;"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo $_align['left']; ?>;"><?php _e( 'Price', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>;"><?php _e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>;"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
|
||||
<th class="td" scope="col" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>;"><?php _e( 'Price', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -52,8 +52,8 @@ do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plai
|
|||
foreach ( $totals as $total ) {
|
||||
$i++;
|
||||
?><tr>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:<?php echo $_align['left']; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:<?php echo $_align['left']; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
|
||||
<th class="td" scope="row" colspan="2" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?></th>
|
||||
<td class="td" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
|
||||
</tr><?php
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,18 +20,16 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
global $_align;
|
||||
|
||||
foreach ( $items as $item_id => $item ) :
|
||||
if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
|
||||
$product = $item->get_product();
|
||||
?>
|
||||
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
|
||||
<td class="td" style="text-align:<?php echo $_align['left']; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; word-wrap:break-word;"><?php
|
||||
<td class="td" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; word-wrap:break-word;"><?php
|
||||
|
||||
// Show title/image etc
|
||||
if ( $show_image ) {
|
||||
echo apply_filters( 'woocommerce_order_item_thumbnail', '<div style="margin-bottom: 5px"><img src="' . ( $product->get_image_id() ? current( wp_get_attachment_image_src( $product->get_image_id(), 'thumbnail' ) ) : wc_placeholder_img_src() ) . '" alt="' . esc_attr__( 'Product image', 'woocommerce' ) . '" height="' . esc_attr( $image_size[1] ) . '" width="' . esc_attr( $image_size[0] ) . '" style="vertical-align:middle; margin-' . $_align['right'] . ': 10px;" /></div>', $item );
|
||||
echo apply_filters( 'woocommerce_order_item_thumbnail', '<div style="margin-bottom: 5px"><img src="' . ( $product->get_image_id() ? current( wp_get_attachment_image_src( $product->get_image_id(), 'thumbnail' ) ) : wc_placeholder_img_src() ) . '" alt="' . esc_attr__( 'Product image', 'woocommerce' ) . '" height="' . esc_attr( $image_size[1] ) . '" width="' . esc_attr( $image_size[0] ) . '" style="vertical-align:middle; margin-' . ( is_rtl() ? 'left' : 'right' ) . ': 10px;" /></div>', $item );
|
||||
}
|
||||
|
||||
// Product name
|
||||
|
@ -55,15 +53,15 @@ foreach ( $items as $item_id => $item ) :
|
|||
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
|
||||
|
||||
?></td>
|
||||
<td class="td" style="text-align:<?php echo $_align['left']; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo apply_filters( 'woocommerce_email_order_item_quantity', $item->get_quantity(), $item ); ?></td>
|
||||
<td class="td" style="text-align:<?php echo $_align['left']; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td>
|
||||
<td class="td" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo apply_filters( 'woocommerce_email_order_item_quantity', $item->get_quantity(), $item ); ?></td>
|
||||
<td class="td" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( $show_purchase_note && is_object( $product ) && ( $purchase_note = $product->get_purchase_note() ) ) : ?>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:<?php echo $_align['left']; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td>
|
||||
<td colspan="3" style="text-align:<?php echo is_rtl() ? 'right' : 'left'; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
global $_align;
|
||||
|
||||
// Load colors
|
||||
$bg = get_option( 'woocommerce_email_background_color' );
|
||||
$body = get_option( 'woocommerce_email_body_background_color' );
|
||||
|
@ -106,7 +104,7 @@ $text_lighter_20 = wc_hex_lighter( $text, 20 );
|
|||
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 150%;
|
||||
text-align: <?php echo $_align['left']; ?>;
|
||||
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
|
||||
}
|
||||
|
||||
.td {
|
||||
|
@ -135,7 +133,7 @@ h1 {
|
|||
font-weight: 300;
|
||||
line-height: 150%;
|
||||
margin: 0;
|
||||
text-align: <?php echo $_align['left']; ?>;
|
||||
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
|
||||
text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
@ -148,7 +146,7 @@ h2 {
|
|||
font-weight: bold;
|
||||
line-height: 130%;
|
||||
margin: 16px 0 8px;
|
||||
text-align: <?php echo $_align['left']; ?>;
|
||||
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
|
||||
}
|
||||
|
||||
h3 {
|
||||
|
@ -159,7 +157,7 @@ h3 {
|
|||
font-weight: bold;
|
||||
line-height: 130%;
|
||||
margin: 16px 0 8px;
|
||||
text-align: <?php echo $_align['left']; ?>;
|
||||
text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
|
||||
}
|
||||
|
||||
a {
|
||||
|
|
Loading…
Reference in New Issue