r93554 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93553‎ | r93554 | r93555 >
Date:19:06, 30 July 2011
Author:ialex
Status:ok
Tags:
Comment:
* Call Linker methods statically
* Factorised calls to Skin::getTitle() in StandardTemplate::quickBar()
Modified paths:
  • /trunk/phase3/skins/Standard.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/Standard.php
@@ -23,7 +23,7 @@
2424 */
2525 function setupSkinUserCss( OutputPage $out ){
2626 parent::setupSkinUserCss( $out );
27 - $out->AddModuleStyles( 'skins.standard' );
 27+ $out->addModuleStyles( 'skins.standard' );
2828
2929 $qb = $this->qbSetting();
3030 $rules = array();
@@ -111,7 +111,8 @@
112112
113113 $action = $wgRequest->getText( 'action' );
114114 $wpPreview = $wgRequest->getBool( 'wpPreview' );
115 - $tns = $this->getSkin()->getTitle()->getNamespace();
 115+ $title = $this->getSkin()->getTitle();
 116+ $tns = $title->getNamespace();
116117
117118 $s = "\n<div id='quickbar'>";
118119 $s .= "\n" . $this->getSkin()->logoText() . "\n<hr class='sep' />";
@@ -151,7 +152,7 @@
152153 }
153154
154155 $s .= "\n<hr class='sep' />";
155 - $articleExists = $this->getSkin()->getTitle()->getArticleId();
 156+ $articleExists = $title->getArticleId();
156157 if ( $wgOut->isArticle() || $action == 'edit' || $action == 'history' || $wpPreview ) {
157158 if( $wgOut->isArticle() ) {
158159 $s .= '<strong>' . $this->editThisPage() . '</strong>';
@@ -196,14 +197,14 @@
197198 $text = wfMsg( 'articlepage' );
198199 }
199200
200 - $link = $this->getSkin()->getTitle()->getText();
 201+ $link = $title->getText();
201202 $nstext = $wgContLang->getNsText( $tns );
202203 if( $nstext ) { # add namespace if necessary
203204 $link = $nstext . ':' . $link;
204205 }
205206
206207 $s .= Linker::link( Title::newFromText( $link ), $text );
207 - } elseif( $this->getSkin()->getTitle()->getNamespace() != NS_SPECIAL ) {
 208+ } elseif( $title->getNamespace() != NS_SPECIAL ) {
208209 # we just throw in a "New page" text to tell the user that he's in edit mode,
209210 # and to avoid messing with the separator that is prepended to the next item
210211 $s .= '<strong>' . wfMsg( 'newpage' ) . '</strong>';
@@ -211,16 +212,15 @@
212213 }
213214
214215 # "Post a comment" link
215 - if( ( $this->getSkin()->getTitle()->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
216 - $s .= '<br />' . $this->getSkin()->link(
217 - $this->getSkin()->getTitle(),
 216+ if( ( $title->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
 217+ $s .= '<br />' . Linker::link(
 218+ $title,
218219 wfMsg( 'postcomment' ),
219220 array(),
220221 array(
221222 'action' => 'edit',
222223 'section' => 'new'
223 - ),
224 - array( 'known', 'noclasses' )
 224+ )
225225 );
226226
227227 /*
@@ -233,7 +233,7 @@
234234 if( $action != 'edit' && $action != 'submit' ) {
235235 $s .= $sep . $this->watchThisPage();
236236 }
237 - if ( $this->getSkin()->getTitle()->userCan( 'edit' ) )
 237+ if ( $title->userCan( 'edit' ) )
238238 $s .= $sep . $this->moveThisPage();
239239 }
240240 if ( $wgUser->isAllowed( 'delete' ) && $articleExists ) {
@@ -251,12 +251,12 @@
252252 }
253253
254254 if (
255 - NS_USER == $this->getSkin()->getTitle()->getNamespace() ||
256 - $this->getSkin()->getTitle()->getNamespace() == NS_USER_TALK
 255+ NS_USER == $title->getNamespace() ||
 256+ $title->getNamespace() == NS_USER_TALK
257257 ) {
258258
259 - $id = User::idFromName( $this->getSkin()->getTitle()->getText() );
260 - $ip = User::isIP( $this->getSkin()->getTitle()->getText() );
 259+ $id = User::idFromName( $title->getText() );
 260+ $ip = User::isIP( $title->getText() );
261261
262262 if( $id || $ip ){
263263 $s .= $sep . $this->userContribsLink();

Status & tagging log