X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSkin.php;h=8b10d7fdff0c1f8bf23230a318e00696c03ea76f;hb=0c2a0e4d6bbda94f5411fbb13432f8f3dd52eaa3;hp=0871f2f7bca59fa594325e8a05df67af0a8602c5;hpb=ba840115260d727abc96aa03dfb581e3fd8dc013;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 0871f2f7bc..8b10d7fdff 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -22,7 +22,7 @@ abstract class Skin extends ContextSource { /** * Fetch the set of available skins. - * @return array of strings + * @return array associative array of strings */ static function getSkinNames() { global $wgValidSkinNames; @@ -55,6 +55,18 @@ abstract class Skin extends ContextSource { } return $wgValidSkinNames; } + + /** + * Fetch the skinname messages for available skins. + * @return array of strings + */ + static function getSkinNameMessages() { + $messages = array(); + foreach( self::getSkinNames() as $skinKey => $skinName ) { + $messages[] = "skinname-$skinKey"; + } + return $messages; + } /** * Fetch the list of usable skins in regards to $wgSkipSkins. @@ -86,7 +98,7 @@ abstract class Skin extends ContextSource { $skinNames = Skin::getSkinNames(); - if ( $key == '' ) { + if ( $key == '' || $key == 'default' ) { // Don't return the default immediately; // in a misconfiguration we need to fall back. $key = $wgDefaultSkin; @@ -156,7 +168,7 @@ abstract class Skin extends ContextSource { } } } - $skin = new $className; + $skin = new $className( $key ); return $skin; } @@ -165,6 +177,9 @@ abstract class Skin extends ContextSource { return $this->skinname; } + /** + * @param $out OutputPage + */ function initPage( OutputPage $out ) { wfProfileIn( __METHOD__ ); @@ -183,7 +198,7 @@ abstract class Skin extends ContextSource { $titles = array( $user->getUserPage(), $user->getTalkPage() ); // Other tab link - if ( $this->getTitle()->getNamespace() == NS_SPECIAL ) { + if ( $this->getTitle()->isSpecialPage() ) { // nothing } elseif ( $this->getTitle()->isTalkPage() ) { $titles[] = $this->getTitle()->getSubjectPage(); @@ -268,8 +283,8 @@ abstract class Skin extends ContextSource { if ( User::isIP( $rootUser ) ) { $this->mRelevantUser = User::newFromName( $rootUser, false ); } else { - $user = User::newFromName( $rootUser ); - if ( $user->isLoggedIn() ) { + $user = User::newFromName( $rootUser, false ); + if ( $user && $user->isLoggedIn() ) { $this->mRelevantUser = $user; } } @@ -282,8 +297,12 @@ abstract class Skin extends ContextSource { * Outputs the HTML generated by other functions. * @param $out OutputPage */ - abstract function outputPage( OutputPage $out ); + abstract function outputPage( OutputPage $out = null ); + /** + * @param $data array + * @return string + */ static function makeVariablesScript( $data ) { if ( $data ) { return Html::inlineScript( @@ -295,28 +314,18 @@ abstract class Skin extends ContextSource { } /** - * Generated JavaScript action=raw&gen=js - * This used to load MediaWiki:Common.js and the skin-specific style - * before the ResourceLoader. + * Make a