Merge pull request #11556 from woothemes/SiR-DanieL-patch-1
Coding standards and escaping
This commit is contained in:
commit
eff4dea334
|
@ -47,26 +47,26 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
|
|||
*/
|
||||
public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
||||
|
||||
if ( ! empty( $args['hierarchical'] ) )
|
||||
if ( ! empty( $args['hierarchical'] ) ) {
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
else
|
||||
} else {
|
||||
$pad = '';
|
||||
}
|
||||
|
||||
$cat_name = apply_filters( 'list_product_cats', $cat->name, $cat );
|
||||
$value = isset( $args['value'] ) && $args['value'] == 'id' ? $cat->term_id : $cat->slug;
|
||||
$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $value ) . "\"";
|
||||
|
||||
$value = isset( $args['value'] ) && $args['value'] == 'id' ? $cat->term_id : $cat->slug;
|
||||
|
||||
$output .= "\t<option class=\"level-$depth\" value=\"" . $value . "\"";
|
||||
|
||||
if ( $value == $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) )
|
||||
if ( $value === $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) ) {
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
|
||||
$output .= '>';
|
||||
$output .= esc_html( $pad . _x( $cat_name, 'product category name', 'woocommerce' ) );
|
||||
|
||||
$output .= $pad . _x( $cat_name, 'product category name', 'woocommerce' );
|
||||
|
||||
if ( ! empty( $args['show_count'] ) )
|
||||
$output .= ' (' . $cat->count . ')';
|
||||
if ( ! empty( $args['show_count'] ) ) {
|
||||
$output .= ' (' . absint( $cat->count ) . ')';
|
||||
}
|
||||
|
||||
$output .= "</option>\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue