import presque ok

This commit is contained in:
Fred Tempez 2022-03-31 15:37:44 +02:00
parent c52c6f4438
commit f35fbb8c71

View File

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