-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.php
51 lines (42 loc) · 1.19 KB
/
atom.php
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
include_once "common/controller.php";
include_once "models/site.php";
include_once "models/post.php";
class AtomFeedController extends Controller
{
function __construct()
{
parent::__construct();
$this->render();
}
function render(): void
{
if (!$this->site->allow_atom_feed)
{
http_response_code(404);
exit;
}
$posts = PostStore::mostRecent();
if ($this->site->site_name) {
$feed_title = $this->site->site_name;
} else {
$bio_name = $this->site->bio_name;
$feed_title = "$bio_name\'s Microblog";
}
if ($this->site->bio) {
$feed_description = $this->site->bio;
} else {
$bio_name = $this->site->bio_name;
$feed_description = "$bio_name\'s Microblog";
}
$params = array(
"posts" => $posts,
"feed_title" => $feed_title,
"feed_description" => $feed_description,
"site_config" => $this->site
);
$template = parent::getTemplate("atom.phtml");
$template->display($params);
}
}
$page = new AtomFeedController();