]> _ Git - cubeextranet.git/commitdiff
wip #4887 @1.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 18 Nov 2021 08:14:39 +0000 (08:14 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 18 Nov 2021 08:14:39 +0000 (08:14 +0000)
inc/ws/Util/class.ws.links.php

index 4eee1d7efeb59f64ecf4460eba60a04259f7e111..6c84e6d407ac4a87d3bb8a3f3f6cdd7800211090 100644 (file)
@@ -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);