forked from peter279k/rss-php
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample-atom.php
More file actions
28 lines (19 loc) · 751 Bytes
/
example-atom.php
File metadata and controls
28 lines (19 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
use Grunjol\Feed\Feed;
header('Content-Type: text/html; charset=utf-8');
if (!ini_get('date.timezone')) {
date_default_timezone_set('Europe/Prague');
}
require_once 'src/Feed.php';
$atom = Feed::loadAtom('http://php.vrana.cz/atom.php');
?>
<h1><?php echo htmlSpecialChars($atom->title) ?></h1>
<?php foreach ($atom->entry as $entry): ?>
<h2><a href="<?php echo htmlSpecialChars($entry->link['href']) ?>"><?php echo htmlSpecialChars($entry->title) ?></a>
<small><?php echo date("j.n.Y H:i", (int) $entry->timestamp) ?></small></h2>
<?php if ($entry->content['type'] == 'html'): ?>
<div><?php echo $entry->content ?></div>
<?php else: ?>
<p><?php echo htmlSpecialChars($entry->content) ?></p>
<?php endif ?>
<?php endforeach ?>