Replace a few remaining uses of deprecated makeKnownLinkObj() by link[Known]() in...
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Mon, 8 Jun 2009 10:07:33 +0000 (10:07 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Mon, 8 Jun 2009 10:07:33 +0000 (10:07 +0000)
Linking this to r51559 for CodeReview as there is some discussion there, and these changes are very similar.

includes/LogEventsList.php
includes/specials/SpecialNewimages.php

index 3739304..922d524 100644 (file)
@@ -108,11 +108,22 @@ class LogEventsList {
                $links = array();
                $hiddens = ''; // keep track for "go" button
                foreach( $filter as $type => $val ) {
+                       // Should the below assignment be outside the foreach?
+                       // Then it would have to be copied. Not certain what is more expensive.
+                       $query = $this->getDefaultQuery();
+                       $queryKey = "hide_{$type}_log";
+                       $query[$queryKey] = $hideVal;
+
                        $hideVal = 1 - intval($val);
-                       // FIXME: use link() here. Needs changes in getDefaultQuery()
-                       $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal],
-                               wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() )
+
+                       $link = $this->skin->link(
+                               $wgTitle,
+                               $messages[$hideVal],
+                               array(),
+                               $query,
+                               array( 'known', 'noclasses' )
                        );
+
                        $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link );
                        $hiddens .= Xml::hidden( "hide_{$type}_log", $val ) . "\n";
                }
index 511cc3a..a874773 100644 (file)
@@ -65,13 +65,13 @@ function wfSpecialNewimages( $par, $specialPage ) {
        }
 
        $where = array();
-       $searchpar = '';
+       $searchpar = array();
        if ( $wpIlMatch != '' && !$wgMiserMode) {
                $nt = Title::newFromUrl( $wpIlMatch );
                if( $nt ) {
                        $m = $dbr->escapeLike( strtolower( $nt->getDBkey() ) );
                        $where[] = "LOWER(img_name) LIKE '%{$m}%'";
-                       $searchpar = '&wpIlMatch=' . urlencode( $wpIlMatch );
+                       $searchpar['wpIlMatch'] = $wpIlMatch;
                }
        }
 
@@ -163,29 +163,75 @@ function wfSpecialNewimages( $par, $specialPage ) {
 
        # If we change bot visibility, this needs to be carried along.
        if( !$hidebots ) {
-               $botpar = '&hidebots=0';
+               $botpar = array( 'hidebots' => 0 );
        } else {
-               $botpar = '';
+               $botpar = array();
        }
        $now = wfTimestampNow();
        $d = $wgLang->date( $now, true );
        $t = $wgLang->time( $now, true );
-       $dateLink = $sk->makeKnownLinkObj( $titleObj, htmlspecialchars( wfMsg( 'sp-newimages-showfrom', $d, $t ) ), 
-               'from='.$now.$botpar.$searchpar );
-
-       $botLink = $sk->makeKnownLinkObj($titleObj, wfMsgHtml( 'showhidebots', 
-               ($hidebots ? wfMsgHtml('show') : wfMsgHtml('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar);
-
+       $query = array_merge(
+               array( 'from' => $now ),
+               $botpar,
+               $searchpar
+       );
+
+       $dateLink = $sk->linkKnown(
+               $titleObj,
+               htmlspecialchars( wfMsg( 'sp-newimages-showfrom', $d, $t ) ),
+               array(),
+               $query
+       );
+
+       $query = array_merge(
+               array( 'hidebots' => ( $hidebots ? 0 : 1 ) ),
+               $searchpar
+       );
+
+       $message = wfMsgHtml(
+               'showhidebots',
+               ( $hidebots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' ) )
+       );
+
+       $botLink = $sk->linkKnown(
+               $titleObj,
+               $message,
+               array(),
+               $query
+       );
 
        $opts = array( 'parsemag', 'escapenoentities' );
        $prevLink = wfMsgExt( 'pager-newer-n', $opts, $wgLang->formatNum( $limit ) );
        if( $firstTimestamp && $firstTimestamp != $latestTimestamp ) {
-               $prevLink = $sk->makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar );
+               $query = array_merge(
+                       array( 'from' => $firstTimestamp ),
+                       $botpar,
+                       $searchpar
+               );
+
+               $prevLink = $sk->linkKnown(
+                       $titleObj,
+                       $prevLink,
+                       array(),
+                       $query
+               );
        }
 
        $nextLink = wfMsgExt( 'pager-older-n', $opts, $wgLang->formatNum( $limit ) );
        if( $shownImages > $limit && $lastTimestamp ) {
-               $nextLink = $sk->makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar );
+               $query = array_merge(
+                       array( 'until' => $lastTimestamp ),
+                       $botpar,
+                       $searchpar
+               );
+
+               $nextLink = $sk->linkKnown(
+                       $titleObj,
+                       $nextLink,
+                       array(),
+                       $query
+               );
+
        }
 
        $prevnext = '<p>' . $botLink . ' '. wfMsgHtml( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'</p>';