From d9f1b7c7d45b86870172fe85fc78d8d69103ef9f Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 22 Feb 2018 12:32:08 -0300 Subject: [PATCH] Fixed converting letters with accents to uppercase in templates Closes #19084 --- templates/emails/plain/email-addresses.php | 25 +++++++++++-------- .../emails/plain/email-customer-details.php | 9 +++---- .../emails/plain/email-order-details.php | 4 +-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/templates/emails/plain/email-addresses.php b/templates/emails/plain/email-addresses.php index ff5995de41c..d460c99d90f 100644 --- a/templates/emails/plain/email-addresses.php +++ b/templates/emails/plain/email-addresses.php @@ -10,28 +10,31 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes - * @package WooCommerce/Templates/Emails/Plain - * @version 3.2.1 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce/Templates/Emails/Plain + * @version 3.4.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } -echo "\n" . strtoupper( __( 'Billing address', 'woocommerce' ) ) . "\n\n"; -echo preg_replace( '##i', "\n", $order->get_formatted_billing_address() ) . "\n"; +echo "\n" . esc_html( wc_strtoupper( __( 'Billing address', 'woocommerce' ) ) ) . "\n\n"; +echo preg_replace( '##i', "\n", $order->get_formatted_billing_address() ) . "\n"; // WPCS: XSS ok. if ( $order->get_billing_phone() ) { - echo $order->get_billing_phone() . "\n"; + echo $order->get_billing_phone() . "\n"; // WPCS: XSS ok. } if ( $order->get_billing_email() ) { - echo $order->get_billing_email() . "\n"; + echo $order->get_billing_email() . "\n"; // WPCS: XSS ok. } -if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && ( $shipping = $order->get_formatted_shipping_address() ) ) { - echo "\n" . strtoupper( __( 'Shipping address', 'woocommerce' ) ) . "\n\n"; - echo preg_replace( '##i', "\n", $shipping ) . "\n"; +if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() ) { + $shipping = $order->get_formatted_shipping_address(); + + if ( $shipping ) { + echo "\n" . esc_html( wc_strtoupper( __( 'Shipping address', 'woocommerce' ) ) ) . "\n\n"; + echo preg_replace( '##i', "\n", $shipping ) . "\n"; // WPCS: XSS ok. + } } diff --git a/templates/emails/plain/email-customer-details.php b/templates/emails/plain/email-customer-details.php index 55e3b48e632..2671ac1db7c 100644 --- a/templates/emails/plain/email-customer-details.php +++ b/templates/emails/plain/email-customer-details.php @@ -12,17 +12,16 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes - * @package WooCommerce/Templates/Emails/Plain - * @version 2.5.0 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce/Templates/Emails/Plain + * @version 3.4.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } -echo strtoupper( __( 'Customer details', 'woocommerce' ) ) . "\n\n"; +echo esc_html( wc_strtoupper( __( 'Customer details', 'woocommerce' ) ) ) . "\n\n"; foreach ( $fields as $field ) { echo wp_kses_post( $field['label'] ) . ': ' . wp_kses_post( $field['value'] ) . "\n"; diff --git a/templates/emails/plain/email-order-details.php b/templates/emails/plain/email-order-details.php index 80bc3841e4b..a07880c2760 100644 --- a/templates/emails/plain/email-order-details.php +++ b/templates/emails/plain/email-order-details.php @@ -12,7 +12,7 @@ * * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates/Emails - * @version 3.3.0 + * @version 3.4.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) { do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); /* translators: %s: Order ID. */ -echo wp_kses_post( strtoupper( sprintf( __( 'Order number: %s', 'woocommerce' ), $order->get_order_number() ) ) ) . "\n"; +echo wp_kses_post( wc_strtoupper( sprintf( __( 'Order number: %s', 'woocommerce' ), $order->get_order_number() ) ) ) . "\n"; echo wc_format_datetime( $order->get_date_created() ) . "\n"; // WPCS: XSS ok. echo "\n" . wc_get_email_order_items( $order, array( // WPCS: XSS ok. 'show_sku' => $sent_to_admin,