X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=c4b57af9788e68b487f6791b43114823d93b5ae9;hb=e27d974043e8c03c49148db0456c4933f720d7ba;hp=fdc348b852f13fb154a00e74f5b949de36228ed5;hpb=20d290b883bc79c975a852670a6ed10d8406896e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index fdc348b852..c4b57af978 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -154,8 +154,7 @@ class Html { * Returns an HTML link element in a string styled as a button * (when $wgUseMediaWikiUIEverywhere is enabled). * - * @param string $contents The raw HTML contents of the element: *not* - * escaped! + * @param string $text The text of the element. Will be escaped (not raw HTML) * @param array $attrs Associative array of attributes, e.g., [ * 'href' => 'https://www.mediawiki.org/' ]. See expandAttributes() for * further documentation. @@ -163,10 +162,10 @@ class Html { * @see https://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers * @return string Raw HTML */ - public static function linkButton( $contents, array $attrs, array $modifiers = [] ) { + public static function linkButton( $text, array $attrs, array $modifiers = [] ) { return self::element( 'a', self::buttonAttributes( $attrs, $modifiers ), - $contents + $text ); } @@ -831,27 +830,25 @@ class Html { * @return array */ public static function namespaceSelectorOptions( array $params = [] ) { - $options = []; - if ( !isset( $params['exclude'] ) || !is_array( $params['exclude'] ) ) { $params['exclude'] = []; } - if ( isset( $params['all'] ) ) { - // add an option that would let the user select all namespaces. - // Value is provided by user, the name shown is localized for the user. - $options[$params['all']] = wfMessage( 'namespacesall' )->text(); - } if ( $params['in-user-lang'] ?? false ) { global $wgLang; $lang = $wgLang; } else { $lang = MediaWikiServices::getInstance()->getContentLanguage(); } - // Add all namespaces as options - $options += $lang->getFormattedNamespaces(); $optionsOut = []; + if ( isset( $params['all'] ) ) { + // add an option that would let the user select all namespaces. + // Value is provided by user, the name shown is localized for the user. + $optionsOut[$params['all']] = wfMessage( 'namespacesall' )->text(); + } + // Add all namespaces as options + $options = $lang->getFormattedNamespaces(); // Filter out namespaces below 0 and massage labels foreach ( $options as $nsId => $nsName ) { if ( $nsId < NS_MAIN || in_array( $nsId, $params['exclude'] ) ) { @@ -1006,16 +1003,16 @@ class Html { } /** - * 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() + * @internal For use by the WebInstaller class. + * @param string $rawHtml HTML * @param string $icon Path to icon file (used as 'src' attribute) * @param string $alt Alternate text for the icon * @param string $class Additional class name to add to the wrapper div - * - * @return string + * @return string HTML */ - static function infoBox( $text, $icon, $alt, $class = '' ) { + public static function infoBox( $rawHtml, $icon, $alt, $class = '' ) { $s = self::openElement( 'div', [ 'class' => "mw-infobox $class" ] ); $s .= self::openElement( 'div', [ 'class' => 'mw-infobox-left' ] ) . @@ -1028,7 +1025,7 @@ class Html { self::closeElement( 'div' ); $s .= self::openElement( 'div', [ 'class' => 'mw-infobox-right' ] ) . - $text . + $rawHtml . self::closeElement( 'div' ); $s .= self::element( 'div', [ 'style' => 'clear: left;' ], ' ' );