]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/category-template.php
WordPress 3.3.2-scripts
[autoinstalls/wordpress.git] / wp-includes / category-template.php
index 382488ded94ba6ffe26357134c3142f8a9bcce8a..2be9eed7934b096057b5940c48f958e920ead5d4 100644 (file)
@@ -82,7 +82,7 @@ function get_the_category( $id = false ) {
                _make_cat_compat( $categories[$key] );
        }
 
-       // Filter name is plural because we return alot of categories not just one
+       // Filter name is plural because we return alot of categories (possibly more than #13237) not just one
        return apply_filters( 'get_the_categories', $categories );
 }
 
@@ -464,11 +464,14 @@ function wp_list_categories( $args = '' ) {
                                $output .= $show_option_none;
                }
        } else {
-               if( !empty( $show_option_all ) )
+               if ( ! empty( $show_option_all ) ) {
+                       $posts_page = ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) ? get_permalink( get_option( 'page_for_posts' ) ) : home_url( '/' );
+                       $posts_page = esc_url( $posts_page );
                        if ( 'list' == $style )
-                               $output .= '<li><a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a></li>';
+                               $output .= "<li><a href='$posts_page'>$show_option_all</a></li>";
                        else
-                               $output .= '<a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a>';
+                               $output .= "<a href='$posts_page'>$show_option_all</a>";
+               }
 
                if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
                        $current_term_object = get_queried_object();
@@ -533,7 +536,7 @@ function wp_tag_cloud( $args = '' ) {
 
        $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
 
-       if ( empty( $tags ) )
+       if ( empty( $tags ) || is_wp_error( $tags ) )
                return;
 
        foreach ( $tags as $key => $tag ) {
@@ -642,9 +645,9 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
                } else {
                        // SQL cannot save you; this is a second (potentially different) sort on a subset of data.
                        if ( 'name' == $orderby )
-                               uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') );
+                               uasort( $tags, '_wp_object_name_sort_cb' );
                        else
-                               uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
+                               uasort( $tags, '_wp_object_count_sort_cb' );
 
                        if ( 'DESC' == $order )
                                $tags = array_reverse( $tags, true );
@@ -704,22 +707,22 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
 }
 
 /**
- * Callback for comparing tags based on name
+ * Callback for comparing objects based on name
  *
  * @since 3.1.0
  * @access private
  */
-function _wp_tag_cloud_name_sort_cb( $a, $b ) {
+function _wp_object_name_sort_cb( $a, $b ) {
        return strnatcasecmp( $a->name, $b->name );
 }
 
 /**
- * Callback for comparing tags based on count
+ * Callback for comparing objects based on count
  *
  * @since 3.1.0
  * @access private
  */
-function _wp_tag_cloud_count_sort_cb( $a, $b ) {
+function _wp_object_count_sort_cb( $a, $b ) {
        return ( $a->count > $b->count );
 }
 
@@ -1064,8 +1067,6 @@ function term_description( $term = 0, $taxonomy = 'post_tag' ) {
 /**
  * Retrieve the terms of the taxonomy that are attached to the post.
  *
- * This function can only be used within the loop.
- *
  * @since 2.5.0
  *
  * @param int $id Post ID. Is not optional.