Index: trunk/phase3/includes/User.php |
— | — | @@ -2216,35 +2216,48 @@ |
2217 | 2217 | * @return Skin The current skin |
2218 | 2218 | * @todo FIXME : need to check the old failback system [AV] |
2219 | 2219 | */ |
2220 | | - function &getSkin( $t = null ) { |
2221 | | - if ( !isset( $this->mSkin ) ) { |
2222 | | - wfProfileIn( __METHOD__ ); |
2223 | | - |
2224 | | - global $wgHiddenPrefs; |
2225 | | - if( !in_array( 'skin', $wgHiddenPrefs ) ) { |
2226 | | - # get the user skin |
2227 | | - global $wgRequest; |
2228 | | - $userSkin = $this->getOption( 'skin' ); |
2229 | | - $userSkin = $wgRequest->getVal( 'useskin', $userSkin ); |
2230 | | - } else { |
2231 | | - # if we're not allowing users to override, then use the default |
2232 | | - global $wgDefaultSkin; |
2233 | | - $userSkin = $wgDefaultSkin; |
| 2220 | + function getSkin( $t = null ) { |
| 2221 | + if ( $t ) { |
| 2222 | + $skin = $this->createSkinObject(); |
| 2223 | + $skin->setTitle( $t ); |
| 2224 | + return $skin; |
| 2225 | + } else { |
| 2226 | + if ( ! $this->mSkin ) { |
| 2227 | + $this->mSkin = $this->createSkinObject(); |
2234 | 2228 | } |
2235 | | - |
2236 | | - $this->mSkin = Skin::newFromKey( $userSkin ); |
2237 | | - wfProfileOut( __METHOD__ ); |
2238 | | - } |
2239 | | - if( $t || !$this->mSkin->getTitle() ) { |
2240 | | - if ( !$t ) { |
| 2229 | + |
| 2230 | + if ( ! $this->mSkin->getTitle() ) { |
2241 | 2231 | global $wgOut; |
2242 | 2232 | $t = $wgOut->getTitle(); |
| 2233 | + $this->mSkin->setTitle($t); |
2243 | 2234 | } |
2244 | | - $this->mSkin->setTitle( $t ); |
| 2235 | + |
| 2236 | + return $this->mSkin; |
2245 | 2237 | } |
2246 | | - return $this->mSkin; |
2247 | 2238 | } |
| 2239 | + |
| 2240 | + // Creates a Skin object, for getSkin() |
| 2241 | + private function createSkinObject() { |
| 2242 | + wfProfileIn( __METHOD__ ); |
2248 | 2243 | |
| 2244 | + global $wgHiddenPrefs; |
| 2245 | + if( !in_array( 'skin', $wgHiddenPrefs ) ) { |
| 2246 | + # get the user skin |
| 2247 | + global $wgRequest; |
| 2248 | + $userSkin = $this->getOption( 'skin' ); |
| 2249 | + $userSkin = $wgRequest->getVal( 'useskin', $userSkin ); |
| 2250 | + } else { |
| 2251 | + # if we're not allowing users to override, then use the default |
| 2252 | + global $wgDefaultSkin; |
| 2253 | + $userSkin = $wgDefaultSkin; |
| 2254 | + } |
| 2255 | + |
| 2256 | + $skin = Skin::newFromKey( $userSkin ); |
| 2257 | + wfProfileOut( __METHOD__ ); |
| 2258 | + |
| 2259 | + return $skin; |
| 2260 | + } |
| 2261 | + |
2249 | 2262 | /** |
2250 | 2263 | * Check the watched status of an article. |
2251 | 2264 | * @param $title \type{Title} Title of the article to look at |