Revision: 51586
Author:   siebrand
Date:     2009-06-08 10:07:33 +0000 (Mon, 08 Jun 2009)

Log Message:
-----------
Replace a few remaining uses of deprecated makeKnownLinkObj() by link[Known]() 
in core. Only uses in core remaining are in includes/Linker.php (all related to 
deprecated methods) and includes/parser/Parser.php.

Linking this to r51559 for CodeReview as there is some discussion there, and 
these changes are very similar.

Modified Paths:
--------------
    trunk/phase3/includes/LogEventsList.php
    trunk/phase3/includes/specials/SpecialNewimages.php

Modified: trunk/phase3/includes/LogEventsList.php
===================================================================
--- trunk/phase3/includes/LogEventsList.php     2009-06-08 09:35:05 UTC (rev 
51585)
+++ trunk/phase3/includes/LogEventsList.php     2009-06-08 10:07:33 UTC (rev 
51586)
@@ -108,11 +108,22 @@
                $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";
                }

Modified: trunk/phase3/includes/specials/SpecialNewimages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialNewimages.php 2009-06-08 09:35:05 UTC 
(rev 51585)
+++ trunk/phase3/includes/specials/SpecialNewimages.php 2009-06-08 10:07:33 UTC 
(rev 51586)
@@ -65,13 +65,13 @@
        }
 
        $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 @@
 
        # 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 );
+       $query = array_merge(
+               array( 'from' => $now ),
+               $botpar,
+               $searchpar
+       );
 
-       $botLink = $sk->makeKnownLinkObj($titleObj, wfMsgHtml( 'showhidebots', 
-               ($hidebots ? wfMsgHtml('show') : 
wfMsgHtml('hide'))),'hidebots='.($hidebots ? '0' : '1').$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>';



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to