http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96669
Revision: 96669
Author: dantman
Date: 2011-09-09 15:41:30 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
Kill off $wg{Request,User,Lang,Output} usage within skins/ and redundant
$this->skin local vars.
Modified Paths:
--------------
trunk/phase3/skins/CologneBlue.php
trunk/phase3/skins/Modern.php
trunk/phase3/skins/Nostalgia.php
trunk/phase3/skins/Simple.php
trunk/phase3/skins/Standard.php
trunk/phase3/skins/Vector.php
Modified: trunk/phase3/skins/CologneBlue.php
===================================================================
--- trunk/phase3/skins/CologneBlue.php 2011-09-09 15:40:19 UTC (rev 96668)
+++ trunk/phase3/skins/CologneBlue.php 2011-09-09 15:41:30 UTC (rev 96669)
@@ -101,8 +101,6 @@
* @return string
*/
function doAfterContent(){
- global $wgLang;
-
$s = "\n</div><br clear='all' />\n";
$s .= "\n<div id='footer'>";
@@ -115,7 +113,7 @@
$s .= '<td class="bottom">';
$s .= $this->bottomLinks();
- $s .= $wgLang->pipeList( array(
+ $s .= $this->getSkin()->getLang()->pipeList( array(
"\n<br />" . Linker::link(
Title::newMainPage(),
null,
@@ -145,7 +143,6 @@
* @return string
*/
function sysLinks() {
- global $wgUser, $wgLang;
$li = SpecialPage::getTitleFor( 'Userlogin' );
$lo = SpecialPage::getTitleFor( 'Userlogout' );
@@ -180,7 +177,7 @@
if( $this->extensionTabLinks() ) {
$s[] = $this->extensionTabLinks();
}
- if ( $wgUser->isLoggedIn() ) {
+ if ( $this->data['loggedin'] ) {
$s[] = Linker::linkKnown(
$lo,
wfMsg( 'logout' ),
@@ -196,7 +193,7 @@
);
}
- return $wgLang->pipeList( $s );
+ return $this->getSkin()->getLang()->pipeList( $s );
}
/**
@@ -206,8 +203,6 @@
* @return string
*/
function quickBar(){
- global $wgOut, $wgUser;
-
$tns = $this->getSkin()->getTitle()->getNamespace();
$s = "\n<div id='quickbar'>";
@@ -246,7 +241,7 @@
$barnumber++;
}
- if ( $wgOut->isArticle() ) {
+ if ( $this->data['isarticle'] ) {
$s .= $this->menuHead( 'qbedit' );
$s .= '<strong>' . $this->editThisPage() . '</strong>';
@@ -255,16 +250,16 @@
wfMsg( 'edithelp' )
);
- if( $wgUser->isLoggedIn() ) {
+ if( $this->data['loggedin'] ) {
$s .= $sep . $this->moveThisPage();
}
- if ( $wgUser->isAllowed( 'delete' ) ) {
+ if ( $this->getSkin()->getUser()->isAllowed( 'delete' )
) {
$dtp = $this->deleteThisPage();
if ( $dtp != '' ) {
$s .= $sep . $dtp;
}
}
- if ( $wgUser->isAllowed( 'protect' ) ) {
+ if ( $this->getSkin()->getUser()->isAllowed( 'protect'
) ) {
$ptp = $this->protectThisPage();
if ( $ptp != '' ) {
$s .= $sep . $ptp;
@@ -276,7 +271,7 @@
$s .= $this->talkLink()
. $sep . $this->commentLink()
. $sep . $this->printableLink();
- if ( $wgUser->isLoggedIn() ) {
+ if ( $this->data['loggedin'] ) {
$s .= $sep . $this->watchThisPage();
}
@@ -300,20 +295,20 @@
}
$s .= $this->menuHead( 'qbmyoptions' );
- if ( $wgUser->isLoggedIn() ) {
+ if ( $this->data['loggedin'] ) {
$tl = Linker::link(
- $wgUser->getTalkPage(),
+ $this->getSkin()->getUser()->getTalkPage(),
wfMsg( 'mytalk' ),
array(),
array(),
array( 'known', 'noclasses' )
);
- if ( $wgUser->getNewtalk() ) {
+ if ( $this->getSkin()->getUser()->getNewtalk() ) {
$tl .= ' *';
}
$s .= Linker::link(
- $wgUser->getUserPage(),
+
$this->getSkin()->getUser()->getUserPage(),
wfMsg( 'mypage' ),
array(),
array(),
@@ -321,7 +316,7 @@
) . $sep . $tl . $sep . Linker::specialLink(
'Watchlist' )
. $sep .
Linker::link(
- SpecialPage::getSafeTitleFor(
'Contributions', $wgUser->getName() ),
+ SpecialPage::getSafeTitleFor(
'Contributions', $this->getSkin()->getUser()->getName() ),
wfMsg( 'mycontris' ),
array(),
array(),
@@ -336,7 +331,7 @@
. Linker::specialLink( 'Newpages' )
. $sep . Linker::specialLink( 'Listfiles' )
. $sep . Linker::specialLink( 'Statistics' );
- if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser )
=== true ) {
+ if( UploadBase::isEnabled() && UploadBase::isAllowed(
$this->getSkin()->getUser() ) === true ) {
$s .= $sep . $this->getUploadLink();
}
@@ -373,9 +368,9 @@
* @return string
*/
function searchForm( $label = '' ) {
- global $wgRequest, $wgUseTwoButtonsSearchForm;
+ global $wgUseTwoButtonsSearchForm;
- $search = $wgRequest->getText( 'search' );
+ $search = $this->getSkin()->getRequest()->getText( 'search' );
$action = $this->data['searchaction'];
$s = "<form id=\"searchform{$this->searchboxes}\"
method=\"get\" class=\"inline\" action=\"$action\">";
if( $label != '' ) {
Modified: trunk/phase3/skins/Modern.php
===================================================================
--- trunk/phase3/skins/Modern.php 2011-09-09 15:40:19 UTC (rev 96668)
+++ trunk/phase3/skins/Modern.php 2011-09-09 15:41:30 UTC (rev 96669)
@@ -37,10 +37,6 @@
class ModernTemplate extends MonoBookTemplate {
/**
- * @var Skin
- */
- var $skin;
- /**
* Template filter callback for Modern skin.
* Takes an associative array of data set from a SkinTemplate-based
* class, and a wrapper for MediaWiki's localization database, and
@@ -49,8 +45,6 @@
* @access private
*/
function execute() {
- $this->skin = $skin = $this->data['skin'];
-
// Suppress warnings to prevent notices about missing indexes
in $this->data
wfSuppressWarnings();
@@ -137,7 +131,7 @@
<div id="mw_<?php echo htmlspecialchars($blockName);
?>">
<?php
foreach ( $footerIcons as $icon ) { ?>
- <?php echo $this->skin->makeFooterIcon( $icon,
'withoutImage' ); ?>
+ <?php echo $this->getSkin()->makeFooterIcon(
$icon, 'withoutImage' ); ?>
<?php
} ?>
Modified: trunk/phase3/skins/Nostalgia.php
===================================================================
--- trunk/phase3/skins/Nostalgia.php 2011-09-09 15:40:19 UTC (rev 96668)
+++ trunk/phase3/skins/Nostalgia.php 2011-09-09 15:41:30 UTC (rev 96669)
@@ -69,13 +69,12 @@
* @return string
*/
function topLinks() {
- global $wgOut, $wgUser;
$sep = " |\n";
$s = $this->getSkin()->mainPageLink() . $sep
. Linker::specialLink( 'Recentchanges' );
- if ( $wgOut->isArticle() ) {
+ if ( $this->data['isarticle'] ) {
$s .= $sep . '<strong>' . $this->editThisPage() .
'</strong>' . $sep . $this->talkLink() .
$sep . $this->historyLink();
}
@@ -83,25 +82,25 @@
/* show links to different language variants */
$s .= $this->variantLinks();
$s .= $this->extensionTabLinks();
- if ( $wgUser->isAnon() ) {
+ if ( !$this->data['loggedin'] ) {
$s .= $sep . Linker::specialLink( 'Userlogin' );
} else {
/* show user page and user talk links */
- $s .= $sep . Linker::link( $wgUser->getUserPage(),
wfMsgHtml( 'mypage' ) );
- $s .= $sep . Linker::link( $wgUser->getTalkPage(),
wfMsgHtml( 'mytalk' ) );
- if ( $wgUser->getNewtalk() ) {
+ $s .= $sep . Linker::link(
$this->getSkin()->getUser()->getUserPage(), wfMsgHtml( 'mypage' ) );
+ $s .= $sep . Linker::link(
$this->getSkin()->getUser()->getTalkPage(), wfMsgHtml( 'mytalk' ) );
+ if ( $this->getSkin()->getUser()->getNewtalk() ) {
$s .= ' *';
}
/* show watchlist link */
$s .= $sep . Linker::specialLink( 'Watchlist' );
/* show my contributions link */
$s .= $sep . Linker::link(
- SpecialPage::getSafeTitleFor( 'Contributions',
$wgUser->getName() ),
+ SpecialPage::getSafeTitleFor( 'Contributions',
$this->data['username'] ),
wfMsgHtml( 'mycontris' ) );
/* show my preferences link */
$s .= $sep . Linker::specialLink( 'Preferences' );
/* show upload file link */
- if( UploadBase::isEnabled() && UploadBase::isAllowed(
$wgUser ) === true ) {
+ if( UploadBase::isEnabled() && UploadBase::isAllowed(
$this->getSkin()->getUser() ) === true ) {
$s .= $sep . $this->getUploadLink();
}
Modified: trunk/phase3/skins/Simple.php
===================================================================
--- trunk/phase3/skins/Simple.php 2011-09-09 15:40:19 UTC (rev 96668)
+++ trunk/phase3/skins/Simple.php 2011-09-09 15:41:30 UTC (rev 96669)
@@ -30,16 +30,15 @@
$out->addModuleStyles( 'skins.simple' );
/* Add some userprefs specific CSS styling */
- global $wgUser;
$rules = array();
$underline = "";
- if ( $wgUser->getOption( 'underline' ) < 2 ) {
- $underline = "text-decoration: " . $wgUser->getOption(
'underline' ) ? 'underline !important' : 'none' . ";";
+ if ( $this->getSkin()->getUser()->getOption( 'underline' ) < 2
) {
+ $underline = "text-decoration: " .
$this->getSkin()->getUser()->getOption( 'underline' ) ? 'underline !important'
: 'none' . ";";
}
/* Also inherits from resourceloader */
- if( !$wgUser->getOption( 'highlightbroken' ) ) {
+ if( !$this->getSkin()->getUser()->getOption( 'highlightbroken'
) ) {
$rules[] = "a.new, a.stub { color: inherit;
text-decoration: inherit;}";
$rules[] = "a.new:after { color: #CC2200; $underline;}";
$rules[] = "a.stub:after { $underline; }";
Modified: trunk/phase3/skins/Standard.php
===================================================================
--- trunk/phase3/skins/Standard.php 2011-09-09 15:40:19 UTC (rev 96668)
+++ trunk/phase3/skins/Standard.php 2011-09-09 15:41:30 UTC (rev 96669)
@@ -54,7 +54,7 @@
* @return string
*/
function doAfterContent() {
- global $wgContLang, $wgLang;
+ global $wgContLang;
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ . '-1' );
@@ -78,7 +78,7 @@
$s .= "<td class='bottom' align='$l' valign='top'>";
$s .= $this->bottomLinks();
- $s .= "\n<br />" . $wgLang->pipeList( array(
+ $s .= "\n<br />" . $this->getSkin()->getLang()->pipeList( array(
$this->getSkin()->mainPageLink(),
$this->getSkin()->aboutLink(),
Linker::specialLink( 'Recentchanges' ),
@@ -105,12 +105,12 @@
* @return string
*/
function quickBar() {
- global $wgOut, $wgUser, $wgRequest, $wgContLang;
+ global $wgContLang;
wfProfileIn( __METHOD__ );
- $action = $wgRequest->getText( 'action' );
- $wpPreview = $wgRequest->getBool( 'wpPreview' );
+ $action = $this->getSkin()->getRequest()->getText( 'action' );
+ $wpPreview = $this->getSkin()->getRequest()->getBool(
'wpPreview' );
$title = $this->getSkin()->getTitle();
$tns = $title->getNamespace();
@@ -138,13 +138,13 @@
}
if ( $barnumber == 1 ) {
// only show watchlist link if logged in
- if( $wgUser->isLoggedIn() ) {
+ if( $this->data['loggedin'] ) {
$s.= Linker::specialLink( 'Watchlist' )
;
$s .= $sep . Linker::linkKnown(
SpecialPage::getTitleFor(
'Contributions' ),
wfMsg( 'mycontris' ),
array(),
- array( 'target' =>
$wgUser->getName() )
+ array( 'target' =>
$this->data['username'] )
);
}
}
@@ -153,8 +153,8 @@
$s .= "\n<hr class='sep' />";
$articleExists = $title->getArticleId();
- if ( $wgOut->isArticle() || $action == 'edit' || $action ==
'history' || $wpPreview ) {
- if( $wgOut->isArticle() ) {
+ if ( $this->data['isarticle'] || $action == 'edit' || $action
== 'history' || $wpPreview ) {
+ if( $this->data['isarticle'] ) {
$s .= '<strong>' . $this->editThisPage() .
'</strong>';
} else { # backlink to the article in edit or history
mode
if( $articleExists ){ # no backlink if no
article
@@ -212,7 +212,7 @@
}
# "Post a comment" link
- if( ( $title->isTalkPage() ||
$wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
+ if( ( $title->isTalkPage() ||
$this->getSkin()->getOutput()->showNewSectionLink() ) && $action != 'edit' &&
!$wpPreview )
$s .= '<br />' . Linker::link(
$title,
wfMsg( 'postcomment' ),
@@ -229,14 +229,14 @@
article with "Watch this article" checkbox disabled,
the article is transparently
unwatched. Therefore we do not show the "Watch this
page" link in edit mode
*/
- if ( $wgUser->isLoggedIn() && $articleExists ) {
+ if ( $this->data['loggedin'] && $articleExists ) {
if( $action != 'edit' && $action != 'submit' ) {
$s .= $sep . $this->watchThisPage();
}
if ( $title->userCan( 'edit' ) )
$s .= $sep . $this->moveThisPage();
}
- if ( $wgUser->isAllowed( 'delete' ) && $articleExists )
{
+ if ( $this->getSkin()->getUser()->isAllowed( 'delete' )
&& $articleExists ) {
$s .= $sep . $this->deleteThisPage() .
$sep . $this->protectThisPage();
}
@@ -246,7 +246,7 @@
}
$s .= $sep . $this->whatLinksHere();
- if( $wgOut->isArticleRelated() ) {
+ if( $this->getSkin()->getOutput()->isArticleRelated() )
{
$s .= $sep . $this->watchPageLinksLink();
}
@@ -268,7 +268,7 @@
$s .= "\n<br /><hr class='sep' />";
}
- if( UploadBase::isEnabled() && UploadBase::isAllowed( $wgUser )
=== true ) {
+ if( UploadBase::isEnabled() && UploadBase::isAllowed(
$this->getSkin()->getUser() ) === true ) {
$s .= $this->getUploadLink() . $sep;
}
Modified: trunk/phase3/skins/Vector.php
===================================================================
--- trunk/phase3/skins/Vector.php 2011-09-09 15:40:19 UTC (rev 96668)
+++ trunk/phase3/skins/Vector.php 2011-09-09 15:41:30 UTC (rev 96669)
@@ -26,14 +26,14 @@
* @param $out OutputPage object to initialize
*/
public function initPage( OutputPage $out ) {
- global $wgLocalStylePath, $wgRequest;
+ global $wgLocalStylePath;
parent::initPage( $out );
// Append CSS which includes IE only behavior fixes for hover
support -
// this is better than including this in a CSS fille since it
doesn't
// wait for the CSS file to load before fetching the HTC file.
- $min = $wgRequest->getFuzzyBool( 'debug' ) ? '' : '.min';
+ $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' :
'.min';
$out->addHeadItem( 'csshover',
'<!--[if lt IE 7]><style
type="text/css">body{behavior:url("' .
htmlspecialchars( $wgLocalStylePath ) .
@@ -60,29 +60,19 @@
*/
class VectorTemplate extends BaseTemplate {
- /* Members */
-
- /**
- * @var Skin Cached skin object
- */
- var $skin;
-
/* Functions */
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute() {
- global $wgLang, $wgVectorUseIconWatch;
+ global $wgVectorUseIconWatch;
- $this->skin = $this->data['skin'];
-
// Build additional attributes for navigation urls
- //$nav = $this->skin->buildNavigationUrls();
$nav = $this->data['content_navigation'];
if ( $wgVectorUseIconWatch ) {
- $mode = $this->skin->getTitle()->userIsWatching() ?
'unwatch' : 'watch';
+ $mode = $this->getSkin()->getTitle()->userIsWatching()
? 'unwatch' : 'watch';
if ( isset( $nav['actions'][$mode] ) ) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim( 'icon '
. $nav['views'][$mode]['class'], ' ' );
@@ -121,7 +111,7 @@
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
- if ( $wgLang->isRTL() ) {
+ if ( $this->data['rtl'] ) {
$this->data['view_urls'] =
array_reverse( $this->data['view_urls'] );
$this->data['namespace_urls'] =
@@ -236,7 +226,7 @@
<?php foreach ( $footericons as $blockName => $footerIcons ):
?>
<li id="footer-<?php echo
htmlspecialchars( $blockName ); ?>ico">
<?php foreach ( $footerIcons as $icon ): ?>
- <?php echo
$this->skin->makeFooterIcon( $icon ); ?>
+ <?php echo
$this->getSkin()->makeFooterIcon( $icon ); ?>
<?php endforeach; ?>
</li>
@@ -336,14 +326,14 @@
* @param $elements array
*/
private function renderNavigation( $elements ) {
- global $wgVectorUseSimpleSearch, $wgVectorShowVariantName,
$wgUser, $wgLang;
+ global $wgVectorUseSimpleSearch, $wgVectorShowVariantName;
// If only one element was given, wrap it in an array, allowing
more
// flexible arguments
if ( !is_array( $elements ) ) {
$elements = array( $elements );
// If there's a series of elements, reverse them when in RTL
mode
- } elseif ( $wgLang->isRTL() ) {
+ } elseif ( $this->data['rtl'] ) {
$elements = array_reverse( $elements );
}
// Render elements
@@ -435,14 +425,14 @@
<h5<?php $this->html( 'userlangattributes' ) ?>><label
for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
<form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
<input type='hidden' name="title" value="<?php $this->text(
'searchtitle' ) ?>"/>
- <?php if ( $wgVectorUseSimpleSearch && $wgUser->getOption(
'vector-simplesearch' ) ): ?>
+ <?php if ( $wgVectorUseSimpleSearch &&
$this->getSkin()->getUser()->getOption( 'vector-simplesearch' ) ): ?>
<div id="simpleSearch">
<?php if ( $this->data['rtl'] ): ?>
- <?php echo $this->makeSearchButton( 'image', array(
'id' => 'searchButton', 'src' => $this->skin->getSkinStylePath(
'images/search-rtl.png' ) ) ); ?>
+ <?php echo $this->makeSearchButton( 'image', array(
'id' => 'searchButton', 'src' => $this->getSkin()->getSkinStylePath(
'images/search-rtl.png' ) ) ); ?>
<?php endif; ?>
<?php echo $this->makeSearchInput( array( 'id' =>
'searchInput', 'type' => 'text' ) ); ?>
<?php if ( !$this->data['rtl'] ): ?>
- <?php echo $this->makeSearchButton( 'image', array(
'id' => 'searchButton', 'src' => $this->skin->getSkinStylePath(
'images/search-ltr.png' ) ) ); ?>
+ <?php echo $this->makeSearchButton( 'image', array(
'id' => 'searchButton', 'src' => $this->getSkin()->getSkinStylePath(
'images/search-ltr.png' ) ) ); ?>
<?php endif; ?>
</div>
<?php else: ?>
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs