*/
/**
- * The main skin class that provide methods and properties for all other skins.
+ * The main skin class which provides methods and properties for all other skins.
* This base class is also the "Standard" skin.
*
* See docs/skin.txt for more information.
static function getSkinNameMessages() {
$messages = array();
foreach ( self::getSkinNames() as $skinKey => $skinName ) {
+ // Give grep a chance to find the usages:
+ // skinname-cologneblue, skinname-monobook, skinname-modern, skinname-vector
$messages[] = "skinname-$skinKey";
}
return $messages;
}
/**
- * Fetch the list of usable skins in regards to $wgSkipSkins.
+ * Fetch the list of user-selectable skins in regards to $wgSkipSkins.
* Useful for Special:Preferences and other places where you
* only want to show skins users _can_ use.
* @return array of strings
public static function getUsableSkins() {
global $wgSkipSkins;
- $usableSkins = self::getSkinNames();
+ $allowedSkins = self::getSkinNames();
foreach ( $wgSkipSkins as $skip ) {
- unset( $usableSkins[$skip] );
+ unset( $allowedSkins[$skip] );
}
- return $usableSkins;
+ return $allowedSkins;
}
/**
wfProfileOut( __METHOD__ );
}
+ /**
+ * Defines the ResourceLoader modules that should be added to the skin
+ * It is recommended that skins wishing to override call parent::getDefaultModules()
+ * and substitute out any modules they wish to change by using a key to look them up
+ * @return Array of modules with helper keys for easy overriding
+ */
+ public function getDefaultModules() {
+ global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax,
+ $wgAjaxWatch, $wgEnableAPI, $wgEnableWriteAPI;
+
+ $out = $this->getOutput();
+ $user = $out->getUser();
+ $modules = array(
+ // modules that enhance the page content in some way
+ 'content' => array(
+ 'mediawiki.page.ready',
+ ),
+ // modules that exist for legacy reasons
+ 'legacy' => array(),
+ // modules relating to search functionality
+ 'search' => array(),
+ // modules relating to functionality relating to watching an article
+ 'watch' => array(),
+ // 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';
+ }
+
+ if ( !$user->getOption( 'disablesuggest', false ) ) {
+ $modules['search'][] = 'mediawiki.searchSuggest';
+ }
+ }
+ }
+
+ if ( $user->getBoolOption( 'editsectiononrightclick' ) ) {
+ $modules['user'][] = 'mediawiki.action.view.rightClickEdit';
+ }
+
+ // Crazy edit-on-double-click stuff
+ if ( $out->isArticle() && $user->getOption( 'editondblclick' ) ) {
+ $modules['user'][] = 'mediawiki.action.view.dblClickEdit';
+ }
+ return $modules;
+ }
+
/**
* Preload the existence of three commonly-requested pages in a single query
*/
array( 'noclasses', 'known' )
);
- # Run the old hook. This takes up half of the function . . . hopefully
- # we can rid of it someday.
- $attribs = '';
- if ( $tooltip ) {
- $attribs = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
- ->inLanguage( $lang )->escaped();
- $attribs = " title=\"$attribs\"";
- }
- $result = null;
- wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $attribs, $link, &$result, $lang ) );
- if ( !is_null( $result ) ) {
- # For reverse compatibility, add the brackets *after* the hook is
- # run, and even add them to hook-provided text. (This is the main
- # reason that the EditSectionLink hook is deprecated in favor of
- # DoEditSectionLink: it can't change the brackets or the span.)
- $result = wfMessage( 'editsection-brackets' )->rawParams( $result )
- ->inLanguage( $lang )->escaped();
- return "<span class=\"mw-editsection\">$result</span>";
- }
-
- # Add the brackets and the span, and *then* run the nice new hook, with
- # clean and non-redundant arguments.
- $result = wfMessage( 'editsection-brackets' )->rawParams( $link )
- ->inLanguage( $lang )->escaped();
- $result = "<span class=\"mw-editsection\">$result</span>";
+ # Add the brackets and the span and run the hook.
+ $result = '<span class="mw-editsection">'
+ . '<span class="mw-editsection-bracket">[</span>'
+ . $link
+ . '<span class="mw-editsection-bracket">]</span>'
+ . '</span>';
wfRunHooks( 'DoEditSectionLink', array( $this, $nt, $section, $tooltip, &$result, $lang ) );
return $result;