]> _ Git - cubeextranet.git/commitdiff
fix #3722 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Jun 2020 17:17:40 +0000 (17:17 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Jun 2020 17:17:40 +0000 (17:17 +0000)
inc/ws/Util/html5/class.ws.html5.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index cd935441abd0e67d4c046161d21bdcb4e7db5330..b8ded0a56830bed8c4fe0670e03da7110a1242cd 100644 (file)
 \r
 class wsHTML5\r
 {\r
-       protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');\r
-\r
-       /**\r
-        * @param $book_id\r
-        * @param string $version\r
-        * @param bool $phonegap\r
-        * @param string $phonegapVersion\r
-        * @param null $dir\r
-        * @param bool $standalone\r
-        * @param bool $appcache\r
-        * @param bool $home\r
-        * @param null $book\r
-        * @return wsHTML5Compiler\r
-        */\r
-       public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null)\r
-       {\r
-               if (is_null($version)) {\r
-                       global $core;\r
-                       $dao = new wsDAOBook($core->con);\r
-                       $book = $dao->selectById($book_id);\r
-                       $version = $book->parametres->mobileLVersion;\r
-               }\r
-\r
-               if ($version == 'stable' || $version == 'dev') {\r
-                       $branch = 'master';\r
-               } else {\r
-                       list($branch, $w) = explode('|', $version);\r
-               }\r
-\r
-\r
-               $branchDir = __DIR__ . '/' . $branch . '/';\r
-               $masterDir = __DIR__ . '/master/';\r
-               $files = array('class.ws.html5.compiler.php', 'class.ws.html5.links.php', 'class.ws.html5.seo.php');\r
-\r
-               if (!class_exists('wsHTML5Compiler', false)) {\r
-                       foreach ($files as $file) {\r
-                               if (file_exists($branchDir . $file)) {\r
-                                       require_once $branchDir . $file;\r
-                               } else if (file_exists($masterDir . $file)) {\r
-                                       require_once $masterDir . $file;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home, $book);\r
-       }\r
-\r
-       public static function getPhonegapVersion($v = 'latest')\r
-       {\r
-               if ($v != 'latest') {\r
-                       return $v;\r
-               }\r
-\r
-               $versions = self::getPhonegapVersions();\r
-               return array_pop($versions);\r
-       }\r
-\r
-       public static function getPhonegapVersions()\r
-       {\r
-               $versions = array();\r
-               $phonegap_dir = WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap';\r
-\r
-               if (is_dir($phonegap_dir)) {\r
-                       $dr = opendir($phonegap_dir);\r
-                       while ($file = readdir($dr)) {\r
-                               if ($file == '.' || $file == '..' || $file == 'plugins') {\r
-                                       continue;\r
-                               }\r
-                               $versions[] = $file;\r
-                       }\r
-                       usort($versions, 'version_compare');\r
-               }\r
-\r
-               return $versions;\r
-       }\r
-\r
-       public static function writeCSSUA($property, $value)\r
-       {\r
-               $res = array();\r
-               foreach (self::$uaPrefixes as $prefix) {\r
-                       $res[] = $prefix . $property . ':' . $value;\r
-               }\r
-               return implode(';', $res);\r
-       }\r
-\r
-       public static function colorToArray($color, $forceAlpha = null)\r
-       {\r
-               $color = ltrim($color, '#');\r
-               if (strlen($color) == 6) {\r
-                       $hex = $color;\r
-                       $alpha = 1;\r
-               } else {\r
-                       $alpha = hexdec(substr($color, 0, 2)) / 255;\r
-                       $hex = substr($color, 2, 6);\r
-               }\r
-\r
-               if (!is_null($forceAlpha)) {\r
-                       $alpha = $forceAlpha;\r
-               }\r
-\r
-               return array('hex' => strtoupper($hex), 'opacity' => number_format($alpha, 3, '.', ''));\r
-       }\r
-\r
-       public static function colorToCSS($color, $forceAlpha = null)\r
-       {\r
-               return CubeIT_Graphics_Color::colorToCSS($color, $forceAlpha);\r
-       }\r
+    protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');\r
+\r
+    /**\r
+     * @param $book_id\r
+     * @param string $version\r
+     * @param bool $phonegap\r
+     * @param string $phonegapVersion\r
+     * @param null $dir\r
+     * @param bool $standalone\r
+     * @param bool $appcache\r
+     * @param bool $home\r
+     * @param null $book\r
+     * @return wsHTML5Compiler\r
+     */\r
+    public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null)\r
+    {\r
+        if (is_null($version)) {\r
+            global $core;\r
+            $dao = new wsDAOBook($core->con);\r
+            $book = $dao->selectById($book_id);\r
+            $version = $book->parametres->mobileLVersion;\r
+        }\r
+\r
+        if ($version == 'stable' || $version == 'dev') {\r
+            $branch = 'master';\r
+        } else {\r
+            list($branch, $w) = explode('|', $version);\r
+        }\r
+\r
+\r
+        $branchDir = __DIR__ . '/' . $branch . '/';\r
+        $masterDir = __DIR__ . '/master/';\r
+        $files = array('class.ws.html5.compiler.php', 'class.ws.html5.links.php', 'class.ws.html5.seo.php');\r
+\r
+        if (!class_exists('wsHTML5Compiler', false)) {\r
+            foreach ($files as $file) {\r
+                if (file_exists($branchDir . $file)) {\r
+                    require_once $branchDir . $file;\r
+                } else if (file_exists($masterDir . $file)) {\r
+                    require_once $masterDir . $file;\r
+                }\r
+            }\r
+        }\r
+\r
+        return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home, $book);\r
+    }\r
+\r
+    public static function getPhonegapVersion($v = 'latest')\r
+    {\r
+        if ($v != 'latest') {\r
+            return $v;\r
+        }\r
+\r
+        $versions = self::getPhonegapVersions();\r
+        return array_pop($versions);\r
+    }\r
+\r
+    public static function getPhonegapVersions()\r
+    {\r
+        $versions = array();\r
+        $phonegap_dir = WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap';\r
+\r
+        if (is_dir($phonegap_dir)) {\r
+            $dr = opendir($phonegap_dir);\r
+            while ($file = readdir($dr)) {\r
+                if ($file == '.' || $file == '..' || $file == 'plugins') {\r
+                    continue;\r
+                }\r
+                $versions[] = $file;\r
+            }\r
+            usort($versions, 'version_compare');\r
+        }\r
+\r
+        return $versions;\r
+    }\r
+\r
+    public static function writeCSSUA($property, $value)\r
+    {\r
+        $res = array();\r
+        foreach (self::$uaPrefixes as $prefix) {\r
+            $res[] = $prefix . $property . ':' . $value;\r
+        }\r
+        return implode(';', $res) . ';';\r
+    }\r
+\r
+    public static function colorToArray($color, $forceAlpha = null)\r
+    {\r
+        $color = ltrim($color, '#');\r
+        if (strlen($color) == 6) {\r
+            $hex = $color;\r
+            $alpha = 1;\r
+        } else {\r
+            $alpha = hexdec(substr($color, 0, 2)) / 255;\r
+            $hex = substr($color, 2, 6);\r
+        }\r
+\r
+        if (!is_null($forceAlpha)) {\r
+            $alpha = $forceAlpha;\r
+        }\r
+\r
+        return array('hex' => strtoupper($hex), 'opacity' => number_format($alpha, 3, '.', ''));\r
+    }\r
+\r
+    public static function colorToCSS($color, $forceAlpha = null)\r
+    {\r
+        return CubeIT_Graphics_Color::colorToCSS($color, $forceAlpha);\r
+    }\r
 }
\ No newline at end of file
index 2c1881e337bd18cca497c0e9dc1dde1e1f5f8d96..1f998b908eaf222a45a32f83b817bc7ba2de3eaf 100644 (file)
@@ -2349,7 +2349,7 @@ class wsHTML5Compiler
 
     public function getConfigZIP($d)
     {
-        $res = array('width' => 0, 'height' => 0);
+        $res = array('type'=>'zip','width' => 0, 'height' => 0);
         if (file_exists($d . '/index.html')) {
             $doc = new DOMDocument();
             @$doc->loadHTMLFile($d . '/index.html');
index 593c2d12fed1cbdcdcf69ae944d4c9a70bf86894..5665199c992433131738c973a338a00fd6ea8d1d 100644 (file)
@@ -436,7 +436,7 @@ class wsHTML5Link
     public function getConfigHTML($d, $html)
     {
         $res = array('width' => $this->video_width, 'height' => $this->video_height);
-        $r = array('html' => $html, 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
+        $r = array('type' => 'html', 'html' => $html, 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
 
         return array_merge($res, $r);
     }
@@ -452,7 +452,7 @@ class wsHTML5Link
         $props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html');
 
 
-        $res = array('inject' => array(), 'injectcss' => array(), 'injectjs' => array(), 'content' => trim($c->content), 'name' => $c->_name, 'assets' => array());
+        $res = array('type' => 'oam', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array(), 'content' => trim($c->content), 'name' => $c->_name, 'assets' => array());
         foreach ($c->properties->property as $p) {
             if (isset($props[$p->_name])) {
                 $res[$props[$p->_name]] = $p->_defaultValue;
@@ -1330,7 +1330,7 @@ class htmlMultimediaLink extends wsHTML5Link
                     $this->_config['lowDef'] = 'index_ld.html';
                     $this->compiler->vdir->file_put_contents($d['fdir'] . '/' . $this->_config['lowDef'], $html);
                 }
-            } elseif ($ext == 'html') {
+            } elseif ($ext === 'html') {
                 $fdir = 'data/links';
                 $dir = $fdir;
 
@@ -1440,6 +1440,26 @@ class htmlMultimediaLink extends wsHTML5Link
         if ($this->_externalIframe !== false && $this->in_popup) {
             $css .= '#l_' . $this->id . '>iframe{' . wsHTML5::writeCSSUA('transform', 'scale(' . $this->getCssScale() . ')') . '}';
         }
+
+        if ($this->_config['type'] === 'oam') {
+            $sx = ($this->width / ($this->_config['width'])) * $this->getCssScale();
+            $sy = ($this->height / ($this->_config['height'])) * $this->getCssScale();
+            if ($this->compiler->book->parametres->OAMChromeFactor != 1) {
+                $css .= '.chrome #l_' . $this->id . '{';
+                $css .= 'width:' . ($this->_config['width'] * $this->compiler->book->parametres->OAMChromeFactor) . 'px;height:' . ($this->_config['height'] * $this->compiler->book->parametres->OAMChromeFactor) . 'px;';
+                $css .= wsHTML5::writeCSSUA('transform', 'scale(' . ($sx / $this->compiler->book->parametres->OAMChromeFactor) . ',' . ($sy / $this->compiler->book->parametres->OAMChromeFactor) . ')');
+                $css .= '}';
+            }
+            if ($this->compiler->book->parametres->OAMIEFactor != 1) {
+                $css .= '.msie #l_' . $this->id . '{';
+                $css .= 'width:' . ($this->_config['width'] * $this->compiler->book->parametres->OAMIEFactor) . 'px;height:' . ($this->_config['height'] * $this->compiler->book->parametres->OAMIEFactor) . 'px;';
+                $css .= wsHTML5::writeCSSUA('transform', 'scale(' . ($sx / $this->compiler->book->parametres->OAMIEFactor) . ',' . ($sy / $this->compiler->book->parametres->OAMIEFactor) . ')');
+                $css .= '}';
+            }
+
+        }
+
+
         return $css;
     }
 
@@ -1865,8 +1885,8 @@ class zoomLink extends normalLink
 
         $maxzoom = $this->getZoomAttributes()['maxzoom']; // Max zoom level might not always be set in the link editor
         $maxzoom = max(2, min($maxzoom, 4.166666667));
-        if(!$maxzoom){
-            $maxzoom=2;
+        if (!$maxzoom) {
+            $maxzoom = 2;
         }
 
         // TODO: Consider generating higher-res images (eg. 2x) for HiDPI screens. Maybe some extra optimisations can be done on the larger images...