From: vincent@cubedesigners.com Date: Thu, 27 Aug 2020 17:34:22 +0000 (+0000) Subject: wip #3733 @4 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=13a7c89e612c7f54378bd2628ea349e5abda5686;p=cubeextranet.git wip #3733 @4 --- 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 b23734442..40c484c4f 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -2524,6 +2524,50 @@ class wsHTML5Compiler } + public function parseArticlesBusinessImmo($file) + { + $zip = new ZipArchive(); + $zip->open($file); + $assets = []; + $xmls = []; + for ($i = 0; $i <= $zip->numFiles; $i++) { + $fname = $zip->getNameIndex($i); + if (stristr($fname, '__MACOSX')) { + continue; + } + if (!preg_match('/\.xml$/', $fname)) { + $assets[$this->_normalizeAssetName($fname, true)] = $i; + } else { + $xmls[$fname] = $i; + } + } + + foreach ($xmls as $name => $index) { + $e = explode('/', $name); + array_pop($e); + $dir = implode('/', $e); + $xmlContent = $zip->getFromIndex($index); + $xmlContent = preg_replace_callback('/\<\/?[A-Za-z]+\/?\>/', function($w){ + return mb_strtolower($w[0]); + }, $xmlContent); + $sx = simplexml_load_string($xmlContent); + } + + } + + protected function _normalizeAssetName($fname, $withDir = false) + { + if (!$withDir) { + $e = explode('/', $fname); + $fname = array_pop($e); + } + $fname = rawurldecode($fname); + $fname = trim(mb_strtolower($fname)); + $fname = str_replace('_opt.', '.', $fname); + $fname = CubeIT_Text::removeAccents($fname); + return $fname; + } + public function writeArticles() { $mapFonts = ['OpenSans' => 'Open Sans']; @@ -2532,6 +2576,7 @@ class wsHTML5Compiler $this->lessVariables['articles-font'] = 'OpenSans'; $list = []; + $f = $this->book->parametres->articlesFile; if ($f === '') { $this->config->articlesList = $list; @@ -2543,6 +2588,10 @@ class wsHTML5Compiler return; } + if ($this->book->parametres->articlesFormat === 'business-immo') { + $this->parseArticlesBusinessImmo($f); + } + $this->addLess('articles'); if ($this->book->parametres->articlesStyle !== 'default') { $this->lessVariables['articles-styles'] = $this->book->parametres->articlesStyle;