WordPress.org

Make WordPress Core

Changeset 28411


Ignore:
Timestamp:
05/15/2014 03:13:44 AM (7 years ago)
Author:
wonderboymusic
Message:

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

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r28410 r28411  
    7171     */
    7272    function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
    73         extract($args);
    74         if ( empty($taxonomy) )
     73        if ( empty( $args['taxonomy'] ) ) {
    7574            $taxonomy = 'category';
    76 
    77         if ( $taxonomy == 'category' )
     75        } else {
     76            $taxonomy = $args['taxonomy'];
     77        }
     78
     79        if ( $taxonomy == 'category' ) {
    7880            $name = 'post_category';
    79         else
    80             $name = 'tax_input['.$taxonomy.']';
    81 
    82         $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
     81        } else {
     82            $name = 'tax_input[' . $taxonomy . ']';
     83        }
     84        $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
     85        $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
     86
     87        $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
    8388
    8489        /** This filter is documented in wp-includes/category-template.php */
    85         $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>';
     90        $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
     91            '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
     92            checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
     93            disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
     94            esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
    8695    }
    8796
Note: See TracChangeset for help on using the changeset viewer.