|
|
@ -315,12 +315,12 @@ class Helper
|
|
|
|
PATH . 'tpl' . DIRECTORY_SEPARATOR . $file
|
|
|
|
PATH . 'tpl' . DIRECTORY_SEPARATOR . $file
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$content = preg_replace_callback(
|
|
|
|
$content = preg_replace_callback(
|
|
|
|
'#<script type="text/javascript" src="js/([a-z0-9.-]+.js)([^"]*)"( integrity="[^"]+" crossorigin="[^"]+")?></script>#',
|
|
|
|
'#<script ([^>]+) src="js/([a-z0-9.-]+.js)([^"]*)"( integrity="[^"]+" crossorigin="[^"]+")?></script>#',
|
|
|
|
function ($matches) {
|
|
|
|
function ($matches) {
|
|
|
|
if (array_key_exists($matches[1], Helper::$hashes)) {
|
|
|
|
if (array_key_exists($matches[2], Helper::$hashes)) {
|
|
|
|
return '<script type="text/javascript" src="js/' .
|
|
|
|
return '<script ' . $matches[1] . ' src="js/' .
|
|
|
|
$matches[1] . $matches[2] .
|
|
|
|
$matches[2] . $matches[3] .
|
|
|
|
'" integrity="sha512-' . Helper::$hashes[$matches[1]] .
|
|
|
|
'" integrity="sha512-' . Helper::$hashes[$matches[2]] .
|
|
|
|
'" crossorigin="anonymous"></script>';
|
|
|
|
'" crossorigin="anonymous"></script>';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return $matches[0];
|
|
|
|
return $matches[0];
|
|
|
|