From 2c9a38c6be50d2f1bb2e6f73333b582dbd567361 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 8 Mar 2024 15:53:37 +0100 Subject: [PATCH] wait #6782 @1 --- src/Links/CustomLink.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Links/CustomLink.php b/src/Links/CustomLink.php index d80c8ab..0e345b5 100644 --- a/src/Links/CustomLink.php +++ b/src/Links/CustomLink.php @@ -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]; } } -- 2.39.5