X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=aa51243d75ebe1236f7356f479c8f705960f096a;hb=db331661b9fd60b1012a98d103078419d85dcb14;hp=1e597b659241cac5e93e49729ae0bd2c3efef2a0;hpb=c8f36c3754b675f9a730d4c0f6a6f9013a2967d2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index 1e597b6592..aa51243d75 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -213,7 +213,7 @@ class Html { // Silly XML. return substr( $start, 0, -1 ) . '/>'; } else { - return "$start$contents" . self::closeElement( $element ); + return $start . $contents . self::closeElement( $element ); } } @@ -574,10 +574,8 @@ class Html { $attrs = []; if ( $nonce !== null ) { $attrs['nonce'] = $nonce; - } else { - if ( ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() ) ) { - wfWarn( "no nonce set on script. CSP will break it" ); - } + } elseif ( ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() ) ) { + wfWarn( "no nonce set on script. CSP will break it" ); } if ( preg_match( '/<\/?script/i', $contents ) ) { @@ -600,10 +598,8 @@ class Html { $attrs = [ 'src' => $url ]; if ( $nonce !== null ) { $attrs['nonce'] = $nonce; - } else { - if ( ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() ) ) { - wfWarn( "no nonce set on script. CSP will break it" ); - } + } elseif ( ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() ) ) { + wfWarn( "no nonce set on script. CSP will break it" ); } return self::element( 'script', $attrs ); @@ -973,7 +969,7 @@ class Html { if ( $isXHTML ) { // XHTML5 // XML MIME-typed markup should have an xml header. // However a DOCTYPE is not needed. - $ret .= "\n"; + $ret .= "\n"; // Add the standard xmlns $attribs['xmlns'] = 'http://www.w3.org/1999/xhtml';