From fbd17e0e38cbdc8e39d46dcab061484e70b1238a Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 22 Apr 2022 15:56:45 +0200 Subject: [PATCH] =?UTF-8?q?Pr=C3=A9chargement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/theme.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 3c2b5ba2..ff4f7065 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -1205,13 +1205,12 @@ class theme extends common { $fileContent = $gf ? '' . $fileContent : $fileContent; - // Enregistre la personnalisation - file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent); + /** * Fontes installées localement */ - $fileContent = ''; + $fileContentCss = ''; foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) { if ( ( $scope === 'user' && in_array($fontId, $fontsInstalled) ) @@ -1219,15 +1218,20 @@ class theme extends common { ) { if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) { // Chargement de la police - $fileContent .= '@font-face {' ; - $fileContent .= 'font-family:"' . $fontValue['font-family'] . '";'; - $fileContent .= 'src: local("' . $fontValue['name'] . '"), url("' . $fontValue['resource'] . '") format("woff");'; - $fileContent .= '}' ; + $fileContentCss .= '@font-face {' ; + $fileContentCss .= 'font-family:"' . $fontValue['font-family'] . '";'; + $fileContentCss .= 'src: local("' . $fontValue['name'] . '"), url("' . $fontValue['resource'] . '") format("woff");'; + $fileContentCss .= '}' ; + // Préchargement + $fileContent = '' . $fileContent; } } } + // Enregistre la personnalisation - file_put_contents(self::DATA_DIR.'fonts/fonts.css', $fileContent); + file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent); + // Enregistre la personnalisation + file_put_contents(self::DATA_DIR.'fonts/fonts.css', $fileContentCss); }