X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHtml.php;h=ad0130bf8f0dfc28e0a791b4132330174c848a50;hb=69a9b1af2b00a15d5d9c75f43f3134595e54511e;hp=019e0785f9dbab8fc06bf51734b99a5e00a6fd15;hpb=70941efd35562dcb7003229b56c91a98a67de7a9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Html.php b/includes/Html.php index 019e0785f9..ad0130bf8f 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -391,8 +391,8 @@ class Html { unset( $attribs['type'] ); } if ( $element === 'input' ) { - $type = isset( $attribs['type'] ) ? $attribs['type'] : null; - $value = isset( $attribs['value'] ) ? $attribs['value'] : null; + $type = $attribs['type'] ?? null; + $value = $attribs['value'] ?? null; if ( $type === 'checkbox' || $type === 'radio' ) { // The default value for checkboxes and radio buttons is 'on' // not ''. By stripping value="" we break radio boxes that @@ -557,7 +557,7 @@ class Html { * literal "" or (for XML) literal "]]>". * * @param string $contents JavaScript - * @param string $nonce Nonce for CSP header, from OutputPage::getCSPNonce() + * @param string|null $nonce Nonce for CSP header, from OutputPage::getCSPNonce() * @return string Raw HTML */ public static function inlineScript( $contents, $nonce = null ) { @@ -565,7 +565,7 @@ class Html { if ( $nonce !== null ) { $attrs['nonce'] = $nonce; } else { - if ( ContentSecurityPolicy::isEnabled( RequestContext::getMain()->getConfig() ) ) { + if ( ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() ) ) { wfWarn( "no nonce set on script. CSP will break it" ); } } @@ -582,7 +582,7 @@ class Html { * "". * * @param string $url - * @param string $nonce Nonce for CSP header, from OutputPage::getCSPNonce() + * @param string|null $nonce Nonce for CSP header, from OutputPage::getCSPNonce() * @return string Raw HTML */ public static function linkedScript( $url, $nonce = null ) { @@ -590,7 +590,7 @@ class Html { if ( $nonce !== null ) { $attrs['nonce'] = $nonce; } else { - if ( ContentSecurityPolicy::isEnabled( RequestContext::getMain()->getConfig() ) ) { + if ( ContentSecurityPolicy::isNonceRequired( RequestContext::getMain()->getConfig() ) ) { wfWarn( "no nonce set on script. CSP will break it" ); } } @@ -925,9 +925,9 @@ class Html { if ( isset( $params['label'] ) ) { $ret .= self::element( 'label', [ - 'for' => isset( $selectAttribs['id'] ) ? $selectAttribs['id'] : null, + 'for' => $selectAttribs['id'] ?? null, ], $params['label'] - ) . ' '; + ) . "\u{00A0}"; } // Wrap options in a