diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/text.php | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/include/text.php b/include/text.php index d7ffa5550..5dc894d11 100644 --- a/include/text.php +++ b/include/text.php @@ -3033,46 +3033,44 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) if($r) { - $xchan[0] = Libzot::zot_record_preferred($r, 'xchan_network'); - - foreach($xchan as $xc) { - $profile = $xc['xchan_url']; - $newname = $xc['xchan_name']; - // add the channel's xchan_hash to $access_tag if exclusive - if($exclusive) { - $access_tag = 'cid:' . $xc['xchan_hash']; - } + $xc = Libzot::zot_record_preferred($r, 'xchan_network'); - // if there is a url for this channel + $profile = $xc['xchan_url']; + $newname = $xc['xchan_name']; + // add the channel's xchan_hash to $access_tag if exclusive + if($exclusive) { + $access_tag = 'cid:' . $xc['xchan_hash']; + } - if(isset($profile)) { - $replaced = true; - //create profile link - $profile = str_replace(',','%2c',$profile); - $url = $profile; + // if there is a url for this channel - $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; - $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); + if(isset($profile)) { + $replaced = true; + //create profile link + $profile = str_replace(',','%2c',$profile); + $url = $profile; + $bb_tag = (($xc['xchan_network'] === 'zot6') ? 'zrl' : 'url'); - // append tag to str_tags - if(! stristr($str_tags,$newtag)) { - if(strlen($str_tags)) - $str_tags .= ','; - $str_tags .= $newtag; - } - } + $newtag = '@' . (($exclusive) ? '!' : '') . '[' . $bb_tag . '=' . $profile . ']' . $newname . '[/' . $bb_tag . ']'; + $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); + // append tag to str_tags + if(! stristr($str_tags,$newtag)) { + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= $newtag; + } + } - $fn_results[] = [ - 'replaced' => $replaced, - 'termtype' => $termtype, - 'term' => $newname, - 'url' => $url, - 'access_tag' => $access_tag, - 'contact' => (($r) ? $xc : []), - ]; - } + $fn_results[] = [ + 'replaced' => $replaced, + 'termtype' => $termtype, + 'term' => $newname, + 'url' => $url, + 'access_tag' => $access_tag, + 'contact' => (($r) ? $xc : []), + ]; } else { |