]> _ Git - fluidbook-toolbox.git/commitdiff
wait #8061 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Mar 2026 11:38:24 +0000 (12:38 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Mar 2026 11:38:24 +0000 (12:38 +0100)
app/Http/Controllers/Admin/Operations/FluidbookPublication/LinksOperation.php

index 0f54f45b3e9def2f554df4220beb7edb3798f3ec..8563d1e722ab6dc059802d64745f2434fa4d5c28 100644 (file)
@@ -294,15 +294,16 @@ trait LinksOperation
         $vPadding = 2;
         $hPadding = 2;
         $tooltip = '';
-        $ignoreSeparators = '';
+
         switch ($rules) {
             case 'cart':
                 $type = \Fluidbook\Tools\Links\Link::CART;
                 $target = '';
+                break;
             case 'steelite':
                 $toSuffix = '?embed';
                 $target = '_popupiframe';
-                $ignoreSeparators = '-';
+                break;
             case 'web':
             default:
                 break;
@@ -312,6 +313,18 @@ trait LinksOperation
         $excel = ExcelToArray::excelToArrayKeyVal($uploadedFile->getPathname());
         /** @var FluidbookPublication $fluidbook */
         $fluidbook = FluidbookPublication::withoutGlobalScopes()->find($fluidbook_id);
+
+
+        uksort($excel, function ($a, $b) {
+            return mb_strlen($b) - mb_strlen($a);
+        });
+        $ignoreSeparators = [];
+        foreach ($excel as $search => $url) {
+            if (preg_match_all('/[^0-9A-Za-z]/', $search, $matches)) {
+                $ignoreSeparators += $matches[0];
+            }
+        }
+        $ignoreSeparators = implode('', array_unique($ignoreSeparators));
         $highlights = $fluidbook->getHightlightData($ignoreSeparators);
 
         foreach ($excel as $search => $url) {