diff options
author | Friendika <info@friendika.com> | 2011-10-05 20:48:00 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-05 20:48:00 -0700 |
commit | 4c0ee7f41ffb614e0e25d9838d1dc0cc8c05ad1d (patch) | |
tree | 975a7e47bc3dc0ba43a6cc94d05886427f657af8 /include | |
parent | ecd714ae54520fb55b54407b5022b6ac7922f514 (diff) | |
download | volse-hubzilla-4c0ee7f41ffb614e0e25d9838d1dc0cc8c05ad1d.tar.gz volse-hubzilla-4c0ee7f41ffb614e0e25d9838d1dc0cc8c05ad1d.tar.bz2 volse-hubzilla-4c0ee7f41ffb614e0e25d9838d1dc0cc8c05ad1d.zip |
bug 173
Diffstat (limited to 'include')
-rw-r--r-- | include/diaspora.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index 33b8336f3..d4edc3f11 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -515,6 +515,26 @@ function diaspora_post($importer,$xml) { $body = diaspora2bb($xml->raw_message); $datarray = array(); + + $str_tags = ''; + + $tags = get_tags($body); + + if(count($tags)) { + foreach($tags as $tag) { + if(strpos($tag,'#') === 0) { + if(strpos($tag,'[url=')) + continue; + $basetag = str_replace('_',' ',substr($tag,1)); + $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body); + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; + continue; + } + } + } + $datarray['uid'] = $importer['uid']; $datarray['contact-id'] = $contact['id']; $datarray['wall'] = 0; @@ -530,6 +550,7 @@ function diaspora_post($importer,$xml) { $datarray['author-link'] = $contact['url']; $datarray['author-avatar'] = $contact['thumb']; $datarray['body'] = $body; + $datarray['tag'] = $str_tags; $datarray['app'] = 'Diaspora'; $message_id = item_store($datarray); @@ -633,6 +654,26 @@ function diaspora_comment($importer,$xml,$msg) { $message_id = $diaspora_handle . ':' . $guid; $datarray = array(); + + $str_tags = ''; + + $tags = get_tags($body); + + if(count($tags)) { + foreach($tags as $tag) { + if(strpos($tag,'#') === 0) { + if(strpos($tag,'[url=')) + continue; + $basetag = str_replace('_',' ',substr($tag,1)); + $body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body); + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; + continue; + } + } + } + $datarray['uid'] = $importer['uid']; $datarray['contact-id'] = $contact['id']; $datarray['wall'] = $parent_item['wall']; @@ -653,6 +694,7 @@ function diaspora_comment($importer,$xml,$msg) { $datarray['author-link'] = $person['url']; $datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']); $datarray['body'] = $body; + $datarray['tag'] = $str_tags; $datarray['app'] = 'Diaspora'; $message_id = item_store($datarray); |