Merge "Fix i18n message tog-watchlistunwatchlinks"
[lhc/web/wiklou.git] / includes / specials / SpecialPrefixindex.php
index 5e3e430..afd626b 100644 (file)
@@ -83,7 +83,7 @@ class SpecialPrefixindex extends SpecialAllPages {
                        $showme = $from;
                }
 
-               // Bug 27864: if transcluded, show all pages instead of the form.
+               // T29864: if transcluded, show all pages instead of the form.
                if ( $this->including() || $showme != '' || $ns !== null ) {
                        $this->showPrefixChunk( $namespace, $showme, $from );
                } else {
@@ -98,56 +98,36 @@ class SpecialPrefixindex extends SpecialAllPages {
         * @return string
         */
        protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) {
-               $out = Xml::openElement( 'div', [ 'class' => 'namespaceoptions' ] );
-               $out .= Xml::openElement(
-                       'form',
-                       [ 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ]
-               );
-               $out .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
-               $out .= Xml::openElement( 'fieldset' );
-               $out .= Xml::element( 'legend', null, $this->msg( 'allpages' )->text() );
-               $out .= Xml::openElement( 'table', [ 'id' => 'nsselect', 'class' => 'allpages' ] );
-               $out .= "<tr>
-                               <td class='mw-label'>" .
-                       Xml::label( $this->msg( 'allpagesprefix' )->text(), 'nsfrom' ) .
-                       "</td>
-                               <td class='mw-input'>" .
-                       Xml::input( 'prefix', 30, str_replace( '_', ' ', $from ), [ 'id' => 'nsfrom' ] ) .
-                       "</td>
-                       </tr>
-                       <tr>
-                       <td class='mw-label'>" .
-                       Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) .
-                       "</td>
-                               <td class='mw-input'>" .
-                       Html::namespaceSelector( [
-                               'selected' => $namespace,
-                       ], [
+               $fields = [
+                       'prefix' => [
+                               'label-message' => 'allpagesprefix',
+                               'type' => 'text',
+                               'size' => '30',
+                       ],
+                       'namespace' => [
+                               'type' => 'namespaceselect',
                                'name' => 'namespace',
                                'id' => 'namespace',
-                               'class' => 'namespaceselector',
-                       ] ) .
-                       Xml::checkLabel(
-                               $this->msg( 'allpages-hide-redirects' )->text(),
-                               'hideredirects',
-                               'hideredirects',
-                               $this->hideRedirects
-                       ) . ' ' .
-                       Xml::checkLabel(
-                               $this->msg( 'prefixindex-strip' )->text(),
-                               'stripprefix',
-                               'stripprefix',
-                               $this->stripPrefix
-                       ) . ' ' .
-                       Xml::submitButton( $this->msg( 'prefixindex-submit' )->text() ) .
-                       "</td>
-                       </tr>";
-               $out .= Xml::closeElement( 'table' );
-               $out .= Xml::closeElement( 'fieldset' );
-               $out .= Xml::closeElement( 'form' );
-               $out .= Xml::closeElement( 'div' );
-
-               return $out;
+                               'label-message' => 'namespace',
+                               'all' => null,
+                               'value' => $namespace,
+                       ],
+                       'hidedirects' => [
+                               'class' => 'HTMLCheckField',
+                               'label-message' => 'allpages-hide-redirects',
+                       ],
+                       'stripprefix' => [
+                               'class' => 'HTMLCheckField',
+                               'label-message' => 'prefixindex-strip',
+                       ],
+               ];
+               $form = new HTMLForm( $fields, $this->getContext() );
+               $form
+                       ->setMethod( 'get' )
+                       ->setWrapperLegendMsg( 'allpages' )
+                       ->setSubmitTextMsg( 'prefixindex-submit' )
+                       ->prepareForm()
+                       ->displayForm( false );
        }
 
        /**
@@ -228,9 +208,9 @@ class SpecialPrefixindex extends SpecialAllPages {
                                                $displayed = substr( $displayed, $prefixLength );
                                        }
                                        $link = ( $title->isRedirect() ? '<div class="allpagesredirect">' : '' ) .
-                                               Linker::linkKnown(
+                                               $this->getLinkRenderer()->makeKnownLink(
                                                        $title,
-                                                       htmlspecialchars( $displayed )
+                                                       $displayed
                                                ) .
                                                ( $title->isRedirect() ? '</div>' : '' );
 
@@ -275,9 +255,9 @@ class SpecialPrefixindex extends SpecialAllPages {
                                $query['namespace'] = $namespace;
                        }
 
-                       $nextLink = Linker::linkKnown(
+                       $nextLink = $this->getLinkRenderer()->makeKnownLink(
                                $this->getPageTitle(),
-                               $this->msg( 'nextpage', str_replace( '_', ' ', $nextRow->page_title ) )->escaped(),
+                               $this->msg( 'nextpage', str_replace( '_', ' ', $nextRow->page_title ) )->text(),
                                [],
                                $query
                        );