]> _ Git - cubeextranet.git/commitdiff
Fix #4642 @7
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 10 Aug 2021 14:03:03 +0000 (14:03 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 10 Aug 2021 14:03:03 +0000 (14:03 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index fa261c943e784368f956d623dad5b65d48845638..27888f596cf77d4d62aa89fe1948fcc3138b6864 100644 (file)
@@ -2191,6 +2191,8 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
     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()
index 51df5a85910113b50485f6924afd55b30a3c878b..a772c41ab070f38faf5e417d9ea8d6fac22e0019 100644 (file)
@@ -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 .= '<iframe data-scale="' . $s . '" data-width="' . $iw . '" data-height="' . $ih . '"  width="' . $iw . '" height="' . $ih . '" src="' . $this->_externalIframe . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel="" style="visibility:hidden;" tabindex="-1" onload="this.style.visibility=\'visible\';"></iframe>';
             }
 
+            //### 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;
                 }
             }