X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=fdc348b852f13fb154a00e74f5b949de36228ed5;hb=cca344a717b9e41b0e32e4915295cd36dd18bf83;hp=0aea7eabc3fd6842133c193fb04dddaeb1b23626;hpb=b4999a404c5a8084ece8c2599c183d8bfa99ff7a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index 0aea7eabc3..fdc348b852 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 ); } } @@ -518,7 +518,7 @@ class Html { $newValue = []; foreach ( $value as $k => $v ) { if ( is_string( $v ) ) { - // String values should be normal `array( 'foo' )` + // String values should be normal `[ 'foo' ]` // Just append them if ( !isset( $value[$v] ) ) { // As a special case don't set 'foo' if a @@ -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'; @@ -983,7 +979,6 @@ class Html { $attribs["xmlns:$tag"] = $ns; } } else { // HTML5 - // DOCTYPE $ret .= "\n"; }