aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php46
1 files changed, 35 insertions, 11 deletions
diff --git a/mod/item.php b/mod/item.php
index ab104735b..ee3bdca99 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -333,15 +333,20 @@ function item_post(&$a) {
}
}
- // embedded bookmark in post? convert to regular url and set bookmark flag
+ // embedded bookmark in post? set bookmark flag
$bookmark = 0;
- if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match)) {
+ if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
$bookmark = 1;
- $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$body);
+// foreach($match as $mtch) {
+// $body = str_replace(
+// '[bookmark=' . $mtch[1] . ']' . $mtch[2] . '[/bookmark]',
+// '[url=' . $mtch[1] . ']' . $mtch[2] . '[/url]',
+// $body
+// );
+// }
}
-
$body = bb_translate_video($body);
/**
@@ -373,6 +378,7 @@ function item_post(&$a) {
if(count($tags)) {
foreach($tags as $tag) {
+
if(isset($profile))
unset($profile);
if(strpos($tag,'#') === 0) {
@@ -408,7 +414,19 @@ function item_post(&$a) {
else {
$newname = $name;
$alias = '';
- if(strstr($name,'_') || strstr($name,' ')) {
+ $tagcid = 0;
+ if(strrpos($newname,'+')) {
+ $tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
+ if(strpos($name,' '))
+ $name = substr($name,0,strpos($name,' '));
+ }
+ if($tagcid) {
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($tagcid),
+ intval($profile_uid)
+ );
+ }
+ elseif(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
@@ -440,17 +458,23 @@ function item_post(&$a) {
if($profile) {
$body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
$profile = str_replace(',','%2c',$profile);
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]';
+ $newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
+ if(! stristr($str_tags,$newtag)) {
+ if(strlen($str_tags))
+ $str_tags .= ',';
+ $str_tags .= $newtag;
+ }
// Status.Net seems to require the numeric ID URL in a mention if the person isn't
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) {
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= '@[url=' . $alias . ']' . $newname . '[/url]';
+ $newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
+ if(! stristr($str_tags,$newtag)) {
+ if(strlen($str_tags))
+ $str_tags .= ',';
+ $str_tags .= $newtag;
+ }
}
}
}