return false;
}
+ public function writeFlexipanCart()
+ {
+ $this->lessVariables['import-cart-styles'] = 'flexipan';
+
+ $this->addJsLib('cookie', 'js/libs/jquery/jquery.cookie.js');
+ $this->addJsLib('flexipan', 'js/libs/fluidbook/cart/fluidbook.cart.flexipan.js');
+ $this->addJsLib('html2pdf', 'js/libs/html2pdf/html2pdf.min.js');
+
+ $cdir = $this->wdir . '/commerce/';
+
+
+ $file = $cdir . $this->book->parametres->basketReferences;
+ $this->config->basketReferences = wsUtil::excelToArrayKeyVars($file);
+
+ wsLinks::getLinksAndRulersFromFile($this->book_id, $links, $rulers);
+
+ foreach ($links as $link) {
+ if ($link['type'] == '12') {
+
+ }
+ }
+
+ $this->config->product_zoom_references = [];
+ foreach ($this->config->basketReferences as $ref => $data){
+ $this->config->product_zoom_references[$ref] = [$ref];
+ }
+ }
+
public function writeMIFCart()
{
$this->lessVariables['import-cart-styles'] = 'mif';
if ($this->config->basket) {
$this->addJsLib('cart', 'js/libs/fluidbook/fluidbook.cart.js');
switch ($this->config->basketManager) {
+ case 'Flexipan';
+ return $this->writeFlexipanCart();
case 'Puma':
return $this->writePumaCart();
case 'MIF':
$this->config->tagcommander_plan = $fixedplan;
}
}
+ if (isset($this->book->parametres->googleTagManager) && $this->book->parametres->googleTagManager) {
+ $this->book->parametres->googleAnalyticsCustom .= "<!-- Google Tag Manager -->
+<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
+new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
+j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
+})(window,document,'script','dataLayer','" . $this->book->parametres->googleTagManager . "');</script>
+<!-- End Google Tag Manager -->
+";
+ $this->book->parametres->statsCustom = '<!-- Google Tag Manager (noscript) -->
+<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=' . $this->book->parametres->googleTagManager . '"
+height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
+<!-- End Google Tag Manager (noscript) -->';
+ }
}
protected function writeSecure()
$favicon = '';
$hasIos = false;
- if ($this->theme->parametres->iosicon != '') {
+ if ($iosico = $this->checkThemeImage($this->theme->parametres->iosicon)) {
$hasIos = true;
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->iosicon, 'data/apple-touch-icon.png');
+ $this->vdir->copy($iosico, 'data/apple-touch-icon.png');
$favicon .= '<link rel="apple-touch-icon" href="data/apple-touch-icon.png" />' . "\n\t";
}
if ($this->theme->parametres->favicon != '') {
- $pngFile = $this->themeRoot . '/' . $this->theme->parametres->favicon;
- $icoFile = $this->themeRoot . '/favicon.ico';
+ $pngFile = $this->checkThemeImage($this->theme->parametres->favicon);
+ $icoFile = $this->checkThemeImage('favicon.ico');
if (!file_exists($icoFile) || filemtime($icoFile) < filemtime($pngFile) || filemtime(__FILE__) > filemtime($icoFile)) {
$tmp = CubeIT_Files::tempnam() . '.png';
if ($this->book->parametres->splashURL !== '') {
$splash = '<a href="' . $this->book->parametres->splashURL . '" target="' . $this->book->parametres->splashTarget . '" style="display:block;position:absolute;top:0;left;0;width:100%;height:100%"></a>';
}
- } else if ($this->theme->parametres->logoLoader && file_exists($this->themeRoot . $this->theme->parametres->logoLoader)) {
- $dim = CubeIT_Image::getimagesize($this->themeRoot . $this->theme->parametres->logoLoader);
+ } else if ($ll = $this->checkThemeImage($this->theme->parametres->logoLoader)) {
+ $dim = CubeIT_Image::getimagesize($ll);
if ($dim !== false) {
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, 'data/images/' . $this->theme->parametres->logoLoader);
+ $this->vdir->copy($ll, '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>';
}
}
protected function writeExtras()
{
- if ($this->theme->parametres->afterSearch != '') {
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, 'data/images/' . $this->theme->parametres->afterSearch);
+ if ($as = $this->checkThemeImage($this->theme->parametres->afterSearch)) {
+ $this->vdir->copy($as, 'data/images/' . $this->theme->parametres->afterSearch);
}
if ($this->book->parametres->externalArchives != '') {
$this->addFilesInfos('archives', $this->wdir . '/' . $this->book->parametres->externalArchives);
$this->config->pagesOfCustomLinks = $pagesOfCustomLinks;
- $i = 0;
+ $i = 1;
$pages = array();
$cpages = array();
$ctpages = array();
protected function _sortLinksByDepth($a, $b)
{
$c = $a->getDepth() - $b->getDepth();
- if($c===0){
- return $a->getInitialOrder()-$b->getInitialOrder();
+ if ($c === 0) {
+ return $a->getInitialOrder() - $b->getInitialOrder();
}
return $c;
}
// Header
$header = 'header{';
$header .= 'height:' . $this->theme->parametres->menuHeight . 'px;';
- if ($this->theme->parametres->menuImage != '') {
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, 'data/images/' . $this->theme->parametres->menuImage);
+ if ($mi = $this->checkThemeImage($this->theme->parametres->menuImage)) {
+ $this->vdir->copy($mi, 'data/images/' . $this->theme->parametres->menuImage);
$header .= 'background-image:url(../images/' . $this->theme->parametres->menuImage . ');';
$header .= 'background-repeat:no-repeat;';
$header .= 'background-size:100% ' . $this->theme->parametres->menuHeight . 'px;';
// Logo
$logo = '#logo{';
- if ($this->theme->parametres->logo) {
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->logo, 'data/images/' . $this->theme->parametres->logo);
- $dim = CubeIT_Image::getimagesize($this->themeRoot . '/' . $this->theme->parametres->logo);
+ if ($l = $this->checkThemeImage($this->theme->parametres->logo)) {
+ $this->vdir->copy($l, 'data/images/' . $this->theme->parametres->logo);
+ $dim = CubeIT_Image::getimagesize($l);
$logo .= 'background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;';
}
$logo .= '}';
$this->log('Write CSS');
}
+ protected function checkThemeImage($path)
+ {
+ $path = trim($path);
+ $path = trim($path, '/');
+ if (!$path) {
+ return false;
+ }
+ $p = $this->themeRoot . '/' . $path;
+ if (file_exists($p)) {
+ return $p;
+ }
+ $po = str_replace('.svg', '.o.svg', $p);
+ if (file_exists($po)) {
+ copy($po, $p);
+ return $p;
+ }
+ return false;
+ }
+
protected function _writeLess($variables, $lessContents = '')
{
if ($this->widget) {
$body .= 'background-size:100% 100%;';
break;
}
- if ($this->theme->parametres->backgroundImage != '') {
- $bi = $this->themeRoot . '/' . $this->theme->parametres->backgroundImage;
- if (file_exists($bi)) {
+ if ($bi = $this->checkThemeImage($this->theme->parametres->backgroundImage)) {
+
$dbi = CubeIT_Image::getimagesize($bi);
$this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]);
- }
- $this->vdir->copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, 'data/images/' . $this->theme->parametres->backgroundImage);
+
+ $this->vdir->copy($bi, 'data/images/' . $this->theme->parametres->backgroundImage);
$body .= 'background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');';
$body .= 'background-position:';
public $maxWidth = 0;
public $wdir;
public $initialOrder = 0;
+ public $gamifyCoins = 0;
+ public $tooltipColor = null;
+ public $tooltipBackgroundColor = null;
protected $role = 'button';
protected $_init;
return new actionLink($id, $init, $compiler);
case 12:
- if ($compiler->book->parametres->basketManager === 'Puma' || $compiler->book->parametres->basketManager === 'MIF') {
+ if ($compiler->book->parametres->basketManager === 'Puma' || $compiler->book->parametres->basketManager === 'MIF' || $compiler->book->parametres->basketManager === 'Flexipan') {
return new zoomProductLink($id, $init, $compiler);
}
if ($compiler->book->parametres->product_zoom_references !== '') {
public function getCSSZIndex()
{
- $zindex = (($this->getDepth() + 1) * 1000) - min(999, round(($this->width * $this->height) / 300));
+ $zindex = $this->getAddZIndex() + (($this->getDepth() + 1) * 1000) - min(999, round(($this->width * $this->height) / 300));
return 'z-index:' . $zindex . ';';
}
+ public function getAddZIndex()
+ {
+ return 0;
+ }
+
public function moveOnEvenPage()
{
return false;
class contentLink extends wsHTML5Link
{
public $defaultZIndex = 30;
+ public $animZindex = 0;
public function getHTMLContainerClass()
{
$res = parent::getAdditionnalContent();
$animations = self::parseAnimations($this->image_rollover);
foreach ($animations as $animation) {
-// if (isset($animation['zindex'])) {
-// $this->defaultZIndex = $animation['zindex'];
-// }
+ if (isset($animation['zindex'])) {
+ $this->animZindex = $animation['zindex'];
+ }
}
$res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
if ($this->_isHiddenFirst($animations)) {
}
return false;
}
+
+ public function getAddZIndex()
+ {
+ return parent::getAddZIndex() + $this->animZindex;
+ }
}
class eventOverlayLink extends wsHTML5Link
public function getHTMLContent()
{
if ($this->_content == '') {
- $type = $ext = files::getExtension($this->alternative);
+ $ext = files::getExtension($this->alternative);
- if ($ext == 'oam') {
+ if ($ext === 'oam') {
$d = $this->unzipFile($this->alternative, true);
$this->_config = $this->getConfigOAM($d['dir']);
$this->copyExternalDir($d['dir'], $d['fdir']);
- } elseif ($ext == 'zip') {
+ } elseif ($ext === 'zip') {
$d = $this->unzipFile($this->alternative, false);
$this->_config = $this->getConfigZIP($d['dir']);
$this->copyExternalDir($d['dir'], $d['fdir']);
$d = array('fdir' => $fdir, 'dir' => $dir);
$file = $this->compiler->wdir . '/' . $this->alternative;
- $content = file_get_contents($file);
-// if (false && strpos($content, '<div id="lottie"></div>')) {
-// return $this->getLottieContent($content, $this->width, $this->height);
-// }
$this->compiler->vdir->copy($this->compiler->wdir . '/' . $this->alternative, $d['dir'] . '/' . $this->alternative);
$this->_config = $this->getConfigHTML($d['dir'], $this->alternative);
$this->copyExternalFile($d['dir'] . '/' . $this->alternative);
return $this->_content;
}
- public function getLottieContent($c, $width, $height)
- {
- $this->_config = ['width' => $this->width * $this->getCssScale(), 'height' => $this->height * $this->getCssScale()];
- $parsedLottie = self::_parseLottieContent($c);
-
- $lottieID = $this->compiler->addLottie($parsedLottie['animation'], $parsedLottie['params'], $parsedLottie['hash']);
- return '<div class="lottie" data-lottie-id="' . $lottieID . '"></div>';
- }
-
- public static function _parseLottieContent($c)
- {
- $hash = hash('sha256', $c);
- $start = mb_strpos($c, 'var animationData = {') + 20;
- $end = mb_strpos($c, '};', $start) + 1;
- $ad = mb_substr($c, $start, $end - $start);
- $animationData = json_decode($ad);
- preg_match('/var params = (\{.*\});/sU', $c, $matches);
- $matches[1] = str_replace('container: document.getElementById(\'lottie\'),', '', $matches[1]);
- $matches[1] = str_replace('animationData: animationData', '', $matches[1]);
- $params = CJSON::decode($matches[1]);
- return ['animation' => $animationData, 'params' => $params, 'hash' => $hash];
- }
+// public function getLottieContent($c, $width, $height)
+// {
+// $this->_config = ['width' => $this->width * $this->getCssScale(), 'height' => $this->height * $this->getCssScale()];
+// $parsedLottie = self::_parseLottieContent($c);
+//
+// $lottieID = $this->compiler->addLottie($parsedLottie['animation'], $parsedLottie['params'], $parsedLottie['hash']);
+// return '<div class="lottie" data-lottie-id="' . $lottieID . '"></div>';
+// }
+//
+// public static function _parseLottieContent($c)
+// {
+// $hash = hash('sha256', $c);
+// $start = mb_strpos($c, 'var animationData = {') + 20;
+// $end = mb_strpos($c, '};', $start) + 1;
+// $ad = mb_substr($c, $start, $end - $start);
+// $animationData = json_decode($ad);
+// preg_match('/var params = (\{.*\});/sU', $c, $matches);
+// $matches[1] = str_replace('container: document.getElementById(\'lottie\'),', '', $matches[1]);
+// $matches[1] = str_replace('animationData: animationData', '', $matches[1]);
+// $params = CJSON::decode($matches[1]);
+// return ['animation' => $animationData, 'params' => $params, 'hash' => $hash];
+// }
public function getHTMLContainerClass()
{
$this->left += $this->compiler->width;
}
+ $this->getHTMLContent();
+
$css = '#l_' . $this->id . '{';
$css .= 'left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;';
$css .= 'width:' . $this->_config['width'] . 'px;height:' . $this->_config['height'] . 'px;';