Index: category-template.php
===================================================================
--- category-template.php	(revision 43663)
+++ category-template.php	(working copy)
@@ -364,15 +364,15 @@
 		);
 		$args['taxonomy'] = 'link_category';
 	}
+	// Parse incoming $args into an array and merge it with $defaults
+	$args                 = wp_parse_args( $args, $defaults );
+	$option_none_value = $args['option_none_value'];
 
-	$r                 = wp_parse_args( $args, $defaults );
-	$option_none_value = $r['option_none_value'];
-
-	if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
-		$r['pad_counts'] = true;
+	if ( ! isset( $args['pad_counts'] ) && $args['show_count'] && $args['hierarchical'] ) {
+		$args['pad_counts'] = true;
 	}
 
-	$tab_index = $r['tab_index'];
+	$tab_index = $args['tab_index'];
 
 	$tab_index_attribute = '';
 	if ( (int) $tab_index > 0 ) {
@@ -380,21 +380,21 @@
 	}
 
 	// Avoid clashes with the 'name' param of get_terms().
-	$get_terms_args = $r;
+	$get_terms_args = $args;
 	unset( $get_terms_args['name'] );
-	$categories = get_terms( $r['taxonomy'], $get_terms_args );
+	$categories = get_terms( $args['taxonomy'], $get_terms_args );
 
-	$name     = esc_attr( $r['name'] );
-	$class    = esc_attr( $r['class'] );
-	$id       = $r['id'] ? esc_attr( $r['id'] ) : $name;
-	$required = $r['required'] ? 'required' : '';
+	$name     = esc_attr( $args['name'] );
+	$class    = esc_attr( $args['class'] );
+	$id       = $args['id'] ? esc_attr( $args['id'] ) : $name;
+	$required = $args['required'] ? 'required' : '';
 
-	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
+	if ( ! $args['hide_if_empty'] || ! empty( $categories ) ) {
 		$output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n";
 	} else {
 		$output = '';
 	}
-	if ( empty( $categories ) && ! $r['hide_if_empty'] && ! empty( $r['show_option_none'] ) ) {
+	if ( empty( $categories ) && ! $args['hide_if_empty'] && ! empty( $args['show_option_none'] ) ) {
 
 		/**
 		 * Filters a taxonomy drop-down display element.
@@ -411,30 +411,30 @@
 		 * @param string       $element  Category name.
 		 * @param WP_Term|null $category The category object, or null if there's no corresponding category.
 		 */
-		$show_option_none = apply_filters( 'list_cats', $r['show_option_none'], null );
+		$show_option_none = apply_filters( 'list_cats', $args['show_option_none'], null );
 		$output          .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
 	}
 
 	if ( ! empty( $categories ) ) {
 
-		if ( $r['show_option_all'] ) {
+		if ( $args['show_option_all'] ) {
 
 			/** This filter is documented in wp-includes/category-template.php */
-			$show_option_all = apply_filters( 'list_cats', $r['show_option_all'], null );
-			$selected        = ( '0' === strval( $r['selected'] ) ) ? " selected='selected'" : '';
+			$show_option_all = apply_filters( 'list_cats', $args['show_option_all'], null );
+			$selected        = ( '0' === strval( $args['selected'] ) ) ? " selected='selected'" : '';
 			$output         .= "\t<option value='0'$selected>$show_option_all</option>\n";
 		}
 
-		if ( $r['show_option_none'] ) {
+		if ( $args['show_option_none'] ) {
 
 			/** This filter is documented in wp-includes/category-template.php */
-			$show_option_none = apply_filters( 'list_cats', $r['show_option_none'], null );
-			$selected         = selected( $option_none_value, $r['selected'], false );
+			$show_option_none = apply_filters( 'list_cats', $args['show_option_none'], null );
+			$selected         = selected( $option_none_value, $args['selected'], false );
 			$output          .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
 		}
 
-		if ( $r['hierarchical'] ) {
-			$depth = $r['depth'];  // Walk the full depth.
+		if ( $args['hierarchical'] ) {
+			$depth = $args['depth'];  // Walk the full depth.
 		} else {
 			$depth = -1; // Flat.
 		}
@@ -441,7 +441,7 @@
 		$output .= walk_category_dropdown_tree( $categories, $depth, $r );
 	}
 
-	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
+	if ( ! $args['hide_if_empty'] || ! empty( $categories ) ) {
 		$output .= "</select>\n";
 	}
 	/**
@@ -454,7 +454,7 @@
 	 */
 	$output = apply_filters( 'wp_dropdown_cats', $output, $r );
 
-	if ( $r['echo'] ) {
+	if ( $args['echo'] ) {
 		echo $output;
 	}
 	return $output;
@@ -537,48 +537,49 @@
 		'use_desc_for_title'  => 1,
 	);
 
-	$r = wp_parse_args( $args, $defaults );
+	// Parse incoming $args into an array and merge it with $defaults
+	$args = wp_parse_args( $args, $defaults );
 
-	if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
-		$r['pad_counts'] = true;
+	if ( ! isset( $args['pad_counts'] ) && $args['show_count'] && $args['hierarchical'] ) {
+		$args['pad_counts'] = true;
 	}
 
 	// Descendants of exclusions should be excluded too.
-	if ( true == $r['hierarchical'] ) {
+	if ( true == $args['hierarchical'] ) {
 		$exclude_tree = array();
 
-		if ( $r['exclude_tree'] ) {
-			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude_tree'] ) );
+		if ( $args['exclude_tree'] ) {
+			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $args['exclude_tree'] ) );
 		}
 
-		if ( $r['exclude'] ) {
-			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude'] ) );
+		if ( $args['exclude'] ) {
+			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $args['exclude'] ) );
 		}
 
-		$r['exclude_tree'] = $exclude_tree;
-		$r['exclude']      = '';
+		$args['exclude_tree'] = $exclude_tree;
+		$args['exclude']      = '';
 	}
 
-	if ( ! isset( $r['class'] ) ) {
-		$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
+	if ( ! isset( $args['class'] ) ) {
+		$args['class'] = ( 'category' == $args['taxonomy'] ) ? 'categories' : $args['taxonomy'];
 	}
 
-	if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
+	if ( ! taxonomy_exists( $args['taxonomy'] ) ) {
 		return false;
 	}
 
-	$show_option_all  = $r['show_option_all'];
-	$show_option_none = $r['show_option_none'];
+	$show_option_all  = $args['show_option_all'];
+	$show_option_none = $args['show_option_none'];
 
 	$categories = get_categories( $r );
 
 	$output = '';
-	if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
-		$output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>';
+	if ( $args['title_li'] && 'list' == $args['style'] && ( ! empty( $categories ) || ! $args['hide_title_if_empty'] ) ) {
+		$output = '<li class="' . esc_attr( $args['class'] ) . '">' . $args['title_li'] . '<ul>';
 	}
 	if ( empty( $categories ) ) {
 		if ( ! empty( $show_option_none ) ) {
-			if ( 'list' == $r['style'] ) {
+			if ( 'list' == $args['style'] ) {
 				$output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
 			} else {
 				$output .= $show_option_none;
@@ -590,7 +591,7 @@
 			$posts_page = '';
 
 			// For taxonomies that belong only to custom post types, point to a valid archive.
-			$taxonomy_object = get_taxonomy( $r['taxonomy'] );
+			$taxonomy_object = get_taxonomy( $args['taxonomy'] );
 			if ( ! in_array( 'post', $taxonomy_object->object_type ) && ! in_array( 'page', $taxonomy_object->object_type ) ) {
 				foreach ( $taxonomy_object->object_type as $object_type ) {
 					$_object_type = get_post_type_object( $object_type );
@@ -613,7 +614,7 @@
 			}
 
 			$posts_page = esc_url( $posts_page );
-			if ( 'list' == $r['style'] ) {
+			if ( 'list' == $args['style'] ) {
 				$output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
 			} else {
 				$output .= "<a href='$posts_page'>$show_option_all</a>";
@@ -620,15 +621,15 @@
 			}
 		}
 
-		if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
+		if ( empty( $args['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
 			$current_term_object = get_queried_object();
-			if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) {
-				$r['current_category'] = get_queried_object_id();
+			if ( $current_term_object && $args['taxonomy'] === $current_term_object->taxonomy ) {
+				$args['current_category'] = get_queried_object_id();
 			}
 		}
 
-		if ( $r['hierarchical'] ) {
-			$depth = $r['depth'];
+		if ( $args['hierarchical'] ) {
+			$depth = $args['depth'];
 		} else {
 			$depth = -1; // Flat.
 		}
@@ -635,7 +636,7 @@
 		$output .= walk_category_tree( $categories, $depth, $r );
 	}
 
-	if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
+	if ( $args['title_li'] && 'list' == $args['style'] && ( ! empty( $categories ) || ! $args['hide_title_if_empty'] ) ) {
 		$output .= '</ul></li>';
 	}
 
@@ -649,7 +650,7 @@
 	 */
 	$html = apply_filters( 'wp_list_categories', $output, $args );
 
-	if ( $r['echo'] ) {
+	if ( $args['echo'] ) {
 		echo $html;
 	} else {
 		return $html;
