-
- print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
- print '<' . '?xml-stylesheet type="text/css" href="' .
- htmlspecialchars( "$wgServer$wgStylePath/feed.css" ) . '"?' . ">\n";
+
+ }
+
+ /**
+ * Return an internet media type to be sent in the headers.
+ *
+ * @return string
+ * @private
+ */
+ function contentType() {
+ global $wgRequest;
+ $ctype = $wgRequest->getVal('ctype','application/xml');
+ $allowedctypes = array('application/xml','text/xml','application/rss+xml','application/atom+xml');
+ return (in_array($ctype, $allowedctypes) ? $ctype : 'application/xml');
+ }
+
+ /**
+ * Output the initial XML headers with a stylesheet for legibility
+ * if someone finds it in a browser.
+ * @private
+ */
+ function outXmlHeader() {
+ global $wgStylePath, $wgStyleVersion;
+
+ $this->httpHeaders();
+ echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
+ echo '<?xml-stylesheet type="text/css" href="' .
+ htmlspecialchars( wfExpandUrl( "$wgStylePath/common/feed.css?$wgStyleVersion" ) ) .
+ '"?' . ">\n";