summaryrefslogtreecommitdiff
path: root/skin/rss.skin.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-07-09 19:40:17 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-07-09 19:40:17 +0300
commitf7bfdf58def6aadc922e1632f407d1418269a0d7 (patch)
treed7a0b2819e6a26c11d40ee0b27267ea827fbb345 /skin/rss.skin.php
initial
Diffstat (limited to 'skin/rss.skin.php')
-rw-r--r--skin/rss.skin.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/skin/rss.skin.php b/skin/rss.skin.php
new file mode 100644
index 0000000..0806182
--- /dev/null
+++ b/skin/rss.skin.php
@@ -0,0 +1,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;
+} \ No newline at end of file