From d417ed09949a2861885219dbd4c3bedecb6d3cbe Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 5 May 2023 08:50:25 +0200 Subject: [PATCH] wip #5908 @1 --- src/Links/ColorLink.php | 9 +++---- src/Links/ContentLink.php | 14 ++++++----- src/Links/Link.php | 51 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/Links/ColorLink.php b/src/Links/ColorLink.php index 5f35e5f..0801bc7 100644 --- a/src/Links/ColorLink.php +++ b/src/Links/ColorLink.php @@ -4,19 +4,16 @@ namespace Fluidbook\Tools\Links; use Cubist\Util\Graphics\Color; -class ColorLink extends ContentLink -{ +class ColorLink extends ContentLink { protected $role = ''; - public function getCSS() - { + public function getCSS() { $res = parent::getCSS(); $res .= 'background-color:' . Color::colorToCSS($this->to, 1) . ';'; return $res; } - public function getAdditionnalContent() - { + public function getAdditionnalContent() { $res = parent::getAdditionnalContent(); $res .= ' data-color="' . Color::colorToCSS($this->to, 1) . '"'; return $res; diff --git a/src/Links/ContentLink.php b/src/Links/ContentLink.php index 088f347..91d535f 100644 --- a/src/Links/ContentLink.php +++ b/src/Links/ContentLink.php @@ -28,12 +28,14 @@ class ContentLink extends Link { $this->addzindex = $animation['addzindex']; } } - $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" '; - if ($this->_isHiddenFirst($animations)) { - $res .= ' data-animation-hide '; - } - if ($this->_isFinallyHidden($animations)) { - $res .= ' data-animation-hide-on-leave '; + if($animations) { + $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" '; + if ($this->_isHiddenFirst($animations)) { + $res .= ' data-animation-hide '; + } + if ($this->_isFinallyHidden($animations)) { + $res .= ' data-animation-hide-on-leave '; + } } } if ($this->forceTexture && $this->getDepth() >= 40) { diff --git a/src/Links/Link.php b/src/Links/Link.php index 10bab6d..69f2f96 100644 --- a/src/Links/Link.php +++ b/src/Links/Link.php @@ -18,6 +18,54 @@ use stdClass; class Link { + const WEB_INFOS = 1; + const PRODUCT = 1; + const WEB = 2; + const GENERAL = 2; + const EMAIL = 3; + const VIDEO = 4; + const INTERNAL = 5; + const MULTIMEDIA = 6; + const PERSO = 7; + const CUSTOM = 7; + const PAGE_CORNER = 8; + const OBJECT3D = 9; + const WEBVIDEO = 10; + const ACTION = 11; + const CART = 12; + const BASKET = 12; + const ZOOM = 13; + const COLOR = 14; + const IMAGE = 15; + const FILE = 16; + const AUDIO = 17; + const TOOLTIP = 18; + const CALL = 19; + const BOOKMARKGROUP = 20; + const HTML5MULTIMEDIA = 21; + const BOOKMARK_CORNER = 22; + const STATSTAG = 23; + const PHONE = 24; + const AUDIODESCRIPTION = 25; + const PAGE_LABEL = 26; + const EVENT_OVERLAY = 27; + const ARTICLE = 28; + const LIKE = 29; + const SLIDESHOW = 30; + const IFRAME = 31; + const SHOWLINK = 32; + const ZOOMHD = 33; + const LOCK_CONTENTS = 34; + const TEXT = 35; + const ARTICLE_OPEN = 36; + const DOWNLOAD_PORTION = 37; + const TRIGGERSLINK = 38; + const LAYER = 39; + const ANCHOR = 40; + const FLIPCARD = 41; + const PDF=42; + + protected static string|false|null $_linksKey = null; public $left; public $top; @@ -291,7 +339,7 @@ class Link { foreach ($anims as $animation) { $animation = trim($animation); - if (!$animation) { + if (!$animation || $animation === 'none') { continue; } $extras = self::parseExtras($animation, true); @@ -363,6 +411,7 @@ class Link { */ public function __construct($id, $init, &$compiler) { $this->_init = $init; + foreach ($init as $k => $v) { if ($k == 'extra') { if (Json::isJson($v)) { -- 2.39.5