Ticket #8828: wp-feed-category.diff
File wp-feed-category.diff, 2.1 KB (added by , 16 years ago) |
---|
-
wp-includes/feed.php
315 315 $categories = get_the_category(); 316 316 $tags = get_the_tags(); 317 317 $the_list = ''; 318 $cat _names = array();318 $cats = array(); 319 319 320 320 $filter = 'rss'; 321 321 if ( 'atom' == $type ) 322 322 $filter = 'raw'; 323 323 324 324 if ( !empty($categories) ) foreach ( (array) $categories as $category ) { 325 $cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); 325 $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); 326 $cats[$cat_name] = $category; 326 327 } 327 328 328 329 if ( !empty($tags) ) foreach ( (array) $tags as $tag ) { 329 $cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); 330 $cat_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); 331 $cats[$cat_name] = $tag; 330 332 } 331 333 332 $cat_names = array_unique($cat_names); 333 334 foreach ( $cat_names as $cat_name ) { 334 foreach ( $cats as $cat_name => $category ) { 335 335 if ( 'rdf' == $type ) 336 336 $the_list .= "\n\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; 337 elseif ( 'atom' == $type ) 338 $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) ); 339 else 340 $the_list .= "\n\t\t<category><![CDATA[" . html_entity_decode( $cat_name ) . "]]></category>\n"; 337 elseif ( 'atom' == $type ) { 338 $blog_url = apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ); 339 $scheme = attribute_escape( $category->taxonomy =='post_tag' ? $blog_url . "/tag/" : $blog_url . "/category/" ); 340 $label = attribute_escape( $cat_name ); 341 $the_list .= "\n\t\t<category scheme=\"$scheme\" term=\"{$category->slug}\" label=\"$label\"/>\n"; 342 } else { 343 $domain = $category->taxonomy =='post_tag' ? "tag" : "category"; 344 $the_list .= "\n\t\t<category domain=\"$domain\"><![CDATA[" . html_entity_decode( $cat_name ) . "]]></category>\n"; 345 } 341 346 } 342 347 343 348 return apply_filters('the_category_rss', $the_list, $type);