Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 16050)
+++ wp-includes/taxonomy.php	(working copy)
@@ -21,8 +21,9 @@
 		'query_var' => 'category_name',
 		'rewrite' => array(
 					'hierarchical' => true,
-					'slug' => get_option('category_base') ? get_option('category_base') : 'category',
-					'with_front' => false),
+					'slug' => get_option( 'category_base' ) ? get_option( 'category_base' ) : 'category',
+					'with_front' => false
+		),
 		'public' => true,
 		'show_ui' => true,
 		'_builtin' => true,
@@ -33,8 +34,9 @@
 		'update_count_callback' => '_update_post_term_count',
 		'query_var' => 'tag',
 		'rewrite' => array(
-					'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag' ,
-					'with_front' => false),
+					'slug' => get_option( 'tag_base' ) ? get_option( 'tag_base' ) : 'tag',
+					'with_front' => false
+		),
 		'public' => true,
 		'show_ui' => true,
 		'_builtin' => true,
@@ -52,7 +54,7 @@
 		'show_ui' => false,
 		'_builtin' => true,
 		'show_in_nav_menus' => false,
-	) ) ;
+	) );
 
 	register_taxonomy( 'link_category', 'link', array(
 		'hierarchical' => false,
@@ -75,9 +77,9 @@
 		'public' => false,
 		'show_ui' => false,
 		'_builtin' => true,
-	) ) ;
+	) );
 
-	register_taxonomy( 'post_format', array('post', 'page', 'attachment'), array(
+	register_taxonomy( 'post_format', array( 'post', 'page', 'attachment' ), array(
 		'public' => false,
 		'hierarchical' => false,
 		'labels' => array(
@@ -89,7 +91,7 @@
 		'show_ui' => false,
 		'_builtin' => true,
 		'show_in_nav_menus' => false,
-	) ) ;
+	) );
 }
 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
 
@@ -111,9 +113,9 @@
 function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
 	global $wp_taxonomies;
 
-	$field = ('names' == $output) ? 'name' : false;
+	$field = ( 'names' == $output ) ? 'name' : false;
 
-	return wp_filter_object_list($wp_taxonomies, $args, $operator, $field);
+	return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field );
 }
 
 
@@ -136,12 +138,12 @@
  * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default.
  * @return array The names of all taxonomy of $object_type.
  */
-function get_object_taxonomies($object, $output = 'names') {
+function get_object_taxonomies( $object, $output = 'names' ) {
 	global $wp_taxonomies;
 
-	if ( is_object($object) ) {
+	if ( is_object( $object ) ) {
 		if ( $object->post_type == 'attachment' )
-			return get_attachment_taxonomies($object);
+			return get_attachment_taxonomies( $object );
 		$object = $object->post_type;
 	}
 
@@ -149,7 +151,7 @@
 
 	$taxonomies = array();
 	foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) {
-		if ( array_intersect($object, (array) $tax_obj->object_type) ) {
+		if ( array_intersect( $object, (array) $tax_obj->object_type ) ) {
 			if ( 'names' == $output )
 				$taxonomies[] = $tax_name;
 			else
@@ -223,11 +225,11 @@
  * @param string $taxonomy Name of taxonomy object
  * @return bool Whether the taxonomy is hierarchical
  */
-function is_taxonomy_hierarchical($taxonomy) {
-	if ( ! taxonomy_exists($taxonomy) )
+function is_taxonomy_hierarchical( $taxonomy ) {
+	if ( ! taxonomy_exists( $taxonomy ) )
 		return false;
 
-	$taxonomy = get_taxonomy($taxonomy);
+	$taxonomy = get_taxonomy( $taxonomy );
 	return $taxonomy->hierarchical;
 }
 
@@ -286,7 +288,7 @@
 function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
 	global $wp_taxonomies, $wp_rewrite, $wp;
 
-	if ( ! is_array($wp_taxonomies) )
+	if ( ! is_array( $wp_taxonomies ) )
 		$wp_taxonomies = array();
 
 	$defaults = array(	'hierarchical' => false,
@@ -301,39 +303,39 @@
 						'capabilities' => array(),
 						'show_in_nav_menus' => null,
 					);
-	$args = wp_parse_args($args, $defaults);
+	$args = wp_parse_args( $args, $defaults );
 
-	if ( false !== $args['query_var'] && !empty($wp) ) {
+	if ( false !== $args['query_var'] && !empty( $wp ) ) {
 		if ( true === $args['query_var'] )
 			$args['query_var'] = $taxonomy;
-		$args['query_var'] = sanitize_title_with_dashes($args['query_var']);
-		$wp->add_query_var($args['query_var']);
+		$args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
+		$wp->add_query_var( $args['query_var'] );
 	}
 
-	if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') && !empty($wp_rewrite) ) {
-		$args['rewrite'] = wp_parse_args($args['rewrite'], array(
-			'slug' => sanitize_title_with_dashes($taxonomy),
+	if ( false !== $args['rewrite'] && '' != get_option( 'permalink_structure' ) && !empty( $wp_rewrite ) ) {
+		$args['rewrite'] = wp_parse_args( $args['rewrite'], array(
+			'slug' => sanitize_title_with_dashes( $taxonomy ),
 			'with_front' => true,
 			'hierarchical' => false
-		));
+		) );
 
 		if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] )
 			$tag = '(.+?)';
 		else
 			$tag = '([^/]+)';
 
-		$wp_rewrite->add_rewrite_tag("%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=");
-		$wp_rewrite->add_permastruct($taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front']);
+		$wp_rewrite->add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" );
+		$wp_rewrite->add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite']['with_front'] );
 	}
 
-	if ( is_null($args['show_ui']) )
+	if ( is_null( $args['show_ui'] ) )
 		$args['show_ui'] = $args['public'];
 
 	// Whether to show this type in nav-menus.php. Defaults to the setting for public.
 	if ( null === $args['show_in_nav_menus'] )
 		$args['show_in_nav_menus'] = $args['public'];
 
-	if ( is_null($args['show_tagcloud']) )
+	if ( is_null( $args['show_tagcloud'] ) )
 		$args['show_tagcloud'] = $args['show_ui'];
 
 	$default_caps = array(
@@ -354,7 +356,7 @@
 	$wp_taxonomies[$taxonomy] = (object) $args;
 
 	// register callback handling for metabox
- 	add_filter('wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term');
+ 	add_filter( 'wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term' );
 }
 
 /**
@@ -419,13 +421,13 @@
  * @param array|string $object_type Name of the object type
  * @return bool True if successful, false if not
  */
-function register_taxonomy_for_object_type( $taxonomy, $object_type) {
+function register_taxonomy_for_object_type( $taxonomy, $object_type ) {
 	global $wp_taxonomies;
 
-	if ( !isset($wp_taxonomies[$taxonomy]) )
+	if ( !isset( $wp_taxonomies[$taxonomy] ) )
 		return false;
 
-	if ( ! get_post_type_object($object_type) )
+	if ( ! get_post_type_object( $object_type ) )
 		return false;
 
 	$wp_taxonomies[$taxonomy]->object_type[] = $object_type;
@@ -536,7 +538,7 @@
 			foreach ( $terms as $i => $term ) {
 				$terms[$i] = sanitize_title_for_query( $term );
 			}
-			$terms = array_filter($terms);
+			$terms = array_filter( $terms );
 
 			$terms = "'" . implode( "','", $terms ) . "'";
 			$sql = "
@@ -593,46 +595,46 @@
  * @return mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not
  * exist then WP_Error will be returned.
  */
-function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
+function &get_term( $term, $taxonomy, $output = OBJECT, $filter = 'raw' ) {
 	global $wpdb;
 	$null = null;
 
-	if ( empty($term) ) {
-		$error = new WP_Error('invalid_term', __('Empty Term'));
+	if ( empty( $term ) ) {
+		$error = new WP_Error( 'invalid_term', __( 'Empty Term' ) );
 		return $error;
 	}
 
-	if ( ! taxonomy_exists($taxonomy) ) {
-		$error = new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+	if ( ! taxonomy_exists( $taxonomy ) ) {
+		$error = new WP_Error( 'invalid_taxonomy', __( 'Invalid Taxonomy' ) );
 		return $error;
 	}
 
-	if ( is_object($term) && empty($term->filter) ) {
-		wp_cache_add($term->term_id, $term, $taxonomy);
+	if ( is_object( $term ) && empty( $term->filter ) ) {
+		wp_cache_add( $term->term_id, $term, $taxonomy );
 		$_term = $term;
 	} else {
-		if ( is_object($term) )
+		if ( is_object( $term ) )
 			$term = $term->term_id;
 		$term = (int) $term;
-		if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
-			$_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) );
+		if ( ! $_term = wp_cache_get( $term, $taxonomy ) ) {
+			$_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term ) );
 			if ( ! $_term )
 				return $null;
-			wp_cache_add($term, $_term, $taxonomy);
+			wp_cache_add( $term, $_term, $taxonomy );
 		}
 	}
 
-	$_term = apply_filters('get_term', $_term, $taxonomy);
-	$_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
-	$_term = sanitize_term($_term, $taxonomy, $filter);
+	$_term = apply_filters( 'get_term', $_term, $taxonomy );
+	$_term = apply_filters( "get_$taxonomy", $_term, $taxonomy );
+	$_term = sanitize_term( $_term, $taxonomy, $filter );
 
 	if ( $output == OBJECT ) {
 		return $_term;
 	} elseif ( $output == ARRAY_A ) {
-		$__term = get_object_vars($_term);
+		$__term = get_object_vars( $_term );
 		return $__term;
 	} elseif ( $output == ARRAY_N ) {
-		$__term = array_values(get_object_vars($_term));
+		$__term = array_values( get_object_vars( $_term ) );
 		return $__term;
 	} else {
 		return $_term;
@@ -666,41 +668,41 @@
  * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
  * @return mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found.
  */
-function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
+function get_term_by( $field, $value, $taxonomy, $output = OBJECT, $filter = 'raw' ) {
 	global $wpdb;
 
-	if ( ! taxonomy_exists($taxonomy) )
+	if ( ! taxonomy_exists( $taxonomy ) )
 		return false;
 
 	if ( 'slug' == $field ) {
 		$field = 't.slug';
-		$value = sanitize_title($value);
-		if ( empty($value) )
+		$value = sanitize_title( $value );
+		if ( empty( $value ) )
 			return false;
 	} else if ( 'name' == $field ) {
 		// Assume already escaped
-		$value = stripslashes($value);
+		$value = stripslashes( $value );
 		$field = 't.name';
 	} else {
-		return get_term( (int) $value, $taxonomy, $output, $filter);
+		return get_term( (int) $value, $taxonomy, $output, $filter );
 	}
 
-	$term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
+	$term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value ) );
 	if ( !$term )
 		return false;
 
-	wp_cache_add($term->term_id, $term, $taxonomy);
+	wp_cache_add( $term->term_id, $term, $taxonomy );
 
-	$term = apply_filters('get_term', $term, $taxonomy);
-	$term = apply_filters("get_$taxonomy", $term, $taxonomy);
-	$term = sanitize_term($term, $taxonomy, $filter);
+	$term = apply_filters( 'get_term', $term, $taxonomy );
+	$term = apply_filters( "get_$taxonomy", $term, $taxonomy );
+	$term = sanitize_term( $term, $taxonomy, $filter );
 
 	if ( $output == OBJECT ) {
 		return $term;
 	} elseif ( $output == ARRAY_A ) {
-		return get_object_vars($term);
+		return get_object_vars( $term );
 	} elseif ( $output == ARRAY_N ) {
-		return array_values(get_object_vars($term));
+		return array_values( get_object_vars( $term ) );
 	} else {
 		return $term;
 	}
@@ -727,21 +729,21 @@
  * @return array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist
  */
 function get_term_children( $term_id, $taxonomy ) {
-	if ( ! taxonomy_exists($taxonomy) )
-		return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+	if ( ! taxonomy_exists( $taxonomy ) )
+		return new WP_Error( 'invalid_taxonomy', __( 'Invalid Taxonomy' ) );
 
 	$term_id = intval( $term_id );
 
-	$terms = _get_term_hierarchy($taxonomy);
+	$terms = _get_term_hierarchy( $taxonomy );
 
-	if ( ! isset($terms[$term_id]) )
+	if ( ! isset( $terms[$term_id] ) )
 		return array();
 
 	$children = $terms[$term_id];
 
 	foreach ( (array) $terms[$term_id] as $child ) {
-		if ( isset($terms[$child]) )
-			$children = array_merge($children, get_term_children($child, $taxonomy));
+		if ( isset( $terms[$child] ) )
+			$children = array_merge( $children, get_term_children( $child, $taxonomy ) );
 	}
 
 	return $children;
@@ -769,16 +771,16 @@
 function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
 	$term = (int) $term;
 	$term = get_term( $term, $taxonomy );
-	if ( is_wp_error($term) )
+	if ( is_wp_error( $term ) )
 		return $term;
 
-	if ( !is_object($term) )
+	if ( !is_object( $term ) )
 		return '';
 
-	if ( !isset($term->$field) )
+	if ( !isset( $term->$field ) )
 		return '';
 
-	return sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context);
+	return sanitize_term_field( $field, $term->$field, $term->term_id, $taxonomy, $context );
 }
 
 /**
@@ -800,13 +802,13 @@
 function get_term_to_edit( $id, $taxonomy ) {
 	$term = get_term( $id, $taxonomy );
 
-	if ( is_wp_error($term) )
+	if ( is_wp_error( $term ) )
 		return $term;
 
-	if ( !is_object($term) )
+	if ( !is_object( $term ) )
 		return '';
 
-	return sanitize_term($term, $taxonomy, 'edit');
+	return sanitize_term( $term, $taxonomy, 'edit' );
 }
 
 /**
