Fixes to Special:LinkSearch form
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 13 Mar 2013 17:08:55 +0000 (18:08 +0100)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 13 Mar 2013 17:08:55 +0000 (18:08 +0100)
- Use Html class instead of Xml where possible
- Use Html class for <fieldset> generation, for consistency
- Add line breaks to the output for better readability
- Don't use $GLOBALS to access $wgScript

Change-Id: Ib11aa8ba3e3ef0e1ca07e0e3ac9605daa33f08a4

includes/specials/SpecialLinkSearch.php

index 4779af2..030416f 100644 (file)
@@ -42,7 +42,7 @@ class LinkSearchPage extends QueryPage {
        }
 
        function execute( $par ) {
-               global $wgUrlProtocols, $wgMiserMode;
+               global $wgUrlProtocols, $wgMiserMode, $wgScript;
 
                $this->setHeaders();
                $this->outputHeader();
@@ -88,11 +88,11 @@ class LinkSearchPage extends QueryPage {
                        '<nowiki>' . $this->getLanguage()->commaList( $protocols_list ) . '</nowiki>',
                        count( $protocols_list )
                );
-               $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
-                       Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
-                       '<fieldset>' .
-                       Xml::element( 'legend', array(), $this->msg( 'linksearch' )->text() ) .
-                       Xml::inputLabel( $this->msg( 'linksearch-pat' )->text(), 'target', 'target', 50, $target ) . ' ';
+               $s = Html::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $wgScript ) ) . "\n" .
+                       Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n" .
+                       Html::openElement( 'fieldset' ) . "\n" .
+                       Html::element( 'legend', array(), $this->msg( 'linksearch' )->text() ) . "\n" .
+                       Xml::inputLabel( $this->msg( 'linksearch-pat' )->text(), 'target', 'target', 50, $target ) . "\n";
                if ( !$wgMiserMode ) {
                        $s .= Html::namespaceSelector(
                                array(
@@ -106,9 +106,9 @@ class LinkSearchPage extends QueryPage {
                                )
                        );
                }
-               $s .= Xml::submitButton( $this->msg( 'linksearch-ok' )->text() ) .
-                       '</fieldset>' .
-                       Xml::closeElement( 'form' );
+               $s .= Xml::submitButton( $this->msg( 'linksearch-ok' )->text() ) . "\n" .
+                       Html::closeElement( 'fieldset' ) . "\n" .
+                       Html::closeElement( 'form' ) . "\n";
                $out->addHTML( $s );
 
                if( $target != '' ) {