29 abstract class ChannelFeed
extends FeedItem {
42 function __construct(
$title, $description, $url, $date =
'', $author =
'', $comments =
'' ) {
43 parent::__construct(
$title, $description, $url, $date, $author, $comments );
44 $this->templateParser =
new TemplateParser();
54 abstract public function outHeader();
64 abstract public function outItem( $item );
73 abstract public function outFooter();
83 public function httpHeaders() {
86 # We take over from $wgOut, excepting its cache header info
88 $mimetype = $this->contentType();
89 header(
"Content-type: $mimetype; charset=UTF-8" );
93 ->getExtensionsForType( $mimetype );
94 $ext = $exts ? strtok( $exts,
' ' ) :
'xml';
95 header(
"Content-Disposition: inline; filename=\"feed.{$ext}\"" );
98 $wgOut->addVaryHeader(
'X-Forwarded-Proto' );
100 $wgOut->sendCacheControl();
108 private function contentType() {
111 $ctype =
$wgRequest->getVal(
'ctype',
'application/xml' );
115 'application/rss+xml',
116 'application/atom+xml'
119 return ( in_array( $ctype, $allowedctypes ) ? $ctype :
'application/xml' );
125 protected function outXmlHeader() {
126 $this->httpHeaders();
127 echo
'<?xml version="1.0"?>' .
"\n";