Changeset 6365
- Timestamp:
- 12/06/2007 07:58:15 PM (17 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/author-template.php
r6364 r6365 367 367 'optioncount' => false, 'exclude_admin' => true, 368 368 'show_fullname' => false, 'hide_empty' => true, 369 'feed' => '', 'feed_image' => '', ' echo' => true369 'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true 370 370 ); 371 371 -
trunk/wp-includes/category-template.php
r6364 r6365 248 248 'style' => 'list', 'show_count' => 0, 249 249 'hide_empty' => 1, 'use_desc_for_title' => 1, 250 'child_of' => 0, 'feed' => '', 250 'child_of' => 0, 'feed' => '', 'feed_type' => '', 251 251 'feed_image' => '', 'exclude' => '', 252 252 'hierarchical' => true, 'title_li' => __('Categories'), -
trunk/wp-includes/classes.php
r6320 r6365 600 600 $link .= '('; 601 601 602 $link .= '<a href="' . get_category_ rss_link( 0, $category->term_id, $category->slug) . '"';602 $link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"'; 603 603 604 604 if ( empty($feed) ) -
trunk/wp-includes/deprecated.php
r6160 r6365 730 730 } 731 731 732 733 function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') { 734 post_comments_feed_link($link_text); 735 } 736 737 function get_category_rss_link($echo = false, $cat_ID, $deprecated = '') { 738 $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 739 740 if ( $echo ) 741 echo $link; 742 return $link; 743 } 744 745 function get_author_rss_link($echo = false, $author_id, $deprecated = '') { 746 $link = get_author_feed_link($author_id); 747 if ( $echo ) 748 echo $link; 749 return $link; 750 } 751 732 752 ?> -
trunk/wp-includes/feed.php
r6364 r6365 6 6 } 7 7 8 9 8 function bloginfo_rss($show = '') { 10 9 echo apply_filters('bloginfo_rss', get_bloginfo_rss($show)); 10 } 11 12 function get_default_feed() { 13 return apply_filters('default_feed', 'rss2'); 11 14 } 12 15 … … 81 84 } 82 85 83 84 86 function get_comment_author_rss() { 85 87 return apply_filters('comment_author_rss', get_comment_author() ); 86 88 } 87 89 88 89 90 function comment_author_rss() { 90 91 echo get_comment_author_rss(); 91 92 } 92 93 93 94 94 function comment_text_rss() { … … 98 98 } 99 99 100 101 function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') {102 $url = get_post_comments_feed_link();103 echo "<a href='$url'>$link_text</a>";104 }105 106 107 100 function comments_rss($deprecated = '') { 108 101 return get_post_comments_feed_link(); 109 102 } 110 111 112 function get_author_rss_link($echo = false, $author_id, $author_nicename) {113 $author_id = (int) $author_id;114 $permalink_structure = get_option('permalink_structure');115 116 if ( '' == $permalink_structure ) {117 $link = get_option('home') . '?feed=rss2&author=' . $author_id;118 } else {119 $link = get_author_posts_url($author_id, $author_nicename);120 $link = trailingslashit($link) . user_trailingslashit('feed', 'feed');121 }122 123 $link = apply_filters('author_feed_link', $link);124 125 if ( $echo )126 echo $link;127 return $link;128 }129 130 /** get_category_feed_link() - Get the feed link for a given category131 *132 * Returns a link to the feed for all post in a given category. A specific feed can be requested133 * or left blank to get the default feed.134 *135 * @package WordPress136 * @subpackage Feed137 * @since 2.4138 *139 * @param int $cat_id ID of a category140 * @param string $feed Feed type141 * @return string Link to the feed for the category specified by $cat_id142 */143 function get_category_feed_link($cat_id, $feed = 'rss2') {144 $cat_id = (int) $cat_id;145 146 $category = get_category($cat_id);147 148 if ( empty($category) || is_wp_error($category) )149 return false;150 151 $permalink_structure = get_option('permalink_structure');152 153 if ( '' == $permalink_structure ) {154 $link = get_option('home') . "?feed=$feed&cat=" . $cat_id;155 } else {156 $link = get_category_link($cat_id);157 if( 'rss2' == $feed )158 $feed_link = 'feed';159 else160 $feed_link = "feed/$feed";161 162 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');163 }164 165 $link = apply_filters('category_feed_link', $link, $feed);166 167 return $link;168 }169 170 171 function get_category_rss_link($echo = false, $cat_ID, $deprecated = '') {172 $link = get_category_feed_link($cat_ID, 'rss2');173 174 if ( $echo )175 echo $link;176 return $link;177 }178 179 103 180 104 function get_the_category_rss($type = 'rss') { … … 210 134 } 211 135 212 213 136 function the_category_rss($type = 'rss') { 214 137 echo get_the_category_rss($type); 215 }216 217 function get_tag_feed_link($tag_id, $feed = 'rss2') {218 $tag_id = (int) $tag_id;219 220 $tag = get_tag($tag_id);221 222 if ( empty($tag) || is_wp_error($tag) )223 return false;224 225 $permalink_structure = get_option('permalink_structure');226 227 if ( '' == $permalink_structure ) {228 $link = get_option('home') . "?feed=$feed&tag=" . $tag->slug;229 } else {230 $link = get_tag_link($tag->term_id);231 if ( 'rss2' == $feed )232 $feed_link = 'feed';233 else234 $feed_link = "feed/$feed";235 $link = $link . user_trailingslashit($feed_link, 'feed');236 }237 238 $link = apply_filters('tag_feed_link', $link, $feed);239 240 return $link;241 138 } 242 139 -
trunk/wp-includes/functions.php
r6364 r6365 864 864 865 865 if ( $feed == '' || $feed == 'feed' ) 866 $feed = 'rss2';866 $feed = get_default_feed(); 867 867 868 868 $hook = 'do_feed_' . $feed; -
trunk/wp-includes/link-template.php
r6364 r6365 231 231 } 232 232 233 function get_feed_link($feed ='rss2') {233 function get_feed_link($feed = '') { 234 234 global $wp_rewrite; 235 235 … … 241 241 } 242 242 243 if ( 'rss2'== $feed )243 if ( get_default_feed() == $feed ) 244 244 $feed = ''; 245 245 … … 248 248 $output = get_option('home') . user_trailingslashit($permalink, 'feed'); 249 249 } else { 250 if ( empty($feed) ) 251 $feed = get_default_feed(); 252 250 253 if ( false !== strpos($feed, 'comments_') ) 251 254 $feed = str_replace('comments_', 'comments-', $feed); … … 257 260 } 258 261 259 function get_post_comments_feed_link($post_id = '', $feed = ' rss2') {262 function get_post_comments_feed_link($post_id = '', $feed = '') { 260 263 global $id; 261 264 … … 263 266 $post_id = (int) $id; 264 267 268 if ( empty($feed) ) 269 $feed = get_default_feed(); 270 265 271 if ( '' != get_option('permalink_structure') ) { 266 272 $url = trailingslashit( get_permalink($post_id) ) . 'feed'; 267 if ( 'rss2' != $feed)273 if ( $feed != get_default_feed() ) 268 274 $url .= "/$feed"; 269 275 $url = user_trailingslashit($url, 'single_feed'); … … 277 283 278 284 return apply_filters('post_comments_feed_link', $url); 285 } 286 287 /** post_comments_feed_link() - Output the comment feed link for a post. 288 * 289 * Prints out the comment feed link for a post. Link text is placed in the 290 * anchor. If no link text is specified, default text is used. If no post ID 291 * is specified, the current post is used. 292 * 293 * @package WordPress 294 * @subpackage Feed 295 * @since 2.4 296 * 297 * @param string Descriptive text 298 * @param int Optional post ID. Default to current post. 299 * @return string Link to the comment feed for the current post 300 */ 301 function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { 302 $url = get_post_comments_feed_link($post_id, $feed); 303 if ( empty($link_text) ) 304 $link_text = __('Comments Feed'); 305 306 echo "<a href='$url'>$link_text</a>"; 307 } 308 309 function get_author_feed_link( $author_id, $feed = '' ) { 310 $author_id = (int) $author_id; 311 $permalink_structure = get_option('permalink_structure'); 312 313 if ( empty($feed) ) 314 $feed = get_default_feed(); 315 316 if ( '' == $permalink_structure ) { 317 $link = get_option('home') . '?feed=rss2&author=' . $author_id; 318 } else { 319 $link = get_author_posts_url($author_id, $author_nicename); 320 $link = trailingslashit($link) . user_trailingslashit('feed', 'feed'); 321 } 322 323 $link = apply_filters('author_feed_link', $link); 324 325 return $link; 326 } 327 328 /** get_category_feed_link() - Get the feed link for a given category 329 * 330 * Returns a link to the feed for all post in a given category. A specific feed can be requested 331 * or left blank to get the default feed. 332 * 333 * @package WordPress 334 * @subpackage Feed 335 * @since 2.4 336 * 337 * @param int $cat_id ID of a category 338 * @param string $feed Feed type 339 * @return string Link to the feed for the category specified by $cat_id 340 */ 341 function get_category_feed_link($cat_id, $feed = '') { 342 $cat_id = (int) $cat_id; 343 344 $category = get_category($cat_id); 345 346 if ( empty($category) || is_wp_error($category) ) 347 return false; 348 349 if ( empty($feed) ) 350 $feed = get_default_feed(); 351 352 $permalink_structure = get_option('permalink_structure'); 353 354 if ( '' == $permalink_structure ) { 355 $link = get_option('home') . "?feed=$feed&cat=" . $cat_id; 356 } else { 357 $link = get_category_link($cat_id); 358 if( $feed == get_default_feed() ) 359 $feed_link = 'feed'; 360 else 361 $feed_link = "feed/$feed"; 362 363 $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 364 } 365 366 $link = apply_filters('category_feed_link', $link, $feed); 367 368 return $link; 369 } 370 371 function get_tag_feed_link($tag_id, $feed = '') { 372 $tag_id = (int) $tag_id; 373 374 $tag = get_tag($tag_id); 375 376 if ( empty($tag) || is_wp_error($tag) ) 377 return false; 378 379 $permalink_structure = get_option('permalink_structure'); 380 381 if ( empty($feed) ) 382 $feed = get_default_feed(); 383 384 if ( '' == $permalink_structure ) { 385 $link = get_option('home') . "?feed=$feed&tag=" . $tag->slug; 386 } else { 387 $link = get_tag_link($tag->term_id); 388 if ( $feed == get_default_feed() ) 389 $feed_link = 'feed'; 390 else 391 $feed_link = "feed/$feed"; 392 $link = $link . user_trailingslashit($feed_link, 'feed'); 393 } 394 395 $link = apply_filters('tag_feed_link', $link, $feed); 396 397 return $link; 279 398 } 280 399
Note: See TracChangeset
for help on using the changeset viewer.