From 40d17e5dd327d0b7bc0f470fa7afcf7548a1471a Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 3 May 2017 14:40:50 +0000 Subject: [PATCH] wip #1381 @0.75 --- inc/ws/Controlleur/class.ws.maintenance.php | 8 +- inc/ws/DAO/class.ws.dao.book.php | 2 +- inc/ws/Util/_common.php | 6 +- inc/ws/Util/class.ws.tools.php | 2 +- inc/ws/Util/html5/class.ws.html5.php | 87 +++++++++++ .../{ => master}/class.ws.html5.compiler.php | 143 +++++------------- .../{ => master}/class.ws.html5.links.php | 14 +- .../packager/class.ws.packager.phonegap.php | 2 +- 8 files changed, 145 insertions(+), 119 deletions(-) create mode 100644 inc/ws/Util/html5/class.ws.html5.php rename inc/ws/Util/html5/{ => master}/class.ws.html5.compiler.php (88%) rename inc/ws/Util/html5/{ => master}/class.ws.html5.links.php (98%) diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index c4bddbe67..7a4e34757 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -751,8 +751,14 @@ class wsMaintenance { public static function restoreComposition($args) { global $core; $book_id = $args[0]; + if (isset($args[1])) { + $date = $args[1]; + } else { + $date = TIME; + } + - $r = $core->con->select('SELECT * FROM book_pages_versions WHERE book_id=\'' . $core->con->escape($book_id) . '\' AND composition!=\'a:0:{}\' ORDER BY `update` DESC LIMIT 1'); + $r = $core->con->select('SELECT * FROM book_pages_versions WHERE book_id=\'' . $core->con->escape($book_id) . '\' AND composition!=\'a:0:{}\' AND `update`<=' . $date . ' ORDER BY `update` DESC LIMIT 1'); if (!$r->count()) { return; } diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index afb60a319..5b5312d3d 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -1618,7 +1618,7 @@ class wsDAOBook extends commonDAO { $version = 'dev'; } - $htmlCompiler = wsHTML5Compiler::factory($book_id, $version); + $htmlCompiler = wsHTML5::compilerFactory($book_id, $version); $htmlCompiler->compile(); } diff --git a/inc/ws/Util/_common.php b/inc/ws/Util/_common.php index 2a4932716..6ed480908 100644 --- a/inc/ws/Util/_common.php +++ b/inc/ws/Util/_common.php @@ -9,10 +9,7 @@ $__autoload['wsSWF2HTMLParagraph'] = dirname(__FILE__) . '/class.ws.swf2html.php $__autoload['wsSWF2HTMLMatrix'] = dirname(__FILE__) . '/class.ws.swf2html.php'; $__autoload['wsSecureSWF'] = dirname(__FILE__) . '/class.ws.secure.swf.php'; $__autoload['wsTools'] = dirname(__FILE__) . '/class.ws.tools.php'; -$__autoload['wsHTML5Compiler'] = dirname(__FILE__) . '/html5/class.ws.html5.compiler.php'; $__autoload['wsHTML5AppCompiler'] = dirname(__FILE__) . '/html5/app/class.ws.html5.app.compiler.php'; -$__autoload['wsHTML5CompilerDev'] = dirname(__FILE__) . '/html5/class.ws.html5.compiler.php'; -$__autoload['wsHTML5Link'] = dirname(__FILE__) . '/html5/class.ws.html5.links.php'; $__autoload['wsPDFFontExtractor'] = dirname(__FILE__) . '/fontextractor/class.ws.pdf.fontextractor.php'; $__autoload['wsPDFFont'] = dirname(__FILE__) . '/fontextractor/class.ws.pdf.font.php'; $__autoload['wsSVN'] = dirname(__FILE__) . '/class.ws.svn.php'; @@ -20,4 +17,5 @@ $__autoload['wsLinks'] = dirname(__FILE__) . '/class.ws.links.php'; $__autoload['wsExporter'] = dirname(__FILE__) . '/class.ws.exporter.php'; $__autoload['wsPDFConvert'] = dirname(__FILE__) . '/class.ws.pdf.convert.php'; $__autoload['wsUtil'] = dirname(__FILE__) . '/class.ws.util.php'; -?> \ No newline at end of file + +$__autoload['wsHTML5'] = dirname(__FILE__) . '/html5/class.ws.html5.php'; diff --git a/inc/ws/Util/class.ws.tools.php b/inc/ws/Util/class.ws.tools.php index 9b08cdce7..a5042f774 100644 --- a/inc/ws/Util/class.ws.tools.php +++ b/inc/ws/Util/class.ws.tools.php @@ -57,7 +57,7 @@ class wsTools { } $hash = sha1(json_encode($colors)); foreach ($colors as $k => $v) { - $colors[$k] = wsHTML5Compiler::colorToArray($colors[$k]); + $colors[$k] = wsHTML5::colorToArray($colors[$k]); } $e = explode('-', $icon); diff --git a/inc/ws/Util/html5/class.ws.html5.php b/inc/ws/Util/html5/class.ws.html5.php new file mode 100644 index 000000000..d08bf868e --- /dev/null +++ b/inc/ws/Util/html5/class.ws.html5.php @@ -0,0 +1,87 @@ +con); + $book = $dao->selectById($book_id); + $version = $book->parametres->mobileLVersion; + } + + if ($version == 'stable' || $version == 'dev') { + $branch = 'master'; + } else { + list($branch, $w) = explode('|', $version); + } + + + $branchDir = __DIR__ . '/' . $branch . '/'; + $masterDir = __DIR__ . '/master/'; + $files = array('class.ws.html5.compiler.php', 'class.ws.html5.links.php'); + + foreach ($files as $file) { + if (file_exists($branchDir . $file)) { + require_once $branchDir . $file; + } else { + require_once $masterDir . $file; + } + } + + return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home); + } + + public static function getPhonegapVersion($v = 'latest') { + if ($v != 'latest') { + return $v; + } + + $versions = self::getPhonegapVersions(); + return array_pop($versions); + } + + public static function getPhonegapVersions() { + $versions = array(); + + $dr = opendir(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap'); + while ($file = readdir($dr)) { + if ($file == '.' || $file == '..' || $file == 'plugins') { + continue; + } + $versions[] = $file; + } + usort($versions, 'version_compare'); + return $versions; + } + + public static function writeCSSUA($property, $value) { + $res = array(); + foreach (self::$uaPrefixes as $prefix) { + $res[] = $prefix . $property . ':' . $value; + } + return implode(';', $res); + } + + public static function colorToArray($color, $forceAlpha = null) { + $color = ltrim($color, '#'); + if (strlen($color) == 6) { + $hex = $color; + $alpha = 1; + } else { + $alpha = hexdec(substr($color, 0, 2)) / 255; + $hex = substr($color, 2, 6); + } + + if (!is_null($forceAlpha)) { + $alpha = $forceAlpha; + } + + return array('hex' => strtoupper($hex), 'opacity' => number_format($alpha, 3, '.', '')); + } + + public static function colorToCSS($color, $forceAlpha = null) { + return CubeIT_Graphics_Color::colorToCSS($color, $forceAlpha); + } +} \ No newline at end of file diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php similarity index 88% rename from inc/ws/Util/html5/class.ws.html5.compiler.php rename to inc/ws/Util/html5/master/class.ws.html5.compiler.php index fd73ada29..191b0fa74 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -1,26 +1,9 @@ con); - $book = $dao->selectById($book_id); - $version = $book->parametres->mobileLVersion; - } - - if ($version == 'stable') { - $class = 'wsHTML5Compiler'; - } else { - $class = 'wsHTML5CompilerDev'; - } - return new $class($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home); - } - protected static $resolutions = array(150, 300); protected $maxRes = 300; - protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); + public $jsFiles = array( 'js/libs/modernizr/modernizr.js', 'js/libs/modernizr/tests.js', @@ -171,7 +154,7 @@ class wsHTML5Compiler { function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false) { global $core; - $this->phonegapVersion = self::getPhonegapVersion($phonegapVersion); + $this->phonegapVersion = wsHTML5::getPhonegapVersion($phonegapVersion); $this->appcache = $appcache; $this->multiApp = $this->home = $home; $this->version = $version; @@ -268,29 +251,6 @@ class wsHTML5Compiler { return $res; } - public static function getPhonegapVersion($v = 'latest') { - if ($v != 'latest') { - return $v; - } - - $versions = self::getPhonegapVersions(); - return array_pop($versions); - } - - public static function getPhonegapVersions() { - $versions = array(); - - $dr = opendir(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap'); - while ($file = readdir($dr)) { - if ($file == '.' || $file == '..' || $file == 'plugins') { - continue; - } - $versions[] = $file; - } - usort($versions, 'version_compare'); - return $versions; - } - public function getCssScale() { return $this->cssScale; } @@ -943,8 +903,8 @@ class wsHTML5Compiler { $this->config->optimalWidth = $this->optimalWidth; $this->config->optimalHeight = $this->optimalHeight; $this->config->chapters = $this->book->chapters; - $this->config->coquilletteBack = $this->colorToCSS($this->theme->parametres->couleurA); - $this->config->coquilletteFront = $this->colorToCSS($this->theme->parametres->arrowsColor); + $this->config->coquilletteBack = wsHTML5::colorToCSS($this->theme->parametres->couleurA); + $this->config->coquilletteFront = wsHTML5::colorToCSS($this->theme->parametres->arrowsColor); $this->config->videoFormats = $this->getVideosFormats(false); $this->config->htmlmultimedia = $this->htmlmultimedia; $this->config->phonegap = $this->phonegap; @@ -1145,31 +1105,31 @@ class wsHTML5Compiler { $offsetLeft2 = $offsetLeft * 2; $offsetTop = round(($this->optimalHeight - $cssHeight) / 2, 3); $navTop = ($cssHeight - 40 - 100) / 2; - $leftOfRightPage=(floor($cssWidth)-1).'px'; + $leftOfRightPage = (floor($cssWidth) - 1) . 'px'; $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.doublePage._3d,#shadow>div{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.doublePage,#pages,#links{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}'; - $res[] = '.landscape .doublePage._2d.axis_x.next{' . self::writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}'; - $res[] = '.landscape .doublePage._2d.axis_x.prev{' . self::writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}'; - $res[] = '.portrait .doublePage._2d.axis_x.next{' . self::writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}'; - $res[] = '.portrait .doublePage._2d.axis_x.prev{' . self::writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}'; - $res[] = '.doublePage._2d.axis_y.next{' . self::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}'; - $res[] = '.doublePage._2d.axis_y.prev{' . self::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}'; + $res[] = '.landscape .doublePage._2d.axis_x.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}'; + $res[] = '.landscape .doublePage._2d.axis_x.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}'; + $res[] = '.portrait .doublePage._2d.axis_x.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}'; + $res[] = '.portrait .doublePage._2d.axis_x.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}'; + $res[] = '.doublePage._2d.axis_y.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}'; + $res[] = '.doublePage._2d.axis_y.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}'; $res[] = '.doublePage._3d{left:' . $w . ';}'; $res[] = '#links.right{left:-' . $w . ';}'; $res[] = '.landscape #shadow>div.right{left: ' . $w . ';}'; $res[] = '.landscape .page.right{left:' . $w . '}'; if ($this->theme->parametres->displayPageNumber) { - $res[] = '#pagesnumbers{font-size: ' . (12 * $this->z) . 'px;margin: ' . (5 * $this->z) . 'px 0 0 0;top:' . $h . ';color:' . self::colorToCSS($this->theme->parametres->colorPageNumber) . '}'; + $res[] = '#pagesnumbers{font-size: ' . (12 * $this->z) . 'px;margin: ' . (5 * $this->z) . 'px 0 0 0;top:' . $h . ';color:' . wsHTML5::colorToCSS($this->theme->parametres->colorPageNumber) . '}'; $res[] = '#pagesnumbers div{width:' . $w . '}'; } else { $res[] = '#pagesnumbers{display:none;}'; } - $res[] = '.doublePage._2d,.doublePage._3d{' . self::writeCSSUA('transition', 'all ' . $this->book->parametres->mobileTransitionDuration . 's ease-in-out') . '}'; + $res[] = '.doublePage._2d,.doublePage._3d{' . wsHTML5::writeCSSUA('transition', 'all ' . $this->book->parametres->mobileTransitionDuration . 's ease-in-out') . '}'; - $res[] = '.background{' . self::writeCSSUA('transform-origin', 'top left') . ';}'; + $res[] = '.background{' . wsHTML5::writeCSSUA('transform-origin', 'top left') . ';}'; foreach ($this->getResolutions() as $r) { $ratio = round(72 / $r, 3) * $cssScale; @@ -1178,13 +1138,13 @@ class wsHTML5Compiler { $br = '.background.r' . $r . '{'; if ($ratio != 1) { - $br .= self::writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; + $br .= wsHTML5::writeCSSUA('transform', 'scale(' . $ratio . ')') . ';'; } $br .= 'width:' . $wr . 'px;height:' . $hr . 'px;}'; $res[] = $br; } - $texts = '.texts{' . self::writeCSSUA('transform-origin', 'top left') . ';'; - $texts .= self::writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale * $this->cssSVGScale, 3) . ')') . ';'; + $texts = '.texts{' . wsHTML5::writeCSSUA('transform-origin', 'top left') . ';'; + $texts .= wsHTML5::writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale * $this->cssSVGScale, 3) . ')') . ';'; $texts .= 'width:' . ($wm / $this->cssSVGScale) . '; max-width:' . ($wm / $this->cssSVGScale) . ';'; $texts .= 'height:' . ($hm / $this->cssSVGScale) . '; max-height:' . ($hm / $this->cssSVGScale) . ';'; $texts .= '}'; @@ -1198,17 +1158,17 @@ class wsHTML5Compiler { // SVG - $res[] = 'svg .fill-c-menu-back{fill:' . self::colorToCSS($this->theme->parametres->couleurB) . ';}'; - $res[] = 'svg .fill-c-menu-text{fill:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}'; + $res[] = 'svg .fill-c-menu-back{fill:' . wsHTML5::colorToCSS($this->theme->parametres->couleurB) . ';}'; + $res[] = 'svg .fill-c-menu-text{fill:' . wsHTML5::colorToCSS($this->theme->parametres->subTextColor) . ';}'; // Search field - $searchColor = self::colorToCSS($this->theme->parametres->couleurS); - $searchBackColor = self::colorToCSS($this->theme->parametres->searchFieldColor); + $searchColor = wsHTML5::colorToCSS($this->theme->parametres->couleurS); + $searchBackColor = wsHTML5::colorToCSS($this->theme->parametres->searchFieldColor); $search = '#q{'; $search .= 'color:' . $searchColor . ';'; $search .= 'background-color:' . $searchBackColor . ';'; if ($this->theme->parametres->searchShadeAlpha > 0) { - $search .= self::writeCSSUA('box-shadow', '1px 1px 4px rgba(0,0,0,' . ($this->theme->parametres->searchShadeAlpha / 100) . ')') . ' inset;'; + $search .= wsHTML5::writeCSSUA('box-shadow', '1px 1px 4px rgba(0,0,0,' . ($this->theme->parametres->searchShadeAlpha / 100) . ')') . ' inset;'; } $search .= '}'; $search .= '#searchHints,.hint{color:' . $searchColor . ';background-color:' . $searchBackColor . ';}'; @@ -1223,7 +1183,7 @@ class wsHTML5Compiler { // Header $header = 'header{'; $header .= 'height:' . $this->theme->parametres->menuHeight . 'px;'; - $header .= 'background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';'; + $header .= 'background-color:' . wsHTML5::colorToCSS($this->theme->parametres->menuColor) . ';'; if ($this->theme->parametres->menuImage != '') { $this->copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage); $header .= 'background-image:url(../images/' . $this->theme->parametres->menuImage . ');'; @@ -1235,7 +1195,7 @@ class wsHTML5Compiler { //Icons $res = array_merge($res, $this->writeIcons()); - $res[] = '#nav #locales{background-color:' . self::colorToCSS($this->theme->parametres->couleurI) . ';}'; + $res[] = '#nav #locales{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurI) . ';}'; // Logo $logo = '#logo{'; @@ -1248,25 +1208,25 @@ class wsHTML5Compiler { $res[] = $logo; // Credits - $res[] = 'footer,footer a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}'; + $res[] = 'footer,footer a{color:' . wsHTML5::colorToCSS($this->theme->parametres->creditsColor) . ';}'; // Arrows - $res[] = '#next,#previous{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}'; + $res[] = '#next,#previous{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurA) . ';}'; // Audio description buttons - $res[] = '.audio-description-button{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}'; + $res[] = '.audio-description-button{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurA) . ';}'; // Book shadow - $shadowColor = self::colorToCSS($this->theme->parametres->bookShadeColor); + $shadowColor = wsHTML5::colorToCSS($this->theme->parametres->bookShadeColor); if ($shadowColor != 'transparent') { - $res[] = '#shadow>div{' . self::writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}'; + $res[] = '#shadow>div{' . wsHTML5::writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}'; } // Links Styles $res = array_merge($res, $links); - $res[] = '.link a.displayArea:hover,.link a.displayArea.animating{background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}'; + $res[] = '.link a.displayArea:hover,.link a.displayArea.animating{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}'; $res[] = '.link a.displayArea:hover{opacity:1 !important;}'; - $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}'; + $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . wsHTML5::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';background-color:' . wsHTML5::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}'; // Bookmarks if (!isset($this->book->parametres->bookmarkCornerSize)) { @@ -1279,7 +1239,7 @@ class wsHTML5Compiler { // Menus $menuColor = new CubeIT_Graphics_Color($this->theme->parametres->couleurB); $menuColor->setAlpha(1); - $menuTextColor = self::colorToCSS($this->theme->parametres->subTextColor); + $menuTextColor = wsHTML5::colorToCSS($this->theme->parametres->subTextColor); $menuMultiply = $menuColor->multiply($menuColor); $menuMultiply2 = $menuMultiply->multiply($menuColor); @@ -1291,7 +1251,7 @@ class wsHTML5Compiler { # Inner View $res[] .= '#innerView>div{background-color:' . $menuColor->toCSS() . ';color:' . $menuTextColor . ';}'; - $res[] .= 'form input[type="text"],form input[type="email"]{background-color:' . self::colorToCSS($this->theme->parametres->subFieldColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextFieldColor) . ';}'; + $res[] .= 'form input[type="text"],form input[type="email"]{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->subFieldColor) . ';color:' . wsHTML5::colorToCSS($this->theme->parametres->subTextFieldColor) . ';}'; // Archives if ($this->book->parametres->externalArchivesBack) { @@ -1335,15 +1295,15 @@ class wsHTML5Compiler { $ratio = $this->width / $this->height; $thumbh = round(100 / $ratio); $res[] = '#indexView .thumb img{width:100px;height:' . $thumbh . 'px;}'; - $res[] = '#indexView .doubleThumb{height:' . $thumbh . 'px;' . self::writeCSSUA('box-shadow', '0 0 3px ' . $shadowColor) . '}'; + $res[] = '#indexView .doubleThumb{height:' . $thumbh . 'px;' . wsHTML5::writeCSSUA('box-shadow', '0 0 3px ' . $shadowColor) . '}'; $res[] = '#indexView .doubleThumb .overlay{height:' . $thumbh . 'px;}'; - $res[] = '#indexView .doubleThumb .hits.yes{background-color:' . self::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextSelectColor) . '}'; + $res[] = '#indexView .doubleThumb .hits.yes{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . wsHTML5::colorToCSS($this->theme->parametres->subTextSelectColor) . '}'; # Tooltip - $res[] = '#tooltip{background-color:' . self::colorToCSS($this->theme->parametres->tooltipBackColor) . ';color:' . self::colorToCSS($this->theme->parametres->tooltipTextColor) . ';}'; + $res[] = '#tooltip{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->tooltipBackColor) . ';color:' . wsHTML5::colorToCSS($this->theme->parametres->tooltipTextColor) . ';}'; - # ZoomPopup close button background - $res[] = '.zoomPopupClose {background-color:'. self::colorToCSS($this->theme->parametres->couleurB) .';}'; + # ZoomPopup close button background + $res[] = '.zoomPopupClose {background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurB) . ';}'; $res = array_chunk($res, 3500); foreach ($res as $k => $css) { @@ -1486,29 +1446,4 @@ class wsHTML5Compiler { } - public static function colorToArray($color, $forceAlpha = null) { - $color = ltrim($color, '#'); - if (strlen($color) == 6) { - $hex = $color; - $alpha = 1; - } else { - $alpha = hexdec(substr($color, 0, 2)) / 255; - $hex = substr($color, 2, 6); - } - - if (!is_null($forceAlpha)) { - $alpha = $forceAlpha; - } - - return array('hex' => strtoupper($hex), 'opacity' => number_format($alpha, 3, '.', '')); - } - - public static function colorToCSS($color, $forceAlpha = null) { - return CubeIT_Graphics_Color::colorToCSS($color, $forceAlpha); - } - -} - -class wsHTML5CompilerDev extends wsHTML5Compiler { - -} +} \ No newline at end of file diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php similarity index 98% rename from inc/ws/Util/html5/class.ws.html5.links.php rename to inc/ws/Util/html5/master/class.ws.html5.links.php index 63c76a44b..67692fa83 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -268,11 +268,11 @@ class wsHTML5Link { $css .= 'width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;'; $origin = false; if ($this->rot) { - $css .= wsHTML5Compiler::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)'); + $css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)'); $origin = true; } if (isset($this->extra->skewX)) { - $css .= wsHTML5Compiler::writeCSSUA('transform', 'skewX(' . $this->extra->skewX . 'deg)'); + $css .= wsHTML5::writeCSSUA('transform', 'skewX(' . $this->extra->skewX . 'deg)'); $origin = true; } $css .= $this->getCSS(); @@ -669,7 +669,7 @@ class basketLink extends contentLink { class colorLink extends contentLink { public function getCSS() { - return 'background-color:' . wsHTML5Compiler::colorToCSS($this->to) . ';'; + return 'background-color:' . wsHTML5::colorToCSS($this->to) . ';'; } } @@ -816,8 +816,8 @@ class htmlMultimediaLink extends wsHTML5Link { $sx = ($this->width / ($this->_config['width'])) * $this->getCssScale(); $sy = ($this->height / ($this->_config['height'])) * $this->getCssScale(); - $res = wsHTML5Compiler::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')'); - $res .= wsHTML5Compiler::writeCSSUA('transform-origin', '0% 0%'); + $res = wsHTML5::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')'); + $res .= wsHTML5::writeCSSUA('transform-origin', '0% 0%'); if (!$this->_config['html']) { return ''; @@ -1017,8 +1017,8 @@ class inpesPopinLink extends htmlMultimediaLink { $css .= 'left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;'; $css .= 'width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;'; if ($this->rot) { - $css .= wsHTML5Compiler::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)'); - $css .= wsHTML5Compiler::writeCSSUA('transform-origin', '0% 0%'); + $css .= wsHTML5::writeCSSUA('transform', 'rotate(' . $this->rot . 'deg)'); + $css .= wsHTML5::writeCSSUA('transform-origin', '0% 0%'); } $css .= $this->getCSS(); $css .= '}'; diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index 65b8081c4..a6e345184 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -31,7 +31,7 @@ class wsPackagerPhonegap extends wsPackager { $vdir .= '/' . $os; } - $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, 'latest', $vdir, false, !$this->ignoreCache, $this->home); + $compiler = wsHTML5::compilerFactory($this->book_id, null, $os, 'latest', $vdir, false, !$this->ignoreCache, $this->home); $compiler->compile(); unlink($vdir . '/indext.html'); -- 2.39.5