réimport du thème pour les fontes WIP
This commit is contained in:
parent
e1d18c54d3
commit
be0b4ca818
@ -29,7 +29,8 @@ class theme extends common {
|
||||
'manage' => self::GROUP_ADMIN,
|
||||
'export' => self::GROUP_ADMIN,
|
||||
'import' => self::GROUP_ADMIN,
|
||||
'save' => self::GROUP_ADMIN
|
||||
'save' => self::GROUP_ADMIN,
|
||||
'fonts' => self::GROUP_ADMIN
|
||||
];
|
||||
public static $aligns = [
|
||||
'left' => 'À gauche',
|
||||
@ -226,6 +227,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 = [];
|
||||
|
||||
/**
|
||||
* Thème des écrans d'administration
|
||||
@ -412,42 +415,14 @@ class theme extends common {
|
||||
$featureContent = $this->getInput('themeHeaderText', null);
|
||||
$featureContent = str_replace(helper::baseUrl(false,false), './', $featureContent);
|
||||
|
||||
// Encodage des images en base64
|
||||
// Identifier les images
|
||||
/*
|
||||
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
||||
foreach($results[0] as $value) {
|
||||
// Lire le contenu XML
|
||||
$sx = simplexml_load_string($value);
|
||||
// Elément à remplacer
|
||||
$src = 'src="' . $sx[0]['src'] . '"';
|
||||
// Elément encodé en base64
|
||||
$base64 = 'src="data:image/'. pathinfo($sx[0]['src'],PATHINFO_EXTENSION) . ';base64,'. base64_encode(file_get_contents($sx[0]['src'])).'"';
|
||||
// Effectuer le remplacement dans la chaine
|
||||
$featureContent = str_replace($src, $base64, $featureContent);
|
||||
}
|
||||
|
||||
// Encodage des videos en base64
|
||||
preg_match_all('/<source[^>]+>/i',$featureContent, $results);
|
||||
foreach($results[0] as $value) {
|
||||
// Lire le contenu XML
|
||||
$sx = simplexml_load_string($value);
|
||||
// Elément à remplacer
|
||||
$src = 'src="' . $sx[0]['src'] . '"';
|
||||
// Elément encodé en base64
|
||||
$base64 = 'src="data:source/'. pathinfo($sx[0]['src'],PATHINFO_EXTENSION) . ';base64,'. base64_encode(file_get_contents($sx[0]['src'])).'"';
|
||||
// Effectuer le remplacement dans la chaine
|
||||
$featureContent = str_replace($src, $base64, $featureContent);
|
||||
}*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* Stocker les images incluses dans la bannière perso dans un tableau
|
||||
*/
|
||||
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
||||
foreach($results[0] as $value) {
|
||||
preg_match_all('/<img[^>]+>/i',$featureContent, $results);
|
||||
foreach($results[0] as $value) {
|
||||
// Lire le contenu XML
|
||||
$sx = simplexml_load_string($value);
|
||||
// Elément à remplacer
|
||||
// Élément à remplacer
|
||||
$files [] = str_replace('./site/file/source/','',(string) $sx[0]['src']);
|
||||
}
|
||||
|
||||
@ -566,6 +541,32 @@ class theme extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options des fontes
|
||||
*/
|
||||
public function fonts() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
}
|
||||
//Polices trouvées dans la configuration
|
||||
|
||||
if ( file_exists(self::DATA_DIR . 'fonts.json') ) {
|
||||
$localFonts = $this->getData(['fonts', 'files']);
|
||||
}
|
||||
// Parcourir les fontes installées et construire le tableau pour le formulaire
|
||||
foreach (self::$fonts as $fontId => $fontName) {
|
||||
self::$fontsList [] = [
|
||||
$fontName,
|
||||
$fontId
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Gestion des fontes',
|
||||
'view' => 'fonts'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Réinitialisation de la personnalisation avancée
|
||||
*/
|
||||
@ -823,10 +824,10 @@ class theme extends common {
|
||||
// Traite les images du header perso
|
||||
if (!empty($this->getData(['theme','header','featureFiles'])) ) {
|
||||
foreach($this->getData(['theme','header','featureFiles']) as $value) {
|
||||
$zip->addFile(self::FILE_DIR . 'source/' . $value,
|
||||
$zip->addFile(self::FILE_DIR . 'source/' . $value,
|
||||
self::FILE_DIR . 'source/' . $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
$ret = $zip->close();
|
||||
|
@ -1,24 +1,25 @@
|
||||
<?php echo template::formOpen('configAdminForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('configAdminBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset4">
|
||||
<!--
|
||||
<div class="col2 offset5">
|
||||
<?php echo template::button('configAdminTest', [
|
||||
'value' => 'Bouton Standard'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset">
|
||||
-->
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('configAdminReset', [
|
||||
'class' => 'buttonRed',
|
||||
'href' => helper::baseUrl() . 'theme/reset/admin' . '&csrf=' . $_SESSION['csrf'],
|
||||
'value' => 'Réinitialiser',
|
||||
'ico' => 'cancel'
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Réinitialiser avec le thème par défaut'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?php echo template::formOpen('themeAdvancedForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeAdvancedBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('themeAdvancedReset', [
|
||||
'href' => helper::baseUrl() . 'theme/reset/custom' . '&csrf=' . $_SESSION['csrf'],
|
||||
'class' => 'buttonRed',
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Réinitialiser'
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Réinitialiser la feuille de style'
|
||||
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('themeBodyForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeBodyBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeBodyHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/arriere-plan',
|
||||
'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('themeBodySubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
11
core/module/theme/view/fonts/fonts copy.php
Normal file
11
core/module/theme/view/fonts/fonts copy.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
$filefont = 'https://www.cdnfonts.com/sketched.font';
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTMLFile($filefont, LIBXML_NOERROR);
|
||||
$elements = $doc->getElementsByTagName('i');
|
||||
var_dump ($elements);
|
||||
foreach($elements as $element) {
|
||||
if ($element->$textContent === 'http://fonts.cdnfonts.com/css/sketched') {
|
||||
var_dump( $element['textContent'] );
|
||||
}
|
||||
}
|
18
core/module/theme/view/fonts/fonts.css
Normal file
18
core/module/theme/view/fonts/fonts.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @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-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
5
core/module/theme/view/fonts/fonts.php
Normal file
5
core/module/theme/view/fonts/fonts.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php if($module::$fontsList): ?>
|
||||
<?php echo template::table([6, 6], $module::$fontsList, ['Family Name', 'Font Id']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune news.'); ?>
|
||||
<?php endif; ?>
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('themeFooterForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeFooterBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeFooterHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/pied-de-page',
|
||||
'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('themeFooterSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('themeHeaderForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeHeaderBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeHeaderHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/banniere',
|
||||
'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('themeHeaderSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -40,7 +40,8 @@ nav li ul {
|
||||
#themeBack,
|
||||
#themeManage,
|
||||
#themeAdmin,
|
||||
#themeAdvanced {
|
||||
#themeAdvanced,
|
||||
#themeFonts {
|
||||
position: relative;
|
||||
z-index: 11;
|
||||
}
|
||||
|
@ -30,9 +30,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2 offset3">
|
||||
<div class="col2 offset2">
|
||||
<?php echo template::button('themeManage', [
|
||||
'ico' => 'cogs',
|
||||
'ico' => 'sliders',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/manage',
|
||||
'value' => 'Gestion'
|
||||
]); ?>
|
||||
@ -52,6 +52,13 @@
|
||||
'value' => 'Éditeur CSS'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeFonts', [
|
||||
'ico' => 'code',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fonts',
|
||||
'value' => 'Fontes'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation.'); ?>
|
||||
@ -75,9 +82,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2 offset3">
|
||||
<div class="col2 offset2">
|
||||
<?php echo template::button('themeManage', [
|
||||
'ico' => 'cogs',
|
||||
'ico' => 'sliders',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/manage',
|
||||
'value' => 'Gestion'
|
||||
]); ?>
|
||||
@ -97,5 +104,12 @@
|
||||
'value' => 'Éditeur CSS'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeFonts', [
|
||||
'ico' => 'code',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fonts',
|
||||
'value' => 'Fontes'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@ -1,19 +1,18 @@
|
||||
<?php echo template::formOpen('themeManageForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeManageBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('configManageReset', [
|
||||
'class' => 'buttonRed',
|
||||
'href' => helper::baseUrl() . 'theme/reset/manage' . '&csrf=' . $_SESSION['csrf'],
|
||||
'value' => 'Réinitialiser',
|
||||
'ico' => 'cancel'
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Réinitialiser avec le thème par défaut'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('themeMenuForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeMenuBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeMenuHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/menu',
|
||||
'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('themeMenuSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,23 +1,21 @@
|
||||
<?php echo template::formOpen('themeSiteForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeSiteBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1">
|
||||
<?php echo template::button('themeSiteHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/site61863d315ffe0',
|
||||
'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('themeSiteSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user