$this->writeImages();
$this->log('Images written');
$this->writeCartConfig();
+ $this->writeXMLArticles();
+ $this->log('XML Articles written');
$linksCSS = $this->writeLinks();
$this->log('Links written');
$this->writeArticles();
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>';
}
}
+ $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) {