From: stephen@cubedesigners.com Date: Tue, 10 Aug 2021 14:03:03 +0000 (+0000) Subject: Fix #4642 @7 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=65d51aaa0f3755493c419f3f7c58b00b6505a29e;p=cubeextranet.git Fix #4642 @7 --- 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 fa261c943..27888f596 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -2191,6 +2191,8 @@ height="0" width="0" style="display:none;visibility:hidden"> protected function writeManifest() { $res = array(); + // TODO: Why was this function missing a return statement? It's called from populateConfig() is expected to return a value. + return $res; } protected function writeImages() diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 51df5a859..a772c41ab 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -432,6 +432,9 @@ class wsHTML5Link public function overlapDoublePage() { + // $this->page is normally an integer but it can also be a string (eg. background / aftersearch) + if (!is_int($this->page)) return false; + return ($this->page % 2 == 0 && $this->left + $this->width > $this->compiler->width); } @@ -1880,12 +1883,20 @@ class htmlMultimediaLink extends wsHTML5Link $res .= ''; } + //### Debug to see how/where this code is being called multiple times + // ob_start(); + // debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + // $trace = ob_get_contents(); + // ob_end_clean(); + // $this->compiler->log("##### Multimedia Link getHTMLContent ID: {$this->id} | {$this->alternative} ######\n\n!!!! BACKTRACE !!!!!\n$trace\n===============\n"); + foreach ($this->_config['inject'] as $i) { - $infos = ['path' => 'data/links/' . str_replace('.', '_', $this->alternative)]; + $infos = ['path' => 'data/links/' . str_replace('.', '_', $this->alternative) . '/']; $i = str_replace('$id', '"#l_' . $this->id . '"', $i); $i = str_replace('$path', '"' . $infos['path'] . '"', $i); $i = str_replace('$init', CubeIT_Util_Json::encode($infos), $i); - $this->compiler->htmlmultimedia[] = $i; + // Key the array with the ID so we don't get duplicates even when this function is called multiple times + $this->compiler->htmlmultimedia[$this->id] = $i; } if (isset($this->_config['injectcss'])) { @@ -1895,8 +1906,10 @@ class htmlMultimediaLink extends wsHTML5Link } if (isset($this->_config['injectjs'])) { - foreach ($this->_config['injectjs'] as $i) { - $this->compiler->pluginJs[] = $d['fdir'] . '/' . $i; + foreach ($this->_config['injectjs'] as $filename) { + $path = $d['fdir'] . '/' . $filename; + // Key the array with the path so we don't get duplicates even when this function is called multiple times + $this->compiler->pluginJs[$path] = $path; } }