From: Vincent Vanwaelscappel Date: Mon, 19 Sep 2022 06:07:29 +0000 (+0200) Subject: wait #5438 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=2069788713dc2bf4c8c464958d9a36ebcbb2ac11;p=fluidbook_tools.git wait #5438 --- diff --git a/src/Links/CustomLink.php b/src/Links/CustomLink.php index 64b6fb5..b265b50 100644 --- a/src/Links/CustomLink.php +++ b/src/Links/CustomLink.php @@ -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; }