simpub/rss.php

41 lines
1.3 KiB
PHP

<?php
$CMS_ACTIVE = true;
$CMS_RSS = true;
require_once "shared.php";
if (RSS_ENABLED) {
header('Content-Type: application/rss+xml; charset=UTF-8');
ob_start(function($output) {
global $tagSearch;
global $latestDisplayedPost;
if (!isset($latestDisplayedPost)) {
$latestDisplayedPost = time();
}
if ($tagSearch != "") {
$tagSearchTitle = " - Archive for '" . $tagSearch . "'";
} else {
$tagSearchTitle = "";
}
$output = '<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="' . getServerUrl() . '/style.css" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>' . PAGE_NAME . $tagSearchTitle . '</title>
<description><![CDATA[' . "Blog of " . PAGE_AUTHOR . $tagSearchTitle . ']]></description>
<link>' . getServerUrl() . '</link>
<lastBuildDate>' . date(RSS_DATE_FORMAT, $latestDisplayedPost) . '</lastBuildDate>
<pubDate>' . date(RSS_DATE_FORMAT, $latestDisplayedPost) . '</pubDate>
<ttl>' . RSS_REFRESH_INTERVAL . '</ttl>
<atom:link href="' . getServerUrl() . "/rss.php" . '" rel="self" type="application/rss+xml" />
' . $output;
return $output;
});
require "blog.php";
echo '</channel></rss>';
}
?>