diff --git a/include/bbcode.php b/include/bbcode.php
index bab50240c..45126c0eb 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -3,7 +3,7 @@
require_once("include/oembed.php");
require_once('include/event.php');
require_once('include/zot.php');
-
+require_once('include/hubloc.php');
function tryoembed($match) {
$url = ((count($match)==2)?$match[1]:$match[2]);
@@ -19,15 +19,7 @@ function tryoembed($match) {
function tryzrlaudio($match) {
$link = $match[1];
- $m = @parse_url($link);
- $zrl = false;
- if($m['host']) {
- $r = q("select hubloc_url from hubloc where hubloc_host = '%s' limit 1",
- dbesc($m['host'])
- );
- if($r)
- $zrl = true;
- }
+ $zrl = is_matrix_url($link);
if($zrl)
$link = zid($link);
return '';
@@ -35,15 +27,7 @@ function tryzrlaudio($match) {
function tryzrlvideo($match) {
$link = $match[1];
- $m = @parse_url($link);
- $zrl = false;
- if($m['host']) {
- $r = q("select hubloc_url from hubloc where hubloc_host = '%s' limit 1",
- dbesc($m['host'])
- );
- if($r)
- $zrl = true;
- }
+ $zrl = is_matrix_url($link);
if($zrl)
$link = zid($link);
return '';
diff --git a/include/bookmarks.php b/include/bookmarks.php
index 21a775f9a..e70158476 100644
--- a/include/bookmarks.php
+++ b/include/bookmarks.php
@@ -23,15 +23,8 @@ function bookmark_add($channel,$sender,$taxonomy,$private,$opts = null) {
$iarr['mitem_desc'] = $taxonomy['term'];
$iarr['mitem_flags'] = (($ischat) ? MENU_ITEM_CHATROOM : 0);
- $m = @parse_url($taxonomy['url']);
- $zrl = false;
- if($m['host']) {
- $r = q("select hubloc_url from hubloc where hubloc_host = '%s' limit 1",
- dbesc($m['host'])
- );
- if($r)
- $zrl = true;
- }
+ require_once('include/hubloc.php');
+ $zrl = is_matrix_url($taxonomy['url']);
if($zrl)
$iarr['mitem_flags'] |= MENU_ITEM_ZID;
diff --git a/include/hubloc.php b/include/hubloc.php
index 35d9dbeb1..566875ce9 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -1,5 +1,17 @@