Fixes to Special:BookSources form
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 10 Apr 2013 08:55:46 +0000 (10:55 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Wed, 10 Apr 2013 08:55:46 +0000 (10:55 +0200)
- Use Html class instead of Xml or raw strings where possible
- Add line breaks to the output for better readability

Change-Id: I6934c8124b3becdb0740883ab853b042098440e7

includes/specials/SpecialBooksources.php

index 0774c44..b3933c5 100644 (file)
@@ -116,13 +116,14 @@ class SpecialBookSources extends SpecialPage {
        private function makeForm() {
                global $wgScript;
 
-               $form = '<fieldset><legend>' . $this->msg( 'booksources-search-legend' )->escaped() . '</legend>';
-               $form .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
-               $form .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() );
+               $form = Html::openElement( 'fieldset' ) . "\n";
+               $form .= Html::element( 'legend', array(), $this->msg( 'booksources-search-legend' )->text() ) . "\n";
+               $form .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . "\n";
+               $form .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
                $form .= '<p>' . Xml::inputLabel( $this->msg( 'booksources-isbn' )->text(), 'isbn', 'isbn', 20, $this->isbn );
-               $form .= '&#160;' . Xml::submitButton( $this->msg( 'booksources-go' )->text() ) . '</p>';
-               $form .= Xml::closeElement( 'form' );
-               $form .= '</fieldset>';
+               $form .= '&#160;' . Xml::submitButton( $this->msg( 'booksources-go' )->text() ) . "</p>\n";
+               $form .= Html::closeElement( 'form' ) . "\n";
+               $form .= Html::closeElement( 'fieldset' ) . "\n";
                return $form;
        }
 
@@ -177,7 +178,8 @@ class SpecialBookSources extends SpecialPage {
         */
        private function makeListItem( $label, $url ) {
                $url = str_replace( '$1', $this->isbn, $url );
-               return '<li><a href="' . htmlspecialchars( $url ) . '" class="external">' . htmlspecialchars( $label ) . '</a></li>';
+               return Html::rawElement( 'li', array(),
+                       Html::element( 'a', array( 'href' => $url, 'class' => 'external' ), $label ) );
        }
 
        protected function getGroupName() {