]> _ Git - cubeextranet.git/commitdiff
wait #4946 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 7 Dec 2021 17:45:35 +0000 (17:45 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 7 Dec 2021 17:45:35 +0000 (17:45 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 21d5b69397b691e3e167a28612a9a6476fe33b95..8cb7c0a1f0ec65f83e91a79182228d2065825af9 100644 (file)
@@ -939,6 +939,8 @@ class wsHTML5Compiler
         $this->writeImages();
         $this->log('Images written');
         $this->writeCartConfig();
+        $this->writeXMLArticles();
+        $this->log('XML Articles written');
         $linksCSS = $this->writeLinks();
         $this->log('Links written');
         $this->writeArticles();
@@ -3253,29 +3255,29 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
         return $innerXML;
     }
 
-    public function writeArticles()
+    public function writeXMLArticles()
     {
-        $mapFonts = ['OpenSans' => 'Open Sans'];
-
-        $this->lessVariables['articles-title-color'] = '#000000';
-        $this->lessVariables['articles-font'] = 'OpenSans';
+        $f = $this->book->parametres->articlesFile;
+        if ($f !== '' && file_exists($this->wdir . '/' . $f)) {
+            $f = $this->wdir . '/' . $f;
 
-        $list = [];
-        if (isset($this->config->articlesList)) {
-            $list = $this->config->articlesList;
-        }
 
-        $f = $this->book->parametres->articlesFile;
-        if ($f !== '' && file_exists($f = $this->wdir . '/' . $f)) {
+            $mapFonts = ['OpenSans' => 'Open Sans'];
+            $this->lessVariables['articles-title-color'] = '#000000';
+            $this->lessVariables['articles-font'] = 'Open Sans';
             $this->addLess('articles');
             if ($this->book->parametres->articlesStyle !== 'default') {
                 $this->lessVariables['articles-styles'] = $this->book->parametres->articlesStyle;
             }
-
-            $this->lessVariables['articles-title-color'] = '#565657';
             $this->lessVariables['articles-font'] = $mapFonts[$this->book->parametres->articlesFont] ?? $this->book->parametres->articlesFont;
             $fontPath = $this->addFontKit($this->book->parametres->articlesFont);
 
+            $list = $this->config->articlesList ?? [];
+
+
+            $this->lessVariables['articles-title-color'] = '#565657';
+
+
             $svg = '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="nav-print" viewBox="0 0 512 512">
         <path d="m424 186l-39 0 0-114c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 114-39 0c-22 0-41 19-41 41l0 121c0 23 19 41 41 41l39 0 0 49c0 8 6 15 14 15l230 0c8 0 14-7 14-15l0-49 39 0c22 0 41-18 41-41l0-121c0-22-19-41-41-41z m-268-100l200 0 0 100-200 0z m200 340l-200 0 0-88 200 0z m80-76c0 6-6 12-12 12l-39 0 0-38c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 38-39 0c-6 0-12-6-12-12l0-121c0-6 6-12 12-12l336 0c6 0 12 6 12 12z m-278-96l-33 0c-8 0-14 6-14 14 0 8 6 15 14 15l35 0c8 0 14-7 14-15 0-8-8-14-16-14z m32 139l132 0c8 0 14-6 14-14 0-8-6-14-14-14l-132 0c-8 0-14 6-14 14 0 8 6 14 14 14z"/>
     </symbol></svg>';
@@ -3365,6 +3367,33 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
             }
         }
 
+        $this->config->articlesList = $list;
+
+    }
+
+    public function findArticleById($id)
+    {
+        foreach ($this->config->articlesList as $item) {
+            if ($item['id'] === $id) {
+                return $item;
+            }
+        }
+        return null;
+    }
+
+    public function updateArticleById($id, $article)
+    {
+        foreach ($this->config->articlesList as $k => $item) {
+            if ($item['id'] === $id) {
+                $this->config->articlesList[$k] = $article;
+                break;
+            }
+        }
+    }
+
+    public function writeArticles()
+    {
+        $list = $this->config->articlesList ?? [];
 
         $nb = count($list);
         foreach ($list as $k => $item) {
index 197ea8fa7dc28edb7b2b75d1971ce2f082f1fa0f..46549ce8e556f541e7801f37f201e1fb51d13d33 100644 (file)
@@ -3130,10 +3130,13 @@ class articleLink extends normalLink
     {
         parent::init();
 
+        $this->article = $this->compiler->findArticleById($this->to);
 
-        $this->article = $this->compiler->config->articlesList[$this->to];
         if (!isset($this->compiler->config->articlesList[$this->to]['page'])) {
-            $this->compiler->config->articlesList[$this->to]['page'] = $this->page;
+            if (!isset($this->article['page'])) {
+                $this->article['page'] = $this->page;
+                $this->compiler->updateArticleById($this->to, $this->article);
+            }
         }
     }