~leeturner/quam-plures/no_generator_templates

« back to all changes in this revision

Viewing changes to _rss2/comments.main.php

  • Committer: EdB
  • Date: 2011-06-24 21:50:18 UTC
  • Revision ID: 1912webworks@gmail.com-20110624215018-gto0jd6sfd6uq43h
updated credits.disp page(s), added templates from the core package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Generates an RSS 2.0 feed for the requested blog's latest comments
 
4
 *
 
5
 * See {@link http://backend.userland.com/rss}
 
6
 *
 
7
 * @package xml
 
8
 * @subpackage rss2
 
9
 */
 
10
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
 
11
 
 
12
if( isset($Item) )
 
13
{ // Comments for a specific Item:
 
14
        $CommentList = new CommentList( $Blog, "'comment'", array('published'), $Item->ID, '', 'DESC', '', $Blog->get_setting('posts_per_feed') );
 
15
        $selfurl = format_to_output( $Item->get_feedback_feed_url( '_rss2' ), 'xmlattr' );
 
16
}
 
17
else
 
18
{ // Comments for the blog:
 
19
        $CommentList = new CommentList( $Blog, "'comment'", array('published'), '', '', 'DESC', '', $Blog->get_setting('posts_per_feed') );
 
20
        $selfurl = format_to_output( $Blog->get_comment_feed_url( '_rss2' ), 'xmlattr' );
 
21
}
 
22
 
 
23
header_content_type( 'application/xml' ); // sets charset
 
24
 
 
25
echo '<?xml version="1.0" encoding="'.$io_charset.'"?'.'>';
 
26
?>
 
27
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
 
28
        <channel>
 
29
                <title><?php
 
30
                        $Blog->disp( 'name', 'xml' );
 
31
                        // title for the current request
 
32
                        request_title( array(
 
33
                                'title_before' => ' - ',
 
34
                                'format' => 'xml',
 
35
                        ) ); ?></title>
 
36
                <link><?php $Blog->disp( 'lastcommentsurl', 'xml' ) ?></link>
 
37
                <atom:link rel="self" type="application/rss+xml" href="<?php echo $selfurl; ?>" />
 
38
                <description></description>
 
39
                <language><?php $Blog->disp( 'locale', 'xml' ) ?></language>
 
40
                <docs>http://backend.userland.com/rss</docs>
 
41
                <admin:generatorAgent rdf:resource="<?php echo $app_homepage ?>"/>
 
42
                <ttl>60</ttl>
 
43
                <?php while( $Comment = & $CommentList->get_next() )
 
44
                { // Loop through comments:
 
45
                        // Load comment's Item:
 
46
                        $Comment->get_Item();
 
47
                        ?>
 
48
                <item>
 
49
                        <title><?php echo format_to_output( $Template->T_('In response to').':', 'xml' ) ?> <?php $Comment->Item->title( array( 'format' => 'xml', 'link_type' => 'none' ) ); ?></title>
 
50
                        <pubDate><?php $Comment->time( array( 'format' => 'r', 'useGM' => true ) ); ?></pubDate>
 
51
                        <dc:creator><?php $Comment->author( array( 'format' => 'xml' ) ); ?></dc:creator>
 
52
                        <guid isPermaLink="false">c<?php $Comment->ID(); ?>@<?php echo $app_baseurl ?></guid>
 
53
                        <description><?php echo make_rel_links_abs( $Comment->get_content('entityencoded') ); ?></description>
 
54
                        <content:encoded><![CDATA[<?php echo make_rel_links_abs( $Comment->get_content() ); ?>]]></content:encoded>
 
55
                        <link><?php $Comment->permanent_url(); ?></link>
 
56
                </item>
 
57
                <?php
 
58
                } /* End of comment loop. */
 
59
        ?>
 
60
        </channel>
 
61
</rss>
 
62
<?php $Hit->log(); // log the hit on this page ?>