protected function _addSpecialInfos($book, $theme, $param, $specialName)
{
- if ($specialName == 'archives' || $specialName==='slider') {
- $inBook=true;
+ if ($specialName == 'archives' || $specialName === 'slider') {
+ $inBook = true;
$p = $book->parametres;
} else {
- $inBook=false;
+ $inBook = false;
$p = $theme->parametres;
}
$pages = json_decode($this->args['pages']);
$dao->setComposition($this->args['book_id'], $pages);
- // Begin to generate files async
- $url = 'https://workshop.fluidbook.com/maintenance/processPage/' . $this->args['book_id'] . '/all/0';
- $ctx = stream_context_create(["http" => ["timeout" => 1]]);
- $it = max(4, min(12, ceil(count($pages) / 20)));
- for ($i = 0; $i < $it; $i++) {
- file_get_contents($url, 0, $ctx);
- }
+ wsBook::precompileImages($this->args['book_id']);
}
public function getTexts()
$page = $args[1];
$force = !isset($args[2]) || $args[2] != '0';
-
$daoBook = new wsDAOBook($core->con);
- $book = $daoBook->selectById($book_id);
+ $book = $daoBook->selectById($book_id, true);
+ $resolutions = wsHTML5Compiler::getBookResolutions($book);
+ $format = $book->parametres->imageFormat;
- $files = [
- ['jpg', '300', true, true, 'html'],
- ['jpg', '150', true, true, 'html'],
- ['jpg', '150', false, true, 'html'],
- ['jpg', '150', false, true, 'html'],
- //['swf', '150', true, true, ''],
- ['svg', '150', true, false, 'html'],
- ['svg', '300', true, false, 'html'],
- ['svg', '150', true, true, 'html'],
- ['svg', '200', true, true, 'html'],
- ];
+ $files = [[$format, 'thumb', true, true, '']];
+ foreach ($resolutions as $resolution) {
+ $files = array_merge($files, [
+ [$format, $resolution, true, true, 'html'],
+ [$format, $resolution, false, true, 'html'],
+ ['svg', $resolution, true, false, 'html'],
+ ['svg', $resolution, true, true, 'html'],
+ ]);
+ }
if ($page == 'all') {
$pages = range(1, $book->parametres->pages);
}
}
+ public static function processBookPages($args)
+ {
+ CubeIT_Util_PHP::neverStop();
+
+ global $core;
+
+ $book_id = $args[0];
+
+ $dao = new wsDAOBook($core->con);
+ $book = $dao->selectById($book_id);
+
+ $url = 'https://workshop.fluidbook.com/maintenance/processPage/' . $book_id . '/all/0';
+ $ctx = stream_context_create(["http" => ["timeout" => 1]]);
+ $it = 2 * max(4, min(12, ceil(count($book->parametres->pages) / 20)));
+ for ($i = 0; $i < $it; $i++) {
+ file_get_contents($url, 0, $ctx);
+ }
+ }
+
public static function getAdditionalSettingsMap(): array
{
public function getResolutions()
{
- $res = [];
+ return self::getBookResolutions($this->book);
+ }
- if ($this->maxRes == 300) {
+ public static function getBookResolutions($book)
+ {
+ $maxRes = min(300, $book->parametres->maxResolution);
+ $res = [];
+ if ($maxRes == 300) {
$res = [150, 300];
- } else if ($this->maxRes <= 150) {
- $res = [$this->maxRes];
- }
-
- if ($this->widget) {
- $res = array_merge(array(36), $res);
+ } else if ($maxRes <= 150) {
+ $res = [$maxRes];
}
return $res;
}
protected function writeWidget()
{
// Write widget html
- if ($this->widget) {
- $whtml = file_get_contents($this->assets . '/widget.html');
- $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>';
- $script .= '<script type="text/javascript" charset="utf-8" src="data/widget.js"></script>';
-
- $style = '<link type="text/css" rel="stylesheet" href="style/widget.css">';
- $vars = array('titre', 'style', 'script');
- foreach ($vars as $v) {
- if (isset($$v)) {
- $whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
- } else {
- $whtml = str_replace('<!-- $' . $v . ' -->', '', $whtml);
- }
- }
- $this->vdir->file_put_contents('widget.html', $whtml);
- }
+// if ($this->widget) {
+// $whtml = file_get_contents($this->assets . '/widget.html');
+// $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>';
+// $script .= '<script type="text/javascript" charset="utf-8" src="data/widget.js"></script>';
+//
+// $style = '<link type="text/css" rel="stylesheet" href="style/widget.css">';
+// $vars = array('titre', 'style', 'script');
+// foreach ($vars as $v) {
+// if (isset($$v)) {
+// $whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
+// } else {
+// $whtml = str_replace('<!-- $' . $v . ' -->', '', $whtml);
+// }
+// }
+// $this->vdir->file_put_contents('widget.html', $whtml);
+// }
}
function writeSEO()
{
global $core;
+ wsBook::precompileImages($this->book_id);
switch ($this->book->parametres->mobileVersion) {
case 'html5-desktop':
return $res;
}
+
+
}
+
+
if (!function_exists('is_countable')) {
function is_countable($c)