From 93ae867328433581b1aa989bb3efa97eb1b57402 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 4 Feb 2022 16:26:39 +0100 Subject: [PATCH] Init Nouvelles polices cdnfonts Correction de bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mise à jour à corriger --- core/class/template.class.php | 7 ++- core/core.php | 48 +++++++++++--- core/include/update.inc.php | 63 +++++++++++++++++++ core/module/install/ressource/defaultdata.php | 16 ++--- core/module/theme/theme.php | 29 --------- core/module/theme/view/admin/admin.js.php | 3 +- core/module/theme/view/admin/admin.php | 4 +- core/module/theme/view/footer/footer.js.php | 7 ++- core/module/theme/view/footer/footer.php | 2 +- core/module/theme/view/header/header.js.php | 7 ++- core/module/theme/view/header/header.php | 2 +- core/module/theme/view/menu/menu.js.php | 7 ++- core/module/theme/view/menu/menu.php | 2 +- core/module/theme/view/site/site.js.php | 14 +++-- core/module/theme/view/site/site.php | 4 +- 15 files changed, 146 insertions(+), 69 deletions(-) diff --git a/core/class/template.class.php b/core/class/template.class.php index 16cbef01..836fd05a 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -619,9 +619,10 @@ class template { $attributes['selected'] = common::$inputBefore[$attributes['id']]; } // Liste des polices à intégrer + //var_dump(core::$fonts); if ($attributes['fonts'] === true) { - foreach ($options as $fontId) { - echo "\n"; + foreach (core::$fonts as $fontId => $font) { + echo "\n"; } } // Début du wrapper @@ -648,7 +649,7 @@ class template { '', $value, $attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string - str_replace('+',' ',$value), + core::$fonts[$value], $text ) : sprintf( '', diff --git a/core/core.php b/core/core.php index b3e6d81a..276c527d 100644 --- a/core/core.php +++ b/core/core.php @@ -181,6 +181,37 @@ class common { 'blacklist' => '', 'locale' => '' ]; + + // 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', + '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' + ]; /** * Constructeur commun @@ -2235,11 +2266,14 @@ class core extends common { // Version $css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/'; // Import des polices de caractères - $css .= '@import url("https://fonts.googleapis.com/css?family=' . $this->getData(['theme', 'text', 'font']) . '|' . $this->getData(['theme', 'title', 'font']) . '|' . $this->getData(['theme', 'header', 'font']) . '|' . $this->getData(['theme', 'menu', 'font']) . '");'; + $css .= '@import url("http://fonts.cdnfonts.com/css/' . $this->getData(['theme', 'text', 'font']) . '");'; + $css .= '@import url("http://fonts.cdnfonts.com/css/' . $this->getData(['theme', 'title', 'font']) . '");'; + $css .= '@import url("http://fonts.cdnfonts.com/css/' . $this->getData(['theme', 'header', 'font']) . '");'; + $css .= '@import url("http://fonts.cdnfonts.com/css/' . $this->getData(['theme', 'menu', 'font']) . '");'; // Fond du body $colors = helper::colorVariants($this->getData(['theme', 'body', 'backgroundColor'])); // Body - $css .= 'body{font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'text', 'font'])) . '",sans-serif}'; + $css .= 'body{font-family:"' . self::$fonts[$this->getData(['theme', 'text', 'font'])] . '",sans-serif}'; if($themeBodyImage = $this->getData(['theme', 'body', 'image'])) { // Image dans html pour éviter les déformations. $css .= 'html {background-image:url("../file/source/' . $themeBodyImage . '");background-position:' . $this->getData(['theme', 'body', 'imagePosition']) . ';background-attachment:' . $this->getData(['theme', 'body', 'imageAttachment']) . ';background-size:' . $this->getData(['theme', 'body', 'imageSize']) . ';background-repeat:' . $this->getData(['theme', 'body', 'imageRepeat']) . '}'; @@ -2257,7 +2291,7 @@ class core extends common { $colors = helper::colorVariants($this->getData(['theme', 'text', 'linkColor'])); $css .= 'a{color:' . $colors['normal'] . '}'; // Couleurs de site dans TinyMCe - $css .= 'div.mce-edit-area {font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'text', 'font'])) . '",sans-serif}'; + $css .= 'div.mce-edit-area {font-family:"' . self::$fonts[$this->getData(['theme', 'text', 'font'])] . '",sans-serif}'; // Site dans TinyMCE $css .= '.editorWysiwyg {background-color:' . $this->getData(['theme', 'site', 'backgroundColor']) . ';}'; $css .= 'span.mce-text{background-color: unset !important;}'; @@ -2298,7 +2332,7 @@ class core extends common { $css .= '.helpButton span:hover{color:' . $colors['darken'] . '}'; $css .= '.button:active,button[type=\'submit\']:active,.pagination a:active{background-color:' . $colors['veryDarken'] . '}'; $colors = helper::colorVariants($this->getData(['theme', 'title', 'textColor'])); - $css .= 'h1,h2,h3,h4,h5,h6,h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:' . $colors['normal'] . ';font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'title', 'font'])) . '",sans-serif;font-weight:' . $this->getData(['theme', 'title', 'fontWeight']) . ';text-transform:' . $this->getData(['theme', 'title', 'textTransform']) . '}'; + $css .= 'h1,h2,h3,h4,h5,h6,h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color:' . $colors['normal'] . ';font-family:"' . self::$fonts[$this->getData(['theme', 'title', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'title', 'fontWeight']) . ';text-transform:' . $this->getData(['theme', 'title', 'textTransform']) . '}'; $css .= 'h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color:' . $colors['darken'] . '}'; // Les blocs $colors = helper::colorVariants($this->getData(['theme', 'block', 'backgroundColor'])); @@ -2332,7 +2366,7 @@ class core extends common { $css .= 'header{background-image:url("../file/source/' . $themeHeaderImage . '");background-position:' . $this->getData(['theme', 'header', 'imagePosition']) . ';background-repeat:' . $this->getData(['theme', 'header', 'imageRepeat']) . '}'; } $colors = helper::colorVariants($this->getData(['theme', 'header', 'textColor'])); - $css .= 'header span{color:' . $colors['normal'] . ';font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'header', 'font'])) . '",sans-serif;font-weight:' . $this->getData(['theme', 'header', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'header', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'header', 'textTransform']) . '}'; + $css .= 'header span{color:' . $colors['normal'] . ';font-family:"' . self::$fonts[$this->getData(['theme', 'header', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'header', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'header', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'header', 'textTransform']) . '}'; } // Bannière au contenu personnalisé @@ -2381,7 +2415,7 @@ class core extends common { $css .= 'nav{padding:0 10px;}'; } - $css .= '#toggle span,#menu a{padding:' . $this->getData(['theme', 'menu', 'height']) .';font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'menu', 'font'])) . '",sans-serif;font-weight:' . $this->getData(['theme', 'menu', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'menu', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'menu', 'textTransform']) . '}'; + $css .= '#toggle span,#menu a{padding:' . $this->getData(['theme', 'menu', 'height']) .';font-family:"' . self::$fonts[$this->getData(['theme', 'menu', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'menu', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'menu', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'menu', 'textTransform']) . '}'; // Pied de page $colors = helper::colorVariants($this->getData(['theme', 'footer', 'backgroundColor'])); @@ -2391,7 +2425,7 @@ class core extends common { $css .= 'footer{padding:0}'; } - $css .= 'footer span, #footerText > p {color:' . $this->getData(['theme', 'footer', 'textColor']) . ';font-family:"' . str_replace('+', ' ', $this->getData(['theme', 'footer', 'font'])) . '",sans-serif;font-weight:' . $this->getData(['theme', 'footer', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'footer', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'footer', 'textTransform']) . '}'; + $css .= 'footer span, #footerText > p {color:' . $this->getData(['theme', 'footer', 'textColor']) . ';font-family:"' . self::$fonts[$this->getData(['theme', 'footer', 'font'])] . '",sans-serif;font-weight:' . $this->getData(['theme', 'footer', 'fontWeight']) . ';font-size:' . $this->getData(['theme', 'footer', 'fontSize']) . ';text-transform:' . $this->getData(['theme', 'footer', 'textTransform']) . '}'; $css .= 'footer {background-color:' . $colors['normal'] . ';color:' . $this->getData(['theme', 'footer', 'textColor']) . '}'; $css .= 'footer a{color:' . $this->getData(['theme', 'footer', 'textColor']) . '}'; $css .= 'footer #footersite > div {margin:' . $this->getData(['theme', 'footer', 'height']) . ' 0}'; diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 1bf1d3b7..be2cc588 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -739,4 +739,67 @@ if ($this->getData(['core', 'dataVersion']) < 11202) { // Mise à jour $this->setData(['core', 'dataVersion', 11202]); +} + +// Version 11.2.06 +if ($this->getData(['core', 'dataVersion']) < 11206) { + + // tableau de substitution + $fonts = [ + 'Abril+Fatface' => 'abril-fatface', + 'Arimo' => 'arimo', + 'Arvo' => 'arvo', + 'Berkshire+Swash' => 'berkshire-swash', + 'Cabin' => 'genera', + 'Dancing+Script' => 'dancing-script', + 'Droid+Sans' => 'droid-sans-2', + 'Droid+Serif' => 'droid-serif-2', + 'Fira+Sans' => 'fira-sans', + 'Inconsolata' => 'inconsolata-2', + 'Indie+Flower' =>'indie-flower', + 'Josefin+Slab' => 'josefin-sans-std', + 'Lobster' => 'lobster-2', + 'Lora' => 'lora', + 'Lato' =>'lato', + 'Marvel' => 'montserrat-ace', + 'Old+Standard+TT' => 'old-standard-tt-3', + 'Open+Sans' =>'open-sans', + // Corriger l'erreur de nom de police installée par défaut, il manquait un O en majuscule + 'open+Sans' =>'open-sans', + 'Oswald' =>'oswald-4', + 'PT+Mono' => 'pt-mono', + 'PT+Serif' =>'pt-serif', + 'Raleway' => 'raleway-5', + 'Rancho' => 'rancho', + 'Roboto' => 'Roboto', + 'Signika' => 'signika', + 'Ubuntu' => 'ubuntu', + 'Vollkorn' => 'vollkorn' + ]; + + if (array_key_exists($fonts[$this->getData (['theme', 'footer', 'font'])], $fonts) ) { + $this->setData(['theme', 'footer', 'font', $fonts[$this->getData (['theme', 'footer', 'font']) ] ]); + } + if (array_key_exists($fonts[$this->getData (['theme', 'header', 'font'])], $fonts) ) { + $this->setData(['theme', 'header', 'font', $fonts[$this->getData (['theme', 'header', 'font' ]) ] ]); + } + if (array_key_exists($fonts[$this->getData (['theme', 'menu', 'font'])], $fonts) ) { + $this->setData(['theme', 'menu', 'font', $fonts[$this->getData (['theme', 'menu', 'font' ]) ] ]); + } + if (array_key_exists($fonts[$this->getData (['theme', 'text', 'font'])], $fonts) ) { + $this->setData(['theme', 'text', 'font', $fonts[$this->getData (['theme', 'text', 'font' ]) ] ]); + } + if (array_key_exists($fonts[$this->getData (['theme', 'title', 'font'])], $fonts) ) { + $this->setData(['theme', 'title', 'font', $fonts[ $this->getData (['theme', 'title', 'font' ]) ] ]); + } + if (array_key_exists($fonts[$this->getData (['admin', 'fontTitle'])], $fonts) ) { + $this->setData(['admin', 'fontTitle', $fonts[ $this->getData (['admin', 'fontTitle' ]) ] ]); + } + + if (array_key_exists($fonts[$this->getData (['admin', 'fontText'])], $fonts) ) { + $this->setData(['admin', 'fontText', $fonts[$this->getData (['admin','fontText' ]) ] ]); + } + + // Mise à jour + $this->setData(['core', 'dataVersion', 11206]); } \ No newline at end of file diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 60540b15..2a37f513 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -56,7 +56,7 @@ class init extends common { ] ], 'core' => [ - 'dataVersion' => 11202, + 'dataVersion' => 11206, 'lastBackup' => 0, 'lastClearTmp' => 0, 'lastAutoUpdate' => 0, @@ -127,7 +127,7 @@ class init extends common { ], 'footer' => [ 'backgroundColor' => 'rgba(255, 255, 255, 1)', - 'font' => 'Open+Sans', + 'font' => 'open-sans', 'fontSize' => '.8em', 'fontWeight' => 'normal', 'height' => '5px', @@ -154,7 +154,7 @@ class init extends common { ], 'header' => [ 'backgroundColor' => 'rgba(32, 59, 82, 1)', - 'font' => 'Oswald', + 'font' => 'oswald-4', 'fontSize' => '2em', 'fontWeight' => 'normal', 'height' => '150px', @@ -177,7 +177,7 @@ class init extends common { 'menu' => [ 'backgroundColor' => 'rgba(32, 59, 82, 1)', 'backgroundColorSub' => 'rgba(32, 59, 82, 1)', - 'font' => 'Open+Sans', + 'font' => 'open-sans', 'fontSize' => '1em', 'fontWeight' => 'normal', 'height' => '15px 10px', @@ -208,13 +208,13 @@ class init extends common { 'borderColor' => 'rgba(236, 239, 241, 1)' ], 'text' => [ - 'font' => 'Open+Sans', + 'font' => 'open-sans', 'fontSize' => '13px', 'textColor' => 'rgba(33, 34, 35, 1)', 'linkColor' => 'rgba(74, 105, 189, 1)' ], 'title' => [ - 'font' => 'Oswald', + 'font' => 'oswald-4', 'fontWeight' => 'normal', 'textColor' => 'rgba(74, 105, 189, 1)', 'textTransform' => 'none' @@ -226,9 +226,9 @@ class init extends common { ], 'admin' => [ 'backgroundColor' => 'rgba(255, 255, 255, 1)', - 'fontText' => 'open+Sans', + 'fontText' => 'open-Sans', 'fontSize' => '13px', - 'fontTitle' => 'Oswald', + 'fontTitle' => 'oswald-4', 'colorText' => 'rgba(33, 34, 35, 1)', 'colorTitle' => 'rgba(74, 105, 189, 1)', 'backgroundColorButton' => 'rgba(74, 105, 189, 1)', diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 72bbdb21..cd1be767 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -40,35 +40,6 @@ class theme extends common { 'scroll' => 'Standard', 'fixed' => 'Fixe' ]; - public static $fonts = [ - 'Abril+Fatface' => 'Abril Fatface', - 'Arimo' => 'Arimo', - 'Arvo' => 'Arvo', - 'Berkshire+Swash' => 'Berkshire Swash', - 'Cabin' => 'Cabin', - 'Dancing+Script' => 'Dancing Script', - 'Droid+Sans' => 'Droid Sans', - 'Droid+Serif' => 'Droid Serif', - 'Fira+Sans' => 'Fira Sans', - 'Inconsolata' => 'Inconsolata', - 'Indie+Flower' => 'Indie Flower', - 'Josefin+Slab' => 'Josefin Slab', - 'Lobster' => 'Lobster', - 'Lora' => 'Lora', - 'Lato' => 'Lato', - 'Marvel' => 'Marvel', - 'Old+Standard+TT' => 'Old Standard TT', - 'Open+Sans' => 'Open Sans', - 'Oswald' => 'Oswald', - 'PT+Mono' => 'PT Mono', - 'PT+Serif' => 'PT Serif', - 'Raleway' => 'Raleway', - 'Rancho' => 'Rancho', - 'Roboto' => 'Roboto', - 'Signika' => 'Signika', - 'Ubuntu' => 'Ubuntu', - 'Vollkorn' => 'Vollkorn' - ]; public static $containerWides = [ 'container' => 'Limitée au site', 'none' => 'Etendue sur la page' diff --git a/core/module/theme/view/admin/admin.js.php b/core/module/theme/view/admin/admin.js.php index e62011e2..7855fb23 100644 --- a/core/module/theme/view/admin/admin.js.php +++ b/core/module/theme/view/admin/admin.js.php @@ -17,7 +17,8 @@ $("input, select").on("change", function() { var titleFont = $("#adminFontTitle").val(); var textFont = $("#adminFontText").val(); - var css = "@import url('https://fonts.googleapis.com/css?family=" + titleFont + "|" + textFont + "');"; + var css = "@import url('http://fonts.cdnfonts.com/css/" + titleFont + "');"; + var css = "@import url('http://fonts.cdnfonts.com/css/" + textFont + "');"; var colors = core.colorVariants($("#adminBackgroundColor").val()); var css = "#site{background-color:" + colors.normal + ";}"; css += "body, .row > div {font:" + $("#adminFontTextSize").val() + " '" + textFont + "', sans-serif;}"; diff --git a/core/module/theme/view/admin/admin.php b/core/module/theme/view/admin/admin.php index 1ab92938..8b81ad02 100644 --- a/core/module/theme/view/admin/admin.php +++ b/core/module/theme/view/admin/admin.php @@ -127,7 +127,7 @@

Mise en forme du texte

- 'Police du texte', 'selected' => $this->getData(['admin', 'fontText']), 'fonts' => true @@ -140,7 +140,7 @@ ]); ?>
- 'Police des titres', 'selected' => $this->getData(['admin', 'fontTitle']), 'fonts' => true diff --git a/core/module/theme/view/footer/footer.js.php b/core/module/theme/view/footer/footer.js.php index ad8c1981..d96ededa 100644 --- a/core/module/theme/view/footer/footer.js.php +++ b/core/module/theme/view/footer/footer.js.php @@ -17,8 +17,9 @@ */ $("input, select").on("change", function() { // Import des polices de caractères - var footerFont = $("#themeFooterFont").val(); - var css = "@import url('https://fonts.googleapis.com/css?family=" + footerFont + "');"; + var footerFont = $("#themeFooterFont :selected").val(); + var footerFontText = $("#themeFooterFont :selected").text(); + var css = "@import url('http://fonts.cdnfonts.com/css/" + footerFont + "');"; // Couleurs du pied de page var colors = core.colorVariants($("#themeFooterBackgroundColor").val()); var textColor = $("#themeFooterTextColor").val(); @@ -35,7 +36,7 @@ $("input, select").on("change", function() { css += "#footerText > p {text-align:" + $("#themeFooterTextAlign").val() + "}"; css += "#footerCopyright{text-align:" + $("#themeFooterCopyrightAlign").val() + "}"; // Taille, couleur, épaisseur et capitalisation du titre de la bannière - css += "footer span, #footerText > p {color:" + $("#themeFooterTextColor").val() + ";font-family:'" + footerFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeFooterFontWeight").val() + ";font-size:" + $("#themeFooterFontSize").val() + ";text-transform:" + $("#themeFooterTextTransform").val() + "}"; + css += "footer span, #footerText > p {color:" + $("#themeFooterTextColor").val() + ";font-family:'" + footerFontText + "',sans-serif;font-weight:" + $("#themeFooterFontWeight").val() + ";font-size:" + $("#themeFooterFontSize").val() + ";text-transform:" + $("#themeFooterTextTransform").val() + "}"; // Marge if($("#themeFooterMargin").is(":checked")) { css += 'footer{padding: 0 20px;}'; diff --git a/core/module/theme/view/footer/footer.php b/core/module/theme/view/footer/footer.php index 75eaf355..9b78b052 100644 --- a/core/module/theme/view/footer/footer.php +++ b/core/module/theme/view/footer/footer.php @@ -173,7 +173,7 @@

Mise en forme du texte

- 'Police', 'selected' => $this->getData(['theme', 'footer', 'font']), 'fonts' => true diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index 07e021db..e048c4a7 100644 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -80,8 +80,9 @@ $("input, select").on("change", function() { tmpImg.src= "" + "site/file/source/" + $("#themeHeaderImage").val(); // Import des polices de caractères - var headerFont = $("#themeHeaderFont").val(); - var css = "@import url('https://fonts.googleapis.com/css?family=" + headerFont + "');"; + var headerFont = $("#themeHeaderFont :selected").val(); + var headerFontText = $("#themeHeaderFont :selected").text(); + var css = "@import url('http://fonts.cdnfonts.com/css/" + headerFont + "');"; css += "header{text-align:" + $("#themeHeaderTextAlign").val() + ";"; if ($("#themeHeaderImage").val()) { @@ -97,7 +98,7 @@ $("input, select").on("change", function() { // Taille, couleur, épaisseur et capitalisation du titre de la bannière - css += "header span{font-family:'" + headerFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeHeaderFontWeight").val() + ";font-size:" + $("#themeHeaderFontSize").val() + ";text-transform:" + $("#themeHeaderTextTransform").val() + ";color:" + $("#themeHeaderTextColor").val() + "}"; + css += "header span{font-family:'" + headerFontText + "',sans-serif;font-weight:" + $("#themeHeaderFontWeight").val() + ";font-size:" + $("#themeHeaderFontSize").val() + ";text-transform:" + $("#themeHeaderTextTransform").val() + ";color:" + $("#themeHeaderTextColor").val() + "}"; // Cache le titre de la bannière if($("#themeHeaderTextHide").is(":checked")) { diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 25cf67a4..e503d88d 100644 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -108,7 +108,7 @@ ]); ?>
- 'Police', 'selected' => $this->getData(['theme', 'header', 'font']), 'fonts' => true diff --git a/core/module/theme/view/menu/menu.js.php b/core/module/theme/view/menu/menu.js.php index 84d99c70..ecb065f8 100644 --- a/core/module/theme/view/menu/menu.js.php +++ b/core/module/theme/view/menu/menu.js.php @@ -40,8 +40,9 @@ $(document).ready(function(){ */ $("input, select").on("change", function() { // Import des polices de caractères - var menuFont = $("#themeMenuFont").val(); - var css = "@import url('https://fonts.googleapis.com/css?family=" + menuFont + "');"; + var menuFont = $("#themeMenuFont :selected").val(); + var menuFontText = $("#themeMenuFont :selected").text(); + var css = "@import url('http://fonts.cdnfonts.com/css/" + menuFont + "');"; var colors = core.colorVariants($("#themeMenuBackgroundColor").val()); // Couleurs du menu css += "nav,nav.navLevel1 a{background-color:" + colors.normal + "}"; @@ -56,7 +57,7 @@ $("input, select").on("change", function() { var colors = core.colorVariants($("#themeMenuBackgroundColorSub").val()); css += 'nav .navSub a{background-color:' + colors.normal + '}'; // Taille, hauteur, épaisseur et capitalisation de caractères du menu - css += "#toggle span,#menu a{padding:" + $("#themeMenuHeight").val() + ";font-family:'" + menuFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeMenuFontWeight").val() + ";font-size:" + $("#themeMenuFontSize").val() + ";text-transform:" + $("#themeMenuTextTransform").val() + "}"; + css += "#toggle span,#menu a{padding:" + $("#themeMenuHeight").val() + ";font-family:'" + menuFontText + "',sans-serif;font-weight:" + $("#themeMenuFontWeight").val() + ";font-size:" + $("#themeMenuFontSize").val() + ";text-transform:" + $("#themeMenuTextTransform").val() + "}"; // Alignement du menu css += "#menu{text-align:" + $("#themeMenuTextAlign").val() + "}"; // Marge diff --git a/core/module/theme/view/menu/menu.php b/core/module/theme/view/menu/menu.php index 1db6aa40..11bde3da 100644 --- a/core/module/theme/view/menu/menu.php +++ b/core/module/theme/view/menu/menu.php @@ -185,7 +185,7 @@

Mise en forme du texte

- 'Police', 'selected' => $this->getData(['theme', 'menu', 'font']), 'fonts' => true diff --git a/core/module/theme/view/site/site.js.php b/core/module/theme/view/site/site.js.php index 9039d830..2f497288 100644 --- a/core/module/theme/view/site/site.js.php +++ b/core/module/theme/view/site/site.js.php @@ -33,9 +33,13 @@ $("input, select").on("change",function() { */ // Import des polices de caractères - var titleFont = $("#themeTitleFont").val(); - var textFont = $("#themeTextFont").val(); - var css = "@import url('https://fonts.googleapis.com/css?family=" + titleFont + "|" + textFont + "');"; + var titleFont = $("#themeTitleFont :selected").val(); + var titleFontText = $("#themeTitleFont :selected").text(); + var textFont = $("#themeTextFont :selected").val(); + var textFontText = $("#themeTextFont :selected").text(); + console.log(textFontText); + var css = "@import url('http://fonts.cdnfonts.com/css/" + titleFont + "');"; + var css = "@import url('http://fonts.cdnfonts.com/css/" + textFont + "');"; // Couleurs des boutons var colors = core.colorVariants($("#themeButtonBackgroundColor").val()); css += ".button.buttonSubmitPreview{background-color:" + colors.normal + ";}"; @@ -47,10 +51,10 @@ $("input, select").on("change",function() { css += "a.urlPreview{color:" + colors.normal + "}"; css += "a.urlPreview:hover{color:" + colors.darken + "}"; // Couleur, polices, épaisseur et capitalisation de caractères des titres - css += ".headerPreview,.headerPreview{color:" + $("#themeTitleTextColor").val() + ";font-family:'" + titleFont.replace(/\+/g, " ") + "',sans-serif;font-weight:" + $("#themeTitleFontWeight").val() + ";text-transform:" + $("#themeTitleTextTransform").val() + "}"; + css += ".headerPreview,.headerPreview{color:" + $("#themeTitleTextColor").val() + ";font-family:'" + titleFontText + "',sans-serif;font-weight:" + $("#themeTitleFontWeight").val() + ";text-transform:" + $("#themeTitleTextTransform").val() + "}"; // Police de caractères // Police + couleur - css += ".textPreview,.urlPreview{color:" + $("#themeTextTextColor").val() + ";font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif; font-size:" + $("#themeTextFontSize").val() + ";}"; + css += ".textPreview,.urlPreview{color:" + $("#themeTextTextColor").val() + ";font-family:'" + textFontText + "',sans-serif; font-size:" + $("#themeTextFontSize").val() + ";}"; // Couleur des liens //css += "a.preview,.buttonSubmitPreview{font-family:'" + textFont.replace(/\+/g, " ") + "',sans-serif}"; diff --git a/core/module/theme/view/site/site.php b/core/module/theme/view/site/site.php index 0184fb0a..7414f397 100644 --- a/core/module/theme/view/site/site.php +++ b/core/module/theme/view/site/site.php @@ -160,7 +160,7 @@

Mise en forme du texte

- 'Police', 'selected' => $this->getData(['theme', 'text', 'font']), 'fonts' => true @@ -181,7 +181,7 @@

Mise en forme des titres

- 'Police', 'selected' => $this->getData(['theme', 'title', 'font']), 'fonts' => true