forked from laysense/laysite
Address LaySite 1.4.5 editor and release review suggestions
This commit is contained in:
@@ -38,7 +38,9 @@ final class PageHead
|
||||
continue;
|
||||
}
|
||||
if ($tag === 'script') {
|
||||
$result['hasScript'] = true;
|
||||
if (strtolower($attributes['type'] ?? '') !== 'application/ld+json') {
|
||||
$result['hasScript'] = true;
|
||||
}
|
||||
if (!isset($attributes['src'])) {
|
||||
$result['inlineScript'] = true;
|
||||
$attributes['nonce'] = $nonce;
|
||||
@@ -83,8 +85,11 @@ final class PageHead
|
||||
|| ($node->nodeType === XML_TEXT_NODE && trim($node->textContent) === '')) {
|
||||
continue;
|
||||
}
|
||||
if (!$node instanceof DOMElement || !isset(self::ATTRIBUTES[$node->tagName]) || count($entries) >= 40) {
|
||||
throw new RuntimeException('Head 最多支持 40 个 meta、样式表、style 或 script 标签。');
|
||||
if (!$node instanceof DOMElement || !isset(self::ATTRIBUTES[$node->tagName])) {
|
||||
throw new RuntimeException('Head 仅支持 meta、样式表(link)、style 和 script 标签。');
|
||||
}
|
||||
if (count($entries) >= 40) {
|
||||
throw new RuntimeException('Head 最多允许 40 个标签。');
|
||||
}
|
||||
$tag = $node->tagName;
|
||||
$attributes = [];
|
||||
|
||||
Reference in New Issue
Block a user