From: Vincent Vanwaelscappel Date: Tue, 3 Sep 2024 09:09:13 +0000 (+0200) Subject: wip #6998 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ff3dddedceee5e53d7b59fc490a562218cdb464a;p=fluidbook-toolbox.git wip #6998 @1.5 --- diff --git a/app/Fluidbook/Compiler/Articles.php b/app/Fluidbook/Compiler/Articles.php index 2ff0deb3d..dbe813d8e 100644 --- a/app/Fluidbook/Compiler/Articles.php +++ b/app/Fluidbook/Compiler/Articles.php @@ -154,7 +154,7 @@ trait Articles $nb = count($list); usort($list, function ($a, $b) { - if ($a['page'] == $b['page']) { + if (!isset($a['page']) || !isset($b['page']) || $a['page'] == $b['page']) { $ea = explode('-', $a['id']); $eb = explode('-', $b['id']); if (is_numeric($ea[0]) && is_numeric($eb[0])) { diff --git a/app/Fluidbook/Compiler/Cart.php b/app/Fluidbook/Compiler/Cart.php index b65ad7554..ec4f0ba09 100644 --- a/app/Fluidbook/Compiler/Cart.php +++ b/app/Fluidbook/Compiler/Cart.php @@ -132,7 +132,7 @@ trait Cart $this->config->product_zoom_references = []; foreach ($this->config->basketReferences as $ref => $data) { - $this->config->product_zoom_references[$ref] = [$ref]; + $this->config->set('product_zoom_references.' . $ref, [$ref]); } } @@ -171,7 +171,7 @@ trait Cart } $vdest = 'data/commerce/opt/' . $d; $this->vdir->copy($dest, $vdest); - $this->config->basketReferences[$ref]['Image'] = $vdest; + $this->config->set('basketReferences.' . $ref . '.Image', $vdest); } foreach ($links as $link) { diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index b9f1ae3d5..0a678a56a 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -1345,21 +1345,34 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError for ($i = 1; $i <= 5; $i++) { $ic = $this->fluidbookSettings->{'navExtraIcon' . $i}; - if ($ic != '') { - if (stristr($ic, '.svg')) { - $e = explode('.', $ic); - $sname = 'external-' . $e[0]; - $this->addSVGSymbolFromFile($this->wdir . '/' . $ic, $sname); - $this->config->{'navExtraIcon' . $i} = $sname; - } else if (stristr($ic, '.')) { - $this->vdir->copy($this->wdir . '/' . $ic, 'data/images/' . $ic); - } + if (!$ic) { + continue; + } + $f = $this->wdir . '/' . $ic; + + if (!stristr($ic, '.')) { + continue; + } + + if (!file_exists($f)) { + $this->addIssue(FluidbookHealthIssues::TYPE_MISSING_FILE, ['path', $f]); + continue; + } + + if (stristr($ic, '.svg')) { + $e = explode('.', $ic); + $sname = 'external-' . $e[0]; + $this->addSVGSymbolFromFile($f, $sname); + $this->config->{'navExtraIcon' . $i} = $sname; + } else { + $this->vdir->copy($f, 'data/images/' . $ic); } } } protected function addSVGSymbolFromFile($svg, $symbolName) { + $svg = SVGTools::optimizeSVG($svg); $xml = simplexml_load_string(file_get_contents($svg)); diff --git a/app/Models/FluidbookHealthIssues.php b/app/Models/FluidbookHealthIssues.php index b14a3df27..81234e0de 100644 --- a/app/Models/FluidbookHealthIssues.php +++ b/app/Models/FluidbookHealthIssues.php @@ -86,7 +86,7 @@ class FluidbookHealthIssues extends ToolboxModel return [ static::TYPE_MISSING_FILE => [ - 'summary' => __('Erreur 404'), + 'summary' => __('Erreur 404') . ', ' . __('Fichier introuvable'), 'criticality' => self::CRIT_ERROR, 'text' => __('Le chemin ":path" est introuvable'),