From c692c0a8694d937c826fb16041e630eba337696a Mon Sep 17 00:00:00 2001 From: Stanislav Mazur Date: Thu, 25 Jan 2018 18:04:17 +0200 Subject: [PATCH 1/2] Make 'woocommerce_email_downloads_column_' hook format aware (#18598) --- templates/emails/email-downloads.php | 2 +- templates/emails/plain/email-downloads.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/emails/email-downloads.php b/templates/emails/email-downloads.php index faa02a5faaa..195dde6e3c5 100644 --- a/templates/emails/email-downloads.php +++ b/templates/emails/email-downloads.php @@ -38,7 +38,7 @@ $text_align = is_rtl() ? 'right' : 'left'; $column_name ) : ?> diff --git a/templates/emails/plain/email-downloads.php b/templates/emails/plain/email-downloads.php index dfb3d49ba5b..8f46cf8820d 100644 --- a/templates/emails/plain/email-downloads.php +++ b/templates/emails/plain/email-downloads.php @@ -27,7 +27,7 @@ foreach ( $downloads as $download ) { echo $column_name . ": "; if ( has_action( 'woocommerce_email_downloads_column_' . $column_id ) ) { - do_action( 'woocommerce_email_downloads_column_' . $column_id, $download ); + do_action( 'woocommerce_email_downloads_column_' . $column_id, $download, false ); } else { switch ( $column_id ) { case 'download-product' : From 04fe7aaf4abe692c002e0729ef17d566e0e53017 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 30 Jan 2018 12:12:44 +0000 Subject: [PATCH 2/2] Switch to variable --- templates/emails/email-downloads.php | 47 ++++++++++++---------- templates/emails/plain/email-downloads.php | 31 +++++++------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/templates/emails/email-downloads.php b/templates/emails/email-downloads.php index 195dde6e3c5..0d02be04865 100644 --- a/templates/emails/email-downloads.php +++ b/templates/emails/email-downloads.php @@ -10,25 +10,22 @@ * 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 + * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates - * @version 3.2.0 + * @version 3.4.0 */ -if ( ! defined( 'ABSPATH' ) ) { - exit; -} +defined( 'ABSPATH' ) || exit; $text_align = is_rtl() ? 'right' : 'left'; -?>

+?>

$column_name ) : ?> - + @@ -36,29 +33,35 @@ $text_align = is_rtl() ? 'right' : 'left'; $column_name ) : ?> - + ?> + diff --git a/templates/emails/plain/email-downloads.php b/templates/emails/plain/email-downloads.php index 8f46cf8820d..9f0a3f646fe 100644 --- a/templates/emails/plain/email-downloads.php +++ b/templates/emails/plain/email-downloads.php @@ -10,39 +10,36 @@ * 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 + * @see https://docs.woocommerce.com/document/template-structure/ * @package WooCommerce/Templates - * @version 3.2.0 + * @version 3.4.0 */ -if ( ! defined( 'ABSPATH' ) ) { - exit; -} +defined( 'ABSPATH' ) || exit; -echo strtoupper( __( 'Downloads', 'woocommerce' ) ) . "\n\n"; +echo esc_html( wc_strtoupper( __( 'Downloads', 'woocommerce' ) ) ) . "\n\n"; foreach ( $downloads as $download ) { foreach ( $columns as $column_id => $column_name ) { - echo $column_name . ": "; + echo wp_kses_post( $column_name ) . ': '; if ( has_action( 'woocommerce_email_downloads_column_' . $column_id ) ) { - do_action( 'woocommerce_email_downloads_column_' . $column_id, $download, false ); + do_action( 'woocommerce_email_downloads_column_' . $column_id, $download, $plain_text ); } else { switch ( $column_id ) { - case 'download-product' : + case 'download-product': echo esc_html( $download['product_name'] ); - break; - case 'download-file' : + break; + case 'download-file': echo esc_html( $download['download_name'] ) . ' - ' . esc_url( $download['download_url'] ); - break; - case 'download-expires' : + break; + case 'download-expires': if ( ! empty( $download['access_expires'] ) ) { - echo date_i18n( get_option( 'date_format' ), strtotime( $download['access_expires'] ) ); + echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $download['access_expires'] ) ) ); } else { - _e( 'Never', 'woocommerce' ); + esc_html_e( 'Never', 'woocommerce' ); } - break; + break; } } echo "\n";
;"> + + case 'download-product': + ?> + break; + case 'download-file': + ?> - - - - - + +