From 2dba1ac7104bd1bec4c771324c6f3ad34ba57269 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 18 Nov 2021 08:14:39 +0000 Subject: [PATCH] wip #4887 @1.25 --- inc/ws/Util/class.ws.links.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/inc/ws/Util/class.ws.links.php b/inc/ws/Util/class.ws.links.php index 4eee1d7ef..6c84e6d40 100644 --- a/inc/ws/Util/class.ws.links.php +++ b/inc/ws/Util/class.ws.links.php @@ -28,14 +28,13 @@ class wsLinks 'video_loop' => __('Video : boucle'), 'video_auto_start' => __('Video : démarrage automatique'), 'video_controls' => __('Vidéo : afficher les contrôles'), 'video_sound_on' => __('Vidéo : activer le son'), 'inline' => __('Vidéo : afficher dans la page'), 'video_width' => __('Vidéo : Largeur du popup'), 'video_height' => __('Vidéo : Hauteur du popup'), 'interactive' => __('Interactivité'), 'video_service' => __('Webvideo : service'), - 'display_area' => __('Afficher le lien au rollover'), 'extra' => __('Paramètre supplémentaire'), 'alternative' => __('Alternative'), 'read_mode' => __('Mode de lecture'), 'image' => __('Image'), 'image_rollover' => __('Animation au survol'), 'animation' => __('Animation'), 'group' => __('Groupe'), - 'zindex'=>__('Profondeur'), + 'zindex' => __('Profondeur'), ); $comments = array(); @@ -54,6 +53,7 @@ class wsLinks } // Links + self::_correctImageSpecialLinks($links); $j = 2; foreach ($links as $l) { $i = 0; @@ -180,6 +180,25 @@ class wsLinks $r = json_decode(gzdecode(file_get_contents($file)), true); $links = $r['links']; $rulers = $r['rulers']; + + self::_correctImageSpecialLinks($links); + } + + protected static function _correctImageSpecialLinks(&$links) + { + foreach ($links as $k => $link) { + if (preg_match('/^link_(.*)$/', $link['page'], $matches) && strlen($matches[1]) !== 32) { + $uid = $matches[1]; + foreach ($links as $l) { + if ($l['uid'] === $uid && $l['alternative']) { + $links[$k]['page'] = 'link_' . md5($l['alternative']); + break; + } + } + } else if (preg_match('/^([0-9a-f]{32})$/', $link['page'], $matches)) { + $links[$k]['page'] = 'link_' . $matches[1]; + } + } } public static function getLinksFromExcel($xls, &$links, &$rulers) @@ -237,6 +256,8 @@ class wsLinks } $i++; } + + self::_correctImageSpecialLinks($links); } public static function getLinksFromAutobookmarkText($txt, &$links, &$rulers) @@ -270,6 +291,8 @@ class wsLinks 'type' => $type, 'to' => $to, 'target' => $target, 'infobulle' => '', 'numerotation' => $numerotation, 'display_area' => '1'); } + + self::_correctImageSpecialLinks($links); } public static function _getLinkKey() @@ -411,6 +434,8 @@ class wsLinks $finalLinks[] = $item; } + self::_correctImageSpecialLinks($finalLinks); + return ['links' => self::encryptLinks($finalLinks), 'rulers' => array_merge(self::_getAsArray($rulers), self::_getAsArray($specialRulers))]; } @@ -456,6 +481,7 @@ class wsLinks if (substr($line[0], 0, 1) == '#' || is_null($line[0])) { continue; } + $link = []; if ($newformat) { $cols = array('page' => '', 'left' => '', 'top' => '', 'width' => '', 'height' => '', 'type' => '', 'to' => '', 'target' => '_blank', 'video_loop' => true, 'video_auto_start' => true, 'video_controls' => true, 'video_sound_on' => true, 'infobulle' => '', 'numerotation' => 'physical', "inline" => true); -- 2.39.5