Skip to content

Commit

Permalink
Allow integrity hashes for CSS CDN resources
Browse files Browse the repository at this point in the history
Fixes #26168
  • Loading branch information
dregad committed Sep 22, 2019
1 parent 14cd147 commit b761164
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/html_api.php
Expand Up @@ -251,10 +251,15 @@ function html_css_link( $p_filename ) {
/**
* Prints a CSS link for CDN
* @param string $p_url fully qualified domain name to the js file name
* @param string $p_hash resource hash to perform subresource integrity check
* @return void
*/
function html_css_cdn_link( $p_url ) {
echo "\t", '<link rel="stylesheet" type="text/css" href="', $p_url, '" crossorigin="anonymous" />', "\n";
function html_css_cdn_link( $p_url, $p_hash = '' ) {
$t_integrity = '';
if( $p_hash !== '' ) {
$t_integrity = 'integrity="' . $p_hash . '" ';
}
echo "\t", '<link rel="stylesheet" type="text/css" href="', $p_url, '" ', $t_integrity, ' crossorigin="anonymous" />', "\n";
}

/**
Expand Down

0 comments on commit b761164

Please sign in to comment.