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) {
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)
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;
}