function outFooter() {
# print "</feed>";
}
+
+ function outXmlHeader( $mimetype="application/xml" ) {
+ global $wgServer, $wgStylePath, $wgOut;
+
+ # We take over from $wgOut, excepting its cache header info
+ $wgOut->disable();
+ header( "Content-type: $mimetype; charset=UTF-8" );
+ $wgOut->sendCacheControl();
+
+ print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
+ print '<' . '?xml-stylesheet type="text/css" href="' .
+ htmlspecialchars( "$wgServer$wgStylePath/feed.css" ) . '"?' . ">\n";
+ }
}
class RSSFeed extends ChannelFeed {
}
function outHeader() {
- global $wgVersion, $wgOut;
+ global $wgVersion;
- # We take over from $wgOut, excepting its cache header info
- $wgOut->disable();
- header( "Content-type: application/xml; charset=UTF-8" );
- $wgOut->sendCacheControl();
-
- print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
+ $this->outXmlHeader();
?><rss version="2.0">
<channel>
<title><?php print $this->getTitle() ?></title>
function outHeader() {
global $wgVersion, $wgOut;
- # We take over from $wgOut, excepting its cache header info
- $wgOut->disable();
- header( "Content-type: application/xml; charset=UTF-8" );
- $wgOut->sendCacheControl();
-
- print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
+ $this->outXmlHeader();
?><feed version="0.3" xml:lang="<?php print $this->getLanguage() ?>">
<title><?php print $this->getTitle() ?></title>
<link rel="alternate" type="text/html" href="<?php print $this->getUrl() ?>"/>
--- /dev/null
+/* Make RSS and Atom feeds at least semi-legible to folk who accidentally load them in a browser */
+
+/* RSS: */ rss, channel, title, link, description, language, generator, lastBuildDate, item, pubDate, author, comments,
+/* Atom: */ feed, modified, tagline, entry, issued, created, summary, comment {
+ display: block;
+}
+
+rss, feed {
+ background: white;
+ color: black;
+ margin: 1em;
+ font-family: "Verdana", "Tahoma", "Arial", "Helvetica", sans-serif;
+ line-height: 1.5em;
+}
+
+rss:before {
+ content: "This RSS feed is meant to be read by a syndicated news reader, and isn't ideal for a web browser.";
+}
+
+feed:before {
+ content: "This Atom feed is meant to be read by a syndicated news reader, and isn't ideal for a web browser.";
+}
+rss:before, feed:before {
+ color: red;
+ text-align: center;
+ line-height: 2em;
+}
+
+channel>title,
+item>title,
+feed>title,
+entry>title {
+ font-weight: bold;
+ border-bottom: solid 1px #aaa;
+ margin-left: -0.5em;
+}
+channel>title, feed>title {
+ font-size: larger;
+}
+item>title, entry>title {
+ font-size: large;
+}
+item, entry {
+ margin-top: 1em;
+ margin-left: 2em;
+}
+
+item>description, entry>summary {
+ white-space: pre;
+ overflow: auto;
+ background: #f8f8ff;
+}
+
+pubDate:before { content: "Date: " }
+link:before { content: "Link: " }
+author:before { content: "Author: " }
+description:before { content: "Description: " }
+
+generator:before { content: "Generator: " }
+language:before { content: "Language: " }
+lastBuildDate:before { content: "Updated: " }
+comments:before { content: "Comments page: " }
+
+tagline:before { content: "Tagline: " }
+issued:before { content: "Issued: " }
+created:before { content: "Created: " }
+modified:before { content: "Modified: " }
+summary:before { content: "Summary: " }
+comment:before { content: "Comment: " }
+
+pubDate:before, link:before, author:before, description:before,
+language:before, generator:before, lastBuildDate:before, comments:before,
+tagline:before, issued:before, created:before, modified:before,
+summary:before, comment:before {
+ color: #224;
+ font-weight: bold;
+}
+