Log in with username/password: lyceum/lyceum

root/branches/1.0/src/lyceum/atom.php

Revision 1285, 1.7 kB (checked in by jjb, 10 months ago)

fixed content type for site-wide atom feed

Line 
1 <?php
2 define('WP_USE_THEMES', true);
3 $blog='NULL';
4 $blogdata='NULL';
5 $optiondomain = 'system';
6 $_REQUEST['b']='system';
7
8 require('private.php');
9 require(CONFIGPATH . 'wp-config.php');
10
11 $site_title = get_settings('site_title');
12
13 $posts = get_recent_posts(10);
14     
15 echo '<?xml version="1.0" encoding="utf-8"?>';
16 $cdata_open  = '<![CDATA[';
17 $cdata_close = ']]>';
18
19 header('Content-type: application/atom+xml');
20
21 ?>
22 <feed
23   xmlns="http://www.w3.org/2005/Atom"
24   xmlns:thr="http://purl.org/syndication/thread/1.0"
25   xml:lang="en"
26   xml:base="<?php echo LURL ?>/atom.php"
27 >
28     <title type="text"><?php echo $site_title ?></title>
29
30     <updated><?php echo gmdate('Y-m-d\TH:i:s\Z') ?></updated>
31     <generator uri="http://lyceum.ibiblio.org/" version="<?php echo $wp_version ?>">Lyceum</generator>
32
33     <link rel="alternate" type="application/atom+xml" href="<?php echo LURL ?>" />
34     <id><?php echo LURL ?>/feed/atom.php/</id>
35     <link rel="self" type="application/atom+xml" href="<?php echo LURL ?>/atom.php" />
36
37 <?php foreach ($posts as $p): ?>
38     <entry>
39         <author>
40             <name><?php echo $p->author_nickname ?></name>
41             <uri><?php echo $p->siteurl ?></uri>
42         </author>
43         <title type="html"><?php echo $cdata_open . $p->post_title . $cdata_close ?></title>
44         <link rel="alternate" type="application/atom+xml" href="<?php echo $p->guid; ?>" />
45         <id><?php echo $p->guid; ?></id>
46         <published><?php echo rfc3339($p->post_date_gmt) ?></published>
47         <updated><?php echo rfc3339($p->post_modified_gmt) ?></updated>
48 <?php if ($p->post_excerpt) : ?>
49         <summary type="html"><?php echo $cdata_open . $p->post_excerpt . $cdata_close ?></summary>
50 <?php endif; ?>
51         <content type="html" xml:base="<?php echo $p->guid; ?>"><?php echo $cdata_open . $p->post_content . $cdata_close ?></content>
52     </entry>
53 <?php endforeach ?>
54 </feed>
Note: See TracBrowser for help on using the browser.
Log in with username/password: lyceum/lyceum