read() ) ) { // Skip non-PHP files, hidden files, and '.dep' includes $matches = array(); if ( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) { $aSkin = $matches[1]; $wgValidSkinNames[strtolower( $aSkin )] = $aSkin; } } $skinDir->close(); $skinsInitialised = true; wfProfileOut( __METHOD__ . '-init' ); } return $wgValidSkinNames; } /** * Fetch the list of usable 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(); foreach ( $wgSkipSkins as $skip ) { unset( $usableSkins[$skip] ); } return $usableSkins; } /** * 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 $key String: 'monobook', 'standard', etc. * @return string */ static function normalizeKey( $key ) { global $wgDefaultSkin; $skinNames = Skin::getSkinNames(); if ( $key == '' ) { // Don't return the default immediately; // in a misconfiguration we need to fall back. $key = $wgDefaultSkin; } if ( isset( $skinNames[$key] ) ) { return $key; } // Older versions of the software used a numeric setting // in the user preferences. $fallback = array( 0 => $wgDefaultSkin, 1 => 'nostalgia', 2 => 'cologneblue' ); if ( isset( $fallback[$key] ) ) { $key = $fallback[$key]; } if ( isset( $skinNames[$key] ) ) { return $key; } else if ( isset( $skinNames[$wgDefaultSkin] ) ) { return $wgDefaultSkin; } else { return 'vector'; } } /** * Factory method for loading a skin of a given type * @param $key String: 'monobook', 'standard', etc. * @return Skin */ static function &newFromKey( $key ) { global $wgStyleDirectory; $key = Skin::normalizeKey( $key ); $skinNames = Skin::getSkinNames(); $skinName = $skinNames[$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 ); } require_once( "{$wgStyleDirectory}/{$skinName}.php" ); # Check if we got if not failback to default skin if ( !class_exists( $className ) ) { # DO NOT die if the class isn't found. This breaks maintenance # scripts and can cause a user account to be unrecoverable # except by SQL manipulation if a previously valid skin name # is no longer valid. wfDebug( "Skin class does not exist: $className\n" ); $className = 'SkinVector'; require_once( "{$wgStyleDirectory}/Vector.php" ); } } $skin = new $className; return $skin; } /** @return string path to the skin stylesheet */ function getStylesheet() { return 'common/wikistandard.css'; } /** @return string skin name */ public function getSkinName() { return $this->skinname; } function qbSetting() { global $wgOut, $wgUser; if ( $wgOut->isQuickbarSuppressed() ) { return 0; } $q = $wgUser->getOption( 'quickbar', 0 ); return $q; } function initPage( OutputPage $out ) { global $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI; wfProfileIn( __METHOD__ ); # 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 # apple-touch-icon is specified first to avoid this. if ( false !== $wgAppleTouchIcon ) { $out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) ); } if ( false !== $wgFavicon ) { $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) ); } # OpenSearch description link $out->addLink( array( 'rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => wfScript( 'opensearch_desc' ), 'title' => wfMsgForContent( 'opensearch-desc' ), ) ); if ( $wgEnableAPI ) { # Real Simple Discovery link, provides auto-discovery information # for the MediaWiki API (and potentially additional custom API # support such as WordPress or Twitter-compatible APIs for a # blogging extension, etc) $out->addLink( array( 'rel' => 'EditURI', 'type' => 'application/rsd+xml', 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ) ), ) ); } $this->addMetadataLinks( $out ); $this->mRevisionId = $out->mRevisionId; $this->preloadExistence(); wfProfileOut( __METHOD__ ); } /** * Preload the existence of three commonly-requested pages in a single query */ function preloadExistence() { global $wgUser; // User/talk link $titles = array( $wgUser->getUserPage(), $wgUser->getTalkPage() ); // Other tab link if ( $this->mTitle->getNamespace() == NS_SPECIAL ) { // nothing } elseif ( $this->mTitle->isTalkPage() ) { $titles[] = $this->mTitle->getSubjectPage(); } else { $titles[] = $this->mTitle->getTalkPage(); } $lb = new LinkBatch( $titles ); $lb->setCaller( __METHOD__ ); $lb->execute(); } /** * Adds metadata links below to the HTML output. *