class wsHTML5Compiler {
- protected static $resolutions = array(150,36);
+ protected static $resolutions = array(150, 36);
protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
protected static $jsFiles = array(
'js/libs/cube/fb.js',
protected $cache = array();
protected $backgroundsPrefix = 'p';
protected $svg = true;
+ protected $config = array();
function __construct($book_id) {
global $core;
$this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssScale;
}
$this->numerotation = explode(',', $this->book->numerotation);
+
+ $this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject());
}
public function getCssScale() {
}
public function compile() {
- $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style', 'data/links/pages', 'data/l10n', 'swf');
+ $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style', 'swf');
foreach ($dirsToCreate as $dir) {
$d = $this->vdir . '/' . $dir;
protected function writeCache() {
$videosExtensions = array('flv', 'ogv', 'webm', 'mp4');
$videos = array('flv' => array(), 'ogv' => array(), 'webm' => array(), 'mp4' => array());
- $ignore = array('data/l10n/([a-z-]{2,5}).json');
$cacheFile = $this->vdir . '/cache.appcache';
$lines[] = 'index.html* index.html';
$lines[] = '';
$lines[] = 'CACHE:';
- $assets = array('images', 'style', 'swf', 'data/l10n', 'data/style', 'data/images', 'data/fluidbook.js');
+ $assets = array('images', 'style', 'swf', 'data/style', 'data/images', 'data/fluidbook.js');
$pages = $this->book->parametres->pages + 1;
for ($i = 0; $i <= $pages; $i++) {
$assets[] = 'data/background/150/' . $this->backgroundsPrefix . $i . '.jpg';
- $assets[] = 'data/links/pages/p' . $i . '.html';
$assets[] = 'data/contents/p' . $i . '.svg';
}
$assets[] = 'data/thumbnails';
$lang = $daoLang->selectById($this->book->lang);
$langs = $daoLang->selectAll();
-
$traductions = (!count($this->book->traductions)) ? $lang->traductions : $this->book->traductions;
- file_put_contents($this->vdir . '/data/l10n/default.json', json_encode($traductions));
+
+ $this->config->l10n=array();
+ $this->config->l10n['default']=$traductions;
+
foreach ($langs as $lang) {
- file_put_contents($this->vdir . '/data/l10n/' . $lang->lang_id . '.json', json_encode($lang->traductions));
+ $this->config->l10n[$lang->lang_id]=$lang->traductions;
}
}
$i++;
}
+ $this->config->links = array();
+
for ($i = 0; $i <= $this->book->parametres->pages + 1; $i++) {
$c = '';
if (isset($pages[$i])) {
$c = $pages[$i];
}
- file_put_contents($this->vdir . 'data/links/pages/p' . $i . '.html', $c);
+ $this->config->links[$i] = $c;
}
return $css;
}
}
protected function writeConfig() {
- $config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject());
- $config->numerotation = explode(',', $this->book->numerotation);
- $config->id = $this->book->book_id;
- $config->cacheDate = TIME;
- $config->width = $this->cssWidth;
- $config->height = $this->cssHeight;
- $config->optimalWidth = $this->optimalWidth;
- $config->optimalHeight = $this->optimalHeight;
+
+ $this->config->numerotation = explode(',', $this->book->numerotation);
+ $this->config->id = $this->book->book_id;
+ $this->config->cacheDate = TIME;
+ $this->config->width = $this->cssWidth;
+ $this->config->height = $this->cssHeight;
+ $this->config->optimalWidth = $this->optimalWidth;
+ $this->config->optimalHeight = $this->optimalHeight;
foreach ($this->additionalConfig as $k => $v) {
- $config->$k = $v;
+ $this->config->$k = $v;
}
- return 'var DATAS=' . json_encode($config) . ';' . "\n";
+ return 'var DATAS=' . json_encode($this->config) . ';' . "\n";
}
protected function writeIcons() {