From 2fbf20a6125d37bbbcf640c86e03659af7b47992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Sat, 5 Mar 2022 15:49:03 +0100 Subject: [PATCH 1/4] =?UTF-8?q?websafe=20Manque=20pr=C3=A9visualisation=20?= =?UTF-8?q?dans=20la=20liste=20de=20fontes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 4 ++ README.md | 2 +- core/class/template.class.php | 2 +- core/core.php | 65 +++++++++++++++++++------ core/module/theme/theme.php | 6 ++- core/module/theme/view/site/site.js.php | 1 - 6 files changed, 60 insertions(+), 20 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4f9f6e82..f72b5c41 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ # Changelog +## Version 11.4.00 +### Amélioration : + - prise en charge des fontes Web Safe : Georgia, Times, Arial, Trebuchet, Lucida, Tahoma, Verdana, Courier et Monaco. + ## Version 11.3.04 ### Correction : - Duplication d'id dans le menu. diff --git a/README.md b/README.md index 9bdc898f..eb9e8330 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ZwiiCMS 11.3.04 +# ZwiiCMS 11.4.00 Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. diff --git a/core/class/template.class.php b/core/class/template.class.php index d246b719..b412e3ea 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -649,7 +649,7 @@ class template { '', $value, $attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string - core::$fonts[$value], + $text, $text ) : sprintf( '', diff --git a/core/core.php b/core/core.php index dc38e1a5..08a9e3ae 100644 --- a/core/core.php +++ b/core/core.php @@ -185,37 +185,41 @@ class common { // Fontes public static $fonts = [ - 'abril-fatface' => 'Abril Fatface', 'arimo' => 'Arimo', 'arvo' => 'Arvo', - 'berkshire-swash' => 'Berkshire Swash', 'dancing-script' => 'Dancing Script', 'droid-sans-2' => 'Droid Sans', 'droid-serif-2' => 'Droid Serif', - 'fira-sans' => 'Fira Sans', - 'genera' => 'Genera', - 'inconsolata-2' => 'Inconsolata', 'indie-flower' => 'Indie Flower', - 'josefin-sans-std' => 'Josefin Sans', 'liberation-sans' => 'Liberation Sans', 'liberation-serif' => 'Liberation Serif', 'lobster-2' => 'Lobster', 'lora' => 'Lora', 'lato' => 'Lato', - 'montserrat-ace' => 'Montserrat Ace', 'old-standard-tt-3' => 'Old Standard TT', 'open-sans' => 'Open Sans', 'oswald-4' => 'Oswald', 'pt-mono' => 'PT Mono', 'pt-serif' => 'PT Serif', - 'raleway-5' => 'Raleway', 'rancho' => 'Rancho', 'roboto' => 'Roboto', - 'signika' => 'Signika', 'ubuntu' => 'Ubuntu', 'vollkorn' => 'Vollkorn' ]; + public static $fontsWebSafe = [ + 'georgia' => 'Georgia, DejaVu Serif, Norasi, serif;', + 'times' => 'Times, Times New Roman, Liberation Serif, FreeSerif, serif;', + 'arial' => 'Arial, Helvetica, Liberation Sans, FreeSans, sans-serif;', + 'trebuchet' => 'Trebuchet MS, Arial, Helvetica, sans-serif;', + 'lucida' => 'Lucida Sans, Lucida Grande, Lucida Sans Unicode, Luxi Sans, sans-serif;', + 'tahoma' => 'Tahoma, Geneva, Kalimati, sans-serif;', + 'verdana' => 'Verdana, DejaVu Sans, Bitstream Vera Sans, Geneva, sans-serif;', + 'impact' => 'Impact, Arial Black, sans-serif;', + 'courrier' => 'Courier, Courier New, FreeMono, Liberation Mono, monospace;', + 'monaco' => 'Monaco, DejaVu Sans Mono, Lucida Console, Andale Mono, monospace;' + ]; + /** * Constructeur commun */ @@ -2277,16 +2281,26 @@ class core extends common { } } + /** + * Traitement des polices de caractères + */ + + // Fusionne la liste des fontes avec les webSafe + foreach (self::$fontsWebSafe as $fontId => $fontValue) { + $fontName = explode (',', $fontValue); + self::$fonts [$fontId] = $fontName[0]; + } // Importe les polices personnalisées $fontsImported = $this->getData(['fonts', 'imported']); if (is_array($fontsImported) && !empty ($fontsImported) ) { - // Fusionner les fonts avec les fontes installées + // Fusionner avec les fontes installées self::$fonts = array_merge(self::$fonts, $fontsImported); - // Tri Alphabétique - asort(self::$fonts); + } + // Tri Alphabétique + asort(self::$fonts); // Crée le fichier de personnalisation avancée if(file_exists(self::DATA_DIR.'custom.css') === false) { @@ -2311,7 +2325,9 @@ class core extends common { /** * Import des polices de caractères - * A partir du CDN ou dans le dossier site/file/source/fonts + * A partir du CDN + * ou dans le dossier site/file/source/fonts + * ou pas du tout si fonte webSafe */ $fonts = [ $this->getData(['theme', 'text', 'font']), $this->getData(['theme', 'title', 'font']), @@ -2321,12 +2337,21 @@ class core extends common { ]; // Suppression des polices identiques $fonts = array_unique($fonts); - // Lire le fichier des fontes locales - $localFonts = $this->getData(['fonts', 'files']); + + /** + * Fontes Web Safe, ne sont pas chargées. + */ + foreach ($fonts as $fontId) { + if (array_key_exists($fontId, self::$fontsWebSafe) ) { + unset($fonts[$fontId]); + } + } /** * Chargement des polices en ligne dans un fichier séparé */ + // Lire le fichier des fontes locales + $localFonts = $this->getData(['fonts', 'files']); $fontFile = ''; foreach ($fonts as $fontId) { if (!array_key_exists($fontId, $localFonts) ) { @@ -2549,6 +2574,16 @@ class core extends common { ]; // Suppression des polices identiques $fonts = array_unique($fonts); + + /** + * Fontes Web Safe, ne sont pas chargées. + */ + foreach ($fonts as $fontId) { + if (array_key_exists($fontId, self::$fontsWebSafe) ) { + unset($fonts[$fontId]); + } + } + // Lire le fichier des fontes locales $localFonts = $this->getData(['fonts', 'files']); diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 5f988d5d..19a209c1 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -574,11 +574,13 @@ class theme extends common { } } self::$fontsList [] = [ - $fontName, + '' . $fontName . '' , $fontId, $fontUsed[$fontId], //array_key_exists($fontId, $fonts['imported']) ? 'Importée' : '', - array_key_exists($fontId, $fonts['files']) ? $fonts['files'][$fontId] : 'CDN Fonts', + array_key_exists($fontId, $fonts['files']) ? + $fonts['files'][$fontId] : + (array_key_exists($fontId, self::$fontsWebSafe) ? 'WebSafe' : 'CDN Fonts'), array_key_exists($fontId, $fonts['imported']) || array_key_exists($fontId, $fonts['files']) ? template::button('themeFontDelete' . $fontId, [ 'class' => 'themeFontDelete buttonRed', diff --git a/core/module/theme/view/site/site.js.php b/core/module/theme/view/site/site.js.php index 3ff25012..c9b01d34 100644 --- a/core/module/theme/view/site/site.js.php +++ b/core/module/theme/view/site/site.js.php @@ -37,7 +37,6 @@ $("input, select").on("change",function() { var titleFontText = $("#themeTitleFont :selected").text(); var textFont = $("#themeTextFont :selected").val(); var textFontText = $("#themeTextFont :selected").text(); - console.log(textFontText); var css = "@import url('https://fonts.cdnfonts.com/css/" + titleFont + "');"; var css = "@import url('https://fonts.cdnfonts.com/css/" + textFont + "');"; // Couleurs des boutons From 3117ebedbe8ecdbc7a57c4ff6b218a0f9a3eb99c Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Mar 2022 10:30:56 +0100 Subject: [PATCH 2/4] bug help largeur --- module/blog/view/edit/edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index 404467b8..14a3f653 100644 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -20,7 +20,7 @@
'Publier', - 'uniqueSubmission' => true, + 'uniqueSubmission' => true ]); ?>
@@ -39,7 +39,7 @@
'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.', + 'help' => $this->getData(['theme', 'site', 'width']) !== '100%' ? 'Taille optimale de l\'image de couverture : ' . ((int) substr($this->getData(['theme', 'site', 'width']), 0, -2) - (20 * 2)) . ' x 350 pixels.' : '', 'label' => 'Image de couverture', 'type' => 1, 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picture']) From 059efebddd5661f7a5d6f83ac33891d2c2b93cb1 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Mar 2022 11:31:52 +0100 Subject: [PATCH 3/4] Fontes websafe + cdfonts en option --- core/core.php | 44 ++++++------------- core/include/update.inc.php | 37 ++++++++++++++-- core/module/install/ressource/defaultdata.php | 23 +++++++++- 3 files changed, 70 insertions(+), 34 deletions(-) diff --git a/core/core.php b/core/core.php index 08a9e3ae..d1e969b2 100644 --- a/core/core.php +++ b/core/core.php @@ -185,41 +185,25 @@ class common { // Fontes public static $fonts = [ - 'arimo' => 'Arimo', - 'arvo' => 'Arvo', - 'dancing-script' => 'Dancing Script', - 'droid-sans-2' => 'Droid Sans', - 'droid-serif-2' => 'Droid Serif', - 'indie-flower' => 'Indie Flower', - 'liberation-sans' => 'Liberation Sans', - 'liberation-serif' => 'Liberation Serif', - 'lobster-2' => 'Lobster', - 'lora' => 'Lora', - 'lato' => 'Lato', - 'old-standard-tt-3' => 'Old Standard TT', - 'open-sans' => 'Open Sans', - 'oswald-4' => 'Oswald', - 'pt-mono' => 'PT Mono', - 'pt-serif' => 'PT Serif', - 'rancho' => 'Rancho', - 'roboto' => 'Roboto', - 'ubuntu' => 'Ubuntu', - 'vollkorn' => 'Vollkorn' ]; public static $fontsWebSafe = [ - 'georgia' => 'Georgia, DejaVu Serif, Norasi, serif;', - 'times' => 'Times, Times New Roman, Liberation Serif, FreeSerif, serif;', - 'arial' => 'Arial, Helvetica, Liberation Sans, FreeSans, sans-serif;', - 'trebuchet' => 'Trebuchet MS, Arial, Helvetica, sans-serif;', - 'lucida' => 'Lucida Sans, Lucida Grande, Lucida Sans Unicode, Luxi Sans, sans-serif;', - 'tahoma' => 'Tahoma, Geneva, Kalimati, sans-serif;', - 'verdana' => 'Verdana, DejaVu Sans, Bitstream Vera Sans, Geneva, sans-serif;', - 'impact' => 'Impact, Arial Black, sans-serif;', - 'courrier' => 'Courier, Courier New, FreeMono, Liberation Mono, monospace;', - 'monaco' => 'Monaco, DejaVu Sans Mono, Lucida Console, Andale Mono, monospace;' + 'arial' => 'Arial, Helvetica, sans-serif;', + 'arial-black' => 'Arial Black, Gadget, sans-serif;', + 'courrier' => 'Courier, Liberation Mono, monospace;', + 'courrier-new' => 'Courier New, Courier, monospace', + 'garamond' => 'Garamond, serif', + 'georgia' => 'Georgia, serif;', + 'impact' => 'Impact, Charcoal, sans-serif;', + 'lucida' => 'Lucida Sans Unicode, Lucida Grande, sans-serif', + 'tahoma' => 'Tahoma, Geneva, sans-serif;', + 'times-new-roman' => 'Times New Roman, Liberation Serif, serif;', + 'trebuchet' => 'Trebuchet MS, Arial, Helvetica, sans-serif;', + 'tahoma' => 'Tahoma, Geneva, sans-serif;', + 'verdana' => 'Verdana, Geneva, sans-serif;', ]; + /** * Constructeur commun */ diff --git a/core/include/update.inc.php b/core/include/update.inc.php index ebe8a045..5500164a 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -714,7 +714,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) { // Option de dévoilement du mdp $this->setData(['config', 'connect', 'showPassword', true]); - + // Mise à jour $this->setData(['core', 'dataVersion', 11200]); } @@ -722,7 +722,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) { // Version 11.2.02 if ($this->getData(['core', 'dataVersion']) < 11202) { - // Renommer les champs + // Renommer les champs $this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText']) ]); $this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText']) ]); $this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText']) ]); @@ -784,7 +784,7 @@ if ($this->getData(['core', 'dataVersion']) < 11300) { $this->setData(['theme', 'title', 'font', $fonts[ $this->getData (['theme', 'title', 'font' ]) ] ]); $this->setData(['admin', 'fontTitle', $fonts[ $this->getData (['admin', 'fontTitle' ]) ] ]); $this->setData(['admin', 'fontText', $fonts[$this->getData (['admin','fontText' ]) ] ]); - + unlink(self::DATA_DIR . 'admin.css'); unlink(self::DATA_DIR . 'theme.css'); @@ -808,3 +808,34 @@ if ($this->getData(['core', 'dataVersion']) < 11303) { // Mise à jour $this->setData(['core', 'dataVersion', 11303]); } + +// Version 11.4.00 +if ($this->getData(['core', 'dataVersion']) < 11400) { + + $fonts = [ + 'arimo' => 'Arimo', + 'arvo' => 'Arvo', + 'dancing-script' => 'Dancing Script', + 'droid-sans-2' => 'Droid Sans', + 'droid-serif-2' => 'Droid Serif', + 'indie-flower' => 'Indie Flower', + 'liberation-sans' => 'Liberation Sans', + 'liberation-serif' => 'Liberation Serif', + 'lobster-2' => 'Lobster', + 'lora' => 'Lora', + 'lato' => 'Lato', + 'old-standard-tt-3' => 'Old Standard TT', + 'open-sans' => 'Open Sans', + 'oswald-4' => 'Oswald', + 'pt-mono' => 'PT Mono', + 'pt-serif' => 'PT Serif', + 'rancho' => 'Rancho', + 'roboto' => 'Roboto', + 'ubuntu' => 'Ubuntu', + 'vollkorn' => 'Vollkorn' + ]; + $this->setData(['fonts', 'imported', $fonts]); + + // Mise à jour + $this->setData(['core', 'dataVersion', 11400]); +} diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 197d69b5..8cf73dbd 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -87,7 +87,28 @@ class init extends common { ], 'fonts' => [ 'files' => [], - 'imported' => [] + 'imported'=> [ + 'arimo'=> 'Arimo', + 'arvo'=> 'Arvo', + 'dancing-script' => 'Dancing Script', + 'droid-sans-2'=> 'Droid Sans', + 'droid-serif-2'=> 'Droid Serif', + 'indie-flower'=> 'Indie Flower', + 'liberation-sans'=> 'Liberation Sans', + 'liberation-serif'=> 'Liberation Serif', + 'lobster-2'=> 'Lobster', + 'lora'=> 'Lora', + 'lato'=> 'Lato', + 'old-standard-tt-3'=> 'Old Standard TT', + 'open-sans'=> 'Open Sans', + 'oswald-4'=> 'Oswald', + 'pt-mono'=> 'PT Mono', + 'pt-serif'=> 'PT Serif', + 'rancho'=> 'Rancho', + 'roboto'=> 'Roboto', + 'ubuntu'=> 'Ubuntu', + 'vollkorn'=> 'Vollkorn' + ] ], 'page' => [ 'accueil' => [ From 5928881ce62343d10a3cc51141801cb5842509a4 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Mar 2022 14:09:09 +0100 Subject: [PATCH 4/4] =?UTF-8?q?banni=C3=A8re=20info=20dimensions=20de=20l'?= =?UTF-8?q?image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 7 ++-- core/module/theme/view/header/header.js.php | 13 +++++--- core/module/theme/view/header/header.php | 36 +++++---------------- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f72b5c41..f1675b4a 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,8 +2,11 @@ ## Version 11.4.00 -### Amélioration : - - prise en charge des fontes Web Safe : Georgia, Times, Arial, Trebuchet, Lucida, Tahoma, Verdana, Courier et Monaco. +### Améliorations : + - Prise en charge des fontes Web Safe. Les fontes initiales sont transférées dans les fontes optionnelles, donc effaçables. + - Configuration de la bannière, modalité d'affichage de la taille d'image recommandée et affichage des dimensions de l'image. +## Correction : + - Module blog : taille recommandée de l'image erronée lorsque la largeur de l'écran est réglée sur fluide (100%). ## Version 11.3.04 ### Correction : diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index 7cc85e53..85f736b6 100644 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -47,9 +47,9 @@ $("input, select").on("change", function() { var tmpImg = new Image(); tmpImg.onload = function() { // Informations affichées - $("#themeHeaderImageHeight").val(tmpImg.height + " px"); - $("#themeHeaderImageWidth").val(tmpImg.width + " px"); - $("#themeHeaderImageRatio").val(tmpImg.width / tmpImg.height); + $("#themeHeaderImageHeight").html(tmpImg.height + "px"); + $("#themeHeaderImageWidth").html(tmpImg.width + "px"); + $("#themeHeaderImageRatio").html(tmpImg.width / tmpImg.height); // Limiter la hauteur à 600 px if (tmpImg.height > 600) { @@ -69,6 +69,9 @@ $("input, select").on("change", function() { $("#themeHeaderHeight option:eq(0)").val(tmpImgHeight + "px"); // Modifier l'option $("#themeHeaderHeight option:eq(0)").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); + $("#themeHeaderImageInfo").show(); + } else { + $("#themeHeaderImageInfo").hide(); } }; @@ -207,10 +210,10 @@ $("input, select").on("change", function() { // Affiche / Cache les options de l'image du fond $("#themeHeaderImage").on("change", function() { if($(this).val()) { - $("#themeHeaderImageOptions").slideDown(); + $(".themeHeaderImageOptions").slideDown(); } else { - $("#themeHeaderImageOptions").slideUp(function() { + $(".themeHeaderImageOptions").slideUp(function() { $("#themeHeaderTextHide").prop("checked", false).trigger("change"); }); } diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index a9956412..232953db 100644 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -154,40 +154,20 @@ $imageFile = file_exists(self::FILE_DIR.'source/'.$this->getData(['theme', 'header', 'image'])) ? $this->getData(['theme', 'header', 'image']) : ""; echo template::file('themeHeaderImage', [ - 'help' => 'Sélectionner une image aux dimensions recommandées ci-dessous :', 'label' => 'Image', 'type' => 1, 'value' => $imageFile ]); ?> + + Largeur de l'image : (largeur de site : getData(['theme', 'site', 'width']); ?>) + - + Hauteur de l'image : + - + Ratio : +
-
-
- Informations sur l'image : -
-
- 'Largeur', - 'class' => 'textAlignCenter', - 'disable' => true - ]); ?> -
-
- 'Hauteur', - 'class' => 'textAlignCenter', - 'disable' => true - ]); ?> -
-
- 'Ratio (L/H)', - 'class' => 'textAlignCenter', - 'disable' => true - ]); ?> -
-
-
+