From fa239349f2d5d4456c45efae16d1673d6472e165 Mon Sep 17 00:00:00 2001 From: Nick Jenkins Date: Wed, 8 Nov 2006 05:21:15 +0000 Subject: [PATCH] * (bug 7405) Make Linker methods static. Patch by Dan Li. --- RELEASE-NOTES | 1 + includes/AjaxFunctions.php | 10 +- includes/Article.php | 28 +- includes/CategoryPage.php | 20 +- includes/ChangesList.php | 60 ++- includes/Credits.php | 9 +- includes/DifferenceEngine.php | 27 +- includes/EditPage.php | 15 +- includes/ImageGallery.php | 35 +- includes/ImagePage.php | 60 +-- includes/Linker.php | 525 +++++++++++++---------- includes/LogPage.php | 48 +-- includes/OutputPage.php | 25 +- includes/PageHistory.php | 23 +- includes/Pager.php | 13 +- includes/Parser.php | 74 ++-- includes/QueryPage.php | 19 +- includes/Skin.php | 102 ++--- includes/SkinTemplate.php | 4 +- includes/SpecialAllpages.php | 15 +- includes/SpecialAncientpages.php | 4 +- includes/SpecialBrokenRedirects.php | 10 +- includes/SpecialCategories.php | 4 +- includes/SpecialConfirmemail.php | 3 +- includes/SpecialContributions.php | 28 +- includes/SpecialDisambiguations.php | 15 +- includes/SpecialDoubleRedirects.php | 10 +- includes/SpecialImagelist.php | 6 +- includes/SpecialImport.php | 8 +- includes/SpecialIpblocklist.php | 16 +- includes/SpecialListredirects.php | 6 +- includes/SpecialListusers.php | 4 +- includes/SpecialLog.php | 10 +- includes/SpecialMIMEsearch.php | 8 +- includes/SpecialMostcategories.php | 6 +- includes/SpecialMostimages.php | 6 +- includes/SpecialMostlinked.php | 12 +- includes/SpecialMostlinkedcategories.php | 4 +- includes/SpecialMostrevisions.php | 6 +- includes/SpecialNewimages.php | 13 +- includes/SpecialNewpages.php | 11 +- includes/SpecialPopularpages.php | 4 +- includes/SpecialPreferences.php | 3 +- includes/SpecialPrefixindex.php | 10 +- includes/SpecialRecentchanges.php | 21 +- includes/SpecialRecentchangeslinked.php | 7 +- includes/SpecialRevisiondelete.php | 10 +- includes/SpecialSearch.php | 6 +- includes/SpecialShortpages.php | 8 +- includes/SpecialSpecialpages.php | 12 +- includes/SpecialStatistics.php | 5 +- includes/SpecialUncategorizedimages.php | 4 +- includes/SpecialUndelete.php | 23 +- includes/SpecialUnusedcategories.php | 4 +- includes/SpecialUnusedimages.php | 8 +- includes/SpecialUnusedtemplates.php | 6 +- includes/SpecialUnwatchedpages.php | 6 +- includes/SpecialUpload.php | 17 +- includes/SpecialUserlogin.php | 5 +- includes/SpecialWantedcategories.php | 6 +- includes/SpecialWantedpages.php | 15 +- includes/SpecialWatchlist.php | 26 +- includes/SpecialWhatlinkshere.php | 10 +- includes/User.php | 4 +- skins/CologneBlue.php | 42 +- skins/Nostalgia.php | 6 +- skins/Standard.php | 16 +- skins/disabled/HTMLDump.php | 2 +- skins/disabled/MonoBookCBT.php | 4 +- 69 files changed, 741 insertions(+), 852 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8d62530801..e66cafa4fa 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -153,6 +153,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN if they have selected that option in preferences. * (bug 5936) Show an 'm' to the left of the edit summary on diff pages for minor edits. * (bug 7820) Improve error reporting for uploads via URL. +* (bug 7405) Make Linker methods static. == Languages updated == diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index 9f7a332f4b..91295bcfde 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -71,8 +71,6 @@ function code2utf($num){ function wfSajaxSearch( $term ) { global $wgContLang, $wgOut; $limit = 16; - - $l = new Linker; $term = str_replace( ' ', '_', $wgContLang->ucfirst( $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ) @@ -94,10 +92,10 @@ function wfSajaxSearch( $term ) { $i=0; while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) { $nt = Title::newFromDBkey( $row->page_title ); - $r .= '
  • ' . $l->makeKnownLinkObj( $nt ) . "
  • \n"; + $r .= '
  • ' . Linker::makeKnownLinkObj( $nt ) . "
  • \n"; } if ( $i > $limit ) { - $more = '' . $l->makeKnownLink( $wgContLang->specialPage( "Allpages" ), + $more = '' . Linker::makeKnownLink( $wgContLang->specialPage( "Allpages" ), wfMsg('moredotdotdot'), "namespace=0&from=" . wfUrlEncode ( $term ) ) . ''; @@ -113,10 +111,10 @@ function wfSajaxSearch( $term ) { . wfMsg( 'hideresults' ) . '' . '

    '.wfMsg('search') . '

    '. $subtitle . '

    " . wfMsg( 'articletitles', $term ) . "

    " diff --git a/includes/Article.php b/includes/Article.php index b2c3b7efd5..c469888d3f 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -613,7 +613,6 @@ class Article { global $wgUser, $wgOut, $wgRequest, $wgContLang; global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser; global $wgUseTrackbacks, $wgNamespaceRobotPolicies; - $sk = $wgUser->getSkin(); wfProfileIn( __METHOD__ ); @@ -693,8 +692,7 @@ class Article { // This is an internally redirected page view. // We'll need a backlink to the source page for navigation. if ( wfRunHooks( 'ArticleViewRedirect', array( &$this ) ) ) { - $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; @@ -704,8 +702,7 @@ class Article { // 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; @@ -787,7 +784,7 @@ class Article { $targetUrl = $rt->escapeLocalURL(); # fixme unused $titleText : $titleText = htmlspecialchars( $rt->getPrefixedText() ); - $link = $sk->makeLinkObj( $rt ); + $link = Linker::makeLinkObj( $rt ); $wgOut->addHTML( '#REDIRECT' . ''.$link.'' ); @@ -829,7 +826,7 @@ class Article { $wgOut->addHTML( "' ); @@ -2256,7 +2253,7 @@ class Article { * @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; @@ -2266,26 +2263,25 @@ class Article { $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 ); diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index 277ee1dbf5..9709033a8e 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -49,8 +49,7 @@ class CategoryViewer { 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; @@ -99,21 +98,13 @@ class CategoryViewer { } } - function getSkin() { - if ( !$this->skin ) { - global $wgUser; - $this->skin = $wgUser->getSkin(); - } - return $this->skin; - } - /** * Add a subcategory to the internal lists */ function addSubcategory( $title, $sortkey, $pageLength ) { global $wgContLang; // Subcategory; strip the 'Category' namespace from the link text. - $this->children[] = $this->getSkin()->makeKnownLinkObj( + $this->children[] = Linker::makeKnownLinkObj( $title, $wgContLang->convertHtml( $title->getText() ) ); $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey ); @@ -159,7 +150,7 @@ class CategoryViewer { */ 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 ) ); @@ -388,17 +379,16 @@ class CategoryViewer { */ function pagingLinks( $title, $first, $last, $limit, $query = array() ) { global $wgUser, $wgLang; - $sk =& $this->getSkin(); $limitText = $wgLang->formatNum( $limit ); $prevLink = htmlspecialchars( wfMsg( 'prevn', $limitText ) ); if( $first != '' ) { - $prevLink = $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 ) ) ); } diff --git a/includes/ChangesList.php b/includes/ChangesList.php index fe3ec1b32d..a0b41309a1 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -34,8 +34,7 @@ class ChangesList { # /** @todo document */ - function ChangesList( &$skin ) { - $this->skin =& $skin; + function ChangesList() { $this->preCacheMessages(); } @@ -47,10 +46,9 @@ class ChangesList { * @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; } @@ -112,13 +110,13 @@ class ChangesList { # 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) { @@ -139,7 +137,7 @@ class ChangesList { function insertLog(&$s, $title, $logtype) { $logname = LogPage::logName( $logtype ); - $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')'; + $s .= '(' . Linker::makeKnownLinkObj($title, $logname ) . ')'; } @@ -151,7 +149,7 @@ class ChangesList { $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'], @@ -162,7 +160,7 @@ class ChangesList { $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' ) ) ); @@ -176,7 +174,7 @@ class ChangesList { $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 = ''.$articlelink.''; global $wgContLang; $articlelink .= $wgContLang->getDirMark(); @@ -192,15 +190,15 @@ class ChangesList { /** 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() ); } } @@ -324,23 +322,23 @@ class EnhancedChangesList extends ChangesList { # Make article link if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir"; - $clink = wfMsg( $msg, $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 ); @@ -358,31 +356,31 @@ class EnhancedChangesList extends ChangesList { $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid"; $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery"; $aprops = ' tabindex="'.$baseRC->counter.'"'; - $curLink = $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 @@ -472,13 +470,13 @@ class EnhancedChangesList extends ChangesList { 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 .= ')'; } @@ -509,7 +507,7 @@ class EnhancedChangesList extends ChangesList { 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 = ''.$link.''; @@ -520,7 +518,7 @@ class EnhancedChangesList extends ChangesList { $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 .= "
    \n"; } $r .= "\n"; @@ -616,14 +614,14 @@ class EnhancedChangesList extends ChangesList { $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 ) { diff --git a/includes/Credits.php b/includes/Credits.php index 62f0b2566a..a31c4f929a 100644 --- a/includes/Credits.php +++ b/includes/Credits.php @@ -171,9 +171,8 @@ function getContributorCredits($article, $cnt, $showIfMax) { * */ 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 )); } @@ -181,9 +180,7 @@ function creditLink($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'); } ?> diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 72ba3469b5..206dddc60c 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -143,13 +143,12 @@ CONTROL; exit; } - $sk = $wgUser->getSkin(); $talk = $wgContLang->getNsText( NS_TALK ); $contribs = wfMsg( 'contribslink' ); if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) { $username = $this->mNewRev->getUserText(); - $rollback = '   [' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ), + $rollback = '   [' . Linker::makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ), 'action=rollback&from=' . urlencode( $username ) . '&token=' . urlencode( $wgUser->editToken( array( $this->mTitle->getPrefixedText(), $username ) ) ) ) . ']'; @@ -157,17 +156,17 @@ CONTROL; $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"' ); } @@ -185,12 +184,12 @@ CONTROL; } $oldHeader = "{$this->mOldtitle}
    " . - $sk->revUserTools( $this->mOldRev ) . "
    " . - $oldminor . $sk->revComment( $this->mOldRev ) . "
    " . + Linker::revUserTools( $this->mOldRev ) . "
    " . + $oldminor . Linker::revComment( $this->mOldRev ) . "
    " . $prevlink; $newHeader = "{$this->mNewtitle}
    " . - $sk->revUserTools( $this->mNewRev ) . " $rollback
    " . - $newminor . $sk->revComment( $this->mNewRev ) . "
    " . + Linker::revUserTools( $this->mNewRev ) . " $rollback
    " . + $newminor . Linker::revComment( $this->mNewRev ) . "
    " . $nextlink . $patrol; $this->showDiff( $oldHeader, $newHeader ); @@ -218,7 +217,7 @@ CONTROL; * contrast to normal "old revision" display style. */ function showFirstRevision() { - global $wgOut, $wgUser; + global $wgOut; $fname = 'DifferenceEngine::showFirstRevision'; wfProfileIn( $fname ); @@ -249,12 +248,10 @@ CONTROL; # 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 = "
    {$this->mOldtitle}
    " . - $sk->revUserTools( $this->mNewRev ) . "
    " . - $sk->revComment( $this->mNewRev ) . "
    " . + Linker::revUserTools( $this->mNewRev ) . "
    " . + Linker::revComment( $this->mNewRev ) . "
    " . $nextlink . "
    \n"; $wgOut->addHTML( $header ); diff --git a/includes/EditPage.php b/includes/EditPage.php index 3017005830..82f875196f 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -820,8 +820,6 @@ class EditPage { $fname = 'EditPage::showEditForm'; wfProfileIn( $fname ); - $sk =& $wgUser->getSkin(); - wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ; $wgOut->setRobotpolicy( 'noindex,nofollow' ); @@ -943,7 +941,7 @@ class EditPage { $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 = ''. @@ -1254,13 +1252,9 @@ END * Prepare a list of templates used by this page. Returns HTML. */ function formatTemplates() { - global $wgUser; - $fname = 'EditPage::formatTemplates'; wfProfileIn( $fname ); - $sk =& $wgUser->getSkin(); - $outText = ''; $templates = $this->mArticle->getUsedTemplates(); if ( count( $templates ) > 0 ) { @@ -1276,7 +1270,7 @@ END wfMsgExt( 'templatesused', array( 'parse' ) ) . '
      '; foreach ( $templates as $titleObj ) { - $outText .= '
    • ' . $sk->makeLinkObj( $titleObj ) . '
    • '; + $outText .= '
    • ' . Linker::makeLinkObj( $titleObj ) . '
    • '; } $outText .= '
    '; } @@ -1436,11 +1430,10 @@ END * 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' ); diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index 7ff456b666..7e6307eff4 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -17,7 +17,6 @@ class ImageGallery { var $mImages, $mShowBytes, $mShowFilename; var $mCaption = false; - var $mSkin = false; /** * Is the gallery on a wiki page (i.e. not a special page) @@ -50,30 +49,6 @@ class ImageGallery $this->mCaption = $caption; } - /** - * Instruct the class to use a specific skin for rendering - * - * @param $skin Skin object - */ - function useSkin( $skin ) { - $this->mSkin =& $skin; - } - - /** - * Return the skin that should be used - * - * @return Skin object - */ - function getSkin() { - if( !$this->mSkin ) { - global $wgUser; - $skin =& $wgUser->getSkin(); - } else { - $skin =& $this->mSkin; - } - return $skin; - } - /** * Add an image to the gallery. * @@ -136,8 +111,6 @@ class ImageGallery function toHTML() { global $wgLang, $wgIgnoreImageErrors, $wgGenerateThumbnailOnParse; - $sk = $this->getSkin(); - $s = ''; if( $this->mCaption ) $s .= ''; @@ -157,7 +130,7 @@ class ImageGallery else if( $this->mParsing && wfIsBadImage( $nt->getDBkey() ) ) { # The image is blacklisted, just show it as a text link. $thumbhtml = '
    ' - . $sk->makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . '
    '; + . Linker::makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) ) . ''; } else if( !( $thumb = $img->getThumbnail( 120, 120, $wgGenerateThumbnailOnParse ) ) ) { # Error generating thumbnail. $thumbhtml = '
    ' @@ -166,11 +139,11 @@ class ImageGallery else { $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2; $thumbhtml = '
    ' - . $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '
    '; + . Linker::makeKnownLinkObj( $nt, $thumb->toHtml() ) . '
    '; } //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() ) { @@ -185,7 +158,7 @@ class ImageGallery } $textlink = $this->mShowFilename ? - $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "
    \n" : + Linker::makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "
    \n" : '' ; # ATTENTION: The newline after
    is needed to accommodate htmltidy which diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 86a15008fb..5067151b02 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -181,7 +181,6 @@ class ImagePage extends Article { $max = $wgImageLimits[$sizeSel]; $maxWidth = $max[0]; $maxHeight = $max[1]; - $sk = $wgUser->getSkin(); if ( $this->img->exists() ) { # image @@ -254,9 +253,9 @@ class ImagePage extends Article { 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 = ''; } @@ -264,8 +263,8 @@ class ImagePage extends Article { 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 = ''; } @@ -334,22 +333,20 @@ END # 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 = "
    " . 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); } @@ -379,18 +376,16 @@ END if( $this->img->fromSharedDirectory ) return; - $sk = $wgUser->getSkin(); - $wgOut->addHtml( '
      ' ); # "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( "
    • {$ulink}
    • " ); } # 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( '
    • ' . $elink . '
      ' . wfMsgWikiHtml( 'edit-externally-help' ) . '
    • ' ); $wgOut->addHtml( '
    ' ); @@ -406,16 +401,13 @@ END * If the page we've just displayed is in the "Image" namespace, * we follow it with an upload history of the image and its usage. */ - function imageHistory() - { - global $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, @@ -442,9 +434,8 @@ END } - function imageLinks() - { - global $wgUser, $wgOut; + function imageLinks() { + global $wgOut; $wgOut->addHTML( '\n" ); @@ -463,10 +454,9 @@ END } $wgOut->addHTML( '

    ' . wfMsg( 'linkstoimage' ) . "

    \n
      " ); - $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( "
    • {$link}
    • \n" ); } $wgOut->addHTML( "
    \n" ); @@ -699,8 +689,7 @@ END * @package MediaWiki */ class ImageHistoryList { - function ImageHistoryList( &$skin ) { - $this->skin =& $skin; + function ImageHistoryList() { } function beginImageHistoryList() { @@ -726,11 +715,8 @@ class ImageHistoryList { $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 = ''.$delall.''; + $dlink = Linker::makeKnownLinkObj( $wgTitle, $delall, + 'image=' . $wgTitle->getPartialURL() . '&action=delete'); } else { $dlink = $del; } @@ -738,10 +724,10 @@ class ImageHistoryList { $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 { @@ -753,15 +739,15 @@ class ImageHistoryList { } } - $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 = "
  • ({$dlink}) ({$rlink}) {$datetime} . . {$userlink} . . {$widthheight} ({$nbytes})"; - $s .= $this->skin->commentBlock( $description, $wgTitle ); + $s .= Linker::commentBlock( $description, $wgTitle ); $s .= "
  • \n"; return $s; } diff --git a/includes/Linker.php b/includes/Linker.php index f492f5733a..bef2cd62b2 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -16,18 +16,20 @@ * @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\""; @@ -36,7 +38,11 @@ class Linker { return $r; } - function getInterwikiLinkAttributes( $link, $text, $class='' ) { + /** + * @todo document + * @static + */ + protected static function getInterwikiLinkAttributes( $link, $text, $class='' ) { global $wgContLang; $same = ($link == $text); @@ -51,8 +57,12 @@ class Linker { 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 ); @@ -70,11 +80,13 @@ class Linker { } /** - * @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' ) { @@ -90,22 +102,24 @@ class Linker { /** * 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' ); @@ -116,19 +130,21 @@ class Linker { * 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; } } @@ -137,19 +153,21 @@ class Linker { * 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; } } @@ -158,19 +176,21 @@ class Linker { * 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; } } @@ -180,22 +200,22 @@ class Linker { * 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 "{$prefix}{$text}{$trail}"; @@ -207,7 +227,7 @@ class Linker { $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 ) { @@ -218,7 +238,6 @@ class Linker { } # Check for anchors, normalize the anchor - $parts = explode( '#', $u, 2 ); if ( count( $parts ) == 2 ) { $anchor = urlencode( Sanitizer::decodeCharReferences( str_replace(' ', '_', $parts[1] ) ) ); @@ -238,13 +257,13 @@ class Linker { 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 ) { @@ -267,9 +286,9 @@ class Linker { $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' ); @@ -282,18 +301,19 @@ class Linker { * 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 ); @@ -321,12 +341,12 @@ class Linker { $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 = "{$prefix}{$text}{$inside}{$trail}"; wfProfileOut( $fname ); return $r; @@ -335,16 +355,18 @@ class Linker { /** * 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 "{$prefix}{$text}{$trail}"; } @@ -362,9 +384,9 @@ class Linker { 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 = "{$prefix}{$text}{$inside}{$trail}"; wfProfileOut( $fname ); @@ -374,14 +396,16 @@ class Linker { /** * 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 ); @@ -389,9 +413,9 @@ class Linker { 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 = "{$prefix}{$text}{$inside}{$trail}"; return $s; } @@ -399,40 +423,47 @@ class Linker { /** * 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 "{$prefix}{$text}{$inside}{$trail}"; } - /** @todo document */ - function fnamePart( $url ) { + /** + * @todo document + * @static + */ + public static function fnamePart( $url ) { $basename = strrchr( $url, '/' ); if ( false === $basename ) { $basename = $url; @@ -442,62 +473,66 @@ class Linker { 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 = ''.$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 = '
    '; $postfix = '
    '; $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' ); @@ -508,14 +543,12 @@ class Linker { $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 == '') { @@ -549,7 +582,7 @@ class Linker { if ( $error ) { $s = $error; } elseif ( $url == '' ) { - $s = $this->makeBrokenImageLinkObj( $img->getTitle() ); + $s = self::makeBrokenImageLinkObj( $img->getTitle() ); //$s .= "
    {$alt}
    {$url}
    \n"; } else { $s = '' . @@ -568,8 +601,10 @@ class Linker { /** * 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 = ''; @@ -606,19 +641,17 @@ class Linker { } $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; } } } @@ -638,7 +671,7 @@ class Linker { $s .= htmlspecialchars( $error ); $zoomicon = ''; } elseif( !$img->exists() ) { - $s .= $this->makeBrokenImageLinkObj( $img->getTitle() ); + $s .= self::makeBrokenImageLinkObj( $img->getTitle() ); $zoomicon = ''; } else { $s .= ''. @@ -660,10 +693,12 @@ class Linker { /** * 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 "{$prefix}{$text}{$trail}"; } @@ -681,33 +716,34 @@ class Linker { 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 = "{$prefix}{$text}{$inside}{$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; @@ -731,19 +767,24 @@ class Linker { } } - /** @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"'; @@ -757,45 +798,47 @@ class Linker { /** * 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 ) { @@ -806,41 +849,45 @@ class Linker { } /** - * @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' ); } @@ -852,14 +899,16 @@ class Linker { /** * 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' ); } @@ -868,22 +917,24 @@ class Linker { } 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 - * + * * 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 ); @@ -913,7 +964,7 @@ class Linker { $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; @@ -936,7 +987,7 @@ class Linker { 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 ) ) { @@ -947,7 +998,7 @@ class Linker { $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 ); } @@ -958,33 +1009,36 @@ class Linker { /** * 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 " ($formatted)"; } } - + /** * 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 = " " . wfMsgHtml( 'rev-deleted-comment' ) . ""; @@ -995,35 +1049,49 @@ class Linker { return $block; } - /** @todo document */ - function tocIndent() { + /** + * @todo document + * @static + */ + public static function tocIndent() { return "\n
      "; } - /** @todo document */ - function tocUnindent($level) { + /** + * @todo document + * @static + */ + public static function tocUnindent($level) { return "\n" . str_repeat( "
    \n\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
  • ' . $tocnumber . ' ' . $tocline . ''; } - /** @todo document */ - function tocLineEnd() { + /** + * @todo document + * @static + */ + static function tocLineEnd() { return "
  • \n"; } - /** @todo document */ - function tocList($toc) { + /** + * @todo document + * @static + */ + static function tocList($toc) { global $wgJsMimeType; - $title = wfMsgForContent('toc') ; + $title = wfMsgForContent('toc') ; return '
    ' . '

    ' . $title . "

    \n" @@ -1040,29 +1108,33 @@ class Linker { . "\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 "[".$url."]"; - } /** - * @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 "[".$url."]"; } @@ -1070,10 +1142,10 @@ class Linker { /** * 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; @@ -1088,6 +1160,5 @@ class Linker { } return array( $inside, $trail ); } - } ?> diff --git a/includes/LogPage.php b/includes/LogPage.php index d25b8aa4ce..46bace0001 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -130,7 +130,7 @@ class LogPage { /** * @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"; @@ -138,37 +138,35 @@ class LogPage { 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; @@ -176,17 +174,17 @@ class LogPage { $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 { @@ -194,8 +192,8 @@ class LogPage { $rv = "$action"; } if( $filterWikilinks ) { - $rv = str_replace( "[[", "", $rv ); - $rv = str_replace( "]]", "", $rv ); + $rv = str_replace( '[[', '', $rv ); + $rv = str_replace( ']]', '', $rv ); } return $rv; } @@ -215,9 +213,9 @@ class LogPage { $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(); } @@ -226,7 +224,7 @@ class LogPage { * Create a blob from a parameter array * @static */ - function makeParamBlob( $params ) { + static function makeParamBlob( $params ) { return implode( "\n", $params ); } @@ -234,7 +232,7 @@ class LogPage { * Extract a parameter array from a blob * @static */ - function extractParams( $blob ) { + static function extractParams( $blob ) { if ( $blob === '' ) { return array(); } else { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index a59ff3d357..dc56282320 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -231,7 +231,7 @@ class OutputPage { * Add an array of categories, with names in the keys */ public function addCategoryLinks($categories) { - global $wgUser, $wgContLang; + global $wgContLang; if ( !is_array( $categories ) ) { return; @@ -242,11 +242,10 @@ class OutputPage { $lb->setArray( $arr ); $lb->execute(); - $sk =& $wgUser->getSkin(); foreach ( $categories as $category => $arbitrary ) { $title = Title::makeTitleSafe( NS_CATEGORY, $category ); $text = $wgContLang->convertHtml( $title->getText() ); - $this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text ); + $this->mCategoryLinks[] = Linker::makeLinkObj( $title, $text ); } } @@ -615,9 +614,6 @@ class OutputPage { # Buffer output; final headers may depend on later processing ob_start(); - # Disable temporary placeholders, so that the skin produces HTML - $sk->postParseLinkColour( false ); - $wgRequest->response()->header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" ); $wgRequest->response()->header( 'Content-language: '.$wgContLanguageCode ); @@ -760,7 +756,7 @@ class OutputPage { * @param string $permission key required */ public function permissionRequired( $permission ) { - global $wgGroupPermissions, $wgUser; + global $wgGroupPermissions; $this->setPageTitle( wfMsg( 'badaccess' ) ); $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); @@ -774,8 +770,7 @@ class OutputPage { $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.'"'; } @@ -823,15 +818,13 @@ class OutputPage { return; } - $skin = $wgUser->getSkin(); - $this->setPageTitle( wfMsg( 'loginreqtitle' ) ); $this->setHtmlTitle( wfMsg( 'errorpagetitle' ) ); $this->setRobotPolicy( 'noindex,nofollow' ); $this->setArticleFlag( false ); $loginTitle = SpecialPage::getTitleFor( 'Userlogin' ); - $loginLink = $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" ); @@ -859,9 +852,8 @@ class OutputPage { $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 @@ -965,7 +957,7 @@ class OutputPage { * @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' ); @@ -984,8 +976,7 @@ class OutputPage { $titleObj = Title::newMainPage(); } - $sk = $wgUser->getSkin(); - $link = $sk->makeLinkObj( $titleObj, '' ); + $link = Linker::makeLinkObj( $titleObj, '' ); $r = wfMsg( 'returnto', $link ); if ( $auto ) { diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 380bbe2637..2b174cffef 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -21,7 +21,7 @@ class PageHistory { const DIR_PREV = 0; const DIR_NEXT = 1; - var $mArticle, $mTitle, $mSkin; + var $mArticle, $mTitle; var $lastdate; var $linesonpage; var $mNotificationTimestamp; @@ -34,12 +34,9 @@ class PageHistory { * @returns nothing */ function PageHistory($article) { - global $wgUser; - $this->mArticle =& $article; $this->mTitle =& $article->mTitle; $this->mNotificationTimestamp = NULL; - $this->mSkin = $wgUser->getSkin(); } /** @@ -71,7 +68,7 @@ class PageHistory { $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' ) . '
    ' . $logLink; $wgOut->setSubtitle( $subtitle ); @@ -178,8 +175,8 @@ class PageHistory { $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"; @@ -189,7 +186,7 @@ class PageHistory { // 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() ) ); @@ -203,7 +200,7 @@ class PageHistory { $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); } - $s .= $this->mSkin->revComment( $rev ); + $s .= Linker::revComment( $rev ); if ($notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp)) { $s .= ' ' . wfMsgHtml( 'updatedmarker' ) . ''; } @@ -220,7 +217,7 @@ class PageHistory { 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; @@ -237,7 +234,7 @@ class PageHistory { 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() ); @@ -252,14 +249,14 @@ class PageHistory { 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}" diff --git a/includes/Pager.php b/includes/Pager.php index b14aa8ca6e..f4b22a3834 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -225,7 +225,7 @@ abstract class IndexPager implements Pager { if ( $query === null ) { return $text; } else { - return $this->getSkin()->makeKnownLinkObj( $this->getTitle(), $text, + return Linker::makeKnownLinkObj( $this->getTitle(), $text, wfArrayToCGI( $query, $this->getDefaultQuery() ) ); } } @@ -261,17 +261,6 @@ abstract class IndexPager implements Pager { return $GLOBALS['wgTitle']; } - /** - * Get the current skin. This can be overridden if necessary. - */ - function getSkin() { - if ( !isset( $this->mSkin ) ) { - global $wgUser; - $this->mSkin = $wgUser->getSkin(); - } - return $this->mSkin; - } - /** * Get an array of query parameters that should be put into self-links. * By default, all parameters passed in the URL are used, except for a diff --git a/includes/Parser.php b/includes/Parser.php index 336b6f8f32..0d881b5eeb 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1037,10 +1037,8 @@ class Parser substr($m[0], 0, 20 ) . '"' ); } - $url = wfMsg( $urlmsg, $id); - $sk =& $this->mOptions->getSkin(); - $la = $sk->getExternalLinkAttributes( $url, $keyword.$id ); - $text = "{$keyword} {$id}"; + $url = wfMsg( $urlmsg, $id ); + $text = Linker::makeExternalLink( $url, "$keyword $id" ); } return $text; } @@ -1258,8 +1256,6 @@ class Parser $fname = 'Parser::replaceExternalLinks'; wfProfileIn( $fname ); - $sk =& $this->mOptions->getSkin(); - $bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); $s = $this->replaceFreeExternalLinks( array_shift( $bits ) ); @@ -1321,7 +1317,7 @@ class Parser # 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 @@ -1347,8 +1343,6 @@ class Parser $s = array_shift( $bits ); $i = 0; - $sk =& $this->mOptions->getSkin(); - while ( $i < count( $bits ) ){ $protocol = $bits[$i++]; $remainder = $bits[$i++]; @@ -1400,7 +1394,7 @@ class Parser $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 ); @@ -1455,7 +1449,6 @@ class Parser * @private */ function maybeMakeExternalImage( $url ) { - $sk =& $this->mOptions->getSkin(); $imagesfrom = $this->mOptions->getAllowExternalImagesFrom(); $imagesexception = !empty($imagesfrom); $text = false; @@ -1463,7 +1456,7 @@ class Parser || ( $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; @@ -1485,8 +1478,6 @@ class Parser # the % is needed to support urlencoded titles as well if ( !$tc ) { $tc = Title::legalChars() . '#%'; } - $sk =& $this->mOptions->getSkin(); - #split the entire text string on occurences of [[ $a = explode( '[[', ' ' . $s ); #get the first element (all text up to first [[), and remove the space we added @@ -1734,13 +1725,13 @@ class Parser 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() ); @@ -1815,8 +1806,7 @@ class Parser */ 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; } @@ -3381,9 +3371,6 @@ class Parser $enoughToc = false; } - # We need this to perform operations on the HTML - $sk =& $this->mOptions->getSkin(); - # headline counter $headlineCount = 0; $sectionCount = 0; # headlineCount excluding template sections @@ -3427,7 +3414,7 @@ class Parser $toclevel++; $sublevelCount[$toclevel] = 0; if( $toclevel<$wgMaxTocLevel ) { - $toc .= $sk->tocIndent(); + $toc .= Linker::tocIndent(); } } elseif ( $level < $prevlevel && $toclevel > 1 ) { @@ -3451,13 +3438,13 @@ class Parser } } 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(); } } @@ -3517,7 +3504,7 @@ class Parser $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 tag @$head[$headlineCount] .= "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. @@ -3544,9 +3531,9 @@ class Parser 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 @@ -3561,7 +3548,7 @@ class Parser # 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 ) { @@ -3904,7 +3891,7 @@ class Parser /** * Replace 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 @@ -3921,7 +3908,6 @@ class Parser $pdbks = array(); $colours = array(); - $sk =& $this->mOptions->getSkin(); $linkCache =& LinkCache::singleton(); if ( !empty( $this->mLinkHolders['namespaces'] ) ) { @@ -4102,15 +4088,15 @@ class Parser $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] ); } @@ -4136,7 +4122,7 @@ class Parser $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( @@ -4216,7 +4202,6 @@ class Parser $ig->setShowBytes( false ); $ig->setShowFilename( false ); $ig->setParsing(); - $ig->useSkin( $this->mOptions->getSkin() ); if( isset( $params['caption'] ) ) $ig->setCaption( $params['caption'] ); @@ -4345,8 +4330,7 @@ class Parser $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 ); } /** @@ -4682,7 +4666,6 @@ class ParserOptions var $mInterwikiMagic; # Interlanguage links are removed and returned in an array var $mAllowExternalImages; # Allow external images inline var $mAllowExternalImagesFrom; # If not, any exception? - var $mSkin; # Reference to the preferred skin var $mDateFormat; # Date format index var $mEditSection; # Create "edit section" links var $mNumberHeadings; # Automatically number headings @@ -4692,7 +4675,7 @@ class ParserOptions var $mMaxIncludeSize; # Maximum size of template expansions, in bytes var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS - var $mUser; # Stored user object, just used to initialise the skin + var $mUser; # Stored user object, just used to initialise the date format function getUseTeX() { return $this->mUseTeX; } function getUseDynamicDates() { return $this->mUseDynamicDates; } @@ -4707,13 +4690,6 @@ class ParserOptions function getMaxIncludeSize() { return $this->mMaxIncludeSize; } function getRemoveComments() { return $this->mRemoveComments; } - function &getSkin() { - if ( !isset( $this->mSkin ) ) { - $this->mSkin = $this->mUser->getSkin(); - } - return $this->mSkin; - } - function getDateFormat() { if ( !isset( $this->mDateFormat ) ) { $this->mDateFormat = $this->mUser->getDatePreference(); @@ -4731,7 +4707,6 @@ class ParserOptions function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); } function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); } function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); } - function setSkin( $x ) { $this->mSkin = $x; } function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); } function setMaxIncludeSize( $x ) { return wfSetVar( $this->mMaxIncludeSize, $x ); } function setRemoveComments( $x ) { return wfSetVar( $this->mRemoveComments, $x ); } @@ -4772,7 +4747,6 @@ class ParserOptions $this->mInterwikiMagic = $wgInterwikiMagic; $this->mAllowExternalImages = $wgAllowExternalImages; $this->mAllowExternalImagesFrom = $wgAllowExternalImagesFrom; - $this->mSkin = null; # Deferred $this->mDateFormat = null; # Deferred $this->mEditSection = true; $this->mNumberHeadings = $user->getOption( 'numberheadings' ); diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 3839aae563..f7b9d1a585 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -156,12 +156,11 @@ class QueryPage { } /** - * 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 ''; } @@ -275,7 +274,7 @@ class QueryPage { * @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; @@ -321,8 +320,6 @@ class QueryPage { $this->preprocessResults( $dbr, $res ); - $sk = $wgUser->getSkin( ); - if($shownavigation) { $wgOut->addHTML( $this->getPageHeader() ); $top = wfShowingResults( $offset, $num); @@ -343,7 +340,7 @@ class QueryPage { # Only read at most $num rows, because $res may contain the whole 1000 for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) { - $format = $this->formatResult( $sk, $obj ); + $format = $this->formatResult( $obj ); if ( $format ) { $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && $obj->patrolled == 0 ) ? ' class="not-patrolled"' : ''; @@ -354,7 +351,7 @@ class QueryPage { 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"' : ''; @@ -473,10 +470,10 @@ class QueryPage { */ 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() ) ) ); } } diff --git a/includes/Skin.php b/includes/Skin.php index 0f9ca2ca67..87dad8f1c8 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -70,7 +70,7 @@ class Skin extends Linker { */ static function normalizeKey( $key ) { global $wgDefaultSkin; - $skinNames = Skin::getSkinNames(); + $skinNames = self::getSkinNames(); if( $key == '' ) { // Don't return the default immediately; @@ -110,9 +110,9 @@ class Skin extends Linker { 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. @@ -579,7 +579,7 @@ END; $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 @@ -591,7 +591,7 @@ END; $parenttree = $wgTitle->getParentCategoryTree(); # Skin object passed by reference cause it can not be # accessed under the method subfunction drawCategoryBrowser - $tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) ); + $tempout = explode("\n", self::drawCategoryBrowser($parenttree, $this) ); # Clean out bogus first entry and sort them unset($tempout[0]); asort($tempout); @@ -602,12 +602,14 @@ END; 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)) { @@ -615,11 +617,11 @@ END; $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; } @@ -690,13 +692,13 @@ END; $image = new Image( $wgTitle ); if( $image->exists() ) { $link = htmlspecialchars( $image->getURL() ); - $style = $this->getInternalLinkAttributes( $link, $name ); + $style = self::getInternalLinkAttributes( $link, $name ); $s .= " | {$name}"; } } } if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) { - $s .= ' | ' . $this->makeKnownLinkObj( $wgTitle, + $s .= ' | ' . self::makeKnownLinkObj( $wgTitle, wfMsg( 'currentrev' ) ); } @@ -704,8 +706,8 @@ END; # 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.= ' | '. wfMsg( 'youhavenewmessages', $tl, $dl ) . ''; # disable caching $wgOut->setSquidMaxage(0); @@ -732,7 +734,7 @@ END; $msg = 'viewdeleted'; } return wfMsg( $msg, - $this->makeKnownLink( + self::makeKnownLink( $wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ), wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) ); } @@ -794,7 +796,7 @@ END; $c++; if ($cmakeLink( $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 .= ' | '; @@ -821,7 +823,7 @@ END; 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.')'; @@ -834,24 +836,24 @@ END; $q = ''; } else { $q = "returnto={$rt}"; } - $s .= "\n
    " . $this->makeKnownLinkObj( + $s .= "\n
    " . 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}
    " . - $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; @@ -885,7 +887,7 @@ END; $sep = " |\n"; $s = $this->mainPageLink() . $sep - . $this->specialLink( 'recentchanges' ); + . self::specialLink( 'recentchanges' ); if ( $wgOut->isArticleRelated() ) { $s .= $sep . $this->editThisPage() @@ -1042,9 +1044,9 @@ END; $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; @@ -1148,12 +1150,12 @@ END; 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; } @@ -1163,12 +1165,12 @@ END; 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; } @@ -1178,7 +1180,7 @@ END; if ($disclaimers == '-') { return ''; } else { - return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ), + return self::makeKnownLink( wfMsgForContent( 'disclaimerpage' ), $disclaimers ); } } @@ -1195,7 +1197,7 @@ END; $t = wfMsg( 'viewsource' ); } - $s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() ); + $s = self::makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() ); } return $s; } @@ -1224,7 +1226,7 @@ END; 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 = ''; } @@ -1243,7 +1245,7 @@ END; $t = wfMsg( 'protectthispage' ); $q = 'action=protect'; } - $s = $this->makeKnownLinkObj( $wgTitle, $t, $q ); + $s = self::makeKnownLinkObj( $wgTitle, $t, $q ); } else { $s = ''; } @@ -1261,7 +1263,7 @@ END; $t = wfMsg( 'watchthispage' ); $q = 'action=watch'; } - $s = $this->makeKnownLinkObj( $wgTitle, $t, $q ); + $s = self::makeKnownLinkObj( $wgTitle, $t, $q ); } else { $s = wfMsg( 'notanarticle' ); } @@ -1272,7 +1274,7 @@ END; 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 @@ -1283,14 +1285,14 @@ END; 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' ) ); } @@ -1298,7 +1300,7 @@ END; function userContribsLink() { global $wgTitle; - return $this->makeKnownLinkObj( + return self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $wgTitle->getDBkey() ), wfMsg( 'contributions' ) ); } @@ -1317,7 +1319,7 @@ END; function emailUserLink() { global $wgTitle; - return $this->makeKnownLinkObj( + return self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ), wfMsg( 'emailuser' ) ); } @@ -1328,7 +1330,7 @@ END; if ( ! $wgOut->isArticleRelated() ) { return '(' . wfMsg( 'notanarticle' ) . ')'; } else { - return $this->makeKnownLinkObj( + return self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ), wfMsg( 'recentchangeslinked' ) ); } @@ -1365,7 +1367,7 @@ END; $text = $wgContLang->getLanguageName( $nt->getInterwiki() ); if ( '' == $text ) { $text = $l; } - $style = $this->getExternalLinkAttributes( $l, $text ); + $style = self::getExternalLinkAttributes( $l, $text ); $s .= "{$text}"; } if($wgContLang->isRTL()) $s .= ''; @@ -1373,7 +1375,7 @@ END; } function bugReportsLink() { - $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ), + $s = self::makeKnownLink( wfMsgForContent( 'bugreportspage' ), wfMsg( 'bugreports' ) ); return $s; } @@ -1385,18 +1387,18 @@ END; $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; } @@ -1444,7 +1446,7 @@ END; $text = wfMsg( 'talkpage' ); } - $s = $this->makeLinkObj( $link, $text ); + $s = self::makeLinkObj( $link, $text ); return $s; } @@ -1467,7 +1469,7 @@ END; $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 */ diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index a4238cce74..a0ae8cdaa9 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -295,12 +295,12 @@ class SkinTemplate extends Skin { $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' diff --git a/includes/SpecialAllpages.php b/includes/SpecialAllpages.php index e868ec7160..43d63dbbcf 100644 --- a/includes/SpecialAllpages.php +++ b/includes/SpecialAllpages.php @@ -83,8 +83,7 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) { * @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 @@ -185,8 +184,6 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) { * @param integer $namespace (Default NS_MAIN) */ function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { - global $wgUser; - $sk = $wgUser->getSkin(); $dbr =& wfGetDB( DB_SLAVE ); $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); @@ -208,12 +205,10 @@ function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { * @param string $from list all pages from this name (default FALSE) */ function showChunk( $namespace = NS_MAIN, $from, $including = false ) { - global $wgOut, $wgUser, $wgContLang; + global $wgOut, $wgContLang; $fname = 'indexShowChunk'; - $sk = $wgUser->getSkin(); - $fromList = $this->getNamespaceKeyAndText($namespace, $from); if ( !$fromList ) { @@ -246,7 +241,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) { $t = Title::makeTitle( $s->page_namespace, $s->page_title ); if( $t ) { $link = ($s->page_is_redirect ? '
    ' : '' ) . - $sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) . + Linker::makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) . ($s->page_is_redirect ? '
    ' : '' ); } else { $link = '[[' . htmlspecialchars( $s->page_title ) . ']]'; @@ -273,12 +268,12 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) { $out2 = ''; $out2 .= '
    ' . $nsForm; $out2 .= '' . - $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 .= "

    "; } diff --git a/includes/SpecialAncientpages.php b/includes/SpecialAncientpages.php index 39a3c8ea17..e5b5ab7f72 100644 --- a/includes/SpecialAncientpages.php +++ b/includes/SpecialAncientpages.php @@ -44,12 +44,12 @@ class AncientPagesPage extends QueryPage { 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); } } diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php index 653e13e244..98af782311 100644 --- a/includes/SpecialBrokenRedirects.php +++ b/includes/SpecialBrokenRedirects.php @@ -45,7 +45,7 @@ class BrokenRedirectsPage extends PageQueryPage { return ''; } - function formatResult( $skin, $result ) { + function formatResult( $result ) { global $wgContLang; $fromObj = Title::makeTitle( $result->namespace, $result->title ); @@ -62,12 +62,12 @@ class BrokenRedirectsPage extends PageQueryPage { // $toObj may very easily be false if the $result list is cached if ( !is_object( $toObj ) ) { - return '' . $skin->makeLinkObj( $fromObj ) . ''; + return '' . Linker::makeLinkObj( $fromObj ) . ''; } - $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"; diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php index 89cff20a05..5bcb97e34d 100644 --- a/includes/SpecialCategories.php +++ b/includes/SpecialCategories.php @@ -44,10 +44,10 @@ class CategoriesPage extends QueryPage { 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); diff --git a/includes/SpecialConfirmemail.php b/includes/SpecialConfirmemail.php index d109eee785..e428d6ca62 100644 --- a/includes/SpecialConfirmemail.php +++ b/includes/SpecialConfirmemail.php @@ -38,8 +38,7 @@ class EmailConfirmation extends SpecialPage { } 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 { diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 29198bb1af..d077b76c5d 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -291,9 +291,8 @@ function wfSpecialContributions( $par = null ) { $wgOut->addHTML( "
      \n" ); - $sk = $wgUser->getSkin(); foreach ( $contribs as $contrib ) - $wgOut->addHTML( ucListEdit( $sk, $contrib ) ); + $wgOut->addHTML( ucListEdit( $contrib ) ); $wgOut->addHTML( "
    \n" ); $wgOut->addHTML( "

    {$prevnextbits}

    \n" ); @@ -306,27 +305,26 @@ function wfSpecialContributions( $par = null ) { function contributionsSub( $nt ) { global $wgSysopUserBans, $wgLang, $wgUser; - $sk = $wgUser->getSkin(); $id = User::idFromName( $nt->getText() ); if ( 0 == $id ) { $ul = $nt->getText(); } else { - $ul = $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; @@ -377,7 +375,7 @@ function contributionsForm( $options ) { * * @todo This would probably look a lot nicer in a table. */ -function ucListEdit( $sk, $row ) { +function ucListEdit( $row ) { $fname = 'ucListEdit'; wfProfileIn( $fname ); @@ -392,12 +390,12 @@ function ucListEdit( $sk, $row ) { $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 .= '' . $messages['uctop'] . ''; 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']; } @@ -406,20 +404,20 @@ function ucListEdit( $sk, $row ) { $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 ) ) { diff --git a/includes/SpecialDisambiguations.php b/includes/SpecialDisambiguations.php index 0355c85b72..622c813ef1 100644 --- a/includes/SpecialDisambiguations.php +++ b/includes/SpecialDisambiguations.php @@ -23,11 +23,8 @@ class DisambiguationsPage extends PageQueryPage { return Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage'); } - function getPageHeader( ) { - global $wgUser; - $sk = $wgUser->getSkin(); - - return '

    '.wfMsg('disambiguationstext', $sk->makeKnownLinkObj($this->getDisambiguationPageObj()))."


    \n"; + function getPageHeader() { + return '

    '.wfMsg('disambiguationstext', Linker::makeKnownLinkObj($this->getDisambiguationPageObj()))."


    \n"; } function getSQL() { @@ -88,15 +85,15 @@ class DisambiguationsPage extends PageQueryPage { 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"; } diff --git a/includes/SpecialDoubleRedirects.php b/includes/SpecialDoubleRedirects.php index fe42b00a1b..079d7eb4d8 100644 --- a/includes/SpecialDoubleRedirects.php +++ b/includes/SpecialDoubleRedirects.php @@ -61,7 +61,7 @@ class DoubleRedirectsPage extends PageQueryPage { return ''; } - function formatResult( $skin, $result ) { + function formatResult( $result ) { global $wgContLang; $fname = 'DoubleRedirectsPage::formatResult'; @@ -83,10 +83,10 @@ class DoubleRedirectsPage extends PageQueryPage { $titleB = Title::makeTitle( $result->nsb, $result->tb ); $titleC = Title::makeTitle( $result->nsc, $result->tc ); - $linkA = $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}" ); diff --git a/includes/SpecialImagelist.php b/includes/SpecialImagelist.php index 54ee83e5f1..bd4939ba4d 100644 --- a/includes/SpecialImagelist.php +++ b/includes/SpecialImagelist.php @@ -112,7 +112,7 @@ class ImageListPager extends TablePager { $name = $this->mCurrentRow->img_name; $ilink = "" . $this->mMessages['imgfile'] . ""; - $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': @@ -121,7 +121,7 @@ class ImageListPager extends TablePager { 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 ); @@ -130,7 +130,7 @@ class ImageListPager extends TablePager { case 'img_size': return $wgLang->formatNum( $value ); case 'img_description': - return $this->getSkin()->commentBlock( $value ); + return Linker::commentBlock( $value ); } } diff --git a/includes/SpecialImport.php b/includes/SpecialImport.php index 04deb1bfd3..9c04111adc 100644 --- a/includes/SpecialImport.php +++ b/includes/SpecialImport.php @@ -176,16 +176,14 @@ class ImportReporter { } 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( "
  • " . $skin->makeKnownLinkObj( $title ) . + $wgOut->addHtml( "
  • " . Linker::makeKnownLinkObj( $title ) . " " . wfMsgExt( 'import-revision-count', array( 'parsemag', 'escape' ), $localCount ) . "
  • \n" ); diff --git a/includes/SpecialIpblocklist.php b/includes/SpecialIpblocklist.php index 85764be909..869d672910 100644 --- a/includes/SpecialIpblocklist.php +++ b/includes/SpecialIpblocklist.php @@ -234,10 +234,8 @@ class IPUnblockForm { 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', @@ -251,15 +249,15 @@ class IPUnblockForm { # 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 ); @@ -289,9 +287,9 @@ class IPUnblockForm { 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 .= "\n"; wfProfileOut( __METHOD__ ); return $s; diff --git a/includes/SpecialListredirects.php b/includes/SpecialListredirects.php index f717ef72c0..cd59d255a2 100644 --- a/includes/SpecialListredirects.php +++ b/includes/SpecialListredirects.php @@ -27,13 +27,13 @@ class ListredirectsPage extends QueryPage { 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 ); @@ -41,7 +41,7 @@ class ListredirectsPage extends QueryPage { # 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 = '*'; diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 4668d0c7d7..f5446ba0d9 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -173,9 +173,9 @@ class ListUsersPage extends QueryPage { 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 ) { diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 10d1d89cb6..2a67763a78 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -218,8 +218,6 @@ class LogViewer { * @param LogReader &$reader where to get our data from */ function LogViewer( &$reader ) { - global $wgUser; - $this->skin =& $wgUser->getSkin(); $this->reader =& $reader; } @@ -316,15 +314,15 @@ class LogViewer { $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' ) ) . @@ -332,7 +330,7 @@ class LogViewer { } } - $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 = "
  • $time $userLink $action $comment $revert
  • \n"; return $out; } diff --git a/includes/SpecialMIMEsearch.php b/includes/SpecialMIMEsearch.php index cbbe6f936d..bdd22fc154 100644 --- a/includes/SpecialMIMEsearch.php +++ b/includes/SpecialMIMEsearch.php @@ -59,19 +59,19 @@ class MIMEsearchPage extends QueryPage { "; } - 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"; diff --git a/includes/SpecialMostcategories.php b/includes/SpecialMostcategories.php index c0d662cc41..503cad413d 100644 --- a/includes/SpecialMostcategories.php +++ b/includes/SpecialMostcategories.php @@ -36,18 +36,18 @@ class MostcategoriesPage extends QueryPage { "; } - 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); diff --git a/includes/SpecialMostimages.php b/includes/SpecialMostimages.php index 09f7108863..45ab1473e5 100644 --- a/includes/SpecialMostimages.php +++ b/includes/SpecialMostimages.php @@ -34,17 +34,17 @@ class MostimagesPage extends QueryPage { "; } - 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); } diff --git a/includes/SpecialMostlinked.php b/includes/SpecialMostlinked.php index 6f5f30dbdd..f50120c7c5 100644 --- a/includes/SpecialMostlinked.php +++ b/includes/SpecialMostlinked.php @@ -58,28 +58,26 @@ class MostlinkedPage extends QueryPage { * Make a link to "what links here" for the specified title * * @param $title Title being queried - * @param $skin Skin to use * @return string */ - function makeWlhLink( &$title, $caption, &$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 ); } } diff --git a/includes/SpecialMostlinkedcategories.php b/includes/SpecialMostlinkedcategories.php index 5942b3f4ea..055cf7c45b 100644 --- a/includes/SpecialMostlinkedcategories.php +++ b/includes/SpecialMostlinkedcategories.php @@ -53,13 +53,13 @@ class MostlinkedCategoriesPage extends QueryPage { $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 ) ); diff --git a/includes/SpecialMostrevisions.php b/includes/SpecialMostrevisions.php index 676923ae79..906d4b7fdf 100644 --- a/includes/SpecialMostrevisions.php +++ b/includes/SpecialMostrevisions.php @@ -38,17 +38,17 @@ class MostrevisionsPage extends QueryPage { "; } - 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); } diff --git a/includes/SpecialNewimages.php b/includes/SpecialNewimages.php index 66cf42603c..7f3144845a 100644 --- a/includes/SpecialNewimages.php +++ b/includes/SpecialNewimages.php @@ -9,11 +9,10 @@ * */ 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); @@ -135,7 +134,7 @@ function wfSpecialNewimages( $par, $specialPage ) { $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
    \n".$wgLang->timeanddate( $s->img_timestamp, true )."
    \n" ); @@ -177,18 +176,18 @@ function wfSpecialNewimages( $par, $specialPage ) { } $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 = '

    ' . $botLink . ' '. wfMsg( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'

    '; diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index a9a028b144..d299a6c0f3 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -84,21 +84,20 @@ class NewPagesPage extends QueryPage { /** * Format a row, providing the timestamp, links to the page/history, size, user links, and a comment * - * @param $skin Skin to use * @param $result Result row * @return string */ - function formatResult( $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}"; } diff --git a/includes/SpecialPopularpages.php b/includes/SpecialPopularpages.php index 77d41437c5..8e12efa46e 100644 --- a/includes/SpecialPopularpages.php +++ b/includes/SpecialPopularpages.php @@ -35,10 +35,10 @@ class PopularPagesPage extends QueryPage { 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); diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index ec1a957e4f..7616a49c0a 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -506,9 +506,8 @@ class PreferencesForm { $disableEmailPrefs = false; } else { $disableEmailPrefs = true; - $skin = $wgUser->getSkin(); $emailauthenticated = wfMsg('emailnotauthenticated').'
    ' . - $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ), + Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'Confirmemail' ), wfMsg( 'emailconfirmlink' ) ); } } else { diff --git a/includes/SpecialPrefixindex.php b/includes/SpecialPrefixindex.php index 86880d2f04..3f39cbce67 100644 --- a/includes/SpecialPrefixindex.php +++ b/includes/SpecialPrefixindex.php @@ -56,12 +56,10 @@ class SpecialPrefixindex extends SpecialAllpages { * @param string $from list all pages from this name (default FALSE) */ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = null ) { - global $wgOut, $wgUser, $wgContLang; + global $wgOut, $wgContLang; $fname = 'indexShowChunk'; - $sk = $wgUser->getSkin(); - if (!isset($from)) $from = $prefix; $fromList = $this->getNamespaceKeyAndText($namespace, $from); @@ -102,7 +100,7 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n $t = Title::makeTitle( $s->page_namespace, $s->page_title ); if( $t ) { $link = ($s->page_is_redirect ? '
    ' : '' ) . - $sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) . + Linker::makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) . ($s->page_is_redirect ? '
    ' : '' ); } else { $link = '[[' . htmlspecialchars( $s->page_title ) . ']]'; @@ -129,11 +127,11 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n $out2 = ''; $out2 .= '
    ' . $nsForm; $out2 .= '' . - $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 ) . diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index cfa115f168..95e9ee5e4a 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -222,7 +222,6 @@ function wfSpecialRecentchanges( $par, $specialPage ) { } // And now for the content - $sk = $wgUser->getSkin(); $wgOut->setSyndicated( true ); $list = ChangesList::newFromUser( $wgUser ); @@ -421,9 +420,8 @@ function rcDoOutputFeed( $rows, &$feed ) { * */ 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; @@ -433,9 +431,8 @@ function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) { * */ 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; @@ -478,9 +475,8 @@ function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall * @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 ) ); } @@ -621,12 +617,11 @@ function rcFormatDiff( $row ) { } function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment ) { - global $wgFeedDiffCutoff, $wgContLang, $wgUser; + global $wgFeedDiffCutoff, $wgContLang; $fname = 'rcFormatDiff'; wfProfileIn( $fname ); - $skin = $wgUser->getSkin(); - $completeText = '

    ' . $skin->formatComment( $comment ) . "

    \n"; + $completeText = '

    ' . Linker::formatComment( $comment ) . "

    \n"; if( $title->getNamespace() >= 0 ) { if( $oldid ) { diff --git a/includes/SpecialRecentchangeslinked.php b/includes/SpecialRecentchangeslinked.php index 59a3beb5c7..71b625ee49 100644 --- a/includes/SpecialRecentchangeslinked.php +++ b/includes/SpecialRecentchangeslinked.php @@ -23,7 +23,6 @@ function wfSpecialRecentchangeslinked( $par = NULL ) { $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0; $wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) ); - $sk = $wgUser->getSkin(); # Validate the title $nt = Title::newFromURL( $target ); @@ -55,11 +54,11 @@ function wfSpecialRecentchangeslinked( $par = NULL ) { $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" ); } @@ -138,7 +137,7 @@ $GROUPBY } $res = $dbr->query( $sql, $fname ); - $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."
    \n"); + $wgOut->addHTML("< ".Linker::makeKnownLinkObj($nt, "", "redirect=no" )."
    \n"); $note = wfMsg( "rcnote", $limit, $days, $wgLang->timeAndDate( wfTimestampNow(), true ) ); $wgOut->addHTML( "
    \n{$note}\n
    " ); diff --git a/includes/SpecialRevisiondelete.php b/includes/SpecialRevisiondelete.php index 1ab505dbf1..544c624025 100644 --- a/includes/SpecialRevisiondelete.php +++ b/includes/SpecialRevisiondelete.php @@ -10,12 +10,11 @@ */ 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 ) ) { @@ -49,7 +48,6 @@ class RevisionDeleteForm { $this->revisions = $request->getIntArray( 'oldid', array() ); - $this->skin = $wgUser->getSkin(); $this->checks = array( array( 'revdelete-hide-text', 'wpHideText', Revision::DELETED_TEXT ), array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ), @@ -122,11 +120,11 @@ class RevisionDeleteForm { $date = $wgContLang->timeanddate( $rev->getTimestamp() ); return "
  • " . - $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 ) . "
  • "; } diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index 8c2f8aad4d..2d0ef1ef3e 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -126,8 +126,7 @@ class SpecialSearch { $this->setupPage( $term ); - global $wgUser, $wgOut; - $sk = $wgUser->getSkin(); + global $wgOut; $wgOut->addWikiText( wfMsg( 'searchresulttext' ) ); #if ( !$this->parseQuery() ) { @@ -321,14 +320,13 @@ class SpecialSearch { wfProfileOut( $fname ); return "\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'), diff --git a/includes/SpecialShortpages.php b/includes/SpecialShortpages.php index 34b3505bbd..d6bd073d9e 100644 --- a/includes/SpecialShortpages.php +++ b/includes/SpecialShortpages.php @@ -60,7 +60,7 @@ class ShortPagesPage extends QueryPage { return false; } - function formatResult( $skin, $result ) { + function formatResult( $result ) { global $wgLang, $wgContLang; $dm = $wgContLang->getDirMark(); @@ -68,10 +68,10 @@ class ShortPagesPage extends QueryPage { if ( !$title ) { return ''; } - $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() diff --git a/includes/SpecialSpecialpages.php b/includes/SpecialSpecialpages.php index 6a01cd0829..67dc858296 100644 --- a/includes/SpecialSpecialpages.php +++ b/includes/SpecialSpecialpages.php @@ -9,25 +9,23 @@ * */ 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 ) { @@ -51,7 +49,7 @@ function wfSpecialSpecialpages_gen($pages,$heading,$sk) { /** Now output the HTML */ $wgOut->addHTML( '

    ' . wfMsgHtml( $heading ) . "

    \n
      " ); foreach ( $sortedPages as $desc => $title ) { - $link = $sk->makeKnownLinkObj( $title, $desc ); + $link = Linker::makeKnownLinkObj( $title, $desc ); $wgOut->addHTML( "
    • {$link}
    • \n" ); } $wgOut->addHTML( "
    \n" ); diff --git a/includes/SpecialStatistics.php b/includes/SpecialStatistics.php index 4a51efd9b5..2ab40962e3 100644 --- a/includes/SpecialStatistics.php +++ b/includes/SpecialStatistics.php @@ -82,17 +82,16 @@ function wfSpecialStatistics() { $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( '

    ' . wfMsgHtml( 'statistics-mostpopular' ) . '

    ' ); - $skin =& $wgUser->getSkin(); $wgOut->addHtml( '
      ' ); 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( '
    1. ' . $link . $dirmark . ' [' . $wgLang->formatNum( $row->page_counter ) . ']
    2. ' ); } diff --git a/includes/SpecialUncategorizedimages.php b/includes/SpecialUncategorizedimages.php index 3815697630..a4c6324612 100644 --- a/includes/SpecialUncategorizedimages.php +++ b/includes/SpecialUncategorizedimages.php @@ -37,11 +37,11 @@ class UncategorizedImagesPage extends QueryPage { 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 ); } } diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 299cb232ed..26eb15a82b 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -482,7 +482,7 @@ class UndeleteForm { } /* private */ function showList() { - global $wgLang, $wgContLang, $wgUser, $wgOut; + global $wgLang, $wgContLang, $wgOut; # List undeletable articles $result = PageArchive::listAllPages(); @@ -494,12 +494,11 @@ class UndeleteForm { } $wgOut->addWikiText( wfMsg( "undeletepagetext" ) ); - $sk = $wgUser->getSkin(); $undelete =& SpecialPage::getTitleFor( 'Undelete' ); $wgOut->addHTML( "
    "; $s .= $this->bottomLinks(); - $s .= "\n
    " . $this->makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | " + $s .= "\n
    " . self::makeKnownLink( wfMsgForContent( "mainpage" ) ) . " | " . $this->aboutLink() . " | " . $this->searchForm( wfMsg( "qbfind" ) ); @@ -138,15 +138,15 @@ class SkinCologneBlue extends Skin { } $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(); @@ -154,9 +154,9 @@ class SkinCologneBlue extends Skin { $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; @@ -195,7 +195,7 @@ class SkinCologneBlue extends Skin { $s .= $this->menuHead( "qbedit" ); $s .= "" . $this->editThisPage() . ""; - $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) ); + $s .= $sep . self::makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) ); if( $wgUser->isLoggedIn() ) { $s .= $sep . $this->moveThisPage(); @@ -244,31 +244,31 @@ class SkinCologneBlue extends Skin { $s .= $this->menuHead( "qbmyoptions" ); if ( $wgUser->isLoggedIn() ) { $name = $wgUser->getName(); - $tl = $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) { @@ -276,7 +276,7 @@ class SkinCologneBlue extends Skin { .wfMsg( "sitesupport" ).""; } - $s .= $sep . $this->makeKnownLinkObj( + $s .= $sep . self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Specialpages' ), wfMsg( 'moredotdotdot' ) ); diff --git a/skins/Nostalgia.php b/skins/Nostalgia.php index 3b19e41e64..7c82e0b8ba 100644 --- a/skins/Nostalgia.php +++ b/skins/Nostalgia.php @@ -57,7 +57,7 @@ class SkinNostalgia extends Skin { $sep = " |\n"; $s = $this->mainPageLink() . $sep - . $this->specialLink( "recentchanges" ); + . self::specialLink( "recentchanges" ); if ( $wgOut->isArticle() ) { $s .= $sep . $this->editThisPage() @@ -69,9 +69,9 @@ class SkinNostalgia extends Skin { $s .= $this->extensionTabLinks(); if ( $wgUser->isAnon() ) { - $s .= $sep . $this->specialLink( "userlogin" ); + $s .= $sep . self::specialLink( "userlogin" ); } else { - $s .= $sep . $this->specialLink( "userlogout" ); + $s .= $sep . self::specialLink( "userlogout" ); } $s .= $sep . $this->specialPagesList(); diff --git a/skins/Standard.php b/skins/Standard.php index 517fd19430..fb0a8df0f7 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -118,7 +118,7 @@ class SkinStandard extends Skin { $s .= $this->bottomLinks(); $s .= "\n
    " . $this->mainPageLink() . ' | ' . $this->aboutLink() - . ' | ' . $this->specialLink( 'recentchanges' ) + . ' | ' . self::specialLink( 'recentchanges' ) . ' | ' . $this->searchForm() . '
    ' . $this->pageStats() . ''; @@ -164,8 +164,8 @@ class SkinStandard extends Skin { } 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 @@ -220,7 +220,7 @@ class SkinStandard extends Skin { $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 @@ -231,10 +231,10 @@ class SkinStandard extends Skin { # "Post a comment" link if( ( $wgTitle->isTalkPage() || $wgOut->showNewSectionLink() ) && $action != 'edit' && !$wpPreview ) - $s .= '
    ' . $this->makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' ); + $s .= '
    ' . self::makeKnownLinkObj( $wgTitle, wfMsg( 'postcomment' ), 'action=edit§ion=new' ); #if( $tns%2 && $action!='edit' && !$wpPreview) { - #$s.= '
    '.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new'); + #$s.= '
    '.self::makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new'); #} /* @@ -282,9 +282,9 @@ class SkinStandard extends Skin { } 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; diff --git a/skins/disabled/HTMLDump.php b/skins/disabled/HTMLDump.php index 5f739a379d..12cbb58b68 100644 --- a/skins/disabled/HTMLDump.php +++ b/skins/disabled/HTMLDump.php @@ -80,7 +80,7 @@ class SkinHTMLDump extends SkinTemplate { $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 ); } } diff --git a/skins/disabled/MonoBookCBT.php b/skins/disabled/MonoBookCBT.php index f5f742d601..24c09c2f25 100644 --- a/skins/disabled/MonoBookCBT.php +++ b/skins/disabled/MonoBookCBT.php @@ -428,12 +428,12 @@ class SkinMonoBookCBT extends SkinTemplate { $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' -- 2.20.1