Paladox has submitted this change and it was merged.
Change subject: Minor optimization
......................................................................
Minor optimization
Instead of calling $this->getSkin() a dozen times all over the place, call
it once and store the result in a variable, and then call the variable
instead.
Change-Id: I84b2ea0324ab778a71b64ffeebfc2c722fb7ad19
---
M MetrolookTemplate.php
1 file changed, 14 insertions(+), 13 deletions(-)
Approvals:
Paladox: Looks good to me, approved
diff --git a/MetrolookTemplate.php b/MetrolookTemplate.php
index 7ed938c..e864641 100644
--- a/MetrolookTemplate.php
+++ b/MetrolookTemplate.php
@@ -83,11 +83,12 @@
* Outputs the entire contents of the (X)HTML page
*/
public function execute() {
+ $skin = $this->getSkin();
// Build additional attributes for navigation urls
$nav = $this->data['content_navigation'];
if ( $this->config->get( 'VectorUseIconWatch' ) ) {
- $mode = $this->getSkin()->getUser()->isWatched(
$this->getSkin()->getRelevantTitle() )
+ $mode = $skin->getUser()->isWatched(
$skin->getRelevantTitle() )
? 'unwatch'
: 'watch';
@@ -147,13 +148,13 @@
}
$this->data['pageLanguage'] =
-
$this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
+ $skin->getTitle()->getPageViewLanguage()->getHtmlCode();
// User name (or "Guest") to be displayed at the top right (on
LTR
// interfaces) portion of the skin
- $user = $this->getSkin()->getUser();
+ $user = $skin->getUser();
if ( !$user->isLoggedIn() ) {
- $userNameTop = $this->getSkin()->msg( 'metrolook-guest'
)->text();
+ $userNameTop = $skin->msg( 'metrolook-guest' )->text();
} else {
$userNameTop = htmlspecialchars( $user->getName(),
ENT_QUOTES );
}
@@ -270,7 +271,7 @@
<li id="footer-<?php echo
htmlspecialchars( $blockName ); ?>ico">
<?php
foreach ( $footerIcons
as $icon ) {
- echo
$this->getSkin()->makeFooterIcon( $icon );
+ echo
$skin->makeFooterIcon( $icon );
}
?>
</li>
@@ -307,7 +308,7 @@
class="userIcon20"
alt=""
src="<?php
- echo
htmlspecialchars( $this->getSkin()->getSkinStylePath( 'images/Transparent.gif'
) )
+ echo
htmlspecialchars( $skin->getSkinStylePath( 'images/Transparent.gif' ) )
?>"
/>
</span>
@@ -317,7 +318,7 @@
class="userIcon40"
alt=""
src="<?php
- echo
htmlspecialchars( $this->getSkin()->getSkinStylePath( 'images/Transparent.gif'
) )
+ echo
htmlspecialchars( $skin->getSkinStylePath( 'images/Transparent.gif' ) )
?>"
/>
</span>
@@ -339,7 +340,7 @@
class="hamburger"
alt=""
src="<?php echo htmlspecialchars(
- $this->getSkin()->getSkinStylePath(
'images/Transparent.gif' ) ) ?>" />
+ $skin->getSkinStylePath(
'images/Transparent.gif' ) ) ?>" />
</div>
<?php
@@ -381,7 +382,7 @@
class="line"
alt=""
src="<?php echo htmlspecialchars(
- $this->getSkin()->getSkinStylePath(
'images/Transparent.gif' ) ) ?>"
+ $skin->getSkinStylePath(
'images/Transparent.gif' ) ) ?>"
/>
<?php
if ( $this->config->get( 'MetrolookSiteName' )
) {
@@ -407,7 +408,7 @@
class="downarrow"
alt=""
src="<?php echo htmlspecialchars(
- $this->getSkin()->getSkinStylePath(
'images/Transparent.gif' ) ) ?>"
+ $skin->getSkinStylePath(
'images/Transparent.gif' ) ) ?>"
/>
<?php
if ( $this->config->get( 'MetrolookSiteName' )
) {
@@ -464,7 +465,7 @@
class="uploadbutton"
alt=""
src="<?php echo
htmlspecialchars(
-
$this->getSkin()->getSkinStylePath( 'images/Transparent.gif' ) ) ?>" />
+
$skin->getSkinStylePath( 'images/Transparent.gif' ) ) ?>" />
<span
class="uploadbutton">
<?php
$this->msg( 'uploadbtn' ) ?>
</span>
@@ -483,7 +484,7 @@
class="searchbar"
alt=""
src="<?php echo htmlspecialchars(
-
$this->getSkin()->getSkinStylePath( 'images/Transparent.gif' ) ) ?>" />
+ $skin->getSkinStylePath(
'images/Transparent.gif' ) ) ?>" />
<?php
}
?>
@@ -491,7 +492,7 @@
class="editbutton"
alt=""
src="<?php echo htmlspecialchars(
- $this->getSkin()->getSkinStylePath(
'images/Transparent.gif' ) ) ?>" />
+ $skin->getSkinStylePath(
'images/Transparent.gif' ) ) ?>" />
<div id="right-navigation">
--
To view, visit https://gerrit.wikimedia.org/r/224731
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I84b2ea0324ab778a71b64ffeebfc2c722fb7ad19
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Metrolook
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits