* replace deprecated makeBrokenLinkObj() by LinkHolderArray.php()
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 13 Jun 2009 12:39:00 +0000 (12:39 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 13 Jun 2009 12:39:00 +0000 (12:39 +0000)
* replace deprecated makeKnownLink() by linkKnown()
* add FIXME where I was not able to.

Linking to r51559 for code review

includes/QueryPage.php
includes/parser/LinkHolderArray.php
includes/specials/SpecialAllmessages.php
includes/specials/SpecialWantedcategories.php
includes/specials/SpecialWatchlist.php
skins/CologneBlue.php
skins/Standard.php

index af96746..86a988e 100644 (file)
@@ -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()
                                        ? '<s>' . $skin->link( $title ) . '</s>'
-                                       : $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 {
index e760ee0..4f382a4 100644 (file)
@@ -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 );
index cfbe158..f81e49a 100644 (file)
@@ -187,20 +187,33 @@ function wfAllMessagesMakeHTMLText( &$messages ) {
                $message = htmlspecialchars( $m['statmsg'] );
                $mw = htmlspecialchars( $m['msg'] );
 
+               $linkText = "<span id=\"sp-allmessages-i-$i\">" . htmlspecialchars( $key ) . '</span>';
+
                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,
-                               "<span id=\"sp-allmessages-i-$i\">" . htmlspecialchars( $key ) . '</span>'
+                               $linkText
                        );
                } else {
-                       $pageLink = $sk->makeBrokenLinkObj( $titleObj, "<span id=\"sp-allmessages-i-$i\">" . 
-                               htmlspecialchars( $key ) . '</span>' );
+                       $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 ) );
index 4d54c86..5e5a4f1 100644 (file)
@@ -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 ) );
index 1d0b8f1..885c814 100644 (file)
@@ -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;
 }
 
index bc4a4c5..6db8cd2 100644 (file)
@@ -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 .= '<strong>' . $this->editThisPage() . '</strong>';
 
-                       $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();
index 83a44d6..fabc81a 100644 (file)
@@ -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<hr class='sep' />";
@@ -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.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit&section=new');
+                               #$s.= '<br />'.$this->linkKnown( Title::newFromText( $wgTitle->getPrefixedText() ),wfMsg('postcomment'),array(),array('action'=>'edit','section'=>'new'));
                        #}
 
                        /*