cart/cart.php

- `wp_kses_post` added by Woo

Reference:
bac2bf7b91ac36f114c16850e6a0118c2aa1c7ca
077eebbf9818aeecdaed53e1066b15bab35fa533
1fa62f83a868fe103d09c3e17c1352784ef7a6ef
9d10d107e20e20b20719236bfbfd123f15667a3d
4f69eced88fe2117cb030e5b2b109861ce9ac478
ffcce0bc772b70e6b9d75184914629e70b4ee4ed
This commit is contained in:
Unknown 2018-06-05 19:59:33 -06:00
parent 3bfdc7996f
commit b5ecffa380
1 changed files with 33 additions and 28 deletions

View File

@ -11,14 +11,11 @@
* the readme will list any important changes. * the readme will list any important changes.
* *
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.3.0 * @version 3.4.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { defined( 'ABSPATH' ) || exit;
exit;
}
wc_print_notices(); wc_print_notices();
@ -64,57 +61,65 @@ do_action( 'woocommerce_before_cart' ); ?>
?> ?>
</td> </td>
<td class="product-thumbnail"><?php <td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $product_permalink ) { if ( ! $product_permalink ) {
echo $thumbnail; echo wp_kses_post( $thumbnail );
} else { } else {
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), wp_kses_post( $thumbnail ) );
} }
?></td> ?>
</td>
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'understrap' ); ?>"><?php <td class="product-name" data-title="<?php esc_attr_e( 'Product', 'understrap' ); ?>">
<?php
if ( ! $product_permalink ) { if ( ! $product_permalink ) {
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;'; echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . '&nbsp;' );
} else { } else {
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ); echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
} }
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
// Meta data. // Meta data.
echo wc_get_formatted_cart_item_data( $cart_item ); echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
// Backorder notification. // Backorder notification.
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) { if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>'; echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>' ) );
} }
?></td> ?>
</td>
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'understrap' ); ?>"> <td class="product-price" data-title="<?php esc_attr_e( 'Price', 'understrap' ); ?>">
<?php <?php
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
?> ?>
</td> </td>
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'understrap' ); ?>"><?php <td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'understrap' ); ?>">
<?php
if ( $_product->is_sold_individually() ) { if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key ); $product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else { } else {
$product_quantity = woocommerce_quantity_input( array( $product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]", 'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'], 'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(), 'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0', 'min_value' => '0',
'product_name' => $_product->get_name(), 'product_name' => $_product->get_name(),
), $_product, false ); ), $_product, false );
} }
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?></td> ?>
</td>
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>"> <td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>">
<?php <?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
?> ?>
</td> </td>
</tr> </tr>
@ -130,16 +135,16 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php if ( wc_coupons_enabled() ) { ?> <?php if ( wc_coupons_enabled() ) { ?>
<div class="coupon"> <div class="coupon">
<label for="coupon_code"><?php esc_html_e( 'Coupon:', 'understrap' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" /> <input type="submit" class="btn btn-outline-primary" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'understrap' ); ?>" /> <label for="coupon_code"><?php esc_html_e( 'Coupon:', 'understrap' ); ?></label> <input type="text" name="coupon_code" class="input-text form-control" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" /> <button type="submit" class="btn btn-outline-primary" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'understrap' ); ?>"><?php esc_attr_e( 'Apply coupon', 'understrap' ); ?></button>
<?php do_action( 'woocommerce_cart_coupon' ); ?> <?php do_action( 'woocommerce_cart_coupon' ); ?>
</div> </div>
<?php } ?> <?php } ?>
<button type="submit" class="btn btn-outline-primary" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'understrap' ); ?>"><?php esc_html_e( 'Update cart', 'understrap' ); ?></button> <button type="submit" class="btn btn-outline-primary" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'understrap' ); ?>"><?php esc_html_e( 'Update cart', 'understrap' ); ?></button>
<?php do_action( 'woocommerce_cart_actions' ); ?> <?php do_action( 'woocommerce_cart_actions' ); ?>
<?php wp_nonce_field( 'woocommerce-cart' ); ?> <?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
</td> </td>
</tr> </tr>