protected $maxRes = 300;
public $jsFiles = array(
- 'js/libs/modernizr/modernizr.js',
+ 'js/libs/modernizr/modernizr.min.js',
'js/libs/modernizr/tests.js',
'js/libs/cube/fb.js',
'js/libs/cube/util.js',
- 'js/libs/json.js',
- 'js/libs/flashdetect.js',
- 'js/libs/screenfull.js',
+ 'js/libs/screenfull.min.js',
'js/libs/storage.js',
'js/libs/keymaster.js',
- 'js/libs/jquery/jquery.js',
+ 'js/libs/jquery/jquery.min.js',
'js/libs/jquery/jquery.transform.js',
- 'js/libs/jquery/jquery.form.js',
- 'js/libs/jquery/jquery.mousewheel.js',
- 'js/libs/jquery/jquery.hashchange.js',
- 'js/libs/jquery/jquery.scrollto.js',
- 'js/libs/jquery/jquery.localscroll.js',
- 'js/libs/jquery/perfect-scrollbar.jquery.js',
- 'js/libs/gsap/TweenMax.js',
- 'js/libs/gsap/jquery.gsap.js',
+ 'js/libs/jquery/jquery.form.min.js',
+ 'js/libs/jquery/jquery.mousewheel.min.js',
+ 'js/libs/jquery/jquery.hashchange.min.js',
+ 'js/libs/jquery/perfect-scrollbar.jquery.min.js',
+ 'js/libs/mmenu/jquery.mmenu.min.js',
+ 'js/libs/mmenu/jquery.mmenu.rtl.min.js',
+ 'js/libs/mmenu/jquery.mmenu.offcanvas.min.js',
+ 'js/libs/gsap/TweenMax.min.js',
+ 'js/libs/gsap/jquery.gsap.min.js',
'js/libs/gal/gal.js',
'js/libs/gal/gal.filesystem.js',
- 'js/libs/interact.js',
- 'js/libs/hammer.js',
+ 'js/libs/hammer.min.js',
'js/libs/fluidbook/forms/fluidbook.form.bulle.js',
'js/libs/fluidbook/fluidbook.utils.js',
'js/libs/fluidbook/fluidbook.links.js',
'js/libs/fluidbook/fluidbook.slider.js',
'js/libs/fluidbook/fluidbook.nav.js',
'js/libs/fluidbook/fluidbook.touch.js',
- 'js/libs/fluidbook/fluidbook.interact.js',
'js/libs/fluidbook/fluidbook.loader.js',
'js/libs/fluidbook/fluidbook.search.js',
'js/libs/fluidbook/fluidbook.help.js',
public $debugJsFiles = array(
'js/libs/Three.js',
'data/search.index.js',
- 'data/search.texts.js',
);
public $testJsFiles = array(
'js/libs/cube/fb.js',
- 'js/libs/modernizr/modernizr.js',
+ 'js/libs/modernizr/modernizr.min.js',
'js/libs/modernizr/tests.js',
- 'js/libs/jquery/jquery.js',
- 'js/libs/jquery/jquery.transform.js',
- 'js/libs/jquery/jquery.mousewheel.js',
- 'js/libs/jquery/jquery.hashchange.js',
+ 'js/libs/jquery/jquery.min.js',
+ 'js/libs/jquery/jquery.transform.min.js',
+ 'js/libs/jquery/jquery.mousewheel.min.js',
+ 'js/libs/jquery/jquery.hashchange.min.js',
'js/tester.js'
);
public $widgetJsFiles = array(
'js/libs/cube/fb.js',
- 'js/libs/modernizr/modernizr.js',
+ 'js/libs/modernizr/modernizr.min.js',
'js/libs/modernizr/tests.js',
'js/libs/jquery/jquery.js',
'js/libs/jquery/jquery.transit.js',
// Collection of LESS files to be compiled
// Filename with no extension, relative to the /style directory in the player build folder
public $lessFiles = ['fluidbook'];
- public $lessFilesExtras = []; // Extra files that will be copied when compiling LESS (eg. used to allow video-js-core.css to be copied)
public $specialCSS = array();
public $phonegapStandardPlugins = array('ios' => array('ExternalFileUtil'),
} else {
$this->dir = $dir;
}
- $this->vdir = $this->dir;
+ $this->vdir = new CubeIT_Files_VirtualDirectory($this->dir);
$this->wdir = WS_BOOKS . '/working/' . $this->book_id . '/';
- // Clean the folder
- `rm -rf $this->vdir`;
- if (!file_exists($this->dir)) {
- mkdir($this->dir, 0777, true);
- }
- $this->log('Clean vdir');
-
$this->daoBook = new wsDAOBook($core->con);
$this->book = $this->daoBook->selectById($book_id);
$this->pages = $this->daoBook->getPagesOfBook($book_id);
$firstDoc = $daoDoc->selectById($this->pages[1]['document_id']);
$size = $firstDoc->generalInfos['size'];
+ $this->log('Got data from database');
+
$this->width = round($size[0], 3);
$this->height = round($size[1], 3);
$this->numerotation = explode(',', $this->book->numerotation);
$this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject());
+
+ $this->log('Defined dimensions');
}
public function log($step) {
$this->log('Start compile process');
- $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style');
- if (in_array('flv', $this->getVideosFormats())) {
- $dirsToCreate[] = 'swf';
- }
-
- foreach ($dirsToCreate as $dir) {
- $d = $this->vdir . '/' . $dir;
- if (!file_exists($d)) {
- mkdir($d, 0777, true);
- }
- }
-
// Copy fonts folder
- $from = $this->assets . '/style/fonts/*';
- $to = $this->vdir . '/style/fonts';
- if (!file_exists($to)) {
- mkdir($to, 0777, true);
- }
- `cp -p -r $from $to`;
+ $from = $this->assets . '/style/fonts';
+ $to = 'style/fonts';
+ $this->vdir->copyDirectory($from, $to);
// Copy images folder
$from = $this->assets . '/images';
- $to = $this->vdir;
- `cp -p -r $from $to`;
+ $to = 'images';
+ $this->vdir->copyDirectory($from, $to);
// Copy images folder
$from = $this->assets . '/video';
- $to = $this->vdir;
- `cp -p -r $from $to`;
+ $to = 'video';
+ $this->vdir->copyDirectory($from, $to);
- // Copy swf
- if (file_exists($this->vdir . '/swf')) {
- $this->copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
- }
$this->log('Copied assets');
$this->loadPlugins();
$this->log('Plugins loaded');
$this->log('Images written');
$linksCSS = $this->writeLinks();
$this->log('Links written');
- $this->writeCSS($this->vdir . '/data/style/style_%d.css', $linksCSS);
+ $this->writeCSS('data/style/style_%d.css', $linksCSS);
$this->log('CSS written');
$this->writeLangs();
$this->log('Langs written');
$this->log('Extras written');
$this->writeJs();
$this->log('Js written');
- $this->writeCache();
- $this->log('Cache written');
+ $this->vdir->sync(true);
+ $this->log('Files Synced');
}
protected function loadPlugins() {
if (file_exists($dir . '/plugin.js')) {
$f = $d . '/plugin.js';
$this->pluginJs[] = $f;
- $this->copy($dir . '/plugin.js', $this->vdir . '/' . $f);
+ $this->vdir->copy($dir . '/plugin.js', $f);
}
if (file_exists($dir . '/plugin.css')) {
$f = $d . '/plugin.css';
$this->pluginCSS[] = $f;
- $this->copy($dir . '/plugin.css', $this->vdir . '/' . $f);
+ $this->vdir->copy($dir . '/plugin.css', $f);
}
}
return $res;
}
- protected function writeCache() {
- if (!$this->appcache) {
- return;
- }
-
- $cacheFile = $this->vdir . '/cache.appcache';
-
- if (file_exists($cacheFile)) {
- unlink($cacheFile);
- }
-
- $dest = realpath($this->vdir);
- $lines = array();
-
- $network = array('NETWORK:', '*');
-
- $lines[] = 'CACHE MANIFEST';
- $lines[] = '# ' . date('Y-m-d H:i:s');
- $lines[] = '';
- $lines[] = 'index.html';
- $lines[] = '';
- $lines[] = 'FALLBACK:';
- $lines[] = '/ index.html';
- $lines[] = 'index.html* index.html';
- $lines[] = '';
- $lines[] = 'CACHE:';
-
- $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dest), RecursiveIteratorIterator::SELF_FIRST);
-
- $exclude = array('index.html', 'indexu.html', 'widget.html', 'indext.html');
-
- foreach ($iterator as $path) {
- if (!$path->isFile()) {
- continue;
- }
-
- $p = str_replace($dest . '/', '', $path);
- if (in_array($p, $exclude)) {
- continue;
- }
- $lines[] = $p;
- }
-
- $lines[] = '';
- $lines = array_merge($lines, $network);
-
- file_put_contents($cacheFile, implode("\n", $lines));
- }
-
/**
* Helper function to add a unique script entry to the JS stack.
* Normally this is a relative path but it can be an external URL.
* @param $path The path of the file relative to the /style folder, without any extension
* @param $extra_files Optional array of extra files that should be copied across for use during LESS compilation
*/
- public function addLess($path, $extra_files = []) {
+ public function addLess($path) {
if (!in_array($path, $this->lessFiles)) {
$this->lessFiles[] = $path;
}
-
- // Make sure no duplicates are added here either
- $this->lessFilesExtras = array_unique(array_merge($this->lessFilesExtras, $extra_files));
}
protected function writeIndex() {
$favicon = '';
if ($this->theme->parametres->favicon != '') {
- copy($this->themeRoot . '/' . $this->theme->parametres->favicon, $this->vdir . '/data/favicon.png');
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->favicon, 'data/favicon.png');
$favicon = '<link rel="apple-touch-icon" href="data/favicon.png" />';
}
$message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), '<br /><a href="http://www.whatbrowser.org/intl/' . $this->config->defaultLang . '/" target="_blank">', '</a>');
$splash = '';
- if ($this->theme->parametres->logoLoader) {
- $dim = getimagesize($this->themeRoot . '/' . $this->theme->parametres->logoLoader);
+ if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
+ $dim = getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
if ($dim !== false) {
- $this->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, $this->vdir . '/data/images/' . $this->theme->parametres->logoLoader);
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader);
$splash .= '<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
}
}
- $svgfiles = array($this->assets . '/images/interface.svg');
+ $svgfiles = array($this->assets . '/images/interface.svg', WS_ICONS . '/' . $this->theme->parametres->iconSet . '/interface.svg');
$svg = '';
foreach ($svgfiles as $svgfile) {
if (file_exists($svgfile)) {
$svg .= file_get_contents($svgfile);
+ }else{
+ die($svgfile.' does not exist');
}
}
$thtml = str_replace('<!-- $' . $v . ' -->', $$v, $thtml);
}
- file_put_contents($this->vdir . '/index.html', $html);
- file_put_contents($this->vdir . '/indexu.html', $uhtml);
- file_put_contents($this->vdir . '/indext.html', $uhtml);
+ $this->vdir->file_put_contents('index.html', $html);
+ $this->vdir->file_put_contents('indexu.html', $uhtml);
+ $this->vdir->file_put_contents('indext.html', $thtml);
// Write widget html
if ($this->widget) {
foreach ($vars as $v) {
$whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
}
- file_put_contents($this->vdir . '/widget.html', $whtml);
+ $this->vdir->file_put_contents('widget.html', $whtml);
}
}
foreach ($vars as $v) {
$manifest = str_replace('$' . $v, $this->book->parametres->$v, $manifest);
}
- file_put_contents($this->vdir . '/imsmanifest.xml', $manifest);
+ $this->vdir->file_put_contents('imsmanifest.xml', $manifest);
}
protected function writePrint() {
return;
}
- $this->copy(WS_BOOKS . '/final/' . $this->book->book_id . '/data/' . $this->book->parametres->pdfName, $this->vdir . '/data/' . $this->book->parametres->pdfName);
+ $this->vdir->copy(WS_BOOKS . '/final/' . $this->book->book_id . '/data/' . $this->book->parametres->pdfName, 'data/' . $this->book->parametres->pdfName);
return '';
}
}
$iso = l10n::getISOcodes();
if ($this->book->parametres->multilang != '') {
- $flagsDir = $this->vdir . '/images/flags';
+ $flagsDir = 'images/flags';
if (!file_exists($flagsDir)) {
mkdir($flagsDir);
}
$ll = explode('-', $l[0]);
- $this->copy(cubeMedia::getFlagFile($flag), $flagsDir . '/' . $flag . '.png');
+ $this->vdir->copy(cubeMedia::getFlagFile($flag), $flagsDir . '/' . $flag . '.png');
$l[3] = cubeText::ucfirst($iso[$l[0]]);
$l[4] = cubeCountry::getCountryName($flag, $ll[0]);
$m[] = implode(',', $l);
protected function writeExtras() {
if ($this->theme->parametres->afterSearch != '') {
- $this->copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, $this->vdir . '/data/images/' . $this->theme->parametres->afterSearch);
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, 'data/images/' . $this->theme->parametres->afterSearch);
}
if ($this->book->parametres->externalArchives != '') {
$this->addFilesInfos('archives', $this->wdir . '/' . $this->book->parametres->externalArchives);
- $this->copy($this->wdir . '/' . $this->book->parametres->externalArchives, $this->vdir . '/data/images/' . $this->book->parametres->externalArchives);
+ $this->vdir->copy($this->wdir . '/' . $this->book->parametres->externalArchives, 'data/images/' . $this->book->parametres->externalArchives);
}
+
+ if ($this->book->parametres->navExtraImage != '') {
+ $this->vdir->copy($this->wdir . '/' . $this->book->parametres->navExtraImage, 'data/images/' . $this->book->parametres->navExtraImage);
+ }
+
+ if ($this->book->parametres->navExtraImageMobile != '') {
+ $this->vdir->copy($this->wdir . '/' . $this->book->parametres->navExtraImageMobile, 'data/images/' . $this->book->parametres->navExtraImageMobile);
+ }
+
}
protected function writeLinks() {
continue;
}
+ // Make old "aftersearch" link compatible with new "extra" menu option by extracting link URL
+ if ($link->page == 'aftersearch') {
+ $this->config->afterSearchLink = $link->to;
+ $this->config->afterSearchTooltip = $link->infobulle;
+ }
+
+
$c = $link->getHTMLContainer();
$css[] = $link->getCSSContainer();
if (!isset($pages[$link->page])) {
protected function writeJs() {
$config = $this->writeConfig();
- file_put_contents($this->vdir . '/data/datas.js', $config);
+ $this->vdir->file_put_contents('data/datas.js', $config);
$finals = array('fluidbook' => $this->jsFiles);
if ($this->book->parametres->scorm_enable) {
$finals['scorm'] = array();
}
if (!$reminimize) {
- if (filemtime(__FILE__) > $mintime || filemtime(__DIR__ . '/class.ws.html5.links.php') > $mintime) {
+ if (filemtime(__FILE__) > $mintime || (file_exists(__DIR__ . '/class.ws.html5.links.php') && filemtime(__DIR__ . '/class.ws.html5.links.php') > $mintime)) {
$reminimize = true;
}
}
if ($reminimize) {
- $js = 'var files=' . json_encode($files) . ';';
+ $js = '';
foreach ($files as $file) {
$js .= file_get_contents($this->assets . '/' . $file);
$js .= ";\n\n";
$uglify->execute();
$uglify->debug();
}
- $dest = $this->vdir . '/data/' . $jsfinal . '.js';
- copy($minimized, $dest);
+ $dest = 'data/' . $jsfinal . '.js';
+ $this->vdir->copy($minimized, $dest);
}
if ($this->phonegap) {
- $this->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->phonegap . '.js', $this->vdir . '/data/cordova.js');
+ $this->vdir->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->phonegap . '.js', 'data/cordova.js');
}
}
public function writeTexts() {
$this->daoBook->makeTextsIndexes($this->book, $this->pages, $index, $textes, true);
- $jsindex = 'var INDEX=' . $index . ';' . "\r";
- $jstexts = 'var TEXTS=' . $textes . ';' . "\r";
-
- file_put_contents($this->vdir . '/data/search.index.js', $jsindex);
- file_put_contents($this->vdir . '/data/search.texts.js', $jstexts);
+ $this->vdir->file_put_contents('data/search.index.js', 'var INDEX=' . $index . ';' . "\r");
if ($this->book->parametres->highlightResults) {
- file_put_contents($this->vdir . '/data/search.highlight.js', 'var HIGHLIGHTS=' . json_encode($this->daoBook->makeHighlightIndex($this->book, $this->pages)) . ";\r");
+ $this->vdir->file_put_contents('data/search.highlight.js', 'var HIGHLIGHTS=' . json_encode($this->daoBook->makeHighlightIndex($this->book, $this->pages)) . ";\r");
}
}
if ($this->phonegap && ($this->book->parametres->offlineLink == '' || $this->book->parametres->offlineLink == 'http://')) {
$this->config->share = false;
}
- $o = trim($this->config->navOrderH) != '' ? $this->config->navOrderH : $this->config->navOrder;
- $navOrder = array();
- $oo = explode(',', $o);
- foreach ($oo as $ooo) {
- $ooo = trim($ooo);
- if ($ooo == '') {
- continue;
- }
- $navOrder[] = $ooo;
- }
- $this->config->navOrder = $navOrder;
+
+ // We need to be able to reference both navOrder and navOrderH so convert both to arrays
+ // We also make sure there are no empty items in the arrays (see: http://php.net/manual/en/function.array-filter.php#111091)
+ $this->config->navOrder = array_filter(array_map('trim', explode(',', $this->config->navOrder)), 'strlen');
+ $this->config->navOrderH = array_filter(array_map('trim', explode(',', $this->config->navOrderH)), 'strlen');
$this->config->standalone = $this->standalone;
if ($this->config->phonegap) {
if ($ext == 'xlsx') {
$this->config->basketReferences = wsUtil::excelToArray($referencesFile);
if ($this->book->parametres->customLinkClass == 'AtlanticDownloadLink') {
- $this->config->basketReferences = wsUtil::atlanticReferences($this->config->basketReferences, $this->vdir . '/local/', array($this, 'log'));
+ $this->config->basketReferences = wsUtil::atlanticReferences($this->config->basketReferences, 'local/', array($this, 'log'), array($this->vdir, "copy"));
}
}
$this->log("Done cart references");
$arrowsColor = $this->theme->parametres->arrowsColor;
// Set the icon list with the color
- $icons = array('nav-bookmark' => $couleurI, 'nav-friend' => $couleurI, 'nav-help' => $couleurI, 'nav-index' => $couleurI, 'nav-sommaire' => $couleurI,
- 'nav-zoomin' => $couleurI, 'nav-zoomout' => $couleurI, 'nav-fullscreen' => $couleurI,
- 'interface-next' => $arrowsColor, 'interface-previous' => $arrowsColor,
- 'interface-sharp-next' => $arrowsColor, 'interface-sharp-previous' => $arrowsColor,
- 'interface-search' => $couleurI, 'interface-back-arrow' => $subTextColor, 'interface-print' => $subTextColor,
- 'interface-down' => $arrowsColor, 'interface-close' => $arrowsColor,
+ $icons = array('interface-down' => $arrowsColor, 'interface-close' => $arrowsColor,
'interface-audio-description-on' => $arrowsColor, 'interface-audio-description-off' => $arrowsColor,
- 'help-fingers' => $couleurI, 'help-mouse' => $couleurI, 'nav-home' => $couleurI, 'nav-archives' => $couleurI, 'nav-map' => $couleurI,
- 'nav-tag' => $couleurI, 'nav-print' => $couleurI, 'nav-friend' => $couleurI,
- 'share-facebook' => $couleurM, 'share-twitter' => $couleurM, 'share-email' => $couleurM, 'share-googleplus' => $couleurM, 'share-linkedin' => $couleurM, 'share-viadeo' => $couleurM,
+ 'help-fingers' => $couleurI, 'help-mouse' => $couleurI,
'bookmark-left-off' => $bookmarksDisabledColors, 'bookmark-left-on' => $bookmarksEnabledColors,
'bookmark-right-off' => $bookmarksDisabledColors, 'bookmark-right-on' => $bookmarksEnabledColors
);
$this->config->iconsDimensions = array();
$makepng = !$this->supportSVG();
+ $tmpdir = CubeIT_Files::tmpdir();
foreach ($icons as $icon => $color) {
- wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $this->vdir . '/data/images/', 4, $w, $h);
+ wsTools::colorizeAndRasterizeIcon($this->theme->parametres->iconSet, $icon, $color, $tmpdir, 4, $w, $h);
$this->config->iconsDimensions[$icon] = array($w, $h);
}
+ $this->vdir->copyDirectory($tmpdir, 'data/images');
+ $this->vdir->addTemp($tmpdir);
return $res;
}
protected function writeImages() {
global $core;
- foreach ($this->getResolutions() as $r) {
- mkdir($this->vdir . '/data/background/' . $r, 0777, true);
- }
$thumbs = array();
foreach ($this->pages as $page => $infos) {
wsDocument::extractTexts($full, $orig);
wsTools::optimizeSVG($orig, $opt);
- $this->copy($opt, $this->vdir . '/data/contents/p' . $page . '.svg');
+ $this->vdir->copy($opt, 'data/contents/p' . $page . '.svg');
}
foreach ($this->getResolutions() as $r) {
if ($backgroundsPrefix == 'p') {
$srcPrefix = 'h';
}
- $ok = $this->copy($docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg');
+ $ok = $this->vdir->copy($docdir . 'html/' . $srcPrefix . $r . '-' . $infos['document_page'] . '.jpg', 'data/background/' . $r . '/' . $backgroundsPrefix . $page . '.jpg');
if (!$ok && $r = 300) {
$this->maxRes = 150;
}
}
- $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg');
+ $this->vdir->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', 'data/thumbnails/p' . $page . '.jpg');
}
$thumb = false;
}
$cache = WS_CACHE . '/thumbsprites/' . hash('sha256', $hash) . '.jpg';
- $dest = $this->vdir . '/data/thumbnails/s' . $k . '.jpg';
+ $dest = 'data/thumbnails/s' . $k . '.jpg';
if (!file_exists($cache)) {
$ratio = $this->width / $this->height;
$thumbh = round(100 / $ratio);
$cmd = 'montage ' . implode(' ', $files) . ' -geometry 100x' . $thumbh . '!+0+0 -background transparent -tile ' . $cols . 'x' . $srows . ' ' . $cache;
$res .= `$cmd`;
}
- copy($cache, $dest);
+ $this->vdir->copy($cache, $dest);
$k++;
}
return $res;
$w = $size[0];
$h = $size[1];
- //$tmp = cubeFiles::tempnam() . '.png';
- $tmp = $this->vdir . '/covers.png';
+ $tmp = cubeFiles::tempnam() . '.png';
$c = new cubeCommandLine('convert');
$c->setArg(null, ROOT . '/images/ws/shade-cover-app.png');
$c->setArg(null, $tmp);
$c->execute();
+ $res = cubeFiles::tempnam() . '.jpg';
+
$convert = new cubeCommandLine('composite');
$cmd = '-compose Multiply ';
$cmd .= $tmp . ' ' . $orig . ' ';
- $cmd .= $this->vdir . '/cover.jpg';
+ $cmd .= $res;
$convert->setManualArg($cmd);
$convert->execute();
- unlink($tmp);
- }
-
- protected function copy($s, $t) {
- if (!file_exists($s)) {
- fb($s . ' dont exists');
- return false;
- }
- if (file_exists($t) && filemtime($t) >= filemtime($s) && filesize($s) == filesize($t)) {
- return true;
- }
- if (!file_exists(dirname($t))) {
- mkdir(dirname($t), 0777, true);
- }
+ $this->vdir->copy($res, 'cover.jpg', true);
- $res = copy($s, $t);
- touch($t, filemtime($s));
- return true;
+ unlink($tmp);
}
protected function _lessBoolean($val) {
$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 = 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 .= 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 . ';}';
- $search .= '.hint:hover{color:' . $searchBackColor . ';background-color:' . $searchColor . ';}';
-
- $res[] = $search;
// Background
$res[] = $this->_cssBackground();
$header .= 'height:' . $this->theme->parametres->menuHeight . 'px;';
$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);
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, 'data/images/' . $this->theme->parametres->menuImage);
$header .= 'background-image:url(../images/' . $this->theme->parametres->menuImage . ');';
$header .= 'background-repeat:no-repeat;';
$header .= 'background-size:100% ' . $this->theme->parametres->menuHeight . 'px;';
// Logo
$logo = '#logo{';
if ($this->theme->parametres->logo) {
- $this->copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo);
- $dim = getimagesize($this->vdir . '/data/images/' . $this->theme->parametres->logo);
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logo, 'data/images/' . $this->theme->parametres->logo);
+ $dim = getimagesize($this->themeRoot . '/' . $this->theme->parametres->logo);
$logo .= 'background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;';
}
$logo .= '}';
$res[] = 'footer,footer a{color:' . wsHTML5::colorToCSS($this->theme->parametres->creditsColor) . ';}';
// Arrows
- $res[] = '#next,#previous{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurA) . ';}';
+ $lessVariables['arrows-background'] = wsHTML5::colorToCSS($this->theme->parametres->couleurA);
+ $lessVariables['arrows-color'] = wsHTML5::colorToCSS($this->theme->parametres->arrowsColor);
// Audio description buttons
- $res[] = '.audio-description-button{background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurA) . ';}';
- $lessVariables['links-color'] = wsHTML5::colorToCSS($this->theme->parametres->linksColor);
+ $lessVariables['audiodescription-background'] = wsHTML5::colorToCSS($this->theme->parametres->couleurA);
+ $lessVariables['audiodescription-color'] = wsHTML5::colorToCSS($this->theme->parametres->couleurA);
// Links Styles
+ $lessVariables['links-color'] = wsHTML5::colorToCSS($this->theme->parametres->linksColor);
$res = array_merge($res, $links);
// Bookmarks
$menuColor = new CubeIT_Graphics_Color($this->theme->parametres->couleurB);
$menuColor->setAlpha(1);
$menuTextColor = wsHTML5::colorToCSS($this->theme->parametres->subTextColor);
+ $menuBreakpoint = empty($this->book->parametres->menuBreakpoint) ? '1080px' : $this->book->parametres->menuBreakpoint;
+ $lessVariables['menu-breakpoint'] = $menuBreakpoint;
$lessVariables['menu-background'] = $menuColor->toCSS();
$lessVariables['menu-text'] = $menuTextColor;
$lessVariables['menu-field-background'] = wsHTML5::colorToCSS($this->theme->parametres->subFieldColor);
$lessVariables['menu-field-text'] = wsHTML5::colorToCSS($this->theme->parametres->subTextFieldColor);
+ $lessVariables['menu-select-background'] = wsHTML5::colorToCSS($this->theme->parametres->subSelectColor);
+ $lessVariables['menu-select-text'] = wsHTML5::colorToCSS($this->theme->parametres->subTextSelectColor);
+ $lessVariables['icon-color'] = wsHTML5::colorToCSS($this->theme->parametres->couleurI);
$menuMultiply = $menuColor->multiply($menuColor);
// Archives
if ($this->book->parametres->externalArchivesBack) {
- $this->copy($this->wdir . '/' . $this->book->parametres->externalArchivesBack, $this->vdir . '/data/images/' . $this->book->parametres->externalArchivesBack);
+ $this->vdir->copy($this->wdir . '/' . $this->book->parametres->externalArchivesBack, 'data/images/' . $this->book->parametres->externalArchivesBack);
$res[] = '.mview.archives{background-image:url("../images/' . $this->book->parametres->externalArchivesBack . '");}';
}
$res = array_chunk($res, 3500);
foreach ($res as $k => $css) {
$this->stylesheets[] = 'data/style/style_' . $k . '.css';
- file_put_contents(sprintf($file, $k), implode("\n", $css));
+ $this->vdir->file_put_contents(sprintf($file, $k), implode("\n", $css));
}
return count($res);
}
}
file_put_contents($tmp . '/book-variables.less', implode("\n", $bookVariables));
- // Also copy any "extra" files that might be needed by LESS compilation
- // (eg. video-js-core.css is needed by videojs.less)
- foreach ($this->lessFilesExtras as $extra) {
- $destination_extra = $tmp . '/' . $extra;
- if (!is_dir(dirname($destination_extra))) {
- mkdir(dirname($destination_extra), 0777, true);
- }
- copy($this->assets . '/style/' . $extra, $destination_extra);
- }
-
foreach ($this->lessFiles as $f) {
$source_less = $this->assets . '/style/' . $f . '.less';
$destination_less = $tmp . '/' . $f . '.less';
- $destination_css = 'style/' . $f . '.css';
+ $destination_css = $tmp . '/' . $f . '.css';
if (!file_exists($source_less)) {
continue;
if (!is_dir(dirname($destination_less))) {
mkdir(dirname($destination_less), 0777, true);
}
- // Generated CSS file might be in a subfolder, so create if it doesn't exist
- if (!is_dir(dirname($this->vdir . '/' . $f . '.css'))) {
- mkdir(dirname($this->vdir . '/' . $f . '.css'), 0777, true);
- }
// Less files must be copied to temporary directory so they'll
// have access to the variables generated in book-variables.less
copy($source_less, $destination_less);
$less = new CubeIT_CommandLine('/usr/local/bin/lessc');
- //$less->setArg('clean-css', '--s1 --advanced --compatibility=ie10');
$less->setArg(null, $destination_less);
- $less->setArg(null, $this->vdir . '/' . $destination_css);
+ $less->setArg(null, $destination_css);
$less->execute();
$less->debug();
- if (!file_exists($this->vdir . '/' . $destination_css)) {
+ if (!file_exists($destination_css)) {
die($less->output);
}
+ $this->vdir->copy($destination_css, 'style/' . $f . '.css');
if ($f != 'widget') {
- $this->stylesheets[] = $destination_css;
+ $this->stylesheets[] = 'style/' . $f . '.css';
}
}
}
$this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]);
}
- $this->copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage);
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, 'data/images/' . $this->theme->parametres->backgroundImage);
$body .= 'background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');';
$body .= 'background-position:';
}
public function copyLinkDir($source, $dest) {
- `cp -a $source $this->vdir/$dest`;
+ $this->vdir->copyDirectory($source, $dest);
}
public function simpleCopyLinkFile($source, $dest, $addVdir = true) {
if ($addVdir) {
- $dest = $this->vdir . '/' . $dest;
- }
- if (!file_exists(dirname($dest))) {
- mkdir(dirname($dest), 0777, true);
- }
- if (file_exists($dest) && filemtime($dest) >= filemtime($source) && filesize($dest) == filesize($source)) {
- return;
+ $dest = $dest;
}
- $this->copy($source, $dest);
+ $this->vdir->copy($source, $dest);
}
public function copyLinkFile($source, $dest, $video = false) {
foreach ($source as $so) {
$s = $origDir . $so;
if (file_exists($s)) {
- $d = $this->vdir . '/' . $dest . '/' . $so;
+ $d = $dest . '/' . $so;
$this->simpleCopyLinkFile($s, $d, false);
}
}