aboutsummaryrefslogtreecommitdiffstats
path: root/changelog/feed.xml.php
diff options
context:
space:
mode:
authorsillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
committersillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
commit898b52edcb47bcb3e9d6106e74ca73e74ea01e70 (patch)
tree85c6ee5ad58b860144551184d4cf86b560c62b91 /changelog/feed.xml.php
downloadwww-898b52edcb47bcb3e9d6106e74ca73e74ea01e70.tar.gz
www-898b52edcb47bcb3e9d6106e74ca73e74ea01e70.zip
import live www.sillylaird.ca webrootHEADmain
Diffstat (limited to 'changelog/feed.xml.php')
-rw-r--r--changelog/feed.xml.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/changelog/feed.xml.php b/changelog/feed.xml.php
new file mode 100644
index 0000000..3a43e6a
--- /dev/null
+++ b/changelog/feed.xml.php
@@ -0,0 +1,37 @@
+<?php
+require_once __DIR__ . '/api/parser.php';
+
+header('Content-Type: application/atom+xml; charset=utf-8');
+header('Cache-Control: public, max-age=900');
+
+$entries = get_changelog_entries(50);
+$site = 'https://www.sillylaird.ca';
+$self = $site . '/changelog/feed.xml.php';
+$updated = $entries[0]['date'] ?? date('Y-m-d');
+
+function _xml(string $s): string {
+ return htmlspecialchars($s, ENT_XML1 | ENT_QUOTES, 'UTF-8');
+}
+
+echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
+?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title>SillyLaird — Changelog</title>
+ <link href="<?= _xml($site) ?>/changelog/" />
+ <link rel="self" href="<?= _xml($self) ?>" />
+ <id><?= _xml($site) ?>/changelog/</id>
+ <updated><?= _xml($updated) ?>T00:00:00Z</updated>
+ <author><name>SillyLaird</name></author>
+<?php foreach ($entries as $e):
+ $id = $site . '/changelog/#' . ($e['date'] ?: $e['raw_date']);
+ $date = $e['date'] ?: date('Y-m-d');
+?>
+ <entry>
+ <title><?= _xml(mb_strimwidth($e['text'], 0, 80, '…', 'UTF-8')) ?></title>
+ <id><?= _xml($id) ?></id>
+ <updated><?= _xml($date) ?>T00:00:00Z</updated>
+ <link href="<?= _xml($site) ?>/changelog/" />
+ <summary type="text"><?= _xml($e['text']) ?></summary>
+ </entry>
+<?php endforeach; ?>
+</feed>