Merge branch '114_dev' of https://forge.chapril.org/Zwii/ZwiiCMS into 114_dev

This commit is contained in:
fredtempez 2022-04-01 08:39:02 +02:00
commit 0ecf080d03

View File

@ -934,27 +934,36 @@ if ($this->getData(['core', 'dataVersion']) < 11400) {
'resource' => 'https://fonts.cdnfonts.com/css/vollkorn' 'resource' => 'https://fonts.cdnfonts.com/css/vollkorn'
] ]
]; ];
$this->setData(['fonts', 'imported', $fonts]);
// Conversion des fontes locales // Conversion des fontes locales
$files = $this->getData(['fonts', 'files']); $files = $this->getData(['fonts', 'files']);
if (is_array($files)) { if (is_array($files)) {
$this->deleteData(['fonts', 'files']);
foreach ($files as $fontId => $fontName) { foreach ($files as $fontId => $fontName) {
$this->setData(['fonts', 'files', $fontId, [ if (file_exists(self::DATA_DIR . 'fonts/' . $fontName)) {
'name' => ucfirst($fontId), $this->setData(['fonts', 'files', $fontId, [
'font-family'=> $fontId . ', sans-serif', 'name' => ucfirst($fontId),
'resource' => $fontName 'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif',
]]); 'resource' => $fontName
]]);
}
} }
} }
// Rafraichir les thèmes // Consersion des fontes importées
if (file_exists(self::DATA_DIR . 'admin.css')) { $imported = $this->getData(['fonts', 'imported']);
unlink (self::DATA_DIR . 'admin.css'); 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 (file_exists(self::DATA_DIR . 'theme.css')) { // Importation des fontes exemples
unlink (self::DATA_DIR . 'theme.css'); $template = $fonts;
foreach ($template as $fontId => $fontValue) {
$this->setData(['fonts', 'imported', $fontId, $fontValue]);
} }
// Transforme les URL en références relatives // Transforme les URL en références relatives