From 54a524c1b64a35bb97d40eae687faa8deec65a6f Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 6 Feb 2018 14:01:52 +0000 Subject: [PATCH] #1852 --- .../landing-page/class.ws.html5.compiler.php | 30 +++++++++++++++++++ .../landing-page/class.ws.html5.links.php | 19 +----------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/inc/ws/Util/html5/landing-page/class.ws.html5.compiler.php b/inc/ws/Util/html5/landing-page/class.ws.html5.compiler.php index 760ff5cc2..a6330d3fb 100644 --- a/inc/ws/Util/html5/landing-page/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/landing-page/class.ws.html5.compiler.php @@ -807,6 +807,15 @@ class wsHTML5Compiler { $ignore = split(',', $ignore); } + if ($this->book->parametres->externalChaptersHTML != '') { + $d = $this->unzipFile($this->book->parametres->externalChaptersHTML, false, 'data/chapters/'); + $meta = $this->getConfigZIP($d['dir']); + $this->config->externalChaptersSize = new stdClass(); + $this->config->externalChaptersSize->width = $meta['width']; + $this->config->externalChaptersSize->height = $meta['height']; + $this->vdir->copyDirectory($d['dir'], $d['fdir']); + } + $daoDoc = new wsDAODocument($core->con); $daoDoc->getLinksAndRulers($this->book_id, $links, $rulers); @@ -1699,4 +1708,25 @@ class wsHTML5Compiler { return array('dir' => $dir, 'fdir' => $fdir); } + public function getConfigZIP($d) { + $res = array('width' => 0, 'height' => 0); + if (file_exists($d . '/index.html')) { + $doc = new DOMDocument(); + $doc->loadHTMLFile($d . '/index.html'); + $xpath = new DOMXPath($doc); + $c = $xpath->query("//canvas"); + foreach ($c as $canvas) { + /* @var $canvas DOMElement */ + $res['width'] = intval((string)$canvas->getAttribute('width')); + $res['height'] = intval((string)$canvas->getAttribute('height')); + } + + $r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array()); + } else { + $r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js')); + } + $res = array_merge($res, $r); + return $res; + } + } diff --git a/inc/ws/Util/html5/landing-page/class.ws.html5.links.php b/inc/ws/Util/html5/landing-page/class.ws.html5.links.php index 997d37a81..db049eed8 100644 --- a/inc/ws/Util/html5/landing-page/class.ws.html5.links.php +++ b/inc/ws/Util/html5/landing-page/class.ws.html5.links.php @@ -945,24 +945,7 @@ class htmlMultimediaLink extends wsHTML5Link { } public function getConfigZIP($d) { - $res = array('width' => $this->video_width, 'height' => $this->video_height); - if (file_exists($d . '/index.html')) { - $doc = new DOMDocument(); - $doc->loadHTMLFile($d . '/index.html'); - $xpath = new DOMXPath($doc); - $c = $xpath->query("//canvas"); - foreach ($c as $canvas) { - /* @var $canvas DOMElement */ - $res['width'] = intval((string)$canvas->getAttribute('width')); - $res['height'] = intval((string)$canvas->getAttribute('height')); - } - - $r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array()); - } else { - $r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js')); - } - $res = array_merge($res, $r); - return $res; + return $this->compiler->getConfigZIP($d); } public function getConfigHTML($d, $html) { -- 2.39.5