]> _ Git - cubeextranet.git/commitdiff
wip #3785 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Aug 2020 14:27:36 +0000 (14:27 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Aug 2020 14:27:36 +0000 (14:27 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 26c83c1b24e52708cd8fbe1f00598601c8698bf9..4a902a009045e794d89e98637e391b99b8706597 100644 (file)
@@ -1393,16 +1393,18 @@ class wsHTML5Compiler
         foreach ($linksCopy as $k => $linkData) {
             if ($linkData['type'] == 35 || $linkData['type'] == 15 || $linkData['type'] == 39) {
                 $linkData = wsLinks::decryptLink($linkData);
-                $animation = contentLink::parseAnimation($linkData['image_rollover']);
-                if (isset($animation['backgroundColor']) && $animation['backgroundColor'] != 'transparent') {
-                    $dupData = $linkData;
-                    $dupData['type'] = 14;
-                    $dupData['to'] = $animation['backgroundColor'];
-                    $dupData['image_rollover'] = '';
-                    $dupData['uid'] = 'b_' . $linkData['uid'];
-                    array_push($links, $dupData);
-                    array_push($links, $linkData);
-                    unset($links[$k]);
+                $animations = contentLink::parseAnimations($linkData['image_rollover']);
+                foreach ($animations as $animation) {
+                    if (isset($animation['backgroundColor']) && $animation['backgroundColor'] != 'transparent') {
+                        $dupData = $linkData;
+                        $dupData['type'] = 14;
+                        $dupData['to'] = $animation['backgroundColor'];
+                        $dupData['image_rollover'] = '';
+                        $dupData['uid'] = 'b_' . $linkData['uid'];
+                        array_push($links, $dupData);
+                        array_push($links, $linkData);
+                        unset($links[$k]);
+                    }
                 }
             }
             if (isset($linkData['image']) && $linkData['image'] && $linkData['type'] != 28 && $linkData['type'] != 35) {
index 7b213b3ca2e56110051247e5b6f2f2acaaa05731..5724591e1590f19e5f4acbbe79a82bdd574dd53c 100644 (file)
@@ -230,22 +230,28 @@ class wsHTML5Link
         return $res;
     }
 
-    public static function parseAnimation($animation)
+    public static function parseAnimations($animations)
     {
-        $extras = self::parseExtras($animation);
-        if (count($extras) > 0) {
-            if (!isset($extras['direction'])) {
-                $extras['direction'] = 'right';
-            }
-            if ($extras['direction'] === 'top') {
-                $extras['direction'] = 'up';
-            }
-            if ($extras['direction'] === 'bottom') {
-                $extras['direction'] = 'down';
+        $anims = explode('---', $animations);
+        $res = [];
+
+        foreach ($anims as $animation) {
+            $animation = trim($animation);
+            $extras = self::parseExtras($animation);
+            if (count($extras) > 0) {
+                if (!isset($extras['direction'])) {
+                    $extras['direction'] = 'right';
+                }
+                if ($extras['direction'] === 'top') {
+                    $extras['direction'] = 'up';
+                }
+                if ($extras['direction'] === 'bottom') {
+                    $extras['direction'] = 'down';
+                }
             }
+            $res[] = $extras;
         }
-
-        return $extras;
+        return $res;
     }
 
     public static function replaceCustomURL($url)
@@ -773,15 +779,13 @@ class contentLink extends wsHTML5Link
     public function getAdditionnalContent()
     {
         $res = parent::getAdditionnalContent();
-        $variables = self::parseAnimation($this->image_rollover);
-
-        if (!isset($variables['type']) || !$variables['type']) {
-            $variables['type'] = 'none';
-        }
-        if (isset($variables['zindex'])) {
-            $this->zindex = $variables['zindex'];
+        $animations = self::parseAnimations($this->image_rollover);
+        foreach ($animations as $animation) {
+            if (isset($animation['zindex'])) {
+                $this->zindex = $animation['zindex'];
+            }
         }
-        $res .= ' data-animation-type="' . $variables['type'] . '" data-animation="' . htmlspecialchars(json_encode($variables), ENT_QUOTES) . '" ';
+        $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
 
         return $res;
     }