Nouvelles polices et nouvelle gestion des polices

This commit is contained in:
Deltacms 2022-02-15 07:42:37 +01:00
parent b9a21a67dd
commit 3960721769
37 changed files with 813 additions and 174 deletions

19
.gitignore vendored Normal file
View File

@ -0,0 +1,19 @@
# Fichiers du site
site/*
# Dossiers vides dans GitHub
!.gitkeep
/.git
# PHPStorm
.idea/
# Trucs
core/vendor/tinymce/link_list.json
.vscode/*
sitemap.xml.gz
sitemap.xml
robots.txt
.DS_Store
# Service de mise à jour
gitupdate.sh

View File

@ -2,6 +2,7 @@
## Version 3.2.01 de Deltacms
- Modifications :
- nouvelles polices 'Open Font License' hébergées en local, l'administrateur peut ajouter des polices.
## Version 3.1.01 de Deltacms
- Modifications :

View File

@ -7,8 +7,6 @@ DeltaCMS est un CMS sans base de données (flat-file) qui permet de créer et g
DeltaCMS a été créé à partir de ZwiiCMS 11.2.00.24
ZwiiCMS a été créé par un développeur de talent, [Rémi Jean](https://remijean.fr/). Il est désormais maintenu par Frédéric Tempez.
[Version initiale ZwiiCMS](https://github.com/remijean/ZwiiCMS/) - [GitHub](https://github.com/fredtempez/ZwiiCMS)
## Configuration recommandée
@ -89,6 +87,7 @@ En cas de difficulté avec la nouvelle version, il suffira de téléverser la sa
[F] config.json Configuration du site
[F] core.json Configuration du noyau
[F] custom.css Feuille de style de la personnalisation avancée
[F] fonts.json Polices du site
[F] journal.log Journalisation des actions
[F] theme.css Thème du site
[F] theme.json Données du site

View File

@ -618,12 +618,7 @@ class template {
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
$attributes['selected'] = common::$inputBefore[$attributes['id']];
}
// Liste des polices à intégrer
if ($attributes['fonts'] === true) {
foreach ($options as $fontId) {
// echo "<link href='https://fonts.googleapis.com/css?family=".str_replace(" ", "+", $fontId)."' rel='stylesheet' type='text/css'>\n";
}
}
// Début du wrapper
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="inputWrapper ' . $attributes['classWrapper'] . '">';
// Label
@ -643,12 +638,13 @@ class template {
$html .= sprintf('<select %s>',
helper::sprintAttributes($attributes)
);
ksort($options);
foreach($options as $value => $text) {
$html .= $attributes['fonts'] === true ? sprintf(
'<option value="%s"%s style="font-family: %s;">%s</option>',
'<option value="%s"%s style="font-family: %s;"> %s </option>',
$value,
$attributes['selected'] == $value ? ' selected' : '', // Double == pour ignorer le type de variable car $_POST change les types en string
str_replace('+',' ',$value),
$value,
$text
) : sprintf(
'<option value="%s"%s>%s</option>',

View File

@ -165,6 +165,7 @@ class common {
private $user = [];
private $core = [];
private $config = [];
private $fonts =[];
// Dossier localisé
private $page = [];
private $module = [];
@ -182,7 +183,8 @@ class common {
'theme' => '',
'admin' => '',
'blacklist' => '',
'locale' => ''
'locale' => '',
'fonts' => ''
];
/**
@ -768,6 +770,7 @@ class common {
$this->setData(['page',$tempData['page']]);
$this->setData(['module',$tempData['module']]);
$this->setData(['theme',$tempData['theme']]);
$this->setData(['fonts',$tempData['fonts']]);
// Import des users sauvegardés si option active
if ($keepUsers === false
@ -2234,15 +2237,44 @@ class core extends common {
if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['theme'])))) {
// Version
$css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/';
// Import des polices de caractères version polices google
// $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']) . '");';
// Import sur le poste de l'utilisateur des polices auto hébergées
// Déclaration des polices
$tab=[];
$tab[0] = $this->getData(['theme', 'text', 'font']);
$tab[1] = $this->getData(['theme', 'title', 'font']);
$tab[2] = $this->getData(['theme', 'menu', 'font']);
$tab[3] = $this->getData(['theme', 'header', 'font']);
$tab[4] = $this->getData(['theme', 'footer', 'font']);
foreach( $tab as $key=>$value){
if( $this->getData(['fonts', $value, 'type' ]) === 'file'){
$file = $this->getData(['fonts', $value, 'file' ]);
$format ='';
switch (pathinfo($file, PATHINFO_EXTENSION)){
case 'ttf':
$format = 'truetype';
break;
case 'otf':
$format = 'opentype';
break;
case 'eot':
$format = 'embedded-opentype';
break;
case 'woff':
$format = 'woff';
break;
case 'woff2':
$format = 'woff2';
break;
}
$css .= '@font-face{ font-family: "'. $value .'"; src: url("'. helper::baseUrl(false). 'site/file/source/fonts/' . $file;
$css .= '") format("'. $format . '"); font-weight: normal; font-style: normal;}';
$css .= ' ';
}
}
// 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:"' . $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']) . '}';
@ -2260,7 +2292,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:"' . $this->getData(['theme', 'text', 'font']) . '",sans-serif}';
// Site dans TinyMCE
$css .= '.editorWysiwyg {background-color:' . $this->getData(['theme', 'site', 'backgroundColor']) . '; margin:0 !important; padding-top: 10px;}';
$css .= 'span.mce-text{background-color: unset !important;}';
@ -2301,7 +2333,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:"' . $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', 'backgroundTitleColor']));
@ -2337,7 +2369,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:"' . $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é
@ -2386,7 +2418,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:"' . $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']));
@ -2396,7 +2428,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:"' . $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}';
@ -2426,11 +2458,43 @@ class core extends common {
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
// Check la version rafraichissement du theme admin
$cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR.'admin.css'));
if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['admin'])))) {
// Check la mise à jour du theme admin
if( $this-> getData(['admin', 'maj']) === true){
// Version
$css = '/*' . md5(json_encode($this->getData(['admin']))) . '*/';
$this-> setData(['admin', 'maj', false]);
// Chargement des polices
if( is_file(self::DATA_DIR . 'fonts.json') ){
$json = file_get_contents( self::DATA_DIR . 'fonts.json');
$tab = json_decode($json, true);
foreach( $tab as $key=>$liste){
foreach ( $liste as $key=>$value ){
if( $value['type'] === 'file' ){
$format ='';
switch (pathinfo($value['file'], PATHINFO_EXTENSION)){
case 'ttf':
$format = 'truetype';
break;
case 'otf':
$format = 'opentype';
break;
case 'eot':
$format = 'embedded-opentype';
break;
case 'woff':
$format = 'woff';
break;
case 'woff2':
$format = 'woff2';
break;
}
$css .= '@font-face{ font-family: "'. $key .'"; src: url("'. helper::baseUrl(false). 'site/file/source/fonts/' . $value['file'];
$css .= '") format("'. $format . '"); font-weight: normal; font-style: normal;}';
$css .= ' ';
}
}
}
}
$colors = helper::colorVariants($this->getData(['admin','backgroundColor']));
$css .= '#site{background-color:' . $colors['normal']. ';}';
$css .= '.row > div {font:' . $this->getData(['admin','fontSize']) . ' "' . $this->getData(['admin','fontText']) . '", sans-serif;}';

View File

@ -4,10 +4,8 @@
*/
if ($this->getData(['core', 'dataVersion']) < 3201) {
// Mise à jour
$this->setData(['core', 'dataVersion', 3201]);
}
?>

View File

@ -14,12 +14,6 @@
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
/**
* Police des icônes
*/
@import url(https://use.fontawesome.com/releases/v5.7.2/css/all.css);
/**
* Éléments génériques
@ -1721,22 +1715,6 @@ th.col12 {
}
/* Traduction auto */
/*
* Supprimer Le tooltip Google
*
.goog-tooltip {
display: none !important;
}
.goog-tooltip:hover {
display: none !important;
}
.goog-text-highlight {
background-color: transparent !important;
border: none !important;
box-shadow: none !important;
} */
/* Emplacement des conditions d'utilisation */
#googTransLogo {
float: right;

View File

@ -112,6 +112,155 @@ class init extends common {
]
],
'module' => [],
'fonts'=> [
'liberation-sans'=> [
'name'=> 'Liberation Sans',
'type'=> 'file',
'file'=> 'liberationsans-rg.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'roboto'=> [
'name'=> 'Roboto',
'type'=> 'file',
'file'=> 'roboto-regular.woff',
'link'=> '',
'license'=> 'Apache 2.0'
],
'cooper-hewitt'=> [
'name'=> 'Cooper Hewitt',
'type'=> 'file',
'file'=> 'cooperhewitt-book.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'linux-biolinum'=> [
'name'=> 'Linux Biolinum',
'type'=> 'file',
'file'=> 'linbiolinum.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'now-regular'=> [
'name'=> 'Now Regular',
'type'=> 'file',
'file'=> 'now-regular.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'cousine'=> [
'name'=> 'Cousine',
'type'=> 'file',
'file'=> 'cousine-regular.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'montserrat'=> [
'name'=> 'Montserrat',
'type'=> 'file',
'file'=> 'montserrat-regular.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'trabajo'=> [
'name'=> 'Trabajo',
'type'=> 'file',
'file'=> 'trabajo.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'noto-serif-medium'=> [
'name'=> 'Noto Serif Medium',
'type'=> 'file',
'file'=> 'notoserif-medium.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'averia'=> [
'name'=> 'Averia',
'type'=> 'file',
'file'=> 'averia.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'space-text'=> [
'name'=> 'Space Text',
'type'=> 'file',
'file'=> 'spacetext-regular.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'avrile'=> [
'name'=> 'Avrile',
'type'=> 'file',
'file'=> 'avrilesansui-regular.woff',
'link'=> '',
'license'=> 'SIL Open Font License'
],
'comic-neue'=> [
'name'=> 'Comic Neue',
'type'=> 'file',
'file'=> 'comicneue-regular.woff',
'link'=> '',
'license'=> 'Open Font License'
],
'seanslab'=> [
'name'=> 'SeansLab',
'type'=> 'file',
'file'=> 'seanslab-wideregular.woff',
'link'=> '',
'license'=> ''
],
'lemon'=> [
'name'=> 'Lemon',
'type'=> 'file',
'file'=> 'lemon.woff',
'link'=> '',
'license'=> 'Open Font License'
],
'funtype'=> [
'name'=> 'Funtype',
'type'=> 'file',
'file'=> 'funtype.woff',
'link'=> '',
'license'=> 'OFL'
],
'remindsans'=> [
'name'=> 'RemindSans',
'type'=> 'file',
'file'=> 'remindsans-medium.woff',
'link'=> '',
'license'=> ''
],
'clayborn'=> [
'name'=> 'Clayborn',
'type'=> 'file',
'file'=> 'clayborn.woff',
'link'=> '',
'license'=> 'OFL'
],
'simply-sans-book'=> [
'name'=> 'Simply Sans Book',
'type'=> 'file',
'file'=> 'simplysans-book.woff',
'link'=> '',
'license'=> 'Open File License'
],
'heraclito'=> [
'name'=> 'Heraclito',
'type'=> 'file',
'file'=> 'heraclito-regular.woff',
'link'=> '',
'license'=> 'Open Font License'
],
'open-sauce-sans'=> [
'name'=> 'Open Sauce Sans',
'type'=> 'file',
'file'=> 'opensaucesans-regular.woff',
'link'=> '',
'license'=> 'Open Font Style'
]
],
'user' => [],
'theme' => [
'body' => [
@ -126,8 +275,8 @@ class init extends common {
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'Open+Sans',
'fontSize' => '.8em',
'font' => 'roboto',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '5px',
'loginLink' => true,
@ -145,7 +294,7 @@ class init extends common {
'displayVersion' => true,
'displaySiteMap' => true,
'displayCopyright' => false,
'displayCookie' => false,
'displayCookie' => true,
'displayLegal' => false,
'displaySearch' => false,
'displayMemberBar' => false,
@ -153,7 +302,7 @@ class init extends common {
],
'header' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'Oswald',
'font' => 'liberation-sans',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '200px',
@ -176,8 +325,8 @@ class init extends common {
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 0.85)',
'backgroundColorSub' => 'rgba(32, 59, 82, 1)',
'font' => 'Open+Sans',
'fontSize' => '1em',
'font' => 'roboto',
'fontSize' => '1.1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
'loginLink' => false,
@ -210,13 +359,13 @@ class init extends common {
'blockBorderShadow' => '3px 3px 6px',
],
'text' => [
'font' => 'Open+Sans',
'fontSize' => '13px',
'font' => 'roboto',
'fontSize' => '15px',
'textColor' => 'rgba(33, 34, 35, 1)',
'linkColor' => 'rgba(74, 105, 189, 1)'
],
'title' => [
'font' => 'Oswald',
'font' => 'liberation-sans',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
@ -228,9 +377,9 @@ class init extends common {
],
'admin' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'fontText' => 'open+Sans',
'fontText' => 'roboto',
'fontSize' => '13px',
'fontTitle' => 'Oswald',
'fontTitle' => 'liberation-sans',
'colorText' => 'rgba(33, 34, 35, 1)',
'colorTitle' => 'rgba(74, 105, 189, 1)',
'backgroundColorButton' => 'rgba(74, 105, 189, 1)',
@ -239,7 +388,8 @@ class init extends common {
'backgroundColorButtonGreen' => 'rgba(162, 223, 57, 1)',
'backgroundColorButtonHelp' => 'rgba(255, 153, 0, 1)',
'backgroundBlockColor' => 'rgba(236, 239, 241, 1)',
'borderBlockColor' => 'rgba(190, 202, 209, 1)'
'borderBlockColor' => 'rgba(190, 202, 209, 1)',
'maj' => true
],
'blacklist' => []
];
@ -416,6 +566,30 @@ class init extends common {
'hideMenuSide' => false,
'hideMenuChildren' =>false
],
'deltacms' => [
'typeMenu' => 'text',
'iconUrl' => '',
'disable' => false,
'content' => 'deltacms.html',
'hideTitle' => false,
'breadCrumb' => false,
'metaDescription' => '',
'metaTitle' => '',
'moduleId' => 'redirection',
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 4,
'group' => self::GROUP_VISITOR,
'targetBlank' => true,
'title' => 'Deltacms',
'shortTitle' => 'Deltacms',
'block' => '12',
'barLeft' => '',
'barRight' => '',
'displayMenu' => 'none',
'hideMenuSide' => false,
'hideMenuChildren' =>false
],
'contact' => [
'typeMenu' => 'text',
'iconUrl' => '',
@ -717,6 +891,10 @@ class init extends common {
'versionData' => '3.0'
],
],
'deltacms' => [
'url' => 'https://deltacms.fr/',
'count' => 0
],
'contact' => [
'config' => [
'button' => '',
@ -801,6 +979,9 @@ class init extends common {
'galeries' => [
'content' => '<p>Cette page contient une instance du module de galeries photos. Cliquez sur la galerie ci-dessous afin de voir les photos qu\'elle contient.</p>'
],
'deltacms' => [
'content' => ''
],
'contact' => [
'content' => '<p>Cette page contient un exemple de formulaire conçu à partir du module de génération de formulaires. Il est configuré pour envoyer les données saisies par mail aux administrateurs du site.</p>'
],

View File

@ -21,6 +21,10 @@ class theme extends common {
public static $actions = [
'advanced' => self::GROUP_ADMIN,
'body' => self::GROUP_ADMIN,
'fonts' => self::GROUP_ADMIN,
'editFonts' => self::GROUP_ADMIN,
'deleteFonts' => self::GROUP_ADMIN,
'addFonts' => self::GROUP_ADMIN,
'footer' => self::GROUP_ADMIN,
'header' => self::GROUP_ADMIN,
'index' => self::GROUP_ADMIN,
@ -42,38 +46,6 @@ class theme extends common {
'scroll' => 'Standard',
'fixed' => 'Fixe'
];
public static $fonts = [
'Arial' => 'Arial',
'Bodoni MT' => 'Bodoni MT',
'Baskerville' => 'Baskerville',
'Calibri' => 'Calibri',
'Calisto MT' => 'Calisto MT',
'Cambria' => 'Cambria',
'Candara' => 'Candara',
'Century Gothic' => 'Century Gothic',
'Consolas' => 'Consolas',
'Copperplate Gothic' => 'Copperplate Gothic',
'Courrier New' => 'Courrier New',
'Dejavu Sans' => 'Dejavu Sans',
'Didot' => 'Didot',
'Franklin Gothic' => 'Franklin Gothic',
'Garamond' => 'Garamond',
'Georgia' => 'Georgia',
'Goudy Old Style' => 'Goudy Old Style',
'Helvetica' => 'Helvetica',
'Impact' => 'Impact',
'Lucida Bright' => 'Lucida Bright',
'Lucida Sans' => 'Lucida Sans',
'Microsoft Sans Serif' => 'Microsoft Sans Serif',
'Optima' => 'Optima',
'Palatino' => 'Palatino',
'Perpetua' => 'Perpetua',
'Rockwell' => 'Rockwell',
'Segoe UI' => 'Segoe UI',
'Tahoma' => 'Tahoma',
'Trebuchet MS' => 'Trebuchet MS',
'Verdana' => 'Verdana'
];
public static $containerWides = [
'container' => 'Limitée au site',
'none' => 'Etendue sur la page'
@ -267,6 +239,17 @@ class theme extends common {
'title' => 'Titre du site',
'logo' => 'Logo du site'
];
// Fonts
public static $fonts = [];
public static $fontFiles =[];
public static $typeAddFont = [
'none' => 'Aucune',
'file' => 'Fichier local'
//'link' => 'Fichier externe avec link',
//'import' => 'Fichier externe avec import'
];
// Variable pour construire la liste des pages du site
public static $pagesList = [];
@ -292,6 +275,7 @@ class theme extends common {
'fontTitle' => $this->getInput('adminFontTitle'),
'backgroundBlockColor' => $this->getInput('adminBackGroundBlockColor'),
'borderBlockColor' => $this->getInput('adminBorderBlockColor'),
'maj' => true
]]);
// Valeurs en sortie
$this->addOutput([
@ -300,6 +284,7 @@ class theme extends common {
'state' => true
]);
}
self::$fonts = $this->extract('./site/data/fonts.json');
// Valeurs en sortie
$this->addOutput([
'title' => 'Administration',
@ -334,7 +319,177 @@ class theme extends common {
'view' => 'advanced'
]);
}
/**
* Gestion des polices / affichage principal
*/
public function fonts() {
// Préparation du tableau d'affichage des polices
$fontsName = helper::arrayCollumn($this->getData(['fonts']), 'name');
ksort($fontsName);
foreach($fontsName as $fontsId => $value) {
self::$fonts[] = [
'<span style="font-family:'.$fontsId.'">'.$fontsId.'</span>',
'<span style="font-family:'.$fontsId.'">'.$this->getData(['fonts', $fontsId, 'name']).'</span>',
'<span style="font-family:'.$fontsId.'">'.$this->getData(['fonts', $fontsId, 'file']).'</span>',
'<span style="font-family:'.$fontsId.'">TPQtpq741àéèôüç</span>',
template::button('fontsEdit' . $fontsId, [
'href' => helper::baseUrl() . 'theme/editFonts/' . $fontsId,
'value' => template::ico('pencil')
]),
template::button('fontsDelete' . $fontsId, [
'class' => 'fontDelete buttonRed',
'href' => helper::baseUrl() . 'theme/deleteFonts/' . $fontsId,
'value' => template::ico('cancel')
])
];
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Gestion des polices',
'view' => 'fonts'
]);
}
/**
* Gestion des polices / édition
*/
public function editfonts() {
// Retour du formulaire
if($this->isPost()) {
if( $this->getInput('typeEditFont') === 'file' && $this->getInput('fileEditFont') === 'Sélectionner le fichier...'){
// Valeurs en sortie
$this->addOutput([
'notification' => 'Vous devez sélectionner un fichier',
'redirect' => helper::baseUrl() . 'theme/fonts',
'state' => false
]);
}
else{
$file = $this->getInput('typeEditFont') === 'none' ? '' : $this->getInput('fileEditFont');
$key = strtolower(str_replace(' ','-',$this->getInput('nameEditFont')));
$this->setData(['fonts', $key, [
'name' => $this->getInput('nameEditFont'),
'type' => $this->getInput('typeEditFont'),
'file' => $file,
'link' => '',
'license' => $this->getInput('licenseEditFont')
]]);
// Force une maj de admin.css
$this-> setData(['admin', 'maj', true]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
'redirect' => helper::baseUrl() . 'theme/fonts',
'state' => true
]);
}
}
// Fichiers site/file/fonts/
if(is_dir(self::FILE_DIR.'source/fonts')) {
$dir=self::FILE_DIR.'source/fonts';
$values = scandir($dir);
$values[0] = 'Sélectionner le fichier...';
unset($values[array_search('..', $values)]);
if (count($values) <= 1){
self::$icsFiles = array(0 => 'Pas de fichier dans le dossier '.self::FILE_DIR.'source/fonts');
}
else{
//Modifier les clefs (qui sont les valeurs de retour du formulaire avec clef = valeur
self::$fontFiles = array_combine($values,$values);
}
}
else {
self::$fontFiles = array(0 => 'Dossier '.self::FILE_DIR.'source/fonts inexistant');
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Édition d\'une police',
'view' => 'editFonts'
]);
}
/**
* Gestion des polices / suppression
*/
public function deleteFonts() {
//Suppression de la police passée en paramètre
$this->deleteData(['fonts', $this->getUrl(2)]);
// Force une maj de admin.css
$this-> setData(['admin', 'maj', true]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Police supprimée',
'redirect' => helper::baseUrl() . 'theme/fonts',
'state' => true
]);
}
/**
* Gestion des polices / ajout
*/
public function addFonts() {
// Retour du formulaire
if($this->isPost()) {
if( $this->getInput('typeAddFont') === 'file' && $this->getInput('fileAddFont') === 'Sélectionner le fichier...'){
// Valeurs en sortie
$this->addOutput([
'notification' => 'Vous devez sélectionner un fichier',
'redirect' => helper::baseUrl() . 'theme/addFonts',
'state' => false
]);
}
else{
$file = $this->getInput('typeAddFont') === 'none' ? '' : $this->getInput('fileAddFont');
$key = strtolower(str_replace(' ','-',$this->getInput('nameAddFont')));
$this->setData(['fonts', $key, [
'name' => $this->getInput('nameAddFont'),
'type' => $this->getInput('typeAddFont'),
'file' => $file,
'link' => '',
'license' => $this->getInput('licenseAddFont')
]]);
// Force une maj de admin.css
$this-> setData(['admin', 'maj', true]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
'redirect' => helper::baseUrl() . 'theme/fonts',
'state' => true
]);
}
}
// Fichiers site/file/fonts/
if(is_dir(self::FILE_DIR.'source/fonts')) {
$dir=self::FILE_DIR.'source/fonts';
$values = scandir($dir);
$values[0] = 'Sélectionner le fichier...';
unset($values[array_search('..', $values)]);
if (count($values) <= 1){
self::$icsFiles = array(0 => 'Pas de fichier dans le dossier '.self::FILE_DIR.'source/fonts');
}
else{
//Modifier les clefs (qui sont les valeurs de retour du formulaire avec clef = valeur
self::$fontFiles = array_combine($values,$values);
}
}
else {
self::$fontFiles = array(0 => 'Dossier '.self::FILE_DIR.'source/fonts inexistant');
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Ajout d\'une police',
'view' => 'addFonts'
]);
}
/**
* Options de l'arrière plan
*/
@ -416,7 +571,7 @@ class theme extends common {
// Sauvegarder la configuration localisée
$this->setData(['locale','legalPageId', $this->getInput('configLegalPageId')]);
$this->setData(['locale','searchPageId', $this->getInput('configSearchPageId')]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
@ -434,7 +589,7 @@ class theme extends common {
unset(self::$pagesList[$page]);
}
}
self::$fonts = $this->extract('./site/data/fonts.json');
// Valeurs en sortie
$this->addOutput([
'title' => 'Personnalisation du pied de page',
@ -493,6 +648,7 @@ class theme extends common {
) {
$this->setData(['theme', 'menu', 'position','site']);
}
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
@ -500,6 +656,7 @@ class theme extends common {
'state' => true
]);
}
self::$fonts = $this->extract('./site/data/fonts.json');
// Valeurs en sortie
$this->addOutput([
'title' => 'Personnalisation de la bannière',
@ -552,6 +709,7 @@ class theme extends common {
'burgerLogo' => $this->getInput('themeMenuBurgerLogo'),
'burgerContent' => $this->getInput('themeMenuBurgerContent')
]]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
@ -559,6 +717,7 @@ class theme extends common {
'state' => true
]);
}
self::$fonts = $this->extract('./site/data/fonts.json');
// Valeurs en sortie
$this->addOutput([
'title' => 'Personnalisation du menu',
@ -648,6 +807,7 @@ class theme extends common {
'blockBorderRadius' => $this->getInput('themeBlockBorderRadius'),
'blockBorderShadow' => $this->getInput('themeBlockBorderShadow')
]]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
@ -655,6 +815,7 @@ class theme extends common {
'state' => true
]);
}
self::$fonts = $this->extract('./site/data/fonts.json');
// Valeurs en sortie
$this->addOutput([
'title' => 'Personnalisation du site',
@ -874,36 +1035,19 @@ class theme extends common {
}
/*
*
* Extraction des noms des polices de fonts.json vers self::$fonts
*/
/*
private function changeName($path = '.')
{
$ignore = array('cgi-bin', '.', '..');
if(is_dir($path)){
if($dir = opendir($path)){
while(false !== ($file = readdir($dir))) {
if(!in_array($file, $ignore)) {
if(is_dir("$path$file")) {
$this->changeName( "$path$file/");
}
else {
$oldName = $file;
$newName = date("YmdHi").$file;
rename("$path$oldName", "$path$newName");
// Modification du nom de fichier dans .../import/site/data/theme.json
$fileTheme = './site/file/import/site/data/theme.json';
if(file_exists($fileTheme)){
$json = file_get_contents($fileTheme);
$json = str_replace($oldName, $newName, $json);
file_put_contents($fileTheme,$json);
}
}
}
}
closedir($dir);
private function extract( $file) {
$fonts = [];
if (file_exists($file)){
$json = file_get_contents($file);
$fonts1 = json_decode($json, true);
$fonts2 = $fonts1['fonts'];
foreach ($fonts2 as $key=>$value){
$fonts[$key] = $value['name'];
}
return $fonts;
}
}
*/
}

View File

@ -0,0 +1,20 @@
/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,25 @@
/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
/**
* Confirmation de suppression
*/
$(".fontDelete").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir supprimer cette police ?", function() {
$(location).attr("href", _this.attr("href"));
});
});

View File

@ -0,0 +1,65 @@
<?php echo template::formOpen('themeAddFonts'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('themeFontsBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme/fonts',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeSiteHelp', [
'href' => 'https://doc.deltacms.fr/polices',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::submit('addFontSubmit'); ?>
</div>
</div>
<div class="block">
<h4>Paramètres de la nouvelle police</h4>
<div class="row">
<div class="col4">
<?php echo template::text('nameAddFont', [
'autocomplete' => 'off',
'label' => 'Nom',
'help' => 'Nom de la police, majuscules et espaces autorisés'
]); ?>
</div>
<div class="col4">
<?php echo template::select('typeAddFont', $module::$typeAddFont, [
'label' => 'Liaison avec un fichier de police',
'selected' => 'file',
'help' => 'Le fichier de police est envoyé, ou pas, depuis un dépôt local'
]); ?>
</div>
<div class="col4">
<!-- Sélection d'un fichier font -->
<?php echo template::select('fileAddFont', $module::$fontFiles, [
'help' => 'Vous devez au préalable téléverser le fichier de police, ttf, woff, otf, eot ou woff2 dans le dossier fonts avec le gestionnaire de fichiers.',
'label' => 'Sélection d\'une police'
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::text('licenseAddFont', [
'autocomplete' => 'off',
'label' => 'License',
'help' => 'Type de license de la police'
]); ?>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -0,0 +1,20 @@
/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,16 @@
/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/

View File

@ -0,0 +1,67 @@
<?php echo template::formOpen('themeEditFonts'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('themeFontsBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme/fonts',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeSiteHelp', [
'href' => 'https://doc.deltacms.fr/polices',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::submit('editFontSubmit'); ?>
</div>
</div>
<div class="block">
<h4>Paramètres de la police </h4>
<div class="row">
<div class="col4">
<?php echo template::text('nameEditFont', [
'value' => $this->getData(['fonts', $this->getUrl(2),'name']),
'label' => 'Nom de la police sélectionnée',
'readonly' => true,
'help' => 'Valeur non modifiable'
]); ?>
</div>
<div class="col4">
<?php echo template::select('typeEditFont', $module::$typeAddFont, [
'label' => 'Liaison avec un fichier de police',
'selected' => $this->getData(['fonts', $this->getUrl(2),'type']),
'help' => 'Le fichier de police est envoyé, ou pas, depuis un dépôt local'
]); ?>
</div>
<div class="col4">
<!-- Sélection d'un fichier font -->
<?php $key = array_search( $this->getData(['fonts', $this->getUrl(2),'file']), $module::$fontFiles);
echo template::select('fileEditFont', $module::$fontFiles, [
'selected' => $key,
'help' => 'Vous devez au préalable téléverser le fichier de police, ttf, woff, otf, eot ou woff2 dans le dossier fonts avec le gestionnaire de fichiers.',
'label' => 'Sélection d\'une police'
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::text('licenseEditFont', [
'value' => $this->getData(['fonts', $this->getUrl(2),'license']),
'label' => 'License',
'help' => 'Type de license de la police'
]); ?>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -0,0 +1,20 @@
/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,25 @@
/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
/**
* Confirmation de suppression
*/
$(".fontDelete").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir supprimer cette police ?", function() {
$(location).attr("href", _this.attr("href"));
});
});

View File

@ -0,0 +1,28 @@
<div class="row">
<div class="col2">
<?php echo template::button('themeFontsBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeSiteHelp', [
'href' => 'https://doc.deltacms.fr/polices',
'target' => '_blank',
'ico' => 'help',
'value' => 'Aide',
'class' => 'buttonHelp'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('fontAdd', [
'href' => helper::baseUrl() . 'theme/addFonts',
'ico' => 'plus',
'value' => 'Police'
]); ?>
</div>
</div>
<?php echo template::table([2, 2, 3, 3, 1, 1], $module::$fonts, ['Identifiant', 'Nom', 'Fichier', 'Aperçu', '', '']); ?>

View File

@ -18,9 +18,7 @@
* Aperçu en direct
*/
$("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 + "');";
// Couleurs du pied de page
var colors = core.colorVariants($("#themeFooterBackgroundColor").val());
var textColor = $("#themeFooterTextColor").val();

View File

@ -81,9 +81,7 @@ $("input, select").on("change", function() {
tmpImg.src= "<?php echo helper::baseUrl(false); ?>" + "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 + "');";
css = "header{text-align:" + $("#themeHeaderTextAlign").val() + ";";
if ($("#themeHeaderImage").val()) {