X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FFeed.php;h=35f2ce94385383952a80ef1bd93c8c9605a35899;hb=d965b71fbfa7a96f96341195da97d6467b5b61e7;hp=189fd9f2fb2b245ff1b33f67c37af7cb818bbb3d;hpb=6124d71e25c2894c3e025c20e81ff742045e8cd5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Feed.php b/includes/Feed.php index 189fd9f2fb..35f2ce9438 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -54,8 +54,6 @@ class FeedItem { public $rssIsPermalink = false; /** - * Constructor - * * @param string|Title $title Item's title * @param string $description * @param string $url URL uniquely designating the item. @@ -141,7 +139,7 @@ class FeedItem { */ public function getLanguage() { global $wgLanguageCode; - return wfBCP47( $wgLanguageCode ); + return LanguageCode::bcp47( $wgLanguageCode ); } /** @@ -232,6 +230,13 @@ abstract class ChannelFeed extends FeedItem { $wgOut->disable(); $mimetype = $this->contentType(); header( "Content-type: $mimetype; charset=UTF-8" ); + + // Set a sane filename + $exts = MediaWiki\MediaWikiServices::getInstance()->getMimeAnalyzer() + ->getExtensionsForType( $mimetype ); + $ext = $exts ? strtok( $exts, ' ' ) : 'xml'; + header( "Content-Disposition: inline; filename=\"feed.{$ext}\"" ); + if ( $wgVaryOnXFP ) { $wgOut->addVaryHeader( 'X-Forwarded-Proto' ); }