diff --git a/CHANGES.md b/CHANGES.md index 7baace06..c427ac94 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,14 @@ - Module blog : taille recommandée de l'image erronée lorsque la largeur de l'écran est réglée sur fluide (100%). - Gestion des pages : positionnement dans le menu accessoire ou dans le menu standard. +## Version 11.3.06 +### Corrections : + - Bug d'affichage des blocs de présentation. + - Double déclaration d'une fonte locale. +### Améliorations : + - Sauvegarde des fontes avec le thème. + - Une fonte Websafe remplace une fonte locale dont le fichier n'est pas disponible. + ## Version 11.3.05 ### Correction : - Dossier du fichier de fontes non créé empêchant la création du fichier des appels de fontes. diff --git a/core/core.php b/core/core.php index 1fbc621a..5c0c63df 100644 --- a/core/core.php +++ b/core/core.php @@ -406,7 +406,7 @@ class common { /** * Construit la liste des fontes dans un tableau * @return array @fonts - * + * */ public function getFonts() { @@ -2342,16 +2342,19 @@ class core extends common { */ foreach ($fonts as $fontId) { // Validité du tableau : - if ( isset($fontsAvailable['files'][$fontId]) && - file_exists(self::DATA_DIR . 'fonts/' . $f) ) { + if ( isset($fontsAvailable['files'][$fontId]) ) { + if (file_exists(self::DATA_DIR . 'fonts/' . $fontId) ) { // Chargement de la police //$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName); $css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";'; $css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' .$fontsAvailable['files'][$fontId]['resource'] . '");}'; // Tableau pour la construction de la feuille de style $fonts [$fontId] = $fontsAvailable['files'][$fontId]['font-family']; + } else { + // Le fichier de font n'est pas disponible, fonte par défaut + $fonts [$fontId] = 'verdana'; + } } - } // Fond du body @@ -2583,16 +2586,19 @@ class core extends common { */ foreach ($fonts as $fontId) { // Validité du tableau : - if ( isset($fontsAvailable['files'][$fontId]) && - file_exists(self::DATA_DIR . 'fonts/' . $f) ) { + if ( isset($fontsAvailable['files'][$fontId]) ) { + if (file_exists(self::DATA_DIR . 'fonts/' . $fontId) ) { // Chargement de la police //$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName); $css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";'; $css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' .$fontsAvailable['files'][$fontId]['resource'] . '");}'; // Tableau pour la construction de la feuille de style $fonts [$fontId] = $fontsAvailable['files'][$fontId]['font-family']; + } else { + // Le fichier de font n'est pas disponible, fonte par défaut + $fonts [$fontId] = 'verdana'; + } } - } // Thème Administration diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 1b01cc54..b277259b 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -859,6 +859,21 @@ if ($this->getData(['core', 'dataVersion']) < 11303) { $this->setData(['core', 'dataVersion', 11303]); } + + // Version 11.3.06 +if ($this->getData(['core', 'dataVersion']) < 11306) { + + // Supprime les fontes déclarées en double par la version précédentes + $files = $this->getData(['fonts', 'files']); + foreach ($files as $fontId => $fontFile) { + if ( !is_null($this->getData(['fonts', 'imported', $fontId])) ) { + $this->deleteData(['fonts', 'imported', $fontId]); + } + } + // Mise à jour + $this->setData(['core', 'dataVersion', 11306]); +} + // Version 11.4.00 if ($this->getData(['core', 'dataVersion']) < 11400) { @@ -987,4 +1002,4 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { // Mise à jour $this->setData(['core', 'dataVersion', 11400]); -} +} \ No newline at end of file diff --git a/core/module/config/view/connect/connect.php b/core/module/config/view/connect/connect.php index 8e7f44b0..e7cc9c5d 100644 --- a/core/module/config/view/connect/connect.php +++ b/core/module/config/view/connect/connect.php @@ -123,4 +123,4 @@ - + \ No newline at end of file diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 08925890..7a65d026 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -283,7 +283,7 @@ class init extends common { 'menu' => [ 'backgroundColor' => 'rgba(32, 59, 82, 1)', 'backgroundColorSub' => 'rgba(32, 59, 82, 1)', - 'font' => 'georgia', + 'font' => 'arial', 'fontSize' => '1em', 'fontWeight' => 'normal', 'height' => '15px 10px', diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index d47f7fe3..437b0a5a 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -621,37 +621,31 @@ class theme extends common { if ($this->isPost()) { // Type d'import en ligne ou local $type = $this->getInput('fontAddFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; - $ressource = $type === 'imported' ? $this->getInput('fontAddUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontAddFile', helper::FILTER__SHORT_STRING); + $typeFlip = $type === 'files' ? 'imported' : 'files'; + $ressource = $type === 'imported' ? $this->getInput('fontAddUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontAddFile', helper::FILTER_STRING_SHORT); $fontId = $this->getInput('fontAddFontId', helper::FILTER_STRING_SHORT, true); $fontName = $this->getInput('fontAddFontName', helper::FILTER_STRING_SHORT, true); $fontFamilyName = $this->getInput('fontAddFontFamilyName', helper::FILTER_STRING_SHORT, true); - // Vérifier l'existence de fontId et validité de family name si usage en ligne de cdnFonts + // Supprime la fonte si elle existe dans le type inverse + if (is_array($this->getData(['fonts', $typeFlip, $fontId])) ) { + $this->deleteData(['fonts', $typeFlip, $fontId ]); + } + // Stocker la fonte + $this->setData(['fonts', + $type, + $fontId, [ + 'name' => $fontName, + 'font-family' => $fontFamilyName, + 'resource' => $ressource + ]]); - // Charger les données des fontes - $fonts = $this->getData(['fonts']); - - // Concaténation dans les tableaux existants - $t = [ $fontId => [ - 'name' => $fontName, - 'font-family' => $fontFamilyName, - 'resource' => $ressource - ]]; - - // Stocker les fontes - $this->setData(['fonts', $type, [ $fontId => - [ - 'name' => $fontName, - 'font-family' => $fontFamilyName, - 'resource' => $ressource - ]] - ]); // Copier la fonte si le nom du fichier est fourni if ( $type === 'files' && - is_file(self::FILE_DIR . 'source/' . $ressource) + file_exists(self::FILE_DIR . 'source/' . $ressource) ) { - copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource ); + copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . $ressource ); } // Valeurs en sortie @@ -677,37 +671,29 @@ class theme extends common { if ($this->isPost()) { // Type d'import en ligne ou local $type = $this->getInput('fontEditFontImported', helper::FILTER_BOOLEAN) ? 'imported' : 'files'; - $ressource = $type === 'imported' ? $this->getInput('fontEditUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontEditFile', helper::FILTER__SHORT_STRING); + $typeFlip = $type === 'files' ? 'imported' : 'files'; + $ressource = $type === 'imported' ? $this->getInput('fontEditUrl', helper::FILTER_STRING_SHORT) : $this->getInput('fontEditFile', helper::FILTER_STRING_SHORT); $fontId = $this->getInput('fontEditFontId', helper::FILTER_STRING_SHORT, true); $fontName = $this->getInput('fontEditFontName', helper::FILTER_STRING_SHORT, true); $fontFamilyName = $this->getInput('fontEditFontFamilyName', helper::FILTER_STRING_SHORT, true); - // Vérifier l'existence de fontId et validité de family name si usage en ligne de cdnFonts - - // Charger les données des fontes - $fonts = $this->getData(['fonts']); - - // Concaténation dans les tableaux existants - $t = [ $fontId => [ - 'name' => $fontName, - 'font-family' => $fontFamilyName, - 'resource' => $ressource - ]]; - + // Supprime la fonte si elle existe dans le type inverse + if (is_array($this->getData(['fonts', $typeFlip, $fontId])) ) { + $this->deleteData(['fonts', $typeFlip, $fontId ]); + } // Stocker les fontes - $this->setData(['fonts', $type, [ $fontId => - [ - 'name' => $fontName, - 'font-family' => $fontFamilyName, - 'resource' => $ressource - ]] - ]); - + $this->setData(['fonts', + $type, + $fontId, [ + 'name' => $fontName, + 'font-family' => $fontFamilyName, + 'resource' => $ressource + ]]); // Copier la fonte si le nom du fichier est fourni if ( $type === 'files' && - is_file(self::FILE_DIR . 'source/' . $ressource) + file_exists(self::FILE_DIR . 'source/' . $ressource) ) { - copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource ); + copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . $ressource ); } // Valeurs en sortie @@ -1019,6 +1005,16 @@ class theme extends common { case 'admin': $zip->addFile(self::DATA_DIR.'admin.json',self::DATA_DIR.'admin.json'); $zip->addFile(self::DATA_DIR.'admin.css',self::DATA_DIR.'admin.css'); + // Ajoute les fontes + $zip->addEmptyDir(self::DATA_DIR .'fonts'); + $fonts = $this->getData(['fonts', 'files']); + foreach ($fonts as $fontId => $fontName) { + $zip->addFile(self::DATA_DIR .'fonts/' . $fontName, self::DATA_DIR.'fonts/' . $fontName); + } + if (file_exists(self::DATA_DIR .'fonts/fonts.html')) { + + $zip->addFile(self::DATA_DIR .'fonts/fonts.html', self::DATA_DIR .'fonts/fonts.html'); + } break; case 'theme': $zip->addFile(self::DATA_DIR.'theme.json',self::DATA_DIR.'theme.json'); @@ -1043,6 +1039,16 @@ class theme extends common { self::FILE_DIR . 'source/' . $value ); } } + // Ajoute les fontes + $zip->addEmptyDir(self::DATA_DIR .'fonts'); + $fonts = $this->getData(['fonts', 'files']); + foreach ($fonts as $fontId => $fontName) { + $zip->addFile(self::DATA_DIR .'fonts/' . $fontName, self::DATA_DIR.'fonts/' . $fontName); + } + if (file_exists(self::DATA_DIR .'fonts/fonts.html')) { + + $zip->addFile(self::DATA_DIR .'fonts/fonts.html', self::DATA_DIR .'fonts/fonts.html'); + } break; } $ret = $zip->close(); diff --git a/core/module/theme/view/footer/footer.php b/core/module/theme/view/footer/footer.php index 6074fb1c..e59b15ec 100644 --- a/core/module/theme/view/footer/footer.php +++ b/core/module/theme/view/footer/footer.php @@ -172,7 +172,7 @@
'Police', + 'label' => 'Fonte', 'selected' => $this->getData(['theme', 'footer', 'font']), 'fonts' => true ]); ?> diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 0f6abeaf..a0f86b11 100644 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -107,7 +107,7 @@
'Police', + 'label' => 'Fonte', 'selected' => $this->getData(['theme', 'header', 'font']), 'fonts' => true ]); ?> diff --git a/core/module/theme/view/menu/menu.php b/core/module/theme/view/menu/menu.php index 46c943ba..161813f2 100644 --- a/core/module/theme/view/menu/menu.php +++ b/core/module/theme/view/menu/menu.php @@ -184,7 +184,7 @@
'Police', + 'label' => 'Fonte', 'selected' => $this->getData(['theme', 'menu', 'font']), 'fonts' => true ]); ?> diff --git a/core/module/theme/view/site/site.php b/core/module/theme/view/site/site.php index b4a6bd42..4157c3d4 100644 --- a/core/module/theme/view/site/site.php +++ b/core/module/theme/view/site/site.php @@ -159,7 +159,7 @@
'Police', + 'label' => 'Fonte', 'selected' => $this->getData(['theme', 'text', 'font']), 'fonts' => true ]); ?> @@ -180,7 +180,7 @@
'Police', + 'label' => 'Fonte', 'selected' => $this->getData(['theme', 'title', 'font']), 'fonts' => true ]); ?>