diff --git a/CHANGES.md b/CHANGES.md index 17babfc8..f7ca8d7f 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,13 @@ - Amélioration du thème admin de base, modifications du jeu d'icônes. - Mise à jour automatisée, affichage de l'erreur en cas d'échec. +## Version 11.4.00 +### 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 : - Duplication d'id dans le menu. diff --git a/core/class/template.class.php b/core/class/template.class.php index 1e9aea0f..ac510b31 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -651,7 +651,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 746ee548..47ad97a6 100644 --- a/core/core.php +++ b/core/core.php @@ -181,37 +181,25 @@ 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 = [ + '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 */ @@ -2244,16 +2232,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) { @@ -2278,7 +2276,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']), @@ -2288,12 +2288,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) ) { @@ -2516,6 +2525,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/include/update.inc.php b/core/include/update.inc.php index afb955ba..ceabc026 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -869,4 +869,34 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { // Mise à jour $this->setData(['core', 'dataVersion', 11400]); -} \ No newline at end of file +} + +// Version 12.0.00 +if ($this->getData(['core', 'dataVersion']) < 12000) { + $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', 12000]); +} diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 5baac636..e696a7ca 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' => [ diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index b7339d53..b68ae856 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/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 - ]); ?> -
-
-
+
'Publier', - 'uniqueSubmission' => true, + 'uniqueSubmission' => true ]); ?>
@@ -38,7 +38,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'])