12518 Sanitizing and brackets

This commit is contained in:
Claudiu Lodromanean 2017-01-19 15:48:15 -08:00
parent b977784a66
commit 9f94b7d51d
1 changed files with 20 additions and 10 deletions

View File

@ -43,22 +43,32 @@ if ( ! defined( 'ABSPATH' ) ) {
<td><?php
$values = array();
if ( $attribute->is_taxonomy() ) :
if ( $attribute->is_taxonomy() ) {
$attribute_taxonomy = $attribute->get_taxonomy_object();
$attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) );
foreach ( $attribute_values as $attribute_value ) :
if ( $attribute_taxonomy->attribute_public ) :
$values[] = '<a href="' . esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $attribute_value->name . '</a>';
else:
$values[] = $attribute_value->name;
endif;
endforeach;
foreach ( $attribute_values as $attribute_value ) {
$value_name = esc_html( $attribute_value->name );
if ( $attribute_taxonomy->attribute_public ) {
$values[] = '<a href="' . esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $value_name . '</a>';
} else {
$values[] = $value_name;
}
}
} else {
else :
$values = $attribute->get_options();
endif;
foreach ( $values as &$value ) {
$value = esc_html( $value );
}
}
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
?></td>