wp/wp-includes/feed-rss2.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     3  * RSS2 Feed Template for displaying RSS2 Posts feed.
     3  * RSS2 Feed Template for displaying RSS2 Posts feed.
     4  *
     4  *
     5  * @package WordPress
     5  * @package WordPress
     6  */
     6  */
     7 
     7 
     8 header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
     8 header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
     9 $more = 1;
     9 $more = 1;
    10 
    10 
    11 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
    11 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
    12 
    12 
    13 /**
    13 /**
    36 	do_action( 'rss2_ns' );
    36 	do_action( 'rss2_ns' );
    37 	?>
    37 	?>
    38 >
    38 >
    39 
    39 
    40 <channel>
    40 <channel>
    41 	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
    41 	<title><?php wp_title_rss(); ?></title>
    42 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    42 	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
    43 	<link><?php bloginfo_rss('url') ?></link>
    43 	<link><?php bloginfo_rss('url') ?></link>
    44 	<description><?php bloginfo_rss("description") ?></description>
    44 	<description><?php bloginfo_rss("description") ?></description>
    45 	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
    45 	<lastBuildDate><?php
       
    46 		$date = get_lastpostmodified( 'GMT' );
       
    47 		echo $date ? mysql2date( 'r', $date, false ) : date( 'r' );
       
    48 	?></lastBuildDate>
    46 	<language><?php bloginfo_rss( 'language' ); ?></language>
    49 	<language><?php bloginfo_rss( 'language' ); ?></language>
    47 	<sy:updatePeriod><?php
    50 	<sy:updatePeriod><?php
    48 		$duration = 'hourly';
    51 		$duration = 'hourly';
    49 
    52 
    50 		/**
    53 		/**
    51 		 * Filter how often to update the RSS feed.
    54 		 * Filters how often to update the RSS feed.
    52 		 *
    55 		 *
    53 		 * @since 2.1.0
    56 		 * @since 2.1.0
    54 		 *
    57 		 *
    55 		 * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
    58 		 * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
    56 		 *                         'yearly'. Default 'hourly'.
    59 		 *                         'yearly'. Default 'hourly'.
    59 	?></sy:updatePeriod>
    62 	?></sy:updatePeriod>
    60 	<sy:updateFrequency><?php
    63 	<sy:updateFrequency><?php
    61 		$frequency = '1';
    64 		$frequency = '1';
    62 
    65 
    63 		/**
    66 		/**
    64 		 * Filter the RSS update frequency.
    67 		 * Filters the RSS update frequency.
    65 		 *
    68 		 *
    66 		 * @since 2.1.0
    69 		 * @since 2.1.0
    67 		 *
    70 		 *
    68 		 * @param string $frequency An integer passed as a string representing the frequency
    71 		 * @param string $frequency An integer passed as a string representing the frequency
    69 		 *                          of RSS updates within the update period. Default '1'.
    72 		 *                          of RSS updates within the update period. Default '1'.
    81 	while( have_posts()) : the_post();
    84 	while( have_posts()) : the_post();
    82 	?>
    85 	?>
    83 	<item>
    86 	<item>
    84 		<title><?php the_title_rss() ?></title>
    87 		<title><?php the_title_rss() ?></title>
    85 		<link><?php the_permalink_rss() ?></link>
    88 		<link><?php the_permalink_rss() ?></link>
       
    89 <?php if ( get_comments_number() || comments_open() ) : ?>
    86 		<comments><?php comments_link_feed(); ?></comments>
    90 		<comments><?php comments_link_feed(); ?></comments>
       
    91 <?php endif; ?>
    87 		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    92 		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    88 		<dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
    93 		<dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
    89 		<?php the_category_rss('rss2') ?>
    94 		<?php the_category_rss('rss2') ?>
    90 
    95 
    91 		<guid isPermaLink="false"><?php the_guid(); ?></guid>
    96 		<guid isPermaLink="false"><?php the_guid(); ?></guid>
    98 		<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
   103 		<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
    99 	<?php else : ?>
   104 	<?php else : ?>
   100 		<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
   105 		<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
   101 	<?php endif; ?>
   106 	<?php endif; ?>
   102 <?php endif; ?>
   107 <?php endif; ?>
       
   108 <?php if ( get_comments_number() || comments_open() ) : ?>
   103 		<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
   109 		<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
   104 		<slash:comments><?php echo get_comments_number(); ?></slash:comments>
   110 		<slash:comments><?php echo get_comments_number(); ?></slash:comments>
       
   111 <?php endif; ?>
   105 <?php rss_enclosure(); ?>
   112 <?php rss_enclosure(); ?>
   106 	<?php
   113 	<?php
   107 	/**
   114 	/**
   108 	 * Fires at the end of each RSS2 feed item.
   115 	 * Fires at the end of each RSS2 feed item.
   109 	 *
   116 	 *