~canonical-sysadmins/wordpress/4.7.4

« back to all changes in this revision

Viewing changes to wp-includes/feed-rss2.php

  • Committer: Jacek Nykis
  • Date: 2015-01-05 16:17:05 UTC
  • Revision ID: jacek.nykis@canonical.com-20150105161705-w544l1h5mcg7u4w9
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * RSS2 Feed Template for displaying RSS2 Posts feed.
 
4
 *
 
5
 * @package WordPress
 
6
 */
 
7
 
 
8
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
 
9
$more = 1;
 
10
 
 
11
echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
 
12
 
 
13
/**
 
14
 * Fires between the <xml> and <rss> tags in a feed.
 
15
 *
 
16
 * @since 4.0.0
 
17
 *
 
18
 * @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments',
 
19
 *                        'rdf', 'atom', and 'atom-comments'.
 
20
 */
 
21
do_action( 'rss_tag_pre', 'rss2' );
 
22
?>
 
23
<rss version="2.0"
 
24
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
 
25
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
 
26
        xmlns:dc="http://purl.org/dc/elements/1.1/"
 
27
        xmlns:atom="http://www.w3.org/2005/Atom"
 
28
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
 
29
        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
 
30
        <?php
 
31
        /**
 
32
         * Fires at the end of the RSS root to add namespaces.
 
33
         *
 
34
         * @since 2.0.0
 
35
         */
 
36
        do_action( 'rss2_ns' );
 
37
        ?>
 
38
>
 
39
 
 
40
<channel>
 
41
        <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
 
42
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
 
43
        <link><?php bloginfo_rss('url') ?></link>
 
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>
 
46
        <language><?php bloginfo_rss( 'language' ); ?></language>
 
47
        <?php
 
48
        $duration = 'hourly';
 
49
        /**
 
50
         * Filter how often to update the RSS feed.
 
51
         *
 
52
         * @since 2.1.0
 
53
         *
 
54
         * @param string $duration The update period.
 
55
         *                         Default 'hourly'. Accepts 'hourly', 'daily', 'weekly', 'monthly', 'yearly'.
 
56
         */
 
57
        ?>
 
58
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', $duration ); ?></sy:updatePeriod>
 
59
        <?php
 
60
        $frequency = '1';
 
61
        /**
 
62
         * Filter the RSS update frequency.
 
63
         *
 
64
         * @since 2.1.0
 
65
         *
 
66
         * @param string $frequency An integer passed as a string representing the frequency
 
67
         *                          of RSS updates within the update period. Default '1'.
 
68
         */
 
69
        ?>
 
70
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', $frequency ); ?></sy:updateFrequency>
 
71
        <?php
 
72
        /**
 
73
         * Fires at the end of the RSS2 Feed Header.
 
74
         *
 
75
         * @since 2.0.0
 
76
         */
 
77
        do_action( 'rss2_head');
 
78
 
 
79
        while( have_posts()) : the_post();
 
80
        ?>
 
81
        <item>
 
82
                <title><?php the_title_rss() ?></title>
 
83
                <link><?php the_permalink_rss() ?></link>
 
84
                <comments><?php comments_link_feed(); ?></comments>
 
85
                <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
 
86
                <dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
 
87
                <?php the_category_rss('rss2') ?>
 
88
 
 
89
                <guid isPermaLink="false"><?php the_guid(); ?></guid>
 
90
<?php if (get_option('rss_use_excerpt')) : ?>
 
91
                <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
 
92
<?php else : ?>
 
93
                <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
 
94
        <?php $content = get_the_content_feed('rss2'); ?>
 
95
        <?php if ( strlen( $content ) > 0 ) : ?>
 
96
                <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
 
97
        <?php else : ?>
 
98
                <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
 
99
        <?php endif; ?>
 
100
<?php endif; ?>
 
101
                <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
 
102
                <slash:comments><?php echo get_comments_number(); ?></slash:comments>
 
103
<?php rss_enclosure(); ?>
 
104
        <?php
 
105
        /**
 
106
         * Fires at the end of each RSS2 feed item.
 
107
         *
 
108
         * @since 2.0.0
 
109
         */
 
110
        do_action( 'rss2_item' );
 
111
        ?>
 
112
        </item>
 
113
        <?php endwhile; ?>
 
114
</channel>
 
115
</rss>