add author, url and photo
[push-tester.git] / www / index.php
1 <?php
2 require_once __DIR__ . '/../data/config.php';
3 header('Link: <' . $hub . '>; rel="hub"');
4 header('Link: <' . $self . '>; rel="self"', false);
5
6 $files = glob(__DIR__ . '/articles/*.htm');
7 $articles = array();
8 foreach ($files as $file) {
9     $content = file_get_contents($file);
10     $xml = simplexml_load_string($content);
11     $timestamp = strtotime(basename($file, '.htm'));
12     $articles[$timestamp] = (object) array(
13         'file' => 'articles/' . basename($file),
14         'title' => basename($file, '.htm'),
15         'content' => (string) $xml->body->div,
16         'time' => $timestamp,
17     );
18 }
19 krsort($articles);
20 ?>
21 <html xmlns="http://www.w3.org/1999/xhtml">
22  <head>
23   <title>PubSubHubbub tester</title>
24  </head>
25  <body class="h-feed">
26   <iframe src="" id="addview" name="addview" style="position: absolute; right: 0.5ex; width: 60ex; height: 10ex; border: 1px solid grey"></iframe>
27   <p>
28    <a href="add-article.php" target="addview">create new article</a>
29   </p>
30   <h1>Articles</h1>
31   <?php foreach ($articles as $article) { ?>
32    <article class="h-entry">
33     <h2><?php echo htmlspecialchars($article->title); ?></h2>
34     <div class="e-content">
35      <?php echo $article->content; ?>
36     </div>
37     <p>
38      <a href="<?php echo $article->file; ?>" class="u-url">permalink</a>
39      at <time class="dt-published"><?php echo date('c', $article->time); ?></time>
40      by
41      <span class="h-card vcard author p-author">
42       <img class="u-photo" src="someone.png" width="16" height="16" alt=""/>
43       <a class="p-author h-card" href="someone.htm">Someone</a>
44      </span>
45     </p>
46    </article>
47   <?php } ?>
48  </body>
49 </html>