From: vincent@cubedesigners.com Date: Fri, 17 Mar 2023 14:57:41 +0000 (+0000) Subject: wait #5795 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=45d2dd056aa77f654bb28cb3ed0334ac6779bf21;p=cubeextranet.git wait #5795 @2 --- diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 8d5113abf..e44ded5ac 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -1497,9 +1497,9 @@ height="0" width="0" style="display:none;visibility:hidden"> if ($page == '' || $text == '') { continue; } - $data=['text' => $text]; - if($voice){ - $data['voice']=$voice; + $data = ['text' => $text]; + if ($voice) { + $data['voice'] = $voice; } $this->audioDescriptionTextsList[$page] = $data; } @@ -1624,13 +1624,13 @@ height="0" width="0" style="display:none;visibility:hidden"> } - protected function _writeIndex($page) + protected function _writeIndex($page, $iv = []) { if (!isset($this->seo->pages[$page])) { return; } $seo = $this->seo->pages[$page]; - $html = $seo->getHTML(); + $html = $seo->getHTML($iv); if ($this->book->parametres->seoVersion) { $seo->writePage($html, $this->vdir); @@ -1870,11 +1870,8 @@ height="0" width="0" style="display:none;visibility:hidden"> $res = []; foreach ($vars as $v) { - if (isset($$v)) { - $res[''] = $$v; - } else { - $res[''] = ''; - } + $res[$v] = $$v ?? ''; + } $this->_indexVars = $res; $this->log('Got index vars 6'); @@ -1913,19 +1910,15 @@ height="0" width="0" style="display:none;visibility:hidden"> protected function writeIndex() { - - $iv = $this->getIndexVars(); $this->log('Got index vars'); - foreach ($iv as $k => $v) { - $this->seo->html = str_replace($k, $v, $this->seo->html); - } + if ($this->book->parametres->seoVersion) { foreach ($this->pages as $page => $infos) { - $this->_writeIndex($page); + $this->_writeIndex($page, $iv); } } else { - $this->_writeIndex(1); + $this->_writeIndex(1, $iv); } } diff --git a/inc/ws/Util/html5/master/class.ws.html5.seo.php b/inc/ws/Util/html5/master/class.ws.html5.seo.php index 12e34329b..66ee35b6e 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.seo.php +++ b/inc/ws/Util/html5/master/class.ws.html5.seo.php @@ -34,7 +34,7 @@ class wsHTML5Seo foreach ($a as $item) { $page = $item['page'] + $offsetPage; - $item['url'] = trim(CubeIT_Text::removeAccents($item['url'])," '"); + $item['url'] = trim(CubeIT_Text::removeAccents($item['url']), " '"); if (!$item['url']) { continue; } @@ -47,6 +47,7 @@ class wsHTML5Seo } } + $this->html = file_get_contents($this->compiler->assets . '/_index.html'); } @@ -192,7 +193,7 @@ class wsHTML5SeoPage $this->_container = $container; } - public function getHTML() + public function getHTML($iv = []) { $html = $this->_container->html; @@ -222,10 +223,11 @@ class wsHTML5SeoPage $vars['canonical'] = $vars['next'] = $vars['prev'] = ''; } + $vars = array_merge($iv, $vars); + foreach ($vars as $k => $var) { $html = str_replace('', $var, $html); } - return $html; }