aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
authormarijus <mario@localhost.localdomain>2014-02-04 16:19:35 +0100
committermarijus <mario@localhost.localdomain>2014-02-04 16:19:35 +0100
commit4253581733d4c6c7f0dce5c3ea7566c6af4af936 (patch)
tree1eadff45b06adcac3f93432beea63b7ccd7391ff /mod/item.php
parent2a9baa1f325b62541ad7a7b68e91455b104677bd (diff)
parent74298c44ae445125bfc2b13d20da91b9d349ce43 (diff)
downloadvolse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.tar.gz
volse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.tar.bz2
volse-hubzilla-4253581733d4c6c7f0dce5c3ea7566c6af4af936.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php25
1 files changed, 18 insertions, 7 deletions
diff --git a/mod/item.php b/mod/item.php
index 6d421009b..68bb75897 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -887,13 +887,24 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$replaced = false;
$r = null;
- $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN);
- $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_BOOKMARK : $termtype);
+
//is it a hash tag?
if(strpos($tag,'#') === 0) {
- // if the tag is replaced...
- if(strpos($tag,'[zrl=')) {
+ if(strpos($tag,'#^[') === 0) {
+ if(preg_match('/#\^\[(url|zrl)=(.*?)\](.*?)\[\/(url|zrl)\]/',$tag,$match)) {
+ $basetag = $match[3];
+ $url = $match[2];
+ $replaced = true;
+
+ }
+ }
+ // if the tag is already replaced...
+ elseif(strpos($tag,'[zrl=')) {
//...do nothing
return $replaced;
}
@@ -904,7 +915,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$body = str_replace($tag,$newtag,$body);
$replaced = true;
}
- else {
+ if(! $replaced) {
//base tag has the tags name only
$basetag = str_replace('_',' ',substr($tag,1));
//create text for link
@@ -961,7 +972,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
- $r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
dbesc($newname),
intval($profile_uid)
@@ -969,7 +980,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
if(! $r) {
//select someone by attag or nick and the name passed in
- $r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE xchan_addr like ('%s') AND abook_channel = %d LIMIT 1",
dbesc($newname . '@%'),
intval($profile_uid)