Revert "Drop repeated conditions for rtl aligning, use variable instead"

This reverts commit a894e7b241.
This commit is contained in:
refael iliaguyev 2017-03-20 22:21:44 +02:00
parent a894e7b241
commit af55947f87
6 changed files with 18 additions and 47 deletions

View File

@ -177,27 +177,6 @@ class WC_Emails {
* Init email classes. * Init email classes.
*/ */
public function init() { 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 email classes
include_once( dirname( __FILE__ ) . '/emails/class-wc-email.php' ); include_once( dirname( __FILE__ ) . '/emails/class-wc-email.php' );

View File

@ -20,17 +20,15 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
global $_align;
?><table id="addresses" cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top;" border="0"> ?><table id="addresses" cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top;" border="0">
<tr> <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> <h3><?php _e( 'Billing address', 'woocommerce' ); ?></h3>
<p class="text"><?php echo $order->get_formatted_billing_address(); ?></p> <p class="text"><?php echo $order->get_formatted_billing_address(); ?></p>
</td> </td>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && ( $shipping = $order->get_formatted_shipping_address() ) ) : ?> <?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> <h3><?php _e( 'Shipping address', 'woocommerce' ); ?></h3>
<p class="text"><?php echo $shipping; ?></p> <p class="text"><?php echo $shipping; ?></p>

View File

@ -20,8 +20,6 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
global $_align;
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
@ -29,8 +27,8 @@ global $_align;
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title> <title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
</head> </head>
<body <?php echo $_align['left']; ?>margin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> <body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<div id="wrapper" dir="<?php echo $_align['ltr']; ?>"> <div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr> <tr>
<td align="center" valign="top"> <td align="center" valign="top">

View File

@ -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"> <table class="td" cellspacing="0" cellpadding="6" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;" border="1">
<thead> <thead>
<tr> <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 is_rtl() ? 'right' : '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 is_rtl() ? 'right' : '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( 'Price', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -52,8 +52,8 @@ do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plai
foreach ( $totals as $total ) { foreach ( $totals as $total ) {
$i++; $i++;
?><tr> ?><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> <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 $_align['left']; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td> <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 </tr><?php
} }
} }

View File

@ -20,18 +20,16 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
global $_align;
foreach ( $items as $item_id => $item ) : foreach ( $items as $item_id => $item ) :
if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) { if ( apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
$product = $item->get_product(); $product = $item->get_product();
?> ?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>"> <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 // Show title/image etc
if ( $show_image ) { 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 // 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 ); do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order, $plain_text );
?></td> ?></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 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 $_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 $order->get_formatted_line_subtotal( $item ); ?></td>
</tr> </tr>
<?php <?php
} }
if ( $show_purchase_note && is_object( $product ) && ( $purchase_note = $product->get_purchase_note() ) ) : ?> if ( $show_purchase_note && is_object( $product ) && ( $purchase_note = $product->get_purchase_note() ) ) : ?>
<tr> <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> </tr>
<?php endif; ?> <?php endif; ?>

View File

@ -18,8 +18,6 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $_align;
// Load colors // Load colors
$bg = get_option( 'woocommerce_email_background_color' ); $bg = get_option( 'woocommerce_email_background_color' );
$body = get_option( 'woocommerce_email_body_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-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
font-size: 14px; font-size: 14px;
line-height: 150%; line-height: 150%;
text-align: <?php echo $_align['left']; ?>; text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
} }
.td { .td {
@ -135,7 +133,7 @@ h1 {
font-weight: 300; font-weight: 300;
line-height: 150%; line-height: 150%;
margin: 0; 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 ); ?>; text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
@ -148,7 +146,7 @@ h2 {
font-weight: bold; font-weight: bold;
line-height: 130%; line-height: 130%;
margin: 16px 0 8px; margin: 16px 0 8px;
text-align: <?php echo $_align['left']; ?>; text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
} }
h3 { h3 {
@ -159,7 +157,7 @@ h3 {
font-weight: bold; font-weight: bold;
line-height: 130%; line-height: 130%;
margin: 16px 0 8px; margin: 16px 0 8px;
text-align: <?php echo $_align['left']; ?>; text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>;
} }
a { a {