/**#@-*/
protected $mRevisionId; // The revision ID we're looking at, null if not applicable.
protected $skinname = 'standard';
+ // @fixme Should be protected :-\
+ var $mTitle = null;
/** Constructor, call parent constructor */
function Skin() { parent::__construct(); }
* Preload the existence of three commonly-requested pages in a single query
*/
function preloadExistence() {
- global $wgUser, $wgTitle;
+ global $wgUser;
// User/talk link
$titles = array( $wgUser->getUserPage(), $wgUser->getTalkPage() );
// Other tab link
- if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
+ if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
// nothing
- } elseif ( $wgTitle->isTalkPage() ) {
- $titles[] = $wgTitle->getSubjectPage();
+ } elseif ( $this->mTitle->isTalkPage() ) {
+ $titles[] = $this->mTitle->getSubjectPage();
} else {
- $titles[] = $wgTitle->getTalkPage();
+ $titles[] = $this->mTitle->getTalkPage();
}
$lb = new LinkBatch( $titles );
}
function addMetadataLinks( OutputPage $out ) {
- global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
+ global $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
global $wgRightsPage, $wgRightsUrl;
if( $out->isArticleRelated() ) {
$out->addMetadataLink( array(
'title' => 'Creative Commons',
'type' => 'application/rdf+xml',
- 'href' => $wgTitle->getLocalURL( 'action=creativecommons' ) )
+ 'href' => $this->mTitle->getLocalURL( 'action=creativecommons' ) )
);
}
if( $wgEnableDublinCoreRdf ) {
$out->addMetadataLink( array(
'title' => 'Dublin Core',
'type' => 'application/rdf+xml',
- 'href' => $wgTitle->getLocalURL( 'action=dublincore' ) )
+ 'href' => $this->mTitle->getLocalURL( 'action=dublincore' ) )
);
}
}
}
}
- function setMembers(){
- global $wgTitle, $wgUser;
- $this->mTitle = $wgTitle;
+ /**
+ * Set some local variables
+ */
+ protected function setMembers(){
+ global $wgUser;
$this->mUser = $wgUser;
$this->userpage = $wgUser->getUserPage()->getPrefixedText();
$this->usercss = false;
}
+
+ /**
+ * Set the title
+ * @param Title $t The title to use
+ */
+ public function setTitle( $t ) {
+ $this->mTitle = $t;
+ }
+
+ /** Get the title */
+ public function getTitle() {
+ return $this->mTitle;
+ }
function outputPage( OutputPage $out ) {
global $wgDebugComments;
* @param array $data Associative array containing one element:
* skinname => the skin name
* The odd calling convention is for backwards compatibility
+ * @TODO @FIXME Make this not depend on $wgTitle!
*/
static function makeGlobalVariablesScript( $data ) {
- global $wgScript, $wgStylePath, $wgUser;
+ global $wgScript, $wgTitle, $wgStylePath, $wgUser;
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
- global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
+ global $wgCanonicalNamespaceNames, $wgOut, $wgArticle;
global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths;
global $wgUseAjax, $wgAjaxWatch;
global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI;
* @private
*/
function userCanPreview( $action ) {
- global $wgTitle, $wgRequest, $wgUser;
+ global $wgRequest, $wgUser;
if( $action != 'submit' )
return false;
if( !$wgRequest->wasPosted() )
return false;
- if( !$wgTitle->userCanEditCssJsSubpage() )
+ if( !$this->mTitle->userCanEditCssJsSubpage() )
return false;
return $wgUser->matchEditToken(
$wgRequest->getVal( 'wpEditToken' ) );
}
function getBodyOptions() {
- global $wgUser, $wgTitle, $wgOut, $wgRequest, $wgContLang;
+ global $wgUser, $wgOut, $wgRequest, $wgContLang;
extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
- if ( 0 != $wgTitle->getNamespace() ) {
+ if ( 0 != $this->mTitle->getNamespace() ) {
$a = array( 'bgcolor' => '#ffffec' );
}
else $a = array( 'bgcolor' => '#FFFFFF' );
if( $wgOut->isArticle() && $wgUser->getOption( 'editondblclick' ) &&
- $wgTitle->quickUserCan( 'edit' ) ) {
- $s = $wgTitle->getFullURL( $this->editUrlOptions() );
+ $this->mTitle->quickUserCan( 'edit' ) ) {
+ $s = $this->mTitle->getFullURL( $this->editUrlOptions() );
$s = 'document.location = "' .Xml::escapeJsString( $s ) .'";';
$a += array( 'ondblclick' => $s );
}
$a['class'] =
'mediawiki' .
' '.( $wgContLang->isRTL() ? 'rtl' : 'ltr' ).
- ' '.$this->getPageClasses( $wgTitle ) .
+ ' '.$this->getPageClasses( $this->mTitle ) .
' skin-'. Sanitizer::escapeClass( $this->getSkinName() );
return $a;
}
function getCategoryLinks() {
- global $wgOut, $wgTitle, $wgUseCategoryBrowser;
+ global $wgOut, $wgUseCategoryBrowser;
global $wgContLang, $wgUser;
if( count( $wgOut->mCategoryLinks ) == 0 ) return '';
if ( isset( $allCats['hidden'] ) ) {
if ( $wgUser->getBoolOption( 'showhiddencats' ) ) {
$class ='mw-hidden-cats-user-shown';
- } elseif ( $wgTitle->getNamespace() == NS_CATEGORY ) {
+ } elseif ( $this->mTitle->getNamespace() == NS_CATEGORY ) {
$class = 'mw-hidden-cats-ns-shown';
} else {
$class = 'mw-hidden-cats-hidden';
$s .= '<br /><hr />';
# get a big array of the parents tree
- $parenttree = $wgTitle->getParentCategoryTree();
+ $parenttree = $this->mTitle->getParentCategoryTree();
# Skin object passed by reference cause it can not be
# accessed under the method subfunction drawCategoryBrowser
$tempout = explode( "\n", Skin::drawCategoryBrowser( $parenttree, $this ) );
/** @return string Retrievied from HTML text */
function printSource() {
- global $wgTitle;
- $url = htmlspecialchars( $wgTitle->getFullURL() );
+ $url = htmlspecialchars( $this->mTitle->getFullURL() );
return wfMsg( 'retrievedfrom', '<a href="'.$url.'">'.$url.'</a>' );
}
function doAfterContent() { return '</div></div>'; }
function pageTitleLinks() {
- global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgLang;
+ global $wgOut, $wgUser, $wgRequest, $wgLang;
$oldid = $wgRequest->getVal( 'oldid' );
$diff = $wgRequest->getVal( 'diff' );
}
if ( $wgOut->isArticleRelated() ) {
- if ( $wgTitle->getNamespace() == NS_FILE ) {
- $name = $wgTitle->getDBkey();
- $image = wfFindFile( $wgTitle );
+ if ( $this->mTitle->getNamespace() == NS_FILE ) {
+ $name = $this->mTitle->getDBkey();
+ $image = wfFindFile( $this->mTitle );
if( $image ) {
$link = htmlspecialchars( $image->getURL() );
$style = $this->getInternalLinkAttributes( $link, $name );
}
}
if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
- $s[] .= $this->makeKnownLinkObj( $wgTitle,
+ $s[] .= $this->makeKnownLinkObj( $this->mTitle,
wfMsg( 'currentrev' ) );
}
if ( $wgUser->getNewtalk() ) {
# do not show "You have new messages" text when we are viewing our
# own talk page
- if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
+ if( !$this->mTitle->equals( $wgUser->getTalkPage() ) ) {
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
$dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
$s[] = '<strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
}
function getUndeleteLink() {
- global $wgUser, $wgTitle, $wgContLang, $wgLang, $action;
- if( $wgUser->isAllowed( 'deletedhistory' ) &&
- ( ( $wgTitle->getArticleId() == 0 ) || ( $action == 'history' ) ) &&
- ( $n = $wgTitle->isDeleted() ) ){
+ global $wgUser, $wgContLang, $wgLang, $wgRequest;
+
+ $action = $wgRequest->getVal( 'action', 'view' );
+
+ if ( $wgUser->isAllowed( 'deletedhistory' ) &&
+ ( $this->mTitle->getArticleId() == 0 || $action == 'history' ) &&
+ $n = $this->mTitle->isDeleted() ) {
if ( $wgUser->isAllowed( 'undelete' ) ) {
$msg = 'thisisdeleted';
} else {
}
return wfMsg( $msg,
$this->makeKnownLinkObj(
- SpecialPage::getTitleFor( 'Undelete', $wgTitle->getPrefixedDBkey() ),
+ SpecialPage::getTitleFor( 'Undelete', $this->mTitle->getPrefixedDBkey() ),
wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $wgLang->formatNum( $n ) ) ) );
}
return '';
if( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages ) ) )
return $subpages;
- global $wgOut, $wgTitle;
- if( $wgOut->isArticle() && MWNamespace::hasSubpages( $wgTitle->getNamespace() ) ) {
- $ptext = $wgTitle->getPrefixedText();
+ global $wgOut;
+ if( $wgOut->isArticle() && MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
+ $ptext = $this->mTitle->getPrefixedText();
if( preg_match( '/\//', $ptext ) ) {
$links = explode( '/', $ptext );
array_pop( $links );
}
function nameAndLogin() {
- global $wgUser, $wgTitle, $wgLang, $wgContLang;
+ global $wgUser, $wgLang, $wgContLang;
$logoutPage = $wgContLang->specialPage( 'Userlogout' );
$ret .= wfMsg( 'notloggedin' );
}
- $returnTo = $wgTitle->getPrefixedDBkey();
+ $returnTo = $this->mTitle->getPrefixedDBkey();
$query = array();
if ( $logoutPage != $returnTo ) {
$query['returnto'] = $returnTo;
wfMsg( $loginlink ), array(), $query
);
} else {
- $returnTo = $wgTitle->getPrefixedDBkey();
+ $returnTo = $this->mTitle->getPrefixedDBkey();
$talkLink = $this->link( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
function variantLinks() {
$s = '';
/* show links to different language variants */
- global $wgDisableLangConversion, $wgLang, $wgContLang, $wgTitle;
+ global $wgDisableLangConversion, $wgLang, $wgContLang;
$variants = $wgContLang->getVariants();
if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
foreach( $variants as $code ) {
continue;
$s = $wgLang->pipeList( array(
$s,
- '<a href="' . $wgTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
+ '<a href="' . $this->mTitle->escapeLocalUrl( 'variant=' . $code ) . '">' . htmlspecialchars( $varname ) . '</a>'
) );
}
}
}
function bottomLinks() {
- global $wgOut, $wgUser, $wgTitle, $wgUseTrackbacks;
+ global $wgOut, $wgUser, $wgUseTrackbacks;
$sep = wfMsgExt( 'pipe-separator', 'escapenoentities' ) . "\n";
$s = '';
if( $wgUseTrackbacks )
$element[] = $this->trackbackLink();
- if ( $wgTitle->getNamespace() == NS_USER
- || $wgTitle->getNamespace() == NS_USER_TALK ){
- $id = User::idFromName( $wgTitle->getText() );
- $ip = User::isIP( $wgTitle->getText() );
+ if ( $this->mTitle->getNamespace() == NS_USER
+ || $this->mTitle->getNamespace() == NS_USER_TALK ){
+ $id = User::idFromName( $this->mTitle->getText() );
+ $ip = User::isIP( $this->mTitle->getText() );
if( $id || $ip ) { # both anons and non-anons have contri list
$element[] = $this->userContribsLink();
$s = implode( $element, $sep );
- if ( $wgTitle->getArticleId() ) {
+ if ( $this->mTitle->getArticleId() ) {
$s .= "\n<br />";
if( $wgUser->isAllowed( 'delete' ) ) { $s .= $this->deleteThisPage(); }
if( $wgUser->isAllowed( 'protect' ) ) { $s .= $sep . $this->protectThisPage(); }
function pageStats() {
global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
- global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
+ global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
$oldid = $wgRequest->getVal( 'oldid' );
$diff = $wgRequest->getVal( 'diff' );
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'watchlist',
array( 'COUNT(*) AS n' ),
- array( 'wl_title' => $dbr->strencode( $wgTitle->getDBkey() ), 'wl_namespace' => $wgTitle->getNamespace() ),
+ array( 'wl_title' => $dbr->strencode( $this->mTitle->getDBkey() ), 'wl_namespace' => $this->mTitle->getNamespace() ),
__METHOD__
);
$x = $dbr->fetchObject( $res );
}
function editThisPage() {
- global $wgOut, $wgTitle;
+ global $wgOut;
if ( !$wgOut->isArticleRelated() ) {
$s = wfMsg( 'protectedpage' );
} else {
- if( $wgTitle->quickUserCan( 'edit' ) && $wgTitle->exists() ) {
+ if( $this->mTitle->quickUserCan( 'edit' ) && $this->mTitle->exists() ) {
$t = wfMsg( 'editthispage' );
- } elseif( $wgTitle->quickUserCan( 'create' ) && !$wgTitle->exists() ) {
+ } elseif( $this->mTitle->quickUserCan( 'create' ) && !$this->mTitle->exists() ) {
$t = wfMsg( 'create-this-page' );
} else {
$t = wfMsg( 'viewsource' );
}
- $s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
+ $s = $this->makeKnownLinkObj( $this->mTitle, $t, $this->editUrlOptions() );
}
return $s;
}
}
function deleteThisPage() {
- global $wgUser, $wgTitle, $wgRequest;
+ global $wgUser, $wgRequest;
$diff = $wgRequest->getVal( 'diff' );
- if ( $wgTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
+ if ( $this->mTitle->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
$t = wfMsg( 'deletethispage' );
- $s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
+ $s = $this->makeKnownLinkObj( $this->mTitle, $t, 'action=delete' );
} else {
$s = '';
}
}
function protectThisPage() {
- global $wgUser, $wgTitle, $wgRequest;
+ global $wgUser, $wgRequest;
$diff = $wgRequest->getVal( 'diff' );
- if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
- if ( $wgTitle->isProtected() ) {
+ if ( $this->mTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('protect') ) {
+ if ( $this->mTitle->isProtected() ) {
$t = wfMsg( 'unprotectthispage' );
$q = 'action=unprotect';
} else {
$t = wfMsg( 'protectthispage' );
$q = 'action=protect';
}
- $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
+ $s = $this->makeKnownLinkObj( $this->mTitle, $t, $q );
} else {
$s = '';
}
}
function watchThisPage() {
- global $wgOut, $wgTitle;
+ global $wgOut;
++$this->mWatchLinkNum;
if ( $wgOut->isArticleRelated() ) {
- if ( $wgTitle->userIsWatching() ) {
+ if ( $this->mTitle->userIsWatching() ) {
$t = wfMsg( 'unwatchthispage' );
$q = 'action=unwatch';
$id = 'mw-unwatch-link' . $this->mWatchLinkNum;
$q = 'action=watch';
$id = 'mw-watch-link' . $this->mWatchLinkNum;
}
- $s = $this->makeKnownLinkObj( $wgTitle, $t, $q, '', '', " id=\"$id\"" );
+ $s = $this->makeKnownLinkObj( $this->mTitle, $t, $q, '', '', " id=\"$id\"" );
} else {
$s = wfMsg( 'notanarticle' );
}
}
function moveThisPage() {
- global $wgTitle;
-
- if ( $wgTitle->quickUserCan( 'move' ) ) {
+ if ( $this->mTitle->quickUserCan( 'move' ) ) {
return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
- wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
+ wfMsg( 'movethispage' ), 'target=' . $this->mTitle->getPrefixedURL() );
} else {
// no message if page is protected - would be redundant
return '';
}
function historyLink() {
- global $wgTitle;
-
- return $this->link( $wgTitle, wfMsg( 'history' ),
+ return $this->link( $this->mTitle, wfMsg( 'history' ),
array( 'rel' => 'archives' ), array( 'action' => 'history' ) );
}
function whatLinksHere() {
- global $wgTitle;
-
return $this->makeKnownLinkObj(
- SpecialPage::getTitleFor( 'Whatlinkshere', $wgTitle->getPrefixedDBkey() ),
+ SpecialPage::getTitleFor( 'Whatlinkshere', $this->mTitle->getPrefixedDBkey() ),
wfMsg( 'whatlinkshere' ) );
}
function userContribsLink() {
- global $wgTitle;
-
return $this->makeKnownLinkObj(
- SpecialPage::getTitleFor( 'Contributions', $wgTitle->getDBkey() ),
+ SpecialPage::getTitleFor( 'Contributions', $this->mTitle->getDBkey() ),
wfMsg( 'contributions' ) );
}
}
function emailUserLink() {
- global $wgTitle;
-
return $this->makeKnownLinkObj(
- SpecialPage::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ),
+ SpecialPage::getTitleFor( 'Emailuser', $this->mTitle->getDBkey() ),
wfMsg( 'emailuser' ) );
}
function watchPageLinksLink() {
- global $wgOut, $wgTitle;
-
+ global $wgOut;
if ( ! $wgOut->isArticleRelated() ) {
return '(' . wfMsg( 'notanarticle' ) . ')';
} else {
return $this->makeKnownLinkObj(
- SpecialPage::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ),
+ SpecialPage::getTitleFor( 'Recentchangeslinked', $this->mTitle->getPrefixedDBkey() ),
wfMsg( 'recentchangeslinked' ) );
}
}
function trackbackLink() {
- global $wgTitle;
-
- return '<a href="' . $wgTitle->trackbackURL() . '">'
+ return '<a href="' . $this->mTitle->trackbackURL() . '">'
. wfMsg( 'trackbacklink' ) . '</a>';
}
}
function talkLink() {
- global $wgTitle;
-
- if ( NS_SPECIAL == $wgTitle->getNamespace() ) {
+ if ( NS_SPECIAL == $this->mTitle->getNamespace() ) {
# No discussion links for special pages
return '';
}
$linkOptions = array();
- if( $wgTitle->isTalkPage() ) {
- $link = $wgTitle->getSubjectPage();
+ if( $this->mTitle->isTalkPage() ) {
+ $link = $this->mTitle->getSubjectPage();
switch( $link->getNamespace() ) {
case NS_MAIN:
$text = wfMsg( 'articlepage' );
$text = wfMsg( 'articlepage' );
}
} else {
- $link = $wgTitle->getTalkPage();
+ $link = $this->mTitle->getTalkPage();
$text = wfMsg( 'talkpage' );
}
}
function commentLink() {
- global $wgTitle, $wgOut;
+ global $wgOut;
- if ( $wgTitle->getNamespace() == NS_SPECIAL ) {
+ if ( $this->mTitle->getNamespace() == NS_SPECIAL ) {
return '';
}
# __NEWSECTIONLINK___ changes behaviour here
# If it's present, the link points to this page, otherwise
# it points to the talk page
- if( $wgTitle->isTalkPage() ) {
- $title = $wgTitle;
+ if( $this->mTitle->isTalkPage() ) {
+ $title = $this->mTitle;
} elseif( $wgOut->showNewSectionLink() ) {
- $title = $wgTitle;
+ $title = $this->mTitle;
} else {
- $title = $wgTitle->getTalkPage();
+ $title = $this->mTitle->getTalkPage();
}
return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
if( strpos( $line, '*' ) !== 0 )
continue;
if( strpos( $line, '**') !== 0 ) {
- $line = trim( $line, '* ' );
- $heading = $line;
+ $heading = trim( $line, '* ' );
if( !array_key_exists( $heading, $bar ) ) $bar[$heading] = array();
} else {
if( strpos( $line, '|' ) !== false ) { // sanity check
wfProfileOut( __METHOD__ );
return $bar;
}
-}
\ No newline at end of file
+}