var $mParseWarnings = array();
var $mSquidMaxage = 0;
var $mRevisionId = null;
+ protected $mTitle = null;
/**
* An array of stylesheet filenames (relative from skins path), with options
$this->setHTMLTitle( wfMsg( 'pagetitle', $name ) );
}
+
+ public function setTitle( $t ) {
+ $this->mTitle = $t;
+ }
+
+ public function getTitle() {
+ if ( $this->mTitle instanceof Title ) {
+ return $this->mTitle;
+ }
+ else {
+ wfDebug( __METHOD__ . ' called and $mTitle is null. Return $wgTitle for sanity' );
+ global $wgTitle;
+ return $wgTitle;
+ }
+ }
public function getHTMLTitle() { return $this->mHTMLtitle; }
public function getPageTitle() { return $this->mPagetitle; }
* @param bool $linestart
*/
public function addWikiText( $text, $linestart = true ) {
- global $wgTitle;
- $this->addWikiTextTitle($text, $wgTitle, $linestart);
+ $this->addWikiTextTitle( $text, $this->getTitle(), $linestart );
}
public function addWikiTextWithTitle($text, &$title, $linestart = true) {
* @param ParserOutput object &$parserOutput
*/
public function addParserOutputNoText( &$parserOutput ) {
- global $wgTitle, $wgExemptFromUserRobotsControl, $wgContentNamespaces;
+ global $wgExemptFromUserRobotsControl, $wgContentNamespaces;
$this->mLanguageLinks += $parserOutput->getLanguageLinks();
$this->addCategoryLinks( $parserOutput->getCategories() );
} else {
$bannedNamespaces = $wgExemptFromUserRobotsControl;
}
- if( !in_array( $wgTitle->getNamespace(), $bannedNamespaces ) ) {
+ if( !in_array( $this->getTitle()->getNamespace(), $bannedNamespaces ) ) {
# FIXME (bug 14900): This overrides $wgArticleRobotPolicies, and it
# shouldn't
$this->setIndexPolicy( $parserOutput->getIndexPolicy() );
* @deprecated use addWikiTextTidy()
*/
public function addSecondaryWikiText( $text, $linestart = true ) {
- global $wgTitle;
wfDeprecated( __METHOD__ );
- $this->addWikiTextTitleTidy($text, $wgTitle, $linestart);
+ $this->addWikiTextTitleTidy($text, $this->getTitle(), $linestart);
}
/**
* Add wikitext with tidy enabled
*/
public function addWikiTextTidy( $text, $linestart = true ) {
- global $wgTitle;
- $this->addWikiTextTitleTidy($text, $wgTitle, $linestart);
+ $this->addWikiTextTitleTidy($text, $this->getTitle(), $linestart);
}
* @param bool $interface ??
*/
public function parse( $text, $linestart = true, $interface = false ) {
- global $wgParser, $wgTitle;
- if( is_null( $wgTitle ) ) {
- throw new MWException( 'Empty $wgTitle in ' . __METHOD__ );
+ global $wgParser;
+ if( is_null( $this->getTitle() ) ) {
+ throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
}
$popts = $this->parserOptions();
if ( $interface) { $popts->setInterfaceMessage(true); }
- $parserOutput = $wgParser->parse( $text, $wgTitle, $popts,
+ $parserOutput = $wgParser->parse( $text, $this->getTitle(), $popts,
$linestart, true, $this->mRevisionId );
if ( $interface) { $popts->setInterfaceMessage(false); }
return $parserOutput->getText();
global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
global $wgJsMimeType, $wgUseAjax, $wgAjaxWatch;
global $wgEnableMWSuggest, $wgUniversalEditButton;
- global $wgArticle, $wgTitle;
+ global $wgArticle;
if( $this->mDoNothing ){
return;
}
if( $wgUniversalEditButton ) {
- if( isset( $wgArticle ) && isset( $wgTitle ) && $wgTitle->quickUserCan( 'edit' )
- && ( $wgTitle->exists() || $wgTitle->quickUserCan( 'create' ) ) ) {
+ if( isset( $wgArticle ) && $this->getTitle() && $this->getTitle()->quickUserCan( 'edit' )
+ && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create' ) ) ) {
// Original UniversalEditButton
$this->addLink( array(
'rel' => 'alternate',
'type' => 'application/x-wiki',
'title' => wfMsg( 'edit' ),
- 'href' => $wgTitle->getLocalURL( 'action=edit' )
+ 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
) );
// Alternate edit link
$this->addLink( array(
'rel' => 'edit',
'title' => wfMsg( 'edit' ),
- 'href' => $wgTitle->getLocalURL( 'action=edit' )
+ 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
) );
}
}
* @return nothing
*/
function blockedPage( $return = true ) {
- global $wgUser, $wgContLang, $wgTitle, $wgLang;
+ global $wgUser, $wgContLang, $wgLang;
$this->setPageTitle( wfMsg( 'blockedtitle' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
# Don't auto-return to special pages
if( $return ) {
- $return = $wgTitle->getNamespace() > -1 ? $wgTitle : NULL;
+ $return = $this->getTitle()->getNamespace() > -1 ? $this->getTitle() : null;
$this->returnToMain( null, $return );
}
}
* @param array $params Message parameters
*/
public function showErrorPage( $title, $msg, $params = array() ) {
- global $wgTitle;
- if ( isset($wgTitle) ) {
- $this->mDebugtext .= 'Original title: ' . $wgTitle->getPrefixedText() . "\n";
+ if ( $this->getTitle() ) {
+ $this->mDebugtext .= 'Original title: ' . $this->getTitle()->getPrefixedText() . "\n";
}
$this->setPageTitle( wfMsg( $title ) );
$this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
*/
public function showPermissionsErrorPage( $errors, $action = null )
{
- global $wgTitle;
-
$this->mDebugtext .= 'Original title: ' .
- $wgTitle->getPrefixedText() . "\n";
+ $this->getTitle()->getPrefixedText() . "\n";
$this->setPageTitle( wfMsg( 'permissionserrors' ) );
$this->setHTMLTitle( wfMsg( 'permissionserrors' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
* Produce the stock "please login to use the wiki" page
*/
public function loginToUse() {
- global $wgUser, $wgTitle, $wgContLang;
+ global $wgUser, $wgContLang;
if( $wgUser->isLoggedIn() ) {
$this->permissionRequired( 'read' );
$this->setArticleFlag( false );
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
- $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
+ $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->getTitle()->getPrefixedUrl() );
$this->addHTML( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
- $this->addHTML( "\n<!--" . $wgTitle->getPrefixedUrl() . "-->" );
+ $this->addHTML( "\n<!--" . $this->getTitle()->getPrefixedUrl() . "-->" );
# Don't return to the main page if the user can't read it
# otherwise we'll end up in a pointless loop
* @param array $reasons List of reasons for this error, as returned by Title::getUserPermissionsErrors().
*/
public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
- global $wgUser, $wgTitle;
+ global $wgUser;
$skin = $wgUser->getSkin();
$this->setRobotPolicy( 'noindex,nofollow' );
// Permissions error
if( $source ) {
$this->setPageTitle( wfMsg( 'viewsource' ) );
- $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
+ $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $this->getTitle() ) ) );
} else {
$this->setPageTitle( wfMsg( 'badaccess' ) );
}
// Show templates used by this article
$skin = $wgUser->getSkin();
- $article = new Article( $wgTitle );
+ $article = new Article( $this->getTitle() );
$this->addHTML( "<div class='templatesUsed'>
{$skin->formatTemplates( $article->getUsedTemplates() )}
</div>
# If the title doesn't exist, it's fairly pointless to print a return
# link to it. After all, you just tried editing it and couldn't, so
# what's there to do there?
- if( $wgTitle->exists() ) {
- $this->returnToMain( null, $wgTitle );
+ if( $this->getTitle()->exists() ) {
+ $this->returnToMain( null, $this->getTitle() );
}
}
* @param ParserOutput &$parserOutput
*/
private function addKeywords( &$parserOutput ) {
- global $wgTitle;
- $this->addKeyword( $wgTitle->getPrefixedText() );
+ $this->addKeyword( $this->getTitle()->getPrefixedText() );
$count = 1;
$links2d =& $parserOutput->getLinks();
if ( !is_array( $links2d ) ) {
public function headElement( Skin $sk ) {
global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
- global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle, $wgStyleVersion;
+ global $wgUser, $wgContLang, $wgUseTrackbacks, $wgStyleVersion;
$this->addMeta( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" );
$this->addStyle( 'common/wikiprintable.css', 'print' );
}
if ($wgUseTrackbacks && $this->isArticleRelated())
- $ret .= $wgTitle->trackbackRDF();
+ $ret .= $this->getTitle()->trackbackRDF();
$ret .= "</head>\n";
return $ret;
}
if( $wgFeed ) {
- global $wgTitle;
foreach( $this->getSyndicationLinks() as $format => $link ) {
# Use the page name for the title (accessed through $wgTitle since
# there's no other way). In principle, this could lead to issues
$tags[] = $this->feedLink(
$format,
$link,
- wfMsg( "page-{$format}-feed", $wgTitle->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
+ wfMsg( "page-{$format}-feed", $this->getTitle()->getPrefixedText() ) ); # Used messages: 'page-rss-feed' and 'page-atom-feed' (for an easier grep)
}
# Recent changes feed should appear on every page (except recentchanges,
wfMsg( "site-{$type}-feed", $wgSitename ) );
}
}
- else if ( $wgTitle->getPrefixedText() != $rctitle->getPrefixedText() ) {
+ else if ( $this->getTitle()->getPrefixedText() != $rctitle->getPrefixedText() ) {
foreach( $wgFeedClasses as $format => $class ) {
$tags[] = $this->feedLink(
$format,
* @return array associating format keys with URLs
*/
public function getSyndicationLinks() {
- global $wgTitle, $wgFeedClasses;
+ global $wgFeedClasses;
$links = array();
if( $this->isSyndicated() ) {
}
foreach( $wgFeedClasses as $format => $class ) {
- $links[$format] = $wgTitle->getLocalUrl( "feed=$format{$appendQuery}" );
+ $links[$format] = $this->getTitle()->getLocalUrl( "feed=$format{$appendQuery}" );
}
}
return $links;
* for when rate limiting has triggered.
*/
public function rateLimited() {
- global $wgTitle;
$this->setPageTitle(wfMsg('actionthrottled'));
$this->setRobotPolicy( 'noindex,follow' );
$this->setStatusCode(503);
$this->addWikiMsg( 'actionthrottledtext' );
- $this->returnToMain( null, $wgTitle );
+ $this->returnToMain( null, $this->getTitle() );
}
/**
wfProfileIn( __METHOD__ );
+ $this->mTitle = $out->getTitle();
+
# Generally the order of the favicon and apple-touch-icon links
# should not matter, but Konqueror (3.5.9 at least) incorrectly
# uses whichever one appears later in the HTML source. Make sure
* 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;
+ global $wgUser;
$this->mUser = $wgUser;
$this->userpage = $wgUser->getUserPage()->getPrefixedText();
$this->usercss = false;
* @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;
+ global $wgUser, $wgContLang, $wgLang, $action;
if( $wgUser->isAllowed( 'deletedhistory' ) &&
- ( ( $wgTitle->getArticleId() == 0 ) || ( $action == 'history' ) ) &&
- ( $n = $wgTitle->isDeleted() ) ){
+ ( ( $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' );
* @param $out OutputPage
*/
function outputPage( OutputPage $out ) {
- global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang;
+ global $wgArticle, $wgUser, $wgLang, $wgContLang;
global $wgScript, $wgStylePath, $wgContLanguageCode;
global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
$tpl->set( 'feeds', false );
}
if( $wgUseTrackbacks && $out->isArticleRelated() ) {
- $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF() );
+ $tpl->set( 'trackbackhtml', $out->getTitle()->trackbackRDF() );
} else {
$tpl->set( 'trackbackhtml', null );
}
* @private
*/
function buildPersonalUrls() {
- global $wgTitle, $wgRequest;
+ global $wgOut, $wgRequest;
- $pageurl = $wgTitle->getLocalURL();
+ $title = $wgOut->getTitle();
+ $pageurl = $title->getLocalURL();
wfProfileIn( __METHOD__ );
/* set up the default links for the personal toolbar */
$personal_urls['logout'] = array(
'text' => wfMsg( 'userlogout' ),
'href' => self::makeSpecialUrl( 'Userlogout',
- $wgTitle->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
+ $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
),
'active' => false
);
$personal_urls['anonlogin'] = array(
'text' => wfMsg( $loginlink ),
'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ),
- 'active' => $wgTitle->isSpecial( 'Userlogin' )
+ 'active' => $title->isSpecial( 'Userlogin' )
);
} else {
$personal_urls['login'] = array(
'text' => wfMsg( $loginlink ),
'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ),
- 'active' => $wgTitle->isSpecial( 'Userlogin' )
+ 'active' => $title->isSpecial( 'Userlogin' )
);
}
}
-
- wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$wgTitle ) );
+
+ wfRunHooks( 'PersonalUrls', array( &$personal_urls, &$title ) );
wfProfileOut( __METHOD__ );
return $personal_urls;
}
* @private
*/
function buildNavUrls() {
- global $wgUseTrackbacks, $wgTitle, $wgUser, $wgRequest;
+ global $wgUseTrackbacks, $wgOut, $wgUser, $wgRequest;
global $wgEnableUploads, $wgUploadNavigationUrl;
wfProfileIn( __METHOD__ );
if ( $this->mRevisionId ) {
$nav_urls['permalink'] = array(
'text' => wfMsg( 'permalink' ),
- 'href' => $wgTitle->getLocalURL( "oldid=$this->mRevisionId" )
+ 'href' => $wgOut->getTitle()->getLocalURL( "oldid=$this->mRevisionId" )
);
}
}
if( $wgUseTrackbacks )
$nav_urls['trackbacklink'] = array(
- 'href' => $wgTitle->trackbackURL()
+ 'href' => $wgOut->getTitle()->trackbackURL()
);
}
* @private
*/
function msgWiki( $str ) {
- global $wgParser, $wgTitle, $wgOut;
+ global $wgParser, $wgOut;
$text = $this->translator->translate( $str );
- $parserOutput = $wgParser->parse( $text, $wgTitle,
+ $parserOutput = $wgParser->parse( $text, $wgOut->getTitle(),
$wgOut->parserOptions(), true );
echo $parserOutput->getText();
}