r97915 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97914‎ | r97915 | r97916 >
Date:12:55, 23 September 2011
Author:ialex
Status:ok
Tags:
Comment:
Factorise calls to $this->getSkin()->getUser() in SkinCologneBlue::quickBar(); also moved the call $this->getSkin()->getTitle() near the only place where it's used
Modified paths:
  • /trunk/phase3/skins/CologneBlue.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/CologneBlue.php
@@ -199,8 +199,6 @@
200200 * @return string
201201 */
202202 function quickBar(){
203 - $tns = $this->getSkin()->getTitle()->getNamespace();
204 -
205203 $s = "\n<div id='quickbar'>";
206204
207205 $sep = '<br />';
@@ -237,6 +235,8 @@
238236 $barnumber++;
239237 }
240238
 239+ $user = $this->getSkin()->getUser();
 240+
241241 if ( $this->data['isarticle'] ) {
242242 $s .= $this->menuHead( 'qbedit' );
243243 $s .= '<strong>' . $this->editThisPage() . '</strong>';
@@ -249,13 +249,13 @@
250250 if( $this->data['loggedin'] ) {
251251 $s .= $sep . $this->moveThisPage();
252252 }
253 - if ( $this->getSkin()->getUser()->isAllowed( 'delete' ) ) {
 253+ if ( $user->isAllowed( 'delete' ) ) {
254254 $dtp = $this->deleteThisPage();
255255 if ( $dtp != '' ) {
256256 $s .= $sep . $dtp;
257257 }
258258 }
259 - if ( $this->getSkin()->getUser()->isAllowed( 'protect' ) ) {
 259+ if ( $user->isAllowed( 'protect' ) ) {
260260 $ptp = $this->protectThisPage();
261261 if ( $ptp != '' ) {
262262 $s .= $sep . $ptp;
@@ -278,8 +278,10 @@
279279 . $sep . $this->whatLinksHere()
280280 . $sep . $this->watchPageLinksLink();
281281
282 - if( $tns == NS_USER || $tns == NS_USER_TALK ) {
283 - $id = User::idFromName( $this->getSkin()->getTitle()->getText() );
 282+ $title = $this->getSkin()->getTitle();
 283+ $tns = $title->getNamespace();
 284+ if ( $tns == NS_USER || $tns == NS_USER_TALK ) {
 285+ $id = User::idFromName( $title->getText() );
284286 if( $id != 0 ) {
285287 $s .= $sep . $this->userContribsLink();
286288 if( $this->getSkin()->showEmailUser( $id ) ) {
@@ -293,18 +295,18 @@
294296 $s .= $this->menuHead( 'qbmyoptions' );
295297 if ( $this->data['loggedin'] ) {
296298 $tl = Linker::link(
297 - $this->getSkin()->getUser()->getTalkPage(),
 299+ $user->getTalkPage(),
298300 wfMsg( 'mytalk' ),
299301 array(),
300302 array(),
301303 array( 'known', 'noclasses' )
302304 );
303 - if ( $this->getSkin()->getUser()->getNewtalk() ) {
 305+ if ( $user->getNewtalk() ) {
304306 $tl .= ' *';
305307 }
306308
307309 $s .= Linker::link(
308 - $this->getSkin()->getUser()->getUserPage(),
 310+ $user->getUserPage(),
309311 wfMsg( 'mypage' ),
310312 array(),
311313 array(),
@@ -312,7 +314,7 @@
313315 ) . $sep . $tl . $sep . Linker::specialLink( 'Watchlist' )
314316 . $sep .
315317 Linker::link(
316 - SpecialPage::getSafeTitleFor( 'Contributions', $this->getSkin()->getUser()->getName() ),
 318+ SpecialPage::getSafeTitleFor( 'Contributions', $user->getName() ),
317319 wfMsg( 'mycontris' ),
318320 array(),
319321 array(),
@@ -327,7 +329,7 @@
328330 . Linker::specialLink( 'Newpages' )
329331 . $sep . Linker::specialLink( 'Listfiles' )
330332 . $sep . Linker::specialLink( 'Statistics' );
331 - if( UploadBase::isEnabled() && UploadBase::isAllowed( $this->getSkin()->getUser() ) === true ) {
 333+ if( UploadBase::isEnabled() && UploadBase::isAllowed( $user ) === true ) {
332334 $s .= $sep . $this->getUploadLink();
333335 }
334336

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96669Kill off $wg{Request,User,Lang,Output} usage within skins/ and redundant $thi...dantman15:41, 9 September 2011

Status & tagging log