https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114311

Revision: 114311
Author:   ialex
Date:     2012-03-20 21:34:50 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
* Use local context to get messages
* Use Language::userTimeAndDate() instead of Language::timeanddate() to display 
the date with user preferences
* Set the form's action to $wgScript instead of direct link to the page since 
it makes a GET request (and the title would be displayed twice with pretty URLs 
since there's already a <input name="title" .../>

Modified Paths:
--------------
    trunk/phase3/includes/specials/SpecialMIMEsearch.php

Modified: trunk/phase3/includes/specials/SpecialMIMEsearch.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMIMEsearch.php        2012-03-20 
21:15:29 UTC (rev 114310)
+++ trunk/phase3/includes/specials/SpecialMIMEsearch.php        2012-03-20 
21:34:50 UTC (rev 114311)
@@ -59,17 +59,19 @@
        }
 
        function execute( $par ) {
+               global $wgScript;
+
                $mime = $par ? $par : $this->getRequest()->getText( 'mime' );
 
                $this->setHeaders();
                $this->outputHeader();
                $this->getOutput()->addHTML(
-                       Xml::openElement( 'form', array( 'id' => 
'specialmimesearch', 'method' => 'get', 'action' => SpecialPage::getTitleFor( 
'MIMEsearch' )->getLocalUrl() ) ) .
+                       Xml::openElement( 'form', array( 'id' => 
'specialmimesearch', 'method' => 'get', 'action' => $wgScript ) ) .
                        Xml::openElement( 'fieldset' ) .
-                       Html::hidden( 'title', SpecialPage::getTitleFor( 
'MIMEsearch' )->getPrefixedText() ) .
-                       Xml::element( 'legend', null, wfMsg( 'mimesearch' ) ) .
-                       Xml::inputLabel( wfMsg( 'mimetype' ), 'mime', 'mime', 
20, $mime ) . ' ' .
-                       Xml::submitButton( wfMsg( 'ilsubmit' ) ) .
+                       Html::hidden( 'title', 
$this->getTitle()->getPrefixedText() ) .
+                       Xml::element( 'legend', null, $this->msg( 'mimesearch' 
)->text() ) .
+                       Xml::inputLabel( $this->msg( 'mimetype' )->text(), 
'mime', 'mime', 20, $mime ) . ' ' .
+                       Xml::submitButton( $this->msg( 'ilsubmit' )->text() ) .
                        Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' )
                );
@@ -93,15 +95,13 @@
                        htmlspecialchars( $text )
                );
 
-               $download = Linker::makeMediaLinkObj( $nt, wfMsgHtml( 
'download' ) );
+               $download = Linker::makeMediaLinkObj( $nt, $this->msg( 
'download' )->escaped() );
                $lang = $this->getLanguage();
                $bytes = htmlspecialchars( $lang->formatSize( $result->img_size 
) );
-               $dimensions = htmlspecialchars( wfMsg( 'widthheight',
-                       $lang->formatNum( $result->img_width ),
-                       $lang->formatNum( $result->img_height )
-               ) );
+               $dimensions = $this->msg( 'widthheight' )->numParams( 
$result->img_width,
+                       $result->img_height )->escaped();
                $user = Linker::link( Title::makeTitle( NS_USER, 
$result->img_user_text ), htmlspecialchars( $result->img_user_text ) );
-               $time = htmlspecialchars( $lang->timeanddate( 
$result->img_timestamp ) );
+               $time = htmlspecialchars( $lang->userTimeAndDate( 
$result->img_timestamp, $this->getUser() ) );
 
                return "($download) $plink . . $dimensions . . $bytes . . $user 
. . $time";
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to