$this->config->pagesOfCustomLinks = $pagesOfCustomLinks;
- $i = 0;
+ $i = 1;
$pages = array();
$cpages = array();
$ctpages = array();
}
foreach ($linksToAdd as $lta) {
- $c = $lta->getHTMLContainer();
+
$css[] = $lta->getCSSContainer();
if (!isset($pages[$lta->page])) {
$pages[$lta->page] = [];
$v = 'pages';
}
+ $lta->setInitialOrder($i);
if (!isset($$v[$lta->page][$lta->blendmode])) {
$$v[$lta->page][$lta->blendmode] = [];
}
- array_push($$v[$lta->page][$lta->blendmode], $c);
+ array_push($$v[$lta->page][$lta->blendmode], $lta);
+ $i++;
}
// Make old "aftersearch" link compatible with new "extra" menu option by extracting link URL
if ($link->page == 'aftersearch') {
$allLinksData[$linkData['uid']] = $linkData;
if ($link->keep()) {
- $this->hiddenContents[] = $c;
+ $this->hiddenContents[] = $link->getHTMLContainer();
}
- $i++;
}
$allpages = range(0, $this->book->parametres->pages + 1);
}
foreach ($allpages as $i) {
-
- $c = [];
- $cc = [];
- $ct = [];
- if (isset($pages[$i])) {
- $c = $pages[$i];
- }
- if (isset($cpages[$i])) {
- $cc = $cpages[$i];
- }
- if (isset($ctpages[$i])) {
- $ct = $ctpages[$i];
- }
- $this->config->links[$i] = $c;
- $this->config->clinks[$i] = $cc;
- $this->config->ctlinks[$i] = $ct;
+ $this->config->links[$i] = $this->_htmlLinkList($pages[$i]['normal'] ?? []);
+ $this->config->clinks[$i] = $this->_htmlLinkList($cpages[$i] ?? []);
+ $this->config->ctlinks[$i] = $this->_htmlLinkList($ctpages[$i] ?? []);
}
if ($this->writeLinksData) {
return $css;
}
+ protected function _htmlLinkList($list)
+ {
+ if (!count($list)) {
+ return '';
+ }
+ usort($list, [$this, '_sortLinksByDepth']);
+ $res = '';
+ foreach ($list as $item) {
+ $res .= $item->getHTMLContainer();
+ }
+ return $res;
+ }
+
+ protected function _sortLinksByDepth($a, $b)
+ {
+ $c = $a->getDepth() - $b->getDepth();
+ if ($c === 0) {
+ return $a->getInitialOrder() - $b->getInitialOrder();
+ }
+ return $c;
+ }
+
public function addSlideshowLibrary($inline = true)
{
$l = ($inline ? $this->config->inlineSlideshowLibrary : $this->config->popupSlideshowLibrary);
if ($this->_isHiddenFirst($animations)) {
$res .= ' data-animation-hide ';
}
+ if ($this->_isFinallyHidden($animations)) {
+ $res .= ' data-animation-hide-on-leave ';
+ }
return $res;
}
+ protected function _isFinallyHidden($animations)
+ {
+ $hiddenAnimations = ['fadeout', 'unmask'];
+ foreach ($animations as $animation) {
+ if (in_array($animation['type'], $hiddenAnimations)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected function _isHiddenFirst($animations)
{
$hiddenAnimations = ['reveal', 'fadein', 'translatefrom'];
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);
$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;';
}
$this->config->product_zoom_references = [];
- foreach ($this->config->basketReferences as $ref => $data){
+ foreach ($this->config->basketReferences as $ref => $data) {
$this->config->product_zoom_references[$ref] = [$ref];
}
}
$linksToAdd[] = $link->getRightClone();
}
foreach ($linksToAdd as $lta) {
+ /** @var $lta wsLink */
+ // Keep this line because some properties of the link (like blend mode) are parsed with this function
+ $c = $lta->getHTMLContainer();
$css[] = $lta->getCSSContainer();
if (!isset($pages[$lta->page])) {
- $pages[$lta->page] = [];
- $cpages[$lta->page] = [];
- $ctpages[$lta->page] = [];
+ $pages[$lta->page] = ['normal' => []];
+ $cpages[$lta->page] = ['normal' => []];
+ $ctpages[$lta->page] = ['normal' => []];
}
$d = $lta->getDepth();
}
$lta->setInitialOrder($i);
- array_push($$v[$lta->page], $lta);
+ if (!isset($$v[$lta->page][$lta->blendmode])) {
+ $$v[$lta->page][$lta->blendmode] = [];
+ }
+
+ array_push($$v[$lta->page][$lta->blendmode], $lta);
$i++;
}
// Make old "aftersearch" link compatible with new "extra" menu option by extracting link URL
protected function _htmlLinkList($list)
{
if (!count($list)) {
- return '';
+ return [];
}
- usort($list, [$this, '_sortLinksByDepth']);
- $res = '';
- foreach ($list as $item) {
- $res .= $item->getHTMLContainer();
+ $res = [];
+ foreach ($list as $blendmode => $l) {
+ usort($l, [$this, '_sortLinksByDepth']);
+ $res[$blendmode] = [];
+ foreach ($l as $item) {
+ $res[$blendmode][] = $item->getHTMLContainer();
+ }
+
}
return $res;
+
}
protected function _sortLinksByDepth($a, $b)
}
if ($bi = $this->checkThemeImage($this->theme->parametres->backgroundImage)) {
- $dbi = CubeIT_Image::getimagesize($bi);
- $this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]);
+ $dbi = CubeIT_Image::getimagesize($bi);
+ $this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]);
$this->vdir->copy($bi, 'data/images/' . $this->theme->parametres->backgroundImage);
public $read_mode;
public $group;
public $infobulle;
+ public $blendmode = "normal";
public $extra;
public $id;
public $rot;
public function getHTMLContainer()
{
- return '<div class="' . $this->getHTMLContainerClass() . '" data-hidden="' . $this->hidden . '" data-scorm="' . $this->scorm . '" data-id="' . $this->uid . '" id="l_' . $this->id . '"' . $this->getAdditionnalContent() . '>' . $this->getHTMLContent() . '</div>';
+ $addContent=$this->getAdditionnalContent();
+ return '<div class="' . $this->getHTMLContainerClass() . '" data-blendmode="' . $this->blendmode . '" data-hidden="' . $this->hidden . '" data-scorm="' . $this->scorm . '" data-id="' . $this->uid . '" id="l_' . $this->id . '"' . $addContent . '>' . $this->getHTMLContent() . '</div>';
}
public function getHTMLContainerClass()
$res = parent::getAdditionnalContent();
$animations = self::parseAnimations($this->image_rollover);
foreach ($animations as $animation) {
+ if (isset($animation['blendmode'])) {
+ $this->blendmode = $animation['blendmode'];
+ unset($animation['blendmode']);
+ }
if (isset($animation['zindex'])) {
$this->animZindex = $animation['zindex'];
}
if (!$this->rightClone) {
zoomLink::generateImage($attributes, $this->compiler, 'layerlink', 'layer');
}
- return 'background-image:url(' . $this->getImageUrl() . ');background-size:100% 100%;background-repeat:no-repeat;';
+ return 'background-image:url(' . $this->getImageUrl() . ');background-size:' . $this->getBackgroundSize() . ';background-position:' . $this->getBackgroundPosition() . ';background-repeat:no-repeat;';
}
public function getImageUrl()
public function getCSS()
{
- return 'background-color:' . wsHTML5::colorToCSS($this->to, 1) . ';';
+ $res = parent::getCSS();
+ $res .= 'background-color:' . wsHTML5::colorToCSS($this->to, 1) . ';';
+ return $res;
}
public function getAdditionnalContent()
}
$fz = $this->height * $this->getCssScale();
$fz = round($fz / $font['capHeight'], 2);
- return 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
+ $res = parent::getCSS();
+ $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
+ return $res;
}
public function getHTMLContainerClass()
public function getCSS()
{
+ $res = parent::getCSS();
$this->copyExternalFile($this->to);
- return 'background-image:url(' . $this->getImageUrl() . ');background-size:100% 100%;background-repeat:no-repeat;';
+ $res .= 'background-image:url(' . $this->getImageUrl() . ');background-size:' . $this->getBackgroundSize() . ';background-position:' . $this->getBackgroundPosition() . ';background-repeat:no-repeat;';
+ return $res;
+ }
+
+ public function getBackgroundPosition()
+ {
+ $animations = self::parseAnimations($this->image_rollover);
+ foreach ($animations as $animation) {
+ if (($animation['type'] === 'zoomout' || $animation['type'] === 'zoomin') && isset($animation['transformorigin'])) {
+ return $animation['transformorigin'];
+ }
+ }
+ return '50% 50%';
+ }
+
+ public function getBackgroundSize()
+ {
+
+ $size = '100%';
+ $animations = self::parseAnimations($this->image_rollover);
+ foreach ($animations as $animation) {
+ if ($animation['type'] === 'zoomout') {
+ $size = round($animation['scale'] * 100) . '%';
+ }
+ }
+ return $size . ' ' . $size;
}
public function getAdditionnalContent()