function bb_feed_head()
{
    $feeds = array();
    switch (bb_get_location()) {
        case 'profile-page':
            if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) {
                if ($tab != 'favorites') {
                    break;
                }
            }
            $feeds[] = array('title' => sprintf(__('%1$s » User Favorites: %2$s'), bb_get_option('name'), get_user_name()), 'href' => get_favorites_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            break;
        case 'topic-page':
            $feeds[] = array('title' => sprintf(__('%1$s » Topic: %2$s'), bb_get_option('name'), get_topic_title()), 'href' => get_topic_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            break;
        case 'tag-page':
            if (bb_is_tag()) {
                $feeds[] = array('title' => sprintf(__('%1$s » Tag: %2$s - Recent Posts'), bb_get_option('name'), bb_get_tag_name()), 'href' => bb_get_tag_posts_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
                $feeds[] = array('title' => sprintf(__('%1$s » Tag: %2$s - Recent Topics'), bb_get_option('name'), bb_get_tag_name()), 'href' => bb_get_tag_topics_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            }
            break;
        case 'forum-page':
            $feeds[] = array('title' => sprintf(__('%1$s » Forum: %2$s - Recent Posts'), bb_get_option('name'), get_forum_name()), 'href' => bb_get_forum_posts_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            $feeds[] = array('title' => sprintf(__('%1$s » Forum: %2$s - Recent Topics'), bb_get_option('name'), get_forum_name()), 'href' => bb_get_forum_topics_rss_link(0, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            break;
        case 'front-page':
            $feeds[] = array('title' => sprintf(__('%1$s » Recent Posts'), bb_get_option('name')), 'href' => bb_get_posts_rss_link(BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            $feeds[] = array('title' => sprintf(__('%1$s » Recent Topics'), bb_get_option('name')), 'href' => bb_get_topics_rss_link(BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            break;
        case 'view-page':
            global $bb_views, $view;
            if ($bb_views[$view]['feed']) {
                $feeds[] = array('title' => sprintf(__('%1$s » View: %2$s'), bb_get_option('name'), get_view_name()), 'href' => bb_get_view_rss_link(null, BB_URI_CONTEXT_LINK_ALTERNATE_HREF + BB_URI_CONTEXT_BB_FEED));
            }
            break;
    }
    if (count($feeds)) {
        $feed_links = array();
        foreach ($feeds as $feed) {
            $link = '<link rel="alternate" type="application/rss+xml" ';
            $link .= 'title="' . esc_attr($feed['title']) . '" ';
            $link .= 'href="' . esc_attr($feed['href']) . '" />';
            $feed_links[] = $link;
        }
        $feed_links = join("\n", $feed_links);
    } else {
        $feed_links = '';
    }
    echo apply_filters('bb_feed_head', $feed_links);
}
예제 #2
0
            $link = get_forum_link($feed_id);
            $link_self = bb_get_forum_posts_rss_link($feed_id);
            break;
            // Get just the first post from the latest topics
        // Get just the first post from the latest topics
        case 'all-topics':
            if (!($topics = get_latest_topics())) {
                die;
            }
            $posts = array();
            foreach ($topics as $topic) {
                $posts[] = bb_get_first_post($topic->topic_id);
            }
            $title = esc_html(sprintf(__('%1$s &raquo; Recent Topics'), bb_get_option('name')));
            $link = bb_get_uri();
            $link_self = bb_get_topics_rss_link();
            break;
            // Get latest posts by default
        // Get latest posts by default
        case 'all-posts':
        default:
            if (!($posts = bb_get_latest_posts(35))) {
                die;
            }
            $title = esc_html(sprintf(__('%1$s &raquo; Recent Posts'), bb_get_option('name')));
            $link = bb_get_uri();
            $link_self = bb_get_posts_rss_link();
            break;
    }
}
bb_send_304($posts[0]->post_time);