| Index: trunk/phase3/includes/Setup.php |
| — | — | @@ -56,7 +56,6 @@ |
| 57 | 57 | require_once( 'Hooks.php' ); |
| 58 | 58 | require_once( 'Namespace.php' ); |
| 59 | 59 | require_once( 'User.php' ); |
| 60 | | -require_once( 'Skin.php' ); |
| 61 | 60 | require_once( 'OutputPage.php' ); |
| 62 | 61 | require_once( 'MagicWord.php' ); |
| 63 | 62 | require_once( 'Block.php' ); |
| Index: trunk/phase3/includes/Title.php |
| — | — | @@ -1163,8 +1163,7 @@ |
| 1164 | 1164 | * Check that the corresponding skin exists |
| 1165 | 1165 | */ |
| 1166 | 1166 | function isValidCssJsSubpage() { |
| 1167 | | - global $wgValidSkinNames; |
| 1168 | | - return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) ); |
| | 1167 | + return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) ); |
| 1169 | 1168 | } |
| 1170 | 1169 | /** |
| 1171 | 1170 | * Trim down a .css or .js subpage title to get the corresponding skin name |
| Index: trunk/phase3/includes/SpecialPreferences.php |
| — | — | @@ -444,7 +444,7 @@ |
| 445 | 445 | * @access private |
| 446 | 446 | */ |
| 447 | 447 | function mainPrefsForm( $status , $message = '' ) { |
| 448 | | - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames; |
| | 448 | + global $wgUser, $wgOut, $wgLang, $wgContLang; |
| 449 | 449 | global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; |
| 450 | 450 | global $wgDisableLangConversion; |
| 451 | 451 | global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits; |
| — | — | @@ -721,9 +721,9 @@ |
| 722 | 722 | $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" ); |
| 723 | 723 | $mptitle = Title::newMainPage(); |
| 724 | 724 | $previewtext = wfMsg('skinpreview'); |
| 725 | | - # Only show members of $wgValidSkinNames rather than |
| | 725 | + # Only show members of Skin::getSkinNames() rather than |
| 726 | 726 | # $skinNames (skins is all skin names from Language.php) |
| 727 | | - foreach ($wgValidSkinNames as $skinkey => $skinname ) { |
| | 727 | + foreach (Skin::getSkinNames() as $skinkey => $skinname ) { |
| 728 | 728 | if ( in_array( $skinkey, $wgSkipSkins ) ) { |
| 729 | 729 | continue; |
| 730 | 730 | } |
| Index: trunk/phase3/includes/Skin.php |
| — | — | @@ -9,27 +9,8 @@ |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | # See skin.txt |
| 13 | | -require_once( 'Linker.php' ); |
| 14 | 13 | require_once( 'Image.php' ); |
| 15 | 14 | |
| 16 | | -# Get a list of available skins |
| 17 | | -# Build using the regular expression '^(.*).php$' |
| 18 | | -# Array keys are all lower case, array value keep the case used by filename |
| 19 | | -# |
| 20 | | - |
| 21 | | -$skinDir = dir( $wgStyleDirectory ); |
| 22 | | - |
| 23 | | -# while code from www.php.net |
| 24 | | -while (false !== ($file = $skinDir->read())) { |
| 25 | | - // Skip non-PHP files, hidden files, and '.dep' includes |
| 26 | | - if(preg_match('/^([^.]*)\.php$/',$file, $matches)) { |
| 27 | | - $aSkin = $matches[1]; |
| 28 | | - $wgValidSkinNames[strtolower($aSkin)] = $aSkin; |
| 29 | | - } |
| 30 | | -} |
| 31 | | -$skinDir->close(); |
| 32 | | -unset($matches); |
| 33 | | - |
| 34 | 15 | /** |
| 35 | 16 | * The main skin class that provide methods and properties for all other skins. |
| 36 | 17 | * This base class is also the "Standard" skin. |
| — | — | @@ -44,6 +25,8 @@ |
| 45 | 26 | var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle |
| 46 | 27 | var $rcMoveIndex; |
| 47 | 28 | /**#@-*/ |
| | 29 | + |
| | 30 | + private static $validSkinNames; |
| 48 | 31 | |
| 49 | 32 | /** Constructor, call parent constructor */ |
| 50 | 33 | function Skin() { parent::Linker(); } |
| — | — | @@ -54,10 +37,33 @@ |
| 55 | 38 | * @static |
| 56 | 39 | */ |
| 57 | 40 | function getSkinNames() { |
| 58 | | - global $wgValidSkinNames; |
| 59 | | - return $wgValidSkinNames; |
| | 41 | + if (!is_array(Skin::$validSkinNames)) { |
| | 42 | + Skin::initializeSkinNames(); |
| | 43 | + } |
| | 44 | + return Skin::$validSkinNames; |
| 60 | 45 | } |
| 61 | 46 | |
| | 47 | + |
| | 48 | + /** Initialize a list of available skins |
| | 49 | + * Build using the regular expression '^(.*).php$' |
| | 50 | + * Array keys are all lower case, array value keep the case used by filename |
| | 51 | + */ |
| | 52 | + |
| | 53 | + function initializeSkinNames() { |
| | 54 | + global $wgStyleDirectory; |
| | 55 | + $skinDir = dir( $wgStyleDirectory ); |
| | 56 | + |
| | 57 | + # while code from www.php.net |
| | 58 | + while (false !== ($file = $skinDir->read())) { |
| | 59 | + // Skip non-PHP files, hidden files, and '.dep' includes |
| | 60 | + if(preg_match('/^([^.]*)\.php$/',$file, $matches)) { |
| | 61 | + $aSkin = $matches[1]; |
| | 62 | + Skin::$validSkinNames[strtolower($aSkin)] = $aSkin; |
| | 63 | + } |
| | 64 | + } |
| | 65 | + $skinDir->close(); |
| | 66 | + } |
| | 67 | + |
| 62 | 68 | /** |
| 63 | 69 | * Normalize a skin preference value to a form that can be loaded. |
| 64 | 70 | * If a skin can't be found, it will fall back to the configured |