http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97915

Revision: 97915
Author:   ialex
Date:     2011-09-23 12:55:01 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
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: trunk/phase3/skins/CologneBlue.php
===================================================================
--- trunk/phase3/skins/CologneBlue.php  2011-09-23 12:50:19 UTC (rev 97914)
+++ trunk/phase3/skins/CologneBlue.php  2011-09-23 12:55:01 UTC (rev 97915)
@@ -199,8 +199,6 @@
         * @return string
         */
        function quickBar(){
-               $tns = $this->getSkin()->getTitle()->getNamespace();
-
                $s = "\n<div id='quickbar'>";
 
                $sep = '<br />';
@@ -237,6 +235,8 @@
                        $barnumber++;
                }
 
+               $user = $this->getSkin()->getUser();
+
                if ( $this->data['isarticle'] ) {
                        $s .= $this->menuHead( 'qbedit' );
                        $s .= '<strong>' . $this->editThisPage() . '</strong>';
@@ -249,13 +249,13 @@
                        if( $this->data['loggedin'] ) {
                                $s .= $sep . $this->moveThisPage();
                        }
-                       if ( $this->getSkin()->getUser()->isAllowed( 'delete' ) 
) {
+                       if ( $user->isAllowed( 'delete' ) ) {
                                $dtp = $this->deleteThisPage();
                                if ( $dtp != '' ) {
                                        $s .= $sep . $dtp;
                                }
                        }
-                       if ( $this->getSkin()->getUser()->isAllowed( 'protect' 
) ) {
+                       if ( $user->isAllowed( 'protect' ) ) {
                                $ptp = $this->protectThisPage();
                                if ( $ptp != '' ) {
                                        $s .= $sep . $ptp;
@@ -278,8 +278,10 @@
                                        . $sep . $this->whatLinksHere()
                                        . $sep . $this->watchPageLinksLink();
 
-                       if( $tns == NS_USER || $tns == NS_USER_TALK ) {
-                               $id = User::idFromName( 
$this->getSkin()->getTitle()->getText() );
+                       $title = $this->getSkin()->getTitle();
+                       $tns = $title->getNamespace();
+                       if ( $tns == NS_USER || $tns == NS_USER_TALK ) {
+                               $id = User::idFromName( $title->getText() );
                                if( $id != 0 ) {
                                        $s .= $sep . $this->userContribsLink();
                                        if( $this->getSkin()->showEmailUser( 
$id ) ) {
@@ -293,18 +295,18 @@
                $s .= $this->menuHead( 'qbmyoptions' );
                if ( $this->data['loggedin'] ) {
                        $tl = Linker::link(
-                               $this->getSkin()->getUser()->getTalkPage(),
+                               $user->getTalkPage(),
                                wfMsg( 'mytalk' ),
                                array(),
                                array(),
                                array( 'known', 'noclasses' )
                        );
-                       if ( $this->getSkin()->getUser()->getNewtalk() ) {
+                       if ( $user->getNewtalk() ) {
                                $tl .= ' *';
                        }
 
                        $s .= Linker::link(
-                                       
$this->getSkin()->getUser()->getUserPage(),
+                                       $user->getUserPage(),
                                        wfMsg( 'mypage' ),
                                        array(),
                                        array(),
@@ -312,7 +314,7 @@
                                ) . $sep . $tl . $sep . Linker::specialLink( 
'Watchlist' )
                                        . $sep .
                                Linker::link(
-                                       SpecialPage::getSafeTitleFor( 
'Contributions', $this->getSkin()->getUser()->getName() ),
+                                       SpecialPage::getSafeTitleFor( 
'Contributions', $user->getName() ),
                                        wfMsg( 'mycontris' ),
                                        array(),
                                        array(),
@@ -327,7 +329,7 @@
                        . Linker::specialLink( 'Newpages' )
                        . $sep . Linker::specialLink( 'Listfiles' )
                        . $sep . Linker::specialLink( 'Statistics' );
-               if( UploadBase::isEnabled() && UploadBase::isAllowed( 
$this->getSkin()->getUser() ) === true ) {
+               if( UploadBase::isEnabled() && UploadBase::isAllowed( $user ) 
=== true ) {
                        $s .= $sep . $this->getUploadLink();
                }
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to