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])) {
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];
}
}