aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-03-03 19:33:39 +0000
committerMario <mario@mariovavti.com>2023-03-03 19:33:39 +0000
commitdc6075aa3f91ad8e96f440f0569cfe5bd862b201 (patch)
treef3ff1829ebfead0b934ed4552a2398dbe9992cc0 /include/text.php
parent972d6917ac9e23d4032f375e2aec8f1839581b06 (diff)
downloadvolse-hubzilla-dc6075aa3f91ad8e96f440f0569cfe5bd862b201.tar.gz
volse-hubzilla-dc6075aa3f91ad8e96f440f0569cfe5bd862b201.tar.bz2
volse-hubzilla-dc6075aa3f91ad8e96f440f0569cfe5bd862b201.zip
do not use zrl tag for non zot profiles and remove redundant foreach which was a leftover from zot to zot6 transition days
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php64
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 {