simpub/rss.php

41 lines
1.3 KiB
PHP
Raw Normal View History

2017-05-27 11:45:08 +02:00
<?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;
2017-09-30 16:09:46 +02:00
2017-05-27 11:45:08 +02:00
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>
2017-09-30 16:09:46 +02:00
<lastBuildDate>' . date(RSS_DATE_FORMAT, $latestDisplayedPost) . '</lastBuildDate>
<pubDate>' . date(RSS_DATE_FORMAT, $latestDisplayedPost) . '</pubDate>
2017-05-27 11:45:08 +02:00
<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>';
}
?>