X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FWebInstaller.php;h=db26c0b63d0fe918eb2f904c09f96abf65d8f29f;hp=20018d0dfba1b9470c2668c8ea09679bcfff7079;hb=6cfb2e3d7a2b96d5041312fcec88248bb46573d7;hpb=c1cf26c04d4f4e2d179db3c0c361042ad14353c2 diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 20018d0dfb..db26c0b63d 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -145,11 +145,6 @@ class WebInstaller extends Installer { parent::__construct(); $this->output = new WebInstallerOutput( $this ); $this->request = $request; - - // Add parser hooks - $parser = MediaWikiServices::getInstance()->getParser(); - $parser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] ); - $parser->setHook( 'doclink', [ $this, 'docLink' ] ); } /** @@ -658,22 +653,23 @@ 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|HtmlArmor $text Wikitext to be parsed (from Message::plain) or raw HTML. * @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 = ( $text instanceof HtmlArmor ) ? + HtmlArmor::getHtml( $text ) : + $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 ); } /** @@ -1090,13 +1086,13 @@ class WebInstaller extends Installer { } /** - * Helper for Installer::docLink() + * Helper for WebInstallerOutput * + * @internal For use by WebInstallerOutput * @param string $page - * * @return string */ - protected function getDocUrl( $page ) { + public function getDocUrl( $page ) { $query = [ 'page' => $page ]; if ( in_array( $this->currentPageName, $this->pageSequence ) ) { @@ -1107,30 +1103,26 @@ class WebInstaller extends Installer { } /** - * Extension tag hook for a documentation link. + * Helper for sidebar links. * + * @internal For use in WebInstallerOutput class + * @param string $url * @param string $linkText - * @param string[] $attribs - * @param Parser $parser Unused - * - * @return string + * @return string HTML */ - public function docLink( $linkText, $attribs, $parser ) { - $url = $this->getDocUrl( $attribs['href'] ); - - return Html::element( 'a', [ 'href' => $url ], $linkText ); + public function makeLinkItem( $url, $linkText ) { + return Html::rawElement( 'li', [], + Html::element( 'a', [ 'href' => $url ], $linkText ) + ); } /** - * Helper for "Download LocalSettings" link on WebInstall_Complete - * - * @param string $text Unused - * @param string[] $attribs Unused - * @param Parser $parser Unused + * Helper for "Download LocalSettings" link. * + * @internal For use in WebInstallerComplete class * @return string Html for download link */ - public function downloadLinkHook( $text, $attribs, $parser ) { + public function makeDownloadLinkHtml() { $anchor = Html::rawElement( 'a', [ 'href' => $this->getUrl( [ 'localsettings' => 1 ] ) ], wfMessage( 'config-download-localsettings' )->parse()