* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will implicitly create
* a OutputPage tied to that context.
- * @param IContextSource|null $context
+ * @param IContextSource $context
*/
- function __construct( IContextSource $context = null ) {
- if ( $context === null ) {
- # Extensions should use `new RequestContext` instead of `new OutputPage` now.
- wfDeprecated( __METHOD__, '1.18' );
- } else {
- $this->setContext( $context );
- }
+ function __construct( IContextSource $context ) {
+ $this->setContext( $context );
}
/**
// IE and some other browsers use BCP 47 standards in
// their Accept-Language header, like "zh-CN" or "zh-Hant".
// We should handle these too.
- $variantBCP47 = wfBCP47( $variant );
+ $variantBCP47 = LanguageCode::bcp47( $variant );
if ( $variantBCP47 !== $variant ) {
$aloption[] = 'substr=' . $variantBCP47;
}
foreach ( $variants as $variant ) {
$tags["variant-$variant"] = Html::element( 'link', [
'rel' => 'alternate',
- 'hreflang' => wfBCP47( $variant ),
+ 'hreflang' => LanguageCode::bcp47( $variant ),
'href' => $this->getTitle()->getLocalURL(
[ 'variant' => $variant ] )
]
return;
}
+ if ( isset( $logo['svg'] ) ) {
+ // No media queries required if we only have a 1x and svg variant
+ // because all preload-capable browsers support SVGs
+ $this->addLinkHeader( '<' . $logo['svg'] . '>;rel=preload;as=image' );
+ return;
+ }
+
foreach ( $logo as $dppx => $src ) {
// Keys are in this format: "1.5x"
$dppx = substr( $dppx, 0, -1 );