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

See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-15 17:58:13 +00:00
parent 9b210df2b9
commit 2b125a881b

View File

@ -962,15 +962,15 @@ class Walker_Category extends Walker {
* @param int $id ID of the current category.
*/
function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
extract($args);
$cat_name = esc_attr( $category->name );
/** This filter is documented in wp-includes/category-template.php */
$cat_name = apply_filters( 'list_cats', $cat_name, $category );
$cat_name = apply_filters(
'list_cats',
esc_attr( $category->name ),
$category
);
$link = '<a href="' . esc_url( get_term_link($category) ) . '" ';
if ( $use_desc_for_title == 0 || empty($category->description) ) {
$link = '<a href="' . esc_url( get_term_link( $category ) ) . '" ';
if ( $args['use_desc_for_title'] == 0 || empty( $category->description ) ) {
$link .= '';
} else {
/**
@ -987,47 +987,50 @@ class Walker_Category extends Walker {
$link .= '>';
$link .= $cat_name . '</a>';
if ( !empty($feed_image) || !empty($feed) ) {
if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
$link .= ' ';
if ( empty($feed_image) )
if ( empty( $args['feed_image'] ) ) {
$link .= '(';
}
$link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $feed_type ) ) . '"';
$link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $args['feed_type'] ) ) . '"';
if ( empty($feed) ) {
if ( empty( $args['feed'] ) ) {
$alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
} else {
$alt = ' alt="' . $feed . '"';
$name = $feed;
$link .= $title;
$alt = ' alt="' . $args['feed'] . '"';
$name = $args['feed'];
$link .= $args['title'];
}
$link .= '>';
if ( empty($feed_image) )
if ( empty( $args['feed_image'] ) ) {
$link .= $name;
else
$link .= "<img src='$feed_image'$alt" . ' />';
} else {
$link .= "<img src='" . $args['feed_image'] . "'$alt" . ' />';
}
$link .= '</a>';
if ( empty($feed_image) )
if ( empty( $args['feed_image'] ) ) {
$link .= ')';
}
}
if ( !empty($show_count) )
if ( ! empty( $args['show_count'] ) ) {
$link .= ' (' . number_format_i18n( $category->count ) . ')';
}
if ( 'list' == $args['style'] ) {
$output .= "\t<li";
$class = 'cat-item cat-item-' . $category->term_id;
if ( !empty($current_category) ) {
$_current_category = get_term( $current_category, $category->taxonomy );
if ( $category->term_id == $current_category )
if ( ! empty( $args['current_category'] ) ) {
$_current_category = get_term( $args['current_category'], $category->taxonomy );
if ( $category->term_id == $args['current_category'] ) {
$class .= ' current-cat';
elseif ( $category->term_id == $_current_category->parent )
} elseif ( $category->term_id == $_current_category->parent ) {
$class .= ' current-cat-parent';
}
}
$output .= ' class="' . $class . '"';
$output .= ">$link\n";