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 @@