X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSkin.php;h=f000fbfffe82dd7dc28bbc8de6232f360e1cbc2c;hb=4074968ddfebc6dee917b95114a428673b6e7bac;hp=4c5cca292a048b4bc3454539fb5bedc605137936;hpb=b6e0df246f8dda61643d9aba36d9f9e802c909ec;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 4c5cca292a..f000fbfffe 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -3,8 +3,9 @@ * @defgroup Skins Skins */ -if ( ! defined( 'MEDIAWIKI' ) ) +if ( !defined( 'MEDIAWIKI' ) ) { die( 1 ); +} /** * The main skin class that provide methods and properties for all other skins. @@ -28,12 +29,13 @@ class Skin extends Linker { var $mTitle = null; /** Constructor, call parent constructor */ - function Skin() { parent::__construct(); } + function __construct() { + parent::__construct(); + } /** * Fetch the set of available skins. * @return array of strings - * @static */ static function getSkinNames() { global $wgValidSkinNames; @@ -53,7 +55,7 @@ class Skin extends Linker { $matches = array(); if( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) { $aSkin = $matches[1]; - $wgValidSkinNames[strtolower($aSkin)] = $aSkin; + $wgValidSkinNames[strtolower( $aSkin )] = $aSkin; } } $skinDir->close(); @@ -82,9 +84,8 @@ class Skin extends Linker { * Normalize a skin preference value to a form that can be loaded. * If a skin can't be found, it will fall back to the configured * default (or the old 'Classic' skin if that's broken). - * @param string $key + * @param $key String: 'monobook', 'standard', etc. * @return string - * @static */ static function normalizeKey( $key ) { global $wgDefaultSkin; @@ -105,24 +106,26 @@ class Skin extends Linker { $fallback = array( 0 => $wgDefaultSkin, 1 => 'nostalgia', - 2 => 'cologneblue' ); + 2 => 'cologneblue' + ); - if( isset( $fallback[$key] ) ){ + if( isset( $fallback[$key] ) ) { $key = $fallback[$key]; } if( isset( $skinNames[$key] ) ) { return $key; + } else if( isset( $skinNames[$wgDefaultSkin] ) ) { + return $wgDefaultSkin; } else { - return 'monobook'; + return 'vector'; } } /** * Factory method for loading a skin of a given type - * @param string $key 'monobook', 'standard', etc + * @param $key String: 'monobook', 'standard', etc. * @return Skin - * @static */ static function &newFromKey( $key ) { global $wgStyleDirectory; @@ -131,13 +134,15 @@ class Skin extends Linker { $skinNames = Skin::getSkinNames(); $skinName = $skinNames[$key]; - $className = 'Skin'.ucfirst($key); + $className = 'Skin' . ucfirst( $key ); # Grab the skin class and initialise it. if ( !class_exists( $className ) ) { // Preload base classes to work around APC/PHP5 bug $deps = "{$wgStyleDirectory}/{$skinName}.deps.php"; - if( file_exists( $deps ) ) include_once( $deps ); + if( file_exists( $deps ) ) { + include_once( $deps ); + } require_once( "{$wgStyleDirectory}/{$skinName}.php" ); # Check if we got if not failback to default skin @@ -147,8 +152,8 @@ class Skin extends Linker { # except by SQL manipulation if a previously valid skin name # is no longer valid. wfDebug( "Skin class does not exist: $className\n" ); - $className = 'SkinMonobook'; - require_once( "{$wgStyleDirectory}/MonoBook.php" ); + $className = 'SkinVector'; + require_once( "{$wgStyleDirectory}/Vector.php" ); } } $skin = new $className; @@ -168,7 +173,9 @@ class Skin extends Linker { function qbSetting() { global $wgOut, $wgUser; - if ( $wgOut->isQuickbarSuppressed() ) { return 0; } + if ( $wgOut->isQuickbarSuppressed() ) { + return 0; + } $q = $wgUser->getOption( 'quickbar', 0 ); return $q; } @@ -180,7 +187,7 @@ class Skin extends Linker { # Generally the order of the favicon and apple-touch-icon links # should not matter, but Konqueror (3.5.9 at least) incorrectly - # uses whichever one appears later in the HTML source. Make sure + # uses whichever one appears later in the HTML source. Make sure # apple-touch-icon is specified first to avoid this. if( false !== $wgAppleTouchIcon ) { $out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) ); @@ -229,6 +236,11 @@ class Skin extends Linker { $lb->execute(); } + /** + * Adds metadata links (Creative Commons/Dublin Core/copyright) to the HTML + * output. + * @param $out Object: instance of OutputPage + */ function addMetadataLinks( OutputPage $out ) { global $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf; global $wgRightsPage, $wgRightsUrl; @@ -271,7 +283,7 @@ class Skin extends Linker { /** * Set some local variables */ - protected function setMembers(){ + protected function setMembers() { global $wgUser; $this->mUser = $wgUser; $this->userpage = $wgUser->getUserPage()->getPrefixedText(); @@ -280,7 +292,7 @@ class Skin extends Linker { /** * Set the title - * @param Title $t The title to use + * @param $t Title object to use */ public function setTitle( $t ) { $this->mTitle = $t; @@ -291,6 +303,10 @@ class Skin extends Linker { return $this->mTitle; } + /** + * Outputs the HTML generated by other functions. + * @param $out Object: instance of OutputPage + */ function outputPage( OutputPage $out ) { global $wgDebugComments; wfProfileIn( __METHOD__ ); @@ -303,12 +319,6 @@ class Skin extends Linker { $out->out( $out->headElement( $this ) ); - $out->out( "\ngetBodyOptions(); - foreach ( $ops as $name => $val ) { - $out->out( " $name='$val'" ); - } - $out->out( ">\n" ); if ( $wgDebugComments ) { $out->out( "\n" ); @@ -348,7 +358,7 @@ class Skin extends Linker { * Make a