From b941fadd1a90bdfd8912904bd1fb016d80bbe4be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 25 Feb 2021 16:49:51 +0100 Subject: [PATCH] Add preload tags to the generated HTML --- .../files/lib/system/style/StyleHandler.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; } /** -- 2.20.1