From af49819e3777ee1a64ee722bbacef889ad2d790e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Mon, 20 Jun 2022 15:01:12 +0200 Subject: [PATCH] =?UTF-8?q?11505=20bug=20cat=C3=A9gorie=20de=20fonte=20vid?= =?UTF-8?q?e=20+=20warning=20sur=20variable=20non=20initialis=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/theme.php | 67 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 7869e9c2..61bc1ba3 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -430,6 +430,7 @@ class theme extends common { /** * Stocker les images incluses dans la bannière perso dans un tableau */ + $files = []; preg_match_all('/]+>/i',$featureContent, $results); foreach($results[0] as $value) { // Lire le contenu XML @@ -460,7 +461,7 @@ class theme extends common { 'tinyHidden' => $this->getInput('themeHeaderTinyHidden', helper::FILTER_BOOLEAN), 'feature' => $this->getInput('themeHeaderFeature'), 'featureContent' => $featureContent, - 'featureFiles' => $files + 'featureFiles' => $files ]]); // Modification de la position du menu selon la position de la bannière if ( $this->getData(['theme','header','position']) == 'site' ) @@ -1188,21 +1189,20 @@ class theme extends common { */ $gf = false; $fileContent = ''; - //if ( is_array($this->getData(['fonts', 'imported'])) && - // !empty($this->getData(['fonts', 'imported'])) ) { - foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) { - if ( - ( $scope === 'user' && in_array($fontId, $fontsInstalled) ) - || $scope === 'all' - ) { - //Pré chargement à revoir - //$fileContent .= ''; - $fileContent .= ''; - // Pré connect pour api.google - $gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true; - } + if ( !empty($this->getData(['fonts', 'imported'])) ) { + foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) { + if ( + ( $scope === 'user' && in_array($fontId, $fontsInstalled) ) + || $scope === 'all' + ) { + //Pré chargement à revoir + //$fileContent .= ''; + $fileContent .= ''; + // Pré connect pour api.google + $gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true; + } } - //} + } // Ajoute le préconnect des fontes Googles. $fileContent = $gf ? '' . $fileContent @@ -1214,27 +1214,26 @@ class theme extends common { * Fontes installées localement */ $fileContentCss = ''; - //if ( is_array($this->getData(['fonts', 'files'])) && - // !empty($this->getData(['fonts', 'files'])) ) { - foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) { - if ( + if ( !empty($this->getData(['fonts', 'files'])) ) { + foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) { + if ( ( $scope === 'user' && in_array($fontId, $fontsInstalled) ) - || $scope === 'all' - ) { - if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) { - // Extension - $path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']); - // Chargement de la police - $fileContentCss .= '@font-face {' ; - $fileContentCss .= 'font-family:"' . $fontValue['name'] . '";'; - $fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");'; - $fileContentCss .= '}' ; - // Préchargement - //$fileContent = '' . $fileContent; - } + || $scope === 'all' + ) { + if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) { + // Extension + $path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']); + // Chargement de la police + $fileContentCss .= '@font-face {' ; + $fileContentCss .= 'font-family:"' . $fontValue['name'] . '";'; + $fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");'; + $fileContentCss .= '}' ; + // Préchargement + //$fileContent = '' . $fileContent; + } + } } - } - //} + } // Enregistre la personnalisation file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent);