Some feed template function cleanup.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3440138f04
commit
7f98c031a7
14
wp-atom.php
14
wp-atom.php
|
@ -15,11 +15,11 @@ $more = 1;
|
||||||
xmlns="http://purl.org/atom/ns#"
|
xmlns="http://purl.org/atom/ns#"
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
<title><?php bloginfo_rss('name') ?></title>
|
<title><?php bloginfo_rss('name') ?></title>
|
||||||
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('url') ?>" />
|
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
||||||
<tagline><?php bloginfo_rss("description") ?></tagline>
|
<tagline><?php bloginfo_rss("description") ?></tagline>
|
||||||
<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></modified>
|
<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></modified>
|
||||||
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></copyright>
|
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog')); ?></copyright>
|
||||||
<generator url="http://wordpress.org/" version="<?php echo $wp_version ?>">WordPress</generator>
|
<generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>
|
||||||
|
|
||||||
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
||||||
<entry>
|
<entry>
|
||||||
|
@ -28,11 +28,11 @@ $more = 1;
|
||||||
</author>
|
</author>
|
||||||
<title><?php the_title_rss() ?></title>
|
<title><?php the_title_rss() ?></title>
|
||||||
<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
|
<link rel="alternate" type="text/html" href="<?php permalink_single_rss() ?>" />
|
||||||
<id><?php bloginfo_rss("url") ?>?p=<?php echo $id; ?></id>
|
<id><?php the_guid(); ?></id>
|
||||||
<modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_modified_gmt); ?></modified>
|
<modified><?php the_time('Y-m-d\TH:i:s\Z'); ?></modified>
|
||||||
<issued><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt); ?></issued>
|
<issued> <?php the_time('Y-m-d\TH:i:s\Z'); ?></issued>
|
||||||
<?php the_category_rss('rdf') ?>
|
<?php the_category_rss('rdf') ?>
|
||||||
<summary type="text/html" mode="escaped"><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></summary>
|
<summary type="text/html" mode="escaped"><?php the_excerpt_rss(); ?></summary>
|
||||||
<?php if (!get_settings('rss_use_excerpt')) : ?>
|
<?php if (!get_settings('rss_use_excerpt')) : ?>
|
||||||
<?php if ( strlen( $post->post_content ) ) : ?>
|
<?php if ( strlen( $post->post_content ) ) : ?>
|
||||||
<content type="text/html" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
<content type="text/html" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
||||||
|
@ -40,7 +40,7 @@ $more = 1;
|
||||||
<content type="text/html" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></content>
|
<content type="text/html" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></content>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<content type="text/html" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_excerpt_rss('', 2) ?>]]></content>
|
<content type="text/html" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_excerpt_rss() ?>]]></content>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</entry>
|
</entry>
|
||||||
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
|
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
|
||||||
|
|
|
@ -60,10 +60,6 @@ function comments_link( $file = '', $echo = true ) {
|
||||||
echo get_comments_link();
|
echo get_comments_link();
|
||||||
}
|
}
|
||||||
|
|
||||||
function comment_link_rss() {
|
|
||||||
echo get_comments_link();
|
|
||||||
}
|
|
||||||
|
|
||||||
function comments_popup_script($width=400, $height=400, $file='') {
|
function comments_popup_script($width=400, $height=400, $file='') {
|
||||||
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
||||||
|
|
||||||
|
@ -145,11 +141,6 @@ function comment_author() {
|
||||||
echo $author;
|
echo $author;
|
||||||
}
|
}
|
||||||
|
|
||||||
function comment_author_rss() {
|
|
||||||
$author = apply_filters('comment_author_rss', get_comment_author() );
|
|
||||||
echo $author;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_comment_author_email() {
|
function get_comment_author_email() {
|
||||||
global $comment;
|
global $comment;
|
||||||
return apply_filters('get_comment_author_email', $comment->comment_author_email);
|
return apply_filters('get_comment_author_email', $comment->comment_author_email);
|
||||||
|
@ -244,12 +235,6 @@ function comment_text() {
|
||||||
echo apply_filters('comment_text', get_comment_text() );
|
echo apply_filters('comment_text', get_comment_text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
function comment_text_rss() {
|
|
||||||
$comment_text = get_comment_text();
|
|
||||||
$comment_text = apply_filters('comment_text_rss', $comment_text);
|
|
||||||
echo $comment_text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_comment_excerpt() {
|
function get_comment_excerpt() {
|
||||||
global $comment;
|
global $comment;
|
||||||
$comment_text = strip_tags($comment->comment_content);
|
$comment_text = strip_tags($comment->comment_content);
|
||||||
|
@ -299,23 +284,6 @@ function comment_time( $d = '' ) {
|
||||||
echo get_comment_time();
|
echo get_comment_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'wp-commentsrss2.php') {
|
|
||||||
$url = comments_rss($commentsrssfilename);
|
|
||||||
echo "<a href='$url'>$link_text</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
function comments_rss($commentsrssfilename = 'wp-commentsrss2.php') {
|
|
||||||
global $id;
|
|
||||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
|
||||||
|
|
||||||
if ('' != get_settings('permalink_structure'))
|
|
||||||
$url = trailingslashit( get_permalink() ) . 'feed/';
|
|
||||||
else
|
|
||||||
$url = get_settings('siteurl') . "/$commentsrssfilename?p=$id";
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_trackback_url() {
|
function get_trackback_url() {
|
||||||
global $id;
|
global $id;
|
||||||
$tb_url = get_settings('siteurl') . '/wp-trackback.php/' . $id;
|
$tb_url = get_settings('siteurl') . '/wp-trackback.php/' . $id;
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function bloginfo_rss($show='') {
|
||||||
|
$info = strip_tags(get_bloginfo($show));
|
||||||
|
echo convert_chars($info);
|
||||||
|
}
|
||||||
|
|
||||||
|
function the_title_rss() {
|
||||||
|
$title = get_the_title();
|
||||||
|
$title = apply_filters('the_title', $title);
|
||||||
|
$title = apply_filters('the_title_rss', $title);
|
||||||
|
echo $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
$content = apply_filters('the_content', $content);
|
||||||
|
if ($cut && !$encode_html) {
|
||||||
|
$encode_html = 2;
|
||||||
|
}
|
||||||
|
if ($encode_html == 1) {
|
||||||
|
$content = wp_specialchars($content);
|
||||||
|
$cut = 0;
|
||||||
|
} elseif ($encode_html == 0) {
|
||||||
|
$content = make_url_footnote($content);
|
||||||
|
} elseif ($encode_html == 2) {
|
||||||
|
$content = strip_tags($content);
|
||||||
|
}
|
||||||
|
if ($cut) {
|
||||||
|
$blah = explode(' ', $content);
|
||||||
|
if (count($blah) > $cut) {
|
||||||
|
$k = $cut;
|
||||||
|
$use_dotdotdot = 1;
|
||||||
|
} else {
|
||||||
|
$k = count($blah);
|
||||||
|
$use_dotdotdot = 0;
|
||||||
|
}
|
||||||
|
for ($i=0; $i<$k; $i++) {
|
||||||
|
$excerpt .= $blah[$i].' ';
|
||||||
|
}
|
||||||
|
$excerpt .= ($use_dotdotdot) ? '...' : '';
|
||||||
|
$content = $excerpt;
|
||||||
|
}
|
||||||
|
$content = str_replace(']]>', ']]>', $content);
|
||||||
|
echo $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
function the_excerpt_rss() {
|
||||||
|
$output = get_the_excerpt(true);
|
||||||
|
echo apply_filters('the_excerpt_rss', $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
function permalink_single_rss($file = '') {
|
||||||
|
echo get_permalink();
|
||||||
|
}
|
||||||
|
|
||||||
|
function comment_link_rss() {
|
||||||
|
echo get_comments_link();
|
||||||
|
}
|
||||||
|
|
||||||
|
function comment_author_rss() {
|
||||||
|
$author = apply_filters('comment_author_rss', get_comment_author() );
|
||||||
|
echo $author;
|
||||||
|
}
|
||||||
|
|
||||||
|
function comment_text_rss() {
|
||||||
|
$comment_text = get_comment_text();
|
||||||
|
$comment_text = apply_filters('comment_text_rss', $comment_text);
|
||||||
|
echo $comment_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = 'wp-commentsrss2.php') {
|
||||||
|
$url = comments_rss($commentsrssfilename);
|
||||||
|
echo "<a href='$url'>$link_text</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function comments_rss($commentsrssfilename = 'wp-commentsrss2.php') {
|
||||||
|
global $id;
|
||||||
|
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||||
|
|
||||||
|
if ('' != get_settings('permalink_structure'))
|
||||||
|
$url = trailingslashit( get_permalink() ) . 'feed/';
|
||||||
|
else
|
||||||
|
$url = get_settings('siteurl') . "/$commentsrssfilename?p=$id";
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
||||||
|
global $querystring_start, $querystring_equal;
|
||||||
|
$auth_ID = $author_id;
|
||||||
|
$permalink_structure = get_settings('permalink_structure');
|
||||||
|
|
||||||
|
if ('' == $permalink_structure) {
|
||||||
|
$file = get_settings('siteurl') . '/wp-rss2.php';
|
||||||
|
$link = $file . $querystring_start . 'author' . $querystring_equal . $author_id;
|
||||||
|
} else {
|
||||||
|
$link = get_author_link(0, $author_id, $author_nicename);
|
||||||
|
$link = $link . "feed/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($echo) echo $link;
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_category_rss_link($echo = false, $category_id, $category_nicename) {
|
||||||
|
global $querystring_start, $querystring_equal;
|
||||||
|
$cat_ID = $category_id;
|
||||||
|
$permalink_structure = get_settings('permalink_structure');
|
||||||
|
|
||||||
|
if ('' == $permalink_structure) {
|
||||||
|
$file = get_settings('siteurl') . '/wp-rss2.php';
|
||||||
|
$link = $file . $querystring_start . 'cat' . $querystring_equal . $category_id;
|
||||||
|
} else {
|
||||||
|
$link = get_category_link(0, $category_id, $category_nicename);
|
||||||
|
$link = $link . "feed/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($echo) echo $link;
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
function the_category_rss($type = 'rss') {
|
||||||
|
$categories = get_the_category();
|
||||||
|
$the_list = '';
|
||||||
|
foreach ($categories as $category) {
|
||||||
|
$category->cat_name = convert_chars($category->cat_name);
|
||||||
|
if ('rdf' == $type) {
|
||||||
|
$the_list .= "\n\t<dc:subject>$category->cat_name</dc:subject>";
|
||||||
|
} else {
|
||||||
|
$the_list .= "\n\t<category>$category->cat_name</category>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo apply_filters('the_category_rss', $the_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
function rss_enclosure() {
|
||||||
|
global $id;
|
||||||
|
$custom_fields = get_post_custom();
|
||||||
|
if( is_array( $custom_fields ) ) {
|
||||||
|
while( list( $key, $val ) = each( $custom_fields ) ) {
|
||||||
|
if( $key == 'enclosure' ) {
|
||||||
|
if (is_array($val)) {
|
||||||
|
foreach($val as $enc) {
|
||||||
|
$enclosure = split( "\n", $enc );
|
||||||
|
print "<enclosure url='".trim( $enclosure[ 0 ] )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -140,23 +140,6 @@ function get_author_link($echo = false, $author_id, $author_nicename) {
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_author_rss_link($echo = false, $author_id, $author_nicename) {
|
|
||||||
global $querystring_start, $querystring_equal;
|
|
||||||
$auth_ID = $author_id;
|
|
||||||
$permalink_structure = get_settings('permalink_structure');
|
|
||||||
|
|
||||||
if ('' == $permalink_structure) {
|
|
||||||
$file = get_settings('siteurl') . '/wp-rss2.php';
|
|
||||||
$link = $file . $querystring_start . 'author' . $querystring_equal . $author_id;
|
|
||||||
} else {
|
|
||||||
$link = get_author_link(0, $author_id, $author_nicename);
|
|
||||||
$link = $link . "feed/";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($echo) echo $link;
|
|
||||||
return $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
function wp_list_authors($args = '') {
|
function wp_list_authors($args = '') {
|
||||||
parse_str($args, $r);
|
parse_str($args, $r);
|
||||||
if (!isset($r['optioncount'])) $r['optioncount'] = false;
|
if (!isset($r['optioncount'])) $r['optioncount'] = false;
|
||||||
|
|
|
@ -43,23 +43,6 @@ function get_category_link($echo = false, $category_id, $category_nicename) {
|
||||||
return $catlink;
|
return $catlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_category_rss_link($echo = false, $category_id, $category_nicename) {
|
|
||||||
global $querystring_start, $querystring_equal;
|
|
||||||
$cat_ID = $category_id;
|
|
||||||
$permalink_structure = get_settings('permalink_structure');
|
|
||||||
|
|
||||||
if ('' == $permalink_structure) {
|
|
||||||
$file = get_settings('siteurl') . '/wp-rss2.php';
|
|
||||||
$link = $file . $querystring_start . 'cat' . $querystring_equal . $category_id;
|
|
||||||
} else {
|
|
||||||
$link = get_category_link(0, $category_id, $category_nicename);
|
|
||||||
$link = $link . "feed/";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($echo) echo $link;
|
|
||||||
return $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
function the_category($separator = '', $parents='') {
|
function the_category($separator = '', $parents='') {
|
||||||
$categories = get_the_category();
|
$categories = get_the_category();
|
||||||
if (empty($categories)) {
|
if (empty($categories)) {
|
||||||
|
@ -118,20 +101,6 @@ function the_category($separator = '', $parents='') {
|
||||||
echo apply_filters('the_category', $thelist);
|
echo apply_filters('the_category', $thelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
function the_category_rss($type = 'rss') {
|
|
||||||
$categories = get_the_category();
|
|
||||||
$the_list = '';
|
|
||||||
foreach ($categories as $category) {
|
|
||||||
$category->cat_name = convert_chars($category->cat_name);
|
|
||||||
if ('rdf' == $type) {
|
|
||||||
$the_list .= "\n\t<dc:subject>$category->cat_name</dc:subject>";
|
|
||||||
} else {
|
|
||||||
$the_list .= "\n\t<category>$category->cat_name</category>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo apply_filters('the_category_rss', $the_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_the_category_by_ID($cat_ID) {
|
function get_the_category_by_ID($cat_ID) {
|
||||||
global $cache_categories, $wpdb;
|
global $cache_categories, $wpdb;
|
||||||
if ( !$cache_categories[$cat_ID] ) {
|
if ( !$cache_categories[$cat_ID] ) {
|
||||||
|
|
|
@ -61,16 +61,6 @@ function bloginfo($show='') {
|
||||||
echo convert_chars($info);
|
echo convert_chars($info);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bloginfo_rss($show='') {
|
|
||||||
$info = strip_tags(get_bloginfo($show));
|
|
||||||
echo convert_chars($info);
|
|
||||||
}
|
|
||||||
|
|
||||||
function bloginfo_unicode($show='') {
|
|
||||||
$info = get_bloginfo($show);
|
|
||||||
echo convert_chars($info);
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_bloginfo($show='') {
|
function get_bloginfo($show='') {
|
||||||
|
|
||||||
switch($show) {
|
switch($show) {
|
||||||
|
@ -611,19 +601,26 @@ function the_date($d='', $before='', $after='', $echo = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function the_time($d='', $echo = true) {
|
function the_time( $d = '' ) {
|
||||||
global $id, $post;
|
echo apply_filters('the_time', get_the_time( $d ) );
|
||||||
if ($d=='') {
|
}
|
||||||
$the_time = mysql2date(get_settings('time_format'), $post->post_date);
|
|
||||||
} else {
|
function get_the_time( $d = '' ) {
|
||||||
$the_time = mysql2date($d, $post->post_date);
|
global $id, $post;
|
||||||
}
|
if ( '' == $d )
|
||||||
$the_time = apply_filters('the_time', $the_time);
|
$the_time = date( get_settings('time_format'), get_post_time() );
|
||||||
if ($echo) {
|
else
|
||||||
echo $the_time;
|
$the_time = mysql2date( $d, get_post_time() );
|
||||||
} else {
|
return apply_filters('get_the_time', $the_time);
|
||||||
return $the_time;
|
}
|
||||||
}
|
|
||||||
|
function get_post_time( $gmt = false ) { // returns timestamp
|
||||||
|
global $post;
|
||||||
|
if ( $gmt )
|
||||||
|
$time = mysql2date('U', $post->post_date_gmt);
|
||||||
|
else
|
||||||
|
$time = mysql2date('U', $post->post_date);
|
||||||
|
return apply_filters('get_the_time', $time);
|
||||||
}
|
}
|
||||||
|
|
||||||
function the_weekday() {
|
function the_weekday() {
|
||||||
|
|
|
@ -22,10 +22,6 @@ function permalink_anchor($mode = 'id') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function permalink_single_rss($file = '') {
|
|
||||||
echo get_permalink();
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_permalink($id = false) {
|
function get_permalink($id = false) {
|
||||||
global $post, $wpdb;
|
global $post, $wpdb;
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,6 @@ function the_title($before = '', $after = '', $echo = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function the_title_rss() {
|
|
||||||
$title = get_the_title();
|
|
||||||
$title = apply_filters('the_title', $title);
|
|
||||||
$title = apply_filters('the_title_rss', $title);
|
|
||||||
echo $title;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_the_title($id = 0) {
|
function get_the_title($id = 0) {
|
||||||
global $post, $wpdb;
|
global $post, $wpdb;
|
||||||
$title = $post->post_title;
|
$title = $post->post_title;
|
||||||
|
@ -59,6 +52,21 @@ function get_the_title($id = 0) {
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_the_guid( $id = 0 ) {
|
||||||
|
global $post, $wpdb;
|
||||||
|
$guid = $post->guid;
|
||||||
|
|
||||||
|
if ( 0 != $id )
|
||||||
|
$title = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE ID = $id");
|
||||||
|
$guid = apply_filters('get_the_guid', $guid);
|
||||||
|
return $guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
function the_guid( $id = 0 ) {
|
||||||
|
echo get_the_guid();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
|
function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
|
||||||
$content = get_the_content($more_link_text, $stripteaser, $more_file);
|
$content = get_the_content($more_link_text, $stripteaser, $more_file);
|
||||||
$content = apply_filters('the_content', $content);
|
$content = apply_filters('the_content', $content);
|
||||||
|
@ -66,39 +74,6 @@ function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file
|
||||||
echo $content;
|
echo $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
$content = apply_filters('the_content', $content);
|
|
||||||
if ($cut && !$encode_html) {
|
|
||||||
$encode_html = 2;
|
|
||||||
}
|
|
||||||
if ($encode_html == 1) {
|
|
||||||
$content = wp_specialchars($content);
|
|
||||||
$cut = 0;
|
|
||||||
} elseif ($encode_html == 0) {
|
|
||||||
$content = make_url_footnote($content);
|
|
||||||
} elseif ($encode_html == 2) {
|
|
||||||
$content = strip_tags($content);
|
|
||||||
}
|
|
||||||
if ($cut) {
|
|
||||||
$blah = explode(' ', $content);
|
|
||||||
if (count($blah) > $cut) {
|
|
||||||
$k = $cut;
|
|
||||||
$use_dotdotdot = 1;
|
|
||||||
} else {
|
|
||||||
$k = count($blah);
|
|
||||||
$use_dotdotdot = 0;
|
|
||||||
}
|
|
||||||
for ($i=0; $i<$k; $i++) {
|
|
||||||
$excerpt .= $blah[$i].' ';
|
|
||||||
}
|
|
||||||
$excerpt .= ($use_dotdotdot) ? '...' : '';
|
|
||||||
$content = $excerpt;
|
|
||||||
}
|
|
||||||
$content = str_replace(']]>', ']]>', $content);
|
|
||||||
echo $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
|
function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
|
||||||
global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
|
global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
|
||||||
global $preview;
|
global $preview;
|
||||||
|
@ -142,42 +117,6 @@ function the_excerpt() {
|
||||||
echo apply_filters('the_excerpt', get_the_excerpt());
|
echo apply_filters('the_excerpt', get_the_excerpt());
|
||||||
}
|
}
|
||||||
|
|
||||||
function the_excerpt_rss($cut = 0, $encode_html = FALSE) {
|
|
||||||
$output = get_the_excerpt(true);
|
|
||||||
|
|
||||||
$output = convert_chars($output);
|
|
||||||
if ($cut && !$encode_html) {
|
|
||||||
$encode_html = 2;
|
|
||||||
}
|
|
||||||
if ($encode_html == 1) {
|
|
||||||
$output = wp_specialchars($output);
|
|
||||||
$cut = 0;
|
|
||||||
} elseif ($encode_html === 0) {
|
|
||||||
$output = make_url_footnote($output);
|
|
||||||
} elseif ($encode_html == 2) {
|
|
||||||
$output = strip_tags($output);
|
|
||||||
$output = str_replace('&', '&', $output);
|
|
||||||
}
|
|
||||||
if ($cut) {
|
|
||||||
$excerpt = '';
|
|
||||||
$blah = explode(' ', $output);
|
|
||||||
if (count($blah) > $cut) {
|
|
||||||
$k = $cut;
|
|
||||||
$use_dotdotdot = 1;
|
|
||||||
} else {
|
|
||||||
$k = count($blah);
|
|
||||||
$use_dotdotdot = 0;
|
|
||||||
}
|
|
||||||
for ($i=0; $i<$k; $i++) {
|
|
||||||
$excerpt .= $blah[$i].' ';
|
|
||||||
}
|
|
||||||
$excerpt .= ($use_dotdotdot) ? '...' : '';
|
|
||||||
$output = $excerpt;
|
|
||||||
}
|
|
||||||
$output = str_replace(']]>', ']]>', $output);
|
|
||||||
echo apply_filters('the_excerpt_rss', $output);
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_the_excerpt($fakeit = true) {
|
function get_the_excerpt($fakeit = true) {
|
||||||
global $id, $post;
|
global $id, $post;
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
|
@ -19,4 +19,6 @@ require($curpath . 'template-functions-category.php');
|
||||||
/***** Comment tags *****/
|
/***** Comment tags *****/
|
||||||
require($curpath . 'comment-functions.php');
|
require($curpath . 'comment-functions.php');
|
||||||
|
|
||||||
|
require($curpath . 'feed-functions.php');
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -158,6 +158,7 @@ add_filter('comment_text', 'convert_smilies', 20);
|
||||||
add_filter('comment_text_rss', 'htmlspecialchars');
|
add_filter('comment_text_rss', 'htmlspecialchars');
|
||||||
|
|
||||||
add_filter('comment_excerpt', 'convert_chars');
|
add_filter('comment_excerpt', 'convert_chars');
|
||||||
|
add_filter('the_excerpt_rss', 'convert_chars');
|
||||||
|
|
||||||
// Places to balance tags on input
|
// Places to balance tags on input
|
||||||
add_filter('content_save_pre', 'balanceTags', 50);
|
add_filter('content_save_pre', 'balanceTags', 50);
|
||||||
|
|
|
@ -46,7 +46,7 @@ add_filter('the_content', 'trim');
|
||||||
<dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
|
<dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
|
||||||
<?php the_category_rss('rdf') ?>
|
<?php the_category_rss('rdf') ?>
|
||||||
<?php if (get_settings('rss_use_excerpt')) : ?>
|
<?php if (get_settings('rss_use_excerpt')) : ?>
|
||||||
<description><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></description>
|
<description><?php the_excerpt_rss() ?></description>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), 2) ?></description>
|
<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), 2) ?></description>
|
||||||
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
||||||
|
|
|
@ -26,7 +26,7 @@ $more = 1;
|
||||||
<?php
|
<?php
|
||||||
if (get_settings('rss_use_excerpt')) {
|
if (get_settings('rss_use_excerpt')) {
|
||||||
?>
|
?>
|
||||||
<description><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></description>
|
<description><?php the_excerpt_rss() ?></description>
|
||||||
<?php
|
<?php
|
||||||
} else { // use content
|
} else { // use content
|
||||||
?>
|
?>
|
||||||
|
|
36
wp-rss2.php
36
wp-rss2.php
|
@ -12,55 +12,37 @@ $more = 1;
|
||||||
?>
|
?>
|
||||||
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
|
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
|
||||||
|
|
||||||
<!-- generator="wordpress/<?php echo $wp_version ?>" -->
|
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
|
||||||
<rss version="2.0"
|
<rss version="2.0"
|
||||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||||
>
|
>
|
||||||
|
|
||||||
<channel>
|
<channel>
|
||||||
<title><?php bloginfo_rss('name') ?></title>
|
<title><?php bloginfo_rss('name'); ?></title>
|
||||||
<link><?php bloginfo_rss('url') ?></link>
|
<link><?php bloginfo_rss('url') ?></link>
|
||||||
<description><?php bloginfo_rss("description") ?></description>
|
<description><?php bloginfo_rss("description") ?></description>
|
||||||
<copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></copyright>
|
|
||||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></pubDate>
|
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></pubDate>
|
||||||
<generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
|
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
||||||
|
|
||||||
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
||||||
<item>
|
<item>
|
||||||
<title><?php the_title_rss() ?></title>
|
<title><?php the_title_rss() ?></title>
|
||||||
<link><?php permalink_single_rss() ?></link>
|
<link><?php permalink_single_rss() ?></link>
|
||||||
<comments><?php comments_link(); ?></comments>
|
<comments><?php comments_link(); ?></comments>
|
||||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $post->post_date_gmt, 0); ?></pubDate>
|
<pubDate><?php the_time('D, d M Y H:i:s +0000'); ?></pubDate>
|
||||||
<?php the_category_rss() ?>
|
<?php the_category_rss() ?>
|
||||||
|
|
||||||
<guid><?php the_permalink($id); ?></guid>
|
<guid><?php the_permalink($id); ?></guid>
|
||||||
<?php if (get_settings('rss_use_excerpt')) : ?>
|
<?php if (get_settings('rss_use_excerpt')) : ?>
|
||||||
<description><?php the_excerpt_rss('', 2) ?></description>
|
<description><?php the_excerpt_rss() ?></description>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<description><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></description>
|
<description><?php the_excerpt_rss() ?></description>
|
||||||
<?php if ( strlen( $post->post_content ) ) : ?>
|
|
||||||
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
||||||
<?php else : ?>
|
|
||||||
<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<wfw:commentRSS><?php echo comments_rss(); ?></wfw:commentRSS>
|
<wfw:commentRSS><?php echo comments_rss(); ?></wfw:commentRSS>
|
||||||
<?php
|
<?php rss_enclosure(); ?>
|
||||||
$custom_fields = get_post_custom();
|
|
||||||
if( is_array( $custom_fields ) ) {
|
|
||||||
while( list( $key, $val ) = each( $custom_fields ) ) {
|
|
||||||
if( $key == 'enclosure' ) {
|
|
||||||
if (is_array($val)) {
|
|
||||||
foreach($val as $enc) {
|
|
||||||
$enclosure = split( "\n", $enc );
|
|
||||||
print "<enclosure url='".trim( $enclosure[ 0 ] )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</item>
|
</item>
|
||||||
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
|
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
Loading…
Reference in New Issue