-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script-js.php
34 lines (33 loc) · 863 Bytes
/
script-js.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
$files = $files ?? [];
foreach ($files as $dep) {
$options = [];
if (is_array($dep)) {
$options = $dep;
$dep = A::get($options, 'src');
if (array_key_exists('src', $options)) {
unset($options['src']);
}
}
if (empty($dep)) {
continue;
}
if (strpos($dep, '|') !== false) {
list($dep, $integrity) = explode('|', $dep);
$options = array_merge([
'integrity' => $integrity,
'crossorigin' => 'anonymous',
], $options);
}
if (isset($async) && $async) {
$options['async'] = true;
}
if (isset($defer) && $defer) {
$options['defer'] = true;
}
if (class_exists('\Bnomei\Fingerprint')) {
echo Bnomei\Fingerprint::js($dep, $options) . PHP_EOL;
} else {
echo js($dep, $options);
}
}