page: rename article method "body" to "story"
[minimedit.git] / nieuws / feed / index.php
1 <?php
2 ob_clean();
3 header('Content-Type: application/atom+xml; charset=utf-8');
4 print '<?xml version="1.0" encoding="utf-8"?>';
5 $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
6 ?>
7
8 <feed xmlns="http://www.w3.org/2005/Atom">
9         <title>Lijtweg.nl</title>
10         <subtitle>Nieuwsberichten</subtitle>
11         <id><?= $siteref ?>/</id>
12         <link href="<?= $siteref ?>/" />
13         <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
14         <author><name>Lijtweg</name></author>
15 <?php
16 $root = preg_replace('{/feed$}', '', $Page) . "/2???";
17 $pages = array_reverse(glob("$root/*.html"));
18
19 foreach ($pages as $i => $page) {
20         $article = new ArchiveArticle($page);
21         if (!$i) {
22                 // feed metadata from top (most recent) article
23                 print "\t<updated>{$article->lastiso}</updated>\n";
24         }
25 ?>
26
27         <entry>
28                 <id><?= $siteref . '/' . $article->link ?></id>
29                 <link href="<?= $siteref . '/' . $article->link ?>" />
30                 <title><?= $article->title ?></title>
31                 <published><?= $article->dateiso ?></published>
32                 <updated><?= $article->dateiso ?></updated>
33                 <content type="html"><?= htmlspecialchars($article->story) ?>
34                 </content>
35 <?php
36         if ($article->thumb) {
37                 printf("\t\t".'<link rel="enclosure" type="%s" href="%s"%s />'."\n",
38                         'image/jpeg',
39                         "$siteref/{$article->thumb}",
40                         file_exists($article->thumb) ? sprintf(' length="%d"', filesize($article->thumb)) : ''
41                 );
42         }
43 ?>
44         </entry>
45 <?php
46 }
47 ?>
48 </feed>
49 <?php
50 exit;