r81964 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81963‎ | r81964 | r81965 >
Date:14:39, 11 February 2011
Author:ialex
Status:deferred
Tags:
Comment:
Use OutputPage::getSkin() instead of $wgTitle
Modified paths:
  • /trunk/extensions/CategoryStepper/CategoryStepper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryStepper/CategoryStepper.php
@@ -56,14 +56,12 @@
5757 */
5858 function efCategoryStepper( $out, $text ) {
5959 // Get various variables needed for this extension.
60 - global $wgCategoryStepper, $wgTitle, $wgArticlePath, $wgRequest, $IP,
61 - $wgUser, $wgOut;
 60+ global $wgCategoryStepper, $wgArticlePath, $wgRequest, $IP, $wgUser;
6261
6362 // Only render on the actual view page; not edit, delete etc.
6463 if ( $wgRequest->getBool( 'action' ) ) return true;
6564
66 - // Load messages into the message cache.
67 - wfLoadExtensionMessages( 'CategoryStepper' );
 65+ $titleObj = $out->getTitle();
6866
6967 // Open a database connection.
7068 $dbr = wfGetDB( DB_SLAVE );
@@ -84,7 +82,7 @@
8583 // Loop through all the categories.
8684 foreach ( $wgCategoryStepper as $name => $title ) {
8785 // Check if the current page is in this category and if so render the box.
88 - if ( $dbr->fetchRow( $dbr->select( "categorylinks", "*", array( "cl_from" => $wgTitle->getArticleID(), "cl_to" => $name ) ) ) ) {
 86+ if ( $dbr->fetchRow( $dbr->select( "categorylinks", "*", array( "cl_from" => $titleObj->getArticleID(), "cl_to" => $name ) ) ) ) {
8987 $prev = false;
9088 $nextI = false;
9189
@@ -94,7 +92,7 @@
9593 if ( isset( $donext ) ) {
9694 $nextI = $row[ 'cl_from' ];
9795 break;
98 - } elseif ( $row[ 'cl_from' ] == $wgTitle->getArticleID() ) {
 96+ } elseif ( $row[ 'cl_from' ] == $titleObj->getArticleID() ) {
9997 $prevI = $prev;
10098 $donext = true;
10199 }
@@ -128,7 +126,7 @@
129127 Xml::closeElement( "tr" ) .
130128 Xml::openElement( "tr" ) .
131129 Xml::tags( "td", array(), $previous ) .
132 - Xml::tags( "td", array(), $wgTitle->getText() ) .
 130+ Xml::tags( "td", array(), $titleObj->getText() ) .
133131 Xml::tags( "td", array(), $next ) .
134132 Xml::closeElement( "tr" ) .
135133 Xml::closeElement( "table" );
@@ -138,7 +136,7 @@
139137 }
140138
141139 // Add style file to the output headers if it exists.
142 - if ( file_exists( "$IP/skins/CategoryStepper.css" ) ) $wgOut->addStyle( 'CategoryStepper.css' );
 140+ if ( file_exists( "$IP/skins/CategoryStepper.css" ) ) $out->addStyle( 'CategoryStepper.css' );
143141
144142 // Return true so things don't break.
145143 return true;

Status & tagging log