*/
# See skin.txt
-require_once( 'Linker.php' );
require_once( 'Image.php' );
-# Get a list of available skins
-# Build using the regular expression '^(.*).php$'
-# Array keys are all lower case, array value keep the case used by filename
-#
-
-$skinDir = dir( $wgStyleDirectory );
-
-# while code from www.php.net
-while (false !== ($file = $skinDir->read())) {
- // Skip non-PHP files, hidden files, and '.dep' includes
- if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
- $aSkin = $matches[1];
- $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
- }
-}
-$skinDir->close();
-unset($matches);
-
/**
* The main skin class that provide methods and properties for all other skins.
* This base class is also the "Standard" skin.
var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
var $rcMoveIndex;
/**#@-*/
+
+ private static $validSkinNames;
/** Constructor, call parent constructor */
function Skin() { parent::Linker(); }
* @static
*/
function getSkinNames() {
- global $wgValidSkinNames;
- return $wgValidSkinNames;
+ if (!is_array(Skin::$validSkinNames)) {
+ Skin::initializeSkinNames();
+ }
+ return Skin::$validSkinNames;
+ }
+
+
+ /** Initialize a list of available skins
+ * Build using the regular expression '^(.*).php$'
+ * Array keys are all lower case, array value keep the case used by filename
+ */
+
+ function initializeSkinNames() {
+ global $wgStyleDirectory;
+ $skinDir = dir( $wgStyleDirectory );
+
+ # while code from www.php.net
+ while (false !== ($file = $skinDir->read())) {
+ // Skip non-PHP files, hidden files, and '.dep' includes
+ if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
+ $aSkin = $matches[1];
+ Skin::$validSkinNames[strtolower($aSkin)] = $aSkin;
+ }
+ }
+ $skinDir->close();
}
/**
* @access private
*/
function mainPrefsForm( $status , $message = '' ) {
- global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
+ global $wgUser, $wgOut, $wgLang, $wgContLang;
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
global $wgDisableLangConversion;
global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
$wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
$mptitle = Title::newMainPage();
$previewtext = wfMsg('skinpreview');
- # Only show members of $wgValidSkinNames rather than
+ # Only show members of Skin::getSkinNames() rather than
# $skinNames (skins is all skin names from Language.php)
- foreach ($wgValidSkinNames as $skinkey => $skinname ) {
+ foreach (Skin::getSkinNames() as $skinkey => $skinname ) {
if ( in_array( $skinkey, $wgSkipSkins ) ) {
continue;
}
* Check that the corresponding skin exists
*/
function isValidCssJsSubpage() {
- global $wgValidSkinNames;
- return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) );
+ return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) );
}
/**
* Trim down a .css or .js subpage title to get the corresponding skin name