Eliminate use of extract() in Walker_Category_Checklist::start_el().

See #22400.

Built from https://develop.svn.wordpress.org/trunk@28411


git-svn-id: http://core.svn.wordpress.org/trunk@28238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-15 03:14:14 +00:00
parent 7ebab48f4c
commit a7a6cb5bef

View File

@ -70,19 +70,28 @@ class Walker_Category_Checklist extends Walker {
* @param int $id ID of the current term. * @param int $id ID of the current term.
*/ */
function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
extract($args); if ( empty( $args['taxonomy'] ) ) {
if ( empty($taxonomy) )
$taxonomy = 'category'; $taxonomy = 'category';
} else {
$taxonomy = $args['taxonomy'];
}
if ( $taxonomy == 'category' ) if ( $taxonomy == 'category' ) {
$name = 'post_category'; $name = 'post_category';
else } else {
$name = 'tax_input['.$taxonomy.']'; $name = 'tax_input[' . $taxonomy . ']';
}
$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
$class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : ''; $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
/** This filter is documented in wp-includes/category-template.php */ /** This filter is documented in wp-includes/category-template.php */
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
} }
/** /**