2005-01-07 22:01:59 +00:00
|
|
|
<?php
|
|
|
|
|
2005-02-25 15:52:28 +00:00
|
|
|
function get_bloginfo_rss($show = '') {
|
|
|
|
$info = strip_tags(get_bloginfo($show));
|
2006-05-18 01:23:25 +00:00
|
|
|
return apply_filters('bloginfo_rss', convert_chars($info));
|
2005-02-25 15:52:28 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-02-25 15:52:28 +00:00
|
|
|
function bloginfo_rss($show = '') {
|
2005-02-27 16:42:57 +00:00
|
|
|
echo get_bloginfo_rss($show);
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-12-15 22:20:06 +00:00
|
|
|
function get_the_title_rss() {
|
2005-01-07 22:01:59 +00:00
|
|
|
$title = get_the_title();
|
|
|
|
$title = apply_filters('the_title', $title);
|
|
|
|
$title = apply_filters('the_title_rss', $title);
|
2005-12-15 22:20:06 +00:00
|
|
|
return $title;
|
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-12-15 22:20:06 +00:00
|
|
|
function the_title_rss() {
|
|
|
|
echo get_the_title_rss();
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
|
|
|
|
$content = get_the_content($more_link_text, $stripteaser, $more_file);
|
2005-11-17 23:17:06 +00:00
|
|
|
$content = apply_filters('the_content_rss', $content);
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( $cut && !$encode_html )
|
2005-01-07 22:01:59 +00:00
|
|
|
$encode_html = 2;
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( 1== $encode_html ) {
|
2005-01-07 22:01:59 +00:00
|
|
|
$content = wp_specialchars($content);
|
|
|
|
$cut = 0;
|
2006-10-13 13:49:39 +00:00
|
|
|
} elseif ( 0 == $encode_html ) {
|
2005-01-07 22:01:59 +00:00
|
|
|
$content = make_url_footnote($content);
|
2006-10-13 13:49:39 +00:00
|
|
|
} elseif ( 2 == $encode_html ) {
|
2005-01-07 22:01:59 +00:00
|
|
|
$content = strip_tags($content);
|
|
|
|
}
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( $cut ) {
|
2005-01-07 22:01:59 +00:00
|
|
|
$blah = explode(' ', $content);
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( count($blah) > $cut ) {
|
2005-01-07 22:01:59 +00:00
|
|
|
$k = $cut;
|
|
|
|
$use_dotdotdot = 1;
|
|
|
|
} else {
|
|
|
|
$k = count($blah);
|
|
|
|
$use_dotdotdot = 0;
|
|
|
|
}
|
2006-12-07 03:57:23 +00:00
|
|
|
for ( $i=0; $i<$k; $i++ )
|
2005-01-07 22:01:59 +00:00
|
|
|
$excerpt .= $blah[$i].' ';
|
|
|
|
$excerpt .= ($use_dotdotdot) ? '...' : '';
|
|
|
|
$content = $excerpt;
|
|
|
|
}
|
|
|
|
$content = str_replace(']]>', ']]>', $content);
|
|
|
|
echo $content;
|
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function the_excerpt_rss() {
|
|
|
|
$output = get_the_excerpt(true);
|
|
|
|
echo apply_filters('the_excerpt_rss', $output);
|
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function permalink_single_rss($file = '') {
|
2006-10-13 13:49:39 +00:00
|
|
|
echo get_permalink();
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-31 10:06:12 +00:00
|
|
|
function comment_link() {
|
|
|
|
echo get_comment_link();
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-12-15 22:20:06 +00:00
|
|
|
function get_comment_author_rss() {
|
|
|
|
return apply_filters('comment_author_rss', get_comment_author() );
|
|
|
|
}
|
2006-12-07 03:57:23 +00:00
|
|
|
|
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function comment_author_rss() {
|
2005-12-15 22:20:06 +00:00
|
|
|
echo get_comment_author_rss();
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function comment_text_rss() {
|
|
|
|
$comment_text = get_comment_text();
|
|
|
|
$comment_text = apply_filters('comment_text_rss', $comment_text);
|
|
|
|
echo $comment_text;
|
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2007-02-23 08:31:07 +00:00
|
|
|
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'nolongerused') {
|
|
|
|
$url = get_post_comments_feed_link();;
|
2005-01-07 22:01:59 +00:00
|
|
|
echo "<a href='$url'>$link_text</a>";
|
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2007-02-23 08:31:07 +00:00
|
|
|
function comments_rss($commentsrssfilename = 'nolongerused') {
|
|
|
|
return get_post_comments_feed_link();
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
2006-10-13 13:49:39 +00:00
|
|
|
$auth_ID = $author_id;
|
|
|
|
$permalink_structure = get_option('permalink_structure');
|
|
|
|
|
|
|
|
if ( '' == $permalink_structure ) {
|
|
|
|
$link = get_option('home') . '?feed=rss2&author=' . $author_id;
|
|
|
|
} else {
|
|
|
|
$link = get_author_posts_url($author_id, $author_nicename);
|
2007-02-15 07:07:12 +00:00
|
|
|
$link = $link . user_trailingslashit('feed');
|
2006-10-13 13:49:39 +00:00
|
|
|
}
|
2005-01-07 22:01:59 +00:00
|
|
|
|
2006-10-13 13:49:39 +00:00
|
|
|
$link = apply_filters('author_feed_link', $link);
|
2005-01-07 22:01:59 +00:00
|
|
|
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( $echo )
|
|
|
|
echo $link;
|
|
|
|
return $link;
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-04-19 17:17:36 +00:00
|
|
|
function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
|
2006-10-13 13:49:39 +00:00
|
|
|
$permalink_structure = get_option('permalink_structure');
|
2005-01-07 22:01:59 +00:00
|
|
|
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( '' == $permalink_structure ) {
|
|
|
|
$link = get_option('home') . '?feed=rss2&cat=' . $cat_ID;
|
|
|
|
} else {
|
|
|
|
$link = get_category_link($cat_ID);
|
2007-02-15 07:07:12 +00:00
|
|
|
$link = $link . user_trailingslashit('feed/');
|
2006-10-13 13:49:39 +00:00
|
|
|
}
|
2005-01-07 22:01:59 +00:00
|
|
|
|
2006-10-13 13:49:39 +00:00
|
|
|
$link = apply_filters('category_feed_link', $link);
|
2005-02-26 06:12:16 +00:00
|
|
|
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( $echo )
|
|
|
|
echo $link;
|
|
|
|
return $link;
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2006-09-26 18:05:06 +00:00
|
|
|
function get_the_category_rss($type = 'rss') {
|
2006-10-13 13:49:39 +00:00
|
|
|
$categories = get_the_category();
|
2007-01-25 08:37:26 +00:00
|
|
|
$home = get_bloginfo_rss('home');
|
2006-10-13 13:49:39 +00:00
|
|
|
$the_list = '';
|
|
|
|
foreach ( (array) $categories as $category ) {
|
|
|
|
$category->cat_name = convert_chars($category->cat_name);
|
|
|
|
if ( 'rdf' == $type )
|
2006-11-08 06:57:26 +00:00
|
|
|
$the_list .= "\n\t\t<dc:subject><![CDATA[$category->cat_name]]></dc:subject>\n";
|
2007-01-25 08:37:26 +00:00
|
|
|
if ( 'atom' == $type )
|
|
|
|
$the_list .= "<category scheme='$home' term='$category->cat_name' />";
|
2006-10-13 13:49:39 +00:00
|
|
|
else
|
2006-11-08 06:57:26 +00:00
|
|
|
$the_list .= "\n\t\t<category><![CDATA[$category->cat_name]]></category>\n";
|
2006-10-13 13:49:39 +00:00
|
|
|
}
|
|
|
|
return apply_filters('the_category_rss', $the_list, $type);
|
2006-09-26 18:05:06 +00:00
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2006-09-26 18:05:06 +00:00
|
|
|
function the_category_rss($type = 'rss') {
|
|
|
|
echo get_the_category_rss($type);
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
|
2007-01-25 08:37:26 +00:00
|
|
|
function html_type_rss() {
|
2007-01-25 08:48:18 +00:00
|
|
|
$type = get_bloginfo('html_type');
|
2007-01-25 08:37:26 +00:00
|
|
|
if ( strstr( $type, 'xhtml' ) )
|
|
|
|
$type = 'xhtml';
|
|
|
|
else
|
|
|
|
$type = 'html';
|
|
|
|
echo $type;
|
|
|
|
}
|
|
|
|
|
2006-12-07 03:57:23 +00:00
|
|
|
|
2005-01-07 22:01:59 +00:00
|
|
|
function rss_enclosure() {
|
2005-03-22 17:49:19 +00:00
|
|
|
global $id, $post;
|
2006-10-13 13:49:39 +00:00
|
|
|
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
|
|
|
|
return;
|
2005-03-22 17:49:19 +00:00
|
|
|
|
2007-02-23 23:47:57 +00:00
|
|
|
foreach (get_post_custom() as $k => $v) {
|
|
|
|
if ($key == 'enclosure') {
|
|
|
|
foreach ((array)$val as $enc) {
|
|
|
|
$enclosure = split("\n", $enc);
|
|
|
|
echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
|
2005-01-07 22:01:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-23 23:47:57 +00:00
|
|
|
function atom_enclosure() {
|
|
|
|
global $id, $post;
|
|
|
|
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
foreach (get_post_custom() as $k => $v) {
|
|
|
|
if ($key == 'enclosure') {
|
|
|
|
foreach ((array)$val as $enc) {
|
|
|
|
$enclosure = split("\n", $enc);
|
|
|
|
echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|