* - "list-contains=$XXX" varies on whether the header value as a
* comma-separated list contains $XXX as one of the list items.
*/
- public function addVaryHeader( $header, $option = null ) {
+ public function addVaryHeader( $header, array $option = null ) {
if ( !array_key_exists( $header, $this->mVaryHeader ) ) {
- $this->mVaryHeader[$header] = (array)$option;
- } elseif ( is_array( $option ) ) {
- if ( is_array( $this->mVaryHeader[$header] ) ) {
- $this->mVaryHeader[$header] = array_merge( $this->mVaryHeader[$header], $option );
- } else {
- $this->mVaryHeader[$header] = $option;
- }
+ $this->mVaryHeader[$header] = array();
}
- $this->mVaryHeader[$header] = array_unique( (array)$this->mVaryHeader[$header] );
+ if ( !is_array( $option ) ) {
+ $option = array();
+ }
+ $this->mVaryHeader[$header] = array_unique( array_merge( $this->mVaryHeader[$header], $option ) );
}
/**
// Automatically select style/script elements
if ( $only === ResourceLoaderModule::TYPE_STYLES ) {
- $media = $group === 'print' ? 'print' : 'all';
- $link = Html::linkedStyle( $url, $media );
+ $link = Html::linkedStyle( $url );
} else {
if ( $context->getRaw() || $isRaw ) {
// Startup module can't load itself, needs to use <script> instead of mw.loader.load
function getExternalHeadScripts() {
$links = array();
- // Startup - this provides the client with the module manifest and loads jquery and mediawiki base modules
+ // Startup - this provides the client with the module
+ // manifest and loads jquery and mediawiki base modules
$links[] = $this->makeResourceLoaderLink( 'startup', ResourceLoaderModule::TYPE_SCRIPTS );
return self::getHtmlFromLoaderLinks( $links );
// This needs to be TYPE_COMBINED so these modules are properly wrapped
// in mw.loader.implement() calls and deferred until mw.user is available
$embedScripts = array( 'user.options' );
- $links[] = $this->makeResourceLoaderLink( $embedScripts, ResourceLoaderModule::TYPE_COMBINED );
+ $links[] = $this->makeResourceLoaderLink(
+ $embedScripts,
+ ResourceLoaderModule::TYPE_COMBINED
+ );
// Separate user.tokens as otherwise caching will be allowed (T84960)
- $links[] = $this->makeResourceLoaderLink( 'user.tokens', ResourceLoaderModule::TYPE_COMBINED );
+ $links[] = $this->makeResourceLoaderLink(
+ 'user.tokens',
+ ResourceLoaderModule::TYPE_COMBINED
+ );
// Modules requests - let the client calculate dependencies and batch requests as it likes
// Only load modules that have marked themselves for loading at the top
// FIXME: If the user is previewing, say, ./vector.js, his ./common.js will be loaded
// asynchronously and may arrive *after* the inline script here. So the previewed code
// may execute before ./common.js runs. Normally, ./common.js runs before ./vector.js.
- // Similarly, when previewing ./common.js and the user module does arrive first, it will
- // arrive without common.js and the inline script runs after. Thus running common after
- // the excluded subpage.
+ // Similarly, when previewing ./common.js and the user module does arrive first,
+ // it will arrive without common.js and the inline script runs after.
+ // Thus running common after the excluded subpage.
} else {
// Include the user module normally, i.e., raw to avoid it being wrapped in a closure.
$links[] = $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_COMBINED );
}
// Group JS is only enabled if site JS is enabled.
- $links[] = $this->makeResourceLoaderLink( 'user.groups', ResourceLoaderModule::TYPE_COMBINED );
+ $links[] = $this->makeResourceLoaderLink(
+ 'user.groups',
+ ResourceLoaderModule::TYPE_COMBINED
+ );
return self::getHtmlFromLoaderLinks( $links );
}
if ( $config->get( 'UniversalEditButton' ) && $this->isArticleRelated() ) {
$user = $this->getUser();
if ( $this->getTitle()->quickUserCan( 'edit', $user )
- && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
+ && ( $this->getTitle()->exists() ||
+ $this->getTitle()->quickUserCan( 'create', $user ) )
+ ) {
// Original UniversalEditButton
$msg = $this->msg( 'edit' )->text();
$tags['universal-edit-button'] = Html::element( 'link', array(
$tags['rsd'] = Html::element( 'link', array(
'rel' => 'EditURI',
'type' => 'application/rsd+xml',
- // Output a protocol-relative URL here if $wgServer is protocol-relative
- // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
+ // Output a protocol-relative URL here if $wgServer is protocol-relative.
+ // Whether RSD accepts relative or protocol-relative URLs is completely
+ // undocumented, though.
'href' => wfExpandUrl( wfAppendQuery(
wfScript( 'api' ),
array( 'action' => 'rsd' ) ),
$tags["variant-$variant"] = Html::element( 'link', array(
'rel' => 'alternate',
'hreflang' => wfBCP47( $variant ),
- 'href' => $this->getTitle()->getLocalURL( array( 'variant' => $variant ) ) )
+ 'href' => $this->getTitle()->getLocalURL(
+ array( 'variant' => $variant ) )
+ )
);
}
# x-default link per https://support.google.com/webmasters/answer/189077?hl=en
$format,
$link,
# Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
- $this->msg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() )->text()
+ $this->msg(
+ "page-{$format}-feed", $this->getTitle()->getPrefixedText()
+ )->text()
);
}
continue;
}
$group = $module->getGroup();
- // Modules in groups other than the ones needing special treatment (see $styles assignment)
+ // Modules in groups other than the ones needing special treatment
+ // (see $styles assignment)
// will be placed in the "other" style category.
$styles[isset( $styles[$group] ) ? $group : 'other'][] = $name;
}
// statically added styles from other modules. So the order has to be
// other, dynamic, site, private, user. Add statically added styles for
// other modules
- $links[] = $this->makeResourceLoaderLink( $styles['other'], ResourceLoaderModule::TYPE_STYLES );
+ $links[] = $this->makeResourceLoaderLink(
+ $styles['other'],
+ ResourceLoaderModule::TYPE_STYLES
+ );
// Add normal styles added through addStyle()/addInlineStyle() here
$links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
- // Add marker tag to mark the place where the client-side loader should inject dynamic styles
+ // Add marker tag to mark the place where the client-side
+ // loader should inject dynamic styles
// We use a <meta> tag with a made-up name for this because that's valid HTML
$links[] = Html::element(
'meta',
$url = $style;
} else {
$config = $this->getConfig();
- $url = $config->get( 'StylePath' ) . '/' . $style . '?' . $config->get( 'StyleVersion' );
+ $url = $config->get( 'StylePath' ) . '/' . $style . '?' .
+ $config->get( 'StyleVersion' );
}
$link = Html::linkedStyle( $url, $media );
$themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
// Make keys (skin names) lowercase for case-insensitive matching.
$themes = array_change_key_case( $themes, CASE_LOWER );
- $theme = isset( $themes[ $skinName ] ) ? $themes[ $skinName ] : 'MediaWiki';
+ $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : 'MediaWiki';
// For example, 'OOUI\MediaWikiTheme'.
$themeClass = "OOUI\\{$theme}Theme";
OOUI\Theme::setSingleton( new $themeClass() );