fix xml problems
[push-tester.git] / www / index.php
index b4d0b2ff6d0dc90fa060c9b8cc3b6b5e005913c8..9be78bc1289bca6816b25953ec3b5683c287eb02 100644 (file)
@@ -1,30 +1,25 @@
 <?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>
+  <title>WebSub tester</title>
+  <link rel="alternate" type="application/atom+xml" title="WebSub 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>
+  <p>
+   This is a tool to test your <a href="https://www.w3.org/TR/websub/">WebSub</a>
+   subscriber.
+   With one click, a new post gets published and the hub gets notified.
   </p>
   <h1>Articles</h1>
   <?php foreach ($articles as $article) { ?>
@@ -35,7 +30,12 @@ krsort($articles);
     </div>
     <p>
      <a href="<?php echo $article->file; ?>" class="u-url">permalink</a>
-      <time class="dt-published"><?php echo date('c', $article->time); ?></time>
+     at <time class="dt-published"><?php echo date('c', $article->time); ?></time>
+     by
+     <span class="h-card vcard author p-author">
+      <img class="u-photo" src="someone.png" width="16" height="16" alt=""/>
+      <a class="p-author h-card" href="someone.htm">Someone</a>
+     </span>
     </p>
    </article>
   <?php } ?>