summaryrefslogtreecommitdiff
path: root/includes/skins
diff options
context:
space:
mode:
Diffstat (limited to 'includes/skins')
-rw-r--r--includes/skins/MediaWikiI18N.php4
-rw-r--r--includes/skins/Skin.php48
-rw-r--r--includes/skins/SkinFallbackTemplate.php6
-rw-r--r--includes/skins/SkinTemplate.php23
4 files changed, 41 insertions, 40 deletions
diff --git a/includes/skins/MediaWikiI18N.php b/includes/skins/MediaWikiI18N.php
index 6e48d04a..20cceda2 100644
--- a/includes/skins/MediaWikiI18N.php
+++ b/includes/skins/MediaWikiI18N.php
@@ -42,9 +42,9 @@ class MediaWikiI18N {
$m = array();
while ( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {
list( $src, $var ) = $m;
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$varValue = $this->context[$var];
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
$value = str_replace( $src, $varValue, $value );
}
return $value;
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index ac7a85ba..4e6201cd 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -180,8 +180,7 @@ abstract class Skin extends ContextSource {
* @return array Array of modules with helper keys for easy overriding
*/
public function getDefaultModules() {
- global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax,
- $wgAjaxWatch, $wgEnableAPI, $wgEnableWriteAPI;
+ global $wgUseAjax, $wgAjaxWatch, $wgEnableAPI, $wgEnableWriteAPI;
$out = $this->getOutput();
$user = $out->getUser();
@@ -191,7 +190,7 @@ abstract class Skin extends ContextSource {
'mediawiki.page.ready',
),
// modules that exist for legacy reasons
- 'legacy' => array(),
+ 'legacy' => ResourceLoaderStartUpModule::getLegacyModules(),
// modules relating to search functionality
'search' => array(),
// modules relating to functionality relating to watching an article
@@ -199,27 +198,17 @@ abstract class Skin extends ContextSource {
// modules which relate to the current users preferences
'user' => array(),
);
- if ( $wgIncludeLegacyJavaScript ) {
- $modules['legacy'][] = 'mediawiki.legacy.wikibits';
- }
-
- if ( $wgPreloadJavaScriptMwUtil ) {
- $modules['legacy'][] = 'mediawiki.util';
- }
// Add various resources if required
- if ( $wgUseAjax ) {
- $modules['legacy'][] = 'mediawiki.legacy.ajax';
-
- if ( $wgEnableAPI ) {
- if ( $wgEnableWriteAPI && $wgAjaxWatch && $user->isLoggedIn()
- && $user->isAllowed( 'writeapi' )
- ) {
- $modules['watch'][] = 'mediawiki.page.watch.ajax';
- }
-
- $modules['search'][] = 'mediawiki.searchSuggest';
+ if ( $wgUseAjax && $wgEnableAPI ) {
+ if ( $wgEnableWriteAPI && $wgAjaxWatch && $user->isLoggedIn()
+ && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' )
+ && $this->getRelevantTitle()->canExist()
+ ) {
+ $modules['watch'][] = 'mediawiki.page.watch.ajax';
}
+
+ $modules['search'][] = 'mediawiki.searchSuggest';
}
if ( $user->getBoolOption( 'editsectiononrightclick' ) ) {
@@ -248,8 +237,8 @@ abstract class Skin extends ContextSource {
$titles[] = $user->getTalkPage();
}
- // Other tab link
- if ( $title->isSpecialPage() ) {
+ // Check, if the page can hold some kind of content, otherwise do nothing
+ if ( !$title->canExist() ) {
// nothing
} elseif ( $title->isTalkPage() ) {
$titles[] = $title->getSubjectPage();
@@ -365,8 +354,8 @@ abstract class Skin extends ContextSource {
*/
static function makeVariablesScript( $data ) {
if ( $data ) {
- return Html::inlineScript(
- ResourceLoader::makeLoaderConditionalScript( ResourceLoader::makeConfigSetScript( $data ) )
+ return ResourceLoader::makeInlineScript(
+ ResourceLoader::makeConfigSetScript( $data )
);
} else {
return '';
@@ -650,7 +639,7 @@ abstract class Skin extends ContextSource {
}
return $this->msg( 'retrievedfrom' )
- ->rawParams( '<a dir="ltr" href="' . $url. '">' . $url . '</a>' )
+ ->rawParams( '<a dir="ltr" href="' . $url . '">' . $url . '</a>' )
->parse();
}
@@ -1234,12 +1223,13 @@ abstract class Skin extends ContextSource {
* @return array
*/
function buildSidebar() {
- global $wgMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
+ global $wgEnableSidebarCache, $wgSidebarCacheExpiry;
+ $cache = ObjectCache::getMainWANInstance();
$key = wfMemcKey( 'sidebar', $this->getLanguage()->getCode() );
if ( $wgEnableSidebarCache ) {
- $cachedsidebar = $wgMemc->get( $key );
+ $cachedsidebar = $cache->get( $key );
if ( $cachedsidebar ) {
Hooks::run( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) );
@@ -1252,7 +1242,7 @@ abstract class Skin extends ContextSource {
Hooks::run( 'SkinBuildSidebar', array( $this, &$bar ) );
if ( $wgEnableSidebarCache ) {
- $wgMemc->set( $key, $bar, $wgSidebarCacheExpiry );
+ $cache->set( $key, $bar, $wgSidebarCacheExpiry );
}
Hooks::run( 'SidebarBeforeOutput', array( $this, &$bar ) );
diff --git a/includes/skins/SkinFallbackTemplate.php b/includes/skins/SkinFallbackTemplate.php
index 1c5f3a6f..cd5e43c6 100644
--- a/includes/skins/SkinFallbackTemplate.php
+++ b/includes/skins/SkinFallbackTemplate.php
@@ -65,7 +65,9 @@ class SkinFallbackTemplate extends BaseTemplate {
return $this->getMsg( 'default-skin-not-found' )->params(
$defaultSkin,
implode( "\n", $skinsInstalledText ),
- implode( "\n", $skinsInstalledSnippet )
+ implode( "\n", $skinsInstalledSnippet ) )->numParams(
+ count( $skinsInstalledText ),
+ count( $skinsInstalledSnippet )
)->parseAsBlock();
} else {
return $this->getMsg( 'default-skin-not-found-no-skins' )->params(
@@ -85,7 +87,7 @@ class SkinFallbackTemplate extends BaseTemplate {
if ( file_exists( "$IP/skins/$skin/skin.json" ) ) {
return "wfLoadSkin( '$skin' );";
} else {
- return "require_once \"\$IP/skins/$skin/$skin.php\";";
+ return "require_once \"\$IP/skins/$skin/$skin.php\";";
}
}
diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index 61aad921..baf9d954 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -51,12 +51,22 @@ class SkinTemplate extends Skin {
* @param OutputPage $out
*/
function setupSkinUserCss( OutputPage $out ) {
- $out->addModuleStyles( array(
+ $moduleStyles = array(
'mediawiki.legacy.shared',
'mediawiki.legacy.commonPrint',
- 'mediawiki.ui.button',
'mediawiki.sectionAnchor'
- ) );
+ );
+ if ( $out->isSyndicated() ) {
+ $moduleStyles[] = 'mediawiki.feedlink';
+ }
+
+ // Deprecated since 1.26: Unconditional loading of mediawiki.ui.button
+ // on every page is deprecated. Express a dependency instead.
+ if ( strpos( $out->getHTML(), 'mw-ui-button' ) !== false ) {
+ $moduleStyles[] = 'mediawiki.ui.button';
+ }
+
+ $out->addModuleStyles( $moduleStyles );
}
/**
@@ -422,11 +432,9 @@ class SkinTemplate extends Skin {
# Add a mw-content-ltr/rtl class to be able to style based on text direction
# when the content is different from the UI language, i.e.:
- # not for special pages or file pages AND only when viewing AND if the page exists
- # (or is in MW namespace, because that has default content)
+ # not for special pages or file pages AND only when viewing
if ( !in_array( $title->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) &&
- Action::getActionName( $this ) === 'view' &&
- ( $title->exists() || $title->getNamespace() == NS_MEDIAWIKI ) ) {
+ Action::getActionName( $this ) === 'view' ) {
$pageLang = $title->getPageViewLanguage();
$realBodyAttribs['lang'] = $pageLang->getHtmlCode();
$realBodyAttribs['dir'] = $pageLang->getDir();
@@ -1078,6 +1086,7 @@ class SkinTemplate extends Skin {
$xmlID = 'ca-nstab-' . $xmlID;
} elseif ( isset( $link['context'] ) && $link['context'] == 'talk' ) {
$xmlID = 'ca-talk';
+ $link['rel'] = 'discussion';
} elseif ( $section == 'variants' ) {
$xmlID = 'ca-varlang-' . $xmlID;
} else {