diff --git a/lib/private/Template/functions.php b/lib/private/Template/functions.php index 37df801c3c4..d9cf5f3f63a 100644 --- a/lib/private/Template/functions.php +++ b/lib/private/Template/functions.php @@ -6,20 +6,23 @@ * SPDX-License-Identifier: AGPL-3.0-only */ +use OC\Security\CSP\ContentSecurityPolicyNonceManager; +use OCP\Files\IMimeTypeDetector; use OCP\IDateTimeFormatter; +use OCP\IURLGenerator; +use OCP\Server; use OCP\Util; -function p($string) { - print(\OCP\Util::sanitizeHTML($string)); +function p(string $string): void { + print(Util::sanitizeHTML($string)); } - /** * Prints a tag for loading css * @param string $href the source URL, ignored when empty * @param string $opts, additional optional options */ -function emit_css_tag($href, $opts = '') { +function emit_css_tag($href, $opts = ''): void { $s = 'get(\OC\Security\CSP\ContentSecurityPolicyNonceManager::class); +function emit_script_tag(string $src, string $script_content = '', string $content_type = ''): void { + $nonceManager = Server::get(ContentSecurityPolicyNonceManager::class); $defer_str = ' defer'; $type = $content_type !== '' ? ' type="' . $content_type . '"' : ''; @@ -74,7 +77,7 @@ function emit_script_tag(string $src, string $script_content = '', string $conte * Print all