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 ==
function wfSajaxSearch( $term ) {
global $wgContLang, $wgOut;
$limit = 16;
-
- $l = new Linker;
$term = str_replace( ' ', '_', $wgContLang->ucfirst(
$wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) )
$i=0;
while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) {
$nt = Title::newFromDBkey( $row->page_title );
- $r .= '<li>' . $l->makeKnownLinkObj( $nt ) . "</li>\n";
+ $r .= '<li>' . Linker::makeKnownLinkObj( $nt ) . "</li>\n";
}
if ( $i > $limit ) {
- $more = '<i>' . $l->makeKnownLink( $wgContLang->specialPage( "Allpages" ),
+ $more = '<i>' . Linker::makeKnownLink( $wgContLang->specialPage( "Allpages" ),
wfMsg('moredotdotdot'),
"namespace=0&from=" . wfUrlEncode ( $term ) ) .
'</i>';
. wfMsg( 'hideresults' ) . '</a></div>'
. '<h1 class="firstHeading">'.wfMsg('search')
. '</h1><div id="contentSub">'. $subtitle . '</div><ul><li>'
- . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ),
+ . Linker::makeKnownLink( $wgContLang->specialPage( 'Search' ),
wfMsg( 'searchcontaining', $term ),
"search=$term&fulltext=Search" )
- . '</li><li>' . $l->makeKnownLink( $wgContLang->specialPage( 'Search' ),
+ . '</li><li>' . Linker::makeKnownLink( $wgContLang->specialPage( 'Search' ),
wfMsg( 'searchnamed', $term ) ,
"search=$term&go=Go" )
. "</li></ul><h2>" . wfMsg( 'articletitles', $term ) . "</h2>"
global $wgUser, $wgOut, $wgRequest, $wgContLang;
global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser;
global $wgUseTrackbacks, $wgNamespaceRobotPolicies;
- $sk = $wgUser->getSkin();
wfProfileIn( __METHOD__ );
// This is an internally redirected page view.
// We'll need a backlink to the source page for navigation.
if ( wfRunHooks( 'ArticleViewRedirect', array( &$this ) ) ) {
- $sk = $wgUser->getSkin();
- $redir = $sk->makeKnownLinkObj( $this->mRedirectedFrom, '', 'redirect=no' );
+ $redir = Linker::makeKnownLinkObj( $this->mRedirectedFrom, '', 'redirect=no' );
$s = wfMsg( 'redirectedfrom', $redir );
$wgOut->setSubtitle( $s );
$wasRedirected = true;
// If it was reported from a trusted site, supply a backlink.
global $wgRedirectSources;
if( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
- $sk = $wgUser->getSkin();
- $redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
+ $redir = Linker::makeExternalLink( $rdfrom, $rdfrom );
$s = wfMsg( 'redirectedfrom', $redir );
$wgOut->setSubtitle( $s );
$wasRedirected = true;
$targetUrl = $rt->escapeLocalURL();
#Â fixme unused $titleText :
$titleText = htmlspecialchars( $rt->getPrefixedText() );
- $link = $sk->makeLinkObj( $rt );
+ $link = Linker::makeLinkObj( $rt );
$wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' .
'<span class="redirectText">'.$link.'</span>' );
$wgOut->addHTML(
"<div class='patrollink'>" .
wfMsg ( 'markaspatrolledlink',
- $sk->makeKnownLinkObj( $this->mTitle, wfMsg('markaspatrolledtext'), "action=markpatrolled&rcid=$rcid" )
+ Linker::makeKnownLinkObj( $this->mTitle, wfMsg('markaspatrolledtext'), "action=markpatrolled&rcid=$rcid" )
) .
'</div>'
);
* @param string $oldid Revision ID of this article revision
*/
function setOldSubtitle( $oldid=0 ) {
- global $wgLang, $wgOut, $wgUser;
+ global $wgLang, $wgOut;
if ( !wfRunHooks( 'DisplayOldSubtitle', array(&$this, &$oldid) ) ) {
return;
$current = ( $oldid == $this->mLatest );
$td = $wgLang->timeanddate( $this->mTimestamp, true );
- $sk = $wgUser->getSkin();
$lnk = $current
? wfMsg( 'currentrevisionlink' )
- : $lnk = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) );
+ : $lnk = Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) );
$prev = $this->mTitle->getPreviousRevisionID( $oldid ) ;
$prevlink = $prev
- ? $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid )
+ ? Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid )
: wfMsg( 'previousrevision' );
$prevdiff = $prev
- ? $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=prev&oldid='.$oldid )
+ ? Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=prev&oldid='.$oldid )
: wfMsg( 'diff' );
$nextlink = $current
? wfMsg( 'nextrevision' )
- : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'nextrevision' ), 'direction=next&oldid='.$oldid );
+ : Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'nextrevision' ), 'direction=next&oldid='.$oldid );
$nextdiff = $current
? wfMsg( 'diff' )
- : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid );
+ : Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=next&oldid='.$oldid );
- $userlinks = $sk->userLink( $revision->getUser(), $revision->getUserText() )
- . $sk->userToolLinks( $revision->getUser(), $revision->getUserText() );
+ $userlinks = Linker::userLink( $revision->getUser(), $revision->getUserText() )
+ . Linker::userToolLinks( $revision->getUser(), $revision->getUserText() );
$r = wfMsg( 'old-revision-navigation', $td, $lnk, $prevlink, $nextlink, $userlinks, $prevdiff, $nextdiff );
$wgOut->setSubtitle( $r );
var $title, $limit, $from, $until,
$articles, $articles_start_char,
$children, $children_start_char,
- $showGallery, $gallery,
- $skin;
+ $showGallery, $gallery;
function __construct( $title, $from = '', $until = '' ) {
global $wgCategoryPagingLimit;
}
}
- 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[] = $this->getSkin()->makeKnownLinkObj(
+ $this->children[] = Linker::makeKnownLinkObj(
$title, $wgContLang->convertHtml( $title->getText() ) );
$this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
*/
function addPage( $title, $sortkey, $pageLength ) {
global $wgContLang;
- $this->articles[] = $this->getSkin()->makeSizeLinkObj(
+ $this->articles[] = Linker::makeSizeLinkObj(
$pageLength, $title, $wgContLang->convert( $title->getPrefixedText() )
);
$this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) );
*/
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 = $sk->makeLinkObj( $title, $prevLink,
+ $prevLink = Linker::makeLinkObj( $title, $prevLink,
wfArrayToCGI( $query + array( 'until' => $first ) ) );
}
$nextLink = htmlspecialchars( wfMsg( 'nextn', $limitText ) );
if( $last != '' ) {
- $nextLink = $sk->makeLinkObj( $title, $nextLink,
+ $nextLink = Linker::makeLinkObj( $title, $nextLink,
wfArrayToCGI( $query + array( 'from' => $last ) ) );
}
#
/** @todo document */
- function ChangesList( &$skin ) {
- $this->skin =& $skin;
+ function ChangesList() {
$this->preCacheMessages();
}
* @return ChangesList derivative
*/
function newFromUser( &$user ) {
- $sk =& $user->getSkin();
$list = NULL;
- if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) {
- return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
+ if( wfRunHooks( 'FetchChangesList', array( &$user, &$list ) ) ) {
+ return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList() : new OldChangesList();
} else {
return $list;
}
# Diff
$s .= '(' . $this->message['diff'] . ') (';
# Hist
- $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
+ $s .= Linker::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, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
- $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+ $s .= wfMsg( $msg, Linker::makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
+ Linker::makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
}
function insertDateHeader(&$s, $rc_timestamp) {
function insertLog(&$s, $title, $logtype) {
$logname = LogPage::logName( $logtype );
- $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
+ $s .= '(' . Linker::makeKnownLinkObj($title, $logname ) . ')';
}
$rcidparam = $unpatrolled
? array( 'rcid' => $rc->mAttribs['rc_id'] )
: array();
- $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
+ $diffLink = Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
wfArrayToCGI( array(
'curid' => $rc->mAttribs['rc_cur_id'],
'diff' => $rc->mAttribs['rc_this_oldid'],
$s .= '('.$diffLink.') (';
# History link
- $s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
+ $s .= Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
wfArrayToCGI( array(
'curid' => $rc->mAttribs['rc_cur_id'],
'action' => 'history' ) ) );
$params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
? 'rcid='.$rc->mAttribs['rc_id']
: '';
- $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
+ $articlelink = ' '. Linker::makeKnownLinkObj( $rc->getTitle(), '', $params );
if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
global $wgContLang;
$articlelink .= $wgContLang->getDirMark();
/** Insert links to user page, user talk page and eventually a blocking link */
function insertUserRelatedLinks(&$s, &$rc) {
- $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'] );
+ $s .= Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+ $s .= Linker::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 .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
+ $s .= Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
}
}
# 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, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
- $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+ $clink = wfMsg( $msg, Linker::makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
+ Linker::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 = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
+ $clink = '(' . Linker::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 = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
+ $clink = Linker::makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
} else {
- $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
+ $clink = Linker::makeKnownLinkObj( $rc->getTitle(), '' );
}
$time = $wgContLang->time( $rc_timestamp, true, true );
$querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
$querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
$aprops = ' tabindex="'.$baseRC->counter.'"';
- $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
+ $curLink = Linker::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 = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
+ $diffLink = Linker::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 = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
+ $lastLink = Linker::makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
$curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
}
- $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
+ $rc->userlink = Linker::userLink( $rc_user, $rc_user_text );
$rc->lastlink = $lastLink;
$rc->curlink = $curLink;
$rc->difflink = $diffLink;
- $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
+ $rc->usertalklink = Linker::userToolLinks( $rc_user, $rc_user_text );
# Put accumulated information into the cache, for later display
# Page moves go on their own line
if( $isnew ) {
$r .= $this->message['changes'];
} else {
- $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
+ $r .= Linker::makeKnownLinkObj( $block[0]->getTitle(),
$this->message['changes'], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
}
$r .= '; ';
# History
- $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
+ $r .= Linker::makeKnownLinkObj( $block[0]->getTitle(),
$this->message['history'], $curIdEq.'&action=history' );
$r .= ')';
}
if( $rc_type == RC_LOG ) {
$link = $rcObj->timestamp;
} else {
- $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
+ $link = Linker::makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
}
$link = '<tt>'.$link.'</tt>';
$r .= $rcObj->lastlink;
$r .= ') . . '.$rcObj->userlink;
$r .= $rcObj->usertalklink;
- $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
+ $r .= Linker::commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= "<br />\n";
}
$r .= "</div>\n";
$r .= ' ('. $rcObj->difflink .'; ';
# Hist
- $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' );
+ $r .= Linker::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 .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
+ $r .= Linker::commentBlock( $rc_comment, $rcObj->getTitle() );
}
if( $rcObj->numberofWatchingusers > 0 ) {
*
*/
function creditLink($user_name, $link_text = '') {
- global $wgUser, $wgContLang;
- $skin = $wgUser->getSkin();
- return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
+ global $wgContLang;
+ return Linker::makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
htmlspecialchars( (empty($link_text)) ? $user_name : $link_text ));
}
*
*/
function creditOthersLink($article) {
- global $wgUser;
- $skin = $wgUser->getSkin();
- return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
+ return Linker::makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
}
?>
exit;
}
- $sk = $wgUser->getSkin();
$talk = $wgContLang->getNsText( NS_TALK );
$contribs = wfMsg( 'contribslink' );
if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) {
$username = $this->mNewRev->getUserText();
- $rollback = ' <strong>[' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ),
+ $rollback = ' <strong>[' . Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ),
'action=rollback&from=' . urlencode( $username ) .
'&token=' . urlencode( $wgUser->editToken( array( $this->mTitle->getPrefixedText(), $username ) ) ) ) .
']</strong>';
$rollback = '';
}
if( $wgUseRCPatrol && $this->mRcidMarkPatrolled != 0 && $wgUser->isAllowed( 'patrol' ) ) {
- $patrol = ' [' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . ']';
+ $patrol = ' [' . Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'markaspatrolleddiff' ), "action=markpatrolled&rcid={$this->mRcidMarkPatrolled}" ) . ']';
} else {
$patrol = '';
}
- $prevlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'previousdiff' ),
+ $prevlink = Linker::makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'previousdiff' ),
'diff=prev&oldid='.$this->mOldid, '', '', 'id="differences-prevlink"' );
if ( $this->mNewRev->isCurrent() ) {
$nextlink = ' ';
} else {
- $nextlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ),
+ $nextlink = Linker::makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ),
'diff=next&oldid='.$this->mNewid, '', '', 'id="differences-nextlink"' );
}
}
$oldHeader = "<strong>{$this->mOldtitle}</strong><br />" .
- $sk->revUserTools( $this->mOldRev ) . "<br />" .
- $oldminor . $sk->revComment( $this->mOldRev ) . "<br />" .
+ Linker::revUserTools( $this->mOldRev ) . "<br />" .
+ $oldminor . Linker::revComment( $this->mOldRev ) . "<br />" .
$prevlink;
$newHeader = "<strong>{$this->mNewtitle}</strong><br />" .
- $sk->revUserTools( $this->mNewRev ) . " $rollback<br />" .
- $newminor . $sk->revComment( $this->mNewRev ) . "<br />" .
+ Linker::revUserTools( $this->mNewRev ) . " $rollback<br />" .
+ $newminor . Linker::revComment( $this->mNewRev ) . "<br />" .
$nextlink . $patrol;
$this->showDiff( $oldHeader, $newHeader );
* contrast to normal "old revision" display style.
*/
function showFirstRevision() {
- global $wgOut, $wgUser;
+ global $wgOut;
$fname = 'DifferenceEngine::showFirstRevision';
wfProfileIn( $fname );
# Prepare the header box
#
- $sk = $wgUser->getSkin();
-
- $nextlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'nextdiff' ), 'diff=next&oldid='.$this->mNewid, '', '', 'id="differences-nextlink"' );
+ $nextlink = Linker::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 />" .
- $sk->revUserTools( $this->mNewRev ) . "<br />" .
- $sk->revComment( $this->mNewRev ) . "<br />" .
+ Linker::revUserTools( $this->mNewRev ) . "<br />" .
+ Linker::revComment( $this->mNewRev ) . "<br />" .
$nextlink . "</div>\n";
$wgOut->addHTML( $header );
$fname = 'EditPage::showEditForm';
wfProfileIn( $fname );
- $sk =& $wgUser->getSkin();
-
wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
$wgOut->setRobotpolicy( 'noindex,nofollow' );
$minor = wfMsgExt('minoredit', array('parseinline'));
$watchthis = wfMsgExt('watchthis', array('parseinline'));
- $cancel = $sk->makeKnownLink( $this->mTitle->getPrefixedText(),
+ $cancel = Linker::makeKnownLink( $this->mTitle->getPrefixedText(),
wfMsgExt('cancel', array('parseinline')) );
$edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' ));
$edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'.
* 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 ) {
wfMsgExt( 'templatesused', array( 'parse' ) ) .
'</div><ul>';
foreach ( $templates as $titleObj ) {
- $outText .= '<li>' . $sk->makeLinkObj( $titleObj ) . '</li>';
+ $outText .= '<li>' . Linker::makeLinkObj( $titleObj ) . '</li>';
}
$outText .= '</ul>';
}
* Produce the stock "please login to edit pages" page
*/
function userNotLoggedInPage() {
- global $wgUser, $wgOut;
- $skin = $wgUser->getSkin();
+ global $wgOut;
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
- $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->mTitle->getPrefixedUrl() );
+ $loginLink = Linker::makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $this->mTitle->getPrefixedUrl() );
$wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
{
var $mImages, $mShowBytes, $mShowFilename;
var $mCaption = false;
- var $mSkin = false;
/**
* Is the gallery on a wiki page (i.e. not a special page)
$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.
*
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>';
else if( $this->mParsing && wfIsBadImage( $nt->getDBkey() ) ) {
# The image is blacklisted, just show it as a text link.
$thumbhtml = '<div style="height: 152px;">'
- . $sk->makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . '</div>';
+ . Linker::makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . '</div>';
} else if( !( $thumb = $img->getThumbnail( 120, 120, $wgGenerateThumbnailOnParse ) ) ) {
# Error generating thumbnail.
$thumbhtml = '<div style="height: 152px;">'
else {
$vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
$thumbhtml = '<div class="thumb" style="padding: ' . $vpad . 'px 0;">'
- . $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div>';
+ . Linker::makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div>';
}
//TODO
- //$ul = $sk->makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
+ //$ul = Linker::makeLink( $wgContLang->getNsText( Namespace::getUser() ) . ":{$ut}", $ut );
if( $this->mShowBytes ) {
if( $img->exists() ) {
}
$textlink = $this->mShowFilename ?
- $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
+ Linker::makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
'' ;
# ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
$max = $wgImageLimits[$sizeSel];
$maxWidth = $max[0];
$maxHeight = $max[1];
- $sk = $wgUser->getSkin();
if ( $this->img->exists() ) {
# image
if ( $page > 1 ) {
$label = $wgOut->parse( wfMsg( 'imgmultipageprev' ), false );
- $link = $sk->makeLinkObj( $this->mTitle, $label, 'page='. ($page-1) );
+ $link = Linker::makeLinkObj( $this->mTitle, $label, 'page='. ($page-1) );
$this->img->selectPage( $page - 1 );
- $thumb1 = $sk->makeThumbLinkObj( $this->img, $link, $label, 'none' );
+ $thumb1 = Linker::makeThumbLinkObj( $this->img, $link, $label, 'none' );
} else {
$thumb1 = '';
}
if ( $page < $count ) {
$label = wfMsg( 'imgmultipagenext' );
$this->img->selectPage( $page + 1 );
- $link = $sk->makeLinkObj( $this->mTitle, $label, 'page='. ($page+1) );
- $thumb2 = $sk->makeThumbLinkObj( $this->img, $link, $label, 'none' );
+ $link = Linker::makeLinkObj( $this->mTitle, $label, 'page='. ($page+1) );
+ $thumb2 = Linker::makeThumbLinkObj( $this->img, $link, $label, 'none' );
} else {
$thumb2 = '';
}
# Image does not exist
$title = SpecialPage::getTitleFor( 'Upload' );
- $link = $sk->makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
+ $link = Linker::makeKnownLinkObj($title, wfMsgHtml('noimage-linktext'),
'wpDestFile=' . urlencode( $this->img->getName() ) );
$wgOut->addHTML( wfMsgWikiHtml( 'noimage', $link ) );
}
}
function printSharedImageText() {
- global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut, $wgUser;
+ global $wgRepositoryBaseUrl, $wgFetchCommonsDescriptions, $wgOut;
$url = $wgRepositoryBaseUrl . urlencode($this->mTitle->getDBkey());
$sharedtext = "<div class='sharedUploadNotice'>" . wfMsgWikiHtml("sharedupload");
if ($wgRepositoryBaseUrl && !$wgFetchCommonsDescriptions) {
-
- $sk = $wgUser->getSkin();
$title = SpecialPage::getTitleFor( 'Upload' );
- $link = $sk->makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
+ $link = Linker::makeKnownLinkObj($title, wfMsgHtml('shareduploadwiki-linktext'),
array( 'wpDestFile' => urlencode( $this->img->getName() )));
$sharedtext .= " " . wfMsgWikiHtml('shareduploadwiki', $link);
}
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 = $sk->makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
+ $ulink = Linker::makeExternalLink( $this->getUploadUrl(), wfMsg( 'uploadnewversion-linktext' ) );
$wgOut->addHtml( "<li><div>{$ulink}</div></li>" );
}
# External editing link
- $elink = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'edit-externally' ), 'action=edit&externaledit=true&mode=file' );
+ $elink = Linker::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>' );
* 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 $wgUser, $wgOut, $wgUseExternalEditor;
-
- $sk = $wgUser->getSkin();
+ function imageHistory() {
+ global $wgOut, $wgUseExternalEditor;
$line = $this->img->nextHistoryLine();
if ( $line ) {
- $list = new ImageHistoryList( $sk );
+ $list = new ImageHistoryList();
$s = $list->beginImageHistoryList() .
$list->imageHistoryLine( true, wfTimestamp(TS_MW, $line->img_timestamp),
$this->mTitle->getDBkey(), $line->img_user,
}
- function imageLinks()
- {
- global $wgUser, $wgOut;
+ function imageLinks() {
+ global $wgOut;
$wgOut->addHTML( '<h2 id="filelinks">' . wfMsg( 'imagelinks' ) . "</h2>\n" );
}
$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 = $sk->makeKnownLinkObj( $name, "" );
+ $link = Linker::makeKnownLinkObj( $name, "" );
$wgOut->addHTML( "<li>{$link}</li>\n" );
}
$wgOut->addHTML( "</ul>\n" );
* @package MediaWiki
*/
class ImageHistoryList {
- function ImageHistoryList( &$skin ) {
- $this->skin =& $skin;
+ function ImageHistoryList() {
}
function beginImageHistoryList() {
$url = Image::imageUrl( $img );
$rlink = $cur;
if ( $wgUser->isAllowed('delete') ) {
- $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() .
- '&action=delete' );
- $style = $this->skin->getInternalLinkAttributes( $link, $delall );
-
- $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>';
+ $dlink = Linker::makeKnownLinkObj( $wgTitle, $delall,
+ 'image=' . $wgTitle->getPartialURL() . '&action=delete');
} else {
$dlink = $del;
}
$url = htmlspecialchars( wfImageArchiveUrl( $img ) );
if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) {
$token = urlencode( $wgUser->editToken( $img ) );
- $rlink = $this->skin->makeKnownLinkObj( $wgTitle,
+ $rlink = Linker::makeKnownLinkObj( $wgTitle,
wfMsg( 'revertimg' ), 'action=revert&oldimage=' .
urlencode( $img ) . "&wpEditToken=$token" );
- $dlink = $this->skin->makeKnownLinkObj( $wgTitle,
+ $dlink = Linker::makeKnownLinkObj( $wgTitle,
$del, 'action=delete&oldimage=' . urlencode( $img ) .
"&wpEditToken=$token" );
} else {
}
}
- $userlink = $this->skin->userLink( $user, $usertext ) . $this->skin->userToolLinks( $user, $usertext );
+ $userlink = Linker::userLink( $user, $usertext ) . Linker::userToolLinks( $user, $usertext );
$nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
$wgLang->formatNum( $size ) );
$widthheight = wfMsg( 'widthheight', $width, $height );
- $style = $this->skin->getInternalLinkAttributes( $url, $datetime );
+ $style = Linker::getInternalLinkAttributes( $url, $datetime );
$s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})";
- $s .= $this->skin->commentBlock( $description, $wgTitle );
+ $s .= Linker::commentBlock( $description, $wgTitle );
$s .= "</li>\n";
return $s;
}
* @package MediaWiki
*/
class Linker {
-
function Linker() {}
/**
* @deprecated
*/
- function postParseLinkColour( $s = NULL ) {
+ private static function postParseLinkColour( $s = NULL ) {
return NULL;
}
- /** @todo document */
- function getExternalLinkAttributes( $link, $text, $class='' ) {
+ /**
+ * @todo document
+ * @static
+ */
+ protected static function getExternalLinkAttributes( $link, $text, $class='' ) {
$link = htmlspecialchars( $link );
$r = ($class != '') ? " class=\"$class\"" : " class=\"external\"";
return $r;
}
- function getInterwikiLinkAttributes( $link, $text, $class='' ) {
+ /**
+ * @todo document
+ * @static
+ */
+ protected static function getInterwikiLinkAttributes( $link, $text, $class='' ) {
global $wgContLang;
$same = ($link == $text);
return $r;
}
- /** @todo document */
- function getInternalLinkAttributes( $link, $text, $broken = false ) {
+ /**
+ * Unfortunately cannot be protected because it is needed by ImagePage.php.
+ * @todo document
+ * @static
+ */
+ static function getInternalLinkAttributes( $link, $text, $broken = false ) {
$link = urldecode( $link );
$link = str_replace( '_', ' ', $link );
$link = htmlspecialchars( $link );
}
/**
- * @param $nt Title object.
- * @param $text String: FIXME
- * @param $broken Boolean: FIXME, default 'false'.
+ * @param $nt Title object
+ * @param $text String FIXME
+ * @param $broken String FIXME, default false
+ *
+ * @static
*/
- function getInternalLinkAttributesObj( &$nt, $text, $broken = false ) {
+ protected static function getInternalLinkAttributesObj( &$nt, $text, $broken = false ) {
if( $broken == 'stub' ) {
$r = ' class="stub"';
} else if ( $broken == 'yes' ) {
/**
* This function is a shortcut to makeLinkObj(Title::newFromText($title),...). Do not call
* it if you already have a title object handy. See makeLinkObj for further documentation.
- *
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
+ *
+ * @param $title String the text of the title
+ * @param $text String link text
+ * @param $query String optional query part
+ * @param $trail String optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ *
+ * @static
*/
- function makeLink( $title, $text = '', $query = '', $trail = '' ) {
+ public static function makeLink( $title, $text = '', $query = '', $trail = '' ) {
wfProfileIn( 'Linker::makeLink' );
$nt = Title::newFromText( $title );
if ($nt) {
- $result = $this->makeLinkObj( Title::newFromText( $title ), $text, $query, $trail );
+ $result = self::makeLinkObj( $nt, $text, $query, $trail );
} else {
- wfDebug( 'Invalid title passed to Linker::makeLink(): "'.$title."\"\n" );
- $result = $text == "" ? $title : $text;
+ wfDebug( "Invalid title passed to Linker::makeLink(): \"$title\"\n" );
+ $result = $text == '' ? $title : $text;
}
wfProfileOut( 'Linker::makeLink' );
* This function is a shortcut to makeKnownLinkObj(Title::newFromText($title),...). Do not call
* it if you already have a title object handy. See makeKnownLinkObj for further documentation.
*
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
+ * @param $title String the text of the title
+ * @param $text String link text
+ * @param $query String optional query part
+ * @param $trail String optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ *
+ * @static
*/
- function makeKnownLink( $title, $text = '', $query = '', $trail = '', $prefix = '',$aprops = '') {
+ public static function makeKnownLink( $title, $text = '', $query = '', $trail = '', $prefix = '',$aprops = '') {
$nt = Title::newFromText( $title );
if ($nt) {
- return $this->makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail, $prefix , $aprops );
+ return self::makeKnownLinkObj( Title::newFromText( $title ), $text, $query, $trail, $prefix, $aprops );
} else {
- wfDebug( 'Invalid title passed to Linker::makeKnownLink(): "'.$title."\"\n" );
+ wfDebug( "Invalid title passed to Linker::makeKnownLink(): \"$title\"\n" );
return $text == '' ? $title : $text;
}
}
* This function is a shortcut to makeBrokenLinkObj(Title::newFromText($title),...). Do not call
* it if you already have a title object handy. See makeBrokenLinkObj for further documentation.
*
- * @param string $title The text of the title
- * @param string $text Link text
- * @param string $query Optional query part
- * @param string $trail Optional trail. Alphabetic characters at the start of this string will
+ * @param $title String The text of the title
+ * @param $text String Link text
+ * @param $query String Optional query part
+ * @param $trail String Optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ *
+ * @static
*/
- function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) {
+ public static function makeBrokenLink( $title, $text = '', $query = '', $trail = '' ) {
$nt = Title::newFromText( $title );
if ($nt) {
- return $this->makeBrokenLinkObj( Title::newFromText( $title ), $text, $query, $trail );
+ return self::makeBrokenLinkObj( Title::newFromText( $title ), $text, $query, $trail );
} else {
- wfDebug( 'Invalid title passed to Linker::makeBrokenLink(): "'.$title."\"\n" );
+ wfDebug( "Invalid title passed to Linker::makeBrokenLink(): \"$title\"\n" );
return $text == '' ? $title : $text;
}
}
* This function is a shortcut to makeStubLinkObj(Title::newFromText($title),...). Do not call
* it if you already have a title object handy. See makeStubLinkObj for further documentation.
*
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
+ * @param $title String the text of the title
+ * @param $text String link text
+ * @param $query String optional query part
+ * @param $trail String optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ *
+ * @static
*/
- function makeStubLink( $title, $text = '', $query = '', $trail = '' ) {
+ public static function makeStubLink( $title, $text = '', $query = '', $trail = '' ) {
$nt = Title::newFromText( $title );
if ($nt) {
- return $this->makeStubLinkObj( Title::newFromText( $title ), $text, $query, $trail );
+ return self::makeStubLinkObj( Title::newFromText( $title ), $text, $query, $trail );
} else {
- wfDebug( 'Invalid title passed to Linker::makeStubLink(): "'.$title."\"\n" );
+ wfDebug( "Invalid title passed to Linker::makeStubLink(): \"$title\"\n" );
return $text == '' ? $title : $text;
}
}
* call this lots of times, pre-fill the link cache with a LinkBatch, otherwise each
* call to this will result in a DB query.
*
- * @param $nt Title: the title object to make the link from, e.g. from
- * Title::newFromText.
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
- * be included in the link text. Other characters will be appended after
- * the end of the link.
- * @param $prefix String: optional prefix. As trail, only before instead of after.
+ * @param $nt Title the title object to make the link from, e.g. from Title::newFromText
+ * @param $text String link text
+ * @param $query String optional query part
+ * @param $trail String optional trail. Alphabetic characters at the start of this string will
+ * be included in the link text. Other characters will be appended after
+ * the end of the link.
+ * @param $prefix String optional prefix. As trail, only before instead of after.
+ * @static
*/
- function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
+ public static function makeLinkObj( $nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
global $wgUser;
$fname = 'Linker::makeLinkObj';
wfProfileIn( $fname );
# Fail gracefully
- if ( ! is_object($nt) ) {
+ if ( !is_object($nt) ) {
# throw new MWException();
wfProfileOut( $fname );
return "<!-- ERROR -->{$prefix}{$text}{$trail}";
$u = $nt->getFullURL();
$link = $nt->getPrefixedURL();
if ( '' == $text ) { $text = $nt->getPrefixedText(); }
- $style = $this->getInterwikiLinkAttributes( $link, $text, 'extiw' );
+ $style = self::getInterwikiLinkAttributes( $link, $text, 'extiw' );
$inside = '';
if ( '' != $trail ) {
}
# Check for anchors, normalize the anchor
-
$parts = explode( '#', $u, 2 );
if ( count( $parts ) == 2 ) {
$anchor = urlencode( Sanitizer::decodeCharReferences( str_replace(' ', '_', $parts[1] ) ) );
return $t;
} elseif ( $nt->isAlwaysKnown() ) {
# Image links, special page links and self-links with fragements are always known.
- $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
+ $retVal = self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
wfProfileIn( $fname.'-immediate' );
# Work out link colour immediately
$aid = $nt->getArticleID() ;
if ( 0 == $aid ) {
- $retVal = $this->makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
+ $retVal = self::makeBrokenLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
$threshold = $wgUser->getOption('stubthreshold') ;
if ( $threshold > 0 ) {
$size = 1 ;
}
if ( $size < $threshold ) {
- $retVal = $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
+ $retVal = self::makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
- $retVal = $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
+ $retVal = self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
}
}
wfProfileOut( $fname.'-immediate' );
* Make a link for a title which definitely exists. This is faster than makeLinkObj because
* it doesn't have to do a database query. It's also valid for interwiki titles and special
* pages.
- *
- * @param $nt Title object of target page
- * @param $text String: text to replace the title
- * @param $query String: link target
- * @param $trail String: text after link
- * @param $prefix String: text before link text
- * @param $aprops String: extra attributes to the a-element
- * @param $style String: style to apply - if empty, use getInternalLinkAttributesObj instead
- * @return the a-element
+ *
+ * @param $nt Title object of target page
+ * @param $text String text to replace the title
+ * @param $query String link target
+ * @param $trail String text after link
+ * @param $prefix String text before link text
+ * @param $aprops String extra attributes to the a-element
+ * @param $style String style to apply
+ * @return String HTML for link
+ *
+ * @static
*/
- function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) {
-
+ public static function makeKnownLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' ) {
$fname = 'Linker::makeKnownLinkObj';
wfProfileIn( $fname );
$text = htmlspecialchars( $nt->getPrefixedText() );
}
if ( $style == '' ) {
- $style = $this->getInternalLinkAttributesObj( $nt, $text );
+ $style = self::getInternalLinkAttributesObj( $nt, $text );
}
if ( $aprops !== '' ) $aprops = ' ' . $aprops;
- list( $inside, $trail ) = Linker::splitTrail( $trail );
+ list( $inside, $trail ) = self::splitTrail( $trail );
$r = "<a href=\"{$u}\"{$style}{$aprops}>{$prefix}{$text}{$inside}</a>{$trail}";
wfProfileOut( $fname );
return $r;
/**
* Make a red link to the edit page of a given title.
*
- * @param $title String: The text of the title
- * @param $text String: Link text
- * @param $query String: Optional query part
- * @param $trail String: Optional trail. Alphabetic characters at the start of this string will
+ * @param $title String The text of the title
+ * @param $text String Link text
+ * @param $query String Optional query part
+ * @param $trail String Optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ *
+ * @static
*/
- function makeBrokenLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ public static function makeBrokenLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
# Fail gracefully
- if ( ! isset($nt) ) {
+ if ( !isset($nt) ) {
# throw new MWException();
return "<!-- ERROR -->{$prefix}{$text}{$trail}";
}
if ( '' == $text ) {
$text = htmlspecialchars( $nt->getPrefixedText() );
}
- $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
+ $style = self::getInternalLinkAttributesObj( $nt, $text, 'yes' );
- list( $inside, $trail ) = Linker::splitTrail( $trail );
+ list( $inside, $trail ) = self::splitTrail( $trail );
$s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
wfProfileOut( $fname );
/**
* Make a brown link to a short article.
*
- * @param $title String: the text of the title
- * @param $text String: link text
- * @param $query String: optional query part
- * @param $trail String: optional trail. Alphabetic characters at the start of this string will
+ * @param $title String the text of the title
+ * @param $text String link text
+ * @param $query String optional query part
+ * @param $trail String optional trail. Alphabetic characters at the start of this string will
* be included in the link text. Other characters will be appended after
* the end of the link.
+ *
+ * @static
*/
- function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ public static function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
$link = $nt->getPrefixedURL();
$u = $nt->escapeLocalURL( $query );
if ( '' == $text ) {
$text = htmlspecialchars( $nt->getPrefixedText() );
}
- $style = $this->getInternalLinkAttributesObj( $nt, $text, 'stub' );
+ $style = self::getInternalLinkAttributesObj( $nt, $text, 'stub' );
- list( $inside, $trail ) = Linker::splitTrail( $trail );
+ list( $inside, $trail ) = self::splitTrail( $trail );
$s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
return $s;
}
/**
* Generate either a normal exists-style link or a stub link, depending
* on the given page size.
- *
+ *
* @param $size Integer
- * @param $nt Title object.
+ * @param $nt Title object
* @param $text String
* @param $query String
* @param $trail String
* @param $prefix String
- * @return string HTML of link
+ * @return String HTML of link
+ *
+ * @static
*/
- function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ public static function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
global $wgUser;
$threshold = intval( $wgUser->getOption( 'stubthreshold' ) );
if( $size < $threshold ) {
- return $this->makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
+ return self::makeStubLinkObj( $nt, $text, $query, $trail, $prefix );
} else {
- return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
+ return self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
}
}
- /**
+ /**
* Make appropriate markup for a link to the current article. This is currently rendered
* as the bold link text. The calling sequence is the same as the other make*LinkObj functions,
* despite $query not being used.
+ *
+ * @static
*/
- function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ public static function makeSelfLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
if ( '' == $text ) {
$text = htmlspecialchars( $nt->getPrefixedText() );
}
- list( $inside, $trail ) = Linker::splitTrail( $trail );
+ list( $inside, $trail ) = self::splitTrail( $trail );
return "<strong class=\"selflink\">{$prefix}{$text}{$inside}</strong>{$trail}";
}
- /** @todo document */
- function fnamePart( $url ) {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function fnamePart( $url ) {
$basename = strrchr( $url, '/' );
if ( false === $basename ) {
$basename = $url;
return htmlspecialchars( $basename );
}
- /** Obsolete alias */
- function makeImage( $url, $alt = '' ) {
- return $this->makeExternalImage( $url, $alt );
+ /**
+ * @deprecated Obsolete alias
+ */
+ private static function makeImage( $url, $alt = '' ) {
+ return self::makeExternalImage( $url, $alt );
}
- /** @todo document */
- function makeExternalImage( $url, $alt = '' ) {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function makeExternalImage( $url, $alt = '' ) {
if ( '' == $alt ) {
- $alt = $this->fnamePart( $url );
+ $alt = self::fnamePart( $url );
}
$s = '<img src="'.$url.'" alt="'.$alt.'" />';
return $s;
}
- /** @todo document */
- function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
- $thumb = false, $manual_thumb = '', $page = null )
- {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function makeImageLinkObj( $nt, $label, $alt, $align = '', $width = false, $height = false, $framed = false,
+ $thumb = false, $manual_thumb = '', $page = null ) {
global $wgContLang, $wgUser, $wgThumbLimits, $wgGenerateThumbnailOnParse;
- $img = new Image( $nt );
+ $img = new Image( $nt );
- if ( ! is_null( $page ) ) {
+ if ( !is_null( $page ) ) {
$img->selectPage( $page );
}
if ( !$img->allowInlineDisplay() && $img->exists() ) {
- return $this->makeKnownLinkObj( $nt );
+ return self::makeKnownLinkObj( $nt );
}
- $url = $img->getViewURL();
+ $url = $img->getViewURL();
$error = $prefix = $postfix = '';
wfDebug( "makeImageLinkObj: '$width'x'$height', \"$label\"\n" );
- if ( 'center' == $align )
- {
+ if ( 'center' == $align ) {
$prefix = '<div class="center">';
$postfix = '</div>';
$align = 'none';
}
if ( $thumb || $framed ) {
-
# Create a thumbnail. Alignment depends on language
- # writing direction, # right aligned for left-to-right-
+ # writing direction: right-aligned for left-to-right-
# languages ("Western languages"), left-aligned
# for right-to-left-languages ("Semitic languages")
#
- # If thumbnail width has not been provided, it is set
+ # If thumbnail width has not been provided, it is set
# to the default user option as specified in Language*.php
if ( $align == '' ) {
$align = $wgContLang->isRTL() ? 'left' : 'right';
}
-
if ( $width === false ) {
$wopt = $wgUser->getOption( 'thumbsize' );
$width = min( $img->getWidth(), $wgThumbLimits[$wopt] );
}
- return $prefix.$this->makeThumbLinkObj( $img, $label, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix;
+ return $prefix.self::makeThumbLinkObj( $img, $label, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix;
}
if ( $width && $img->exists() ) {
-
# Create a resized image, without the additional thumbnail
# features
-
if ( $height == false )
$height = -1;
if ( $manual_thumb == '') {
if ( $error ) {
$s = $error;
} elseif ( $url == '' ) {
- $s = $this->makeBrokenImageLinkObj( $img->getTitle() );
+ $s = self::makeBrokenImageLinkObj( $img->getTitle() );
//$s .= "<br />{$alt}<br />{$url}<br />\n";
} else {
$s = '<a href="'.$u.'" class="image" title="'.$alt.'">' .
/**
* Make HTML for a thumbnail including image, border and caption
* $img is an Image object
+ *
+ * @static
*/
- function makeThumbLinkObj( $img, $label = '', $alt, $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
+ public static function makeThumbLinkObj( $img, $label = '', $alt, $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
global $wgStylePath, $wgContLang, $wgGenerateThumbnailOnParse;
$thumbUrl = '';
$error = '';
}
$oboxwidth = $boxwidth + 2;
- if ( $manual_thumb != '' ) # Use manually specified thumbnail
- {
+ if ( $manual_thumb != '' ) { # Use manually specified thumbnail
$manual_title = Title::makeTitleSafe( NS_IMAGE, $manual_thumb ); #new Title ( $manual_thumb ) ;
if( $manual_title ) {
$manual_img = new Image( $manual_title );
$thumbUrl = $manual_img->getViewURL();
- if ( $manual_img->exists() )
- {
+ if ( $manual_img->exists() ) {
$width = $manual_img->getWidth();
$height = $manual_img->getHeight();
- $boxwidth = $width ;
- $boxheight = $height ;
- $oboxwidth = $boxwidth + 2 ;
+ $boxwidth = $width;
+ $boxheight = $height;
+ $oboxwidth = $boxwidth + 2;
}
}
}
$s .= htmlspecialchars( $error );
$zoomicon = '';
} elseif( !$img->exists() ) {
- $s .= $this->makeBrokenImageLinkObj( $img->getTitle() );
+ $s .= self::makeBrokenImageLinkObj( $img->getTitle() );
$zoomicon = '';
} else {
$s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
/**
* Pass a title object, not a title string
+ *
+ * @static
*/
- function makeBrokenImageLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
+ public static function makeBrokenImageLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
# Fail gracefully
- if ( ! isset($nt) ) {
+ if ( !isset($nt) ) {
# throw new MWException();
return "<!-- ERROR -->{$prefix}{$text}{$trail}";
}
if ( '' == $text ) {
$text = htmlspecialchars( $nt->getPrefixedText() );
}
- $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
- list( $inside, $trail ) = Linker::splitTrail( $trail );
+ $style = self::getInternalLinkAttributesObj( $nt, $text, 'yes' );
+ list( $inside, $trail ) = self::splitTrail( $trail );
$s = "<a href=\"{$url}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
wfProfileOut( $fname );
return $s;
}
- /** @todo document */
- function makeMediaLink( $name, /* wtf?! */ $url, $alt = '' ) {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function makeMediaLink( $name, /* wtf?! */ $url, $alt = '' ) {
$nt = Title::makeTitleSafe( NS_IMAGE, $name );
- return $this->makeMediaLinkObj( $nt, $alt );
+ return self::makeMediaLinkObj( $nt, $alt );
}
/**
* Create a direct link to a given uploaded file.
- *
- * @param $title Title object.
- * @param $text String: pre-sanitized HTML
- * @param $nourl Boolean: Mask absolute URLs, so the parser doesn't
- * linkify them (it is currently not context-aware)
- * @return string HTML
- *
- * @public
+ *
+ * @param $title Title object
+ * @param $text String pre-sanitized HTML
+ * @return String HTML
+ *
+ * @static
* @todo Handle invalid or missing images better.
*/
- function makeMediaLinkObj( $title, $text = '' ) {
+ public static function makeMediaLinkObj( $title, $text = '' ) {
if( is_null( $title ) ) {
### HOTFIX. Instead of breaking, return empty string.
return $text;
}
}
- /** @todo document */
- function specialLink( $name, $key = '' ) {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function specialLink( $name, $key = '' ) {
global $wgContLang;
if ( '' == $key ) { $key = strtolower( $name ); }
$pn = $wgContLang->ucfirst( $name );
- return $this->makeKnownLink( $wgContLang->specialPage( $pn ),
- wfMsg( $key ) );
+ return self::makeKnownLink( $wgContLang->specialPage( $pn ), wfMsg( $key ) );
}
- /** @todo document */
- function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
- $style = $this->getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
+ /**
+ * @todo document
+ * @static
+ */
+ public static function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
+ $style = self::getExternalLinkAttributes( $url, $text, 'external ' . $linktype );
global $wgNoFollowLinks, $wgNoFollowNsExceptions;
if( $wgNoFollowLinks && !(isset($ns) && in_array($ns, $wgNoFollowNsExceptions)) ) {
$style .= ' rel="nofollow"';
/**
* Make user link (or user contributions for unregistered users)
- * @param $userId Integer: user id in database.
- * @param $userText String: user name in database
- * @return string HTML fragment
- * @private
+ * @param $userId Integer user id in database
+ * @param $userText String user name in database
+ * @return String HTML fragment
+ *
+ * @static
*/
- function userLink( $userId, $userText ) {
+ public static function userLink( $userId, $userText ) {
$encName = htmlspecialchars( $userText );
if( $userId == 0 ) {
$contribsPage = SpecialPage::getTitleFor( 'Contributions' );
- return $this->makeKnownLinkObj( $contribsPage,
+ return self::makeKnownLinkObj( $contribsPage,
$encName, 'target=' . urlencode( $userText ) );
} else {
$userPage = Title::makeTitle( NS_USER, $userText );
- return $this->makeLinkObj( $userPage, $encName );
+ return self::makeLinkObj( $userPage, $encName );
}
}
/**
- * @param $userId Integer: user id in database.
- * @param $userText String: user name in database.
- * @return string HTML fragment with talk and/or block links
- * @private
+ * @param $userId Integer user id in database
+ * @param $userText String user name in database
+ * @return String HTML fragment with talk and/or block links
+ *
+ * @static
*/
- function userToolLinks( $userId, $userText ) {
+ public static function userToolLinks( $userId, $userText ) {
global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
$talkable = !( $wgDisableAnonTalk && 0 == $userId );
$blockable = ( $wgSysopUserBans || 0 == $userId );
$items = array();
if( $talkable ) {
- $items[] = $this->userTalkLink( $userId, $userText );
+ $items[] = self::userTalkLink( $userId, $userText );
}
if( $userId ) {
$contribsPage = SpecialPage::getTitleFor( 'Contributions' );
- $items[] = $this->makeKnownLinkObj( $contribsPage,
+ $items[] = self::makeKnownLinkObj( $contribsPage,
wfMsgHtml( 'contribslink' ), 'target=' . urlencode( $userText ) );
}
if( $blockable && $wgUser->isAllowed( 'block' ) ) {
- $items[] = $this->blockLink( $userId, $userText );
+ $items[] = self::blockLink( $userId, $userText );
}
if( $items ) {
}
/**
- * @param $userId Integer: user id in database.
- * @param $userText String: user name in database.
- * @return string HTML fragment with user talk link
- * @private
+ * @param $userId Integer user id in database
+ * @param $userText String user name in database
+ * @return String HTML fragment with user talk link
+ *
+ * @static
*/
- function userTalkLink( $userId, $userText ) {
+ public static function userTalkLink( $userId, $userText ) {
global $wgLang;
$talkname = $wgLang->getNsText( NS_TALK ); # use the shorter name
$userTalkPage = Title::makeTitle( NS_USER_TALK, $userText );
- $userTalkLink = $this->makeLinkObj( $userTalkPage, $talkname );
+ $userTalkLink = self::makeLinkObj( $userTalkPage, $talkname );
return $userTalkLink;
}
/**
- * @param $userId Integer: userid
- * @param $userText String: user name in database.
+ * @param $userId Integer userid
+ * @param $userText String user name in database
* @return string HTML fragment with block link
- * @private
+ *
+ * @static
*/
- function blockLink( $userId, $userText ) {
+ public static function blockLink( $userId, $userText ) {
$blockPage = SpecialPage::getTitleFor( 'Blockip' );
- $blockLink = $this->makeKnownLinkObj( $blockPage,
+ $blockLink = self::makeKnownLinkObj( $blockPage,
wfMsgHtml( 'blocklink' ), 'ip=' . urlencode( $userText ) );
return $blockLink;
}
-
+
/**
* Generate a user link if the current user is allowed to view it
- * @param $rev Revision object.
+ * @param $rev Revision object
* @return string HTML
+ *
+ * @static
*/
- function revUserLink( $rev ) {
+ public static function revUserLink( $rev ) {
if( $rev->userCan( Revision::DELETED_USER ) ) {
- $link = $this->userLink( $rev->getRawUser(), $rev->getRawUserText() );
+ $link = self::userLink( $rev->getRawUser(), $rev->getRawUserText() );
} else {
$link = wfMsgHtml( 'rev-deleted-user' );
}
/**
* Generate a user tool link cluster if the current user is allowed to view it
- * @param $rev Revision object.
+ * @param $rev Revision object
* @return string HTML
+ *
+ * @static
*/
- function revUserTools( $rev ) {
+ public static function revUserTools( $rev ) {
if( $rev->userCan( Revision::DELETED_USER ) ) {
- $link = $this->userLink( $rev->getRawUser(), $rev->getRawUserText() ) .
+ $link = self::userLink( $rev->getRawUser(), $rev->getRawUserText() ) .
' ' .
- $this->userToolLinks( $rev->getRawUser(), $rev->getRawUserText() );
+ self::userToolLinks( $rev->getRawUser(), $rev->getRawUserText() );
} else {
$link = wfMsgHtml( 'rev-deleted-user' );
}
}
return $link;
}
-
+
/**
* This function is called by all recent changes variants, by the page history,
* and by the user contributions list. It is responsible for formatting edit
* comments. It escapes any HTML in the comment, but adds some CSS to format
* auto-generated comments (from section editing) and formats [[wikilinks]].
- *
+ *
* The $title parameter must be a title OBJECT. It is used to generate a
* direct link to the section in the autocomment.
* @author Erik Moeller <moeller@scireview.de>
- *
+ *
* Note: there's not always a title to pass to this function.
* Since you can't set a default parameter for a reference, I've turned it
* temporarily to a value pass. Should be adjusted further. --brion
+ *
+ * @static
*/
- function formatComment($comment, $title = NULL) {
+ public static function formatComment( $comment, $title = NULL ) {
$fname = 'Linker::formatComment';
wfProfileIn( $fname );
$section = str_replace( ']]', '', $section );
$sectionTitle = wfClone( $title );
$sectionTitle->mFragment = $section;
- $link = $this->makeKnownLinkObj( $sectionTitle, wfMsg( 'sectionlink' ) );
+ $link = self::makeKnownLinkObj( $sectionTitle, wfMsg( 'sectionlink' ) );
}
$sep='-';
$auto=$link.$auto;
if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
# Media link; trail not supported.
$linkRegexp = '/\[\[(.*?)\]\]/';
- $thelink = $this->makeMediaLink( $submatch[1], "", $text );
+ $thelink = self::makeMediaLink( $submatch[1], "", $text );
} else {
# Other kind of link
if( preg_match( $wgContLang->linkTrail(), $match[4], $submatch ) ) {
$linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
if ($match[1][0] == ':')
$match[1] = substr($match[1], 1);
- $thelink = $this->makeLink( $match[1], $text, "", $trail );
+ $thelink = self::makeLink( $match[1], $text, "", $trail );
}
$comment = preg_replace( $linkRegexp, wfRegexReplacement( $thelink ), $comment, 1 );
}
/**
* Wrap a comment in standard punctuation and formatting if
* it's non-empty, otherwise return empty string.
- *
- * @param $comment String: the comment.
- * @param $title Title object.
- *
- * @return string
+ *
+ * @param $comment String the comment
+ * @param $title Title object
+ * @return String
+ *
+ * @static
*/
- function commentBlock( $comment, $title = NULL ) {
+ public static function commentBlock( $comment, $title = NULL ) {
// '*' used to be the comment inserted by the software way back
// in antiquity in case none was provided, here for backwards
// compatability, acc. to brion -ævar
if( $comment == '' || $comment == '*' ) {
return '';
} else {
- $formatted = $this->formatComment( $comment, $title );
+ $formatted = self::formatComment( $comment, $title );
return " <span class=\"comment\">($formatted)</span>";
}
}
-
+
/**
* Wrap and format the given revision's comment block, if the current
* user is allowed to view it.
- * @param $rev Revision object.
- * @return string HTML
+ * @param $rev Revision object
+ * @return String HTML
+ *
+ * @static
*/
- function revComment( $rev ) {
+ public static function revComment( $rev ) {
if( $rev->userCan( Revision::DELETED_COMMENT ) ) {
- $block = $this->commentBlock( $rev->getRawComment(), $rev->getTitle() );
+ $block = self::commentBlock( $rev->getRawComment(), $rev->getTitle() );
} else {
$block = " <span class=\"comment\">" .
wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
return $block;
}
- /** @todo document */
- function tocIndent() {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function tocIndent() {
return "\n<ul>";
}
- /** @todo document */
- function tocUnindent($level) {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function tocUnindent($level) {
return "</li>\n" . str_repeat( "</ul>\n</li>\n", $level>0 ? $level : 0 );
}
/**
* parameter level defines if we are on an indentation level
+ *
+ * @static
*/
- function tocLine( $anchor, $tocline, $tocnumber, $level ) {
+ public static function tocLine( $anchor, $tocline, $tocnumber, $level ) {
return "\n<li class=\"toclevel-$level\"><a href=\"#" .
$anchor . '"><span class="tocnumber">' .
$tocnumber . '</span> <span class="toctext">' .
$tocline . '</span></a>';
}
- /** @todo document */
- function tocLineEnd() {
+ /**
+ * @todo document
+ * @static
+ */
+ static function tocLineEnd() {
return "</li>\n";
}
- /** @todo document */
- function tocList($toc) {
+ /**
+ * @todo document
+ * @static
+ */
+ static function tocList($toc) {
global $wgJsMimeType;
- $title = wfMsgForContent('toc') ;
+ $title = wfMsgForContent('toc') ;
return
'<table id="toc" class="toc" summary="' . $title .'"><tr><td>'
. '<div id="toctitle"><h2>' . $title . "</h2></div>\n"
. "</script>\n";
}
- /** @todo document */
- function editSectionLinkForOther( $title, $section ) {
+ /**
+ * @todo document
+ * @static
+ */
+ public static function editSectionLinkForOther( $title, $section ) {
global $wgContLang;
$title = Title::newFromText( $title );
$editurl = '§ion='.$section;
- $url = $this->makeKnownLinkObj( $title, wfMsg('editsection'), 'action=edit'.$editurl );
+ $url = self::makeKnownLinkObj( $title, wfMsg('editsection'), 'action=edit'.$editurl );
return "<span class=\"editsection\">[".$url."]</span>";
-
}
/**
- * @param $title Title object.
- * @param $section Integer: section number.
- * @param $hint Link String: title, or default if omitted or empty
+ * @param $title Title object
+ * @param $section Integer section number
+ * @param $hint Link String title, or default if omitted or empty
+ *
+ * @static
*/
- function editSectionLink( $nt, $section, $hint='' ) {
+ public static function editSectionLink( $nt, $section, $hint='' ) {
global $wgContLang;
$editurl = '§ion='.$section;
$hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ) . '"';
- $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint );
+ $url = self::makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint );
return "<span class=\"editsection\">[".$url."]</span>";
}
/**
* Split a link trail, return the "inside" portion and the remainder of the trail
* as a two-element array
- *
+ *
* @static
*/
- static function splitTrail( $trail ) {
+ public static function splitTrail( $trail ) {
static $regex = false;
if ( $regex === false ) {
global $wgContLang;
}
return array( $inside, $trail );
}
-
}
?>
/**
* @static
*/
- function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false, $translate=false ) {
+ static function actionText( $type, $action, $title = NULL, $forContent = true, $params = array(), $filterWikilinks=false, $translate=false ) {
global $wgLang, $wgContLang, $wgLogActions;
$key = "$type/$action";
if( is_null( $title ) ) {
$rv=wfMsg( $wgLogActions[$key] );
} else {
- if( $skin ) {
-
+ if( $forContent ) {
+ $titleLink = $title->getPrefixedText();
+ } else {
switch( $type ) {
case 'move':
- $titleLink = $skin->makeLinkObj( $title, $title->getPrefixedText(), 'redirect=no' );
- $params[0] = $skin->makeLinkObj( Title::newFromText( $params[0] ), $params[0] );
+ $titleLink = Linker::makeLinkObj( $title, $title->getPrefixedText(), 'redirect=no' );
+ $params[0] = Linker::makeLinkObj( Title::newFromText( $params[0] ), $params[0] );
break;
case 'block':
if( substr( $title->getText(), 0, 1 ) == '#' ) {
$titleLink = $title->getText();
} else {
- $titleLink = $skin->makeLinkObj( $title, $title->getText() );
- $titleLink .= ' (' . $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() ), wfMsg( 'contribslink' ) ) . ')';
+ $titleLink = Linker::makeLinkObj( $title, $title->getText() );
+ $titleLink .= ' (' . Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() ), wfMsg( 'contribslink' ) ) . ')';
}
break;
case 'rights':
$text = $wgContLang->ucfirst( $title->getText() );
- $titleLink = $skin->makeLinkObj( Title::makeTitle( NS_USER, $text ) );
+ $titleLink = Linker::makeLinkObj( Title::makeTitle( NS_USER, $text ) );
break;
default:
- $titleLink = $skin->makeLinkObj( $title );
+ $titleLink = Linker::makeLinkObj( $title );
}
-
- } else {
- $titleLink = $title->getPrefixedText();
}
if( $key == 'rights/rights' ) {
- if ($skin) {
- $rightsnone = wfMsg( 'rightsnone' );
- } else {
+ if( $forContent ) {
$rightsnone = wfMsgForContent( 'rightsnone' );
+ } else {
+ $rightsnone = wfMsg( 'rightsnone' );
}
if( !isset( $params[0] ) || trim( $params[0] ) == '' )
$params[0] = $rightsnone;
$params[1] = $rightsnone;
}
if( count( $params ) == 0 ) {
- if ( $skin ) {
- $rv = wfMsg( $wgLogActions[$key], $titleLink );
- } else {
+ if ( $forContent ) {
$rv = wfMsgForContent( $wgLogActions[$key], $titleLink );
+ } else {
+ $rv = wfMsg( $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, !$skin );
+ $rv = wfMsgReal( $wgLogActions[$key], $params, true, $forContent );
}
}
} else {
$rv = "$action";
}
if( $filterWikilinks ) {
- $rv = str_replace( "[[", "", $rv );
- $rv = str_replace( "]]", "", $rv );
+ $rv = str_replace( '[[', '', $rv );
+ $rv = str_replace( ']]', '', $rv );
}
return $rv;
}
$this->action = $action;
$this->target = $target;
$this->comment = $comment;
- $this->params = LogPage::makeParamBlob( $params );
+ $this->params = self::makeParamBlob( $params );
- $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params );
+ $this->actionText = self::actionText( $this->type, $action, $target, true, $params );
return $this->saveContent();
}
* Create a blob from a parameter array
* @static
*/
- function makeParamBlob( $params ) {
+ static function makeParamBlob( $params ) {
return implode( "\n", $params );
}
* Extract a parameter array from a blob
* @static
*/
- function extractParams( $blob ) {
+ static function extractParams( $blob ) {
if ( $blob === '' ) {
return array();
} else {
* Add an array of categories, with names in the keys
*/
public function addCategoryLinks($categories) {
- global $wgUser, $wgContLang;
+ global $wgContLang;
if ( !is_array( $categories ) ) {
return;
$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[] = $sk->makeLinkObj( $title, $text );
+ $this->mCategoryLinks[] = Linker::makeLinkObj( $title, $text );
}
}
# 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 );
* @param string $permission key required
*/
public function permissionRequired( $permission ) {
- global $wgGroupPermissions, $wgUser;
+ global $wgGroupPermissions;
$this->setPageTitle( wfMsg( 'badaccess' ) );
$this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
$groupName = User::getGroupName( $key );
$groupPage = User::getGroupPage( $key );
if( $groupPage ) {
- $skin =& $wgUser->getSkin();
- $groups[] = '"'.$skin->makeLinkObj( $groupPage, $groupName ).'"';
+ $groups[] = '"'.Linker::makeLinkObj( $groupPage, $groupName ).'"';
} else {
$groups[] = '"'.$groupName.'"';
}
return;
}
- $skin = $wgUser->getSkin();
-
$this->setPageTitle( wfMsg( 'loginreqtitle' ) );
$this->setHtmlTitle( wfMsg( 'errorpagetitle' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
$this->setArticleFlag( false );
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
- $loginLink = $skin->makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
+ $loginLink = Linker::makeKnownLinkObj( $loginTitle, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $wgTitle->getPrefixedUrl() );
$this->addHtml( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
$this->addHtml( "\n<!--" . $wgTitle->getPrefixedUrl() . "-->" );
$this->setArticleRelated( false );
if( $protected ) {
- $skin = $wgUser->getSkin();
$this->setPageTitle( wfMsg( 'viewsource' ) );
- $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
+ $this->setSubtitle( wfMsg( 'viewsourcefor', Linker::makeKnownLinkObj( $wgTitle ) ) );
# Determine if protection is due to the page being a system message
# and show an appropriate explanation
* @param $returnto page title to return to. Default is Main Page.
*/
public function returnToMain( $auto = true, $returnto = NULL ) {
- global $wgUser, $wgOut, $wgRequest;
+ global $wgOut, $wgRequest;
if ( $returnto == NULL ) {
$returnto = $wgRequest->getText( 'returnto' );
$titleObj = Title::newMainPage();
}
- $sk = $wgUser->getSkin();
- $link = $sk->makeLinkObj( $titleObj, '' );
+ $link = Linker::makeLinkObj( $titleObj, '' );
$r = wfMsg( 'returnto', $link );
if ( $auto ) {
const DIR_PREV = 0;
const DIR_NEXT = 1;
- var $mArticle, $mTitle, $mSkin;
+ var $mArticle, $mTitle;
var $lastdate;
var $linesonpage;
var $mNotificationTimestamp;
* @returns nothing
*/
function PageHistory($article) {
- global $wgUser;
-
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
$this->mNotificationTimestamp = NULL;
- $this->mSkin = $wgUser->getSkin();
}
/**
$wgOut->setSyndicated( true );
$logPage = SpecialPage::getTitleFor( 'Log' );
- $logLink = $this->mSkin->makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ), 'page=' . $this->mTitle->getPrefixedUrl() );
+ $logLink = Linker::makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ), 'page=' . $this->mTitle->getPrefixedUrl() );
$subtitle = wfMsgHtml( 'revhistory' ) . '<br />' . $logLink;
$wgOut->setSubtitle( $subtitle );
$arbitrary = $this->diffButtons( $rev, $firstInList, $counter );
$link = $this->revLink( $rev );
- $user = $this->mSkin->userLink( $rev->getUser(), $rev->getUserText() )
- . $this->mSkin->userToolLinks( $rev->getUser(), $rev->getUserText() );
+ $user = Linker::userLink( $rev->getUser(), $rev->getUserText() )
+ . Linker::userToolLinks( $rev->getUser(), $rev->getUserText() );
$s .= "($curlink) ($lastlink) $arbitrary";
// We don't currently handle well changing the top revision's settings
$del = wfMsgHtml( 'rev-delundel' );
} else {
- $del = $this->mSkin->makeKnownLinkObj( $revdel,
+ $del = Linker::makeKnownLinkObj( $revdel,
wfMsg( 'rev-delundel' ),
'target=' . urlencode( $this->mTitle->getPrefixedDbkey() ) .
'&oldid=' . urlencode( $rev->getId() ) );
$s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
}
- $s .= $this->mSkin->revComment( $rev );
+ $s .= Linker::revComment( $rev );
if ($notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp)) {
$s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
}
global $wgLang;
$date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
if( $rev->userCan( Revision::DELETED_TEXT ) ) {
- $link = $this->mSkin->makeKnownLinkObj(
+ $link = Linker::makeKnownLinkObj(
$this->mTitle, $date, "oldid=" . $rev->getId() );
} else {
$link = $date;
if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
return $cur;
} else {
- return $this->mSkin->makeKnownLinkObj(
+ return Linker::makeKnownLinkObj(
$this->mTitle, $cur,
'diff=' . $this->getLatestID() .
"&oldid=" . $rev->getId() );
return $last;
} elseif ( $next === 'unknown' ) {
# Next row probably exists but is unknown, use an oldid=prev link
- return $this->mSkin->makeKnownLinkObj(
+ return Linker::makeKnownLinkObj(
$this->mTitle,
$last,
"diff=" . $rev->getId() . "&oldid=prev" );
} elseif( !$rev->userCan( Revision::DELETED_TEXT ) ) {
return $last;
} else {
- return $this->mSkin->makeKnownLinkObj(
+ return Linker::makeKnownLinkObj(
$this->mTitle,
$last,
"diff=" . $rev->getId() . "&oldid={$next->rev_id}"
if ( $query === null ) {
return $text;
} else {
- return $this->getSkin()->makeKnownLinkObj( $this->getTitle(), $text,
+ return Linker::makeKnownLinkObj( $this->getTitle(), $text,
wfArrayToCGI( $query, $this->getDefaultQuery() ) );
}
}
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
substr($m[0], 0, 20 ) . '"' );
}
- $url = wfMsg( $urlmsg, $id);
- $sk =& $this->mOptions->getSkin();
- $la = $sk->getExternalLinkAttributes( $url, $keyword.$id );
- $text = "<a href=\"{$url}\"{$la}>{$keyword} {$id}</a>";
+ $url = wfMsg( $urlmsg, $id );
+ $text = Linker::makeExternalLink( $url, "$keyword $id" );
}
return $text;
}
$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 ) );
# This means that users can paste URLs directly into the text
# Funny characters like ö aren't valid in URLs anyway
# This was changed in August 2004
- $s .= $sk->makeExternalLink( $url, $text, false, $linktype, $this->mTitle->getNamespace() ) . $dtrail . $trail;
+ $s .= Linker::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
$s = array_shift( $bits );
$i = 0;
- $sk =& $this->mOptions->getSkin();
-
while ( $i < count( $bits ) ){
$protocol = $bits[$i++];
$remainder = $bits[$i++];
$text = $this->maybeMakeExternalImage( $url );
if ( $text === false ) {
# Not an image, make a link
- $text = $sk->makeExternalLink( $url, $wgContLang->markNoConversion($url), true, 'free', $this->mTitle->getNamespace() );
+ $text = Linker::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 );
* @private
*/
function maybeMakeExternalImage( $url ) {
- $sk =& $this->mOptions->getSkin();
$imagesfrom = $this->mOptions->getAllowExternalImagesFrom();
$imagesexception = !empty($imagesfrom);
$text = false;
|| ( $imagesexception && strpos( $url, $imagesfrom ) === 0 ) ) {
if ( preg_match( EXT_IMAGE_REGEX, $url ) ) {
# Image found
- $text = $sk->makeExternalImage( htmlspecialchars( $url ) );
+ $text = Linker::makeExternalImage( htmlspecialchars( $url ) );
}
}
return $text;
# 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
if( ( $nt->getPrefixedText() === $selflink ) &&
( $nt->getFragment() === '' ) ) {
# Self-links are handled specially; generally de-link and change to bold.
- $s .= $prefix . $sk->makeSelfLinkObj( $nt, $text, '', $trail );
+ $s .= $prefix . Linker::makeSelfLinkObj( $nt, $text, '', $trail );
continue;
}
# Special and Media are pseudo-namespaces; no pages actually exist in them
if( $ns == NS_MEDIA ) {
- $link = $sk->makeMediaLinkObj( $nt, $text );
+ $link = Linker::makeMediaLinkObj( $nt, $text );
# Cloak with NOPARSE to avoid replacement in replaceExternalLinks
$s .= $prefix . $this->armorLinks( $link ) . $trail;
$this->mOutput->addImage( $nt->getDBkey() );
*/
function makeKnownLinkHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
list( $inside, $trail ) = Linker::splitTrail( $trail );
- $sk =& $this->mOptions->getSkin();
- $link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
+ $link = Linker::makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
return $this->armorLinks( $link ) . $trail;
}
$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
$toclevel++;
$sublevelCount[$toclevel] = 0;
if( $toclevel<$wgMaxTocLevel ) {
- $toc .= $sk->tocIndent();
+ $toc .= Linker::tocIndent();
}
}
elseif ( $level < $prevlevel && $toclevel > 1 ) {
}
}
if( $toclevel<$wgMaxTocLevel ) {
- $toc .= $sk->tocUnindent( $prevtoclevel - $toclevel );
+ $toc .= Linker::tocUnindent( $prevtoclevel - $toclevel );
}
}
else {
# No change in level, end TOC line
if( $toclevel<$wgMaxTocLevel ) {
- $toc .= $sk->tocLineEnd();
+ $toc .= Linker::tocLineEnd();
}
}
$anchor .= '_' . $refcount[$headlineCount];
}
if( $enoughToc && ( !isset($wgMaxTocLevel) || $toclevel<$wgMaxTocLevel ) ) {
- $toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel);
+ $toc .= Linker::tocLine($anchor, $tocline, $numbering, $toclevel);
}
# give headline the correct <h#> tag
@$head[$headlineCount] .= "<a name=\"$anchor\"></a><h".$level.$matches[2][$headlineCount];
$head[$headlineCount] = '';
}
if( $istemplate )
- $head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection);
+ $head[$headlineCount] .= Linker::editSectionLinkForOther($templatetitle, $templatesection);
else
- $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1, $headline_hint);
+ $head[$headlineCount] .= Linker::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.
if( $enoughToc ) {
if( $toclevel<$wgMaxTocLevel ) {
- $toc .= $sk->tocUnindent( $toclevel - 1 );
+ $toc .= Linker::tocUnindent( $toclevel - 1 );
}
- $toc = $sk->tocList( $toc );
+ $toc = Linker::tocList( $toc );
}
# split up and insert constructed headlines
# Disabled because it broke block formatting
# For example, a bullet point in the top line
- # $full .= $sk->editSectionLink(0);
+ # $full .= Linker::editSectionLink(0);
}
$full .= $block;
if( $enoughToc && !$i && $isMain && !$this->mForceTocPosition ) {
/**
* Replace <!--LINK--> link placeholders with actual links, in the buffer
- * Placeholders created in Skin::makeLinkObj()
+ * Placeholders created in Linker::makeLinkObj()
* Returns an array of links found, indexed by PDBK:
* 0 - broken
* 1 - normal link
$pdbks = array();
$colours = array();
- $sk =& $this->mOptions->getSkin();
$linkCache =& LinkCache::singleton();
if ( !empty( $this->mLinkHolders['namespaces'] ) ) {
$linkCache->addBadLinkObj( $title );
$colours[$pdbk] = 0;
$this->mOutput->addLink( $title, 0 );
- $wgOutputReplace[$searchkey] = $sk->makeBrokenLinkObj( $title,
+ $wgOutputReplace[$searchkey] = Linker::makeBrokenLinkObj( $title,
$this->mLinkHolders['texts'][$key],
$this->mLinkHolders['queries'][$key] );
} elseif ( $colours[$pdbk] == 1 ) {
- $wgOutputReplace[$searchkey] = $sk->makeKnownLinkObj( $title,
+ $wgOutputReplace[$searchkey] = Linker::makeKnownLinkObj( $title,
$this->mLinkHolders['texts'][$key],
$this->mLinkHolders['queries'][$key] );
} elseif ( $colours[$pdbk] == 2 ) {
- $wgOutputReplace[$searchkey] = $sk->makeStubLinkObj( $title,
+ $wgOutputReplace[$searchkey] = Linker::makeStubLinkObj( $title,
$this->mLinkHolders['texts'][$key],
$this->mLinkHolders['queries'][$key] );
}
$wgOutputReplace = array();
foreach( $this->mInterwikiLinkHolders['texts'] as $key => $link ) {
$title = $this->mInterwikiLinkHolders['titles'][$key];
- $wgOutputReplace[$key] = $sk->makeLinkObj( $title, $link );
+ $wgOutputReplace[$key] = Linker::makeLinkObj( $title, $link );
}
$text = preg_replace_callback(
$ig->setShowBytes( false );
$ig->setShowFilename( false );
$ig->setParsing();
- $ig->useSkin( $this->mOptions->getSkin() );
if( isset( $params['caption'] ) )
$ig->setCaption( $params['caption'] );
$alt = Sanitizer::stripAllTags( $alt );
# Linker does the rest
- $sk =& $this->mOptions->getSkin();
- return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $width, $height, $framed, $thumb, $manual_thumb, $page );
+ return Linker::makeImageLinkObj( $nt, $caption, $alt, $align, $width, $height, $framed, $thumb, $manual_thumb, $page );
}
/**
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
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 skin
+ var $mUser; # Stored user object, just used to initialise the date format
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
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();
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 ); }
$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' );
}
/**
- * 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.
+ * 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.
* If the function return "false", the line output will be skipped.
*/
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
return '';
}
* @param $shownavigation show navigation like "next 200"?
*/
function doQuery( $offset, $limit, $shownavigation=true ) {
- global $wgUser, $wgOut, $wgLang, $wgContLang;
+ global $wgOut, $wgLang, $wgContLang;
$this->offset = $offset;
$this->limit = $limit;
$this->preprocessResults( $dbr, $res );
- $sk = $wgUser->getSkin( );
-
if($shownavigation) {
$wgOut->addHTML( $this->getPageHeader() );
$top = wfShowingResults( $offset, $num);
# 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( $sk, $obj );
+ $format = $this->formatResult( $obj );
if ( $format ) {
$attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol &&
$obj->patrolled == 0 ) ? ' class="not-patrolled"' : '';
if($this->tryLastResult()) {
// flush the very last result
$obj = null;
- $format = $this->formatResult( $sk, $obj );
+ $format = $this->formatResult( $obj );
if( $format ) {
$attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol &&
$obj->patrolled == 0 ) ? ' class="not-patrolled"' : '';
*/
class PageQueryPage extends QueryPage {
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
- return $skin->makeKnownLinkObj( $nt, htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ) );
+ return Linker::makeKnownLinkObj( $nt, htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ) );
}
}
*/
static function normalizeKey( $key ) {
global $wgDefaultSkin;
- $skinNames = Skin::getSkinNames();
+ $skinNames = self::getSkinNames();
if( $key == '' ) {
// Don't return the default immediately;
static function &newFromKey( $key ) {
global $wgStyleDirectory;
- $key = Skin::normalizeKey( $key );
+ $key = self::normalizeKey( $key );
- $skinNames = Skin::getSkinNames();
+ $skinNames = self::getSkinNames();
$skinName = $skinNames[$key];
# Grab the skin class and initialise it.
$t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop;
$msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks ) );
- $s = $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
+ $s = self::makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
. ': ' . $t;
# optional 'dmoz-like' category browser. Will be shown under the list
$parenttree = $wgTitle->getParentCategoryTree();
# Skin object passed by reference cause it can not be
# accessed under the method subfunction drawCategoryBrowser
- $tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) );
+ $tempout = explode("\n", self::drawCategoryBrowser($parenttree, $this) );
# Clean out bogus first entry and sort them
unset($tempout[0]);
asort($tempout);
return $s;
}
- /** Render the array as a serie of links.
- * @param $tree Array: categories tree returned by Title::getParentCategoryTree
- * @param &skin Object: skin passed by reference
+ /**
+ * Render the array as a series of links.
+ * @param $tree Array categories tree returned by Title::getParentCategoryTree
+ * @param &skin Object skin passed by reference
* @return String separated by >, terminate with "\n"
+ * @static
*/
- function drawCategoryBrowser($tree, &$skin) {
+ static function drawCategoryBrowser($tree, &$skin) {
$return = '';
foreach ($tree as $element => $parent) {
if (empty($parent)) {
$return .= "\n";
} else {
# grab the others elements
- $return .= Skin::drawCategoryBrowser($parent, $skin) . ' > ';
+ $return .= self::drawCategoryBrowser($parent, $skin) . ' > ';
}
# add our current element to the list
$eltitle = Title::NewFromText($element);
- $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
+ $return .= self::makeLinkObj( $eltitle, $eltitle->getText() ) ;
}
return $return;
}
$image = new Image( $wgTitle );
if( $image->exists() ) {
$link = htmlspecialchars( $image->getURL() );
- $style = $this->getInternalLinkAttributes( $link, $name );
+ $style = self::getInternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
}
}
}
if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
- $s .= ' | ' . $this->makeKnownLinkObj( $wgTitle,
+ $s .= ' | ' . self::makeKnownLinkObj( $wgTitle,
wfMsg( 'currentrev' ) );
}
# do not show "You have new messages" text when we are viewing our
# own talk page
if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
- $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
- $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
+ $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
+ $dl = self::makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
$s.= ' | <strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
# disable caching
$wgOut->setSquidMaxage(0);
$msg = 'viewdeleted';
}
return wfMsg( $msg,
- $this->makeKnownLink(
+ self::makeKnownLink(
$wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) );
}
$c++;
if ($c<count($links)) {
$growinglink .= $link;
- $getlink = $this->makeLink( $growinglink, htmlspecialchars( $link ) );
+ $getlink = self::makeLink( $growinglink, htmlspecialchars( $link ) );
if(preg_match('/class="new"/i',$getlink)) { break; } # this is a hack, but it saves time
if ($c>1) {
$subpages .= ' | ';
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
$n = wfGetIP();
- $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
+ $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
$s .= $n . ' ('.$tl.')';
$q = '';
} else { $q = "returnto={$rt}"; }
- $s .= "\n<br />" . $this->makeKnownLinkObj(
+ $s .= "\n<br />" . self::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Userlogin' ),
wfMsg( 'login' ), $q );
} else {
$n = $wgUser->getName();
$rt = $wgTitle->getPrefixedURL();
- $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
+ $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
$tl = " ({$tl})";
- $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
+ $s .= self::makeKnownLinkObj( $wgUser->getUserPage(),
$n ) . "{$tl}<br />" .
- $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
+ self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
"returnto={$rt}" ) . ' | ' .
- $this->specialLink( 'preferences' );
+ self::specialLink( 'preferences' );
}
- $s .= ' | ' . $this->makeKnownLink( wfMsgForContent( 'helppage' ),
+ $s .= ' | ' . self::makeKnownLink( wfMsgForContent( 'helppage' ),
wfMsg( 'help' ) );
return $s;
$sep = " |\n";
$s = $this->mainPageLink() . $sep
- . $this->specialLink( 'recentchanges' );
+ . self::specialLink( 'recentchanges' );
if ( $wgOut->isArticleRelated() ) {
$s .= $sep . $this->editThisPage()
$out = '';
if( $wgRightsPage ) {
- $link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
+ $link = self::makeKnownLink( $wgRightsPage, $wgRightsText );
} elseif( $wgRightsUrl ) {
- $link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
+ $link = self::makeExternalLink( $wgRightsUrl, $wgRightsText );
} else {
# Give up now
return $out;
function mainPageLink() {
$mp = wfMsgForContent( 'mainpage' );
$mptxt = wfMsg( 'mainpage');
- $s = $this->makeKnownLink( $mp, $mptxt );
+ $s = self::makeKnownLink( $mp, $mptxt );
return $s;
}
function copyrightLink() {
- $s = $this->makeKnownLink( wfMsgForContent( 'copyrightpage' ),
+ $s = self::makeKnownLink( wfMsgForContent( 'copyrightpage' ),
wfMsg( 'copyrightpagename' ) );
return $s;
}
if ($privacy == '-') {
return '';
} else {
- return $this->makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
+ return self::makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
}
}
function aboutLink() {
- $s = $this->makeKnownLink( wfMsgForContent( 'aboutpage' ),
+ $s = self::makeKnownLink( wfMsgForContent( 'aboutpage' ),
wfMsg( 'aboutsite' ) );
return $s;
}
if ($disclaimers == '-') {
return '';
} else {
- return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
+ return self::makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
$disclaimers );
}
}
$t = wfMsg( 'viewsource' );
}
- $s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
+ $s = self::makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
}
return $s;
}
if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
$t = wfMsg( 'deletethispage' );
- $s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
+ $s = self::makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
} else {
$s = '';
}
$t = wfMsg( 'protectthispage' );
$q = 'action=protect';
}
- $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
+ $s = self::makeKnownLinkObj( $wgTitle, $t, $q );
} else {
$s = '';
}
$t = wfMsg( 'watchthispage' );
$q = 'action=watch';
}
- $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
+ $s = self::makeKnownLinkObj( $wgTitle, $t, $q );
} else {
$s = wfMsg( 'notanarticle' );
}
global $wgTitle;
if ( $wgTitle->userCanMove() ) {
- return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
+ return self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
} else {
// no message if page is protected - would be redundant
function historyLink() {
global $wgTitle;
- return $this->makeKnownLinkObj( $wgTitle,
+ return self::makeKnownLinkObj( $wgTitle,
wfMsg( 'history' ), 'action=history' );
}
function whatLinksHere() {
global $wgTitle;
- return $this->makeKnownLinkObj(
+ return self::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Whatlinkshere', $wgTitle->getPrefixedDBkey() ),
wfMsg( 'whatlinkshere' ) );
}
function userContribsLink() {
global $wgTitle;
- return $this->makeKnownLinkObj(
+ return self::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Contributions', $wgTitle->getDBkey() ),
wfMsg( 'contributions' ) );
}
function emailUserLink() {
global $wgTitle;
- return $this->makeKnownLinkObj(
+ return self::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ),
wfMsg( 'emailuser' ) );
}
if ( ! $wgOut->isArticleRelated() ) {
return '(' . wfMsg( 'notanarticle' ) . ')';
} else {
- return $this->makeKnownLinkObj(
+ return self::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ),
wfMsg( 'recentchangeslinked' ) );
}
$text = $wgContLang->getLanguageName( $nt->getInterwiki() );
if ( '' == $text ) { $text = $l; }
- $style = $this->getExternalLinkAttributes( $l, $text );
+ $style = self::getExternalLinkAttributes( $l, $text );
$s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
}
if($wgContLang->isRTL()) $s .= '</span>';
}
function bugReportsLink() {
- $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
+ $s = self::makeKnownLink( wfMsgForContent( 'bugreportspage' ),
wfMsg( 'bugreports' ) );
return $s;
}
$id = $t1->getArticleID();
if ( 0 == $id ) {
- $s = $this->makeBrokenLink( $t1->getText() );
+ $s = self::makeBrokenLink( $t1->getText() );
} else {
- $s = $this->makeKnownLink( $t1->getText() );
+ $s = self::makeKnownLink( $t1->getText() );
}
$s .= ', ';
$id = $t2->getArticleID();
if ( 0 == $id ) {
- $s .= $this->makeBrokenLink( $t2->getText() );
+ $s .= self::makeBrokenLink( $t2->getText() );
} else {
- $s .= $this->makeKnownLink( $t2->getText() );
+ $s .= self::makeKnownLink( $t2->getText() );
}
return $s;
}
$text = wfMsg( 'talkpage' );
}
- $s = $this->makeLinkObj( $link, $text );
+ $s = self::makeLinkObj( $link, $text );
return $s;
}
$title =& $wgTitle->getTalkPage();
}
- return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
+ return self::makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
}
/* these are used extensively in SkinTemplate, but also some other places */
$usertalktitle = $usertitle->getTalkPage();
if( !$usertalktitle->equals( $this->mTitle ) ) {
$ntl = wfMsg( 'youhavenewmessages',
- $this->makeKnownLinkObj(
+ self::makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessageslink' ),
'redirect=no'
),
- $this->makeKnownLinkObj(
+ self::makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessagesdifflink' ),
'diff=cur'
* @param integer $namespace (default NS_MAIN)
*/
function showToplevel ( $namespace = NS_MAIN, $including = false ) {
- global $wgOut, $wgUser;
- $sk = $wgUser->getSkin();
+ global $wgOut;
$fname = "indexShowToplevel";
# TODO: Either make this *much* faster or cache the title index points
* @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 ) );
* @param string $from list all pages from this name (default FALSE)
*/
function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
- global $wgOut, $wgUser, $wgContLang;
+ global $wgOut, $wgContLang;
$fname = 'indexShowChunk';
- $sk = $wgUser->getSkin();
-
$fromList = $this->getNamespaceKeyAndText($namespace, $from);
if ( !$fromList ) {
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if( $t ) {
$link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
- $sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
+ Linker::makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
($s->page_is_redirect ? '</div>' : '' );
} else {
$link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
$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;">' .
- $sk->makeKnownLink( $wgContLang->specialPage( "Allpages" ),
+ Linker::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 .= ' | ' . $sk->makeKnownLinkObj( $self, wfMsgHtml( 'nextpage', $t->getText() ), $q );
+ $out2 .= ' | ' . Linker::makeKnownLinkObj( $self, wfMsgHtml( 'nextpage', $t->getText() ), $q );
}
$out2 .= "</td></tr></table><hr />";
}
return false;
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
$title = Title::makeTitle( $result->namespace, $result->title );
- $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
+ $link = Linker::makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
return wfSpecialList($link, $d);
}
}
return '';
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang;
$fromObj = Title::makeTitle( $result->namespace, $result->title );
// $toObj may very easily be false if the $result list is cached
if ( !is_object( $toObj ) ) {
- return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
+ return '<s>' . Linker::makeLinkObj( $fromObj ) . '</s>';
}
- $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
- $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
- $to = $skin->makeBrokenLinkObj( $toObj );
+ $from = Linker::makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
+ $edit = Linker::makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
+ $to = Linker::makeBrokenLinkObj( $toObj );
$arr = $wgContLang->getArrow();
return "$from $edit $arr $to";
return false;
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang;
$title = Title::makeTitle( NS_CATEGORY, $result->title );
- $plink = $skin->makeLinkObj( $title, $title->getText() );
+ $plink = Linker::makeLinkObj( $title, $title->getText() );
$nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->count ) );
return wfSpecialList($plink, $nlinks);
} else {
$title = SpecialPage::getTitleFor( 'Userlogin' );
$self = SpecialPage::getTitleFor( 'Confirmemail' );
- $skin = $wgUser->getSkin();
- $llink = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $self->getPrefixedUrl() );
+ $llink = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'loginreqlink' ), 'returnto=' . $self->getPrefixedUrl() );
$wgOut->addHtml( wfMsgWikiHtml( 'confirmemail_needlogin', $llink ) );
}
} else {
$wgOut->addHTML( "<ul>\n" );
- $sk = $wgUser->getSkin();
foreach ( $contribs as $contrib )
- $wgOut->addHTML( ucListEdit( $sk, $contrib ) );
+ $wgOut->addHTML( ucListEdit( $contrib ) );
$wgOut->addHTML( "</ul>\n" );
$wgOut->addHTML( "<p>{$prevnextbits}</p>\n" );
function contributionsSub( $nt ) {
global $wgSysopUserBans, $wgLang, $wgUser;
- $sk = $wgUser->getSkin();
$id = User::idFromName( $nt->getText() );
if ( 0 == $id ) {
$ul = $nt->getText();
} else {
- $ul = $sk->makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
+ $ul = Linker::makeLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
}
$talk = $nt->getTalkPage();
if( $talk ) {
# Talk page link
- $tools[] = $sk->makeLinkObj( $talk, $wgLang->getNsText( NS_TALK ) );
+ $tools[] = Linker::makeLinkObj( $talk, $wgLang->getNsText( NS_TALK ) );
if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && User::isIP( $nt->getText() ) ) ) {
# Block link
if( $wgUser->isAllowed( 'block' ) )
- $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ), wfMsgHtml( 'blocklink' ) );
+ $tools[] = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ), wfMsgHtml( 'blocklink' ) );
# Block log link
- $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), htmlspecialchars( LogPage::logName( 'block' ) ), 'type=block&page=' . $nt->getPrefixedUrl() );
+ $tools[] = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), htmlspecialchars( LogPage::logName( 'block' ) ), 'type=block&page=' . $nt->getPrefixedUrl() );
}
# Other logs link
- $tools[] = $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), 'user=' . $nt->getPartialUrl() );
+ $tools[] = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Log' ), wfMsgHtml( 'log' ), 'user=' . $nt->getPartialUrl() );
$ul .= ' (' . implode( ' | ', $tools ) . ')';
}
return $ul;
*
* @todo This would probably look a lot nicer in a table.
*/
-function ucListEdit( $sk, $row ) {
+function ucListEdit( $row ) {
$fname = 'ucListEdit';
wfProfileIn( $fname );
$rev = new Revision( $row );
$page = Title::makeTitle( $row->page_namespace, $row->page_title );
- $link = $sk->makeKnownLinkObj( $page );
+ $link = Linker::makeKnownLinkObj( $page );
$difftext = $topmarktext = '';
if( $row->rev_id == $row->page_latest ) {
$topmarktext .= '<strong>' . $messages['uctop'] . '</strong>';
if( !$row->page_is_new ) {
- $difftext .= '(' . $sk->makeKnownLinkObj( $page, $messages['diff'], 'diff=0' ) . ')';
+ $difftext .= '(' . Linker::makeKnownLinkObj( $page, $messages['diff'], 'diff=0' ) . ')';
} else {
$difftext .= $messages['newarticle'];
}
$extraRollback = $wgRequest->getBool( 'bot' ) ? '&bot=1' : '';
$extraRollback .= '&token=' . urlencode(
$wgUser->editToken( array( $page->getPrefixedText(), $row->rev_user_text ) ) );
- $topmarktext .= ' ['. $sk->makeKnownLinkObj( $page,
+ $topmarktext .= ' ['. Linker::makeKnownLinkObj( $page,
$messages['rollbacklink'],
'action=rollback&from=' . urlencode( $row->rev_user_text ) . $extraRollback ) .']';
}
}
if( $rev->userCan( Revision::DELETED_TEXT ) ) {
- $difftext = '(' . $sk->makeKnownLinkObj( $page, $messages['diff'], 'diff=prev&oldid='.$row->rev_id ) . ')';
+ $difftext = '(' . Linker::makeKnownLinkObj( $page, $messages['diff'], 'diff=prev&oldid='.$row->rev_id ) . ')';
} else {
$difftext = '(' . $messages['diff'] . ')';
}
- $histlink='('.$sk->makeKnownLinkObj( $page, $messages['hist'], 'action=history' ) . ')';
+ $histlink = '(' . Linker::makeKnownLinkObj( $page, $messages['hist'], 'action=history' ) . ')';
- $comment = $sk->revComment( $rev );
+ $comment = Linker::revComment( $rev );
$d = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->rev_timestamp ), true );
if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
return Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage');
}
- function getPageHeader( ) {
- global $wgUser;
- $sk = $wgUser->getSkin();
-
- return '<p>'.wfMsg('disambiguationstext', $sk->makeKnownLinkObj($this->getDisambiguationPageObj()))."</p><br />\n";
+ function getPageHeader() {
+ return '<p>'.wfMsg('disambiguationstext', Linker::makeKnownLinkObj($this->getDisambiguationPageObj()))."</p><br />\n";
}
function getSQL() {
return '';
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang;
$title = Title::newFromId( $result->value );
$dp = Title::makeTitle( $result->namespace, $result->title );
- $from = $skin->makeKnownLinkObj( $title,'');
- $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
+ $from = Linker::makeKnownLinkObj( $title,'');
+ $edit = Linker::makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
$arr = $wgContLang->getArrow();
- $to = $skin->makeKnownLinkObj( $dp,'');
+ $to = Linker::makeKnownLinkObj( $dp,'');
return "$from $edit $arr $to";
}
return '';
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang;
$fname = 'DoubleRedirectsPage::formatResult';
$titleB = Title::makeTitle( $result->nsb, $result->tb );
$titleC = Title::makeTitle( $result->nsc, $result->tc );
- $linkA = $skin->makeKnownLinkObj( $titleA,'', 'redirect=no' );
- $edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
- $linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
- $linkC = $skin->makeKnownLinkObj( $titleC );
+ $linkA = Linker::makeKnownLinkObj( $titleA,'', 'redirect=no' );
+ $edit = Linker::makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
+ $linkB = Linker::makeKnownLinkObj( $titleB, '', 'redirect=no' );
+ $linkC = Linker::makeKnownLinkObj( $titleC );
$arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
$name = $this->mCurrentRow->img_name;
$ilink = "<a href=\"" . htmlspecialchars( Image::imageUrl( $name ) ) .
"\">" . $this->mMessages['imgfile'] . "</a>";
- $desc = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_IMAGE, $name ),
+ $desc = Linker::makeKnownLinkObj( Title::makeTitle( NS_IMAGE, $name ),
$this->mMessages['imgdesc'] );
return "$desc | $ilink";
case 'img_timestamp':
return htmlspecialchars( $value );
case 'img_user_text':
if ( $this->mCurrentRow->img_user ) {
- $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ),
+ $link = Linker::makeLinkObj( Title::makeTitle( NS_USER, $value ),
htmlspecialchars( $value ) );
} else {
$link = htmlspecialchars( $value );
case 'img_size':
return $wgLang->formatNum( $value );
case 'img_description':
- return $this->getSkin()->commentBlock( $value );
+ return Linker::commentBlock( $value );
}
}
}
function reportPage( $title, $origTitle, $revisionCount, $successCount ) {
- global $wgOut, $wgUser, $wgLang, $wgContLang;
-
- $skin = $wgUser->getSkin();
-
+ global $wgOut, $wgLang, $wgContLang;
+
$this->mPageCount++;
$localCount = $wgLang->formatNum( $successCount );
$contentCount = $wgContLang->formatNum( $successCount );
- $wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) .
+ $wgOut->addHtml( "<li>" . Linker::makeKnownLinkObj( $title ) .
" " .
wfMsgExt( 'import-revision-count', array( 'parsemag', 'escape' ), $localCount ) .
"</li>\n" );
wfProfileIn( __METHOD__ );
- static $sk=null, $msg=null;
+ static $msg=null;
- if( is_null( $sk ) )
- $sk = $wgUser->getSkin();
if( is_null( $msg ) ) {
$msg = array();
$keys = array( 'infiniteblock', 'expiringblock', 'contribslink', 'unblocklink',
# Prepare links to the blocker's user and talk pages
$blocker_name = $block->getByName();
- $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 ) ) . ')';
+ $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 ) ) . ')';
# 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 = $sk->makeLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress );
- $target .= ' (' . $sk->makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $block->mAddress ), $msg['contribslink'] ) . ')';
+ $target = Linker::makeLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress );
+ $target .= ' (' . Linker::makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $block->mAddress ), $msg['contribslink'] ) . ')';
}
$formattedTime = $wgLang->timeanddate( $block->mTimestamp, true );
if ( $wgUser->isAllowed('block') ) {
$titleObj = SpecialPage::getTitleFor( "Ipblocklist" );
- $s .= ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')';
+ $s .= ' (' . Linker::makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')';
}
- $s .= $sk->commentBlock( $block->mReason );
+ $s .= Linker::commentBlock( $block->mReason );
$s .= "</li>\n";
wfProfileOut( __METHOD__ );
return $s;
return( $sql );
}
- function formatResult( $skin, $result ) {
+ function formatResult( $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 = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
+ $rd_link = Linker::makeKnownLinkObj( $rd_title, '', 'redirect=no' );
# Find out where the redirect leads
$revision = Revision::newFromTitle( $rd_title );
# Make a link to the destination page
$target = Title::newFromRedirect( $revision->getText() );
if( $target ) {
- $targetLink = $skin->makeLinkObj( $target );
+ $targetLink = Linker::makeLinkObj( $target );
} else {
/** @todo Put in some decent error display here */
$targetLink = '*';
return false;
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
$userPage = Title::makeTitle( $result->namespace, $result->title );
- $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
+ $name = Linker::makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
$groups = null;
if( !isset( $result->numgroups ) || $result->numgroups > 0 ) {
* @param LogReader &$reader where to get our data from
*/
function LogViewer( &$reader ) {
- global $wgUser;
- $this->skin =& $wgUser->getSkin();
$this->reader =& $reader;
}
$linkCache->addBadLinkObj( $title );
}
- $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 );
+ $userLink = Linker::userLink( $s->log_user, $s->user_name ) . Linker::userToolLinks( $s->log_user, $s->user_name );
+ $comment = Linker::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 = '(' . $this->skin->makeKnownLinkObj( $specialTitle, wfMsg( 'revertmove' ),
+ $revert = '(' . Linker::makeKnownLinkObj( $specialTitle, wfMsg( 'revertmove' ),
'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
'&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
'&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
}
}
- $action = LogPage::actionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, true, true );
+ $action = LogPage::actionText( $s->log_type, $s->log_action, $title, false, $paramArray, true, true );
$out = "<li>$time $userLink $action $comment $revert</li>\n";
return $out;
}
";
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang, $wgLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getText() );
- $plink = $skin->makeLink( $nt->getPrefixedText(), $text );
+ $plink = Linker::makeLink( $nt->getPrefixedText(), $text );
- $download = $skin->makeMediaLink( $nt->getText(), 'fuck me!', wfMsgHtml( 'download' ) );
+ $download = Linker::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 = $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
+ $user = Linker::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";
";
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang, $wgLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
- $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
+ $plink = Linker::makeKnownLink( $nt->getPrefixedText(), $text );
$nl = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ),
$wgLang->formatNum( $result->value ) );
- $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Categories' ),
+ $nlink = Linker::makeKnownLink( $wgContLang->specialPage( 'Categories' ),
$nl, 'article=' . $nt->getPrefixedURL() );
return wfSpecialList($plink, $nlink);
";
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
- $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
+ $plink = Linker::makeKnownLink( $nt->getPrefixedText(), $text );
$nl = wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
$wgLang->formatNum ( $result->value ) );
- $nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
+ $nlink = Linker::makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
return wfSpecialList($plink, $nlink);
}
* 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, &$skin ) {
+ function makeWlhLink( &$title, $caption ) {
$wlh = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedDBkey() );
- return $skin->makeKnownLinkObj( $wlh, $caption );
+ return Linker::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( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang;
$title = Title::makeTitleSafe( $result->namespace, $result->title );
- $link = $skin->makeLinkObj( $title );
+ $link = Linker::makeLinkObj( $title );
$wlh = $this->makeWlhLink( $title,
wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
- $wgLang->formatNum( $result->value ) ), $skin );
+ $wgLang->formatNum( $result->value ) ) );
return wfSpecialList( $link, $wlh );
}
}
$db->dataSeek( $res, 0 );
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getText() );
- $plink = $skin->makeLinkObj( $nt, htmlspecialchars( $text ) );
+ $plink = Linker::makeLinkObj( $nt, htmlspecialchars( $text ) );
$nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );
";
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
- $plink = $skin->makeKnownLinkObj( $nt, $text );
+ $plink = Linker::makeKnownLinkObj( $nt, $text );
$nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );
- $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
+ $nlink = Linker::makeKnownLinkObj( $nt, $nl, 'action=history' );
return wfSpecialList($plink, $nlink);
}
*
*/
function wfSpecialNewimages( $par, $specialPage ) {
- global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions;
+ global $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions;
$wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
$dbr =& wfGetDB( DB_SLAVE );
- $sk = $wgUser->getSkin();
$shownav = !$specialPage->including();
$hidebots = $wgRequest->getBool('hidebots',1);
$nt = Title::newFromText( $name, NS_IMAGE );
$img = new Image( $nt );
- $ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
+ $ul = Linker::makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
$gallery->add( $img, "$ul<br />\n<i>".$wgLang->timeanddate( $s->img_timestamp, true )."</i><br />\n" );
}
$now = wfTimestampNow();
$date = $wgLang->timeanddate( $now, true );
- $dateLink = $sk->makeKnownLinkObj( $titleObj, wfMsg( 'sp-newimages-showfrom', $date ), 'from='.$now.$botpar.$searchpar );
+ $dateLink = Linker::makeKnownLinkObj( $titleObj, wfMsg( 'sp-newimages-showfrom', $date ), 'from='.$now.$botpar.$searchpar );
- $botLink = $sk->makeKnownLinkObj($titleObj, wfMsg( 'showhidebots', ($hidebots ? wfMsg('show') : wfMsg('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar);
+ $botLink = Linker::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 = $sk->makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar );
+ $prevLink = Linker::makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar );
}
$nextLink = wfMsg( 'nextn', $wgLang->formatNum( $limit ) );
if( $shownImages > $limit && $lastTimestamp ) {
- $nextLink = $sk->makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar );
+ $nextLink = Linker::makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar );
}
$prevnext = '<p>' . $botLink . ' '. wfMsg( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'</p>';
/**
* 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( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$dm = $wgContLang->getDirMark();
$title = Title::makeTitleSafe( $result->namespace, $result->title );
$time = $wgLang->timeAndDate( $result->timestamp, true );
- $plink = $skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rcid : '' );
- $hist = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
+ $plink = Linker::makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rcid : '' );
+ $hist = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$length = wfMsgHtml( 'nbytes', $wgLang->formatNum( htmlspecialchars( $result->length ) ) );
- $ulink = $skin->userLink( $result->user, $result->user_text ) . $skin->userToolLinks( $result->user, $result->user_text );
- $comment = $skin->commentBlock( $result->comment );
+ $ulink = Linker::userLink( $result->user, $result->user_text ) . Linker::userToolLinks( $result->user, $result->user_text );
+ $comment = Linker::commentBlock( $result->comment );
return "{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment}";
}
WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$title = Title::makeTitle( $result->namespace, $result->title );
- $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
+ $link = Linker::makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
$nv = wfMsgExt( 'nviews', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );
return wfSpecialList($link, $nv);
$disableEmailPrefs = false;
} else {
$disableEmailPrefs = true;
- $skin = $wgUser->getSkin();
$emailauthenticated = wfMsg('emailnotauthenticated').'<br />' .
- $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
+ Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ),
wfMsg( 'emailconfirmlink' ) );
}
} else {
* @param string $from list all pages from this name (default FALSE)
*/
function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = null ) {
- global $wgOut, $wgUser, $wgContLang;
+ global $wgOut, $wgContLang;
$fname = 'indexShowChunk';
- $sk = $wgUser->getSkin();
-
if (!isset($from)) $from = $prefix;
$fromList = $this->getNamespaceKeyAndText($namespace, $from);
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if( $t ) {
$link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
- $sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
+ Linker::makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) .
($s->page_is_redirect ? '</div>' : '' );
} else {
$link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
$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;">' .
- $sk->makeKnownLink( $wgContLang->specialPage( $this->name ),
+ Linker::makeKnownLink( $wgContLang->specialPage( $this->name ),
wfMsg ( 'allpages' ) );
if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
$namespaceparam = $namespace ? "&namespace=$namespace" : "";
- $out2 .= " | " . $sk->makeKnownLink(
+ $out2 .= " | " . Linker::makeKnownLink(
$wgContLang->specialPage( $this->name ),
wfMsg ( 'nextpage', $s->page_title ),
"from=" . wfUrlEncode ( $s->page_title ) .
}
// And now for the content
- $sk = $wgUser->getSkin();
$wgOut->setSyndicated( true );
$list = ChangesList::newFromUser( $wgUser );
*
*/
function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
- global $wgUser, $wgLang, $wgContLang;
- $sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
+ global $wgLang, $wgContLang;
+ $s = Linker::makeKnownLink( $wgContLang->specialPage( $page ),
($lim ? $wgLang->formatNum( "{$lim}" ) : wfMsg( 'recentchangesall' ) ), "{$more}" .
($d ? "days={$d}&" : '') . 'limit='.$lim );
return $s;
*
*/
function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) {
- global $wgUser, $wgLang, $wgContLang;
- $sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
+ global $wgLang, $wgContLang;
+ $s = Linker::makeKnownLink( $wgContLang->specialPage( $page ),
($d ? $wgLang->formatNum( "{$d}" ) : wfMsg( 'recentchangesall' ) ), $more.'days='.$d .
($lim ? '&limit='.$lim : '') );
return $s;
* @param $options
*/
function makeOptionsLink( $title, $override, $options ) {
- global $wgUser, $wgContLang;
- $sk = $wgUser->getSkin();
- return $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
+ global $wgContLang;
+ return Linker::makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
htmlspecialchars( $title ), wfArrayToCGI( $override, $options ) );
}
}
function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment ) {
- global $wgFeedDiffCutoff, $wgContLang, $wgUser;
+ global $wgFeedDiffCutoff, $wgContLang;
$fname = 'rcFormatDiff';
wfProfileIn( $fname );
- $skin = $wgUser->getSkin();
- $completeText = '<p>' . $skin->formatComment( $comment ) . "</p>\n";
+ $completeText = '<p>' . Linker::formatComment( $comment ) . "</p>\n";
if( $title->getNamespace() >= 0 ) {
if( $oldid ) {
$hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
$wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
- $sk = $wgUser->getSkin();
# Validate the title
$nt = Title::newFromURL( $target );
$hideminor = ($hideminor ? 1 : 0);
if ( $hideminor ) {
- $mlink = $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
+ $mlink = Linker::makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
wfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
"&days={$days}&limit={$limit}&hideminor=0" );
} else {
- $mlink = $sk->makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
+ $mlink = Linker::makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
wfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
"&days={$days}&limit={$limit}&hideminor=1" );
}
}
$res = $dbr->query( $sql, $fname );
- $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
+ $wgOut->addHTML("< ".Linker::makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
$note = wfMsg( "rcnote", $limit, $days, $wgLang->timeAndDate( wfTimestampNow(), true ) );
$wgOut->addHTML( "<hr />\n{$note}\n<br />" );
*/
function wfSpecialRevisiondelete( $par = null ) {
- global $wgOut, $wgRequest, $wgUser;
+ global $wgOut, $wgRequest;
$target = $wgRequest->getVal( 'target' );
$oldid = $wgRequest->getIntArray( 'oldid' );
- $sk = $wgUser->getSkin();
$page = Title::newFromUrl( $target );
if( is_null( $page ) ) {
$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 ),
$date = $wgContLang->timeanddate( $rev->getTimestamp() );
return
"<li>" .
- $this->skin->makeLinkObj( $this->page, $date, 'oldid=' . $rev->getId() ) .
+ Linker::makeLinkObj( $this->page, $date, 'oldid=' . $rev->getId() ) .
" " .
- $this->skin->revUserLink( $rev ) .
+ Linker::revUserLink( $rev ) .
" " .
- $this->skin->revComment( $rev ) .
+ Linker::revComment( $rev ) .
"</li>";
}
$this->setupPage( $term );
- global $wgUser, $wgOut;
- $sk = $wgUser->getSkin();
+ global $wgOut;
$wgOut->addWikiText( wfMsg( 'searchresulttext' ) );
#if ( !$this->parseQuery() ) {
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 = $sk->makeKnownLinkObj( $t );
+ $link = Linker::makeKnownLinkObj( $t );
$revision = Revision::newFromTitle( $t );
$text = $revision->getText();
$size = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),
return false;
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$dm = $wgContLang->getDirMark();
if ( !$title ) {
return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->';
}
- $hlink = $skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
+ $hlink = Linker::makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
$plink = $this->isCached()
- ? $skin->makeLinkObj( $title )
- : $skin->makeKnownLinkObj( $title );
+ ? Linker::makeLinkObj( $title )
+ : Linker::makeKnownLinkObj( $title );
$size = wfMsgHtml( 'nbytes', $wgLang->formatNum( htmlspecialchars( $result->value ) ) );
return $title->exists()
*
*/
function wfSpecialSpecialpages() {
- global $wgOut, $wgUser;
+ global $wgOut;
$wgOut->setRobotpolicy( 'index,nofollow' );
- $sk = $wgUser->getSkin();
/** Pages available to all */
- wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading', $sk );
+ wfSpecialSpecialpages_gen( SpecialPage::getRegularPages(), 'spheading' );
/** Restricted special pages */
- wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading', $sk );
+ wfSpecialSpecialpages_gen( SpecialPage::getRestrictedPages(), 'restrictedpheading' );
}
/**
* 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,$sk) {
+function wfSpecialSpecialpages_gen( $pages, $heading ) {
global $wgOut, $wgSortSpecialPages;
if( count( $pages ) == 0 ) {
/** Now output the HTML */
$wgOut->addHTML( '<h2>' . wfMsgHtml( $heading ) . "</h2>\n<ul>" );
foreach ( $sortedPages as $desc => $title ) {
- $link = $sk->makeKnownLinkObj( $title, $desc );
+ $link = Linker::makeKnownLinkObj( $title, $desc );
$wgOut->addHTML( "<li>{$link}</li>\n" );
}
$wgOut->addHTML( "</ul>\n" );
$wgOut->addWikiText( $text );
- global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
+ global $wgDisableCounters, $wgMiserMode, $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 = $skin->makeKnownLinkObj( Title::makeTitleSafe( $row->page_namespace, $row->page_title ) );
+ $link = Linker::makeKnownLinkObj( Title::makeTitleSafe( $row->page_namespace, $row->page_title ) );
$dirmark = $wgContLang->getDirMark();
$wgOut->addHtml( '<li>' . $link . $dirmark . ' [' . $wgLang->formatNum( $row->page_counter ) . ']</li>' );
}
WHERE cl_from IS NULL AND page_namespace = {$ns} AND page_is_redirect = 0";
}
- function formatResult( &$skin, $row ) {
+ function formatResult( $row ) {
global $wgContLang;
$title = Title::makeTitleSafe( NS_IMAGE, $row->title );
$label = htmlspecialchars( $wgContLang->convert( $title->getText() ) );
- return $skin->makeKnownLinkObj( $title, $label );
+ return Linker::makeKnownLinkObj( $title, $label );
}
}
}
/* private */ function showList() {
- global $wgLang, $wgContLang, $wgUser, $wgOut;
+ global $wgLang, $wgContLang, $wgOut;
# List undeletable articles
$result = PageArchive::listAllPages();
}
$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 = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
+ $link = Linker::makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
$revs = wfMsgHtml( 'undeleterevisions', $wgLang->formatNum( $row->count ) );
$wgOut->addHtml( "<li>{$link} ({$revs})</li>\n" );
}
/* private */ function showHistory() {
global $wgLang, $wgUser, $wgOut;
- $sk = $wgUser->getSkin();
if ( $this->mAllowed ) {
$wgOut->setPagetitle( wfMsg( "undeletepage" ) );
} else {
$ts = wfTimestamp( TS_MW, $row->ar_timestamp );
if ( $this->mAllowed ) {
$checkBox = wfCheck( "ts$ts" );
- $pageLink = $sk->makeKnownLinkObj( $titleObj,
+ $pageLink = Linker::makeKnownLinkObj( $titleObj,
$wgLang->timeanddate( $ts, true ),
"target=$target×tamp=$ts" );
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate( $ts, true );
}
- $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 );
+ $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 );
$wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" );
}
$checkBox = wfCheck( "fileid" . $row->fa_id );
$key = urlencode( $row->fa_storage_key );
$target = urlencode( $this->mTarget );
- $pageLink = $sk->makeKnownLinkObj( $titleObj,
+ $pageLink = Linker::makeKnownLinkObj( $titleObj,
$wgLang->timeanddate( $ts, true ),
"target=$target&file=$key" );
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate( $ts, true );
}
- $userLink = $sk->userLink( $row->fa_user, $row->fa_user_text ) . $sk->userToolLinks( $row->fa_user, $row->fa_user_text );
+ $userLink = Linker::userLink( $row->fa_user, $row->fa_user_text ) . Linker::userToolLinks( $row->fa_user, $row->fa_user_text );
$data =
wfMsgHtml( 'widthheight',
$wgLang->formatNum( $row->fa_width ),
' (' .
wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size ) ) .
')';
- $comment = $sk->commentBlock( $row->fa_description );
+ $comment = Linker::commentBlock( $row->fa_description );
$wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
}
$files->free();
}
function undelete() {
- global $wgOut, $wgUser;
+ global $wgOut;
if( !is_null( $this->mTargetObj ) ) {
$archive = new PageArchive( $this->mTargetObj );
$ok = true;
$this->mFileVersions );
if( $ok ) {
- $skin =& $wgUser->getSkin();
- $link = $skin->makeKnownLinkObj( $this->mTargetObj );
+ $link = Linker::makeKnownLinkObj( $this->mTargetObj );
$wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
return true;
}
AND page_is_redirect = 0";
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
$title = Title::makeTitle( NS_CATEGORY, $result->title );
- return $skin->makeLinkObj( $title, $title->getText() );
+ return Linker::makeLinkObj( $title, $title->getText() );
}
}
}
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$title = Title::makeTitle( NS_IMAGE, $result->title );
$return =
# The 'desc' linking to the image page
- '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' . $dirmark .
+ '('.Linker::makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' . $dirmark .
# Link to the image itself
'<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) .
$wgLang->timeanddate($result->value) . ' . . ' . $dirmark .
# Link to username
- $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ),
+ Linker::makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ),
$result->img_user_text) . $dirmark .
# If there is a description, show it
- $skin->commentBlock( $wgContLang->convert( $result->img_description ) );
+ Linker::commentBlock( $wgContLang->convert( $result->img_description ) );
return $return;
}
return $sql;
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
$title = Title::makeTitle( NS_TEMPLATE, $result->title );
- $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
- $wlhLink = $skin->makeKnownLinkObj(
+ $pageLink = Linker::makeKnownLinkObj( $title, '', 'redirect=no' );
+ $wlhLink = Linker::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Whatlinkshere' ),
wfMsgHtml( 'unusedtemplateswlh' ),
'target=' . $title->getPrefixedUrl() );
function sortDescending() { return false; }
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getPrefixedText() );
- $plink = $skin->makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
- $wlink = $skin->makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
+ $plink = Linker::makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
+ $wlink = Linker::makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
return wfSpecialList( $plink, $wlink );
}
* @access private
*/
function processUpload() {
- global $wgUser, $wgOut;
+ global $wgOut;
/* Check for PHP error if any, requires php 4.2 or newer */
if( $this->mUploadError == 1/*UPLOAD_ERR_INI_SIZE*/ ) {
}
if( $nt->getArticleID() ) {
- global $wgUser;
- $sk = $wgUser->getSkin();
- $dlink = $sk->makeKnownLinkObj( $nt );
+ $dlink = Linker::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 = $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
+ $llink = Linker::makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
$warning .= wfOpenElement( 'li' ) . wfMsgWikiHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' );
}
}
* @access private
*/
function showSuccess() {
- global $wgUser, $wgOut, $wgContLang;
+ global $wgOut, $wgContLang;
- $sk = $wgUser->getSkin();
- $ilink = $sk->makeMediaLink( $this->mUploadSaveName, Image::imageUrl( $this->mUploadSaveName ) );
+ $ilink = Linker::makeMediaLink( $this->mUploadSaveName, Image::imageUrl( $this->mUploadSaveName ) );
$dname = $wgContLang->getNsText( NS_IMAGE ) . ':'.$this->mUploadSaveName;
- $dlink = $sk->makeKnownLink( $dname, $dname );
+ $dlink = Linker::makeKnownLink( $dname, $dname );
$wgOut->addHTML( '<h2>' . wfMsgHtml( 'successfulupload' ) . "</h2>\n" );
$text = wfMsgWikiHtml( 'fileuploaded', $ilink, $dlink );
$wgOut->addHTML( '<div id="uploadtext">' );
$wgOut->addWikiText( wfMsg( 'uploadtext' ) );
$wgOut->addHTML( '</div>' );
- $sk = $wgUser->getSkin();
$sourcefilename = wfMsgHtml( 'sourcefilename' );
} else {
# Confirm that the account was created
global $wgOut;
- $skin = $wgUser->getSkin();
$self = SpecialPage::getTitleFor( 'Userlogin' );
$wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
$wgOut->setArticleRelated( false );
* @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;
- $skin =& $wgUser->getSkin();
- return $skin->makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );
+ return Linker::makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );
}
}
$db->dataSeek( $res, 0 );
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang, $wgContLang;
$nt = Title::makeTitle( $result->namespace, $result->title );
$text = $wgContLang->convert( $nt->getText() );
$plink = $this->isCached() ?
- $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) :
- $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
+ Linker::makeLinkObj( $nt, htmlspecialchars( $text ) ) :
+ Linker::makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
$nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) );
}
- function formatResult( $skin, $result ) {
+ function formatResult( $result ) {
global $wgLang;
$title = Title::makeTitleSafe( $result->namespace, $result->title );
# Check existence; which is stored in the link cache
if( !$title->exists() ) {
# Make a redlink
- $pageLink = $skin->makeBrokenLinkObj( $title );
+ $pageLink = Linker::makeBrokenLinkObj( $title );
} else {
# Make a a struck-out normal link
- $pageLink = "<s>" . $skin->makeLinkObj( $title ) . "</s>";
+ $pageLink = "<s>" . Linker::makeLinkObj( $title ) . "</s>";
}
} else {
# Not cached? Don't bother checking existence; it can't
- $pageLink = $skin->makeBrokenLinkObj( $title );
+ $pageLink = Linker::makeBrokenLinkObj( $title );
}
# Make a link to "what links here" if it's required
$wlhLink = $this->nlinks
- ? $this->makeWlhLink( $title, $skin,
+ ? $this->makeWlhLink( $title,
wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
$wgLang->formatNum( $result->value ) ) )
: null;
/**
* 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, &$skin, $text ) {
+ function makeWlhLink( &$title, $text ) {
$wlhTitle = SpecialPage::getTitleFor( 'Whatlinkshere' );
- return $skin->makeKnownLinkObj( $wlhTitle, $text, 'target=' . $title->getPrefixedUrl() );
+ return Linker::makeKnownLinkObj( $wlhTitle, $text, 'target=' . $title->getPrefixedUrl() );
}
}
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 = $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() );
+ $llink = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), 'returnto=' . $specialTitle->getPrefixedUrl() );
$wgOut->addHtml( wfMsgWikiHtml( 'watchlistanontext', $llink ) );
return;
} else {
$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 ) ) {
global $wgContLang;
$toolLinks = array();
$titleText = $titleObj->getPrefixedText();
- $pageLink = $sk->makeLinkObj( $titleObj );
- $toolLinks[] = $sk->makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
+ $pageLink = Linker::makeLinkObj( $titleObj );
+ $toolLinks[] = Linker::makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) );
if( $titleObj->exists() )
- $toolLinks[] = $sk->makeKnownLinkObj( $titleObj, wfMsgHtml( 'history_short' ), 'action=history' );
+ $toolLinks[] = Linker::makeKnownLinkObj( $titleObj, wfMsgHtml( 'history_short' ), 'action=history' );
$toolLinks = '(' . implode( ' | ', $toolLinks ) . ')';
$checkbox = '<input type="checkbox" name="id[]" value="' . htmlspecialchars( $titleObj->getPrefixedText() ) . '" /> ' . ( $wgContLang->isRTL() ? '‏' : '‎' );
if( $redir ) {
# 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 = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
+ $link = Linker::makeKnownLinkObj( $thisTitle, $label, $linkBits );
$links[] = wfMsgHtml( 'wlhideshowbots', $link );
$label = $hideOwn ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' );
$linkBits = wfArrayToCGI( array( 'hideOwn' => 1 - (int)$hideOwn ), $nondefaults );
- $link = $skin->makeKnownLinkObj( $thisTitle, $label, $linkBits );
+ $link = Linker::makeKnownLinkObj( $thisTitle, $label, $linkBits );
$links[] = wfMsgHtml( 'wlhideshowown', $link );
$wgOut->addHTML( implode( ' | ', $links ) );
}
function wlHoursLink( $h, $page, $options = array() ) {
- global $wgUser, $wgLang, $wgContLang;
- $sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink(
+ global $wgLang, $wgContLang;
+ $s = Linker::makeKnownLink(
$wgContLang->specialPage( $page ),
$wgLang->formatNum( $h ),
wfArrayToCGI( array('days' => ($h / 24.0)), $options ) );
}
function wlDaysLink( $d, $page, $options = array() ) {
- global $wgUser, $wgLang, $wgContLang;
- $sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink(
+ global $wgLang, $wgContLang;
+ $s = Linker::makeKnownLink(
$wgContLang->specialPage( $page ),
($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) ),
wfArrayToCGI( array('days' => $d), $options ) );
class WhatLinksHerePage {
var $request, $par;
var $limit, $from, $dir, $target;
- var $selfTitle, $skin;
+ var $selfTitle;
function WhatLinksHerePage( &$request, $par = null ) {
- global $wgUser;
$this->request =& $request;
- $this->skin =& $wgUser->getSkin();
$this->par = $par;
}
$isredir = ' (' . wfMsg( 'isredirect' ) . ")\n";
- $wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) . ' ' .$this->skin->makeLinkObj($this->target, '', 'redirect=no' )."<br />\n");
+ $wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) .' '.Linker::makeLinkObj($this->target, '', 'redirect=no' )."<br />\n");
$this->showIndirectLinks( 0, $this->target, $this->limit, $this->from, $this->dir );
}
$extra = '';
}
- $link = $this->skin->makeKnownLinkObj( $nt, '', $extra );
+ $link = Linker::makeKnownLinkObj( $nt, '', $extra );
$wgOut->addHTML( '<li>'.$link );
// Display properties (redirect or template)
}
function makeSelfLink( $text, $query ) {
- return $this->skin->makeKnownLinkObj( $this->selfTitle, $text, $query );
+ return Linker::makeKnownLinkObj( $this->selfTitle, $text, $query );
}
function getPrevNext( $limit, $prevId, $nextId ) {
}
$title = self::getGroupPage( $group );
if( $title ) {
- global $wgUser;
- $sk = $wgUser->getSkin();
- return $sk->makeLinkObj( $title, $text );
+ return Linker::makeLinkObj( $title, $text );
} else {
return $text;
}
$s .= "<td class='bottom' align='center' valign='top'>";
$s .= $this->bottomLinks();
- $s .= "\n<br />" . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
+ $s .= "\n<br />" . self::makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | "
. $this->aboutLink() . " | "
. $this->searchForm( wfMsg( "qbfind" ) );
}
$s = "" .
- $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
+ self::makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
. " | " .
- $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
+ self::makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) )
. " | " .
- $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
+ self::makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) )
. " | " .
- $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
+ self::makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") )
. " | " .
- $this->specialLink( "specialpages" );
+ self::specialLink( "specialpages" );
/* show links to different language variants */
$s .= $this->variantLinks();
$s .= " | ";
if ( $wgUser->isLoggedIn() ) {
- $s .= $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
+ $s .= self::makeKnownLink( $lo, wfMsg( "logout" ), $q );
} else {
- $s .= $this->makeKnownLink( $li, wfMsg( "login" ), $q );
+ $s .= self::makeKnownLink( $li, wfMsg( "login" ), $q );
}
return $s;
$s .= $this->menuHead( "qbedit" );
$s .= "<strong>" . $this->editThisPage() . "</strong>";
- $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
+ $s .= $sep . self::makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
if( $wgUser->isLoggedIn() ) {
$s .= $sep . $this->moveThisPage();
$s .= $this->menuHead( "qbmyoptions" );
if ( $wgUser->isLoggedIn() ) {
$name = $wgUser->getName();
- $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
+ $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
wfMsg( 'mytalk' ) );
if ( $wgUser->getNewtalk() ) {
$tl .= " *";
}
- $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
+ $s .= self::makeKnownLinkObj( $wgUser->getUserPage(),
wfMsg( "mypage" ) )
. $sep . $tl
- . $sep . $this->specialLink( "watchlist" )
- . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
+ . $sep . self::specialLink( "watchlist" )
+ . $sep . self::makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
wfMsg( "mycontris" ) )
- . $sep . $this->specialLink( "preferences" )
- . $sep . $this->specialLink( "userlogout" );
+ . $sep . self::specialLink( "preferences" )
+ . $sep . self::specialLink( "userlogout" );
} else {
- $s .= $this->specialLink( "userlogin" );
+ $s .= self::specialLink( "userlogin" );
}
$s .= $this->menuHead( "qbspecialpages" )
- . $this->specialLink( "newpages" )
- . $sep . $this->specialLink( "imagelist" )
- . $sep . $this->specialLink( "statistics" )
+ . self::specialLink( "newpages" )
+ . $sep . self::specialLink( "imagelist" )
+ . $sep . self::specialLink( "statistics" )
. $sep . $this->bugReportsLink();
if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
- $s .= $sep . $this->specialLink( "upload" );
+ $s .= $sep . self::specialLink( "upload" );
}
global $wgSiteSupportPage;
if( $wgSiteSupportPage) {
.wfMsg( "sitesupport" )."</a>";
}
- $s .= $sep . $this->makeKnownLinkObj(
+ $s .= $sep . self::makeKnownLinkObj(
SpecialPage::getTitleFor( 'Specialpages' ),
wfMsg( 'moredotdotdot' ) );
$sep = " |\n";
$s = $this->mainPageLink() . $sep
- . $this->specialLink( "recentchanges" );
+ . self::specialLink( "recentchanges" );
if ( $wgOut->isArticle() ) {
$s .= $sep . $this->editThisPage()
$s .= $this->extensionTabLinks();
if ( $wgUser->isAnon() ) {
- $s .= $sep . $this->specialLink( "userlogin" );
+ $s .= $sep . self::specialLink( "userlogin" );
} else {
- $s .= $sep . $this->specialLink( "userlogout" );
+ $s .= $sep . self::specialLink( "userlogout" );
}
$s .= $sep . $this->specialPagesList();
$s .= $this->bottomLinks();
$s .= "\n<br />" . $this->mainPageLink()
. ' | ' . $this->aboutLink()
- . ' | ' . $this->specialLink( 'recentchanges' )
+ . ' | ' . self::specialLink( 'recentchanges' )
. ' | ' . $this->searchForm()
. '<br /><span id="pagestats">' . $this->pageStats() . '</span>';
}
if( $wgUser->isLoggedIn() ) {
- $s.= $this->specialLink( 'watchlist' ) ;
- $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
+ $s.= self::specialLink( 'watchlist' ) ;
+ $s .= $sep . self::makeKnownLink( $wgContLang->specialPage( 'Contributions' ),
wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) );
}
// only show watchlist link if logged in
$link = $nstext . ':' . $link ;
}
- $s .= $this->makeLink( $link, $text );
+ $s .= self::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
# "Post a comment" link
if( ( $wgTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview )
- $s .= '<br />' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
+ $s .= '<br />' . self::makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
#if( $tns%2 && $action!='edit' && !$wpPreview) {
- #$s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
+ #$s.= '<br />'.self::makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new');
#}
/*
}
if ( $wgUser->isLoggedIn() && ( $wgEnableUploads || $wgRemoteUploads ) ) {
- $s .= $this->specialLink( 'upload' ) . $sep;
+ $s .= self::specialLink( 'upload' ) . $sep;
}
- $s .= $this->specialLink( 'specialpages' )
+ $s .= self::specialLink( 'specialpages' )
. $sep . $this->bugReportsLink();
global $wgSiteSupportPage;
$hasMembers = $dbr->selectField( 'categorylinks', '1',
array( 'cl_to' => $nt->getDBkey() ), __METHOD__ );
if ( $hasMembers ) {
- return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
+ return self::makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
}
}
$usertalktitle = $usertitle->getTalkPage();
if( !$usertalktitle->equals( $this->mTitle ) ) {
$ntl = wfMsg( 'youhavenewmessages',
- $this->makeKnownLinkObj(
+ self::makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessageslink' ),
'redirect=no'
),
- $this->makeKnownLinkObj(
+ self::makeKnownLinkObj(
$usertalktitle,
wfMsgHtml( 'newmessagesdifflink' ),
'diff=cur'