X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=0aea7eabc3fd6842133c193fb04dddaeb1b23626;hb=5d2e39401d0bab43c0582ef893850372cc72c1f7;hp=dba4c67a72a00e5753c7adf6e6af4b2ea5d1a69d;hpb=6704cbe78f5817baff78308ad27145002d40ccec;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index dba4c67a72..0aea7eabc3 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -255,6 +255,12 @@ class Html { // consistency and better compression. $element = strtolower( $element ); + // Some people were abusing this by passing things like + // 'h1 id="foo" to $element, which we don't want. + if ( strpos( $element, ' ' ) !== false ) { + wfWarn( __METHOD__ . " given element name with space '$element'" ); + } + // Remove invalid input types if ( $element == 'input' ) { $validTypes = [ @@ -552,10 +558,13 @@ class Html { } /** - * Output a "" or (for XML) literal "]]>". + * It is unsupported for the contents to contain the sequence `text(); } - // Add all namespaces as options (in the content language) - $options += - MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces(); + if ( $params['in-user-lang'] ?? false ) { + global $wgLang; + $lang = $wgLang; + } else { + $lang = MediaWikiServices::getInstance()->getContentLanguage(); + } + // Add all namespaces as options + $options += $lang->getFormattedNamespaces(); $optionsOut = []; // Filter out namespaces below 0 and massage labels @@ -851,8 +866,7 @@ class Html { // main we don't use "" but the user message describing it (e.g. "(Main)" or "(Article)") $nsName = wfMessage( 'blanknamespace' )->text(); } elseif ( is_int( $nsId ) ) { - $nsName = MediaWikiServices::getInstance()->getContentLanguage()-> - convertNamespace( $nsId ); + $nsName = $lang->convertNamespace( $nsId ); } $optionsOut[$nsId] = $nsName; }