From fa2e4b2be0e0909461a03a29718e64c36b1283b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 14:57:50 +0200 Subject: [PATCH 1/6] import font locale en test --- core/include/update.inc.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 731798da..4e92dc3e 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -941,10 +941,25 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { if (is_array($files)) { $this->deleteData(['fonts', 'files']); foreach ($files as $fontId => $fontName) { - $this->setData(['fonts', 'files', $fontId, [ - 'name' => ucfirst($fontId), + if (file_exists(self::DIR_DATA . 'fonts' . $fontName)) { + $this->setData(['fonts', 'files', $fontId, [ + 'name' => ucfirst($fontId), + 'font-family'=> $fontId . ', sans-serif', + 'resource' => $fontName + ]]); + } + } + } + // Consersion des fontes importées + // Conversion des fontes locales + $imported = $this->getData(['fonts', 'imported']); + if (is_array($imported)) { + $this->deleteData(['fonts', 'imported']); + foreach ($imported as $fontId => $fontName) { + $this->setData(['fonts', 'imported', $fontId, [ + 'name' => $fontId, 'font-family'=> $fontId . ', sans-serif', - 'resource' => $fontName + 'resource' => 'https:\/\/fonts.cdnfonts.com\/css\/' . $fontId ]]); } } From 3f52396e9dbe02ea7c30727694abe875334404c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 15:03:13 +0200 Subject: [PATCH 2/6] import des fontes WIP --- core/include/update.inc.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 4e92dc3e..61740e49 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -934,7 +934,6 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { 'resource' => 'https://fonts.cdnfonts.com/css/vollkorn' ] ]; - $this->setData(['fonts', 'imported', $fonts]); // Conversion des fontes locales $files = $this->getData(['fonts', 'files']); @@ -950,20 +949,22 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { } } } - // Consersion des fontes importées - // Conversion des fontes locales + // Consersion des fontes importées $imported = $this->getData(['fonts', 'imported']); if (is_array($imported)) { $this->deleteData(['fonts', 'imported']); - foreach ($imported as $fontId => $fontName) { + foreach ($imported as $fontId => $fontUrl) { $this->setData(['fonts', 'imported', $fontId, [ 'name' => $fontId, - 'font-family'=> $fontId . ', sans-serif', - 'resource' => 'https:\/\/fonts.cdnfonts.com\/css\/' . $fontId + 'font-family'=> '"' . $fontId . '", sans-serif', + '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'); From c52c6f4438a76be9f25e55ad7de81e2e7f8a7837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 15:07:16 +0200 Subject: [PATCH 3/6] import de fontes DIR_DATA !!!! --- core/include/update.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 61740e49..ea8ad2a6 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -940,7 +940,7 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { if (is_array($files)) { $this->deleteData(['fonts', 'files']); foreach ($files as $fontId => $fontName) { - if (file_exists(self::DIR_DATA . 'fonts' . $fontName)) { + if (file_exists(self::DATA_DIR . 'fonts' . $fontName)) { $this->setData(['fonts', 'files', $fontId, [ 'name' => ucfirst($fontId), 'font-family'=> $fontId . ', sans-serif', From f35fbb8c7133de2b4b4f5f27fd3185a5965976a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 15:37:44 +0200 Subject: [PATCH 4/6] import presque ok --- core/include/update.inc.php | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index ea8ad2a6..d7658cbb 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -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 From 0b2f514320a0af60fa2edbb72e00783e66ea7df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 15:40:16 +0200 Subject: [PATCH 5/6] simple quotes --- core/include/update.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index d7658cbb..38a67b68 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -955,7 +955,7 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { foreach ($imported as $fontId => $fontUrl) { $this->setData(['fonts', 'imported', $fontId, [ 'name' => ucfirst($fontId), - 'font-family'=> '"' . $fontId . '", sans-serif', + 'font-family'=> '\'' . $fontId . '\', sans-serif', 'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl ]]); } From b8016a3bc1a33a5368092bd4c897923230d5136f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 15:43:36 +0200 Subject: [PATCH 6/6] update quotes dans family name --- core/include/update.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 38a67b68..b3b09894 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -942,7 +942,7 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { if (file_exists(self::DATA_DIR . 'fonts/' . $fontName)) { $this->setData(['fonts', 'files', $fontId, [ 'name' => ucfirst($fontId), - 'font-family'=> $fontId . ', sans-serif', + 'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif', 'resource' => $fontName ]]); } @@ -955,7 +955,7 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { foreach ($imported as $fontId => $fontUrl) { $this->setData(['fonts', 'imported', $fontId, [ 'name' => ucfirst($fontId), - 'font-family'=> '\'' . $fontId . '\', sans-serif', + 'font-family'=> '\'' . ucfirst($fontId) . '\', sans-serif', 'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl ]]); }