use FeedCreator to generate syndicated feeds

This commit is contained in:
Andrew Dolgov 2006-10-12 04:27:03 +01:00
parent a422968f92
commit ed313cdea9
3 changed files with 1557 additions and 21 deletions

3
README
View File

@ -14,8 +14,9 @@ Portions (C):
Sundar Dorai-Raj <sdoraira@vt.edu> (isNumeric() in functions.js) Sundar Dorai-Raj <sdoraira@vt.edu> (isNumeric() in functions.js)
Uses Prototype javascript library, from http://prototype.conio.net/ Uses Prototype javascript library, from http://prototype.conio.net/
Uses FeedCreator library, from http://www.bitfolge.de/rsscreator-en.html
Licensed under GNU GPL version 2 Tiny Tiny RSS is licensed under GNU GPL version 2
Features Overview Features Overview
================= =================

1541
feedcreator.class.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@
require_once 'simplepie/simplepie.inc'; require_once 'simplepie/simplepie.inc';
} }
require_once "feedcreator.class.php";
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
function purge_feed($link, $feed_id, $purge_interval, $debug = false) { function purge_feed($link, $feed_id, $purge_interval, $debug = false) {
@ -2360,7 +2362,7 @@
} }
function generate_syndicated_feed($link, $feed, $is_cat, function generate_syndicated_feed($link, $feed, $is_cat,
$search, $search_mode, $match_on) { $search, $search_mode, $match_on, $output_format = "RSS2.0") {
$qfh_ret = queryFeedHeadlines($link, $feed, $qfh_ret = queryFeedHeadlines($link, $feed,
30, false, $is_cat, $search, $search_mode, $match_on, "updated DESC"); 30, false, $is_cat, $search, $search_mode, $match_on, "updated DESC");
@ -2370,31 +2372,23 @@
$feed_site_url = $qfh_ret[2]; $feed_site_url = $qfh_ret[2];
$last_error = $qfh_ret[3]; $last_error = $qfh_ret[3];
print "<rss version=\"2.0\"> $rss = new UniversalFeedCreator();
<channel>
<title>$feed_title</title> $rss->title = $feed_title;
<link>$feed_site_url</link> $rss->link = $feed_site_url;
<generator>Tiny Tiny RSS v".VERSION."</generator>";
while ($line = db_fetch_assoc($result)) { while ($line = db_fetch_assoc($result)) {
print "<item>";
print "<id>" . htmlspecialchars($line["guid"]) . "</id>";
print "<link>" . htmlspecialchars($line["link"]) . "</link>";
$rfc822_date = date('r', strtotime($line["updated"])); $item = new FeedItem();
$item->title = $line["title"];
$item->description = $line["content_preview"];
$item->date = strtotime($line["updated"]);
$item->id = $line["guid"];
print "<pubDate>$rfc822_date</pubDate>"; $rss->addItem($item);
print "<title>" .
htmlspecialchars($line["title"]) . "</title>";
print "<description>" .
htmlspecialchars($line["content_preview"]) . "</description>";
print "</item>";
} }
print "</channel></rss>"; print $rss->createFeed($output_format);
} }