From 30ea75c64820d9f712afb327b3955bfca699f6c4 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 13 Jun 2009 12:39:00 +0000 Subject: [PATCH] * replace deprecated makeBrokenLinkObj() by LinkHolderArray.php() * replace deprecated makeKnownLink() by linkKnown() * add FIXME where I was not able to. Linking to r51559 for code review --- includes/QueryPage.php | 18 +++++++-- includes/parser/LinkHolderArray.php | 2 + includes/specials/SpecialAllmessages.php | 21 ++++++++-- includes/specials/SpecialWantedcategories.php | 12 ++++-- includes/specials/SpecialWatchlist.php | 31 +++++++++++---- skins/CologneBlue.php | 38 +++++++++++++++---- skins/Standard.php | 15 ++++++-- 7 files changed, 107 insertions(+), 30 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index af96746774..86a988e987 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -549,7 +549,7 @@ abstract class WantedQueryPage extends QueryPage { function isSyndicated() { return false; } - + /** * Cache page existence for performance */ @@ -578,9 +578,21 @@ abstract class WantedQueryPage extends QueryPage { if( $this->isCached() ) { $pageLink = $title->exists() ? '' . $skin->link( $title ) . '' - : $skin->makeBrokenLinkObj( $title ); + : $skin->link( + $title, + null, + array(), + array(), + array( 'broken' ) + ); } else { - $pageLink = $skin->makeBrokenLinkObj( $title ); + $pageLink = $skin->link( + $title, + null, + array(), + array(), + array( 'broken' ) + ); } return wfSpecialList( $pageLink, $this->makeWlhLink( $title, $skin, $result ) ); } else { diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index e760ee0566..4f382a4fa3 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -229,10 +229,12 @@ class LinkHolderArray { $linkCache->addBadLinkObj( $title ); $colours[$pdbk] = 'new'; $output->addLink( $title, 0 ); + // FIXME: replace deprecated makeBrokenLinkObj() by link() $replacePairs[$searchkey] = $sk->makeBrokenLinkObj( $title, $entry['text'], $query ); } else { + // FIXME: replace deprecated makeColouredLinkObj() by link() $replacePairs[$searchkey] = $sk->makeColouredLinkObj( $title, $colours[$pdbk], $entry['text'], $query ); diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index cfbe158e4a..f81e49aa21 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -187,20 +187,33 @@ function wfAllMessagesMakeHTMLText( &$messages ) { $message = htmlspecialchars( $m['statmsg'] ); $mw = htmlspecialchars( $m['msg'] ); + $linkText = "" . htmlspecialchars( $key ) . ''; + if( array_key_exists( $title, $pageExists[NS_MEDIAWIKI] ) ) { // FIXME: the span should be taken care of in $customAttribs, shouldn't it? $pageLink = $sk->linkKnown( $titleObj, - "" . htmlspecialchars( $key ) . '' + $linkText ); } else { - $pageLink = $sk->makeBrokenLinkObj( $titleObj, "" . - htmlspecialchars( $key ) . '' ); + $pageLink = $sk->link( + $titleObj, + $linkText, + array(), + array(), + array( 'broken' ) + ); } if( array_key_exists( $title, $pageExists[NS_MEDIAWIKI_TALK] ) ) { $talkLink = $sk->linkKnown( $talkPage, htmlspecialchars( $talk ) ); } else { - $talkLink = $sk->makeBrokenLinkObj( $talkPage, htmlspecialchars( $talk ) ); + $talkLink = $sk->link( + $talkPage, + htmlspecialchars( $talk ), + array(), + array(), + array( 'broken' ) + ); } $anchor = 'msg_' . htmlspecialchars( strtolower( $title ) ); diff --git a/includes/specials/SpecialWantedcategories.php b/includes/specials/SpecialWantedcategories.php index 4d54c86e37..5e5a4f17e9 100644 --- a/includes/specials/SpecialWantedcategories.php +++ b/includes/specials/SpecialWantedcategories.php @@ -41,11 +41,17 @@ class WantedCategoriesPage extends WantedQueryPage { global $wgLang, $wgContLang; $nt = Title::makeTitle( $result->namespace, $result->title ); - $text = $wgContLang->convert( $nt->getText() ); + $text = htmlspecialchars( $wgContLang->convert( $nt->getText() ) ); $plink = $this->isCached() ? - $skin->link( $nt, htmlspecialchars( $text ) ) : - $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) ); + $skin->link( $nt, $text ) : + $skin->link( + $nt, + $text, + array(), + array(), + array( 'broken' ) + ); $nlinks = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'), $wgLang->formatNum( $result->value ) ); diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 1d0b8f1133..885c81450b 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -441,21 +441,36 @@ function wfSpecialWatchlist( $par ) { function wlHoursLink( $h, $page, $options = array() ) { global $wgUser, $wgLang, $wgContLang; + $sk = $wgUser->getSkin(); - $s = $sk->makeKnownLink( - $wgContLang->specialPage( $page ), - $wgLang->formatNum( $h ), - wfArrayToCGI( array('days' => ($h / 24.0)), $options ) ); + $title = Title::newFromText( $wgContLang->specialPage( $page ) ); + $options['days'] = ($h / 24.0); + + $s = $sk->linkKnown( + $title, + $wgLang->formatNum( $h ), + array(), + $options + ); + return $s; } function wlDaysLink( $d, $page, $options = array() ) { global $wgUser, $wgLang, $wgContLang; + $sk = $wgUser->getSkin(); - $s = $sk->makeKnownLink( - $wgContLang->specialPage( $page ), - ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) ), - wfArrayToCGI( array('days' => $d), $options ) ); + $title = Title::newFromText( $wgContLang->specialPage( $page ) ); + $options['days'] = $d; + $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) ); + + $s = $sk->linkKnown( + $title, + $message, + array(), + $options + ); + return $s; } diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index bc4a4c535f..6db8cd26f8 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -135,16 +135,25 @@ class SkinCologneBlue extends Skin { $rt = $this->mTitle->getPrefixedURL(); if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) { - $q = ''; + $q = array(); } else { - $q = "returnto={$rt}"; + $q = array( 'returnto' => $rt ); } $s = array( $this->mainPageLink(), - $this->makeKnownLink( wfMsgForContent( 'aboutpage' ), wfMsg( 'about' ) ), - $this->makeKnownLink( wfMsgForContent( 'helppage' ), wfMsg( 'help' ) ), - $this->makeKnownLink( wfMsgForContent( 'faqpage' ), wfMsg( 'faq' ) ), + $this->linkKnown( + Title::newFromText( wfMsgForContent( 'aboutpage' ) ), + wfMsg( 'about' ) + ), + $this->linkKnown( + Title::newFromText( wfMsgForContent( 'helppage' ) ), + wfMsg( 'help' ) + ), + $this->linkKnown( + Title::newFromText( wfMsgForContent( 'faqpage' ) ), + wfMsg( 'faq' ) + ), $this->specialLink( 'specialpages' ) ); @@ -156,9 +165,19 @@ class SkinCologneBlue extends Skin { $s[] = $this->extensionTabLinks(); } if ( $wgUser->isLoggedIn() ) { - $s[] = $this->makeKnownLink( $lo, wfMsg( 'logout' ), $q ); + $s[] = $this->linkKnown( + $lo, + wfMsg( 'logout' ), + array(), + $q + ); } else { - $s[] = $this->makeKnownLink( $li, wfMsg( 'login' ), $q ); + $s[] = $this->LinkKnown( + $li, + wfMsg( 'login' ), + array(), + $q + ); } return $wgLang->pipeList( $s ); @@ -199,7 +218,10 @@ class SkinCologneBlue extends Skin { $s .= $this->menuHead( 'qbedit' ); $s .= '' . $this->editThisPage() . ''; - $s .= $sep . $this->makeKnownLink( wfMsgForContent( 'edithelppage' ), wfMsg( 'edithelp' ) ); + $s .= $sep . $this->linkKnown( + Title::newFromText( wfMsgForContent( 'edithelppage' ) ), + wfMsg( 'edithelp' ) + ); if( $wgUser->isLoggedIn() ) { $s .= $sep . $this->moveThisPage(); diff --git a/skins/Standard.php b/skins/Standard.php index 83a44d6e5f..fabc81ae68 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -160,8 +160,12 @@ class SkinStandard extends Skin { if( $wgUser->isLoggedIn() ) { $s.= $this->specialLink( 'watchlist' ) ; - $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ), - wfMsg( 'mycontris' ), 'target=' . wfUrlencode( $wgUser->getName() ) ); + $s .= $sep . $this->linkKnown( + Title::newFromText( $wgContLang->specialPage( 'Contributions' ) ), + wfMsg( 'mycontris' ), + array(), + array( 'target' => $wgUser->getName() ) + ); } // only show watchlist link if logged in $s .= "\n
"; @@ -215,7 +219,10 @@ class SkinStandard extends Skin { $link = $nstext . ':' . $link; } - $s .= $this->makeLink( $link, $text ); + $s .= $this->link( + Title::newFromText( $link ), + $text + ); } elseif( $this->mTitle->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 @@ -237,7 +244,7 @@ class SkinStandard extends Skin { ); #if( $tns%2 && $action!='edit' && !$wpPreview) { - #$s.= '
'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new'); + #$s.= '
'.$this->linkKnown( Title::newFromText( $wgTitle->getPrefixedText() ),wfMsg('postcomment'),array(),array('action'=>'edit','section'=>'new')); #} /* -- 2.20.1