X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FFeed.php;h=fd223e63dd67931f4556517ba7595f513a687e8b;hp=189fd9f2fb2b245ff1b33f67c37af7cb818bbb3d;hb=c75f0e95c9888489961548c72ef24786c43838aa;hpb=1f83b424294a6fd78cb73cf43db3464ca7481774 diff --git a/includes/Feed.php b/includes/Feed.php index 189fd9f2fb..fd223e63dd 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,12 @@ abstract class ChannelFeed extends FeedItem { $wgOut->disable(); $mimetype = $this->contentType(); header( "Content-type: $mimetype; charset=UTF-8" ); + + // Set a sane filename + $exts = MimeMagic::singleton()->getExtensionsForType( $mimetype ); + $ext = $exts ? strtok( $exts, ' ' ) : 'xml'; + header( "Content-Disposition: inline; filename=\"feed.{$ext}\"" ); + if ( $wgVaryOnXFP ) { $wgOut->addVaryHeader( 'X-Forwarded-Proto' ); }