CS: reformat a very long line

This line was quite unreadable.

Additionally, it was using the "heavy" `wp_kses_data()` function to escape item count phrase, while that phrase should not contain HTML in the first place and therefore can use the lighter `esc_html()` function to do the output escaping.
This commit is contained in:
jrfnl 2018-02-27 14:05:41 +01:00
parent 1abaebcdaa
commit eb091acf66
1 changed files with 8 additions and 2 deletions

View File

@ -225,8 +225,14 @@ if ( ! function_exists( '_s_woocommerce_cart_link' ) ) {
function _s_woocommerce_cart_link() { function _s_woocommerce_cart_link() {
?> ?>
<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', '_s' ); ?>"> <a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', '_s' ); ?>">
<?php /* translators: number of items in the mini cart. */ ?> <?php
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), '_s' ), WC()->cart->get_cart_contents_count() ) ); ?></span> $item_count_text = sprintf(
/* translators: number of items in the mini cart. */
_n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), '_s' ),
WC()->cart->get_cart_contents_count()
);
?>
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo esc_html( $item_count_text ); ?></span>
</a> </a>
<?php <?php
} }