phpcs tweaks and escaping

This commit is contained in:
Mike Jolley 2017-11-01 12:32:35 +00:00
parent 289842aacf
commit 80dfbc0ced
1 changed files with 44 additions and 38 deletions

View File

@ -164,53 +164,59 @@ class WC_Meta_Box_Order_Data {
<div class="panel-wrap woocommerce"> <div class="panel-wrap woocommerce">
<input name="post_title" type="hidden" value="<?php echo empty( $post->post_title ) ? __( 'Order', 'woocommerce' ) : esc_attr( $post->post_title ); ?>" /> <input name="post_title" type="hidden" value="<?php echo empty( $post->post_title ) ? __( 'Order', 'woocommerce' ) : esc_attr( $post->post_title ); ?>" />
<input name="post_status" type="hidden" value="<?php echo esc_attr( $post->post_status ); ?>" /> <input name="post_status" type="hidden" value="<?php echo esc_attr( $post->post_status ); ?>" />
<div id="order_data" class="panel"> <div id="order_data" class="panel woocommerce-order-data">
<h2 class="woocommerce-order-data__heading"><?php
<h2><?php
/* translators: 1: order type 2: order number */ /* translators: 1: order type 2: order number */
printf( printf(
esc_html__( '%1$s #%2$s details', 'woocommerce' ), esc_html__( '%1$s #%2$s details', 'woocommerce' ),
$order_type_object->labels->singular_name, esc_html( $order_type_object->labels->singular_name ),
$order->get_order_number() esc_html( $order->get_order_number() )
); );
?></h2> ?></h2>
<p class="order_meta order_number"><?php <p class="woocommerce-order-data__meta order_number"><?php
$order_meta = array();
$meta_list = array();
if ( $payment_method ) { if ( $payment_method ) {
/* translators: %s: payment method */ /* translators: %s: payment method */
$order_meta['payment_method']['gateway'] = sprintf( $payment_method_string = sprintf(
__( 'Payment via %s', 'woocommerce' ), __( 'Payment via %s', 'woocommerce' ),
( isset( $payment_gateways[ $payment_method ] ) ? esc_html( $payment_gateways[ $payment_method ]->get_title() ) : esc_html( $payment_method ) ) esc_html( isset( $payment_gateways[ $payment_method ] ) ? $payment_gateways[ $payment_method ]->get_title() : $payment_method )
); );
if ( $transaction_id = $order->get_transaction_id() ) { if ( $transaction_id = $order->get_transaction_id() ) {
if ( isset( $payment_gateways[ $payment_method ] ) && ( $url = $payment_gateways[ $payment_method ]->get_transaction_url( $order ) ) ) { if ( isset( $payment_gateways[ $payment_method ] ) && ( $url = $payment_gateways[ $payment_method ]->get_transaction_url( $order ) ) ) {
$order_meta['payment_method']['transaction_id'] = '(<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $transaction_id ) . '</a>)'; $payment_method_string = ' (<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $transaction_id ) . '</a>)';
} else { } else {
$order_meta['payment_method']['transaction_id'] = '(' . esc_html( $transaction_id ) . ')'; $payment_method_string = ' (' . esc_html( $transaction_id ) . ')';
} }
} }
$meta_list[] = $payment_method_string;
}
if ( $order->get_date_paid() ) { if ( $order->get_date_paid() ) {
/* translators: 1: date 2: time */ /* translators: 1: date 2: time */
$order_meta['payment_method']['date_paid'] = sprintf( __( 'on %1$s @ %2$s', 'woocommerce' ), wc_format_datetime( $order->get_date_paid() ), wc_format_datetime( $order->get_date_paid(), get_option( 'time_format' ) ) ); $meta_list[] = sprintf(
} __( 'Paid on %1$s @ %2$s', 'woocommerce' ),
wc_format_datetime( $order->get_date_paid() ),
$order_meta['payment_method'] = implode( ' ', $order_meta['payment_method'] ); wc_format_datetime( $order->get_date_paid(), get_option( 'time_format' ) )
);
} }
if ( $ip_address = $order->get_customer_ip_address() ) { if ( $ip_address = $order->get_customer_ip_address() ) {
/* translators: %s: IP address */ /* translators: %s: IP address */
$order_meta['ip_address'] = sprintf( $meta_list[] = sprintf(
__( 'Customer IP: %s', 'woocommerce' ), __( 'Customer IP: %s', 'woocommerce' ),
'<span class="woocommerce-Order-customerIP">' . esc_html( $ip_address ) . '</span>' '<span class="woocommerce-Order-customerIP">' . esc_html( $ip_address ) . '</span>'
); );
} }
echo implode( '. ', $order_meta ); echo wp_kses_post( implode( '. ', $meta_list ) ) . '.';
?></p>
?></p>
<div class="order_data_column_container"> <div class="order_data_column_container">
<div class="order_data_column"> <div class="order_data_column">
<h3><?php _e( 'General Details', 'woocommerce' ); ?></h3> <h3><?php _e( 'General Details', 'woocommerce' ); ?></h3>