cvs: php-master-web /scripts rss_parser
| From: | Gabor Hojtsy | Date: | Sat, 04 Jan 2003 19:34:15 +0000 |
| Subject: | cvs: php-master-web /scripts rss_parser | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-14710@lists.php.net to get a copy of this message | ||
goba Sat Jan 4 14:34:15 2003 EDT
Modified files:
/php-master-web/scripts rss_parser
Log:
Adding date information to RSS feed
Index: php-master-web/scripts/rss_parser
diff -u php-master-web/scripts/rss_parser:1.2 php-master-web/scripts/rss_parser:1.3
--- php-master-web/scripts/rss_parser:1.2 Tue Nov 19 14:24:10 2002
+++ php-master-web/scripts/rss_parser Sat Jan 4 14:34:15 2003
@@ -133,6 +133,9 @@
// And the text needs to be cleaned up
$headlines[$num]['text'] = ProcessText($headline['text']);
+
+ // And date needs to be reformatted
+ $headlines[$num]['date'] = date("Y-m-d", $headline['date']);
}
return $headlines;
@@ -144,6 +147,7 @@
"<rdf:RDF\n" .
"\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
.
"\txmlns=\"http://purl.org/rss/1.0/\"\n" .
+ "\txmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n"
.
">\n" .
"<channel rdf:about=\"http://www.php.net/\">\n" .
"\t<title>PHP: Hypertext Preprocessor</title>\n" .
@@ -166,11 +170,12 @@
}
// Add an RSS item's information to $RSS
-function GenerateRSSItem($href, $title, $text, &$RSS) {
+function GenerateRSSItem($href, $title, $text, $date, &$RSS) {
$RSS .= "\n<item rdf:about=\"$href\">\n" .
"\t<title>" . htmlspecialchars($title) . "</title>\n" .
"\t<link>" . htmlspecialchars($href) . "</link>\n" .
"\t<description>" . htmlspecialchars($text) .
"</description>\n" .
+ "\t<dc:date>" . $date . "</dc:date>\n" .
"</item>\n";
}
@@ -191,7 +196,7 @@
// Add every news item to the feed
foreach ($hlines as $hline) {
- GenerateRSSItem($hline['link'], $hline['title'], $hline['text'],
$RSS);
+ GenerateRSSItem($hline['link'], $hline['title'], $hline['text'],
$hline['date'], $RSS);
}
// Add end separator