From: Tim Düsterhus Date: Thu, 25 Feb 2021 15:49:51 +0000 (+0100) Subject: Add preload tags to the generated HTML X-Git-Tag: 5.4.0_Alpha_1~222^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b941fadd1a90bdfd8912904bd1fb016d80bbe4be;p=GitHub%2FWoltLab%2FWCF.git Add preload tags to the generated HTML --- diff --git a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php index 58d0acb07e..19fe7bef75 100644 --- a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php @@ -139,6 +139,8 @@ class StyleHandler extends SingletonFactory */ public function getStylesheet($isACP = false) { + $preload = ''; + if ($isACP) { // ACP $filename = 'acp/style/style' . (WCF::getLanguage()->get('wcf.global.pageDirection') == 'rtl' ? '-rtl' : '') . '.css'; @@ -151,9 +153,16 @@ class StyleHandler extends SingletonFactory if (!\file_exists(WCF_DIR . $filename)) { StyleCompiler::getInstance()->compile($this->getStyle()->getDecoratedObject()); } + + if (\is_readable(WCF_DIR . 'style/style-' . $this->getStyle()->styleID . '-preload.json')) { + $decoded = JSON::decode(\file_get_contents(WCF_DIR . 'style/style-' . $this->getStyle()->styleID . '-preload.json')); + if (isset($decoded['html']) && \is_array($decoded['html'])) { + $preload = \implode('', $decoded['html']); + } + } } - return ''; + return '' . $preload; } /**