b4d0b2ff6d0dc90fa060c9b8cc3b6b5e005913c8
[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   <p>
27    <a href="add-article.php">create new article</a>
28   </p>
29   <h1>Articles</h1>
30   <?php foreach ($articles as $article) { ?>
31    <article class="h-entry">
32     <h2><?php echo htmlspecialchars($article->title); ?></h2>
33     <div class="e-content">
34      <?php echo $article->content; ?>
35     </div>
36     <p>
37      <a href="<?php echo $article->file; ?>" class="u-url">permalink</a>
38       <time class="dt-published"><?php echo date('c', $article->time); ?></time>
39     </p>
40    </article>
41   <?php } ?>
42  </body>
43 </html>