'display_area' => __('Afficher le lien au rollover'),
'extra' => __('Paramètre supplémentaire'),
'alternative' => __('Alternative'),
- 'image' => __('Image')
+ 'read_mode' => __('Mode de lecture'),
+ 'image' => __('Image'),
+ 'group' => __('Groupe'),
);
new PHPExcel();
public $beginBody = array();
public $seoArticles = [];
public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com'];
+ protected $_indexVars = null;
public $_signature;
/**
$this->vdir->copyDirectory($from, $directory);
}
+ if ($this->book->parametres->scorm_enable) {
+ $this->book->parametres->seoVersion = false;
+ }
+
$this->log('Copied assets');
$this->loadPlugins();
$this->log('Plugins loaded');
protected function _writeIndex($page)
{
- global $core;
$seo = $this->seo->pages[$page];
$html = $seo->getHTML();
- $titre = $this->book->parametres->title;
+ $iv = $this->getIndexVars();
-
- if (null === $this->_signature) {
- $daoSignature = new wsDAOSignature($core->con);
- $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+ foreach ($iv as $k => $v) {
+ $html = str_replace($k, $v, $html);
}
- $credits = '';
- if ($this->_signature->partner != '') {
- $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+ if ($this->book->parametres->seoVersion) {
+ $seo->writePage($html, $this->vdir);
+ }
+ if ($page == 1) {
+ $seo->writePage($html, $this->vdir, 'index.html');
}
- $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
+ }
- $hiddenContents = implode("\n", $this->hiddenContents);
+ public function getIndexVars()
+ {
+ if (null === $this->_indexVars) {
+ global $core;
+ $titre = $this->book->parametres->title;
- $bgcolor = $this->theme->parametres->loadingBackColor;
+ if (null === $this->_signature) {
+ $daoSignature = new wsDAOSignature($core->con);
+ $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+ }
- // Feuilles de style
- $sheets = array_merge($this->stylesheets, $this->specialCSS);
+ $credits = '';
+ if ($this->_signature->partner != '') {
+ $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+ }
+ $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
- $style = array();
- foreach ($sheets as $sheet) {
- $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
- }
- $style = implode("\n\t\t", $style);
+ $hiddenContents = implode("\n", $this->hiddenContents);
- $pagesContents = '';
+ $bgcolor = $this->theme->parametres->loadingBackColor;
- $cache = '';
+ // Feuilles de style
+ $sheets = array_merge($this->stylesheets, $this->specialCSS);
- $beginbody = implode("\n", array_unique($this->beginBody));
+ $style = array();
+ foreach ($sheets as $sheet) {
+ $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
+ }
+ $style = implode("\n\t\t", $style);
- $iscript = '';
- if (count($this->htmlmultimedia)) {
- $iscript .= '<script type="text/javascript">' . "\n";
- $iscript .= implode("\n", $this->htmlmultimedia);
- $iscript .= '</script>' . "\n";
- }
+ $pagesContents = '';
- $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
- $script .= '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
- $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
- if ($this->book->parametres->scorm_enable) {
- $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
- }
- if (count($this->specialJsFiles)) {
- $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
- }
- foreach ($this->pluginJs as $p) {
- $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
- }
- $script .= $iscript;
+ $cache = '';
+
+ $beginbody = implode("\n", array_unique($this->beginBody));
- $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
- $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
- $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
- $dim = CubeIT_Image::getimagesize($socialImage);
- $socialImageWidth = $dim[0];
- $socialImageHeight = $dim[1];
+ $iscript = '';
+ if (count($this->htmlmultimedia)) {
+ $iscript .= '<script type="text/javascript">' . "\n";
+ $iscript .= implode("\n", $this->htmlmultimedia);
+ $iscript .= '</script>' . "\n";
+ }
- $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
+ $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
+ $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
+ $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
+ if ($this->book->parametres->scorm_enable) {
+ $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
+ }
+ if (count($this->specialJsFiles)) {
+ $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
+ }
+ foreach ($this->pluginJs as $p) {
+ $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
+ }
+ $script .= $iscript;
+
+ $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
+ $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
+ $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
+ $dim = CubeIT_Image::getimagesize($socialImage);
+ $socialImageWidth = $dim[0];
+ $socialImageHeight = $dim[1];
+
+ $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
<meta name="twitter:description" content="' . html::escapeHTML($socialDescription) . '">
<meta name="twitter:image" content="' . $socialImage . '">
<meta name="twitter:site" content="@Fluidbook">
<meta name="twitter:card" content="summary_large_image">';
- $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
+ $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
<meta property="og:description" content="' . html::escapeHTML($socialDescription) . '"/>
<meta property="og:image" content="' . $socialImage . '"/>
<meta property="og:image:width" content="' . $socialImageWidth . '"/>
<meta property="og:image:height" content="' . $socialImageHeight . '"/>';
- $favicon = '';
- $hasIos = false;
- if ($this->theme->parametres->iosicon != '') {
- $hasIos = true;
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
- $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
- }
- if ($this->theme->parametres->favicon != '') {
-
- $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
- $icoFile = $this->themeRoot . '/favicon.ico';
- if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
- $tmp = CubeIT_Files::tempnam() . '.png';
- $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
- `$convert`;
-
- $icotool = new cubeCommandLine('icotool');
- $icotool->setArg('c');
- $icotool->setArg('o', $icoFile);
- $icotool->setArg(null, $tmp);
- $icotool->execute();
-
- unlink($tmp);
+ $favicon = '';
+ $hasIos = false;
+ if ($this->theme->parametres->iosicon != '') {
+ $hasIos = true;
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
+ $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
}
- $this->vdir->copy($pngFile, 'data/favicon.png');
- $this->vdir->copy($icoFile, 'data/favicon.ico');
- $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
- $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
- $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
- if (!$hasIos) {
- $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+ if ($this->theme->parametres->favicon != '') {
+
+ $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
+ $icoFile = $this->themeRoot . '/favicon.ico';
+ if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
+ $tmp = CubeIT_Files::tempnam() . '.png';
+ $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
+ `$convert`;
+
+ $icotool = new cubeCommandLine('icotool');
+ $icotool->setArg('c');
+ $icotool->setArg('o', $icoFile);
+ $icotool->setArg(null, $tmp);
+ $icotool->execute();
+
+ unlink($tmp);
+ }
+ $this->vdir->copy($pngFile, 'data/favicon.png');
+ $this->vdir->copy($icoFile, 'data/favicon.ico');
+ $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
+ $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
+ $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
+ if (!$hasIos) {
+ $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+ }
}
- }
- $print = $this->writePrint();
- $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>');
+ $print = $this->writePrint();
+ $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 && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
- $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
- if ($dim !== false) {
- $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>';
+ $splash = '';
+ if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
+ $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
+ if ($dim !== false) {
+ $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', 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');
+ $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');
+ }
}
- }
- if ($this->phonegap) {
- $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
- }
- $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
- foreach ($vars as $v) {
- if (isset($$v)) {
- $html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
- } else {
- $html = str_replace('<!-- $' . $v . ' -->', '', $html);
+ if ($this->phonegap) {
+ $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
}
- }
- $seo->writePage($html, $this->vdir);
- if ($page == 1) {
- $seo->writePage($html, $this->vdir, 'index.html');
- }
+ $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
+
+ $res = [];
+ foreach ($vars as $v) {
+ if (isset($$v)) {
+ $res['<!-- $' . $v . ' -->'] = $$v;
+ } else {
+ $res['<!-- $' . $v . ' -->'] = '';
+ }
+ }
+ $this->_indexVars = $res;
}
+ return $this->_indexVars;
+ }
protected function writeIndex()
{
- foreach ($this->pages as $page => $infos) {
- $this->_writeIndex($page);
- }
+ if ($this->book->parametres->seoVersion) {
+ foreach ($this->pages as $page => $infos) {
+ $this->_writeIndex($page);
+ }
+ } else {
+ $this->_writeIndex(1);
}
+ }
protected function writeWidget()
{
}
$origDir = $this->wdir;
-
+ $types = $this->getVideosFormats();
if ($video) {
wsTools::encodeWebVideos($origDir . $source, null, true);
$e = explode('.', $source);
array_pop($e);
$base = implode('.', $e);
$source = array();
- $types = $this->getVideosFormats();
foreach ($types as $type) {
$source[] = $base . '.' . $type;
}
public $beginBody = array();
public $seoArticles = [];
public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com'];
+ protected $_indexVars = null;
public $_signature;
/**
$this->vdir->copyDirectory($from, $directory);
}
+ if ($this->book->parametres->scorm_enable) {
+ $this->book->parametres->seoVersion = false;
+ }
+
$this->log('Copied assets');
$this->loadPlugins();
$this->log('Plugins loaded');
protected function _writeIndex($page)
{
- global $core;
$seo = $this->seo->pages[$page];
$html = $seo->getHTML();
- $titre = $this->book->parametres->title;
+ $iv = $this->getIndexVars();
-
- if (null === $this->_signature) {
- $daoSignature = new wsDAOSignature($core->con);
- $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+ foreach ($iv as $k => $v) {
+ $html = str_replace($k, $v, $html);
}
- $credits = '';
- if ($this->_signature->partner != '') {
- $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+ if ($this->book->parametres->seoVersion) {
+ $seo->writePage($html, $this->vdir);
+ }
+ if ($page == 1) {
+ $seo->writePage($html, $this->vdir, 'index.html');
}
- $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
+ }
- $hiddenContents = implode("\n", $this->hiddenContents);
+ public function getIndexVars()
+ {
+ if (null === $this->_indexVars) {
+ global $core;
+ $titre = $this->book->parametres->title;
- $bgcolor = $this->theme->parametres->loadingBackColor;
- // Feuilles de style
- $sheets = array_merge($this->stylesheets, $this->specialCSS);
+ if (null === $this->_signature) {
+ $daoSignature = new wsDAOSignature($core->con);
+ $this->_signature = $daoSignature->selectById($this->book->parametres->signature);
+ }
- $style = array();
- foreach ($sheets as $sheet) {
- $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
- }
- $style = implode("\n\t\t", $style);
+ $credits = '';
+ if ($this->_signature->partner != '') {
+ $credits = '<a href="' . $this->_signature->partnerLink . '" target="_blank">' . $this->_signature->partner . '</a> ';
+ }
+ $credits .= '<a href="' . $this->_signature->mainLink . '" target="_blank">' . $this->_signature->main . '</a>';
- $pagesContents = '';
+ $hiddenContents = implode("\n", $this->hiddenContents);
- $cache = '';
+ $bgcolor = $this->theme->parametres->loadingBackColor;
- $beginbody = implode("\n", array_unique($this->beginBody));
+ // Feuilles de style
+ $sheets = array_merge($this->stylesheets, $this->specialCSS);
- $iscript = '';
- if (count($this->htmlmultimedia)) {
- $iscript .= '<script type="text/javascript">' . "\n";
- $iscript .= implode("\n", $this->htmlmultimedia);
- $iscript .= '</script>' . "\n";
- }
+ $style = array();
+ foreach ($sheets as $sheet) {
+ $style[] = '<link type="text/css" rel="stylesheet" media="screen" href="' . $sheet . '">';
+ }
+ $style = implode("\n\t\t", $style);
- $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
- $script .= '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
- $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
- if ($this->book->parametres->scorm_enable) {
- $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
- }
- if (count($this->specialJsFiles)) {
- $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
- }
- foreach ($this->pluginJs as $p) {
- $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
- }
- $script .= $iscript;
+ $pagesContents = '';
+
+ $cache = '';
+
+ $beginbody = implode("\n", array_unique($this->beginBody));
+
+ $iscript = '';
+ if (count($this->htmlmultimedia)) {
+ $iscript .= '<script type="text/javascript">' . "\n";
+ $iscript .= implode("\n", $this->htmlmultimedia);
+ $iscript .= '</script>' . "\n";
+ }
+
+
+ $script = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
+ $script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
+ if ($this->book->parametres->scorm_enable) {
+ $script .= '<script type="text/javascript" charset="utf-8" src="data/scorm.js"></script>' . "\n";
+ }
+ if (count($this->specialJsFiles)) {
+ $script .= '<script type="text/javascript" charset="utf-8" src="data/special.js"></script>' . "\n";
+ }
+ foreach ($this->pluginJs as $p) {
+ $script .= '<script type="text/javascript" charset="utf-8" src="' . $p . '"></script>' . "\n";
+ }
+ $script .= $iscript;
- $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
- $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
- $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
- $dim = CubeIT_Image::getimagesize($socialImage);
- $socialImageWidth = $dim[0];
- $socialImageHeight = $dim[1];
+ $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
+ $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
+ $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . TIME;
+ $dim = CubeIT_Image::getimagesize($socialImage);
+ $socialImageWidth = $dim[0];
+ $socialImageHeight = $dim[1];
- $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
+ $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
<meta name="twitter:description" content="' . html::escapeHTML($socialDescription) . '">
<meta name="twitter:image" content="' . $socialImage . '">
<meta name="twitter:site" content="@Fluidbook">
<meta name="twitter:card" content="summary_large_image">';
- $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
+ $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
<meta property="og:description" content="' . html::escapeHTML($socialDescription) . '"/>
<meta property="og:image" content="' . $socialImage . '"/>
<meta property="og:image:width" content="' . $socialImageWidth . '"/>
<meta property="og:image:height" content="' . $socialImageHeight . '"/>';
- $favicon = '';
- $hasIos = false;
- if ($this->theme->parametres->iosicon != '') {
- $hasIos = true;
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
- $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
- }
- if ($this->theme->parametres->favicon != '') {
-
- $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
- $icoFile = $this->themeRoot . '/favicon.ico';
- if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
- $tmp = CubeIT_Files::tempnam() . '.png';
- $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
- `$convert`;
-
- $icotool = new cubeCommandLine('icotool');
- $icotool->setArg('c');
- $icotool->setArg('o', $icoFile);
- $icotool->setArg(null, $tmp);
- $icotool->execute();
-
- unlink($tmp);
+ $favicon = '';
+ $hasIos = false;
+ if ($this->theme->parametres->iosicon != '') {
+ $hasIos = true;
+ $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
+ $favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />';
}
- $this->vdir->copy($pngFile, 'data/favicon.png');
- $this->vdir->copy($icoFile, 'data/favicon.ico');
- $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
- $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
- $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
- if (!$hasIos) {
- $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+ if ($this->theme->parametres->favicon != '') {
+
+ $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
+ $icoFile = $this->themeRoot . '/favicon.ico';
+ if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
+ $tmp = CubeIT_Files::tempnam() . '.png';
+ $convert = "convert $pngFile -resize 64x64^ -gravity center $tmp";
+ `$convert`;
+
+ $icotool = new cubeCommandLine('icotool');
+ $icotool->setArg('c');
+ $icotool->setArg('o', $icoFile);
+ $icotool->setArg(null, $tmp);
+ $icotool->execute();
+
+ unlink($tmp);
+ }
+ $this->vdir->copy($pngFile, 'data/favicon.png');
+ $this->vdir->copy($icoFile, 'data/favicon.ico');
+ $favicon .= '<link rel="shortcut icon" href="data/favicon.ico" />';
+ $favicon .= '<link rel="icon" type="image/vnd.microsoft.icon" href="data/favicon.ico" />';
+ $favicon .= '<link rel="icon" type="image/png" href="data/favicon.png" />';
+ if (!$hasIos) {
+ $favicon .= '<link rel="apple-touch-icon" href="data/favicon.png" />';
+ }
}
- }
- $print = $this->writePrint();
- $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>');
+ $print = $this->writePrint();
+ $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 && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
- $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
- if ($dim !== false) {
- $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>';
+ $splash = '';
+ if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
+ $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
+ if ($dim !== false) {
+ $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', 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');
+ $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');
+ }
}
- }
- if ($this->phonegap) {
- $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
- }
- $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
- foreach ($vars as $v) {
- if (isset($$v)) {
- $html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
- } else {
- $html = str_replace('<!-- $' . $v . ' -->', '', $html);
+ if ($this->phonegap) {
+ $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
}
- }
+ $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
- $seo->writePage($html, $this->vdir);
- if ($page == 1) {
- $seo->writePage($html, $this->vdir, 'index.html');
+ $res = [];
+ foreach ($vars as $v) {
+ if (isset($$v)) {
+ $res['<!-- $' . $v . ' -->'] = $$v;
+ } else {
+ $res['<!-- $' . $v . ' -->'] = '';
+ }
+ }
+ $this->_indexVars = $res;
}
+ return $this->_indexVars;
}
protected function writeIndex()
{
- foreach ($this->pages as $page => $infos) {
- $this->_writeIndex($page);
+ if ($this->book->parametres->seoVersion) {
+ foreach ($this->pages as $page => $infos) {
+ $this->_writeIndex($page);
+ }
+ } else {
+ $this->_writeIndex(1);
}
}
$style = '<link type="text/css" rel="stylesheet" href="style/widget.css">';
$vars = array('titre', 'style', 'script');
foreach ($vars as $v) {
- $whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
+ if (isset($$v)) {
+ $whtml = str_replace('<!-- $' . $v . ' -->', $$v, $whtml);
+ } else {
+ $whtml = str_replace('<!-- $' . $v . ' -->', '', $whtml);
+ }
}
$this->vdir->file_put_contents('widget.html', $whtml);
}
public $in_popup = false;
public $display_area;
public $read_mode;
+ public $group;
public $infobulle;
public $extra;
public $id;
'robots' => $this->robots ? '<meta name="robots" content="' . $this->robots . '">' : '',\r
'statsfooter' => $this->footer,\r
'ga' => $this->ua,\r
- 'seoContent' => $this->getSEOContent()];\r
+ 'seoContent' => $this->getSEOContent(),\r
+ 'startpage' => '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $this->page . '";</script>' . "\n"];\r
\r
foreach ($vars as $k => $var) {\r
$html = str_replace('<!-- $' . $k . ' -->', $var, $html);\r