WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/06/2007 07:58:15 PM (13 years ago)
Author:
ryan
Message:

New feed_link functions. Deprecate rss_link functions. Make default feed pluggable. Props rubys. see #5328

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/feed.php

    r6364 r6365  
    66}
    77
    8 
    98function bloginfo_rss($show = '') {
    109    echo apply_filters('bloginfo_rss', get_bloginfo_rss($show));
     10}
     11
     12function get_default_feed() {
     13    return apply_filters('default_feed', 'rss2');
    1114}
    1215
     
    8184}
    8285
    83 
    8486function get_comment_author_rss() {
    8587    return apply_filters('comment_author_rss', get_comment_author() );
    8688}
    8789
    88 
    8990function comment_author_rss() {
    9091    echo get_comment_author_rss();
    9192}
    92 
    9393
    9494function comment_text_rss() {
     
    9898}
    9999
    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 
    107100function comments_rss($deprecated = '') {
    108101    return get_post_comments_feed_link();
    109102}
    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&amp;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 category
    131  *
    132  * Returns a link to the feed for all post in a given category.  A specific feed can be requested
    133  * or left blank to get the default feed.
    134  *
    135  * @package WordPress
    136  * @subpackage Feed
    137  * @since 2.4
    138  *
    139  * @param int $cat_id ID of a category
    140  * @param string $feed Feed type
    141  * @return string Link to the feed for the category specified by $cat_id
    142 */
    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&amp;cat=" . $cat_id;
    155     } else {
    156         $link = get_category_link($cat_id);
    157         if( 'rss2' == $feed )
    158             $feed_link = 'feed';
    159         else
    160             $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 
    179103
    180104function get_the_category_rss($type = 'rss') {
     
    210134}
    211135
    212 
    213136function the_category_rss($type = 'rss') {
    214137    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&amp;tag=" . $tag->slug;
    229     } else {
    230         $link = get_tag_link($tag->term_id);
    231         if ( 'rss2' == $feed )
    232             $feed_link = 'feed';
    233         else
    234             $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;
    241138}
    242139
Note: See TracChangeset for help on using the changeset viewer.