Merge pull request #11556 from woothemes/SiR-DanieL-patch-1

Coding standards and escaping
This commit is contained in:
Claudio Sanches 2016-07-29 11:43:35 -03:00 committed by GitHub
commit eff4dea334
1 changed files with 11 additions and 11 deletions

View File

@ -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 .= '&nbsp;(' . $cat->count . ')';
if ( ! empty( $args['show_count'] ) ) {
$output .= '&nbsp;(' . absint( $cat->count ) . ')';
}
$output .= "</option>\n";
}