var $Author = '';
/**#@-*/
- /**
+ /**#@+
* @todo document
*/
function FeedItem( $Title, $Description, $Url, $Date = '', $Author = '', $Comments = '' ) {
/**
* @static
- * @todo document
*/
function xmlEncode( $string ) {
$string = str_replace( "\r\n", "\n", $string );
return htmlspecialchars( $string );
}
- /**
- * @todo document
- */
function getTitle() { return $this->xmlEncode( $this->Title ); }
- /**
- * @todo document
- */
function getUrl() { return $this->xmlEncode( $this->Url ); }
- /**
- * @todo document
- */
function getDescription() { return $this->xmlEncode( $this->Description ); }
- /**
- * @todo document
- */
function getLanguage() {
global $wgContLanguageCode;
return $wgContLanguageCode;
}
- /**
- * @todo document
- */
function getDate() { return $this->Date; }
- /**
- * @todo document
- */
function getAuthor() { return $this->xmlEncode( $this->Author ); }
- /**
- * @todo document
- */
function getComments() { return $this->xmlEncode( $this->Comments ); }
+ /**#@-*/
}
/**
* @access private
*/
function contentType() {
- return 'application/xml';
+ 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');
}
/**
global $wgServer, $wgStylePath;
$this->httpHeaders();
- print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n";
- print '<' . '?xml-stylesheet type="text/css" href="' .
+ echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
+ echo '<?xml-stylesheet type="text/css" href="' .
htmlspecialchars( "$wgServer$wgStylePath/common/feed.css" ) . '"?' . ">\n";
}
}