X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FCoreTagHooks.php;h=438603a84165bfdc94f92becef983d004f827130;hp=c943b7c98637b59c0ef9783e9211d4e848f8cd1e;hb=6c9a2923fe1ee3a65cb027be5e781772f2b12fbd;hpb=1e3c2e5904d628c001a8d65909b135ea9bf042aa diff --git a/includes/parser/CoreTagHooks.php b/includes/parser/CoreTagHooks.php index c943b7c986..438603a841 100644 --- a/includes/parser/CoreTagHooks.php +++ b/includes/parser/CoreTagHooks.php @@ -79,12 +79,25 @@ class CoreTagHooks { * @param array $attributes * @param Parser $parser * @throws MWException - * @return array + * @return array|string Output of tag hook */ public static function html( $content, $attributes, $parser ) { global $wgRawHtml; if ( $wgRawHtml ) { - return [ $content, 'markerType' => 'nowiki' ]; + if ( $parser->getOptions()->getAllowUnsafeRawHtml() ) { + return [ $content, 'markerType' => 'nowiki' ]; + } else { + // In a system message where raw html is + // not allowed (but it is allowed in other + // contexts). + return Html::rawElement( + 'span', + [ 'class' => 'error' ], + // Using ->text() not ->parse() as + // a paranoia measure against a loop. + wfMessage( 'rawhtml-notallowed' )->escaped() + ); + } } else { throw new MWException( ' extension tag encountered unexpectedly' ); }