\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
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);
}
$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;
$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;
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;
}
$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...