meta = $item_meta;
}
/**
* Display meta in a formatted list
*
* @access public
* @param bool $flat (default: false)
* @param bool $return (default: false)
* @param string $hideprefix (default: _)
* @return void
*/
public function display( $flat = false, $return = false, $hideprefix = '_' ) {
global $woocommerce;
if ( ! empty( $this->meta ) ) {
$output = $flat ? '' : '
';
$meta_list = array();
foreach ( $this->meta as $meta_key => $meta_values ) {
if ( empty( $meta_values ) || ( ! empty( $hideprefix ) && substr( $meta_key, 0, 1 ) == $hideprefix ) )
continue;
foreach( $meta_values as $meta_value ) {
// If this is a term slug, get the term's nice name
if ( taxonomy_exists( esc_attr( str_replace( 'attribute_', '', $meta_key ) ) ) ) {
$term = get_term_by('slug', $meta_value, esc_attr( str_replace( 'attribute_', '', $meta_key ) ) );
if ( ! is_wp_error( $term ) && $term->name )
$meta_value = $term->name;
}
if ( $flat )
$meta_list[] = esc_attr( $woocommerce->attribute_label( str_replace( 'attribute_', '', $meta_key ) ) . ': ' . $meta_value );
else
$meta_list[] = '- ' . wp_kses_post( $woocommerce->attribute_label( str_replace( 'attribute_', '', $meta_key ) ) ) . ':
- ' . wp_kses_post( $meta_value ) . '
';
}
}
if ( $flat )
$output .= implode( ", \n", $meta_list );
else
$output .= implode( '', $meta_list );
if ( ! $flat )
$output .= '
';
if ( $return )
return $output;
else
echo $output;
}
}
}