Index: trunk/phase3/includes/User.php |
— | — | @@ -2295,48 +2295,15 @@ |
2296 | 2296 | } |
2297 | 2297 | |
2298 | 2298 | /** |
2299 | | - * Get the current skin, loading it if required, and setting a title |
2300 | | - * @param $t Title: the title to use in the skin |
| 2299 | + * Get the current skin, loading it if required |
2301 | 2300 | * @return Skin The current skin |
2302 | 2301 | * @todo: FIXME : need to check the old failback system [AV] |
| 2302 | + * @deprecated Use ->getSkin() in the most relevant outputting context you have |
2303 | 2303 | */ |
2304 | | - function getSkin( $t = null ) { |
2305 | | - if( !$this->mSkin ) { |
2306 | | - global $wgOut; |
2307 | | - $this->mSkin = $this->createSkinObject(); |
2308 | | - $this->mSkin->setTitle( $wgOut->getTitle() ); |
2309 | | - } |
2310 | | - if ( $t && ( !$this->mSkin->getTitle() || !$t->equals( $this->mSkin->getTitle() ) ) ) { |
2311 | | - $skin = $this->createSkinObject(); |
2312 | | - $skin->setTitle( $t ); |
2313 | | - return $skin; |
2314 | | - } else { |
2315 | | - return $this->mSkin; |
2316 | | - } |
| 2304 | + function getSkin() { |
| 2305 | + return RequestContext::getMain()->getSkin(); |
2317 | 2306 | } |
2318 | 2307 | |
2319 | | - // Creates a Skin object, for getSkin() |
2320 | | - private function createSkinObject() { |
2321 | | - wfProfileIn( __METHOD__ ); |
2322 | | - |
2323 | | - global $wgHiddenPrefs; |
2324 | | - if( !in_array( 'skin', $wgHiddenPrefs ) ) { |
2325 | | - global $wgRequest; |
2326 | | - # get the user skin |
2327 | | - $userSkin = $this->getOption( 'skin' ); |
2328 | | - $userSkin = $wgRequest->getVal( 'useskin', $userSkin ); |
2329 | | - } else { |
2330 | | - # if we're not allowing users to override, then use the default |
2331 | | - global $wgDefaultSkin; |
2332 | | - $userSkin = $wgDefaultSkin; |
2333 | | - } |
2334 | | - |
2335 | | - $skin = Skin::newFromKey( $userSkin ); |
2336 | | - wfProfileOut( __METHOD__ ); |
2337 | | - |
2338 | | - return $skin; |
2339 | | - } |
2340 | | - |
2341 | 2308 | /** |
2342 | 2309 | * Check the watched status of an article. |
2343 | 2310 | * @param $title Title of the article to look at |
Index: trunk/phase3/includes/RequestContext.php |
— | — | @@ -130,9 +130,25 @@ |
131 | 131 | * @return Skin |
132 | 132 | */ |
133 | 133 | public function getSkin() { |
134 | | - // For now we'll just proxy to the user. In the future a saner location for |
135 | | - // organizing what skin to use may be chosen |
136 | | - return $this->getUser()->getSkin(); |
| 134 | + if ( !isset($this->skin) ) { |
| 135 | + wfProfileIn( __METHOD__ . '-createskin' ); |
| 136 | + |
| 137 | + global $wgHiddenPrefs; |
| 138 | + if( !in_array( 'skin', $wgHiddenPrefs ) ) { |
| 139 | + # get the user skin |
| 140 | + $userSkin = $this->getUser()->getOption( 'skin' ); |
| 141 | + $userSkin = $this->getRequest()->getVal( 'useskin', $userSkin ); |
| 142 | + } else { |
| 143 | + # if we're not allowing users to override, then use the default |
| 144 | + global $wgDefaultSkin; |
| 145 | + $userSkin = $wgDefaultSkin; |
| 146 | + } |
| 147 | + |
| 148 | + $this->skin = Skin::newFromKey( $userSkin ); |
| 149 | + $this->skin->setContext( $this ); |
| 150 | + wfProfileOut( __METHOD__ . '-createskin' ); |
| 151 | + } |
| 152 | + return $this->skin; |
137 | 153 | } |
138 | 154 | |
139 | 155 | /** Helpful methods **/ |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -552,7 +552,7 @@ |
553 | 553 | * @return Boolean: true iff cache-ok headers was sent. |
554 | 554 | */ |
555 | 555 | public function checkLastModified( $timestamp ) { |
556 | | - global $wgCachePages, $wgCacheEpoch, $wgRequest; |
| 556 | + global $wgCachePages, $wgCacheEpoch; |
557 | 557 | |
558 | 558 | if ( !$timestamp || $timestamp == '19700101000000' ) { |
559 | 559 | wfDebug( __METHOD__ . ": CACHE DISABLED, NO TIMESTAMP\n" ); |
— | — | @@ -619,7 +619,7 @@ |
620 | 620 | # Give a 304 response code and disable body output |
621 | 621 | wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false ); |
622 | 622 | ini_set( 'zlib.output_compression', 0 ); |
623 | | - $wgRequest->response()->header( "HTTP/1.1 304 Not Modified" ); |
| 623 | + $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" ); |
624 | 624 | $this->sendCacheControl(); |
625 | 625 | $this->disable(); |
626 | 626 | |
— | — | @@ -774,6 +774,16 @@ |
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
| 778 | + * Get the WebRequest being used for this instance |
| 779 | + * |
| 780 | + * @return WebRequest |
| 781 | + * @since 1.18 |
| 782 | + */ |
| 783 | + public function getRequest() { |
| 784 | + return $this->getContext()->getRequest(); |
| 785 | + } |
| 786 | + |
| 787 | + /** |
778 | 788 | * Set the Title object to use |
779 | 789 | * |
780 | 790 | * @param $t Title object |
— | — | @@ -1546,9 +1556,9 @@ |
1547 | 1557 | * @return Boolean |
1548 | 1558 | */ |
1549 | 1559 | function uncacheableBecauseRequestVars() { |
1550 | | - global $wgRequest; |
1551 | | - return $wgRequest->getText( 'useskin', false ) === false |
1552 | | - && $wgRequest->getText( 'uselang', false ) === false; |
| 1560 | + $request = $this->getRequest(); |
| 1561 | + return $request->getText( 'useskin', false ) === false |
| 1562 | + && $request->getText( 'uselang', false ) === false; |
1553 | 1563 | } |
1554 | 1564 | |
1555 | 1565 | /** |
— | — | @@ -1558,8 +1568,7 @@ |
1559 | 1569 | * @return Boolean |
1560 | 1570 | */ |
1561 | 1571 | function haveCacheVaryCookies() { |
1562 | | - global $wgRequest; |
1563 | | - $cookieHeader = $wgRequest->getHeader( 'cookie' ); |
| 1572 | + $cookieHeader = $this->getRequest()->getHeader( 'cookie' ); |
1564 | 1573 | if ( $cookieHeader === false ) { |
1565 | 1574 | return false; |
1566 | 1575 | } |
— | — | @@ -1632,8 +1641,8 @@ |
1633 | 1642 | * /w/index.php?title=Main_page&variant=zh-cn should never be served. |
1634 | 1643 | */ |
1635 | 1644 | function addAcceptLanguage() { |
1636 | | - global $wgRequest, $wgContLang; |
1637 | | - if( !$wgRequest->getCheck( 'variant' ) && $wgContLang->hasVariants() ) { |
| 1645 | + global $wgContLang; |
| 1646 | + if( !$this->getRequest()->getCheck( 'variant' ) && $wgContLang->hasVariants() ) { |
1638 | 1647 | $variants = $wgContLang->getVariants(); |
1639 | 1648 | $aloption = array(); |
1640 | 1649 | foreach ( $variants as $variant ) { |
— | — | @@ -1696,9 +1705,9 @@ |
1697 | 1706 | * Send cache control HTTP headers |
1698 | 1707 | */ |
1699 | 1708 | public function sendCacheControl() { |
1700 | | - global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgRequest, $wgUseXVO; |
| 1709 | + global $wgUseSquid, $wgUseESI, $wgUseETag, $wgSquidMaxage, $wgUseXVO; |
1701 | 1710 | |
1702 | | - $response = $wgRequest->response(); |
| 1711 | + $response = $this->getRequest()->response(); |
1703 | 1712 | if ( $wgUseETag && $this->mETag ) { |
1704 | 1713 | $response->header( "ETag: $this->mETag" ); |
1705 | 1714 | } |
— | — | @@ -1824,7 +1833,7 @@ |
1825 | 1834 | * the object, let's actually output it: |
1826 | 1835 | */ |
1827 | 1836 | public function output() { |
1828 | | - global $wgOutputEncoding, $wgRequest; |
| 1837 | + global $wgOutputEncoding; |
1829 | 1838 | global $wgLanguageCode, $wgDebugRedirects, $wgMimeType; |
1830 | 1839 | |
1831 | 1840 | if( $this->mDoNothing ) { |
— | — | @@ -1833,7 +1842,7 @@ |
1834 | 1843 | |
1835 | 1844 | wfProfileIn( __METHOD__ ); |
1836 | 1845 | |
1837 | | - $response = $wgRequest->response(); |
| 1846 | + $response = $this->getRequest()->response(); |
1838 | 1847 | |
1839 | 1848 | if ( $this->mRedirect != '' ) { |
1840 | 1849 | # Standards require redirect URLs to be absolute |
— | — | @@ -1924,7 +1933,7 @@ |
1925 | 1934 | * @return nothing |
1926 | 1935 | */ |
1927 | 1936 | function blockedPage( $return = true ) { |
1928 | | - global $wgContLang, $wgLang; |
| 1937 | + global $wgContLang; |
1929 | 1938 | |
1930 | 1939 | $this->setPageTitle( wfMsg( 'blockedtitle' ) ); |
1931 | 1940 | $this->setRobotPolicy( 'noindex,nofollow' ); |
— | — | @@ -1935,7 +1944,7 @@ |
1936 | 1945 | if( $reason == '' ) { |
1937 | 1946 | $reason = wfMsg( 'blockednoreason' ); |
1938 | 1947 | } |
1939 | | - $blockTimestamp = $wgLang->timeanddate( |
| 1948 | + $blockTimestamp = $this->getContext()->getLang()->timeanddate( |
1940 | 1949 | wfTimestamp( TS_MW, $this->getUser()->mBlock->mTimestamp ), true |
1941 | 1950 | ); |
1942 | 1951 | $ip = wfGetIP(); |
— | — | @@ -1944,7 +1953,7 @@ |
1945 | 1954 | |
1946 | 1955 | $blockid = $this->getUser()->mBlock->getId(); |
1947 | 1956 | |
1948 | | - $blockExpiry = $wgLang->formatExpiry( $this->getUser()->mBlock->mExpiry ); |
| 1957 | + $blockExpiry = $this->getContext()->getLang()->formatExpiry( $this->getUser()->mBlock->mExpiry ); |
1949 | 1958 | |
1950 | 1959 | if ( $this->getUser()->mBlock->mAuto ) { |
1951 | 1960 | $msg = 'autoblockedtext'; |
— | — | @@ -2034,8 +2043,6 @@ |
2035 | 2044 | * @param $permission String: key required |
2036 | 2045 | */ |
2037 | 2046 | public function permissionRequired( $permission ) { |
2038 | | - global $wgLang; |
2039 | | - |
2040 | 2047 | $this->setPageTitle( wfMsg( 'badaccess' ) ); |
2041 | 2048 | $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); |
2042 | 2049 | $this->setRobotPolicy( 'noindex,nofollow' ); |
— | — | @@ -2047,7 +2054,7 @@ |
2048 | 2055 | if( $groups ) { |
2049 | 2056 | $this->addWikiMsg( |
2050 | 2057 | 'badaccess-groups', |
2051 | | - $wgLang->commaList( $groups ), |
| 2058 | + $this->getContext()->getLang()->commaList( $groups ), |
2052 | 2059 | count( $groups ) |
2053 | 2060 | ); |
2054 | 2061 | } else { |
— | — | @@ -2279,14 +2286,12 @@ |
2280 | 2287 | * @param $returntoquery String: query string for the return to link |
2281 | 2288 | */ |
2282 | 2289 | public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) { |
2283 | | - global $wgRequest; |
2284 | | - |
2285 | 2290 | if ( $returnto == null ) { |
2286 | | - $returnto = $wgRequest->getText( 'returnto' ); |
| 2291 | + $returnto = $this->getRequest()->getText( 'returnto' ); |
2287 | 2292 | } |
2288 | 2293 | |
2289 | 2294 | if ( $returntoquery == null ) { |
2290 | | - $returntoquery = $wgRequest->getText( 'returntoquery' ); |
| 2295 | + $returntoquery = $this->getRequest()->getText( 'returntoquery' ); |
2291 | 2296 | } |
2292 | 2297 | |
2293 | 2298 | if ( $returnto === '' ) { |
— | — | @@ -2313,7 +2318,6 @@ |
2314 | 2319 | public function headElement( Skin $sk, $includeStyle = true ) { |
2315 | 2320 | global $wgOutputEncoding, $wgMimeType; |
2316 | 2321 | global $wgUseTrackbacks, $wgHtml5; |
2317 | | - global $wgRequest, $wgLang; |
2318 | 2322 | |
2319 | 2323 | if ( $sk->commonPrintStylesheet() ) { |
2320 | 2324 | $this->addModuleStyles( 'mediawiki.legacy.wikiprintable' ); |
— | — | @@ -2353,7 +2357,7 @@ |
2354 | 2358 | $bodyAttrs = array(); |
2355 | 2359 | |
2356 | 2360 | # Crazy edit-on-double-click stuff |
2357 | | - $action = $wgRequest->getVal( 'action', 'view' ); |
| 2361 | + $action = $this->getRequest()->getVal( 'action', 'view' ); |
2358 | 2362 | |
2359 | 2363 | if ( |
2360 | 2364 | $this->getTitle()->getNamespace() != NS_SPECIAL && |
— | — | @@ -2368,7 +2372,7 @@ |
2369 | 2373 | $dir = wfUILang()->getDir(); |
2370 | 2374 | $bodyAttrs['class'] = "mediawiki $dir"; |
2371 | 2375 | |
2372 | | - if ( $wgLang->capitalizeAllNouns() ) { |
| 2376 | + if ( $this->getContext()->getLang()->capitalizeAllNouns() ) { |
2373 | 2377 | # A <body> class is probably not the best way to do this . . . |
2374 | 2378 | $bodyAttrs['class'] .= ' capitalize-all-nouns'; |
2375 | 2379 | } |
— | — | @@ -2437,13 +2441,13 @@ |
2438 | 2442 | * @return string html <script> and <style> tags |
2439 | 2443 | */ |
2440 | 2444 | protected function makeResourceLoaderLink( Skin $skin, $modules, $only, $useESI = false ) { |
2441 | | - global $wgLang, $wgLoadScript, $wgResourceLoaderUseESI, |
2442 | | - $wgResourceLoaderInlinePrivateModules, $wgRequest; |
| 2445 | + global $wgLoadScript, $wgResourceLoaderUseESI, |
| 2446 | + $wgResourceLoaderInlinePrivateModules; |
2443 | 2447 | // Lazy-load ResourceLoader |
2444 | 2448 | // TODO: Should this be a static function of ResourceLoader instead? |
2445 | 2449 | // TODO: Divide off modules starting with "user", and add the user parameter to them |
2446 | 2450 | $baseQuery = array( |
2447 | | - 'lang' => $wgLang->getCode(), |
| 2451 | + 'lang' => $this->getContext()->getLang()->getCode(), |
2448 | 2452 | 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false', |
2449 | 2453 | 'skin' => $skin->getSkinName(), |
2450 | 2454 | 'only' => $only, |
— | — | @@ -2452,7 +2456,7 @@ |
2453 | 2457 | if ( $this->isPrintable() ) { |
2454 | 2458 | $baseQuery['printable'] = 1; |
2455 | 2459 | } |
2456 | | - if ( $wgRequest->getBool( 'handheld' ) ) { |
| 2460 | + if ( $this->getRequest()->getBool( 'handheld' ) ) { |
2457 | 2461 | $baseQuery['handheld'] = 1; |
2458 | 2462 | } |
2459 | 2463 | |
— | — | @@ -2589,7 +2593,7 @@ |
2590 | 2594 | * @return String: HTML fragment |
2591 | 2595 | */ |
2592 | 2596 | function getHeadScripts( Skin $sk ) { |
2593 | | - global $wgRequest, $wgUseSiteJs, $wgAllowUserJs; |
| 2597 | + global $wgUseSiteJs, $wgAllowUserJs; |
2594 | 2598 | |
2595 | 2599 | // Startup - this will immediately load jquery and mediawiki modules |
2596 | 2600 | $scripts = $this->makeResourceLoaderLink( $sk, 'startup', ResourceLoaderModule::TYPE_SCRIPTS, true ); |
— | — | @@ -2626,10 +2630,10 @@ |
2627 | 2631 | |
2628 | 2632 | // Add user JS if enabled |
2629 | 2633 | if ( $wgAllowUserJs && $this->getUser()->isLoggedIn() ) { |
2630 | | - $action = $wgRequest->getVal( 'action', 'view' ); |
| 2634 | + $action = $this->getRequest()->getVal( 'action', 'view' ); |
2631 | 2635 | if( $this->getTitle() && $this->getTitle()->isJsSubpage() && $sk->userCanPreview( $action ) ) { |
2632 | 2636 | # XXX: additional security check/prompt? |
2633 | | - $scripts .= Html::inlineScript( "\n" . $wgRequest->getText( 'wpTextbox1' ) . "\n" ) . "\n"; |
| 2637 | + $scripts .= Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n"; |
2634 | 2638 | } else { |
2635 | 2639 | # FIXME: this means that User:Me/Common.js doesn't load when previewing |
2636 | 2640 | # User:Me/Vector.js, and vice versa (bug26283) |
— | — | @@ -2650,7 +2654,7 @@ |
2651 | 2655 | * have to be purged on configuration changes. |
2652 | 2656 | */ |
2653 | 2657 | protected function getJSVars() { |
2654 | | - global $wgRequest, $wgUseAjax, $wgEnableMWSuggest, $wgContLang; |
| 2658 | + global $wgUseAjax, $wgEnableMWSuggest, $wgContLang; |
2655 | 2659 | |
2656 | 2660 | $title = $this->getTitle(); |
2657 | 2661 | $ns = $title->getNamespace(); |
— | — | @@ -2671,7 +2675,7 @@ |
2672 | 2676 | 'wgCurRevisionId' => $title->getLatestRevID(), |
2673 | 2677 | 'wgArticleId' => $title->getArticleId(), |
2674 | 2678 | 'wgIsArticle' => $this->isArticle(), |
2675 | | - 'wgAction' => $wgRequest->getText( 'action', 'view' ), |
| 2679 | + 'wgAction' => $this->getRequest()->getText( 'action', 'view' ), |
2676 | 2680 | 'wgUserName' => $this->getUser()->isAnon() ? null : $this->getUser()->getName(), |
2677 | 2681 | 'wgUserGroups' => $this->getUser()->getEffectiveGroups(), |
2678 | 2682 | 'wgCategories' => $this->getCategories(), |
— | — | @@ -3094,7 +3098,7 @@ |
3095 | 3099 | * @return String: modified value of the "media" attribute |
3096 | 3100 | */ |
3097 | 3101 | public static function transformCssMedia( $media ) { |
3098 | | - global $wgRequest, $wgHandheldForIPhone; |
| 3102 | + global $wgHandheldForIPhone; |
3099 | 3103 | |
3100 | 3104 | // Switch in on-screen display for media testing |
3101 | 3105 | $switches = array( |
— | — | @@ -3102,7 +3106,7 @@ |
3103 | 3107 | 'handheld' => 'handheld', |
3104 | 3108 | ); |
3105 | 3109 | foreach( $switches as $switch => $targetMedia ) { |
3106 | | - if( $wgRequest->getBool( $switch ) ) { |
| 3110 | + if( $this->getRequest()->getBool( $switch ) ) { |
3107 | 3111 | if( $media == $targetMedia ) { |
3108 | 3112 | $media = ''; |
3109 | 3113 | } elseif( $media == 'screen' ) { |
— | — | @@ -3153,13 +3157,13 @@ |
3154 | 3158 | * @param $lag Integer: slave lag |
3155 | 3159 | */ |
3156 | 3160 | public function showLagWarning( $lag ) { |
3157 | | - global $wgSlaveLagWarning, $wgSlaveLagCritical, $wgLang; |
| 3161 | + global $wgSlaveLagWarning, $wgSlaveLagCritical; |
3158 | 3162 | if( $lag >= $wgSlaveLagWarning ) { |
3159 | 3163 | $message = $lag < $wgSlaveLagCritical |
3160 | 3164 | ? 'lag-warn-normal' |
3161 | 3165 | : 'lag-warn-high'; |
3162 | 3166 | $wrap = Html::rawElement( 'div', array( 'class' => "mw-{$message}" ), "\n$1\n" ); |
3163 | | - $this->wrapWikiMsg( "$wrap\n", array( $message, $wgLang->formatNum( $lag ) ) ); |
| 3167 | + $this->wrapWikiMsg( "$wrap\n", array( $message, $this->getContext()->getLang()->formatNum( $lag ) ) ); |
3164 | 3168 | } |
3165 | 3169 | } |
3166 | 3170 | |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -158,8 +158,8 @@ |
159 | 159 | wfProfileOut( __METHOD__ . '-init' ); |
160 | 160 | |
161 | 161 | wfProfileIn( __METHOD__ . '-stuff' ); |
162 | | - $this->thispage = $this->mTitle->getPrefixedDBkey(); |
163 | | - $this->thisurl = $this->mTitle->getPrefixedURL(); |
| 162 | + $this->thispage = $this->getTitle()->getPrefixedDBkey(); |
| 163 | + $this->thisurl = $this->getTitle()->getPrefixedURL(); |
164 | 164 | $query = array(); |
165 | 165 | if ( !$wgRequest->wasPosted() ) { |
166 | 166 | $query = $wgRequest->getValues(); |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | } |
171 | 171 | $this->thisquery = wfUrlencode( wfArrayToCGI( $query ) ); |
172 | 172 | $this->loggedin = $wgUser->isLoggedIn(); |
173 | | - $this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL ); |
| 173 | + $this->iscontent = ( $this->getTitle()->getNamespace() != NS_SPECIAL ); |
174 | 174 | $this->iseditable = ( $this->iscontent and !( $action == 'edit' or $action == 'submit' ) ); |
175 | 175 | $this->username = $wgUser->getName(); |
176 | 176 | |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | $this->userpageUrlDetails = self::makeKnownUrlDetails( $this->userpage ); |
183 | 183 | } |
184 | 184 | |
185 | | - $this->titletxt = $this->mTitle->getPrefixedText(); |
| 185 | + $this->titletxt = $this->getTitle()->getPrefixedText(); |
186 | 186 | wfProfileOut( __METHOD__ . '-stuff' ); |
187 | 187 | |
188 | 188 | wfProfileIn( __METHOD__ . '-stuff-head' ); |
— | — | @@ -230,19 +230,19 @@ |
231 | 231 | $tpl->set( 'title', $out->getPageTitle() ); |
232 | 232 | $tpl->set( 'pagetitle', $out->getHTMLTitle() ); |
233 | 233 | $tpl->set( 'displaytitle', $out->mPageLinkTitle ); |
234 | | - $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) ); |
| 234 | + $tpl->set( 'pageclass', $this->getPageClasses( $this->getTitle() ) ); |
235 | 235 | $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) ); |
236 | 236 | |
237 | | - $nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ? |
238 | | - MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) : |
239 | | - $this->mTitle->getNsText(); |
| 237 | + $nsname = MWNamespace::exists( $this->getTitle()->getNamespace() ) ? |
| 238 | + MWNamespace::getCanonicalName( $this->getTitle()->getNamespace() ) : |
| 239 | + $this->getTitle()->getNsText(); |
240 | 240 | |
241 | 241 | $tpl->set( 'nscanonical', $nsname ); |
242 | | - $tpl->set( 'nsnumber', $this->mTitle->getNamespace() ); |
243 | | - $tpl->set( 'titleprefixeddbkey', $this->mTitle->getPrefixedDBKey() ); |
244 | | - $tpl->set( 'titletext', $this->mTitle->getText() ); |
245 | | - $tpl->set( 'articleid', $this->mTitle->getArticleId() ); |
246 | | - $tpl->set( 'currevisionid', $this->mTitle->getLatestRevID() ); |
| 242 | + $tpl->set( 'nsnumber', $this->getTitle()->getNamespace() ); |
| 243 | + $tpl->set( 'titleprefixeddbkey', $this->getTitle()->getPrefixedDBKey() ); |
| 244 | + $tpl->set( 'titletext', $this->getTitle()->getText() ); |
| 245 | + $tpl->set( 'articleid', $this->getTitle()->getArticleId() ); |
| 246 | + $tpl->set( 'currevisionid', $this->getTitle()->getLatestRevID() ); |
247 | 247 | |
248 | 248 | $tpl->set( 'isarticle', $out->isArticle() ); |
249 | 249 | |
— | — | @@ -284,12 +284,12 @@ |
285 | 285 | $tpl->set( 'printable', $out->isPrintable() ); |
286 | 286 | $tpl->set( 'handheld', $wgRequest->getBool( 'handheld' ) ); |
287 | 287 | $tpl->setRef( 'loggedin', $this->loggedin ); |
288 | | - $tpl->set( 'notspecialpage', $this->mTitle->getNamespace() != NS_SPECIAL ); |
| 288 | + $tpl->set( 'notspecialpage', $this->getTitle()->getNamespace() != NS_SPECIAL ); |
289 | 289 | /* XXX currently unused, might get useful later |
290 | | - $tpl->set( 'editable', ( $this->mTitle->getNamespace() != NS_SPECIAL ) ); |
291 | | - $tpl->set( 'exists', $this->mTitle->getArticleID() != 0 ); |
292 | | - $tpl->set( 'watch', $this->mTitle->userIsWatching() ? 'unwatch' : 'watch' ); |
293 | | - $tpl->set( 'protect', count( $this->mTitle->isProtected() ) ? 'unprotect' : 'protect' ); |
| 290 | + $tpl->set( 'editable', ( $this->getTitle()->getNamespace() != NS_SPECIAL ) ); |
| 291 | + $tpl->set( 'exists', $this->getTitle()->getArticleID() != 0 ); |
| 292 | + $tpl->set( 'watch', $this->getTitle()->userIsWatching() ? 'unwatch' : 'watch' ); |
| 293 | + $tpl->set( 'protect', count( $this->getTitle()->isProtected() ) ? 'unprotect' : 'protect' ); |
294 | 294 | $tpl->set( 'helppage', wfMsg( 'helppage' ) ); |
295 | 295 | */ |
296 | 296 | $tpl->set( 'searchaction', $this->escapeSearchLink() ); |
— | — | @@ -328,7 +328,7 @@ |
329 | 329 | |
330 | 330 | // The content of SpecialPages should be presented in the |
331 | 331 | // user's language. Content of regular pages should not be touched. |
332 | | - if( $this->mTitle->isSpecialPage() ) { |
| 332 | + if( $this->getTitle()->isSpecialPage() ) { |
333 | 333 | $tpl->set( 'specialpageattributes', $attrs ); |
334 | 334 | } |
335 | 335 | } |
— | — | @@ -342,9 +342,9 @@ |
343 | 343 | $tpl->setRef( 'skin', $this ); |
344 | 344 | $tpl->set( 'logo', $this->logoText() ); |
345 | 345 | if ( $out->isArticle() && ( !isset( $oldid ) || isset( $diff ) ) && |
346 | | - $this->mTitle->exists() ) |
| 346 | + $this->getTitle()->exists() ) |
347 | 347 | { |
348 | | - $article = new Article( $this->mTitle, 0 ); |
| 348 | + $article = new Article( $this->getTitle(), 0 ); |
349 | 349 | if ( !$wgDisableCounters ) { |
350 | 350 | $viewcount = $wgLang->formatNum( $article->getCount() ); |
351 | 351 | if ( $viewcount ) { |
— | — | @@ -360,7 +360,7 @@ |
361 | 361 | $dbr = wfGetDB( DB_SLAVE ); |
362 | 362 | $res = $dbr->select( 'watchlist', |
363 | 363 | array( 'COUNT(*) AS n' ), |
364 | | - array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ), |
| 364 | + array( 'wl_title' => $dbr->strencode( $this->getTitle()->getDBkey() ), 'wl_namespace' => $this->getTitle()->getNamespace() ), |
365 | 365 | __METHOD__ |
366 | 366 | ); |
367 | 367 | $x = $dbr->fetchObject( $res ); |
— | — | @@ -796,7 +796,7 @@ |
797 | 797 | wfProfileIn( __METHOD__ ); |
798 | 798 | |
799 | 799 | $title = $this->getRelevantTitle(); // Display tabs for the relevant title rather than always the title itself |
800 | | - $onPage = $title->equals($this->mTitle); |
| 800 | + $onPage = $title->equals($this->getTitle()); |
801 | 801 | |
802 | 802 | $content_navigation = array( |
803 | 803 | 'namespaces' => array(), |
— | — | @@ -935,7 +935,7 @@ |
936 | 936 | if ( $title->quickUserCan( 'move' ) ) { |
937 | 937 | $moveTitle = SpecialPage::getTitleFor( 'Movepage', $title->getPrefixedDBkey() ); |
938 | 938 | $content_navigation['actions']['move'] = array( |
939 | | - 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? 'selected' : false, |
| 939 | + 'class' => $this->getTitle()->isSpecial( 'Movepage' ) ? 'selected' : false, |
940 | 940 | 'text' => wfMessageFallback( "$skname-action-move", 'move' )->text(), |
941 | 941 | 'href' => $moveTitle->getLocalURL() |
942 | 942 | ); |
— | — | @@ -958,7 +958,7 @@ |
959 | 959 | // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead |
960 | 960 | $msgKey = $wgUser->isAllowed( 'undelete' ) ? 'undelete' : 'viewdeleted'; |
961 | 961 | $content_navigation['actions']['undelete'] = array( |
962 | | - 'class' => $this->mTitle->isSpecial( 'Undelete' ) ? 'selected' : false, |
| 962 | + 'class' => $this->getTitle()->isSpecial( 'Undelete' ) ? 'selected' : false, |
963 | 963 | 'text' => wfMessageFallback( "$skname-action-$msgKey", "{$msgKey}_short" ) |
964 | 964 | ->params( $wgLang->formatNum( $n ) )->text(), |
965 | 965 | 'href' => $undelTitle->getLocalURL( array( 'target' => $title->getPrefixedDBkey() ) ) |
— | — | @@ -1157,7 +1157,7 @@ |
1158 | 1158 | if ( !$out->isPrintable() ) { |
1159 | 1159 | $nav_urls['print'] = array( |
1160 | 1160 | 'text' => wfMsg( 'printableversion' ), |
1161 | | - 'href' => $this->mTitle->getLocalURL( $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) |
| 1161 | + 'href' => $this->getTitle()->getLocalURL( $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) |
1162 | 1162 | ); |
1163 | 1163 | } |
1164 | 1164 | |
— | — | @@ -1174,12 +1174,12 @@ |
1175 | 1175 | wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$revid, &$revid ) ); |
1176 | 1176 | } |
1177 | 1177 | |
1178 | | - if( $this->mTitle->getNamespace() != NS_SPECIAL ) { |
| 1178 | + if( $this->getTitle()->getNamespace() != NS_SPECIAL ) { |
1179 | 1179 | $wlhTitle = SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage ); |
1180 | 1180 | $nav_urls['whatlinkshere'] = array( |
1181 | 1181 | 'href' => $wlhTitle->getLocalUrl() |
1182 | 1182 | ); |
1183 | | - if( $this->mTitle->getArticleId() ) { |
| 1183 | + if( $this->getTitle()->getArticleId() ) { |
1184 | 1184 | $rclTitle = SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage ); |
1185 | 1185 | $nav_urls['recentchangeslinked'] = array( |
1186 | 1186 | 'href' => $rclTitle->getLocalUrl() |
— | — | @@ -1249,7 +1249,7 @@ |
1250 | 1250 | * @private |
1251 | 1251 | */ |
1252 | 1252 | function getNameSpaceKey() { |
1253 | | - return $this->mTitle->getNamespaceKey(); |
| 1253 | + return $this->getTitle()->getNamespaceKey(); |
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | /** |
— | — | @@ -1263,7 +1263,7 @@ |
1264 | 1264 | $action = $wgRequest->getVal( 'action', 'view' ); |
1265 | 1265 | |
1266 | 1266 | if( $allowUserJs && $this->loggedin ) { |
1267 | | - if( $this->mTitle->isJsSubpage() and $this->userCanPreview( $action ) ) { |
| 1267 | + if( $this->getTitle()->isJsSubpage() and $this->userCanPreview( $action ) ) { |
1268 | 1268 | # XXX: additional security check/prompt? |
1269 | 1269 | $this->userjsprev = '/*<![CDATA[*/ ' . $wgRequest->getText( 'wpTextbox1' ) . ' /*]]>*/'; |
1270 | 1270 | } else { |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -23,11 +23,6 @@ |
24 | 24 | /**#@-*/ |
25 | 25 | protected $mRevisionId; // The revision ID we're looking at, null if not applicable. |
26 | 26 | protected $skinname = 'standard'; |
27 | | - /** |
28 | | - * todo Fixme: should be protected :-\ |
29 | | - * @var Title |
30 | | - */ |
31 | | - var $mTitle = null; |
32 | 27 | protected $mRelevantTitle = null; |
33 | 28 | protected $mRelevantUser = null; |
34 | 29 | |
— | — | @@ -191,18 +186,18 @@ |
192 | 187 | * Preload the existence of three commonly-requested pages in a single query |
193 | 188 | */ |
194 | 189 | function preloadExistence() { |
195 | | - global $wgUser; |
196 | | - |
| 190 | + $user = $this->getContext()->getUser(); |
| 191 | + |
197 | 192 | // User/talk link |
198 | | - $titles = array( $wgUser->getUserPage(), $wgUser->getTalkPage() ); |
| 193 | + $titles = array( $user->getUserPage(), $user->getTalkPage() ); |
199 | 194 | |
200 | 195 | // Other tab link |
201 | | - if ( $this->mTitle->getNamespace() == NS_SPECIAL ) { |
| 196 | + if ( $this->getTitle()->getNamespace() == NS_SPECIAL ) { |
202 | 197 | // nothing |
203 | | - } elseif ( $this->mTitle->isTalkPage() ) { |
204 | | - $titles[] = $this->mTitle->getSubjectPage(); |
| 198 | + } elseif ( $this->getTitle()->isTalkPage() ) { |
| 199 | + $titles[] = $this->getTitle()->getSubjectPage(); |
205 | 200 | } else { |
206 | | - $titles[] = $this->mTitle->getTalkPage(); |
| 201 | + $titles[] = $this->getTitle()->getTalkPage(); |
207 | 202 | } |
208 | 203 | |
209 | 204 | $lb = new LinkBatch( $titles ); |
— | — | @@ -214,9 +209,7 @@ |
215 | 210 | * Set some local variables |
216 | 211 | */ |
217 | 212 | protected function setMembers() { |
218 | | - global $wgUser; |
219 | | - $this->mUser = $wgUser; |
220 | | - $this->userpage = $wgUser->getUserPage()->getPrefixedText(); |
| 213 | + $this->userpage = $this->getContext()->getUser()->getUserPage()->getPrefixedText(); |
221 | 214 | $this->usercss = false; |
222 | 215 | } |
223 | 216 | |
— | — | @@ -226,23 +219,37 @@ |
227 | 220 | * @return Boolean |
228 | 221 | */ |
229 | 222 | public function isRevisionCurrent() { |
230 | | - return $this->mRevisionId == 0 || $this->mRevisionId == $this->mTitle->getLatestRevID(); |
| 223 | + return $this->mRevisionId == 0 || $this->mRevisionId == $this->getTitle()->getLatestRevID(); |
231 | 224 | } |
232 | 225 | |
233 | 226 | /** |
234 | | - * Set the title |
235 | | - * @param $t Title object to use |
| 227 | + * Set the RequestContext used in this instance |
| 228 | + * |
| 229 | + * @param RequestContext $context |
236 | 230 | */ |
237 | | - public function setTitle( $t ) { |
238 | | - $this->mTitle = $t; |
| 231 | + public function setContext( RequestContext $context ) { |
| 232 | + $this->mContext = $context; |
239 | 233 | } |
240 | 234 | |
| 235 | + /** |
| 236 | + * Get the RequestContext used in this instance |
| 237 | + * |
| 238 | + * @return RequestContext |
| 239 | + */ |
| 240 | + public function getContext() { |
| 241 | + if ( !isset($this->mContext) ) { |
| 242 | + wfDebug( __METHOD__ . " called and \$mContext is null. Using RequestContext::getMain(); for sanity\n" ); |
| 243 | + $this->mContext = RequestContext::getMain(); |
| 244 | + } |
| 245 | + return $this->mContext; |
| 246 | + } |
| 247 | + |
241 | 248 | /** Get the title |
242 | 249 | * |
243 | 250 | * @return Title |
244 | 251 | */ |
245 | 252 | public function getTitle() { |
246 | | - return $this->mTitle; |
| 253 | + return $this->getContext()->getTitle(); |
247 | 254 | } |
248 | 255 | |
249 | 256 | /** |
— | — | @@ -266,7 +273,7 @@ |
267 | 274 | if ( isset($this->mRelevantTitle) ) { |
268 | 275 | return $this->mRelevantTitle; |
269 | 276 | } |
270 | | - return $this->mTitle; |
| 277 | + return $this->getTitle(); |
271 | 278 | } |
272 | 279 | |
273 | 280 | /** |
— | — | @@ -363,23 +370,21 @@ |
364 | 371 | * @return bool |
365 | 372 | */ |
366 | 373 | public function userCanPreview( $action ) { |
367 | | - global $wgRequest, $wgUser; |
368 | | - |
369 | 374 | if ( $action != 'submit' ) { |
370 | 375 | return false; |
371 | 376 | } |
372 | | - if ( !$wgRequest->wasPosted() ) { |
| 377 | + if ( !$this->getContext()->getRequest()->wasPosted() ) { |
373 | 378 | return false; |
374 | 379 | } |
375 | | - if ( !$this->mTitle->userCanEditCssSubpage() ) { |
| 380 | + if ( !$this->getTitle()->userCanEditCssSubpage() ) { |
376 | 381 | return false; |
377 | 382 | } |
378 | | - if ( !$this->mTitle->userCanEditJsSubpage() ) { |
| 383 | + if ( !$this->getTitle()->userCanEditJsSubpage() ) { |
379 | 384 | return false; |
380 | 385 | } |
381 | 386 | |
382 | | - return $wgUser->matchEditToken( |
383 | | - $wgRequest->getVal( 'wpEditToken' ) ); |
| 387 | + return $this->getContext()->getUser()->matchEditToken( |
| 388 | + $this->getContext()->getRequest()->getVal( 'wpEditToken' ) ); |
384 | 389 | } |
385 | 390 | |
386 | 391 | /** |
— | — | @@ -428,7 +433,6 @@ |
429 | 434 | * @private |
430 | 435 | */ |
431 | 436 | function setupUserCss( OutputPage $out ) { |
432 | | - global $wgRequest, $wgUser; |
433 | 437 | global $wgUseSiteCss, $wgAllowUserCss, $wgAllowUserCssPrefs; |
434 | 438 | |
435 | 439 | wfProfileIn( __METHOD__ ); |
— | — | @@ -442,16 +446,16 @@ |
443 | 447 | // Per-site custom styles |
444 | 448 | if ( $wgUseSiteCss ) { |
445 | 449 | $out->addModuleStyles( array( 'site', 'noscript' ) ); |
446 | | - if( $wgUser->isLoggedIn() ){ |
| 450 | + if( $this->getContext()->getUser()->isLoggedIn() ){ |
447 | 451 | $out->addModuleStyles( 'user.groups' ); |
448 | 452 | } |
449 | 453 | } |
450 | 454 | |
451 | 455 | // Per-user custom styles |
452 | 456 | if ( $wgAllowUserCss ) { |
453 | | - if ( $this->mTitle->isCssSubpage() && $this->userCanPreview( $wgRequest->getVal( 'action' ) ) ) { |
| 457 | + if ( $this->getTitle()->isCssSubpage() && $this->userCanPreview( $this->getContext()->getRequest()->getVal( 'action' ) ) ) { |
454 | 458 | // @FIXME: properly escape the cdata! |
455 | | - $out->addInlineStyle( $wgRequest->getText( 'wpTextbox1' ) ); |
| 459 | + $out->addInlineStyle( $this->getContext()->getRequest()->getText( 'wpTextbox1' ) ); |
456 | 460 | } else { |
457 | 461 | $out->addModuleStyles( 'user' ); |
458 | 462 | } |
— | — | @@ -533,14 +537,8 @@ |
534 | 538 | * The format without an explicit $out argument is deprecated |
535 | 539 | */ |
536 | 540 | function getCategoryLinks( OutputPage $out=null ) { |
537 | | - global $wgUseCategoryBrowser, $wgContLang, $wgUser; |
| 541 | + global $wgUseCategoryBrowser, $wgContLang; |
538 | 542 | |
539 | | - if ( is_null( $out ) ) { |
540 | | - // Backwards compatibility for when there was no $out arg |
541 | | - global $wgOut; |
542 | | - $out = $wgOut; |
543 | | - } |
544 | | - |
545 | 543 | if ( count( $out->mCategoryLinks ) == 0 ) { |
546 | 544 | return ''; |
547 | 545 | } |
— | — | @@ -569,9 +567,9 @@ |
570 | 568 | |
571 | 569 | # Hidden categories |
572 | 570 | if ( isset( $allCats['hidden'] ) ) { |
573 | | - if ( $wgUser->getBoolOption( 'showhiddencats' ) ) { |
| 571 | + if ( $this->getContext()->getUser()->getBoolOption( 'showhiddencats' ) ) { |
574 | 572 | $class = 'mw-hidden-cats-user-shown'; |
575 | | - } elseif ( $this->mTitle->getNamespace() == NS_CATEGORY ) { |
| 573 | + } elseif ( $this->getTitle()->getNamespace() == NS_CATEGORY ) { |
576 | 574 | $class = 'mw-hidden-cats-ns-shown'; |
577 | 575 | } else { |
578 | 576 | $class = 'mw-hidden-cats-hidden'; |
— | — | @@ -589,7 +587,7 @@ |
590 | 588 | $s .= '<br /><hr />'; |
591 | 589 | |
592 | 590 | # get a big array of the parents tree |
593 | | - $parenttree = $this->mTitle->getParentCategoryTree(); |
| 591 | + $parenttree = $this->getTitle()->getParentCategoryTree(); |
594 | 592 | # Skin object passed by reference cause it can not be |
595 | 593 | # accessed under the method subfunction drawCategoryBrowser |
596 | 594 | $tempout = explode( "\n", $this->drawCategoryBrowser( $parenttree, $this ) ); |
— | — | @@ -634,22 +632,15 @@ |
635 | 633 | * the ->getCategories( $out ) form with whatout OutputPage is on hand |
636 | 634 | */ |
637 | 635 | function getCategories( OutputPage $out=null ) { |
638 | | - if ( is_null( $out ) ) { |
639 | | - // Backwards compatibility for when there was no $out arg |
640 | | - global $wgOut; |
641 | | - $out = $wgOut; |
642 | | - } |
643 | 636 | |
644 | 637 | $catlinks = $this->getCategoryLinks( $out ); |
645 | 638 | |
646 | 639 | $classes = 'catlinks'; |
647 | 640 | |
648 | | - global $wgUser; |
649 | | - |
650 | 641 | // Check what we're showing |
651 | 642 | $allCats = $out->getCategoryLinks(); |
652 | | - $showHidden = $wgUser->getBoolOption( 'showhiddencats' ) || |
653 | | - $this->mTitle->getNamespace() == NS_CATEGORY; |
| 643 | + $showHidden = $this->getContext()->getUser()->getBoolOption( 'showhiddencats' ) || |
| 644 | + $this->getTitle()->getNamespace() == NS_CATEGORY; |
654 | 645 | |
655 | 646 | if ( empty( $allCats['normal'] ) && !( !empty( $allCats['hidden'] ) && $showHidden ) ) { |
656 | 647 | $classes .= ' catlinks-allhidden'; |
— | — | @@ -774,21 +765,19 @@ |
775 | 766 | |
776 | 767 | /** @return string Retrievied from HTML text */ |
777 | 768 | function printSource() { |
778 | | - $url = htmlspecialchars( $this->mTitle->getFullURL() ); |
| 769 | + $url = htmlspecialchars( $this->getTitle()->getFullURL() ); |
779 | 770 | return wfMsg( 'retrievedfrom', '<a href="' . $url . '">' . $url . '</a>' ); |
780 | 771 | } |
781 | 772 | |
782 | 773 | function getUndeleteLink() { |
783 | | - global $wgUser, $wgLang, $wgRequest; |
| 774 | + $action = $this->getContext()->getRequest()->getVal( 'action', 'view' ); |
784 | 775 | |
785 | | - $action = $wgRequest->getVal( 'action', 'view' ); |
| 776 | + if ( $this->getContext()->getUser()->isAllowed( 'deletedhistory' ) && |
| 777 | + ( $this->getTitle()->getArticleId() == 0 || $action == 'history' ) ) { |
| 778 | + $n = $this->getTitle()->isDeleted(); |
786 | 779 | |
787 | | - if ( $wgUser->isAllowed( 'deletedhistory' ) && |
788 | | - ( $this->mTitle->getArticleId() == 0 || $action == 'history' ) ) { |
789 | | - $n = $this->mTitle->isDeleted(); |
790 | | - |
791 | 780 | if ( $n ) { |
792 | | - if ( $wgUser->isAllowed( 'undelete' ) ) { |
| 781 | + if ( $this->getContext()->getUser()->isAllowed( 'undelete' ) ) { |
793 | 782 | $msg = 'thisisdeleted'; |
794 | 783 | } else { |
795 | 784 | $msg = 'viewdeleted'; |
— | — | @@ -797,8 +786,8 @@ |
798 | 787 | return wfMsg( |
799 | 788 | $msg, |
800 | 789 | $this->link( |
801 | | - SpecialPage::getTitleFor( 'Undelete', $this->mTitle->getPrefixedDBkey() ), |
802 | | - wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ), |
| 790 | + SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ), |
| 791 | + wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $this->getContext()->getLang()->formatNum( $n ) ), |
803 | 792 | array(), |
804 | 793 | array(), |
805 | 794 | array( 'known', 'noclasses' ) |
— | — | @@ -814,12 +803,7 @@ |
815 | 804 | * The format without an explicit $out argument is deprecated |
816 | 805 | */ |
817 | 806 | function subPageSubtitle( OutputPage $out=null ) { |
818 | | - if ( is_null( $out ) ) { |
819 | | - // Backwards compatibility for when there was no $out arg |
820 | | - global $wgOut; |
821 | | - $out = $wgOut; |
822 | | - } |
823 | | - |
| 807 | + $out = $this->getContext()->getOutput(); |
824 | 808 | $subpages = ''; |
825 | 809 | |
826 | 810 | if ( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages, $this, $out ) ) ) { |
— | — | @@ -827,7 +811,7 @@ |
828 | 812 | } |
829 | 813 | |
830 | 814 | if ( $out->isArticle() && MWNamespace::hasSubpages( $out->getTitle()->getNamespace() ) ) { |
831 | | - $ptext = $this->mTitle->getPrefixedText(); |
| 815 | + $ptext = $this->getTitle()->getPrefixedText(); |
832 | 816 | if ( preg_match( '/\//', $ptext ) ) { |
833 | 817 | $links = explode( '/', $ptext ); |
834 | 818 | array_pop( $links ); |
— | — | @@ -888,10 +872,10 @@ |
889 | 873 | } |
890 | 874 | |
891 | 875 | function getCopyright( $type = 'detect' ) { |
892 | | - global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest; |
| 876 | + global $wgRightsPage, $wgRightsUrl, $wgRightsText; |
893 | 877 | |
894 | 878 | if ( $type == 'detect' ) { |
895 | | - $diff = $wgRequest->getVal( 'diff' ); |
| 879 | + $diff = $this->getContext()->getRequest()->getVal( 'diff' ); |
896 | 880 | |
897 | 881 | if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) { |
898 | 882 | $type = 'history'; |
— | — | @@ -923,7 +907,7 @@ |
924 | 908 | // Allow for site and per-namespace customization of copyright notice. |
925 | 909 | $forContent = true; |
926 | 910 | |
927 | | - wfRunHooks( 'SkinCopyrightFooter', array( $this->mTitle, $type, &$msg, &$link, &$forContent ) ); |
| 911 | + wfRunHooks( 'SkinCopyrightFooter', array( $this->getTitle(), $type, &$msg, &$link, &$forContent ) ); |
928 | 912 | |
929 | 913 | if ( $forContent ) { |
930 | 914 | $out .= wfMsgForContent( $msg, $link ); |
— | — | @@ -980,17 +964,15 @@ |
981 | 965 | * @return String |
982 | 966 | */ |
983 | 967 | protected function lastModified( $article ) { |
984 | | - global $wgLang; |
985 | | - |
986 | 968 | if ( !$this->isRevisionCurrent() ) { |
987 | | - $timestamp = Revision::getTimestampFromId( $this->mTitle, $this->mRevisionId ); |
| 969 | + $timestamp = Revision::getTimestampFromId( $this->getTitle(), $this->mRevisionId ); |
988 | 970 | } else { |
989 | 971 | $timestamp = $article->getTimestamp(); |
990 | 972 | } |
991 | 973 | |
992 | 974 | if ( $timestamp ) { |
993 | | - $d = $wgLang->date( $timestamp, true ); |
994 | | - $t = $wgLang->time( $timestamp, true ); |
| 975 | + $d = $this->getContext()->getLang()->date( $timestamp, true ); |
| 976 | + $t = $this->getContext()->getLang()->time( $timestamp, true ); |
995 | 977 | $s = ' ' . wfMsg( 'lastmodifiedat', $d, $t ); |
996 | 978 | } else { |
997 | 979 | $s = ''; |
— | — | @@ -1116,9 +1098,8 @@ |
1117 | 1099 | } |
1118 | 1100 | |
1119 | 1101 | function showEmailUser( $id ) { |
1120 | | - global $wgUser; |
1121 | 1102 | $targetUser = User::newFromId( $id ); |
1122 | | - return $wgUser->canSendEmail() && # the sending user must have a confirmed email address |
| 1103 | + return $this->getContext()->getUser()->canSendEmail() && # the sending user must have a confirmed email address |
1123 | 1104 | $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users |
1124 | 1105 | } |
1125 | 1106 | |
— | — | @@ -1238,10 +1219,9 @@ |
1239 | 1220 | */ |
1240 | 1221 | function buildSidebar() { |
1241 | 1222 | global $parserMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry; |
1242 | | - global $wgLang; |
1243 | 1223 | wfProfileIn( __METHOD__ ); |
1244 | 1224 | |
1245 | | - $key = wfMemcKey( 'sidebar', $wgLang->getCode() ); |
| 1225 | + $key = wfMemcKey( 'sidebar', $this->getContext()->getLang()->getCode() ); |
1246 | 1226 | |
1247 | 1227 | if ( $wgEnableSidebarCache ) { |
1248 | 1228 | $cachedsidebar = $parserMemc->get( $key ); |
— | — | @@ -1301,7 +1281,7 @@ |
1302 | 1282 | $line = trim( $line, '* ' ); |
1303 | 1283 | |
1304 | 1284 | if ( strpos( $line, '|' ) !== false ) { // sanity check |
1305 | | - $line = MessageCache::singleton()->transform( $line, false, null, $this->mTitle ); |
| 1285 | + $line = MessageCache::singleton()->transform( $line, false, null, $this->getTitle() ); |
1306 | 1286 | $line = array_map( 'trim', explode( '|', $line, 2 ) ); |
1307 | 1287 | $link = wfMsgForContent( $line[0] ); |
1308 | 1288 | |
— | — | @@ -1346,7 +1326,7 @@ |
1347 | 1327 | $options = new ParserOptions(); |
1348 | 1328 | $options->setEditSection( false ); |
1349 | 1329 | $options->setInterfaceMessage( true ); |
1350 | | - $wikiBar[$heading] = $wgParser->parse( wfMsgForContentNoTrans( $line ) , $this->mTitle, $options )->getText(); |
| 1330 | + $wikiBar[$heading] = $wgParser->parse( wfMsgForContentNoTrans( $line ) , $this->getTitle(), $options )->getText(); |
1351 | 1331 | } else { |
1352 | 1332 | continue; |
1353 | 1333 | } |
— | — | @@ -1375,18 +1355,11 @@ |
1376 | 1356 | /** |
1377 | 1357 | * Gets new talk page messages for the current user. |
1378 | 1358 | * @return MediaWiki message or if no new talk page messages, nothing |
1379 | | - * The format without an explicit $out argument is deprecated |
1380 | 1359 | */ |
1381 | | - function getNewtalks( OutputPage $out=null ) { |
1382 | | - global $wgUser; |
| 1360 | + function getNewtalks() { |
| 1361 | + $out = $this->getContext()->getOutput(); |
1383 | 1362 | |
1384 | | - if ( is_null( $out ) ) { |
1385 | | - // Backwards compatibility for when there was no $out arg |
1386 | | - global $wgOut; |
1387 | | - $out = $wgOut; |
1388 | | - } |
1389 | | - |
1390 | | - $newtalks = $wgUser->getNewMessageLinks(); |
| 1363 | + $newtalks = $this->getContext()->getUser()->getNewMessageLinks(); |
1391 | 1364 | $ntl = ''; |
1392 | 1365 | |
1393 | 1366 | if ( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) { |
— | — | @@ -1444,7 +1417,7 @@ |
1445 | 1418 | * @return String: HTML fragment |
1446 | 1419 | */ |
1447 | 1420 | private function getCachedNotice( $name ) { |
1448 | | - global $wgOut, $wgRenderHashAppend, $parserMemc; |
| 1421 | + global $wgRenderHashAppend, $parserMemc; |
1449 | 1422 | |
1450 | 1423 | wfProfileIn( __METHOD__ ); |
1451 | 1424 | |
— | — | @@ -1481,14 +1454,9 @@ |
1482 | 1455 | } |
1483 | 1456 | |
1484 | 1457 | if ( $needParse ) { |
1485 | | - if( is_object( $wgOut ) ) { |
1486 | | - $parsed = $wgOut->parse( $notice ); |
1487 | | - $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 ); |
1488 | | - $notice = $parsed; |
1489 | | - } else { |
1490 | | - wfDebug( 'Skin::getCachedNotice called for ' . $name . ' with no $wgOut available' . "\n" ); |
1491 | | - $notice = ''; |
1492 | | - } |
| 1458 | + $parsed = $this->getContext()->getOutput()->parse( $notice ); |
| 1459 | + $parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 ); |
| 1460 | + $notice = $parsed; |
1493 | 1461 | } |
1494 | 1462 | |
1495 | 1463 | $notice = '<div id="localNotice">' .$notice . '</div>'; |
— | — | @@ -1504,7 +1472,7 @@ |
1505 | 1473 | function getNamespaceNotice() { |
1506 | 1474 | wfProfileIn( __METHOD__ ); |
1507 | 1475 | |
1508 | | - $key = 'namespacenotice-' . $this->mTitle->getNsText(); |
| 1476 | + $key = 'namespacenotice-' . $this->getTitle()->getNsText(); |
1509 | 1477 | $namespaceNotice = $this->getCachedNotice( $key ); |
1510 | 1478 | if ( $namespaceNotice && substr( $namespaceNotice, 0, 7 ) != '<p><' ) { |
1511 | 1479 | $namespaceNotice = '<div id="namespacebanner">' . $namespaceNotice . '</div>'; |
— | — | @@ -1522,13 +1490,11 @@ |
1523 | 1491 | * @return String: HTML fragment |
1524 | 1492 | */ |
1525 | 1493 | function getSiteNotice() { |
1526 | | - global $wgUser; |
1527 | | - |
1528 | 1494 | wfProfileIn( __METHOD__ ); |
1529 | 1495 | $siteNotice = ''; |
1530 | 1496 | |
1531 | 1497 | if ( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice, $this ) ) ) { |
1532 | | - if ( is_object( $wgUser ) && $wgUser->isLoggedIn() ) { |
| 1498 | + if ( is_object( $this->getContext()->getUser() ) && $this->getContext()->getUser()->isLoggedIn() ) { |
1533 | 1499 | $siteNotice = $this->getCachedNotice( 'sitenotice' ); |
1534 | 1500 | } else { |
1535 | 1501 | $anonNotice = $this->getCachedNotice( 'anonnotice' ); |