aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-04-18 17:55:35 -0700
committerfriendica <info@friendica.com>2013-04-18 17:55:35 -0700
commitdb038c56542f7fb9658c3b7a703e50efe7823014 (patch)
treeb0f0af805f46209406ccfed3969718f5d414ed35 /include/items.php
parentba1cb0bb059bfcd20ec2a14b70c4a79b4a222977 (diff)
downloadvolse-hubzilla-db038c56542f7fb9658c3b7a703e50efe7823014.tar.gz
volse-hubzilla-db038c56542f7fb9658c3b7a703e50efe7823014.tar.bz2
volse-hubzilla-db038c56542f7fb9658c3b7a703e50efe7823014.zip
turn naked links in posts into zrl's if we've got a hubloc for the site
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index 954042b65..088aa11a1 100755
--- a/include/items.php
+++ b/include/items.php
@@ -54,6 +54,31 @@ function collect_recipients($item,&$private) {
}
/**
+ * @function red_zrl_callback
+ * preg_match function when fixing 'naked' links in mod item.php
+ * Check if we've got a hubloc for the site and use a zrl if we do, a url if we don't.
+ *
+ */
+
+
+function red_zrl_callback($matches) {
+ $m = @parse_url($matches[2]);
+ $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;
+ }
+ if($zrl)
+ return $matches[1] . '[zrl=' . $matches[2] . ']' . $matches[2] . '[/zrl]';
+ return $matches[0];
+}
+
+
+
+/**
* @function post_activity_item($arr)
*
* post an activity