Merge branch '114_dev' into 12_dev
This commit is contained in:
commit
d24379e1cf
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
class template {
|
||||
class template {
|
||||
|
||||
/**
|
||||
* Crée un bouton
|
||||
@ -120,7 +120,7 @@ class template {
|
||||
copy ('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$firstNumber] . '.png', 'site/tmp/' . $firstLetter . '.png');
|
||||
copy ('core/vendor/zwiico/png/' . $attributes['type'] . '/' . $letters[$secondNumber] . '.png', 'site/tmp/' . $secondLetter . '.png');
|
||||
|
||||
|
||||
|
||||
// Début du wrapper
|
||||
$html = '<div id="' . $attributes['id'] . 'Wrapper" class="captcha inputWrapper ' . $attributes['classWrapper'] . '">';
|
||||
// Label
|
||||
@ -449,7 +449,7 @@ class template {
|
||||
$lang = 'fr';
|
||||
}
|
||||
}
|
||||
return '<img class="flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $lang . '.png"
|
||||
return '<img class="flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $lang . '.png"
|
||||
width="' . $size .'"
|
||||
height="' . $size .'"
|
||||
title="' . $lang .'"
|
||||
@ -614,8 +614,13 @@ class template {
|
||||
'label' => '',
|
||||
'name' => $nameId,
|
||||
'selected' => '',
|
||||
'fonts' => false
|
||||
'fonts' => []
|
||||
], $attributes);
|
||||
// Stocker les fontes et remettre à zéro le tableau des fontes transmis pour éviter une erreur de sprintAttributes
|
||||
if (empty($attributes['fonts']) === false) {
|
||||
$fonts = $attributes['fonts'];
|
||||
$attributes['fonts'] = [];
|
||||
}
|
||||
// Sauvegarde des données en cas d'erreur
|
||||
if($attributes['before'] AND array_key_exists($attributes['id'], common::$inputBefore)) {
|
||||
$attributes['selected'] = common::$inputBefore[$attributes['id']];
|
||||
@ -628,7 +633,7 @@ class template {
|
||||
'help' => $attributes['help']
|
||||
]);
|
||||
}
|
||||
// Notice
|
||||
// Notice
|
||||
$notice = '';
|
||||
if(array_key_exists($attributes['id'], common::$inputNotices)) {
|
||||
$notice = common::$inputNotices[$attributes['id']];
|
||||
@ -640,12 +645,14 @@ class template {
|
||||
helper::sprintAttributes($attributes)
|
||||
);
|
||||
foreach($options as $value => $text) {
|
||||
$html .= $attributes['fonts'] === true ? sprintf(
|
||||
// Select des liste de fontes
|
||||
$html .= isset($fonts) ? sprintf(
|
||||
'<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
|
||||
$text,
|
||||
$fonts[$value],
|
||||
$text
|
||||
// Select standard
|
||||
) : sprintf(
|
||||
'<option value="%s"%s>%s</option>',
|
||||
$value,
|
||||
|
169
core/core.php
169
core/core.php
@ -183,14 +183,9 @@ class common {
|
||||
'font-family' => 'Arial, Helvetica, sans-serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'arial-black' => [
|
||||
'name' => 'Arial Black',
|
||||
'font-family' => '\'Arial Black\', Gadget, sans-serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'courrier' => [
|
||||
'name' => 'Courier',
|
||||
'font-family' => 'Courier, \'Liberation Mono\', monospace',
|
||||
'arvo'=> [
|
||||
'name' => 'Arvo',
|
||||
'font-family' => 'Arvo, sans-serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'courrier-new' => [
|
||||
@ -213,11 +208,21 @@ class common {
|
||||
'font-family' => 'Impact, Charcoal, sans-serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'lora'=> [
|
||||
'name' => 'Lora',
|
||||
'font-family' => 'Lora, serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'lucida' => [
|
||||
'name' => 'Lucida',
|
||||
'font-family' => '\'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'roboto'=> [
|
||||
'name' => 'Roboto',
|
||||
'font-family' => 'Roboto, sans-serif',
|
||||
'resource' => 'websafe'
|
||||
],
|
||||
'tahoma' => [
|
||||
'name' => 'Tahoma',
|
||||
'font-family' => 'Tahoma, Geneva, sans-serif',
|
||||
@ -1321,9 +1326,6 @@ class common {
|
||||
*/
|
||||
echo '<div class="'. $content . '" id="contentSite">';
|
||||
$this->showContent();
|
||||
if (file_exists(self::DATA_DIR . 'body.inc.html')) {
|
||||
include(self::DATA_DIR . 'body.inc.html');
|
||||
}
|
||||
echo '</div>';
|
||||
/**
|
||||
* Barre droite
|
||||
@ -2105,14 +2107,18 @@ class common {
|
||||
// Import des styles liés à la page
|
||||
if($this->output['style']) {
|
||||
echo '<base href="' . helper::baseUrl(true) .'">';
|
||||
// Import de la feuille de style des pages admin
|
||||
if (strpos($this->output['style'], 'admin.css') >= 1 ) {
|
||||
echo '<link rel="stylesheet" href="' . self::DATA_DIR . 'admin.css?' . md5_file(self::DATA_DIR .'admin.css') . '">';
|
||||
}
|
||||
echo '<style type="text/css">' . helper::minifyCss($this->output['style']) . '</style>';
|
||||
}
|
||||
// Import des fontes liées au thème
|
||||
if (file_exists(self::DATA_DIR.'fonts/fonts.html')) {
|
||||
include_once(self::DATA_DIR.'fonts/fonts.html');
|
||||
// Import des fontes
|
||||
if ( file_exists(self::DATA_DIR . 'fonts/fonts.html') ){
|
||||
include_once(self::DATA_DIR . 'fonts/fonts.html');
|
||||
}
|
||||
if ( file_exists(self::DATA_DIR . 'fonts/fonts.css') ){
|
||||
echo '<link rel="stylesheet" href="' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/fonts.css?' . md5_file(self::DATA_DIR .'fonts/fonts.css') . '">';
|
||||
}
|
||||
}
|
||||
|
||||
@ -2283,73 +2289,18 @@ class core extends common {
|
||||
// Version
|
||||
$css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/';
|
||||
|
||||
|
||||
/**
|
||||
* Import des polices de caractères
|
||||
* A partir du CDN
|
||||
* ou dans le dossier site/file/source/fonts
|
||||
* ou pas du tout si fonte webSafe
|
||||
*/
|
||||
|
||||
// Fonts disponibles
|
||||
$fontsAvailable ['files'] = $this->getData(['fonts', 'files']);
|
||||
$fontsAvailable ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$fontsAvailable ['websafe'] = self::$fontsWebSafe;
|
||||
|
||||
// Fontes installées
|
||||
$fonts = [ $this->getData(['theme', 'text', 'font']),
|
||||
$this->getData(['theme', 'title', 'font']),
|
||||
$this->getData(['theme', 'header', 'font']),
|
||||
$this->getData(['theme', 'menu', 'font']),
|
||||
$this->getData(['theme', 'footer', 'font'])
|
||||
];
|
||||
// Suppression des polices identiques
|
||||
$fonts = array_unique($fonts);
|
||||
|
||||
/**
|
||||
* Charge les fontes websafe
|
||||
*/
|
||||
foreach ($fonts as $fontId) {
|
||||
if ( isset($fontsAvailable['websafe'][$fontId])) {
|
||||
$fonts [$fontId] = $fontsAvailable['websafe'][$fontId]['font-family'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php
|
||||
*/
|
||||
$fontFile = '';
|
||||
$gf = false;
|
||||
foreach ($fonts as $fontId) {
|
||||
if ( isset($fontsAvailable['imported'][$fontId])) {
|
||||
$fontFile .= '<link href="' . $fontsAvailable['imported'][$fontId]['resource'] .'" rel="stylesheet">';
|
||||
// Tableau pour la construction de la feuille de style
|
||||
$fonts [$fontId] = $fontsAvailable['imported'][$fontId]['font-family'];
|
||||
$gf = strpos($fontsAvailable['imported'][$fontId]['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true;
|
||||
}
|
||||
}
|
||||
// Ajoute le préconnect des fontes Google.
|
||||
$fontFile = $gf ? '<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>' . $fontFile
|
||||
: $fontFile;
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fontFile);
|
||||
|
||||
/**
|
||||
* Fontes installées localement
|
||||
*/
|
||||
foreach ($fonts as $fontId) {
|
||||
// Validité du tableau :
|
||||
if ( isset($fontsAvailable['files'][$fontId]) ) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontId) ) {
|
||||
// Chargement de la police
|
||||
//$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName);
|
||||
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
|
||||
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' .$fontsAvailable['files'][$fontId]['resource'] . '");}';
|
||||
// Tableau pour la construction de la feuille de style
|
||||
$fonts [$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
|
||||
} else {
|
||||
// Le fichier de font n'est pas disponible, fonte par défaut
|
||||
$fonts [$fontId] = 'verdana';
|
||||
$f ['files'] = $this->getData(['fonts', 'files']);
|
||||
$f ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f ['websafe'] = self::$fontsWebSafe;
|
||||
// Construit un tableau avec leur ID et leur famille
|
||||
foreach(['websafe', 'imported', 'files'] as $type) {
|
||||
if (is_array($f[$type])) {
|
||||
foreach ($f[$type] as $fontId => $fontValue ) {
|
||||
$fonts[$fontId] = $fontValue['font-family'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2520,12 +2471,6 @@ class core extends common {
|
||||
$css .= '#footerText > p {text-align:' . $this->getData(['theme', 'footer', 'textAlign']) . '}';
|
||||
$css .= '#footerCopyright{text-align:' . $this->getData(['theme', 'footer', 'copyrightAlign']) . '}';
|
||||
|
||||
// Enregistre les fontes
|
||||
if (!is_dir(self::DATA_DIR . 'fonts')) {
|
||||
mkdir(self::DATA_DIR . 'fonts');
|
||||
}
|
||||
file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fontFile);
|
||||
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'theme.css', $css);
|
||||
|
||||
@ -2544,60 +2489,18 @@ class core extends common {
|
||||
// Version
|
||||
$css = '/*' . md5(json_encode($this->getData(['admin']))) . '*/';
|
||||
|
||||
// Fonts disponibles
|
||||
$fontsAvailable ['files'] = $this->getData(['fonts', 'files']);
|
||||
$fontsAvailable ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$fontsAvailable ['websafe'] = self::$fontsWebSafe;
|
||||
|
||||
/**
|
||||
* Import des polices de caractères
|
||||
* A partir du CDN ou dans le dossier site/file/source/fonts
|
||||
*/
|
||||
$fonts = [ $this->getData(['admin', 'fontText']),
|
||||
$this->getData(['admin', 'fontTitle']),
|
||||
];
|
||||
// Suppression des polices identiques
|
||||
$fonts = array_unique($fonts);
|
||||
|
||||
/**
|
||||
* Charge les fontes websafe
|
||||
*/
|
||||
foreach ($fonts as $fontId) {
|
||||
if ( isset($fontsAvailable['websafe'][$fontId])) {
|
||||
$fonts [$fontId] = $fontsAvailable['websafe'][$fontId]['font-family'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php
|
||||
*/
|
||||
$fontFile = '';
|
||||
foreach ($fonts as $fontId) {
|
||||
if ( isset($fontsAvailable['imported'][$fontId])) {
|
||||
$fontFile .= '<link href="' . $fontsAvailable['imported'][$fontId]['resource'] .'" rel="stylesheet">';
|
||||
// Tableau pour la construction de la feuille de style
|
||||
$fonts [$fontId] = $fontsAvailable['imported'][$fontId]['font-family'];
|
||||
}
|
||||
}
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fontFile);
|
||||
|
||||
/**
|
||||
* Fontes installées localement
|
||||
*/
|
||||
foreach ($fonts as $fontId) {
|
||||
// Validité du tableau :
|
||||
if ( isset($fontsAvailable['files'][$fontId]) ) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontId) ) {
|
||||
// Chargement de la police
|
||||
//$formatFont = explode('.', self::DATA_DIR . 'fonts/' . $fontName);
|
||||
$css .= '@font-face {font-family:"' . $fontsAvailable['files'][$fontId]['font-family'] . '";';
|
||||
$css .= 'src: url("' . helper::baseUrl(false) . self::DATA_DIR . 'fonts/' .$fontsAvailable['files'][$fontId]['resource'] . '");}';
|
||||
// Tableau pour la construction de la feuille de style
|
||||
$fonts [$fontId] = $fontsAvailable['files'][$fontId]['font-family'];
|
||||
} else {
|
||||
// Le fichier de font n'est pas disponible, fonte par défaut
|
||||
$fonts [$fontId] = 'verdana';
|
||||
$f ['files'] = $this->getData(['fonts', 'files']);
|
||||
$f ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f ['websafe'] = self::$fontsWebSafe;
|
||||
// Construit un tableau avec leur ID et leur famille
|
||||
foreach(['websafe', 'imported', 'files'] as $type) {
|
||||
if (is_array($f[$type])) {
|
||||
foreach ($f[$type] as $fontId => $fontValue ) {
|
||||
$fonts[$fontId] = $fontValue['font-family'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -705,11 +705,6 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'font-family' => 'Arimo, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/arimo'
|
||||
],
|
||||
'arvo'=> [
|
||||
'name' => 'Arvo',
|
||||
'font-family' => 'Arvo, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/arvo'
|
||||
],
|
||||
'dancing-script' => [
|
||||
'name' => 'Dancing Script',
|
||||
'font-family' => '\'Dancing Script\', sans-serif',
|
||||
@ -733,7 +728,7 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'fira-sans' => [
|
||||
'name' => 'Fira Sans',
|
||||
'font-family' => '\'Fira Sans\', sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/fira'
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/fira-sans'
|
||||
],
|
||||
'liberation-sans'=> [
|
||||
'name' => 'Liberation Sans',
|
||||
@ -755,11 +750,6 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'font-family' => 'Lato, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/lato'
|
||||
],
|
||||
'lora'=> [
|
||||
'name' => 'Lora',
|
||||
'font-family' => 'Lora, serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/lora'
|
||||
],
|
||||
'old-standard-tt-3'=> [
|
||||
'name' => 'Old Standard TT',
|
||||
'font-family' => '\'Old Standard TT\', serif',
|
||||
@ -790,11 +780,6 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
'font-family' => 'Rancho, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/rancho'
|
||||
],
|
||||
'roboto'=> [
|
||||
'name' => 'Roboto',
|
||||
'font-family' => 'Roboto, sans-serif',
|
||||
'resource' => 'https://fonts.cdnfonts.com/css/roboto'
|
||||
],
|
||||
'ubuntu'=> [
|
||||
'name' => 'Ubuntu',
|
||||
'font-family' => 'Ubuntu, sans-serif',
|
||||
@ -811,7 +796,8 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
$files = $this->getData(['fonts', 'files']);
|
||||
if (is_array($files)) {
|
||||
foreach ($files as $fontId => $fontName) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontName)) {
|
||||
if ( gettype($fontName) === 'string'
|
||||
&& file_exists(self::DATA_DIR . 'fonts/' . $fontName)) {
|
||||
$this->setData(['fonts', 'files', $fontId, [
|
||||
'name' => ucfirst($fontId),
|
||||
'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
@ -825,11 +811,13 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
$imported = $this->getData(['fonts', 'imported']);
|
||||
if (is_array($imported)) {
|
||||
foreach ($imported as $fontId => $fontUrl) {
|
||||
$this->setData(['fonts', 'imported', $fontId, [
|
||||
'name' => ucfirst($fontId),
|
||||
'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl
|
||||
]]);
|
||||
if ( gettype($fontUrl) === 'string' ) {
|
||||
$this->setData(['fonts', 'imported', $fontId, [
|
||||
'name' => ucfirst($fontId),
|
||||
'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif',
|
||||
'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl
|
||||
]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Importation des fontes exemples
|
||||
@ -861,7 +849,7 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
|
||||
*/
|
||||
|
||||
// Suppression de la variable URL dans core
|
||||
//$this->deleteData(['core', 'baseUrl']);
|
||||
$this->deleteData(['core', 'baseUrl']);
|
||||
|
||||
// Mise à jour
|
||||
$this->setData(['core', 'dataVersion', 11400]);
|
||||
|
@ -13,7 +13,8 @@
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/blank.css">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>theme.css?<?php echo md5_file(self::DATA_DIR.'theme.css'); ?>">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>"></head>
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php $this->showContent(); ?>
|
||||
<?php $this->showScript(); ?>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css?<?php echo md5_file('core/layout/common.css');?>">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>theme.css?<?php echo md5_file(self::DATA_DIR.'theme.css'); ?>">
|
||||
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>">
|
||||
|
||||
<!-- Détection RSS -->
|
||||
<?php if ( ( $this->getData(['page', $this->getUrl(0), 'moduleId']) === 'blog'
|
||||
OR $this->getData(['page', $this->getUrl(0), 'moduleId']) === 'news' )
|
||||
@ -20,6 +21,7 @@
|
||||
<link rel="alternate" type="application/rss+xml" href="'<?php echo helper::baseUrl(). $this->getUrl(0) . '/rss';?>" title="fLUX rss">
|
||||
<?php endif; ?>
|
||||
<?php $this->showStyle(); ?>
|
||||
<!-- Script perso dans le header -->
|
||||
<?php if (file_exists(self::DATA_DIR .'head.inc.html')) {
|
||||
include(self::DATA_DIR .'head.inc.html');
|
||||
}?>
|
||||
@ -186,6 +188,10 @@
|
||||
<?php $this->showCookies(); ?>
|
||||
<!-- Les scripts -->
|
||||
<?php $this->showScript();?>
|
||||
|
||||
<!-- Script perso dans body -->
|
||||
<?php if (file_exists(self::DATA_DIR . 'body.inc.html')) {
|
||||
include(self::DATA_DIR . 'body.inc.html');
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -583,8 +583,6 @@ class config extends common {
|
||||
// Change le statut de la réécriture d'URL (pour le helper::baseUrl() de la redirection)
|
||||
helper::$rewriteStatus = false;
|
||||
}
|
||||
// Met à jour la baseUrl
|
||||
$this->setData(['core', 'baseUrl', helper::baseUrl(true,false) ]);
|
||||
}
|
||||
// Générer robots.txt et sitemap
|
||||
$this->siteMap();
|
||||
|
@ -122,9 +122,6 @@ class install extends common {
|
||||
mkdir(self::DATA_DIR . 'fonts');
|
||||
}
|
||||
|
||||
// Stocker le dossier d'installation
|
||||
$this->setData(['core', 'baseUrl', helper::baseUrl(false,false) ]);
|
||||
|
||||
// Installation du thème sélectionné
|
||||
$dataThemes = file_get_contents('core/module/install/ressource/themes/themes.json');
|
||||
$dataThemes = json_decode($dataThemes, true);
|
||||
|
@ -57,12 +57,11 @@ class init extends common {
|
||||
]
|
||||
],
|
||||
'core' => [
|
||||
'dataVersion' => 11300,
|
||||
'dataVersion' => 11400,
|
||||
'lastBackup' => 0,
|
||||
'lastClearTmp' => 0,
|
||||
'lastAutoUpdate' => 0,
|
||||
'updateAvailable' => false,
|
||||
'baseUrl' => ''
|
||||
'updateAvailable' => false
|
||||
],
|
||||
'locale' => [
|
||||
'homePageId' => 'accueil',
|
||||
|
@ -232,7 +232,8 @@ class theme extends common {
|
||||
// Variable pour construire la liste des pages du site
|
||||
public static $pagesList = [];
|
||||
// Variable pour construire la liste des fontes installées
|
||||
public static $fontsList = [];
|
||||
public static $fontsNames= [];
|
||||
public static $fonts = [];
|
||||
// Variable pour détailler les fontes installées
|
||||
public static $fontsDetail = [];
|
||||
|
||||
@ -267,6 +268,8 @@ class theme extends common {
|
||||
}
|
||||
// Lire les fontes installées
|
||||
$this->enumFonts();
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Administration',
|
||||
@ -403,6 +406,8 @@ class theme extends common {
|
||||
}
|
||||
// Lire les fontes installées
|
||||
$this->enumFonts();
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du pied de page',
|
||||
@ -481,6 +486,8 @@ class theme extends common {
|
||||
}
|
||||
// Lire les fontes installées
|
||||
$this->enumFonts();
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation de la bannière',
|
||||
@ -496,6 +503,10 @@ class theme extends common {
|
||||
* Accueil de la personnalisation
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
// Restaurer les fontes utilisateurs
|
||||
$this->setFonts('user');
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation des thèmes',
|
||||
@ -542,6 +553,8 @@ class theme extends common {
|
||||
}
|
||||
// Lire les fontes installées
|
||||
$this->enumFonts();
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du menu',
|
||||
@ -557,6 +570,9 @@ class theme extends common {
|
||||
*/
|
||||
public function fonts() {
|
||||
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
|
||||
// Polices liées au thème
|
||||
$used = [
|
||||
'Bannière' => $this->getData (['theme', 'header', 'font']),
|
||||
@ -652,7 +668,7 @@ class theme extends common {
|
||||
if ( $type === 'files' &&
|
||||
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
||||
) {
|
||||
copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . $ressource );
|
||||
copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource );
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -703,7 +719,7 @@ class theme extends common {
|
||||
if ( $type === 'files' &&
|
||||
file_exists(self::FILE_DIR . 'source/' . $ressource)
|
||||
) {
|
||||
copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . $ressource );
|
||||
copy ( self::FILE_DIR . 'source/' . $ressource, self::DATA_DIR . 'fonts/' . $ressource );
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
@ -839,6 +855,8 @@ class theme extends common {
|
||||
}
|
||||
// Lire les fontes installées
|
||||
$this->enumFonts();
|
||||
// Toutes les fontes installées sont chargées
|
||||
$this->setFonts('all');
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Personnalisation du site',
|
||||
@ -1124,7 +1142,11 @@ class theme extends common {
|
||||
// Retourne un tableau simple des fonts installées idfont avec le nom
|
||||
// Cette fonction est utile aux sélecteurs de fonts dans les formulaires.
|
||||
public function enumFonts() {
|
||||
// Récupère la liste des fontes installées
|
||||
/**
|
||||
* Récupère la liste des fontes installées et construit deux tableaux
|
||||
* id - nom
|
||||
* id - font-family - resource
|
||||
*/
|
||||
$f ['files'] = $this->getData(['fonts', 'files']);
|
||||
$f ['imported'] = $this->getData(['fonts', 'imported']);
|
||||
$f ['websafe'] = self::$fontsWebSafe;
|
||||
@ -1132,12 +1154,87 @@ class theme extends common {
|
||||
foreach(['websafe', 'imported', 'files'] as $type) {
|
||||
if (is_array($f[$type])) {
|
||||
foreach ($f[$type] as $fontId => $fontValue ) {
|
||||
$fonts [$fontId] = $fontValue['name'];
|
||||
self::$fonts['name'][$fontId] = $fontValue['name'];
|
||||
self::$fonts['family'][$fontId] = $fontValue['font-family'];
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($fonts);
|
||||
self::$fontsList = $fonts;
|
||||
// Liste des fontes pour les sélecteurs
|
||||
ksort(self::$fonts['name']);
|
||||
ksort(self::$fonts['family']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Création d'un fichier de liens d'appel des fontes
|
||||
* @param string $scope vaut all pour toutes les fontes ; 'user' pour les fontes utilisateurs
|
||||
*/
|
||||
private function setFonts($scope = 'all') {
|
||||
|
||||
// Filtrage par fontes installées
|
||||
$fontsInstalled = [ $this->getData(['theme', 'text', 'font']),
|
||||
$this->getData(['theme', 'title', 'font']),
|
||||
$this->getData(['theme', 'header', 'font']),
|
||||
$this->getData(['theme', 'menu', 'font']),
|
||||
$this->getData(['theme', 'footer', 'font']),
|
||||
$this->getData(['admin', 'fontText']),
|
||||
$this->getData(['admin', 'fontTitle']),
|
||||
];
|
||||
|
||||
// Compression
|
||||
$fontsInstalled = array_unique($fontsInstalled);
|
||||
|
||||
/**
|
||||
* Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php
|
||||
*/
|
||||
$gf = false;
|
||||
$fileContent = '<!-- Fontes personnalisées -->';
|
||||
foreach ($this->getData(['fonts', 'imported']) as $fontId => $fontValue) {
|
||||
if (
|
||||
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
||||
|| $scope === 'all'
|
||||
) {
|
||||
//Pré chargement à revoir
|
||||
//$fileContent .= '<link rel="preload" href="' . $fontValue['resource'] . '" crossorigin="anonymous" as="style">';
|
||||
$fileContent .= '<link href="' . $fontValue['resource'] .'" rel="stylesheet">';
|
||||
// Pré connect pour api.google
|
||||
$gf = strpos($fontValue['resource'], 'fonts.googleapis.com') === false ? $gf || false : $gf || true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ajoute le préconnect des fontes Googles.
|
||||
$fileContent = $gf ? '<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>' . $fileContent
|
||||
: $fileContent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fontes installées localement
|
||||
*/
|
||||
$fileContentCss = '';
|
||||
foreach ($this->getData(['fonts', 'files']) as $fontId => $fontValue) {
|
||||
if (
|
||||
( $scope === 'user' && in_array($fontId, $fontsInstalled) )
|
||||
|| $scope === 'all'
|
||||
) {
|
||||
if (file_exists(self::DATA_DIR . 'fonts/' . $fontValue['resource']) ) {
|
||||
// Extension
|
||||
$path_parts = pathinfo(helper::baseUrl(false) . self::DATA_DIR . 'fonts/' . $fontValue['resource']);
|
||||
// Chargement de la police
|
||||
$fileContentCss .= '@font-face {' ;
|
||||
$fileContentCss .= 'font-family:"' . $fontId . '";';
|
||||
$fileContentCss .= 'src: url("' . $fontValue['resource'] . '") format("' . $path_parts['extension'] . '");';
|
||||
$fileContentCss .= '}' ;
|
||||
// Préchargement
|
||||
//$fileContent = '<link rel="preload" href="' . self::DATA_DIR . 'fonts/' . $fontValue['resource'] . '" type="font/woff" crossorigin="anonymous" as="font">' . $fileContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'fonts/fonts.html', $fileContent);
|
||||
// Enregistre la personnalisation
|
||||
file_put_contents(self::DATA_DIR.'fonts/fonts.css', $fileContentCss);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -128,10 +128,10 @@
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('adminFontText', $module::$fontsList, [
|
||||
<?php echo template::select('adminFontText', $module::$fonts['name'], [
|
||||
'label' => 'Police du texte',
|
||||
'selected' => $this->getData(['admin', 'fontText']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
@ -141,10 +141,10 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('adminFontTitle', $module::$fontsList, [
|
||||
<?php echo template::select('adminFontTitle', $module::$fonts['name'], [
|
||||
'label' => 'Police des titres',
|
||||
'selected' => $this->getData(['admin', 'fontTitle']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('fontAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('fontAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme/fonts',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('fontAddHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/fontes#add',
|
||||
'target' => '_blank',
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('fontAddPublish', [
|
||||
'value' => 'Valider',
|
||||
'uniqueSubmission' => true
|
||||
|
@ -10,35 +10,50 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Option par défaut du sélecteur de mode
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$('input[name=fontEditFontImported]').prop('checked', true);
|
||||
$('input[name=fontEditFontUrl]').prop('checked', false);
|
||||
$('#containerfontEditFile').hide();
|
||||
if( $('input[name=fontEditFontImported]').is(':checked') ){
|
||||
$('#containerfontEditFile').hide();
|
||||
$('#containerfontEditUrl').show();
|
||||
$('#fontEditFontFileWrapper').hide();
|
||||
$('input[name=fontEditFontImported]').attr('disabled', 'disabled');
|
||||
|
||||
}
|
||||
|
||||
|
||||
if( $('input[name=fontEditFontFile]').is(':checked') ){
|
||||
$('#containerfontEditFile').show();
|
||||
$('#containerfontEditUrl').hide();
|
||||
$('#fontEditFontImportedWrapper').hide();
|
||||
$('input[name=fontEditFontFile]').attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Mode téléchargement en ligne de la fonte ou installation locale
|
||||
*/
|
||||
$("input[name=fontEditFontImported]").on("click", function() {
|
||||
if( $('input[name=fontEditFontImported]').is(':checked') ){
|
||||
$('input[name=fontEditFontFile]').prop('checked', false);
|
||||
} else {
|
||||
$('input[name=fontEditFontFile]').prop('checked', true);
|
||||
}
|
||||
$('#containerfontEditFile').hide();
|
||||
$('#containerfontEditUrl').show();
|
||||
});
|
||||
|
||||
$("input[name=fontEditFontFile]").on("click", function() {
|
||||
if( $('input[name=fontEditFontFile]').is(':checked') ){
|
||||
$('input[name=fontEditFontImported]').prop('checked', false);
|
||||
} else {
|
||||
$('input[name=fontEditFontImported]').prop('checked', true);
|
||||
}
|
||||
$('#containerfontEditFile').show();
|
||||
$('#containerfontEditUrl').hide();
|
||||
$("input, select").on("change", function() {
|
||||
|
||||
if( $('input[name=fontEditFontImported]').is(':checked') ){
|
||||
$('input[name=fontEditFontFile]').prop('checked', false);
|
||||
$('#containerfontEditFile').hide();
|
||||
$('#containerfontEditUrl').show();
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
if( $('input[name=fontEditFontFile]').is(':checked') ){
|
||||
$('input[name=fontEditFontImported]').prop('checked', false);
|
||||
$('#containerfontEditFile').show();
|
||||
$('#containerfontEditUrl').hide();
|
||||
} else {
|
||||
$('input[name=fontEditFontImported]').prop('checked', true);
|
||||
}
|
||||
|
||||
});
|
||||
*/
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('fontEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('fontEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme/fonts',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('fontEditHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/fontes#add',
|
||||
'target' => '_blank',
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('fontEditPublish', [
|
||||
'value' => 'Valider',
|
||||
'uniqueSubmission' => true
|
||||
@ -36,7 +34,7 @@
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('fontEditFontFile', true,'Fonte installée', [
|
||||
'checked' => $this->getUrl(2) === 'file' ? true : false
|
||||
'checked' => $this->getUrl(2) === 'files' ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -69,7 +67,7 @@
|
||||
<div class="col12">
|
||||
<?php echo template::file('fontEditFile', [
|
||||
'label' => 'Fichier de fonte (Format WOFF)',
|
||||
'value' => $this->getUrl(2) === 'file' ? $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'resource']) : ''
|
||||
'value' => $this->getUrl(2) === 'files' ? $this->getData(['fonts', $this->getUrl(2), $this->getUrl(3), 'resource']) : ''
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -11,11 +11,10 @@
|
||||
'href' => 'https://doc.zwiicms.fr/fontes',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('themeFontAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fontAdd',
|
||||
'value' => template::ico('plus'),
|
||||
|
@ -171,10 +171,10 @@
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('themeFooterFont', $module::$fontsList, [
|
||||
<?php echo template::select('themeFooterFont', $module::$fonts['name'], [
|
||||
'label' => 'Fonte',
|
||||
'selected' => $this->getData(['theme', 'footer', 'font']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
|
@ -106,10 +106,10 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeHeaderFont', $module::$fontsList, [
|
||||
<?php echo template::select('themeHeaderFont', $module::$fonts['name'], [
|
||||
'label' => 'Fonte',
|
||||
'selected' => $this->getData(['theme', 'header', 'font']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
|
@ -183,10 +183,10 @@
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeMenuFont', $module::$fontsList, [
|
||||
<?php echo template::select('themeMenuFont', $module::$fonts['name'], [
|
||||
'label' => 'Fonte',
|
||||
'selected' => $this->getData(['theme', 'menu', 'font']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
|
@ -11,8 +11,6 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Aperçu en direct
|
||||
*/
|
||||
@ -28,20 +26,19 @@ $("input, select").on("change",function() {
|
||||
$("#themeSiteMarginWrapper").show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Aperçu dans la boîte
|
||||
*/
|
||||
|
||||
// Import des polices de caractères
|
||||
// Import des polices de caractères pour l'aperçu en temps réel
|
||||
var titleFont = $("#themeTitleFont :selected").val();
|
||||
var titleFontText = $("#themeTitleFont :selected").text();
|
||||
var textFont = $("#themeTextFont :selected").val();
|
||||
var textFontText = $("#themeTextFont :selected").text();
|
||||
var css = "@import url('https://fonts.cdnfonts.com/css/" + titleFont + "');";
|
||||
var css = "@import url('https://fonts.cdnfonts.com/css/" + textFont + "');";
|
||||
// Couleurs des boutons
|
||||
var colors = core.colorVariants($("#themeButtonBackgroundColor").val());
|
||||
css += ".button.buttonSubmitPreview{background-color:" + colors.normal + ";}";
|
||||
var css = ".button.buttonSubmitPreview{background-color:" + colors.normal + ";}";
|
||||
css += ".button.buttonSubmitPreview:hover{background-color:" + colors.darken + "}";
|
||||
css += ".button.buttonSubmitPreview{color:" + colors.text + ";}";
|
||||
|
||||
@ -113,5 +110,4 @@ $("input, select").on("change",function() {
|
||||
.attr("id", "themePreview")
|
||||
.text(css)
|
||||
.appendTo("head");
|
||||
|
||||
}).trigger("change");
|
||||
|
@ -141,7 +141,8 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block preview">
|
||||
<h4 class="preview">Bloc</h4> <p class="textPreview">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
||||
<h4 class="preview">Bloc</h4>
|
||||
<p class="textPreview">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
||||
<p><a href="#" class="urlPreview">Lorem ipsum dolor sit amet.</a></p>
|
||||
</div>
|
||||
</div>
|
||||
@ -158,10 +159,11 @@
|
||||
<h4>Mise en forme du texte</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('themeTextFont', $module::$fontsList, [
|
||||
<?php
|
||||
echo template::select('themeTextFont', $module::$fonts['name'], [
|
||||
'label' => 'Fonte',
|
||||
'selected' => $this->getData(['theme', 'text', 'font']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
@ -179,10 +181,10 @@
|
||||
<h4>Mise en forme des titres</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('themeTitleFont', $module::$fontsList, [
|
||||
<?php echo template::select('themeTitleFont', $module::$fonts['name'] , [
|
||||
'label' => 'Fonte',
|
||||
'selected' => $this->getData(['theme', 'title', 'font']),
|
||||
'fonts' => true
|
||||
'fonts' => $module::$fonts['family']
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
|
Loading…
Reference in New Issue
Block a user