make generated_feed parameters optional, add specific date type for RSS feeds

master
Andrew Dolgov 13 years ago
parent 2ab20c313c
commit 9c97041d55

@ -38,23 +38,23 @@ class Public_Handler extends Handler {
$tpl->readTemplateFromFile("templates/generated_feed.txt");
$tpl->setVariable('FEED_TITLE', $feed_title);
$tpl->setVariable('VERSION', VERSION);
$tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url));
$tpl->setVariable('FEED_TITLE', $feed_title, true);
$tpl->setVariable('VERSION', VERSION, true);
$tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
if (PUBSUBHUBBUB_HUB && $feed == -2) {
$tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB));
$tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
$tpl->addBlock('feed_hub');
}
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()));
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
while ($line = db_fetch_assoc($result)) {
$tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']));
$tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']));
$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']));
$tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
$tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
$tpl->setVariable('ARTICLE_EXCERPT',
truncate_string(strip_tags($line["content_preview"]), 100, '...'));
truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
$content = sanitize($this->link, $line["content_preview"], false, $owner_uid);
@ -63,15 +63,19 @@ class Public_Handler extends Handler {
$content;
}
$tpl->setVariable('ARTICLE_CONTENT', $content);
$tpl->setVariable('ARTICLE_CONTENT', $content, true);
$tpl->setVariable('ARTICLE_UPDATED', date('c', strtotime($line["updated"])));
$tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']));
$tpl->setVariable('ARTICLE_UPDATED_ATOM',
date('c', strtotime($line["updated"])), true);
$tpl->setVariable('ARTICLE_UPDATED_RFC822',
date(DATE_RFC822, strtotime($line["updated"])), true);
$tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true);
$tags = get_article_tags($this->link, $line["id"], $owner_uid);
foreach ($tags as $tag) {
$tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag));
$tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true);
$tpl->addBlock('category');
}
@ -82,9 +86,9 @@ class Public_Handler extends Handler {
$url = htmlspecialchars($e['content_url']);
$length = $e['duration'];
$tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url);
$tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type);
$tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length);
$tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true);
$tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true);
$tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true);
$tpl->addBlock('enclosure');
}

@ -4,7 +4,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<title>${FEED_TITLE}</title>
<generator uri="http://tt-rss.org/">Tiny Tiny RSS/${VERSION}</generator>
<updated>${ARTICLE_UPDATED}</updated>
<updated>${ARTICLE_UPDATED_ATOM}</updated>
<id>${FEED_URL}</id>
<link href="${FEED_URL}" rel="self"/>
<!-- $BeginBlock feed_hub -->
@ -18,7 +18,7 @@
<title>${ARTICLE_TITLE}</title>
<summary type="html"><![CDATA[${ARTICLE_EXCERPT}]]></summary>
<content type="html"><![CDATA[${ARTICLE_CONTENT}]]></content>
<updated>${ARTICLE_UPDATED}</updated>
<updated>${ARTICLE_UPDATED_ATOM}</updated>
<author><name>${ARTICLE_AUTHOR}</name></author>
<!-- $BeginBlock category -->
<category term="${ARTICLE_CATEGORY}"/>

Loading…
Cancel
Save