Reverting 17479/17480, breaks subclassing of Linker methods by skins. See my comment on bug 7405.

This commit is contained in:
Tim Starling 2006-11-08 07:12:03 +00:00
parent 020e6ac57f
commit 36ed0cd96c
69 changed files with 851 additions and 741 deletions

View file

@ -153,7 +153,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
if they have selected that option in preferences.
* (bug 5936) Show an 'm' to the left of the edit summary on diff pages for minor edits.
* (bug 7820) Improve error reporting for uploads via URL.
* (bug 7405) Make Linker methods static.
== Languages updated ==

View file

@ -71,6 +71,8 @@ function code2utf($num){
function wfSajaxSearch( $term ) {
global $wgContLang, $wgOut;
$limit = 16;
$l = new Linker;
$term = str_replace( ' ', '_', $wgContLang->ucfirst(
$wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) )
@ -92,10 +94,10 @@ function wfSajaxSearch( $term ) {
$i=0;
while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) {
$nt = Title::newFromDBkey( $row->page_title );
$r .= '<li>' . Linker::makeKnownLinkObj( $nt ) . "</li>\n";
$r .= '<li>' . $l->makeKnownLinkObj( $nt ) . "</li>\n";
}
if ( $i > $limit ) {
$more = '<i>' . Linker::makeKnownLink( $wgContLang->specialPage( "Allpages" ),
$more = '<i>' . $l->makeKnownLink( $wgContLang->specialPage( "Allpages" ),
wfMsg('moredotdotdot'),
"namespace=0&from=" . wfUrlEncode ( $term ) ) .
'</i>';
@ -111,10 +113,10 @@ function wfSajaxSearch( $term ) {
. wfMsg( 'hideresults' ) . '</a></div>'
. '<h1 class="firstHeading">'.wfMsg('search')
. '</h1><div id="contentSub">'. $subtitle . '</div><ul><li>'
. Linker::makeKnownLink( $wgContLang->specialPage( 'Search' ),
. $l->makeKnownLink( $wgContLang->specialPage( 'Search' ),
wfMsg( 'searchcontaining', $term ),
"search=$term&fulltext=Search" )
. '</li><li>' . Linker::makeKnownLink( $wgContLang->specialPage( 'Search' ),
. '</li><li>' . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ),
wfMsg( 'searchnamed', $term ) ,
"search=$term&go=Go" )
. "</li></ul><h2>" . wfMsg( 'articletitles', $term ) . "</h2>"

View file

@ -613,6 +613,7 @@ class Article {
global $wgUser, $wgOut, $wgRequest, $wgContLang;
global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
global $wgUseTrackbacks, $wgNamespaceRobotPolicies;
$sk = $wgUser->getSkin();
wfProfileIn( __METHOD__ );
@ -692,7 +693,8 @@ class Article {
// This is an internally redirected page view.
// We'll need a backlink to the source page for navigation.
if ( wfRunHooks( 'ArticleViewRedirect', array( &$this ) ) ) {
$redir = Linker::makeKnownLinkObj( $this->mRedirectedFrom, '', 'redirect=no' );
$sk = $wgUser->getSkin();
$redir = $sk->makeKnownLinkObj( $this->mRedirectedFrom, '', 'redirect=no' );
$s = wfMsg( 'redirectedfrom', $redir );
$wgOut->setSubtitle( $s );
$wasRedirected = true;
@ -702,7 +704,8 @@ class Article {
// If it was reported from a trusted site, supply a backlink.
global $wgRedirectSources;
if( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
$redir = Linker::makeExternalLink( $rdfrom, $rdfrom );
$sk = $wgUser->getSkin();
$redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
$s = wfMsg( 'redirectedfrom', $redir );
$wgOut->setSubtitle( $s );
$wasRedirected = true;
@ -784,7 +787,7 @@ class Article {
$targetUrl = $rt->escapeLocalURL();
# fixme unused $titleText :
$titleText = htmlspecialchars( $rt->getPrefixedText() );
$link = Linker::makeLinkObj( $rt );
$link = $sk->makeLinkObj( $rt );
$wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' .
'<span class="redirectText">'.$link.'</span>' );
@ -826,7 +829,7 @@ class Article {
$wgOut->addHTML(
"<div class='patrollink'>" .
wfMsg ( 'markaspatrolledlink',
Linker::makeKnownLinkObj( $this->mTitle, wfMsg('markaspatrolledtext'), "action=markpatrolled&rcid=$rcid" )
$sk->makeKnownLinkObj( $this->mTitle, wfMsg('markaspatrolledtext'), "action=markpatrolled&rcid=$rcid" )
) .
'</div>'
);
@ -2253,7 +2256,7 @@ class Article {
* @param string $oldid Revision ID of this article revision
*/
function setOldSubtitle( $oldid=0 ) {
global $wgLang, $wgOut;
global $wgLang, $wgOut, $wgUser;
if ( !wfRunHooks( 'DisplayOldSubtitle', array(&$this, &$oldid) ) ) {
return;
@ -2263,25 +2266,26 @@ class Article {
$current = ( $oldid == $this->mLatest );
$td = $wgLang->timeanddate( $this->mTimestamp, true );
$sk = $wgUser->getSkin();
$lnk = $current
? wfMsg( 'currentrevisionlink' )
: $lnk = Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) );
: $lnk = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) );
$prev = $this->mTitle->getPreviousRevisionID( $oldid ) ;
$prevlink = $prev
? Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid )
? $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid )
: wfMsg( 'previousrevision' );
$prevdiff = $prev
? Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=prev&oldid='.$oldid )
? $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=prev&oldid='.$oldid )
: wfMsg( 'diff' );
$nextlink = $current
? wfMsg( 'nextrevision' )
: Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'nextrevision' ), 'direction=next&oldid='.$oldid );
: $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'nextrevision' ), 'direction=next&oldid='.$oldid );
$nextdiff = $current
? wfMsg( 'diff' )
: Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid );
: $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid );
$userlinks = Linker::userLink( $revision->getUser(), $revision->getUserText() )
. Linker::userToolLinks( $revision->getUser(), $revision->getUserText() );
$userlinks = $sk->userLink( $revision->getUser(), $revision->getUserText() )
. $sk->userToolLinks( $revision->getUser(), $revision->getUserText() );
$r = wfMsg( 'old-revision-navigation', $td, $lnk, $prevlink, $nextlink, $userlinks, $prevdiff, $nextdiff );
$wgOut->setSubtitle( $r );

View file

@ -49,7 +49,8 @@ class CategoryViewer {
var $title, $limit, $from, $until,
$articles, $articles_start_char,
$children, $children_start_char,
$showGallery, $gallery;
$showGallery, $gallery,
$skin;
function __construct( $title, $from = '', $until = '' ) {
global $wgCategoryPagingLimit;
@ -98,13 +99,21 @@ class CategoryViewer {
}
}
function getSkin() {
if ( !$this->skin ) {
global $wgUser;
$this->skin = $wgUser->getSkin();
}
return $this->skin;
}
/**
* Add a subcategory to the internal lists
*/
function addSubcategory( $title, $sortkey, $pageLength ) {
global $wgContLang;
// Subcategory; strip the 'Category' namespace from the link text.
$this->children[] = Linker::makeKnownLinkObj(
$this->children[] = $this->getSkin()->makeKnownLinkObj(
$title, $wgContLang->convertHtml( $title->getText() ) );
$this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
@ -150,7 +159,7 @@ class CategoryViewer {
*/
function addPage( $title, $sortkey, $pageLength ) {
global $wgContLang;
$this->articles[] = Linker::makeSizeLinkObj(
$this->articles[] = $this->getSkin()->makeSizeLinkObj(
$pageLength, $title, $wgContLang->convert( $title->getPrefixedText() )
);
$this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) );
@ -379,16 +388,17 @@ class CategoryViewer {
*/
function pagingLinks( $title, $first, $last, $limit, $query = array() ) {
global $wgUser, $wgLang;
$sk =& $this->getSkin();
$limitText = $wgLang->formatNum( $limit );
$prevLink = htmlspecialchars( wfMsg( 'prevn', $limitText ) );
if( $first != '' ) {
$prevLink = Linker::makeLinkObj( $title, $prevLink,
$prevLink = $sk->makeLinkObj( $title, $prevLink,
wfArrayToCGI( $query + array( 'until' => $first ) ) );
}
$nextLink = htmlspecialchars( wfMsg( 'nextn', $limitText ) );
if( $last != '' ) {
$nextLink = Linker::makeLinkObj( $title, $nextLink,
$nextLink = $sk->makeLinkObj( $title, $nextLink,
wfArrayToCGI( $query + array( 'from' => $last ) ) );
}

View file

@ -34,7 +34,8 @@ class ChangesList {
#
/** @todo document */
function ChangesList() {
function ChangesList( &$skin ) {
$this->skin =& $skin;
$this->preCacheMessages();
}
@ -46,9 +47,10 @@ class ChangesList {
* @return ChangesList derivative
*/
function newFromUser( &$user ) {
$sk =& $user->getSkin();
$list = NULL;
if( wfRunHooks( 'FetchChangesList', array( &$user, &$list ) ) ) {
return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList() : new OldChangesList();
if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) {
return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
} else {
return $list;
}
@ -110,13 +112,13 @@ class ChangesList {
# Diff
$s .= '(' . $this->message['diff'] . ') (';
# Hist
$s .= Linker::makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
$s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
') . . ';
# "[[x]] moved to [[y]]"
$msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
$s .= wfMsg( $msg, Linker::makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
Linker::makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
$s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
$this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
}
function insertDateHeader(&$s, $rc_timestamp) {
@ -137,7 +139,7 @@ class ChangesList {
function insertLog(&$s, $title, $logtype) {
$logname = LogPage::logName( $logtype );
$s .= '(' . Linker::makeKnownLinkObj($title, $logname ) . ')';
$s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
}
@ -149,7 +151,7 @@ class ChangesList {
$rcidparam = $unpatrolled
? array( 'rcid' => $rc->mAttribs['rc_id'] )
: array();
$diffLink = Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
wfArrayToCGI( array(
'curid' => $rc->mAttribs['rc_cur_id'],
'diff' => $rc->mAttribs['rc_this_oldid'],
@ -160,7 +162,7 @@ class ChangesList {
$s .= '('.$diffLink.') (';
# History link
$s .= Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
$s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
wfArrayToCGI( array(
'curid' => $rc->mAttribs['rc_cur_id'],
'action' => 'history' ) ) );
@ -174,7 +176,7 @@ class ChangesList {
$params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
? 'rcid='.$rc->mAttribs['rc_id']
: '';
$articlelink = ' '. Linker::makeKnownLinkObj( $rc->getTitle(), '', $params );
$articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
global $wgContLang;
$articlelink .= $wgContLang->getDirMark();
@ -190,15 +192,15 @@ class ChangesList {
/** Insert links to user page, user talk page and eventually a blocking link */
function insertUserRelatedLinks(&$s, &$rc) {
$s .= Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
$s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
$s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
$s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
}
/** insert a formatted comment */
function insertComment(&$s, &$rc) {
# Add comment
if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
$s .= Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
$s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
}
}
@ -322,23 +324,23 @@ class EnhancedChangesList extends ChangesList {
# Make article link
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
$clink = wfMsg( $msg, Linker::makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
Linker::makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
$clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
$this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
} elseif( $rc_namespace == NS_SPECIAL ) {
list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
if ( $specialName == 'Log' ) {
# Log updates, etc
$logname = LogPage::logName( $logtype );
$clink = '(' . Linker::makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
$clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
} else {
wfDebug( "Unexpected special page in recentchanges\n" );
$clink = '';
}
} elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
# Unpatrolled new page, give rc_id in query
$clink = Linker::makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
} else {
$clink = Linker::makeKnownLinkObj( $rc->getTitle(), '' );
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
}
$time = $wgContLang->time( $rc_timestamp, true, true );
@ -356,31 +358,31 @@ class EnhancedChangesList extends ChangesList {
$querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
$querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
$aprops = ' tabindex="'.$baseRC->counter.'"';
$curLink = Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
$curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
if( $rc_type != RC_NEW ) {
$curLink = $this->message['cur'];
}
$diffLink = $this->message['diff'];
} else {
$diffLink = Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
}
# Make "last" link
if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$lastLink = $this->message['last'];
} else {
$lastLink = Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
$lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
$curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
}
$rc->userlink = Linker::userLink( $rc_user, $rc_user_text );
$rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
$rc->lastlink = $lastLink;
$rc->curlink = $curLink;
$rc->difflink = $diffLink;
$rc->usertalklink = Linker::userToolLinks( $rc_user, $rc_user_text );
$rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
# Put accumulated information into the cache, for later display
# Page moves go on their own line
@ -470,13 +472,13 @@ class EnhancedChangesList extends ChangesList {
if( $isnew ) {
$r .= $this->message['changes'];
} else {
$r .= Linker::makeKnownLinkObj( $block[0]->getTitle(),
$r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
$this->message['changes'], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
}
$r .= '; ';
# History
$r .= Linker::makeKnownLinkObj( $block[0]->getTitle(),
$r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
$this->message['history'], $curIdEq.'&action=history' );
$r .= ')';
}
@ -507,7 +509,7 @@ class EnhancedChangesList extends ChangesList {
if( $rc_type == RC_LOG ) {
$link = $rcObj->timestamp;
} else {
$link = Linker::makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
$link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
}
$link = '<tt>'.$link.'</tt>';
@ -518,7 +520,7 @@ class EnhancedChangesList extends ChangesList {
$r .= $rcObj->lastlink;
$r .= ') . . '.$rcObj->userlink;
$r .= $rcObj->usertalklink;
$r .= Linker::commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= "<br />\n";
}
$r .= "</div>\n";
@ -614,14 +616,14 @@ class EnhancedChangesList extends ChangesList {
$r .= ' ('. $rcObj->difflink .'; ';
# Hist
$r .= Linker::makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
$r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
# User/talk
$r .= ') . . '.$rcObj->userlink . $rcObj->usertalklink;
# Comment
if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
$r .= Linker::commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
}
if( $rcObj->numberofWatchingusers > 0 ) {

View file

@ -171,8 +171,9 @@ function getContributorCredits($article, $cnt, $showIfMax) {
*
*/
function creditLink($user_name, $link_text = '') {
global $wgContLang;
return Linker::makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
global $wgUser, $wgContLang;
$skin = $wgUser->getSkin();
return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
htmlspecialchars( (empty($link_text)) ? $user_name : $link_text ));
}
@ -180,7 +181,9 @@ function creditLink($user_name, $link_text = '') {
*
*/
function creditOthersLink($article) {
return Linker::makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
global $wgUser;
$skin = $wgUser->getSkin();
return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
}
?>

View file

@ -143,12 +143,13 @@ CONTROL;
exit;
}
$sk = $wgUser->getSkin();
$talk = $wgContLang->getNsText( NS_TALK );
$contribs = wfMsg( 'contribslink' );
if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) {
$username = $this->mNewRev->getUserText();
$rollback = '&nbsp;&nbsp;&nbsp;<strong>[' . Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ),
$rollback = '&nbsp;&nbsp;&nbsp;<strong>[' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ),
'action=rollback&from=' . urlencode( $username ) .
'&token=' . urlencode( $wgUser->editToken( array( $this->mTitle->getPrefixedText(), $username ) ) ) ) .
']</strong>';
@ -156,17 +157,17 @@ CONTROL;
$rollback = '';
}
if( $wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->isAllowed( 'patrol' ) ) {
$patrol = ' [' . Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . ']';
$patrol = ' [' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . ']';
} else {
$patrol = '';
}
$prevlink = Linker::makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'previousdiff' ),
$prevlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'previousdiff' ),
'diff=prev&oldid='.$this->mOldid, '', '', 'id="differences-prevlink"' );
if ( $this->mNewRev->isCurrent() ) {
$nextlink = '&nbsp;';
} else {
$nextlink = Linker::makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ),
$nextlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ),
'diff=next&oldid='.$this->mNewid, '', '', 'id="differences-nextlink"' );
}
@ -184,12 +185,12 @@ CONTROL;
}
$oldHeader = "<strong>{$this->mOldtitle}</strong><br />" .
Linker::revUserTools( $this->mOldRev ) . "<br />" .
$oldminor . Linker::revComment( $this->mOldRev ) . "<br />" .
$sk->revUserTools( $this->mOldRev ) . "<br />" .
$oldminor . $sk->revComment( $this->mOldRev ) . "<br />" .
$prevlink;
$newHeader = "<strong>{$this->mNewtitle}</strong><br />" .
Linker::revUserTools( $this->mNewRev ) . " $rollback<br />" .
$newminor . Linker::revComment( $this->mNewRev ) . "<br />" .
$sk->revUserTools( $this->mNewRev ) . " $rollback<br />" .
$newminor . $sk->revComment( $this->mNewRev ) . "<br />" .
$nextlink . $patrol;
$this->showDiff( $oldHeader, $newHeader );
@ -217,7 +218,7 @@ CONTROL;
* contrast to normal "old revision" display style.
*/
function showFirstRevision() {
global $wgOut;
global $wgOut, $wgUser;
$fname = 'DifferenceEngine::showFirstRevision';
wfProfileIn( $fname );
@ -248,10 +249,12 @@ CONTROL;
# Prepare the header box
#
$nextlink = Linker::makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ), 'diff=next&oldid='.$this->mNewid, '', '', 'id="differences-nextlink"' );
$sk = $wgUser->getSkin();
$nextlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ), 'diff=next&oldid='.$this->mNewid, '', '', 'id="differences-nextlink"' );
$header = "<div class=\"firstrevisionheader\" style=\"text-align: center\"><strong>{$this->mOldtitle}</strong><br />" .
Linker::revUserTools( $this->mNewRev ) . "<br />" .
Linker::revComment( $this->mNewRev ) . "<br />" .
$sk->revUserTools( $this->mNewRev ) . "<br />" .
$sk->revComment( $this->mNewRev ) . "<br />" .
$nextlink . "</div>\n";
$wgOut->addHTML( $header );

View file

@ -820,6 +820,8 @@ class EditPage {
$fname = 'EditPage::showEditForm';
wfProfileIn( $fname );
$sk =& $wgUser->getSkin();
wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
$wgOut->setRobotpolicy( 'noindex,nofollow' );
@ -941,7 +943,7 @@ class EditPage {
$minor = wfMsgExt('minoredit', array('parseinline'));
$watchthis = wfMsgExt('watchthis', array('parseinline'));
$cancel = Linker::makeKnownLink( $this->mTitle->getPrefixedText(),
$cancel = $sk->makeKnownLink( $this->mTitle->getPrefixedText(),
wfMsgExt('cancel', array('parseinline')) );
$edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ));
$edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
@ -1252,9 +1254,13 @@ END
* Prepare a list of templates used by this page. Returns HTML.
*/
function formatTemplates() {
global $wgUser;
$fname = 'EditPage::formatTemplates';
wfProfileIn( $fname );
$sk =& $wgUser->getSkin();
$outText = '';
$templates = $this->mArticle->getUsedTemplates();
if ( count( $templates ) > 0 ) {
@ -1270,7 +1276,7 @@ END
wfMsgExt( 'templatesused', array( 'parse' ) ) .
'</div><ul>';
foreach ( $templates as $titleObj ) {
$outText .= '<li>' . Linker::makeLinkObj( $titleObj ) . '</li>';
$outText .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
}
$outText .= '</ul>';
}
@ -1430,10 +1436,11 @@ END
* Produce the stock "please login to edit pages" page
*/
function userNotLoggedInPage() {
global $wgOut;
global $wgUser, $wgOut;
$skin = $wgUser->getSkin();
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
$loginLink = Linker::makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->mTitle->getPrefixedUrl() );
$loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->mTitle->getPrefixedUrl() );
$wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );

View file

@ -17,6 +17,7 @@ class ImageGallery
{
var $mImages, $mShowBytes, $mShowFilename;
var $mCaption = false;
var $mSkin = false;
/**
* Is the gallery on a wiki page (i.e. not a special page)
@ -49,6 +50,30 @@ class ImageGallery
$this->mCaption = $caption;
}
/**
* Instruct the class to use a specific skin for rendering
*
* @param $skin Skin object
*/
function useSkin( $skin ) {
$this->mSkin =& $skin;
}
/**
* Return the skin that should be used
*
* @return Skin object
*/
function getSkin() {
if( !$this->mSkin ) {
global $wgUser;
$skin =& $wgUser->getSkin();
} else {
$skin =& $this->mSkin;
}
return $skin;
}
/**
* Add an image to the gallery.
*
@ -111,6 +136,8 @@ class ImageGallery
function toHTML() {
global $wgLang, $wgIgnoreImageErrors, $wgGenerateThumbnailOnParse;
$sk = $this->getSkin();
$s = '<table class="gallery" cellspacing="0" cellpadding="0">';
if( $this->mCaption )
$s .= '<td class="galleryheader" colspan="4"><big>' . htmlspecialchars( $this->mCaption ) . '</big></td>';
@ -130,7 +157,7 @@ class ImageGallery
else if( $this->mParsing && wfIsBadImage( $nt->getDBkey() ) ) {
# The image is blacklisted, just show it as a text link.
$thumbhtml = '<div style="height: 152px;">'
. Linker::makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . '</div>';
. $sk->makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . '</div>';
} else if( !( $thumb = $img->getThumbnail( 120, 120, $wgGenerateThumbnailOnParse ) ) ) {
# Error generating thumbnail.
$thumbhtml = '<div style="height: 152px;">'
@ -139,11 +166,11 @@ class ImageGallery
else {
$vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
$thumbhtml = '<div class="thumb" style="padding: ' . $vpad . 'px 0;">'
. Linker::makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div>';
. $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div>';
}
//TODO
//$ul = Linker::makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
//$ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
if( $this->mShowBytes ) {
if( $img->exists() ) {
@ -158,7 +185,7 @@ class ImageGallery
}
$textlink = $this->mShowFilename ?
Linker::makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
$sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
'' ;
# ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which

View file

@ -181,6 +181,7 @@ class ImagePage extends Article {
$max = $wgImageLimits[$sizeSel];
$maxWidth = $max[0];
$maxHeight = $max[1];
$sk = $wgUser->getSkin();
if ( $this->img->exists() ) {
# image
@ -253,9 +254,9 @@ class ImagePage extends Article {
if ( $page > 1 ) {
$label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
$link = Linker::makeLinkObj( $this->mTitle, $label, 'page='. ($page-1) );
$link = $sk->makeLinkObj( $this->mTitle, $label, 'page='. ($page-1) );
$this->img->selectPage( $page - 1 );
$thumb1 = Linker::makeThumbLinkObj( $this->img, $link, $label, 'none' );
$thumb1 = $sk->makeThumbLinkObj( $this->img, $link, $label, 'none' );
} else {
$thumb1 = '';
}
@ -263,8 +264,8 @@ class ImagePage extends Article {
if ( $page < $count ) {
$label = wfMsg( 'imgmultipagenext' );
$this->img->selectPage( $page + 1 );
$link = Linker::makeLinkObj( $this->mTitle, $label, 'page='. ($page+1) );
$thumb2 = Linker::makeThumbLinkObj( $this->img, $link, $label, 'none' );
$link = $sk->makeLinkObj( $this->mTitle, $label, 'page='. ($page+1) );
$thumb2 = $sk->makeThumbLinkObj( $this->img, $link, $label, 'none' );
} else {
$thumb2 = '';
}
@ -333,20 +334,22 @@ END
# Image does not exist
$title = SpecialPage::getTitleFor( 'Upload' );
$link = Linker::makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
$link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
'wpDestFile=' . urlencode( $this->img->getName() ) );
$wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
}
}
function printSharedImageText() {
global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut;
global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser;
$url = $wgRepositoryBaseUrl . urlencode($this->mTitle->getDBkey());
$sharedtext = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml("sharedupload");
if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
$sk = $wgUser->getSkin();
$title = SpecialPage::getTitleFor( 'Upload' );
$link = Linker::makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
$link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
array( 'wpDestFile' => urlencode( $this->img->getName() )));
$sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
}
@ -376,16 +379,18 @@ END
if( $this->img->fromSharedDirectory )
return;
$sk = $wgUser->getSkin();
$wgOut->addHtml( '<br /><ul>' );
# "Upload a new version of this file" link
if( $wgUser->isAllowed( 'reupload' ) ) {
$ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
$ulink = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
$wgOut->addHtml( "<li><div>{$ulink}</div></li>" );
}
# External editing link
$elink = Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
$elink = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
$wgOut->addHtml( '<li>' . $elink . '<div>' . wfMsgWikiHtml( 'edit-externally-help' ) . '</div></li>' );
$wgOut->addHtml( '</ul>' );
@ -401,13 +406,16 @@ END
* If the page we've just displayed is in the "Image" namespace,
* we follow it with an upload history of the image and its usage.
*/
function imageHistory() {
global $wgOut, $wgUseExternalEditor;
function imageHistory()
{
global $wgUser, $wgOut, $wgUseExternalEditor;
$sk = $wgUser->getSkin();
$line = $this->img->nextHistoryLine();
if ( $line ) {
$list = new ImageHistoryList();
$list = new ImageHistoryList( $sk );
$s = $list->beginImageHistoryList() .
$list->imageHistoryLine( true, wfTimestamp(TS_MW, $line->img_timestamp),
$this->mTitle->getDBkey(), $line->img_user,
@ -434,8 +442,9 @@ END
}
function imageLinks() {
global $wgOut;
function imageLinks()
{
global $wgUser, $wgOut;
$wgOut->addHTML( '<h2 id="filelinks">' . wfMsg( 'imagelinks' ) . "</h2>\n" );
@ -454,9 +463,10 @@ END
}
$wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" );
$sk = $wgUser->getSkin();
while ( $s = $dbr->fetchObject( $res ) ) {
$name = Title::MakeTitle( $s->page_namespace, $s->page_title );
$link = Linker::makeKnownLinkObj( $name, "" );
$link = $sk->makeKnownLinkObj( $name, "" );
$wgOut->addHTML( "<li>{$link}</li>\n" );
}
$wgOut->addHTML( "</ul>\n" );
@ -689,7 +699,8 @@ END
* @package MediaWiki
*/
class ImageHistoryList {
function ImageHistoryList() {
function ImageHistoryList( &$skin ) {
$this->skin =& $skin;
}
function beginImageHistoryList() {
@ -715,8 +726,11 @@ class ImageHistoryList {
$url = Image::imageUrl( $img );
$rlink = $cur;
if ( $wgUser->isAllowed('delete') ) {
$dlink = Linker::makeKnownLinkObj( $wgTitle, $delall,
'image=' . $wgTitle->getPartialURL() . '&action=delete');
$link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
'&action=delete' );
$style = $this->skin->getInternalLinkAttributes( $link, $delall );
$dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
} else {
$dlink = $del;
}
@ -724,10 +738,10 @@ class ImageHistoryList {
$url = htmlspecialchars( wfImageArchiveUrl( $img ) );
if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) {
$token = urlencode( $wgUser->editToken( $img ) );
$rlink = Linker::makeKnownLinkObj( $wgTitle,
$rlink = $this->skin->makeKnownLinkObj( $wgTitle,
wfMsg( 'revertimg' ), 'action=revert&oldimage=' .
urlencode( $img ) . "&wpEditToken=$token" );
$dlink = Linker::makeKnownLinkObj( $wgTitle,
$dlink = $this->skin->makeKnownLinkObj( $wgTitle,
$del, 'action=delete&oldimage=' . urlencode( $img ) .
"&wpEditToken=$token" );
} else {
@ -739,15 +753,15 @@ class ImageHistoryList {
}
}
$userlink = Linker::userLink( $user, $usertext ) . Linker::userToolLinks( $user, $usertext );
$userlink = $this->skin->userLink( $user, $usertext ) . $this->skin->userToolLinks( $user, $usertext );
$nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
$wgLang->formatNum( $size ) );
$widthheight = wfMsg( 'widthheight', $width, $height );
$style = Linker::getInternalLinkAttributes( $url, $datetime );
$style = $this->skin->getInternalLinkAttributes( $url, $datetime );
$s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})";
$s .= Linker::commentBlock( $description, $wgTitle );
$s .= $this->skin->commentBlock( $description, $wgTitle );
$s .= "</li>\n";
return $s;
}

File diff suppressed because it is too large Load diff

View file

@ -130,7 +130,7 @@ class LogPage {
/**
* @static
*/
static function actionText( $type, $action, $title = NULL, $forContent = true, $params = array(), $filterWikilinks=false, $translate=false ) {
function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
global $wgLang, $wgContLang, $wgLogActions;
$key = "$type/$action";
@ -138,35 +138,37 @@ class LogPage {
if( is_null( $title ) ) {
$rv=wfMsg( $wgLogActions[$key] );
} else {
if( $forContent ) {
$titleLink = $title->getPrefixedText();
} else {
if( $skin ) {
switch( $type ) {
case 'move':
$titleLink = Linker::makeLinkObj( $title, $title->getPrefixedText(), 'redirect=no' );
$params[0] = Linker::makeLinkObj( Title::newFromText( $params[0] ), $params[0] );
$titleLink = $skin->makeLinkObj( $title, $title->getPrefixedText(), 'redirect=no' );
$params[0] = $skin->makeLinkObj( Title::newFromText( $params[0] ), $params[0] );
break;
case 'block':
if( substr( $title->getText(), 0, 1 ) == '#' ) {
$titleLink = $title->getText();
} else {
$titleLink = Linker::makeLinkObj( $title, $title->getText() );
$titleLink .= ' (' . Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() ), wfMsg( 'contribslink' ) ) . ')';
$titleLink = $skin->makeLinkObj( $title, $title->getText() );
$titleLink .= ' (' . $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() ), wfMsg( 'contribslink' ) ) . ')';
}
break;
case 'rights':
$text = $wgContLang->ucfirst( $title->getText() );
$titleLink = Linker::makeLinkObj( Title::makeTitle( NS_USER, $text ) );
$titleLink = $skin->makeLinkObj( Title::makeTitle( NS_USER, $text ) );
break;
default:
$titleLink = Linker::makeLinkObj( $title );
$titleLink = $skin->makeLinkObj( $title );
}
} else {
$titleLink = $title->getPrefixedText();
}
if( $key == 'rights/rights' ) {
if( $forContent ) {
$rightsnone = wfMsgForContent( 'rightsnone' );
} else {
if ($skin) {
$rightsnone = wfMsg( 'rightsnone' );
} else {
$rightsnone = wfMsgForContent( 'rightsnone' );
}
if( !isset( $params[0] ) || trim( $params[0] ) == '' )
$params[0] = $rightsnone;
@ -174,17 +176,17 @@ class LogPage {
$params[1] = $rightsnone;
}
if( count( $params ) == 0 ) {
if ( $forContent ) {
$rv = wfMsgForContent( $wgLogActions[$key], $titleLink );
} else {
if ( $skin ) {
$rv = wfMsg( $wgLogActions[$key], $titleLink );
} else {
$rv = wfMsgForContent( $wgLogActions[$key], $titleLink );
}
} else {
array_unshift( $params, $titleLink );
if ( $translate && $key == 'block/block' ) {
$params[1] = $wgLang->translateBlockExpiry($params[1]);
}
$rv = wfMsgReal( $wgLogActions[$key], $params, true, $forContent );
$rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin );
}
}
} else {
@ -192,8 +194,8 @@ class LogPage {
$rv = "$action";
}
if( $filterWikilinks ) {
$rv = str_replace( '[[', '', $rv );
$rv = str_replace( ']]', '', $rv );
$rv = str_replace( "[[", "", $rv );
$rv = str_replace( "]]", "", $rv );
}
return $rv;
}
@ -213,9 +215,9 @@ class LogPage {
$this->action = $action;
$this->target = $target;
$this->comment = $comment;
$this->params = self::makeParamBlob( $params );
$this->params = LogPage::makeParamBlob( $params );
$this->actionText = self::actionText( $this->type, $action, $target, true, $params );
$this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params );
return $this->saveContent();
}
@ -224,7 +226,7 @@ class LogPage {
* Create a blob from a parameter array
* @static
*/
static function makeParamBlob( $params ) {
function makeParamBlob( $params ) {
return implode( "\n", $params );
}
@ -232,7 +234,7 @@ class LogPage {
* Extract a parameter array from a blob
* @static
*/
static function extractParams( $blob ) {
function extractParams( $blob ) {
if ( $blob === '' ) {
return array();
} else {

View file

@ -231,7 +231,7 @@ class OutputPage {
* Add an array of categories, with names in the keys
*/
public function addCategoryLinks($categories) {
global $wgContLang;
global $wgUser, $wgContLang;
if ( !is_array( $categories ) ) {
return;
@ -242,10 +242,11 @@ class OutputPage {
$lb->setArray( $arr );
$lb->execute();
$sk =& $wgUser->getSkin();
foreach ( $categories as $category => $arbitrary ) {
$title = Title::makeTitleSafe( NS_CATEGORY, $category );
$text = $wgContLang->convertHtml( $title->getText() );
$this->mCategoryLinks[] = Linker::makeLinkObj( $title, $text );
$this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text );
}
}
@ -614,6 +615,9 @@ class OutputPage {
# Buffer output; final headers may depend on later processing
ob_start();
# Disable temporary placeholders, so that the skin produces HTML
$sk->postParseLinkColour( false );
$wgRequest->response()->header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" );
$wgRequest->response()->header( 'Content-language: '.$wgContLanguageCode );
@ -756,7 +760,7 @@ class OutputPage {
* @param string $permission key required
*/
public function permissionRequired( $permission ) {
global $wgGroupPermissions;
global $wgGroupPermissions, $wgUser;
$this->setPageTitle( wfMsg( 'badaccess' ) );
$this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
@ -770,7 +774,8 @@ class OutputPage {
$groupName = User::getGroupName( $key );
$groupPage = User::getGroupPage( $key );
if( $groupPage ) {
$groups[] = '"'.Linker::makeLinkObj( $groupPage, $groupName ).'"';
$skin =& $wgUser->getSkin();
$groups[] = '"'.$skin->makeLinkObj( $groupPage, $groupName ).'"';
} else {
$groups[] = '"'.$groupName.'"';
}
@ -818,13 +823,15 @@ class OutputPage {
return;
}
$skin = $wgUser->getSkin();
$this->setPageTitle( wfMsg( 'loginreqtitle' ) );
$this->setHtmlTitle( wfMsg( 'errorpagetitle' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
$this->setArticleFlag( false );
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
$loginLink = Linker::makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
$loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
$this->addHtml( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
$this->addHtml( "\n<!--" . $wgTitle->getPrefixedUrl() . "-->" );
@ -852,8 +859,9 @@ class OutputPage {
$this->setArticleRelated( false );
if( $protected ) {
$skin = $wgUser->getSkin();
$this->setPageTitle( wfMsg( 'viewsource' ) );
$this->setSubtitle( wfMsg( 'viewsourcefor', Linker::makeKnownLinkObj( $wgTitle ) ) );
$this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
# Determine if protection is due to the page being a system message
# and show an appropriate explanation
@ -957,7 +965,7 @@ class OutputPage {
* @param $returnto page title to return to. Default is Main Page.
*/
public function returnToMain( $auto = true, $returnto = NULL ) {
global $wgOut, $wgRequest;
global $wgUser, $wgOut, $wgRequest;
if ( $returnto == NULL ) {
$returnto = $wgRequest->getText( 'returnto' );
@ -976,7 +984,8 @@ class OutputPage {
$titleObj = Title::newMainPage();
}
$link = Linker::makeLinkObj( $titleObj, '' );
$sk = $wgUser->getSkin();
$link = $sk->makeLinkObj( $titleObj, '' );
$r = wfMsg( 'returnto', $link );
if ( $auto ) {

View file

@ -21,7 +21,7 @@ class PageHistory {
const DIR_PREV = 0;
const DIR_NEXT = 1;
var $mArticle, $mTitle;
var $mArticle, $mTitle, $mSkin;
var $lastdate;
var $linesonpage;
var $mNotificationTimestamp;
@ -34,9 +34,12 @@ class PageHistory {
* @returns nothing
*/
function PageHistory($article) {
global $wgUser;
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
$this->mNotificationTimestamp = NULL;
$this->mSkin = $wgUser->getSkin();
}
/**
@ -68,7 +71,7 @@ class PageHistory {
$wgOut->setSyndicated( true );
$logPage = SpecialPage::getTitleFor( 'Log' );
$logLink = Linker::makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ), 'page=' . $this->mTitle->getPrefixedUrl() );
$logLink = $this->mSkin->makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ), 'page=' . $this->mTitle->getPrefixedUrl() );
$subtitle = wfMsgHtml( 'revhistory' ) . '<br />' . $logLink;
$wgOut->setSubtitle( $subtitle );
@ -175,8 +178,8 @@ class PageHistory {
$arbitrary = $this->diffButtons( $rev, $firstInList, $counter );
$link = $this->revLink( $rev );
$user = Linker::userLink( $rev->getUser(), $rev->getUserText() )
. Linker::userToolLinks( $rev->getUser(), $rev->getUserText() );
$user = $this->mSkin->userLink( $rev->getUser(), $rev->getUserText() )
. $this->mSkin->userToolLinks( $rev->getUser(), $rev->getUserText() );
$s .= "($curlink) ($lastlink) $arbitrary";
@ -186,7 +189,7 @@ class PageHistory {
// We don't currently handle well changing the top revision's settings
$del = wfMsgHtml( 'rev-delundel' );
} else {
$del = Linker::makeKnownLinkObj( $revdel,
$del = $this->mSkin->makeKnownLinkObj( $revdel,
wfMsg( 'rev-delundel' ),
'target=' . urlencode( $this->mTitle->getPrefixedDbkey() ) .
'&oldid=' . urlencode( $rev->getId() ) );
@ -200,7 +203,7 @@ class PageHistory {
$s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
}
$s .= Linker::revComment( $rev );
$s .= $this->mSkin->revComment( $rev );
if ($notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp)) {
$s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
}
@ -217,7 +220,7 @@ class PageHistory {
global $wgLang;
$date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
if( $rev->userCan( Revision::DELETED_TEXT ) ) {
$link = Linker::makeKnownLinkObj(
$link = $this->mSkin->makeKnownLinkObj(
$this->mTitle, $date, "oldid=" . $rev->getId() );
} else {
$link = $date;
@ -234,7 +237,7 @@ class PageHistory {
if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
return $cur;
} else {
return Linker::makeKnownLinkObj(
return $this->mSkin->makeKnownLinkObj(
$this->mTitle, $cur,
'diff=' . $this->getLatestID() .
"&oldid=" . $rev->getId() );
@ -249,14 +252,14 @@ class PageHistory {
return $last;
} elseif ( $next === 'unknown' ) {
# Next row probably exists but is unknown, use an oldid=prev link
return Linker::makeKnownLinkObj(
return $this->mSkin->makeKnownLinkObj(
$this->mTitle,
$last,
"diff=" . $rev->getId() . "&oldid=prev" );
} elseif( !$rev->userCan( Revision::DELETED_TEXT ) ) {
return $last;
} else {
return Linker::makeKnownLinkObj(
return $this->mSkin->makeKnownLinkObj(
$this->mTitle,
$last,
"diff=" . $rev->getId() . "&oldid={$next->rev_id}"

View file

@ -225,7 +225,7 @@ abstract class IndexPager implements Pager {
if ( $query === null ) {
return $text;
} else {
return Linker::makeKnownLinkObj( $this->getTitle(), $text,
return $this->getSkin()->makeKnownLinkObj( $this->getTitle(), $text,
wfArrayToCGI( $query, $this->getDefaultQuery() ) );
}
}
@ -261,6 +261,17 @@ abstract class IndexPager implements Pager {
return $GLOBALS['wgTitle'];
}
/**
* Get the current skin. This can be overridden if necessary.
*/
function getSkin() {
if ( !isset( $this->mSkin ) ) {
global $wgUser;
$this->mSkin = $wgUser->getSkin();
}
return $this->mSkin;
}
/**
* Get an array of query parameters that should be put into self-links.
* By default, all parameters passed in the URL are used, except for a

View file

@ -1037,8 +1037,9 @@ class Parser
substr($m[0], 0, 20 ) . '"' );
}
$url = wfMsg( $urlmsg, $id );
$la = Linker::getExternalLinkAttributes( $url, "$keyword $id" );
$url = wfMsg( $urlmsg, $id);
$sk =& $this->mOptions->getSkin();
$la = $sk->getExternalLinkAttributes( $url, $keyword.$id );
$text = "<a href=\"{$url}\"{$la}>{$keyword} {$id}</a>";
}
return $text;
@ -1257,6 +1258,8 @@ class Parser
$fname = 'Parser::replaceExternalLinks';
wfProfileIn( $fname );
$sk =& $this->mOptions->getSkin();
$bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$s = $this->replaceFreeExternalLinks( array_shift( $bits ) );
@ -1318,7 +1321,7 @@ class Parser
# This means that users can paste URLs directly into the text
# Funny characters like &ouml; aren't valid in URLs anyway
# This was changed in August 2004
$s .= Linker::makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail;
$s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail;
# Register link in the output object.
# Replace unnecessary URL escape codes with the referenced character
@ -1344,6 +1347,8 @@ class Parser
$s = array_shift( $bits );
$i = 0;
$sk =& $this->mOptions->getSkin();
while ( $i < count( $bits ) ){
$protocol = $bits[$i++];
$remainder = $bits[$i++];
@ -1395,7 +1400,7 @@ class Parser
$text = $this->maybeMakeExternalImage( $url );
if ( $text === false ) {
# Not an image, make a link
$text = Linker::makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() );
$text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() );
# Register it in the output object...
# Replace unnecessary URL escape codes with their equivalent characters
$pasteurized = Parser::replaceUnusualEscapes( $url );
@ -1450,6 +1455,7 @@ class Parser
* @private
*/
function maybeMakeExternalImage( $url ) {
$sk =& $this->mOptions->getSkin();
$imagesfrom = $this->mOptions->getAllowExternalImagesFrom();
$imagesexception = !empty($imagesfrom);
$text = false;
@ -1457,7 +1463,7 @@ class Parser
|| ( $imagesexception && strpos( $url, $imagesfrom ) === 0 ) ) {
if ( preg_match( EXT_IMAGE_REGEX, $url ) ) {
# Image found
$text = Linker::makeExternalImage( htmlspecialchars( $url ) );
$text = $sk->makeExternalImage( htmlspecialchars( $url ) );
}
}
return $text;
@ -1479,6 +1485,8 @@ class Parser
# the % is needed to support urlencoded titles as well
if ( !$tc ) { $tc = Title::legalChars() . '#%'; }
$sk =& $this->mOptions->getSkin();
#split the entire text string on occurences of [[
$a = explode( '[[', ' ' . $s );
#get the first element (all text up to first [[), and remove the space we added
@ -1726,13 +1734,13 @@ class Parser
if( ( $nt->getPrefixedText() === $selflink ) &&
( $nt->getFragment() === '' ) ) {
# Self-links are handled specially; generally de-link and change to bold.
$s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
$s .= $prefix . $sk->makeSelfLinkObj( $nt, $text, '', $trail );
continue;
}
# Special and Media are pseudo-namespaces; no pages actually exist in them
if( $ns == NS_MEDIA ) {
$link = Linker::makeMediaLinkObj( $nt, $text );
$link = $sk->makeMediaLinkObj( $nt, $text );
# Cloak with NOPARSE to avoid replacement in replaceExternalLinks
$s .= $prefix . $this->armorLinks( $link ) . $trail;
$this->mOutput->addImage( $nt->getDBkey() );
@ -1807,7 +1815,8 @@ class Parser
*/
function makeKnownLinkHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
list( $inside, $trail ) = Linker::splitTrail( $trail );
$link = Linker::makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
$sk =& $this->mOptions->getSkin();
$link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
return $this->armorLinks( $link ) . $trail;
}
@ -3372,6 +3381,9 @@ class Parser
$enoughToc = false;
}
# We need this to perform operations on the HTML
$sk =& $this->mOptions->getSkin();
# headline counter
$headlineCount = 0;
$sectionCount = 0; # headlineCount excluding template sections
@ -3415,7 +3427,7 @@ class Parser
$toclevel++;
$sublevelCount[$toclevel] = 0;
if( $toclevel<$wgMaxTocLevel ) {
$toc .= Linker::tocIndent();
$toc .= $sk->tocIndent();
}
}
elseif ( $level < $prevlevel && $toclevel > 1 ) {
@ -3439,13 +3451,13 @@ class Parser
}
}
if( $toclevel<$wgMaxTocLevel ) {
$toc .= Linker::tocUnindent( $prevtoclevel - $toclevel );
$toc .= $sk->tocUnindent( $prevtoclevel - $toclevel );
}
}
else {
# No change in level, end TOC line
if( $toclevel<$wgMaxTocLevel ) {
$toc .= Linker::tocLineEnd();
$toc .= $sk->tocLineEnd();
}
}
@ -3505,7 +3517,7 @@ class Parser
$anchor .= '_' . $refcount[$headlineCount];
}
if( $enoughToc && ( !isset($wgMaxTocLevel) || $toclevel<$wgMaxTocLevel ) ) {
$toc .= Linker::tocLine($anchor, $tocline, $numbering, $toclevel);
$toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel);
}
# give headline the correct <h#> tag
@$head[$headlineCount] .= "<a name=\"$anchor\"></a><h".$level.$matches[2][$headlineCount];
@ -3515,9 +3527,9 @@ class Parser
$head[$headlineCount] = '';
}
if( $istemplate )
$head[$headlineCount] .= Linker::editSectionLinkForOther($templatetitle, $templatesection);
$head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection);
else
$head[$headlineCount] .= Linker::editSectionLink($this->mTitle, $sectionCount+1, $headline_hint);
$head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1, $headline_hint);
}
// Yes, the headline logically goes before the edit section. Why isn't it there
// in source? Ask the CSS people. The float gets screwed up if you do that.
@ -3532,9 +3544,9 @@ class Parser
if( $enoughToc ) {
if( $toclevel<$wgMaxTocLevel ) {
$toc .= Linker::tocUnindent( $toclevel - 1 );
$toc .= $sk->tocUnindent( $toclevel - 1 );
}
$toc = Linker::tocList( $toc );
$toc = $sk->tocList( $toc );
}
# split up and insert constructed headlines
@ -3549,7 +3561,7 @@ class Parser
# Disabled because it broke block formatting
# For example, a bullet point in the top line
# $full .= Linker::editSectionLink(0);
# $full .= $sk->editSectionLink(0);
}
$full .= $block;
if( $enoughToc && !$i && $isMain && !$this->mForceTocPosition ) {
@ -3892,7 +3904,7 @@ class Parser
/**
* Replace <!--LINK--> link placeholders with actual links, in the buffer
* Placeholders created in Linker::makeLinkObj()
* Placeholders created in Skin::makeLinkObj()
* Returns an array of links found, indexed by PDBK:
* 0 - broken
* 1 - normal link
@ -3909,6 +3921,7 @@ class Parser
$pdbks = array();
$colours = array();
$sk =& $this->mOptions->getSkin();
$linkCache =& LinkCache::singleton();
if ( !empty( $this->mLinkHolders['namespaces'] ) ) {
@ -4089,15 +4102,15 @@ class Parser
$linkCache->addBadLinkObj( $title );
$colours[$pdbk] = 0;
$this->mOutput->addLink( $title, 0 );
$wgOutputReplace[$searchkey] = Linker::makeBrokenLinkObj( $title,
$wgOutputReplace[$searchkey] = $sk->makeBrokenLinkObj( $title,
$this->mLinkHolders['texts'][$key],
$this->mLinkHolders['queries'][$key] );
} elseif ( $colours[$pdbk] == 1 ) {
$wgOutputReplace[$searchkey] = Linker::makeKnownLinkObj( $title,
$wgOutputReplace[$searchkey] = $sk->makeKnownLinkObj( $title,
$this->mLinkHolders['texts'][$key],
$this->mLinkHolders['queries'][$key] );
} elseif ( $colours[$pdbk] == 2 ) {
$wgOutputReplace[$searchkey] = Linker::makeStubLinkObj( $title,
$wgOutputReplace[$searchkey] = $sk->makeStubLinkObj( $title,
$this->mLinkHolders['texts'][$key],
$this->mLinkHolders['queries'][$key] );
}
@ -4123,7 +4136,7 @@ class Parser
$wgOutputReplace = array();
foreach( $this->mInterwikiLinkHolders['texts'] as $key => $link ) {
$title = $this->mInterwikiLinkHolders['titles'][$key];
$wgOutputReplace[$key] = Linker::makeLinkObj( $title, $link );
$wgOutputReplace[$key] = $sk->makeLinkObj( $title, $link );
}
$text = preg_replace_callback(
@ -4203,6 +4216,7 @@ class Parser
$ig->setShowBytes( false );
$ig->setShowFilename( false );
$ig->setParsing();
$ig->useSkin( $this->mOptions->getSkin() );
if( isset( $params['caption'] ) )
$ig->setCaption( $params['caption'] );
@ -4331,7 +4345,8 @@ class Parser
$alt = Sanitizer::stripAllTags( $alt );
# Linker does the rest
return Linker::makeImageLinkObj( $nt, $caption, $alt, $align, $width, $height, $framed, $thumb, $manual_thumb, $page );
$sk =& $this->mOptions->getSkin();
return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $width, $height, $framed, $thumb, $manual_thumb, $page );
}
/**
@ -4667,6 +4682,7 @@ class ParserOptions
var $mInterwikiMagic; # Interlanguage links are removed and returned in an array
var $mAllowExternalImages; # Allow external images inline
var $mAllowExternalImagesFrom; # If not, any exception?
var $mSkin; # Reference to the preferred skin
var $mDateFormat; # Date format index
var $mEditSection; # Create "edit section" links
var $mNumberHeadings; # Automatically number headings
@ -4676,7 +4692,7 @@ class ParserOptions
var $mMaxIncludeSize; # Maximum size of template expansions, in bytes
var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
var $mUser; # Stored user object, just used to initialise the date format
var $mUser; # Stored user object, just used to initialise the skin
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
@ -4691,6 +4707,13 @@ class ParserOptions
function getMaxIncludeSize() { return $this->mMaxIncludeSize; }
function getRemoveComments() { return $this->mRemoveComments; }
function &getSkin() {
if ( !isset( $this->mSkin ) ) {
$this->mSkin = $this->mUser->getSkin();
}
return $this->mSkin;
}
function getDateFormat() {
if ( !isset( $this->mDateFormat ) ) {
$this->mDateFormat = $this->mUser->getDatePreference();
@ -4708,6 +4731,7 @@ class ParserOptions
function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); }
function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
function setSkin( $x ) { $this->mSkin = $x; }
function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); }
function setMaxIncludeSize( $x ) { return wfSetVar( $this->mMaxIncludeSize, $x ); }
function setRemoveComments( $x ) { return wfSetVar( $this->mRemoveComments, $x ); }
@ -4748,6 +4772,7 @@ class ParserOptions
$this->mInterwikiMagic = $wgInterwikiMagic;
$this->mAllowExternalImages = $wgAllowExternalImages;
$this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom;
$this->mSkin = null; # Deferred
$this->mDateFormat = null; # Deferred
$this->mEditSection = true;
$this->mNumberHeadings = $user->getOption( 'numberheadings' );

View file

@ -156,11 +156,12 @@ class QueryPage {
}
/**
* Formats the results of the query for display. The result is a single
* row of result data. You should be able to grab SQL results off of it.
* Formats the results of the query for display. The skin is the current
* skin; you can use it for making links. The result is a single row of
* result data. You should be able to grab SQL results off of it.
* If the function return "false", the line output will be skipped.
*/
function formatResult( $result ) {
function formatResult( $skin, $result ) {
return '';
}
@ -274,7 +275,7 @@ class QueryPage {
* @param $shownavigation show navigation like "next 200"?
*/
function doQuery( $offset, $limit, $shownavigation=true ) {
global $wgOut, $wgLang, $wgContLang;
global $wgUser, $wgOut, $wgLang, $wgContLang;
$this->offset = $offset;
$this->limit = $limit;
@ -320,6 +321,8 @@ class QueryPage {
$this->preprocessResults( $dbr, $res );
$sk = $wgUser->getSkin( );
if($shownavigation) {
$wgOut->addHTML( $this->getPageHeader() );
$top = wfShowingResults( $offset, $num);
@ -340,7 +343,7 @@ class QueryPage {
# Only read at most $num rows, because $res may contain the whole 1000
for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) {
$format = $this->formatResult( $obj );
$format = $this->formatResult( $sk, $obj );
if ( $format ) {
$attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol &&
$obj->patrolled == 0 ) ? ' class="not-patrolled"' : '';
@ -351,7 +354,7 @@ class QueryPage {
if($this->tryLastResult()) {
// flush the very last result
$obj = null;
$format = $this->formatResult( $obj );
$format = $this->formatResult( $sk, $obj );
if( $format ) {
$attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol &&
$obj->patrolled == 0 ) ? ' class="not-patrolled"' : '';
@ -470,10 +473,10 @@ class QueryPage {
*/
class PageQueryPage extends QueryPage {
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
return Linker::makeKnownLinkObj( $nt, htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ) );
return $skin->makeKnownLinkObj( $nt, htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ) );
}
}

View file

@ -70,7 +70,7 @@ class Skin extends Linker {
*/
static function normalizeKey( $key ) {
global $wgDefaultSkin;
$skinNames = self::getSkinNames();
$skinNames = Skin::getSkinNames();
if( $key == '' ) {
// Don't return the default immediately;
@ -110,9 +110,9 @@ class Skin extends Linker {
static function &newFromKey( $key ) {
global $wgStyleDirectory;
$key = self::normalizeKey( $key );
$key = Skin::normalizeKey( $key );
$skinNames = self::getSkinNames();
$skinNames = Skin::getSkinNames();
$skinName = $skinNames[$key];
# Grab the skin class and initialise it.
@ -579,7 +579,7 @@ END;
$t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop;
$msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks ) );
$s = self::makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
$s = $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
. ': ' . $t;
# optional 'dmoz-like' category browser. Will be shown under the list
@ -591,7 +591,7 @@ END;
$parenttree = $wgTitle->getParentCategoryTree();
# Skin object passed by reference cause it can not be
# accessed under the method subfunction drawCategoryBrowser
$tempout = explode("\n", self::drawCategoryBrowser($parenttree, $this) );
$tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) );
# Clean out bogus first entry and sort them
unset($tempout[0]);
asort($tempout);
@ -602,14 +602,12 @@ END;
return $s;
}
/**
* Render the array as a series of links.
* @param $tree Array categories tree returned by Title::getParentCategoryTree
* @param &skin Object skin passed by reference
/** Render the array as a serie of links.
* @param $tree Array: categories tree returned by Title::getParentCategoryTree
* @param &skin Object: skin passed by reference
* @return String separated by &gt;, terminate with "\n"
* @static
*/
static function drawCategoryBrowser($tree, &$skin) {
function drawCategoryBrowser($tree, &$skin) {
$return = '';
foreach ($tree as $element => $parent) {
if (empty($parent)) {
@ -617,11 +615,11 @@ END;
$return .= "\n";
} else {
# grab the others elements
$return .= self::drawCategoryBrowser($parent, $skin) . ' &gt; ';
$return .= Skin::drawCategoryBrowser($parent, $skin) . ' &gt; ';
}
# add our current element to the list
$eltitle = Title::NewFromText($element);
$return .= self::makeLinkObj( $eltitle, $eltitle->getText() ) ;
$return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
}
return $return;
}
@ -692,13 +690,13 @@ END;
$image = new Image( $wgTitle );
if( $image->exists() ) {
$link = htmlspecialchars( $image->getURL() );
$style = self::getInternalLinkAttributes( $link, $name );
$style = $this->getInternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
}
}
}
if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
$s .= ' | ' . self::makeKnownLinkObj( $wgTitle,
$s .= ' | ' . $this->makeKnownLinkObj( $wgTitle,
wfMsg( 'currentrev' ) );
}
@ -706,8 +704,8 @@ END;
# do not show "You have new messages" text when we are viewing our
# own talk page
if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
$tl = self::makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
$dl = self::makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
$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>';
# disable caching
$wgOut->setSquidMaxage(0);
@ -734,7 +732,7 @@ END;
$msg = 'viewdeleted';
}
return wfMsg( $msg,
self::makeKnownLink(
$this->makeKnownLink(
$wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) );
}
@ -796,7 +794,7 @@ END;
$c++;
if ($c<count($links)) {
$growinglink .= $link;
$getlink = self::makeLink( $growinglink, htmlspecialchars( $link ) );
$getlink = $this->makeLink( $growinglink, htmlspecialchars( $link ) );
if(preg_match('/class="new"/i',$getlink)) { break; } # this is a hack, but it saves time
if ($c>1) {
$subpages .= ' | ';
@ -823,7 +821,7 @@ END;
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
$n = wfGetIP();
$tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
$s .= $n . ' ('.$tl.')';
@ -836,24 +834,24 @@ END;
$q = '';
} else { $q = "returnto={$rt}"; }
$s .= "\n<br />" . self::makeKnownLinkObj(
$s .= "\n<br />" . $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Userlogin' ),
wfMsg( 'login' ), $q );
} else {
$n = $wgUser->getName();
$rt = $wgTitle->getPrefixedURL();
$tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
$tl = " ({$tl})";
$s .= self::makeKnownLinkObj( $wgUser->getUserPage(),
$s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
$n ) . "{$tl}<br />" .
self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
$this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
"returnto={$rt}" ) . ' | ' .
self::specialLink( 'preferences' );
$this->specialLink( 'preferences' );
}
$s .= ' | ' . self::makeKnownLink( wfMsgForContent( 'helppage' ),
$s .= ' | ' . $this->makeKnownLink( wfMsgForContent( 'helppage' ),
wfMsg( 'help' ) );
return $s;
@ -887,7 +885,7 @@ END;
$sep = " |\n";
$s = $this->mainPageLink() . $sep
. self::specialLink( 'recentchanges' );
. $this->specialLink( 'recentchanges' );
if ( $wgOut->isArticleRelated() ) {
$s .= $sep . $this->editThisPage()
@ -1044,9 +1042,9 @@ END;
$out = '';
if( $wgRightsPage ) {
$link = self::makeKnownLink( $wgRightsPage, $wgRightsText );
$link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
} elseif( $wgRightsUrl ) {
$link = self::makeExternalLink( $wgRightsUrl, $wgRightsText );
$link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
} else {
# Give up now
return $out;
@ -1150,12 +1148,12 @@ END;
function mainPageLink() {
$mp = wfMsgForContent( 'mainpage' );
$mptxt = wfMsg( 'mainpage');
$s = self::makeKnownLink( $mp, $mptxt );
$s = $this->makeKnownLink( $mp, $mptxt );
return $s;
}
function copyrightLink() {
$s = self::makeKnownLink( wfMsgForContent( 'copyrightpage' ),
$s = $this->makeKnownLink( wfMsgForContent( 'copyrightpage' ),
wfMsg( 'copyrightpagename' ) );
return $s;
}
@ -1165,12 +1163,12 @@ END;
if ($privacy == '-') {
return '';
} else {
return self::makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
return $this->makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
}
}
function aboutLink() {
$s = self::makeKnownLink( wfMsgForContent( 'aboutpage' ),
$s = $this->makeKnownLink( wfMsgForContent( 'aboutpage' ),
wfMsg( 'aboutsite' ) );
return $s;
}
@ -1180,7 +1178,7 @@ END;
if ($disclaimers == '-') {
return '';
} else {
return self::makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
$disclaimers );
}
}
@ -1197,7 +1195,7 @@ END;
$t = wfMsg( 'viewsource' );
}
$s = self::makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
$s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
}
return $s;
}
@ -1226,7 +1224,7 @@ END;
if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
$t = wfMsg( 'deletethispage' );
$s = self::makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
$s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
} else {
$s = '';
}
@ -1245,7 +1243,7 @@ END;
$t = wfMsg( 'protectthispage' );
$q = 'action=protect';
}
$s = self::makeKnownLinkObj( $wgTitle, $t, $q );
$s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
} else {
$s = '';
}
@ -1263,7 +1261,7 @@ END;
$t = wfMsg( 'watchthispage' );
$q = 'action=watch';
}
$s = self::makeKnownLinkObj( $wgTitle, $t, $q );
$s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
} else {
$s = wfMsg( 'notanarticle' );
}
@ -1274,7 +1272,7 @@ END;
global $wgTitle;
if ( $wgTitle->userCanMove() ) {
return self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
} else {
// no message if page is protected - would be redundant
@ -1285,14 +1283,14 @@ END;
function historyLink() {
global $wgTitle;
return self::makeKnownLinkObj( $wgTitle,
return $this->makeKnownLinkObj( $wgTitle,
wfMsg( 'history' ), 'action=history' );
}
function whatLinksHere() {
global $wgTitle;
return self::makeKnownLinkObj(
return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Whatlinkshere', $wgTitle->getPrefixedDBkey() ),
wfMsg( 'whatlinkshere' ) );
}
@ -1300,7 +1298,7 @@ END;
function userContribsLink() {
global $wgTitle;
return self::makeKnownLinkObj(
return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Contributions', $wgTitle->getDBkey() ),
wfMsg( 'contributions' ) );
}
@ -1319,7 +1317,7 @@ END;
function emailUserLink() {
global $wgTitle;
return self::makeKnownLinkObj(
return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ),
wfMsg( 'emailuser' ) );
}
@ -1330,7 +1328,7 @@ END;
if ( ! $wgOut->isArticleRelated() ) {
return '(' . wfMsg( 'notanarticle' ) . ')';
} else {
return self::makeKnownLinkObj(
return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ),
wfMsg( 'recentchangeslinked' ) );
}
@ -1367,7 +1365,7 @@ END;
$text = $wgContLang->getLanguageName( $nt->getInterwiki() );
if ( '' == $text ) { $text = $l; }
$style = self::getExternalLinkAttributes( $l, $text );
$style = $this->getExternalLinkAttributes( $l, $text );
$s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
}
if($wgContLang->isRTL()) $s .= '</span>';
@ -1375,7 +1373,7 @@ END;
}
function bugReportsLink() {
$s = self::makeKnownLink( wfMsgForContent( 'bugreportspage' ),
$s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
wfMsg( 'bugreports' ) );
return $s;
}
@ -1387,18 +1385,18 @@ END;
$id = $t1->getArticleID();
if ( 0 == $id ) {
$s = self::makeBrokenLink( $t1->getText() );
$s = $this->makeBrokenLink( $t1->getText() );
} else {
$s = self::makeKnownLink( $t1->getText() );
$s = $this->makeKnownLink( $t1->getText() );
}
$s .= ', ';
$id = $t2->getArticleID();
if ( 0 == $id ) {
$s .= self::makeBrokenLink( $t2->getText() );
$s .= $this->makeBrokenLink( $t2->getText() );
} else {
$s .= self::makeKnownLink( $t2->getText() );
$s .= $this->makeKnownLink( $t2->getText() );
}
return $s;
}
@ -1446,7 +1444,7 @@ END;
$text = wfMsg( 'talkpage' );
}
$s = self::makeLinkObj( $link, $text );
$s = $this->makeLinkObj( $link, $text );
return $s;
}
@ -1469,7 +1467,7 @@ END;
$title =& $wgTitle->getTalkPage();
}
return self::makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit&section=new' );
return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit&section=new' );
}
/* these are used extensively in SkinTemplate, but also some other places */

View file

@ -295,12 +295,12 @@ class SkinTemplate extends Skin {
$usertalktitle = $usertitle->getTalkPage();
if( !$usertalktitle->equals( $this->mTitle ) ) {
$ntl = wfMsg( 'youhavenewmessages',
self::makeKnownLinkObj(
$this->makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessageslink' ),
'redirect=no'
),
self::makeKnownLinkObj(
$this->makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessagesdifflink' ),
'diff=cur'

View file

@ -83,7 +83,8 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
* @param integer $namespace (default NS_MAIN)
*/
function showToplevel ( $namespace = NS_MAIN, $including = false ) {
global $wgOut;
global $wgOut, $wgUser;
$sk = $wgUser->getSkin();
$fname = "indexShowToplevel";
# TODO: Either make this *much* faster or cache the title index points
@ -184,6 +185,8 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) {
* @param integer $namespace (Default NS_MAIN)
*/
function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
global $wgUser;
$sk = $wgUser->getSkin();
$dbr =& wfGetDB( DB_SLAVE );
$inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
@ -205,10 +208,12 @@ function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
* @param string $from list all pages from this name (default FALSE)
*/
function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
global $wgOut, $wgContLang;
global $wgOut, $wgUser, $wgContLang;
$fname = 'indexShowChunk';
$sk = $wgUser->getSkin();
$fromList = $this->getNamespaceKeyAndText($namespace, $from);
if ( !$fromList ) {
@ -241,7 +246,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if( $t ) {
$link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
Linker::makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
$sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
($s->page_is_redirect ? '</div>' : '' );
} else {
$link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
@ -268,12 +273,12 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
$out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">';
$out2 .= '<tr valign="top"><td align="left">' . $nsForm;
$out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' .
Linker::makeKnownLink( $wgContLang->specialPage( "Allpages" ),
$sk->makeKnownLink( $wgContLang->specialPage( "Allpages" ),
wfMsgHtml ( 'allpages' ) );
if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
$self = SpecialPage::getTitleFor( 'Allpages' );
$q = 'from=' . $t->getPartialUrl() . ( $namespace ? '&namespace=' . $namespace : '' );
$out2 .= ' | ' . Linker::makeKnownLinkObj( $self, wfMsgHtml( 'nextpage', $t->getText() ), $q );
$out2 .= ' | ' . $sk->makeKnownLinkObj( $self, wfMsgHtml( 'nextpage', $t->getText() ), $q );
}
$out2 .= "</td></tr></table><hr />";
}

View file

@ -44,12 +44,12 @@ class AncientPagesPage extends QueryPage {
return false;
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
$title = Title::makeTitle( $result->namespace, $result->title );
$link = Linker::makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
$link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
return wfSpecialList($link, $d);
}
}

View file

@ -45,7 +45,7 @@ class BrokenRedirectsPage extends PageQueryPage {
return '';
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang;
$fromObj = Title::makeTitle( $result->namespace, $result->title );
@ -62,12 +62,12 @@ class BrokenRedirectsPage extends PageQueryPage {
// $toObj may very easily be false if the $result list is cached
if ( !is_object( $toObj ) ) {
return '<s>' . Linker::makeLinkObj( $fromObj ) . '</s>';
return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
}
$from = Linker::makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
$edit = Linker::makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
$to = Linker::makeBrokenLinkObj( $toObj );
$from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
$edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
$to = $skin->makeBrokenLinkObj( $toObj );
$arr = $wgContLang->getArrow();
return "$from $edit $arr $to";

View file

@ -44,10 +44,10 @@ class CategoriesPage extends QueryPage {
return false;
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang;
$title = Title::makeTitle( NS_CATEGORY, $result->title );
$plink = Linker::makeLinkObj( $title, $title->getText() );
$plink = $skin->makeLinkObj( $title, $title->getText() );
$nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->count ) );
return wfSpecialList($plink, $nlinks);

View file

@ -38,7 +38,8 @@ class EmailConfirmation extends SpecialPage {
} else {
$title = SpecialPage::getTitleFor( 'Userlogin' );
$self = SpecialPage::getTitleFor( 'Confirmemail' );
$llink = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $self->getPrefixedUrl() );
$skin = $wgUser->getSkin();
$llink = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $self->getPrefixedUrl() );
$wgOut->addHtml( wfMsgWikiHtml( 'confirmemail_needlogin', $llink ) );
}
} else {

View file

@ -291,8 +291,9 @@ function wfSpecialContributions( $par = null ) {
$wgOut->addHTML( "<ul>\n" );
$sk = $wgUser->getSkin();
foreach ( $contribs as $contrib )
$wgOut->addHTML( ucListEdit( $contrib ) );
$wgOut->addHTML( ucListEdit( $sk, $contrib ) );
$wgOut->addHTML( "</ul>\n" );
$wgOut->addHTML( "<p>{$prevnextbits}</p>\n" );
@ -305,26 +306,27 @@ function wfSpecialContributions( $par = null ) {
function contributionsSub( $nt ) {
global $wgSysopUserBans, $wgLang, $wgUser;
$sk = $wgUser->getSkin();
$id = User::idFromName( $nt->getText() );
if ( 0 == $id ) {
$ul = $nt->getText();
} else {
$ul = Linker::makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
$ul = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
}
$talk = $nt->getTalkPage();
if( $talk ) {
# Talk page link
$tools[] = Linker::makeLinkObj( $talk, $wgLang->getNsText( NS_TALK ) );
$tools[] = $sk->makeLinkObj( $talk, $wgLang->getNsText( NS_TALK ) );
if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && User::isIP( $nt->getText() ) ) ) {
# Block link
if( $wgUser->isAllowed( 'block' ) )
$tools[] = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ), wfMsgHtml( 'blocklink' ) );
$tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ), wfMsgHtml( 'blocklink' ) );
# Block log link
$tools[] = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), htmlspecialchars( LogPage::logName( 'block' ) ), 'type=block&page=' . $nt->getPrefixedUrl() );
$tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), htmlspecialchars( LogPage::logName( 'block' ) ), 'type=block&page=' . $nt->getPrefixedUrl() );
}
# Other logs link
$tools[] = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), 'user=' . $nt->getPartialUrl() );
$tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), 'user=' . $nt->getPartialUrl() );
$ul .= ' (' . implode( ' | ', $tools ) . ')';
}
return $ul;
@ -375,7 +377,7 @@ function contributionsForm( $options ) {
*
* @todo This would probably look a lot nicer in a table.
*/
function ucListEdit( $row ) {
function ucListEdit( $sk, $row ) {
$fname = 'ucListEdit';
wfProfileIn( $fname );
@ -390,12 +392,12 @@ function ucListEdit( $row ) {
$rev = new Revision( $row );
$page = Title::makeTitle( $row->page_namespace, $row->page_title );
$link = Linker::makeKnownLinkObj( $page );
$link = $sk->makeKnownLinkObj( $page );
$difftext = $topmarktext = '';
if( $row->rev_id == $row->page_latest ) {
$topmarktext .= '<strong>' . $messages['uctop'] . '</strong>';
if( !$row->page_is_new ) {
$difftext .= '(' . Linker::makeKnownLinkObj( $page, $messages['diff'], 'diff=0' ) . ')';
$difftext .= '(' . $sk->makeKnownLinkObj( $page, $messages['diff'], 'diff=0' ) . ')';
} else {
$difftext .= $messages['newarticle'];
}
@ -404,20 +406,20 @@ function ucListEdit( $row ) {
$extraRollback = $wgRequest->getBool( 'bot' ) ? '&bot=1' : '';
$extraRollback .= '&token=' . urlencode(
$wgUser->editToken( array( $page->getPrefixedText(), $row->rev_user_text ) ) );
$topmarktext .= ' ['. Linker::makeKnownLinkObj( $page,
$topmarktext .= ' ['. $sk->makeKnownLinkObj( $page,
$messages['rollbacklink'],
'action=rollback&from=' . urlencode( $row->rev_user_text ) . $extraRollback ) .']';
}
}
if( $rev->userCan( Revision::DELETED_TEXT ) ) {
$difftext = '(' . Linker::makeKnownLinkObj( $page, $messages['diff'], 'diff=prev&oldid='.$row->rev_id ) . ')';
$difftext = '(' . $sk->makeKnownLinkObj( $page, $messages['diff'], 'diff=prev&oldid='.$row->rev_id ) . ')';
} else {
$difftext = '(' . $messages['diff'] . ')';
}
$histlink = '(' . Linker::makeKnownLinkObj( $page, $messages['hist'], 'action=history' ) . ')';
$histlink='('.$sk->makeKnownLinkObj( $page, $messages['hist'], 'action=history' ) . ')';
$comment = Linker::revComment( $rev );
$comment = $sk->revComment( $rev );
$d = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {

View file

@ -23,8 +23,11 @@ class DisambiguationsPage extends PageQueryPage {
return Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage');
}
function getPageHeader() {
return '<p>'.wfMsg('disambiguationstext', Linker::makeKnownLinkObj($this->getDisambiguationPageObj()))."</p><br />\n";
function getPageHeader( ) {
global $wgUser;
$sk = $wgUser->getSkin();
return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLinkObj($this->getDisambiguationPageObj()))."</p><br />\n";
}
function getSQL() {
@ -85,15 +88,15 @@ class DisambiguationsPage extends PageQueryPage {
return '';
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang;
$title = Title::newFromId( $result->value );
$dp = Title::makeTitle( $result->namespace, $result->title );
$from = Linker::makeKnownLinkObj( $title,'');
$edit = Linker::makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
$from = $skin->makeKnownLinkObj( $title,'');
$edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
$arr = $wgContLang->getArrow();
$to = Linker::makeKnownLinkObj( $dp,'');
$to = $skin->makeKnownLinkObj( $dp,'');
return "$from $edit $arr $to";
}

View file

@ -61,7 +61,7 @@ class DoubleRedirectsPage extends PageQueryPage {
return '';
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang;
$fname = 'DoubleRedirectsPage::formatResult';
@ -83,10 +83,10 @@ class DoubleRedirectsPage extends PageQueryPage {
$titleB = Title::makeTitle( $result->nsb, $result->tb );
$titleC = Title::makeTitle( $result->nsc, $result->tc );
$linkA = Linker::makeKnownLinkObj( $titleA,'', 'redirect=no' );
$edit = Linker::makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
$linkB = Linker::makeKnownLinkObj( $titleB, '', 'redirect=no' );
$linkC = Linker::makeKnownLinkObj( $titleC );
$linkA = $skin->makeKnownLinkObj( $titleA,'', 'redirect=no' );
$edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
$linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
$linkC = $skin->makeKnownLinkObj( $titleC );
$arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );

View file

@ -112,7 +112,7 @@ class ImageListPager extends TablePager {
$name = $this->mCurrentRow->img_name;
$ilink = "<a href=\"" . htmlspecialchars( Image::imageUrl( $name ) ) .
"\">" . $this->mMessages['imgfile'] . "</a>";
$desc = Linker::makeKnownLinkObj( Title::makeTitle( NS_IMAGE, $name ),
$desc = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_IMAGE, $name ),
$this->mMessages['imgdesc'] );
return "$desc | $ilink";
case 'img_timestamp':
@ -121,7 +121,7 @@ class ImageListPager extends TablePager {
return htmlspecialchars( $value );
case 'img_user_text':
if ( $this->mCurrentRow->img_user ) {
$link = Linker::makeLinkObj( Title::makeTitle( NS_USER, $value ),
$link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ),
htmlspecialchars( $value ) );
} else {
$link = htmlspecialchars( $value );
@ -130,7 +130,7 @@ class ImageListPager extends TablePager {
case 'img_size':
return $wgLang->formatNum( $value );
case 'img_description':
return Linker::commentBlock( $value );
return $this->getSkin()->commentBlock( $value );
}
}

View file

@ -176,14 +176,16 @@ class ImportReporter {
}
function reportPage( $title, $origTitle, $revisionCount, $successCount ) {
global $wgOut, $wgLang, $wgContLang;
global $wgOut, $wgUser, $wgLang, $wgContLang;
$skin = $wgUser->getSkin();
$this->mPageCount++;
$localCount = $wgLang->formatNum( $successCount );
$contentCount = $wgContLang->formatNum( $successCount );
$wgOut->addHtml( "<li>" . Linker::makeKnownLinkObj( $title ) .
$wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) .
" " .
wfMsgExt( 'import-revision-count', array( 'parsemag', 'escape' ), $localCount ) .
"</li>\n" );

View file

@ -234,8 +234,10 @@ class IPUnblockForm {
wfProfileIn( __METHOD__ );
static $msg=null;
static $sk=null, $msg=null;
if( is_null( $sk ) )
$sk = $wgUser->getSkin();
if( is_null( $msg ) ) {
$msg = array();
$keys = array( 'infiniteblock', 'expiringblock', 'contribslink', 'unblocklink',
@ -249,15 +251,15 @@ class IPUnblockForm {
# Prepare links to the blocker's user and talk pages
$blocker_name = $block->getByName();
$blocker = Linker::makeLinkObj( Title::makeTitle( NS_USER, $blocker_name ), $blocker_name );
$blocker .= ' (' . Linker::makeLinkObj( Title::makeTitle( NS_USER_TALK, $blocker_name ), $wgLang->getNsText( NS_TALK ) ) . ')';
$blocker = $sk->MakeLinkObj( Title::makeTitle( NS_USER, $blocker_name ), $blocker_name );
$blocker .= ' (' . $sk->makeLinkObj( Title::makeTitle( NS_USER_TALK, $blocker_name ), $wgLang->getNsText( NS_TALK ) ) . ')';
# Prepare links to the block target's user and contribs. pages (as applicable, don't do it for autoblocks)
if( $block->mAuto ) {
$target = $block->getRedactedName(); # Hide the IP addresses of auto-blocks; privacy
} else {
$target = Linker::makeLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress );
$target .= ' (' . Linker::makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $block->mAddress ), $msg['contribslink'] ) . ')';
$target = $sk->makeLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress );
$target .= ' (' . $sk->makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $block->mAddress ), $msg['contribslink'] ) . ')';
}
$formattedTime = $wgLang->timeanddate( $block->mTimestamp, true );
@ -287,9 +289,9 @@ class IPUnblockForm {
if ( $wgUser->isAllowed('block') ) {
$titleObj = SpecialPage::getTitleFor( "Ipblocklist" );
$s .= ' (' . Linker::makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')';
$s .= ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')';
}
$s .= Linker::commentBlock( $block->mReason );
$s .= $sk->commentBlock( $block->mReason );
$s .= "</li>\n";
wfProfileOut( __METHOD__ );
return $s;

View file

@ -27,13 +27,13 @@ class ListredirectsPage extends QueryPage {
return( $sql );
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang;
# Make a link to the redirect itself
$rd_title = Title::makeTitle( $result->namespace, $result->title );
$arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
$rd_link = Linker::makeKnownLinkObj( $rd_title, '', 'redirect=no' );
$rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
# Find out where the redirect leads
$revision = Revision::newFromTitle( $rd_title );
@ -41,7 +41,7 @@ class ListredirectsPage extends QueryPage {
# Make a link to the destination page
$target = Title::newFromRedirect( $revision->getText() );
if( $target ) {
$targetLink = Linker::makeLinkObj( $target );
$targetLink = $skin->makeLinkObj( $target );
} else {
/** @todo Put in some decent error display here */
$targetLink = '*';

View file

@ -173,9 +173,9 @@ class ListUsersPage extends QueryPage {
return false;
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
$userPage = Title::makeTitle( $result->namespace, $result->title );
$name = Linker::makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
$name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
$groups = null;
if( !isset( $result->numgroups ) || $result->numgroups > 0 ) {

View file

@ -218,6 +218,8 @@ class LogViewer {
* @param LogReader &$reader where to get our data from
*/
function LogViewer( &$reader ) {
global $wgUser;
$this->skin =& $wgUser->getSkin();
$this->reader =& $reader;
}
@ -314,15 +316,15 @@ class LogViewer {
$linkCache->addBadLinkObj( $title );
}
$userLink = Linker::userLink( $s->log_user, $s->user_name ) . Linker::userToolLinks( $s->log_user, $s->user_name );
$comment = Linker::commentBlock( $s->log_comment );
$userLink = $this->skin->userLink( $s->log_user, $s->user_name ) . $this->skin->userToolLinks( $s->log_user, $s->user_name );
$comment = $this->skin->commentBlock( $s->log_comment );
$paramArray = LogPage::extractParams( $s->log_params );
$revert = '';
if ( $s->log_type == 'move' && isset( $paramArray[0] ) ) {
$specialTitle = SpecialPage::getTitleFor( 'Movepage' );
$destTitle = Title::newFromText( $paramArray[0] );
if ( $destTitle ) {
$revert = '(' . Linker::makeKnownLinkObj( $specialTitle, wfMsg( 'revertmove' ),
$revert = '(' . $this->skin->makeKnownLinkObj( $specialTitle, wfMsg( 'revertmove' ),
'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
'&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
'&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
@ -330,7 +332,7 @@ class LogViewer {
}
}
$action = LogPage::actionText( $s->log_type, $s->log_action, $title, false, $paramArray, true, true );
$action = LogPage::actionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true );
$out = "<li>$time $userLink $action $comment $revert</li>\n";
return $out;
}

View file

@ -59,19 +59,19 @@ class MIMEsearchPage extends QueryPage {
";
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang, $wgLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getText() );
$plink = Linker::makeLink( $nt->getPrefixedText(), $text );
$plink = $skin->makeLink( $nt->getPrefixedText(), $text );
$download = Linker::makeMediaLink( $nt->getText(), 'fuck me!', wfMsgHtml( 'download' ) );
$download = $skin->makeMediaLink( $nt->getText(), 'fuck me!', wfMsgHtml( 'download' ) );
$bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->img_size ) );
$dimensions = wfMsg( 'widthheight', $wgLang->formatNum( $result->img_width ),
$wgLang->formatNum( $result->img_height ) );
$user = Linker::makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
$user = $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
$time = $wgLang->timeanddate( $result->img_timestamp );
return "($download) $plink . . $dimensions . . $bytes . . $user . . $time";

View file

@ -36,18 +36,18 @@ class MostcategoriesPage extends QueryPage {
";
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang, $wgLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
$plink = Linker::makeKnownLink( $nt->getPrefixedText(), $text );
$plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
$nl = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ),
$wgLang->formatNum( $result->value ) );
$nlink = Linker::makeKnownLink( $wgContLang->specialPage( 'Categories' ),
$nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Categories' ),
$nl, 'article=' . $nt->getPrefixedURL() );
return wfSpecialList($plink, $nlink);

View file

@ -34,17 +34,17 @@ class MostimagesPage extends QueryPage {
";
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
$plink = Linker::makeKnownLink( $nt->getPrefixedText(), $text );
$plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
$nl = wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
$wgLang->formatNum ( $result->value ) );
$nlink = Linker::makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
$nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
return wfSpecialList($plink, $nlink);
}

View file

@ -58,26 +58,28 @@ class MostlinkedPage extends QueryPage {
* Make a link to "what links here" for the specified title
*
* @param $title Title being queried
* @param $skin Skin to use
* @return string
*/
function makeWlhLink( &$title, $caption ) {
function makeWlhLink( &$title, $caption, &$skin ) {
$wlh = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedDBkey() );
return Linker::makeKnownLinkObj( $wlh, $caption );
return $skin->makeKnownLinkObj( $wlh, $caption );
}
/**
* Make links to the page corresponding to the item, and the "what links here" page for it
*
* @param $skin Skin to be used
* @param $result Result row
* @return string
*/
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang;
$title = Title::makeTitleSafe( $result->namespace, $result->title );
$link = Linker::makeLinkObj( $title );
$link = $skin->makeLinkObj( $title );
$wlh = $this->makeWlhLink( $title,
wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) ) );
$wgLang->formatNum( $result->value ) ), $skin );
return wfSpecialList( $link, $wlh );
}
}

View file

@ -53,13 +53,13 @@ class MostlinkedCategoriesPage extends QueryPage {
$db->dataSeek( $res, 0 );
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getText() );
$plink = Linker::makeLinkObj( $nt, htmlspecialchars( $text ) );
$plink = $skin->makeLinkObj( $nt, htmlspecialchars( $text ) );
$nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );

View file

@ -38,17 +38,17 @@ class MostrevisionsPage extends QueryPage {
";
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
$plink = Linker::makeKnownLinkObj( $nt, $text );
$plink = $skin->makeKnownLinkObj( $nt, $text );
$nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );
$nlink = Linker::makeKnownLinkObj( $nt, $nl, 'action=history' );
$nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
return wfSpecialList($plink, $nlink);
}

View file

@ -9,10 +9,11 @@
*
*/
function wfSpecialNewimages( $par, $specialPage ) {
global $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions;
global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions;
$wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
$dbr =& wfGetDB( DB_SLAVE );
$sk = $wgUser->getSkin();
$shownav = !$specialPage->including();
$hidebots = $wgRequest->getBool('hidebots',1);
@ -134,7 +135,7 @@ function wfSpecialNewimages( $par, $specialPage ) {
$nt = Title::newFromText( $name, NS_IMAGE );
$img = new Image( $nt );
$ul = Linker::makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
$ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
$gallery->add( $img, "$ul<br />\n<i>".$wgLang->timeanddate( $s->img_timestamp, true )."</i><br />\n" );
@ -176,18 +177,18 @@ function wfSpecialNewimages( $par, $specialPage ) {
}
$now = wfTimestampNow();
$date = $wgLang->timeanddate( $now, true );
$dateLink = Linker::makeKnownLinkObj( $titleObj, wfMsg( 'sp-newimages-showfrom', $date ), 'from='.$now.$botpar.$searchpar );
$dateLink = $sk->makeKnownLinkObj( $titleObj, wfMsg( 'sp-newimages-showfrom', $date ), 'from='.$now.$botpar.$searchpar );
$botLink = Linker::makeKnownLinkObj($titleObj, wfMsg( 'showhidebots', ($hidebots ? wfMsg('show') : wfMsg('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar);
$botLink = $sk->makeKnownLinkObj($titleObj, wfMsg( 'showhidebots', ($hidebots ? wfMsg('show') : wfMsg('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar);
$prevLink = wfMsg( 'prevn', $wgLang->formatNum( $limit ) );
if( $firstTimestamp && $firstTimestamp != $latestTimestamp ) {
$prevLink = Linker::makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar );
$prevLink = $sk->makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar );
}
$nextLink = wfMsg( 'nextn', $wgLang->formatNum( $limit ) );
if( $shownImages > $limit && $lastTimestamp ) {
$nextLink = Linker::makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar );
$nextLink = $sk->makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar );
}
$prevnext = '<p>' . $botLink . ' '. wfMsg( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'</p>';

View file

@ -84,20 +84,21 @@ class NewPagesPage extends QueryPage {
/**
* Format a row, providing the timestamp, links to the page/history, size, user links, and a comment
*
* @param $skin Skin to use
* @param $result Result row
* @return string
*/
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$dm = $wgContLang->getDirMark();
$title = Title::makeTitleSafe( $result->namespace, $result->title );
$time = $wgLang->timeAndDate( $result->timestamp, true );
$plink = Linker::makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rcid : '' );
$hist = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$plink = $skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rcid : '' );
$hist = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$length = wfMsgHtml( 'nbytes', $wgLang->formatNum( htmlspecialchars( $result->length ) ) );
$ulink = Linker::userLink( $result->user, $result->user_text ) . Linker::userToolLinks( $result->user, $result->user_text );
$comment = Linker::commentBlock( $result->comment );
$ulink = $skin->userLink( $result->user, $result->user_text ) . $skin->userToolLinks( $result->user, $result->user_text );
$comment = $skin->commentBlock( $result->comment );
return "{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment}";
}

View file

@ -35,10 +35,10 @@ class PopularPagesPage extends QueryPage {
WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$title = Title::makeTitle( $result->namespace, $result->title );
$link = Linker::makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
$link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
$nv = wfMsgExt( 'nviews', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );
return wfSpecialList($link, $nv);

View file

@ -506,8 +506,9 @@ class PreferencesForm {
$disableEmailPrefs = false;
} else {
$disableEmailPrefs = true;
$skin = $wgUser->getSkin();
$emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
$skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
wfMsg( 'emailconfirmlink' ) );
}
} else {

View file

@ -56,10 +56,12 @@ class SpecialPrefixindex extends SpecialAllpages {
* @param string $from list all pages from this name (default FALSE)
*/
function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = null ) {
global $wgOut, $wgContLang;
global $wgOut, $wgUser, $wgContLang;
$fname = 'indexShowChunk';
$sk = $wgUser->getSkin();
if (!isset($from)) $from = $prefix;
$fromList = $this->getNamespaceKeyAndText($namespace, $from);
@ -100,7 +102,7 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if( $t ) {
$link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
Linker::makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
$sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
($s->page_is_redirect ? '</div>' : '' );
} else {
$link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
@ -127,11 +129,11 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n
$out2 = '<table style="background: inherit;" width="100%" cellpadding="0" cellspacing="0" border="0">';
$out2 .= '<tr valign="top"><td align="left">' . $nsForm;
$out2 .= '</td><td align="right" style="font-size: smaller; margin-bottom: 1em;">' .
Linker::makeKnownLink( $wgContLang->specialPage( $this->name ),
$sk->makeKnownLink( $wgContLang->specialPage( $this->name ),
wfMsg ( 'allpages' ) );
if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
$namespaceparam = $namespace ? "&namespace=$namespace" : "";
$out2 .= " | " . Linker::makeKnownLink(
$out2 .= " | " . $sk->makeKnownLink(
$wgContLang->specialPage( $this->name ),
wfMsg ( 'nextpage', $s->page_title ),
"from=" . wfUrlEncode ( $s->page_title ) .

View file

@ -222,6 +222,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) {
}
// And now for the content
$sk = $wgUser->getSkin();
$wgOut->setSyndicated( true );
$list = ChangesList::newFromUser( $wgUser );
@ -420,8 +421,9 @@ function rcDoOutputFeed( $rows, &$feed ) {
*
*/
function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
global $wgLang, $wgContLang;
$s = Linker::makeKnownLink( $wgContLang->specialPage( $page ),
global $wgUser, $wgLang, $wgContLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
($lim ? $wgLang->formatNum( "{$lim}" ) : wfMsg( 'recentchangesall' ) ), "{$more}" .
($d ? "days={$d}&" : '') . 'limit='.$lim );
return $s;
@ -431,8 +433,9 @@ function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
*
*/
function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) {
global $wgLang, $wgContLang;
$s = Linker::makeKnownLink( $wgContLang->specialPage( $page ),
global $wgUser, $wgLang, $wgContLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
($d ? $wgLang->formatNum( "{$d}" ) : wfMsg( 'recentchangesall' ) ), $more.'days='.$d .
($lim ? '&limit='.$lim : '') );
return $s;
@ -475,8 +478,9 @@ function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall
* @param $options
*/
function makeOptionsLink( $title, $override, $options ) {
global $wgContLang;
return Linker::makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
global $wgUser, $wgContLang;
$sk = $wgUser->getSkin();
return $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
htmlspecialchars( $title ), wfArrayToCGI( $override, $options ) );
}
@ -617,11 +621,12 @@ function rcFormatDiff( $row ) {
}
function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment ) {
global $wgFeedDiffCutoff, $wgContLang;
global $wgFeedDiffCutoff, $wgContLang, $wgUser;
$fname = 'rcFormatDiff';
wfProfileIn( $fname );
$completeText = '<p>' . Linker::formatComment( $comment ) . "</p>\n";
$skin = $wgUser->getSkin();
$completeText = '<p>' . $skin->formatComment( $comment ) . "</p>\n";
if( $title->getNamespace() >= 0 ) {
if( $oldid ) {

View file

@ -23,6 +23,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
$hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
$wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
$sk = $wgUser->getSkin();
# Validate the title
$nt = Title::newFromURL( $target );
@ -54,11 +55,11 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
$hideminor = ($hideminor ? 1 : 0);
if ( $hideminor ) {
$mlink = Linker::makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
$mlink = $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
wfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
"&days={$days}&limit={$limit}&hideminor=0" );
} else {
$mlink = Linker::makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
$mlink = $sk->makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
wfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
"&days={$days}&limit={$limit}&hideminor=1" );
}
@ -137,7 +138,7 @@ $GROUPBY
}
$res = $dbr->query( $sql, $fname );
$wgOut->addHTML("&lt; ".Linker::makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
$wgOut->addHTML("&lt; ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
$note = wfMsg( "rcnote", $limit, $days, $wgLang->timeAndDate( wfTimestampNow(), true ) );
$wgOut->addHTML( "<hr />\n{$note}\n<br />" );

View file

@ -10,11 +10,12 @@
*/
function wfSpecialRevisiondelete( $par = null ) {
global $wgOut, $wgRequest;
global $wgOut, $wgRequest, $wgUser;
$target = $wgRequest->getVal( 'target' );
$oldid = $wgRequest->getIntArray( 'oldid' );
$sk = $wgUser->getSkin();
$page = Title::newFromUrl( $target );
if( is_null( $page ) ) {
@ -48,6 +49,7 @@ class RevisionDeleteForm {
$this->revisions = $request->getIntArray( 'oldid', array() );
$this->skin = $wgUser->getSkin();
$this->checks = array(
array( 'revdelete-hide-text', 'wpHideText', Revision::DELETED_TEXT ),
array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ),
@ -120,11 +122,11 @@ class RevisionDeleteForm {
$date = $wgContLang->timeanddate( $rev->getTimestamp() );
return
"<li>" .
Linker::makeLinkObj( $this->page, $date, 'oldid=' . $rev->getId() ) .
$this->skin->makeLinkObj( $this->page, $date, 'oldid=' . $rev->getId() ) .
" " .
Linker::revUserLink( $rev ) .
$this->skin->revUserLink( $rev ) .
" " .
Linker::revComment( $rev ) .
$this->skin->revComment( $rev ) .
"</li>";
}

View file

@ -126,7 +126,8 @@ class SpecialSearch {
$this->setupPage( $term );
global $wgOut;
global $wgUser, $wgOut;
$sk = $wgUser->getSkin();
$wgOut->addWikiText( wfMsg( 'searchresulttext' ) );
#if ( !$this->parseQuery() ) {
@ -320,13 +321,14 @@ class SpecialSearch {
wfProfileOut( $fname );
return "<!-- Broken link in search result -->\n";
}
$sk =& $wgUser->getSkin();
$contextlines = $wgUser->getOption( 'contextlines' );
if ( '' == $contextlines ) { $contextlines = 5; }
$contextchars = $wgUser->getOption( 'contextchars' );
if ( '' == $contextchars ) { $contextchars = 50; }
$link = Linker::makeKnownLinkObj( $t );
$link = $sk->makeKnownLinkObj( $t );
$revision = Revision::newFromTitle( $t );
$text = $revision->getText();
$size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),

View file

@ -60,7 +60,7 @@ class ShortPagesPage extends QueryPage {
return false;
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$dm = $wgContLang->getDirMark();
@ -68,10 +68,10 @@ class ShortPagesPage extends QueryPage {
if ( !$title ) {
return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->';
}
$hlink = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$hlink = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$plink = $this->isCached()
? Linker::makeLinkObj( $title )
: Linker::makeKnownLinkObj( $title );
? $skin->makeLinkObj( $title )
: $skin->makeKnownLinkObj( $title );
$size = wfMsgHtml( 'nbytes', $wgLang->formatNum( htmlspecialchars( $result->value ) ) );
return $title->exists()

View file

@ -9,23 +9,25 @@
*
*/
function wfSpecialSpecialpages() {
global $wgOut;
global $wgOut, $wgUser;
$wgOut->setRobotpolicy( 'index,nofollow' );
$sk = $wgUser->getSkin();
/** Pages available to all */
wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading' );
wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk );
/** Restricted special pages */
wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading' );
wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk );
}
/**
* sub function generating the list of pages
* @param $pages the list of pages
* @param $heading header to be used
* @param $sk skin object ???
*/
function wfSpecialSpecialpages_gen( $pages, $heading ) {
function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
global $wgOut, $wgSortSpecialPages;
if( count( $pages ) == 0 ) {
@ -49,7 +51,7 @@ function wfSpecialSpecialpages_gen( $pages, $heading ) {
/** Now output the HTML */
$wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
foreach ( $sortedPages as $desc => $title ) {
$link = Linker::makeKnownLinkObj( $title, $desc );
$link = $sk->makeKnownLinkObj( $title, $desc );
$wgOut->addHTML( "<li>{$link}</li>\n" );
}
$wgOut->addHTML( "</ul>\n" );

View file

@ -82,16 +82,17 @@ function wfSpecialStatistics() {
$wgOut->addWikiText( $text );
global $wgDisableCounters, $wgMiserMode, $wgLang, $wgContLang;
global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
if( !$wgDisableCounters && !$wgMiserMode ) {
$sql = "SELECT page_namespace, page_title, page_counter FROM {$page} WHERE page_is_redirect = 0 AND page_counter > 0 ORDER BY page_counter DESC";
$sql = $dbr->limitResult($sql, 10, 0);
$res = $dbr->query( $sql, $fname );
if( $res ) {
$wgOut->addHtml( '<h2>' . wfMsgHtml( 'statistics-mostpopular' ) . '</h2>' );
$skin =& $wgUser->getSkin();
$wgOut->addHtml( '<ol>' );
while( $row = $dbr->fetchObject( $res ) ) {
$link = Linker::makeKnownLinkObj( Title::makeTitleSafe( $row->page_namespace, $row->page_title ) );
$link = $skin->makeKnownLinkObj( Title::makeTitleSafe( $row->page_namespace, $row->page_title ) );
$dirmark = $wgContLang->getDirMark();
$wgOut->addHtml( '<li>' . $link . $dirmark . ' [' . $wgLang->formatNum( $row->page_counter ) . ']</li>' );
}

View file

@ -37,11 +37,11 @@ class UncategorizedImagesPage extends QueryPage {
WHERE cl_from IS NULL AND page_namespace = {$ns} AND page_is_redirect = 0";
}
function formatResult( $row ) {
function formatResult( &$skin, $row ) {
global $wgContLang;
$title = Title::makeTitleSafe( NS_IMAGE, $row->title );
$label = htmlspecialchars( $wgContLang->convert( $title->getText() ) );
return Linker::makeKnownLinkObj( $title, $label );
return $skin->makeKnownLinkObj( $title, $label );
}
}

View file

@ -482,7 +482,7 @@ class UndeleteForm {
}
/* private */ function showList() {
global $wgLang, $wgContLang, $wgOut;
global $wgLang, $wgContLang, $wgUser, $wgOut;
# List undeletable articles
$result = PageArchive::listAllPages();
@ -494,11 +494,12 @@ class UndeleteForm {
}
$wgOut->addWikiText( wfMsg( "undeletepagetext" ) );
$sk = $wgUser->getSkin();
$undelete =& SpecialPage::getTitleFor( 'Undelete' );
$wgOut->addHTML( "<ul>\n" );
while( $row = $result->fetchObject() ) {
$title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
$link = Linker::makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
$link = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
$revs = wfMsgHtml( 'undeleterevisions', $wgLang->formatNum( $row->count ) );
$wgOut->addHtml( "<li>{$link} ({$revs})</li>\n" );
}
@ -581,6 +582,7 @@ class UndeleteForm {
/* private */ function showHistory() {
global $wgLang, $wgUser, $wgOut;
$sk = $wgUser->getSkin();
if ( $this->mAllowed ) {
$wgOut->setPagetitle( wfMsg( "undeletepage" ) );
} else {
@ -669,15 +671,15 @@ class UndeleteForm {
$ts = wfTimestamp( TS_MW, $row->ar_timestamp );
if ( $this->mAllowed ) {
$checkBox = wfCheck( "ts$ts" );
$pageLink = Linker::makeKnownLinkObj( $titleObj,
$pageLink = $sk->makeKnownLinkObj( $titleObj,
$wgLang->timeanddate( $ts, true ),
"target=$target&timestamp=$ts" );
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate( $ts, true );
}
$userLink = Linker::userLink( $row->ar_user, $row->ar_user_text ) . Linker::userToolLinks( $row->ar_user, $row->ar_user_text );
$comment = Linker::commentBlock( $row->ar_comment );
$userLink = $sk->userLink( $row->ar_user, $row->ar_user_text ) . $sk->userToolLinks( $row->ar_user, $row->ar_user_text );
$comment = $sk->commentBlock( $row->ar_comment );
$wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" );
}
@ -697,14 +699,14 @@ class UndeleteForm {
$checkBox = wfCheck( "fileid" . $row->fa_id );
$key = urlencode( $row->fa_storage_key );
$target = urlencode( $this->mTarget );
$pageLink = Linker::makeKnownLinkObj( $titleObj,
$pageLink = $sk->makeKnownLinkObj( $titleObj,
$wgLang->timeanddate( $ts, true ),
"target=$target&file=$key" );
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate( $ts, true );
}
$userLink = Linker::userLink( $row->fa_user, $row->fa_user_text ) . Linker::userToolLinks( $row->fa_user, $row->fa_user_text );
$userLink = $sk->userLink( $row->fa_user, $row->fa_user_text ) . $sk->userToolLinks( $row->fa_user, $row->fa_user_text );
$data =
wfMsgHtml( 'widthheight',
$wgLang->formatNum( $row->fa_width ),
@ -712,7 +714,7 @@ class UndeleteForm {
' (' .
wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size ) ) .
')';
$comment = Linker::commentBlock( $row->fa_description );
$comment = $sk->commentBlock( $row->fa_description );
$wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
}
$files->free();
@ -730,7 +732,7 @@ class UndeleteForm {
}
function undelete() {
global $wgOut;
global $wgOut, $wgUser;
if( !is_null( $this->mTargetObj ) ) {
$archive = new PageArchive( $this->mTargetObj );
$ok = true;
@ -741,7 +743,8 @@ class UndeleteForm {
$this->mFileVersions );
if( $ok ) {
$link = Linker::makeKnownLinkObj( $this->mTargetObj );
$skin =& $wgUser->getSkin();
$link = $skin->makeKnownLinkObj( $this->mTargetObj );
$wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
return true;
}

View file

@ -33,9 +33,9 @@ class UnusedCategoriesPage extends QueryPage {
AND page_is_redirect = 0";
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
$title = Title::makeTitle( NS_CATEGORY, $result->title );
return Linker::makeLinkObj( $title, $title->getText() );
return $skin->makeLinkObj( $title, $title->getText() );
}
}

View file

@ -40,7 +40,7 @@ class UnusedimagesPage extends QueryPage {
}
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$title = Title::makeTitle( NS_IMAGE, $result->title );
@ -49,7 +49,7 @@ class UnusedimagesPage extends QueryPage {
$return =
# The 'desc' linking to the image page
'('.Linker::makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' . $dirmark .
'('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' . $dirmark .
# Link to the image itself
'<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) .
@ -59,11 +59,11 @@ class UnusedimagesPage extends QueryPage {
$wgLang->timeanddate($result->value) . ' . . ' . $dirmark .
# Link to username
Linker::makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ),
$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ),
$result->img_user_text) . $dirmark .
# If there is a description, show it
Linker::commentBlock( $wgContLang->convert( $result->img_description ) );
$skin->commentBlock( $wgContLang->convert( $result->img_description ) );
return $return;
}

View file

@ -33,10 +33,10 @@ class UnusedtemplatesPage extends QueryPage {
return $sql;
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
$title = Title::makeTitle( NS_TEMPLATE, $result->title );
$pageLink = Linker::makeKnownLinkObj( $title, '', 'redirect=no' );
$wlhLink = Linker::makeKnownLinkObj(
$pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
$wlhLink = $skin->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Whatlinkshere' ),
wfMsgHtml( 'unusedtemplateswlh' ),
'target=' . $title->getPrefixedUrl() );

View file

@ -39,14 +39,14 @@ class UnwatchedpagesPage extends QueryPage {
function sortDescending() { return false; }
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
$plink = Linker::makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
$wlink = Linker::makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
$plink = $skin->makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
$wlink = $skin->makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
return wfSpecialList( $plink, $wlink );
}

View file

@ -254,7 +254,7 @@ class UploadForm {
* @access private
*/
function processUpload() {
global $wgOut;
global $wgUser, $wgOut;
/* Check for PHP error if any, requires php 4.2 or newer */
if( $this->mUploadError == 1/*UPLOAD_ERR_INI_SIZE*/ ) {
@ -395,15 +395,18 @@ class UploadForm {
}
if( $nt->getArticleID() ) {
$dlink = Linker::makeKnownLinkObj( $nt );
global $wgUser;
$sk = $wgUser->getSkin();
$dlink = $sk->makeKnownLinkObj( $nt );
$warning .= '<li>'.wfMsgHtml( 'fileexists', $dlink ).'</li>';
} else {
# If the file existed before and was deleted, warn the user of this
# Don't bother doing so if the image exists now, however
$image = new Image( $nt );
if( $image->wasDeleted() ) {
$skin = $wgUser->getSkin();
$ltitle = SpecialPage::getTitleFor( 'Log' );
$llink = Linker::makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
$llink = $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
$warning .= wfOpenElement( 'li' ) . wfMsgWikiHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' );
}
}
@ -588,11 +591,12 @@ class UploadForm {
* @access private
*/
function showSuccess() {
global $wgOut, $wgContLang;
global $wgUser, $wgOut, $wgContLang;
$ilink = Linker::makeMediaLink( $this->mUploadSaveName, Image::imageUrl( $this->mUploadSaveName ) );
$sk = $wgUser->getSkin();
$ilink = $sk->makeMediaLink( $this->mUploadSaveName, Image::imageUrl( $this->mUploadSaveName ) );
$dname = $wgContLang->getNsText( NS_IMAGE ) . ':'.$this->mUploadSaveName;
$dlink = Linker::makeKnownLink( $dname, $dname );
$dlink = $sk->makeKnownLink( $dname, $dname );
$wgOut->addHTML( '<h2>' . wfMsgHtml( 'successfulupload' ) . "</h2>\n" );
$text = wfMsgWikiHtml( 'fileuploaded', $ilink, $dlink );
@ -700,6 +704,7 @@ class UploadForm {
$wgOut->addHTML( '<div id="uploadtext">' );
$wgOut->addWikiText( wfMsg( 'uploadtext' ) );
$wgOut->addHTML( '</div>' );
$sk = $wgUser->getSkin();
$sourcefilename = wfMsgHtml( 'sourcefilename' );

View file

@ -177,6 +177,7 @@ class LoginForm {
} else {
# Confirm that the account was created
global $wgOut;
$skin = $wgUser->getSkin();
$self = SpecialPage::getTitleFor( 'Userlogin' );
$wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
$wgOut->setArticleRelated( false );
@ -726,13 +727,15 @@ class LoginForm {
* @param $lang Language code
*/
function makeLanguageSelectorLink( $text, $lang ) {
global $wgUser;
$self = SpecialPage::getTitleFor( 'Userlogin' );
$attr[] = 'uselang=' . $lang;
if( $this->mType == 'signup' )
$attr[] = 'type=signup';
if( $this->mReturnTo )
$attr[] = 'returnto=' . $this->mReturnTo;
return Linker::makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );
$skin =& $wgUser->getSkin();
return $skin->makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );
}
}

View file

@ -55,15 +55,15 @@ class WantedCategoriesPage extends QueryPage {
$db->dataSeek( $res, 0 );
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getText() );
$plink = $this->isCached() ?
Linker::makeLinkObj( $nt, htmlspecialchars( $text ) ) :
Linker::makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
$skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) :
$skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
$nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );

View file

@ -66,7 +66,7 @@ class WantedPagesPage extends QueryPage {
}
function formatResult( $result ) {
function formatResult( $skin, $result ) {
global $wgLang;
$title = Title::makeTitleSafe( $result->namespace, $result->title );
@ -75,19 +75,19 @@ class WantedPagesPage extends QueryPage {
# Check existence; which is stored in the link cache
if( !$title->exists() ) {
# Make a redlink
$pageLink = Linker::makeBrokenLinkObj( $title );
$pageLink = $skin->makeBrokenLinkObj( $title );
} else {
# Make a a struck-out normal link
$pageLink = "<s>" . Linker::makeLinkObj( $title ) . "</s>";
$pageLink = "<s>" . $skin->makeLinkObj( $title ) . "</s>";
}
} else {
# Not cached? Don't bother checking existence; it can't
$pageLink = Linker::makeBrokenLinkObj( $title );
$pageLink = $skin->makeBrokenLinkObj( $title );
}
# Make a link to "what links here" if it's required
$wlhLink = $this->nlinks
? $this->makeWlhLink( $title,
? $this->makeWlhLink( $title, $skin,
wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) ) )
: null;
@ -98,12 +98,13 @@ class WantedPagesPage extends QueryPage {
/**
* Make a "what links here" link for a specified title
* @param $title Title to make the link for
* @param $skin Skin to use
* @param $text Link text
* @return string
*/
function makeWlhLink( &$title, $text ) {
function makeWlhLink( &$title, &$skin, $text ) {
$wlhTitle = SpecialPage::getTitleFor( 'Whatlinkshere' );
return Linker::makeKnownLinkObj( $wlhTitle, $text, 'target=' . $title->getPrefixedUrl() );
return $skin->makeKnownLinkObj( $wlhTitle, $text, 'target=' . $title->getPrefixedUrl() );
}
}

View file

@ -22,13 +22,14 @@ function wfSpecialWatchlist( $par ) {
global $wgEnotifWatchlist;
$fname = 'wfSpecialWatchlist';
$skin =& $wgUser->getSkin();
$specialTitle = SpecialPage::getTitleFor( 'Watchlist' );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
# Anons don't get a watchlist
if( $wgUser->isAnon() ) {
$wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
$llink = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() );
$llink = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() );
$wgOut->addHtml( wfMsgWikiHtml( 'watchlistanontext', $llink ) );
return;
} else {
@ -189,6 +190,8 @@ function wfSpecialWatchlist( $par ) {
$linkBatch->execute();
if( $dbr->numRows( $res ) > 0 )
$dbr->dataSeek( $res, 0 ); # Let's do the time warp again!
$sk = $wgUser->getSkin();
$list = array();
while( $s = $dbr->fetchObject( $res ) ) {
@ -213,10 +216,10 @@ function wfSpecialWatchlist( $par ) {
global $wgContLang;
$toolLinks = array();
$titleText = $titleObj->getPrefixedText();
$pageLink = Linker::makeLinkObj( $titleObj );
$toolLinks[] = Linker::makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
$pageLink = $sk->makeLinkObj( $titleObj );
$toolLinks[] = $sk->makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
if( $titleObj->exists() )
$toolLinks[] = Linker::makeKnownLinkObj( $titleObj, wfMsgHtml( 'history_short' ), 'action=history' );
$toolLinks[] = $sk->makeKnownLinkObj( $titleObj, wfMsgHtml( 'history_short' ), 'action=history' );
$toolLinks = '(' . implode( ' | ', $toolLinks ) . ')';
$checkbox = '<input type="checkbox" name="id[]" value="' . htmlspecialchars( $titleObj->getPrefixedText() ) . '" /> ' . ( $wgContLang->isRTL() ? '&rlm;' : '&lrm;' );
if( $redir ) {
@ -323,17 +326,18 @@ function wfSpecialWatchlist( $par ) {
# Spit out some control panel links
$thisTitle = SpecialPage::getTitleFor( 'Watchlist' );
$skin = $wgUser->getSkin();
$linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' );
# Problems encountered using the fancier method
$label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' );
$linkBits = wfArrayToCGI( array( 'hideBots' => 1 - (int)$hideBots ), $nondefaults );
$link = Linker::makeKnownLinkObj( $thisTitle, $label, $linkBits );
$link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
$links[] = wfMsgHtml( 'wlhideshowbots', $link );
$label = $hideOwn ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' );
$linkBits = wfArrayToCGI( array( 'hideOwn' => 1 - (int)$hideOwn ), $nondefaults );
$link = Linker::makeKnownLinkObj( $thisTitle, $label, $linkBits );
$link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
$links[] = wfMsgHtml( 'wlhideshowown', $link );
$wgOut->addHTML( implode( ' | ', $links ) );
@ -399,8 +403,9 @@ function wfSpecialWatchlist( $par ) {
}
function wlHoursLink( $h, $page, $options = array() ) {
global $wgLang, $wgContLang;
$s = Linker::makeKnownLink(
global $wgUser, $wgLang, $wgContLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink(
$wgContLang->specialPage( $page ),
$wgLang->formatNum( $h ),
wfArrayToCGI( array('days' => ($h / 24.0)), $options ) );
@ -408,8 +413,9 @@ function wlHoursLink( $h, $page, $options = array() ) {
}
function wlDaysLink( $d, $page, $options = array() ) {
global $wgLang, $wgContLang;
$s = Linker::makeKnownLink(
global $wgUser, $wgLang, $wgContLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink(
$wgContLang->specialPage( $page ),
($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) ),
wfArrayToCGI( array('days' => $d), $options ) );

View file

@ -18,10 +18,12 @@ function wfSpecialWhatlinkshere($par = NULL) {
class WhatLinksHerePage {
var $request, $par;
var $limit, $from, $dir, $target;
var $selfTitle;
var $selfTitle, $skin;
function WhatLinksHerePage( &$request, $par = null ) {
global $wgUser;
$this->request =& $request;
$this->skin =& $wgUser->getSkin();
$this->par = $par;
}
@ -57,7 +59,7 @@ class WhatLinksHerePage {
$isredir = ' (' . wfMsg( 'isredirect' ) . ")\n";
$wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) .' '.Linker::makeLinkObj($this->target, '', 'redirect=no' )."<br />\n");
$wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) . ' ' .$this->skin->makeLinkObj($this->target, '', 'redirect=no' )."<br />\n");
$this->showIndirectLinks( 0, $this->target, $this->limit, $this->from, $this->dir );
}
@ -205,7 +207,7 @@ class WhatLinksHerePage {
$extra = '';
}
$link = Linker::makeKnownLinkObj( $nt, '', $extra );
$link = $this->skin->makeKnownLinkObj( $nt, '', $extra );
$wgOut->addHTML( '<li>'.$link );
// Display properties (redirect or template)
@ -236,7 +238,7 @@ class WhatLinksHerePage {
}
function makeSelfLink( $text, $query ) {
return Linker::makeKnownLinkObj( $this->selfTitle, $text, $query );
return $this->skin->makeKnownLinkObj( $this->selfTitle, $text, $query );
}
function getPrevNext( $limit, $prevId, $nextId ) {

View file

@ -2388,7 +2388,9 @@ class User {
}
$title = self::getGroupPage( $group );
if( $title ) {
return Linker::makeLinkObj( $title, $text );
global $wgUser;
$sk = $wgUser->getSkin();
return $sk->makeLinkObj( $title, $text );
} else {
return $text;
}

View file

@ -84,7 +84,7 @@ class SkinCologneBlue extends Skin {
$s .= "<td class='bottom' align='center' valign='top'>";
$s .= $this->bottomLinks();
$s .= "\n<br />" . self::makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
$s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
. $this->aboutLink() . " | "
. $this->searchForm( wfMsg( "qbfind" ) );
@ -138,15 +138,15 @@ class SkinCologneBlue extends Skin {
}
$s = "" .
self::makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
$this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
. " | " .
self::makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
$this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
. " | " .
self::makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
$this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
. " | " .
self::makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
$this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
. " | " .
self::specialLink( "specialpages" );
$this->specialLink( "specialpages" );
/* show links to different language variants */
$s .= $this->variantLinks();
@ -154,9 +154,9 @@ class SkinCologneBlue extends Skin {
$s .= " | ";
if ( $wgUser->isLoggedIn() ) {
$s .= self::makeKnownLink( $lo, wfMsg( "logout" ), $q );
$s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
} else {
$s .= self::makeKnownLink( $li, wfMsg( "login" ), $q );
$s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
}
return $s;
@ -195,7 +195,7 @@ class SkinCologneBlue extends Skin {
$s .= $this->menuHead( "qbedit" );
$s .= "<strong>" . $this->editThisPage() . "</strong>";
$s .= $sep . self::makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
$s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
if( $wgUser->isLoggedIn() ) {
$s .= $sep . $this->moveThisPage();
@ -244,31 +244,31 @@ class SkinCologneBlue extends Skin {
$s .= $this->menuHead( "qbmyoptions" );
if ( $wgUser->isLoggedIn() ) {
$name = $wgUser->getName();
$tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
wfMsg( 'mytalk' ) );
if ( $wgUser->getNewtalk() ) {
$tl .= " *";
}
$s .= self::makeKnownLinkObj( $wgUser->getUserPage(),
$s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
wfMsg( "mypage" ) )
. $sep . $tl
. $sep . self::specialLink( "watchlist" )
. $sep . self::makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
. $sep . $this->specialLink( "watchlist" )
. $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
wfMsg( "mycontris" ) )
. $sep . self::specialLink( "preferences" )
. $sep . self::specialLink( "userlogout" );
. $sep . $this->specialLink( "preferences" )
. $sep . $this->specialLink( "userlogout" );
} else {
$s .= self::specialLink( "userlogin" );
$s .= $this->specialLink( "userlogin" );
}
$s .= $this->menuHead( "qbspecialpages" )
. self::specialLink( "newpages" )
. $sep . self::specialLink( "imagelist" )
. $sep . self::specialLink( "statistics" )
. $this->specialLink( "newpages" )
. $sep . $this->specialLink( "imagelist" )
. $sep . $this->specialLink( "statistics" )
. $sep . $this->bugReportsLink();
if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
$s .= $sep . self::specialLink( "upload" );
$s .= $sep . $this->specialLink( "upload" );
}
global $wgSiteSupportPage;
if( $wgSiteSupportPage) {
@ -276,7 +276,7 @@ class SkinCologneBlue extends Skin {
.wfMsg( "sitesupport" )."</a>";
}
$s .= $sep . self::makeKnownLinkObj(
$s .= $sep . $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Specialpages' ),
wfMsg( 'moredotdotdot' ) );

View file

@ -57,7 +57,7 @@ class SkinNostalgia extends Skin {
$sep = " |\n";
$s = $this->mainPageLink() . $sep
. self::specialLink( "recentchanges" );
. $this->specialLink( "recentchanges" );
if ( $wgOut->isArticle() ) {
$s .= $sep . $this->editThisPage()
@ -69,9 +69,9 @@ class SkinNostalgia extends Skin {
$s .= $this->extensionTabLinks();
if ( $wgUser->isAnon() ) {
$s .= $sep . self::specialLink( "userlogin" );
$s .= $sep . $this->specialLink( "userlogin" );
} else {
$s .= $sep . self::specialLink( "userlogout" );
$s .= $sep . $this->specialLink( "userlogout" );
}
$s .= $sep . $this->specialPagesList();

View file

@ -118,7 +118,7 @@ class SkinStandard extends Skin {
$s .= $this->bottomLinks();
$s .= "\n<br />" . $this->mainPageLink()
. ' | ' . $this->aboutLink()
. ' | ' . self::specialLink( 'recentchanges' )
. ' | ' . $this->specialLink( 'recentchanges' )
. ' | ' . $this->searchForm()
. '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
@ -164,8 +164,8 @@ class SkinStandard extends Skin {
}
if( $wgUser->isLoggedIn() ) {
$s.= self::specialLink( 'watchlist' ) ;
$s .= $sep . self::makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
$s.= $this->specialLink( 'watchlist' ) ;
$s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
}
// only show watchlist link if logged in
@ -220,7 +220,7 @@ class SkinStandard extends Skin {
$link = $nstext . ':' . $link ;
}
$s .= self::makeLink( $link, $text );
$s .= $this->makeLink( $link, $text );
} elseif( $wgTitle->getNamespace() != NS_SPECIAL ) {
# we just throw in a "New page" text to tell the user that he's in edit mode,
# and to avoid messing with the separator that is prepended to the next item
@ -231,10 +231,10 @@ class SkinStandard extends Skin {
# "Post a comment" link
if( ( $wgTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
$s .= '<br />' . self::makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit&section=new' );
$s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit&section=new' );
#if( $tns%2 && $action!='edit' && !$wpPreview) {
#$s.= '<br />'.self::makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit&section=new');
#$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit&section=new');
#}
/*
@ -282,9 +282,9 @@ class SkinStandard extends Skin {
}
if ( $wgUser->isLoggedIn() && ( $wgEnableUploads || $wgRemoteUploads ) ) {
$s .= self::specialLink( 'upload' ) . $sep;
$s .= $this->specialLink( 'upload' ) . $sep;
}
$s .= self::specialLink( 'specialpages' )
$s .= $this->specialLink( 'specialpages' )
. $sep . $this->bugReportsLink();
global $wgSiteSupportPage;

View file

@ -80,7 +80,7 @@ class SkinHTMLDump extends SkinTemplate {
$hasMembers = $dbr->selectField( 'categorylinks', '1',
array( 'cl_to' => $nt->getDBkey() ), __METHOD__ );
if ( $hasMembers ) {
return self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
}
}

View file

@ -428,12 +428,12 @@ class SkinMonoBookCBT extends SkinTemplate {
$usertalktitle = $usertitle->getTalkPage();
if( !$usertalktitle->equals( $this->mTitle ) ) {
$ntl = wfMsg( 'youhavenewmessages',
self::makeKnownLinkObj(
$this->makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessageslink' ),
'redirect=no'
),
self::makeKnownLinkObj(
$this->makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessagesdifflink' ),
'diff=cur'