],
];
- protected $specialJsFiles = array();
+ protected $specialJsFiles = [];
public $jsFiles = [];
// Filename with no extension, relative to the /style directory in the player build folder
public $lessFiles = ['fluidbook'];
- public $specialCSS = array();
+ public $specialCSS = [];
public $phonegapStandardPlugins = array('ios' => array('ExternalFileUtil'),
'android' => array('webintent'));
- public $pluginCSS = array();
- public $pluginJs = array();
- public $htmlmultimedia = array();
- public $cssX = array();
- public $cssY = array();
- public $cssWidths = array();
+ public $pluginCSS = [];
+ public $pluginJs = [];
+ public $htmlmultimedia = [];
+ public $cssX = [];
+ public $cssY = [];
+ public $cssWidths = [];
public $pdf2htmlRatio;
public $scale;
public $multiply;
- public $div = array();
+ public $div = [];
public $numerotation;
- public $fontDocs = array();
+ public $fontDocs = [];
public $dir;
public $z = 3;
protected $_lottieIDByHash = [];
public $linkScale;
public $optimalWidth = 567;
public $optimalHeight = 709;
- public $additionalConfig = array();
+ public $additionalConfig = [];
public $fontScale = 1;
- public $cache = array();
- public $backgroundsPrefix = array();
+ public $cache = [];
+ public $backgroundsPrefix = [];
public $svg = true;
public $assets = '';
public $phonegap = false;
public $phonegapVersion;
public $standalone = false;
- public $hiddenContents = array();
+ public $hiddenContents = [];
public $appcache;
public $home;
public $widget = true;
public $multiApp = false;
- public $pageLabels = array();
- public $stylesheets = array();
+ public $pageLabels = [];
+ public $stylesheets = [];
public $logfp = null;
public $logtime = null;
- public $beginBody = array();
+ public $beginBody = [];
public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com', '*.googletagmanager.com'];
public $writeLinksData = false;
$e = explode("\n", $this->fluidbookSettings->mobilePlugins);
$main = array_pop($this->jsFiles);
- $plugins = array();
+ $plugins = [];
foreach ($e as $plugin) {
$plugin = trim($plugin);
public function getIndexVars()
{
if (null === $this->_indexVars) {
+ $assetsPrefix = '';
+ if ($this->fluidbookSettings->hosting_loadbalancer) {
+ $assetsPrefix = 'https://s1.lb.fluidbook.com/' . $this->book_id . '_' . $this->_fluidbook->hash . '/';
+ }
+
+
$titre = $this->fluidbookSettings->title;
if (null === $this->_signature) {
} else {
$credits = '';
}
- $hiddenContents = implode("\n", $this->hiddenContents);
$bgcolor = $this->themeSettings->loadingBackColor;
// Feuilles de style
$sheets = array_merge($this->stylesheets, $this->specialCSS);
- $style = array();
+ $style = [];
foreach ($sheets as $sheet) {
- $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '?j=' . time() . '">';
+ $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $assetsPrefix . $sheet . '?j=' . time() . '">';
}
$style = implode("\n\t\t", $style);
$jstime = "?j=" . time();
+
$iscript = '';
if (count($this->htmlmultimedia)) {
$iscript .= '<script type="text/javascript">' . "\n";
$iscript .= '</script>' . "\n";
}
- $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js' . $jstime . '"></script>' . "\n";
+ $script = '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . 'data/datas.js' . $jstime . '"></script>' . "\n";
foreach ($this->jsLibs as $jsLib => $files) {
- $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="data/' . $jsLib . '.js' . $jstime . '"></script>' . "\n";
+ $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . 'data/' . $jsLib . '.js' . $jstime . '"></script>' . "\n";
}
if ($this->fluidbookSettings->scorm_enable) {
- $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="data/scorm.js' . $jstime . '"></script>' . "\n";
+ $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . 'data/scorm.js' . $jstime . '"></script>' . "\n";
}
if (count($this->specialJsFiles)) {
- $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="data/special.js' . $jstime . '"></script>' . "\n";
+ $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . 'data/special.js' . $jstime . '"></script>' . "\n";
}
foreach ($this->pluginJs as $p) {
- $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $p . $jstime . '"></script>' . "\n";
+ $script .= "\t" . '<script type="text/javascript" charset="utf-8" src="' . $assetsPrefix . $p . $jstime . '"></script>' . "\n";
}
$script .= $iscript;
$datapng = 'data:image/png;base64,' . base64_encode(file_get_contents($pngFile));
$favicon .= '<link rel="icon" type="image/png" href="' . $datapng . '" />' . "\n\t";
- $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
+ $favicon .= '<link rel="apple-touch-icon" href="' . $assetsPrefix . 'data/apple-touch-icon.png" />';
}
$print = $this->writePDF();
}
$this->log('Got index vars 5');
- $vars = array('lang', 'titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description', 'console');
+ $vars = array('lang', 'titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description', 'console');
$res = [];
foreach ($vars as $v) {
return;
}
if (!isset($this->config->filesInfos)) {
- $this->config->filesInfos = array();
+ $this->config->filesInfos = [];
}
$infos = array('filesize' => filesize($file));
$dim = Image::getimagesize($file);
$multilang = Text::explodeNewLines($this->config->get('multilang', ''));
if (count($multilang)) {
- $m = array();
+ $m = [];
foreach ($multilang as $line) {
$line = trim($line);
if ($line == '') {
$this->addPDFJS();
if ($this->fluidbookSettings->scorm_enable) {
- $finals['scorm'] = array();
+ $finals['scorm'] = [];
$finals['scorm'][] = 'js/libs/scorm/apiwrapper.js';
$finals['scorm'][] = 'js/libs/scorm/scorm.js';
}
$v = $data[$k] = !!$v;
}
}
+ $data['hiddenContents'] = implode('', $this->hiddenContents);
$data['id'] = $this->book_id;
$data['compiler'] = 3;
return 'var SETTINGS=' . json_encode($data) . ';' . "\n";
protected function writeManifest()
{
- $res = array();
+ $res = [];
// TODO: Why was this function missing a return statement? It's called from populateConfig() is expected to return a value.
return $res;
}
protected function writeCSS($links)
{
- $res = array();
+ $res = [];
$this->addFontKit('OpenSans');
$from = $this->assets . '/style/*';
`cp -r $from $tmp`;
- $bookVariables = array();
+ $bookVariables = [];
foreach ($variables as $k => $v) {
$bookVariables[] = '@' . trim($k) . ':' . $v . ';';
}
public static function writeCSSUA($property, $value)
{
- $res = array();
+ $res = [];
foreach (self::$uaPrefixes as $prefix) {
$res[] = $prefix . $property . ':' . $value;
}
if (is_string($format)) {
if ($format == 'none') {
- $format = array();
+ $format = [];
} elseif ($format == 'all') {
$format = $videos;
} else {
}
if (!$force) {
- $format = array();
+ $format = [];
}
$e = explode('.', $source);
array_pop($e);
$base = implode('.', $e);
- $source = array();
+ $source = [];
foreach ($types as $type) {
$source[] = $base . '.' . $type;
}
$res['height'] = intval((string)$meta->getAttribute('content'));
}
- $r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
+ $r = array('html' => 'index.html', 'inject' => [], 'injectcss' => [], 'injectjs' => []);
} else {
$r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js'));
}
public static function getPhonegapVersions()
{
- $versions = array();
+ $versions = [];
$phonegap_dir = resource_path('fluidbookpublication/phonegap');
if (is_dir($phonegap_dir)) {