Merge "WebInstaller::docLink: Use Html::element to generate the link"
[lhc/web/wiklou.git] / includes / installer / WebInstaller.php
index 9d7e051..018754b 100644 (file)
@@ -717,7 +717,7 @@ class WebInstaller extends Installer {
         */
        public function showHelpBox( $msg /*, ... */ ) {
                $args = func_get_args();
-               $html = call_user_func_array( [ $this, 'getHelpBox' ], $args );
+               $html = $this->getHelpBox( ...$args );
                $this->output->addHTML( $html );
        }
 
@@ -742,7 +742,7 @@ class WebInstaller extends Installer {
        public function showStatusMessage( Status $status ) {
                $errors = array_merge( $status->getErrorsArray(), $status->getWarningsArray() );
                foreach ( $errors as $error ) {
-                       call_user_func_array( [ $this, 'showMessage' ], $error );
+                       $this->showMessage( ...$error );
                }
        }
 
@@ -915,6 +915,7 @@ class WebInstaller extends Installer {
         *    Parameters are:
         *      var:         The variable to be configured (required)
         *      label:       The message name for the label (required)
+        *      labelAttribs:Additional attributes for the label element (optional)
         *      attribs:     Additional attributes for the input element (optional)
         *      controlName: The name for the input element (optional)
         *      value:       The current value of the variable (optional)
@@ -937,6 +938,9 @@ class WebInstaller extends Installer {
                if ( !isset( $params['help'] ) ) {
                        $params['help'] = "";
                }
+               if ( !isset( $params['labelAttribs'] ) ) {
+                       $params['labelAttribs'] = [];
+               }
                if ( isset( $params['rawtext'] ) ) {
                        $labelText = $params['rawtext'];
                } else {
@@ -945,17 +949,19 @@ class WebInstaller extends Installer {
 
                return "<div class=\"config-input-check\">\n" .
                        $params['help'] .
-                       "<label>\n" .
-                       Xml::check(
-                               $params['controlName'],
-                               $params['value'],
-                               $params['attribs'] + [
-                                       'id' => $params['controlName'],
-                                       'tabindex' => $this->nextTabIndex(),
-                               ]
-                       ) .
-                       $labelText . "\n" .
-                       "</label>\n" .
+                       Html::rawElement(
+                               'label',
+                               $params['labelAttribs'],
+                               Xml::check(
+                                       $params['controlName'],
+                                       $params['value'],
+                                       $params['attribs'] + [
+                                               'id' => $params['controlName'],
+                                               'tabindex' => $this->nextTabIndex(),
+                                       ]
+                               ) .
+                               $labelText . "\n"
+                               ) .
                        "</div>\n";
        }
 
@@ -1115,13 +1121,13 @@ class WebInstaller extends Installer {
         * @return string
         */
        protected function getDocUrl( $page ) {
-               $url = "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
+               $query = [ 'page' => $page ];
 
                if ( in_array( $this->currentPageName, $this->pageSequence ) ) {
-                       $url .= '&lastPage=' . urlencode( $this->currentPageName );
+                       $query['lastPage'] = $this->currentPageName;
                }
 
-               return $url;
+               return $this->getUrl( $query );
        }
 
        /**
@@ -1136,9 +1142,7 @@ class WebInstaller extends Installer {
        public function docLink( $linkText, $attribs, $parser ) {
                $url = $this->getDocUrl( $attribs['href'] );
 
-               return '<a href="' . htmlspecialchars( $url ) . '">' .
-                       htmlspecialchars( $linkText ) .
-                       '</a>';
+               return Html::element( 'a', [ 'href' => $url ], $linkText );
        }
 
        /**