atom feed support
[push-tester.git] / www / index.php
index 0a205f80943041fc1f3540dd170fd3c00269f390..6a98ad05e37ff6af492657c4bf2b1803808bf22f 100644 (file)
@@ -1,30 +1,20 @@
 <?php
 require_once __DIR__ . '/../data/config.php';
+require_once __DIR__ . '/functions.php';
 header('Link: <' . $hub . '>; rel="hub"');
 header('Link: <' . $self . '>; rel="self"', false);
 
-$files = glob(__DIR__ . '/articles/*.htm');
-$articles = array();
-foreach ($files as $file) {
-    $content = file_get_contents($file);
-    $xml = simplexml_load_string($content);
-    $timestamp = strtotime(basename($file, '.htm'));
-    $articles[$timestamp] = (object) array(
-        'file' => 'articles/' . basename($file),
-        'title' => basename($file, '.htm'),
-        'content' => (string) $xml->body->div,
-        'time' => $timestamp,
-    );
-}
-krsort($articles);
+$articles = loadArticles();
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
   <title>PubSubHubbub tester</title>
+  <link rel="alternate" type="application/atom+xml" title="PubSubHubbub tester" href="feed.php" />
  </head>
  <body class="h-feed">
   <p>
    <a href="add-article.php">create new article</a>
+   | <a href="feed.php">atom feed</a>
   </p>
   <h1>Articles</h1>
   <?php foreach ($articles as $article) { ?>