r81254 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81253‎ | r81254 | r81255 >
Date:15:47, 31 January 2011
Author:demon
Status:resolved
Tags:
Comment:
Remove a bunch of useless $wgOuts. Just pass them like we should. Also make them protected so people don't call them
Modified paths:
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -496,14 +496,14 @@
497497
498498 wfProfileIn( __METHOD__ . '-stuff5' );
499499 # Personal toolbar
500 - $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
501 - $content_navigation = $this->buildContentNavigationUrls();
 500+ $tpl->set( 'personal_urls', $this->buildPersonalUrls( $out ) );
 501+ $content_navigation = $this->buildContentNavigationUrls( $out );
502502 $content_actions = $this->buildContentActionUrls( $content_navigation );
503503 $tpl->setRef( 'content_navigation', $content_navigation );
504504 $tpl->setRef( 'content_actions', $content_actions );
505505
506506 $tpl->set( 'sidebar', $this->buildSidebar() );
507 - $tpl->set( 'nav_urls', $this->buildNavUrls() );
 507+ $tpl->set( 'nav_urls', $this->buildNavUrls( $out ) );
508508
509509 // Set the head scripts near the end, in case the above actions resulted in added scripts
510510 if ( $this->useHeadElement ) {
@@ -560,12 +560,11 @@
561561 /**
562562 * build array of urls for personal toolbar
563563 * @return array
564 - * @private
565564 */
566 - function buildPersonalUrls() {
567 - global $wgOut, $wgRequest;
 565+ protected function buildPersonalUrls( OutputPage $out ) {
 566+ global $wgRequest;
568567
569 - $title = $wgOut->getTitle();
 568+ $title = $out->getTitle();
570569 $pageurl = $title->getLocalURL();
571570 wfProfileIn( __METHOD__ );
572571
@@ -791,10 +790,9 @@
792791 * believes that the accesskey should not be added to the tab.
793792 *
794793 * @return array
795 - * @private
796794 */
797 - function buildContentNavigationUrls() {
798 - global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest;
 795+ protected function buildContentNavigationUrls( OutputPage $out ) {
 796+ global $wgContLang, $wgLang, $wgUser, $wgRequest;
799797 global $wgDisableLangConversion;
800798
801799 wfProfileIn( __METHOD__ );
@@ -893,9 +891,9 @@
894892 );
895893 // Checks if this is a current rev of talk page and we should show a new
896894 // section link
897 - if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
 895+ if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $out->showNewSectionLink() ) ) {
898896 // Checks if we should ever show a new section link
899 - if ( !$wgOut->forceHideNewSectionLink() ) {
 897+ if ( !$out->forceHideNewSectionLink() ) {
900898 // Adds new section link
901899 //$content_navigation['actions']['addsection']
902900 $content_navigation['views']['addsection'] = array(
@@ -1133,8 +1131,8 @@
11341132 * @return array
11351133 * @private
11361134 */
1137 - function buildNavUrls() {
1138 - global $wgUseTrackbacks, $wgOut, $wgUser, $wgRequest;
 1135+ protected function buildNavUrls( OutputPage $out ) {
 1136+ global $wgUseTrackbacks, $wgUser, $wgRequest;
11391137 global $wgUploadNavigationUrl;
11401138
11411139 wfProfileIn( __METHOD__ );
@@ -1158,7 +1156,7 @@
11591157 // A print stylesheet is attached to all pages, but nobody ever
11601158 // figures that out. :) Add a link...
11611159 if( $this->iscontent && ( $action == 'view' || $action == 'purge' ) ) {
1162 - if ( !$wgOut->isPrintable() ) {
 1160+ if ( !$out->isPrintable() ) {
11631161 $nav_urls['print'] = array(
11641162 'text' => wfMsg( 'printableversion' ),
11651163 'href' => $wgRequest->appendQuery( 'printable=yes' )
@@ -1169,13 +1167,13 @@
11701168 if ( $this->mRevisionId ) {
11711169 $nav_urls['permalink'] = array(
11721170 'text' => wfMsg( 'permalink' ),
1173 - 'href' => $wgOut->getTitle()->getLocalURL( "oldid=$this->mRevisionId" )
 1171+ 'href' => $out->getTitle()->getLocalURL( "oldid=$this->mRevisionId" )
11741172 );
11751173 }
11761174
11771175 // Copy in case this undocumented, shady hook tries to mess with internals
11781176 $revid = $this->mRevisionId;
1179 - wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$revid, &$revid ) );
 1177+ wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( $this, &$nav_urls, &$revid, &$revid ) );
11801178 }
11811179
11821180 if( $this->mTitle->getNamespace() != NS_SPECIAL ) {
@@ -1193,7 +1191,7 @@
11941192 }
11951193 if( $wgUseTrackbacks )
11961194 $nav_urls['trackbacklink'] = array(
1197 - 'href' => $wgOut->getTitle()->trackbackURL()
 1195+ 'href' => $out->getTitle()->trackbackURL()
11981196 );
11991197 }
12001198

Follow-up revisions

RevisionCommit summaryAuthorDate
r81255Stupid references, stupid PHP. I blame Nikerabbit (fixing r81254)demon16:23, 31 January 2011

Status & tagging log