Make WordPress Core


Ignore:
Timestamp:
05/15/2014 05:57:13 PM (10 years ago)
Author:
wonderboymusic
Message:

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

See #22400.

File:
1 edited

Legend:

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

    r28435 r28436  
    963963     */
    964964    function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
    965         extract($args);
    966 
    967         $cat_name = esc_attr( $category->name );
    968 
    969965        /** This filter is documented in wp-includes/category-template.php */
    970         $cat_name = apply_filters( 'list_cats', $cat_name, $category );
    971 
    972         $link = '<a href="' . esc_url( get_term_link($category) ) . '" ';
    973         if ( $use_desc_for_title == 0 || empty($category->description) ) {
     966        $cat_name = apply_filters(
     967            'list_cats',
     968            esc_attr( $category->name ),
     969            $category
     970        );
     971
     972        $link = '<a href="' . esc_url( get_term_link( $category ) ) . '" ';
     973        if ( $args['use_desc_for_title'] == 0 || empty( $category->description ) ) {
    974974            $link .= '';
    975975        } else {
     
    988988        $link .= $cat_name . '</a>';
    989989
    990         if ( !empty($feed_image) || !empty($feed) ) {
     990        if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
    991991            $link .= ' ';
    992992
    993             if ( empty($feed_image) )
     993            if ( empty( $args['feed_image'] ) ) {
    994994                $link .= '(';
    995 
    996             $link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $feed_type ) ) . '"';
    997 
    998             if ( empty($feed) ) {
     995            }
     996
     997            $link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $args['feed_type'] ) ) . '"';
     998
     999            if ( empty( $args['feed'] ) ) {
    9991000                $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
    10001001            } else {
    1001                 $alt = ' alt="' . $feed . '"';
    1002                 $name = $feed;
    1003                 $link .= $title;
     1002                $alt = ' alt="' . $args['feed'] . '"';
     1003                $name = $args['feed'];
     1004                $link .= $args['title'];
    10041005            }
    10051006
    10061007            $link .= '>';
    10071008
    1008             if ( empty($feed_image) )
     1009            if ( empty( $args['feed_image'] ) ) {
    10091010                $link .= $name;
    1010             else
    1011                 $link .= "<img src='$feed_image'$alt" . ' />';
    1012 
     1011            } else {
     1012                $link .= "<img src='" . $args['feed_image'] . "'$alt" . ' />';
     1013            }
    10131014            $link .= '</a>';
    10141015
    1015             if ( empty($feed_image) )
     1016            if ( empty( $args['feed_image'] ) ) {
    10161017                $link .= ')';
    1017         }
    1018 
    1019         if ( !empty($show_count) )
     1018            }
     1019        }
     1020
     1021        if ( ! empty( $args['show_count'] ) ) {
    10201022            $link .= ' (' . number_format_i18n( $category->count ) . ')';
    1021 
     1023        }
    10221024        if ( 'list' == $args['style'] ) {
    10231025            $output .= "\t<li";
    10241026            $class = 'cat-item cat-item-' . $category->term_id;
    1025             if ( !empty($current_category) ) {
    1026                 $_current_category = get_term( $current_category, $category->taxonomy );
    1027                 if ( $category->term_id == $current_category )
     1027            if ( ! empty( $args['current_category'] ) ) {
     1028                $_current_category = get_term( $args['current_category'], $category->taxonomy );
     1029                if ( $category->term_id == $args['current_category'] ) {
    10281030                    $class .=  ' current-cat';
    1029                 elseif ( $category->term_id == $_current_category->parent )
     1031                } elseif ( $category->term_id == $_current_category->parent ) {
    10301032                    $class .=  ' current-cat-parent';
     1033                }
    10311034            }
    10321035            $output .=  ' class="' . $class . '"';
Note: See TracChangeset for help on using the changeset viewer.