| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
function get_bloginfo_rss($show = '') { |
|---|
| 4 |
$info = strip_tags(get_bloginfo($show)); |
|---|
| 5 |
return apply_filters('bloginfo_rss', convert_chars($info)); |
|---|
| 6 |
} |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
function bloginfo_rss($show = '') { |
|---|
| 10 |
echo get_bloginfo_rss($show); |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
function get_the_title_rss() { |
|---|
| 15 |
$title = get_the_title(); |
|---|
| 16 |
$title = apply_filters('the_title', $title); |
|---|
| 17 |
$title = apply_filters('the_title_rss', $title); |
|---|
| 18 |
return $title; |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
function the_title_rss() { |
|---|
| 23 |
echo get_the_title_rss(); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { |
|---|
| 28 |
$content = get_the_content($more_link_text, $stripteaser, $more_file); |
|---|
| 29 |
$content = apply_filters('the_content_rss', $content); |
|---|
| 30 |
if ( $cut && !$encode_html ) |
|---|
| 31 |
$encode_html = 2; |
|---|
| 32 |
if ( 1== $encode_html ) { |
|---|
| 33 |
$content = wp_specialchars($content); |
|---|
| 34 |
$cut = 0; |
|---|
| 35 |
} elseif ( 0 == $encode_html ) { |
|---|
| 36 |
$content = make_url_footnote($content); |
|---|
| 37 |
} elseif ( 2 == $encode_html ) { |
|---|
| 38 |
$content = strip_tags($content); |
|---|
| 39 |
} |
|---|
| 40 |
if ( $cut ) { |
|---|
| 41 |
$blah = explode(' ', $content); |
|---|
| 42 |
if ( count($blah) > $cut ) { |
|---|
| 43 |
$k = $cut; |
|---|
| 44 |
$use_dotdotdot = 1; |
|---|
| 45 |
} else { |
|---|
| 46 |
$k = count($blah); |
|---|
| 47 |
$use_dotdotdot = 0; |
|---|
| 48 |
} |
|---|
| 49 |
for ( $i=0; $i<$k; $i++ ) |
|---|
| 50 |
$excerpt .= $blah[$i].' '; |
|---|
| 51 |
$excerpt .= ($use_dotdotdot) ? '...' : ''; |
|---|
| 52 |
$content = $excerpt; |
|---|
| 53 |
} |
|---|
| 54 |
$content = str_replace(']]>', ']]>', $content); |
|---|
| 55 |
echo $content; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
function the_excerpt_rss() { |
|---|
| 60 |
$output = get_the_excerpt(true); |
|---|
| 61 |
echo apply_filters('the_excerpt_rss', $output); |
|---|
| 62 |
} |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
function permalink_single_rss($file = '') { |
|---|
| 66 |
echo get_permalink(); |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
function comment_link() { |
|---|
| 71 |
echo get_comment_link(); |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
function get_comment_author_rss() { |
|---|
| 76 |
return apply_filters('comment_author_rss', get_comment_author() ); |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
function comment_author_rss() { |
|---|
| 81 |
echo get_comment_author_rss(); |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
function comment_text_rss() { |
|---|
| 86 |
$comment_text = get_comment_text(); |
|---|
| 87 |
$comment_text = apply_filters('comment_text_rss', $comment_text); |
|---|
| 88 |
echo $comment_text; |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = '') { |
|---|
| 93 |
$url = comments_rss($commentsrssfilename); |
|---|
| 94 |
echo "<a href='$url'>$link_text</a>"; |
|---|
| 95 |
} |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
function comments_rss($commentsrssfilename = '') { |
|---|
| 99 |
global $id; |
|---|
| 100 |
|
|---|
| 101 |
if ( '' != get_option('permalink_structure') ) |
|---|
| 102 |
$url = trailingslashit( get_permalink() ) . 'feed/'; |
|---|
| 103 |
else |
|---|
| 104 |
$url = get_option('home') . "/$commentsrssfilename?feed=rss2&p=$id"; |
|---|
| 105 |
|
|---|
| 106 |
return apply_filters('post_comments_feed_link', $url); |
|---|
| 107 |
} |
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
function get_author_rss_link($echo = false, $author_id, $author_nicename) { |
|---|
| 111 |
$auth_ID = $author_id; |
|---|
| 112 |
$permalink_structure = get_option('permalink_structure'); |
|---|
| 113 |
|
|---|
| 114 |
if ( '' == $permalink_structure ) { |
|---|
| 115 |
$link = get_option('home') . '?feed=rss2&author=' . $author_id; |
|---|
| 116 |
} else { |
|---|
| 117 |
$link = get_author_posts_url($author_id, $author_nicename); |
|---|
| 118 |
$link = $link . "feed/"; |
|---|
| 119 |
} |
|---|
| 120 |
|
|---|
| 121 |
$link = apply_filters('author_feed_link', $link); |
|---|
| 122 |
|
|---|
| 123 |
if ( $echo ) |
|---|
| 124 |
echo $link; |
|---|
| 125 |
return $link; |
|---|
| 126 |
} |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { |
|---|
| 130 |
$permalink_structure = get_option('permalink_structure'); |
|---|
| 131 |
|
|---|
| 132 |
if ( '' == $permalink_structure ) { |
|---|
| 133 |
$link = get_option('home') . '?feed=rss2&cat=' . $cat_ID; |
|---|
| 134 |
} else { |
|---|
| 135 |
$link = get_category_link($cat_ID); |
|---|
| 136 |
$link = $link . "feed/"; |
|---|
| 137 |
} |
|---|
| 138 |
|
|---|
| 139 |
$link = apply_filters('category_feed_link', $link); |
|---|
| 140 |
|
|---|
| 141 |
if ( $echo ) |
|---|
| 142 |
echo $link; |
|---|
| 143 |
return $link; |
|---|
| 144 |
} |
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
function get_the_category_rss($type = 'rss') { |
|---|
| 148 |
$categories = get_the_category(); |
|---|
| 149 |
$the_list = ''; |
|---|
| 150 |
foreach ( (array) $categories as $category ) { |
|---|
| 151 |
$category->cat_name = convert_chars($category->cat_name); |
|---|
| 152 |
if ( 'rdf' == $type ) |
|---|
| 153 |
$the_list .= "\n\t\t<dc:subject><![CDATA[$category->cat_name]]></dc:subject>\n"; |
|---|
| 154 |
else |
|---|
| 155 |
$the_list .= "\n\t\t<category><![CDATA[$category->cat_name]]></category>\n"; |
|---|
| 156 |
} |
|---|
| 157 |
return apply_filters('the_category_rss', $the_list, $type); |
|---|
| 158 |
} |
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 |
function the_category_rss($type = 'rss') { |
|---|
| 162 |
echo get_the_category_rss($type); |
|---|
| 163 |
} |
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
function rss_enclosure() { |
|---|
| 167 |
global $id, $post; |
|---|
| 168 |
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) |
|---|
| 169 |
return; |
|---|
| 170 |
|
|---|
| 171 |
$custom_fields = get_post_custom(); |
|---|
| 172 |
if ( is_array($custom_fields) ) { |
|---|
| 173 |
while ( list($key, $val) = each($custom_fields) ) { |
|---|
| 174 |
if ( $key == 'enclosure' ) { |
|---|
| 175 |
if ( is_array($val) ) { |
|---|
| 176 |
foreach ( (array) $val as $enc ) { |
|---|
| 177 |
$enclosure = split( "\n", $enc ); |
|---|
| 178 |
print "<enclosure url='".trim( htmlspecialchars($enclosure[ 0 ]) )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n"; |
|---|
| 179 |
} |
|---|
| 180 |
} |
|---|
| 181 |
} |
|---|
| 182 |
} |
|---|
| 183 |
} |
|---|
| 184 |
} |
|---|
| 185 |
|
|---|
| 186 |
?> |
|---|