diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-04 21:55:56 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-05-04 21:55:56 -0700 |
commit | f0a2747d80b29810eddeb62063c231d7178ac3db (patch) | |
tree | b8b787d29429fc8ac530e9f1073d4d4d9fe79b34 /include/network.php | |
parent | 67918033f94e277240a826534f03ed6d13e4be9d (diff) | |
download | volse-hubzilla-f0a2747d80b29810eddeb62063c231d7178ac3db.tar.gz volse-hubzilla-f0a2747d80b29810eddeb62063c231d7178ac3db.tar.bz2 volse-hubzilla-f0a2747d80b29810eddeb62063c231d7178ac3db.zip |
make service_plink pluggable
Diffstat (limited to 'include/network.php')
-rw-r--r-- | include/network.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php index d4b9e73ee..5bf626908 100644 --- a/include/network.php +++ b/include/network.php @@ -1980,3 +1980,26 @@ function scrape_vcard($url) { return $ret; } + +function service_plink($contact, $guid) { + + $plink = ''; + + $m = parse_url($contact['xchan_url']); + if($m) { + $url = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : ''); + } + else { + $url = 'https://' . substr($contact['xchan_addr'],strpos($contact['xchan_addr'],'@')+1); + } + + $handle = substr($contact['xchan_addr'], 0, strpos($contact['xchan_addr'],'@')); + + $plink = $url . '/channel/' . $handle . '?f=&mid=' . $guid; + + $x = [ 'xchan' => $contact, 'guid' => $guid, '$url' => $url, 'plink' => $plink ]; + call_hooks('service_plink', $x); + + return $x['plink']; +} + |