<?php
-class wsPackagerHTML extends wsPackager {
+class wsPackagerHTML extends wsPackager
+{
protected $origHTML;
protected $_labels = array();
protected $_allowNeworking = 'all';
protected $_ext = 'html';
+ protected $_forceOnlyHtml = false;
+ protected $_disableScorm = true;
- public function __construct($book_id, $vdir = null, $whole = true) {
+ public function __construct($book_id, $vdir = null, $whole = true)
+ {
parent::__construct($book_id, $vdir, $whole);
$this->version = 'html';
}
- protected function getMinFlashVersion() {
+ protected function getMinFlashVersion()
+ {
return '10.0.22';
}
- protected function getSWFFiles() {
+ protected function getSWFFiles()
+ {
return array('index.swf', 'player.swf');
}
- protected function preparePackage() {
+ protected function preparePackage()
+ {
parent::preparePackage();
- if($this->book->parametres->scorm_enable){
- $this->book->parametres->alwaysHTML5=true;
+ if ($this->_forceOnlyHtml) {
+ $this->book->parametres->alwaysHTML5 = true;
+ }
+ if ($this->_disableScorm) {
+ $this->book->parametres->scorm_enable = false;
}
$this->_ext = $this->book->parametres->htmlExtension;
// Stuffs to replace in html
$toReplace = array('lang' => strtolower($this->book->lang),
- 'ga' => $ga,
- 'statsfooter' => $statsfooter,
- 'facebook' => $facebook,
- 'bgcolor' => $this->theme->parametres->loadingBackColor,
- 'redirectMobile' => $redirectMobile,
- 'redirectPDF' => $redirectPDF,
- 'junk' => TIME,
- 'robots' => $robots,
- 'favicon' => $favicon,
- 'flashversion' => $this->getMinFlashVersion(),
- 'fv' => json_encode($this->getFlashvars()),
- 'alwaysHTML5' => $alwaysHTML5,
- 'keywords' => $keywords,
- 'allowNetworking' => $this->_allowNeworking,
- 'redirectIfFlashNotInstalled' => in_array($html5priority, array('true', 'notinstalled')) ? 'true' : 'false',
- 'redirectIfFlashBlocked' => $html5priority == 'true' ? 'true' : 'false',
- 'flash_blocked_wait' => $this->book->parametres->flashBlockedWait,
+ 'ga' => $ga,
+ 'statsfooter' => $statsfooter,
+ 'facebook' => $facebook,
+ 'bgcolor' => $this->theme->parametres->loadingBackColor,
+ 'redirectMobile' => $redirectMobile,
+ 'redirectPDF' => $redirectPDF,
+ 'junk' => TIME,
+ 'robots' => $robots,
+ 'favicon' => $favicon,
+ 'flashversion' => $this->getMinFlashVersion(),
+ 'fv' => json_encode($this->getFlashvars()),
+ 'alwaysHTML5' => $alwaysHTML5,
+ 'keywords' => $keywords,
+ 'allowNetworking' => $this->_allowNeworking,
+ 'redirectIfFlashNotInstalled' => in_array($html5priority, array('true', 'notinstalled')) ? 'true' : 'false',
+ 'redirectIfFlashBlocked' => $html5priority == 'true' ? 'true' : 'false',
+ 'flash_blocked_wait' => $this->book->parametres->flashBlockedWait,
);
$this->origHTML = $this->book->parametres->htmlPrepend . file_get_contents($this->vdir . '/index.html');
fb(time(), 'end prepare seo');
}
- protected function getFlashvars() {
+ protected function getFlashvars()
+ {
return array();
}
- public function prepareHTML5() {
+ public function prepareHTML5()
+ {
fb(time(), 'start prepare html5');
if (!$this->whole) {
return;
}
-
- $this->daoBook->compile($this->book_id, 'html5', false, $this->book->parametres->forceCompileOnDownload);
+ $this->daoBook->compile($this->book_id, 'html5', false, $this->book->parametres->forceCompileOnDownload, false, $this->book);
$dest = $this->vdir . 'm';
if (!file_exists($dest)) {
mkdir($dest, 0777, true);
}
-
$cp = new cubeCommandLine('cp');
$cp->setPath(CONVERTER_PATH);
$cp->setArg('r');
$cp->setArg(null, $dest);
$cp->execute();
-
$filesToAdd = array();
if ($this->book->parametres->mobileServerConfig) {
$filesToAdd = array('.htaccess', 'web.config');
fb(time(), 'end prepare html5');
}
- public function makePackage($zip) {
+ public function makePackage($zip)
+ {
parent::makePackage($zip);
if ($zip) {
return $this->zip();
return $this->getFinalPackageDir();
}
- protected function makeHTMLNav($root) {
+ protected function makeHTMLNav($root)
+ {
$res = '<nav>';
foreach ($this->pages as $page => $infos) {
$label = $this->_getLabelOfPage($page);
return $res;
}
- protected function _getLabelOfPage($page) {
+ protected function _getLabelOfPage($page)
+ {
if (!isset($this->_chapters)) {
$this->_chapters = $this->book->chapters;
}
return $this->_labels[$page];
}
- protected function _sortCandidates($a, $b) {
+ protected function _sortCandidates($a, $b)
+ {
if ($a->level > $b->level) {
return 1;
} else if ($a->level < $b->level) {
}
}
- protected function _getVirtualPage($page) {
+ protected function _getVirtualPage($page)
+ {
$num = explode(',', $this->book->numerotation);
if (isset($num[$page - 1])) {
return $num[$page - 1];
return 1;
}
- protected function escape($txt, $replaceNewLines = false) {
+ protected function escape($txt, $replaceNewLines = false)
+ {
$res = htmlentities($txt, ENT_COMPAT, 'UTF-8');
if ($replaceNewLines) {
$res = str_replace("\n", ' ', $res);
return $res;
}
- protected function makeHTMLFooter() {
+ protected function makeHTMLFooter()
+ {
$res = '<footer>';
$res .= '<h2><a href="https://www.fluidbook.com">Fluidbook : Solution de catalogues interactifs et brochures en ligne</a></h2>';
$res .= '</footer>';
return $res;
}
- protected function replaceHTML($toReplace) {
+ protected function replaceHTML($toReplace)
+ {
return $this->replaceContents($this->origHTML, $toReplace);
}
- protected function mergeJavascript() {
+ protected function mergeJavascript()
+ {
$dest = WS_COMPILE_ASSETS . '/fluidbook.js';
$orig = WS_COMPILE_ASSETS . '/_js/';
$files = array('log4js.js' => false, 'esapi.js' => false, 'resources/i18n/ESAPI_Standard_en_US.properties.js' => false, 'resources/Base.esapi.properties.js' => false, 'swfobject.js' => false, 'swfaddress.js' => true, 'fluidbook.js' => true);