Skip to content

Commit

Permalink
PlainRenderer: Add nonces
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Aug 16, 2024
1 parent 70e1b74 commit 38df142
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Renderer/PlainRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,18 @@ public function preRender(): string

switch ($type) {
case 'script':
$output .= '<script class="kint-plain-script">'.$contents.'</script>';
$output .= '<script class="kint-plain-script"';
if (null !== self::$js_nonce) {
$output .= ' nonce="'.\htmlspecialchars(self::$js_nonce).'"';
}
$output .= '>'.$contents.'</script>';
break;
case 'style':
$output .= '<style class="kint-plain-style">'.$contents.'</style>';
$output .= '<style class="kint-plain-style"';
if (null !== self::$css_nonce) {
$output .= ' nonce="'.\htmlspecialchars(self::$css_nonce).'"';
}
$output .= '>'.$contents.'</style>';
break;
default:
$output .= $contents;
Expand Down

0 comments on commit 38df142

Please sign in to comment.