Escape caption in product-images.php
This commit is contained in:
parent
40351f7e63
commit
e1a5bb1f28
|
@ -13,11 +13,11 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.0.14
|
||||
* @version 2.6.3
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
global $post, $product;
|
||||
|
@ -32,7 +32,17 @@ global $post, $product;
|
|||
'title' => $props['title'],
|
||||
'alt' => $props['alt'],
|
||||
) );
|
||||
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $props['url'], $props['caption'], $image ), $post->ID );
|
||||
echo apply_filters(
|
||||
'woocommerce_single_product_image_html',
|
||||
sprintf(
|
||||
'<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto%s">%s</a>',
|
||||
esc_url( $props['url'] ),
|
||||
esc_attr( $props['caption'] ),
|
||||
$gallery,
|
||||
$image
|
||||
),
|
||||
$post->ID
|
||||
);
|
||||
} else {
|
||||
echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="%s" />', wc_placeholder_img_src(), __( 'Placeholder', 'woocommerce' ) ), $post->ID );
|
||||
}
|
||||
|
|
|
@ -42,22 +42,21 @@ if ( $attachment_ids ) {
|
|||
$classes[] = 'last';
|
||||
}
|
||||
|
||||
if ( ! $image_link = wp_get_attachment_url( $attachment_id ) ) {
|
||||
$image_class = implode( ' ', $classes );
|
||||
$props = wc_get_product_attachment_props( $attachment_id, $post );
|
||||
|
||||
if ( ! $props['url'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$props = wc_get_product_attachment_props( $attachment_id, $post );
|
||||
$image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props );
|
||||
$image_class = implode( ' ', $classes );
|
||||
|
||||
echo apply_filters(
|
||||
'woocommerce_single_product_image_thumbnail_html',
|
||||
sprintf(
|
||||
'<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>',
|
||||
$image_link,
|
||||
esc_url( $props['url'] ),
|
||||
esc_attr( $image_class ),
|
||||
esc_attr( $props['caption'] ),
|
||||
$image
|
||||
wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props )
|
||||
),
|
||||
$attachment_id,
|
||||
$post->ID,
|
||||
|
|
Loading…
Reference in New Issue