]> git.wh0rd.org Git - tt-rss.git/commitdiff
make generated_feed parameters optional, add specific date type for RSS feeds
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 27 Feb 2012 10:39:15 +0000 (14:39 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 27 Feb 2012 10:39:15 +0000 (14:39 +0400)
classes/public_handler.php
templates/generated_feed.txt

index 0896e498c26177a435f721143dc6a16ef591ac90..7db341458bc89bcdd22e6f3c524563212ad12c6b 100644 (file)
@@ -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');
                        }
index dff67cf7e0e20d19bcab6c0eccefea670c9736b1..6bfa50b1beacffc28c73b54f0a3c97e08d68fe88 100644 (file)
@@ -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}"/>