fix xml problems
[push-tester.git] / www / feed.php
1 <?php
2 require_once __DIR__ . '/../data/config.php';
3 require_once __DIR__ . '/functions.php';
4 header('Content-type: application/atom+xml');
5 header('Link: <' . $hub . '>; rel="hub"');
6 header('Link: <' . $self . 'feed.php>; rel="self"', false);
7
8 $articles = loadArticles();
9 reset($articles);
10 $lastUpdate = key($articles);
11 ?>
12 <?xml version="1.0" encoding="utf-8" ?>
13 <feed xmlns="http://www.w3.org/2005/Atom">
14  <title>WebSub tester</title>
15  <author>
16   <name>Someone</name>
17   <email>someone@example.org</email>
18  </author>
19  <link href="<?php echo $self; ?>"/>
20  <link rel="self" href="<?php echo $self; ?>feed.php"/>
21  <link rel="hub" href="<?php echo $hub; ?>"/>
22  <link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" />
23  <id><?php echo $self; ?>feed.php</id>
24  <updated><?php echo date('c', $lastUpdate); ?></updated>
25
26  <?php foreach ($articles as $article) { ?>
27  <entry>
28   <id><?php echo $article->file; ?></id>
29   <title><?php echo htmlspecialchars($article->title); ?></title>
30   <published><?php echo date('c', $article->time); ?></published>
31   <updated><?php echo date('c', $article->time); ?></updated>
32   <summary><?php echo substr($article->content, 0, 100); ?>&#8230;</summary>
33   <content type="xhtml">
34    <div xmlns="http://www.w3.org/1999/xhtml">
35     <?php echo $article->content; ?>
36    </div>
37   </content>
38   <link rel="alternate" type="text/html" href="<?php echo $self . $article->file; ?>" />
39  </entry>
40  <?php } ?>
41 </feed>