0, 'normal' => 1, 'late' => 2]; $pa = $order[$a['priority'] ?? 'normal'] ?? 1; $pb = $order[$b['priority'] ?? 'normal'] ?? 1; return $pa <=> $pb; }); foreach ($styles as $s) { $href = $s['href'] ?? ''; $version = $s['version'] ?? null; if ($href === '') { continue; } // Cache-Buster nur, wenn Version explizit gesetzt und nicht leer if ($version !== null && $version !== '') { $separator = (strpos($href, '?') === false) ? '?' : '&'; $href .= $separator . 'v=' . rawurlencode($version); } echo '' . "\n"; } } // ------------------------------------------------------- // Scripts im Header aus der zentralen Registry // ------------------------------------------------------- $headerScripts = $GLOBALS['page_header_scripts'] ?? []; foreach ($headerScripts as $script) { $src = $script['src'] ?? ''; $version = $script['version'] ?? null; if ($src === '') { continue; } if ($version !== null && $version !== '') { $src .= (str_contains($src, '?') ? '&' : '?') . 'v=' . urlencode($version); } $attr = ''; if (!empty($script['async'])) { $attr .= ' async'; } elseif (!empty($script['defer'])) { $attr .= ' defer'; } if (!empty($script['type'])) { $attr .= ' type="' . htmlspecialchars($script['type']) . '"'; } echo '' . PHP_EOL; } ?>