* Prettify
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Sat, 5 May 2007 20:18:13 +0000 (20:18 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Sat, 5 May 2007 20:18:13 +0000 (20:18 +0000)
* Rather throw an extension than split unuseful fatal error

includes/SpecialCategories.php
includes/SpecialMIMEsearch.php
includes/SpecialMostcategories.php

index 45e1ae6..7191fe9 100644 (file)
@@ -53,13 +53,11 @@ class CategoryPager extends AlphabeticPager {
        function formatRow($result) {
                global $wgLang;
                $title = Title::makeTitle( NS_CATEGORY, $result->cl_to );
-               return ( 
-                       '<li>' .
-                       $this->getSkin()->makeLinkObj( $title, $title->getText() )
-                       . ' ' .
+               return Xml::tags('li', null,
+                       $this->getSkin()->makeLinkObj( $title, $title->getText() ) . ' (' .
                        wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
-                               $wgLang->formatNum( $result->count ) )
-                       . "</li>\n" );
+                               $wgLang->formatNum( $result->count ) ) . ')'
+                       ) . "\n";
        }
 }
 
index d50efc0..5ecfb35 100644 (file)
@@ -87,33 +87,16 @@ function wfSpecialMIMEsearch( $par = null ) {
        $mime = isset( $par ) ? $par : $wgRequest->getText( 'mime' );
 
        $wgOut->addHTML(
-               wfElement( 'form',
+               Xml::openElement( 'form',
                        array(
                                'id' => 'specialmimesearch',
                                'method' => 'get',
                                'action' => $wgTitle->escapeLocalUrl()
-                       ),
-                       null
+                       )
                ) .
-                       wfOpenElement( 'label' ) .
-                               wfMsgHtml( 'mimetype' ) .
-                               wfElement( 'input', array(
-                                               'type' => 'text',
-                                               'size' => 20,
-                                               'name' => 'mime',
-                                               'value' => $mime
-                                       ),
-                                       ''
-                               ) .
-                               ' ' .
-                               wfElement( 'input', array(
-                                               'type' => 'submit',
-                                               'value' => wfMsg( 'ilsubmit' )
-                                       ),
-                                       ''
-                               ) .
-                       wfCloseElement( 'label' ) .
-               wfCloseElement( 'form' )
+                       Xml::inputLabel( wfMsg( 'mimetype' ), 'mime', 'mime', 20, $mime ) .
+                       Xml::submitButton( wfMsg( 'ilsubmit' ) ) .
+               Xml::closeElement( 'form' )
        );
 
        list( $major, $minor ) = wfSpecialMIMEsearchParse( $mime );
index df2b9ad..9a06f41 100644 (file)
@@ -38,6 +38,7 @@ class MostcategoriesPage extends QueryPage {
        function formatResult( $skin, $result ) {
                global $wgLang;
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
+               if ( !$title instanceof Title ) { throw new MWException('Invalid title in database'); }
                $count = wfMsgExt( 'ncategories', array( 'parsemag', 'escape' ), $wgLang->formatNum( $result->value ) );
                $link = $skin->makeKnownLinkObj( $title, $title->getText() );
                return wfSpecialList( $link, $count );