X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FWebInstaller.php;h=b09455e96343039ac229f07851e810954b57ed0a;hb=51e00a4f262efb0faf1aac1e547086f9df6eedb8;hp=2d12e62de8cc22b57e0fb0be7513a3de974da1ac;hpb=75f937543b8d3eaec8d3fe4f726c088ef028abab;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 2d12e62de8..b09455e963 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -124,6 +124,13 @@ class WebInstaller extends Installer { */ protected $tabIndex = 1; + /** + * Numeric index of the help box + * + * @var int + */ + protected $helpBoxId = 1; + /** * Name of the page we're on * @@ -374,13 +381,14 @@ class WebInstaller extends Installer { * Show an error message in a box. Parameters are like wfMessage(), or * alternatively, pass a Message object in. * @param string|Message $msg + * @param mixed ...$params */ - public function showError( $msg /*...*/ ) { + public function showError( $msg, ...$params ) { if ( !( $msg instanceof Message ) ) { - $args = func_get_args(); - array_shift( $args ); - $args = array_map( 'htmlspecialchars', $args ); - $msg = wfMessage( $msg, $args ); + $msg = wfMessage( + $msg, + array_map( 'htmlspecialchars', $params ) + ); } $text = $msg->useDatabase( false )->plain(); $this->output->addHTML( $this->getErrorBox( $text ) ); @@ -650,22 +658,21 @@ class WebInstaller extends Installer { } /** - * Get HTML for an info box with an icon. + * Get HTML for an information message box with an icon. * - * @param string $text Wikitext, get this with wfMessage()->plain() + * @param string $text Wikitext to be parsed (from Message::plain). * @param string|bool $icon Icon name, file in mw-config/images. Default: false * @param string|bool $class Additional class name to add to the wrapper div. Default: false. - * - * @return string + * @return string HTML */ public function getInfoBox( $text, $icon = false, $class = false ) { - $text = $this->parse( $text, true ); + $html = $this->parse( $text, true ); $icon = ( $icon == false ) ? 'images/info-32.png' : 'images/' . $icon; $alt = wfMessage( 'config-information' )->text(); - return Html::infoBox( $text, $icon, $alt, $class ); + return Html::infoBox( $html, $icon, $alt, $class ); } /** @@ -675,17 +682,17 @@ class WebInstaller extends Installer { * @param string $msg * @return string */ - public function getHelpBox( $msg /*, ... */ ) { - $args = func_get_args(); - array_shift( $args ); + public function getHelpBox( $msg, ...$args ) { $args = array_map( 'htmlspecialchars', $args ); $text = wfMessage( $msg, $args )->useDatabase( false )->plain(); $html = $this->parse( $text, true ); + $id = 'helpBox-' . $this->helpBoxId++; return "
\n" . - "" . + "\n" . + wfMessage( 'config-help' )->escaped() . "\n" . "
" . $html . "
\n" . "
\n"; } @@ -693,10 +700,10 @@ class WebInstaller extends Installer { /** * Output a help box. * @param string $msg Key for wfMessage() + * @param mixed ...$params */ - public function showHelpBox( $msg /*, ... */ ) { - $args = func_get_args(); - $html = $this->getHelpBox( ...$args ); + public function showHelpBox( $msg, ...$params ) { + $html = $this->getHelpBox( $msg, ...$params ); $this->output->addHTML( $html ); } @@ -705,12 +712,11 @@ class WebInstaller extends Installer { * Output looks like a list. * * @param string $msg + * @param mixed ...$params */ - public function showMessage( $msg /*, ... */ ) { - $args = func_get_args(); - array_shift( $args ); + public function showMessage( $msg, ...$params ) { $html = '
' . - $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) . + $this->parse( wfMessage( $msg, $params )->useDatabase( false )->plain() ) . "
\n"; $this->output->addHTML( $html ); }