aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-09-24 19:45:19 -0700
committerzotlabs <mike@macgirvin.com>2017-09-24 19:45:19 -0700
commit1650d79862c0e89887ede279a19c8df07fe0d927 (patch)
treed79456ec287e5627975fa0bba02fb41b148c5030 /include/text.php
parente8a888caabe83170ce879d7043fae188cd0fed16 (diff)
downloadvolse-hubzilla-1650d79862c0e89887ede279a19c8df07fe0d927.tar.gz
volse-hubzilla-1650d79862c0e89887ede279a19c8df07fe0d927.tar.bz2
volse-hubzilla-1650d79862c0e89887ede279a19c8df07fe0d927.zip
tagging changes - provides ability to mention a forum by using !forumname as well as the traditional red style (@forumname+). This should probably not be advertised on a wide scale until after a critical mass of sites have updated to a version containing these changes. This adds yet another option type to the ACL module which probably needs refactoring soon since it is turning into option type spaghetti.
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/include/text.php b/include/text.php
index 16391bbc9..baac58e50 100644
--- a/include/text.php
+++ b/include/text.php
@@ -823,7 +823,7 @@ function get_tags($s) {
// Otherwise pull out single word tags. These can be @nickname, @first_last
// and #hash tags.
- if(preg_match_all('/(?<![a-zA-Z0-9=\/\?\;])([@#!][^ \x0D\x0A,;:?\[]+)/',$s,$match)) {
+ if(preg_match_all('/(?<![a-zA-Z0-9=\/\?\;])([@#\!][^ \x0D\x0A,;:?\[]+)/',$s,$match)) {
foreach($match[1] as $mtch) {
if(substr($mtch,-1,1) === '.')
$mtch = substr($mtch,0,-1);
@@ -2383,9 +2383,9 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
$r = null;
$match = array();
- $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
- $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype);
- $termtype = ((strpos($tag,'!') === 0) ? TERM_MENTION : $termtype);
+ $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
+ $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype);
+ $termtype = ((strpos($tag,'!') === 0) ? TERM_FORUM : $termtype);
$termtype = ((strpos($tag,'#^[') === 0) ? TERM_BOOKMARK : $termtype);
//is it a hash tag?
@@ -2623,8 +2623,15 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
//create profile link
$profile = str_replace(',','%2c',$profile);
$url = $profile;
- $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . (($forum && ! $trailing_plus_name) ? '+' : '') . '[/zrl]';
- $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
+ if($grouptag) {
+ $newtag = '!' . '[zrl=' . $profile . ']' . $newname . '[/zrl]';
+ $body = str_replace('!' . $name, $newtag, $body);
+ }
+ else {
+ $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . (($forum && ! $trailing_plus_name) ? '+' : '') . '[/zrl]';
+ $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
+ }
+
//append tag to str_tags
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))