blob: 08061821e0c9e8cdde59b7f7f473e9521652845a (
plain)
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
|
<?php
namespace skin\rss;
function atom($ctx, $title, $link, $rss_link, $items) {
return <<<HTML
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>{$title}</title>
<link>{$link}</link>
<description/>
<atom:link href="{$rss_link}" rel="self" type="application/rss+xml"/>
{$ctx->for_each($items, fn($item) => $ctx->item(...$item))}
</channel>
</rss>
HTML;
}
function item($ctx, $title, $link, $pub_date, $description) {
return <<<HTML
<item>
<title>{$title}</title>
<link>{$link}</link>
<pubDate>{$pub_date}</pubDate>
<description>{$description}</description>
</item>
HTML;
}
|