]> _ Git - fluidbook_tools.git/commitdiff
wait #5438
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Sep 2022 06:07:29 +0000 (08:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 19 Sep 2022 06:07:29 +0000 (08:07 +0200)
src/Links/CustomLink.php

index 64b6fb57e1683a1a160f04f7e2a88621bafb0e2b..b265b508928d90fda5d986dcfe2ca74236fee730 100644 (file)
@@ -11,15 +11,22 @@ class CustomLink extends NormalLink
         return static::_getURL($this->to);
     }
 
-    protected static function _getURLOfType($type, $ref)
+    protected static function _getURLOfType($type, $ref, $default = null)
     {
         global $core;
+        $e = explode(':', $ref, 2);
+        if (count($e) == 2 && $e[0] == $type) {
+            $ref = $e[1];
+        }
         $nospaceref = str_replace(' ', '', $ref);
         $r = $core->con->select("SELECT * FROM wsref WHERE (ref='" . $core->con->escape($ref) . "' OR ref='" . $core->con->escape($nospaceref) . "') AND type='" . $core->con->escape($type) . "'");
         if ($r->count()) {
             return $r->url;
         }
-        return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($type . '|' . $ref);
+        if (null === $default) {
+            return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($type . '|' . $ref);
+        }
+        return $default;
     }