]> _ Git - fluidbook_tools.git/commitdiff
wait #6782 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Mar 2024 14:53:37 +0000 (15:53 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 8 Mar 2024 14:53:37 +0000 (15:53 +0100)
src/Links/CustomLink.php

index d80c8ab3fb85f025b249e694b7c9d84215a0bc0c..0e345b57ce5109837f0587d89b48e11b8e0f6565 100644 (file)
@@ -39,15 +39,20 @@ class CustomLink extends NormalLink
 
     public static function _getURL($ref, $type = '', $default = null)
     {
+        if (str_starts_with($ref, 'http')) {
+            return $ref;
+        }
         $ref = str_replace('custom:', '', $ref);
         $e = explode(':', $ref, 2);
+
         if (count($e) == 2) {
             $ref = $e[1];
             $type = $e[0];
         }
         $nospaceref = str_replace(' ', '', $ref);
 
-        $all = self::getAllURLOf($type);
+        $all = static::getAllURLOf($type);
+
         if (isset($all[$ref])) {
             $res = $all[$ref];
         } else if (isset($all[$nospaceref])) {
@@ -69,13 +74,13 @@ class CustomLink extends NormalLink
 
     protected static function getAllURLOf($type)
     {
-        if (!isset(self::$_all[$type])) {
-            self::$_all[$type] = [];
+        if (!isset(static::$_all[$type])) {
+            static::$_all[$type] = [];
             $res = DB::table('fluidbook_reference_url')->where('type', $type)->get(['url', 'ref']);
             foreach ($res as $item) {
-                self::$_all[$type][$item->ref] = $item->url;
+                static::$_all[$type][$item->ref] = $item->url;
             }
         }
-        return self::$_all[$type];
+        return static::$_all[$type];
     }
 }