aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php1
-rwxr-xr-xinclude/text.php30
2 files changed, 31 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index ec324b6a3..f1778e722 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2339,6 +2339,7 @@ function tag_deliver($uid,$item_id) {
if($j_obj && $j_obj['id'] && $j_obj['title']) {
if(is_array($j_obj['link']))
$taglink = get_rel_link($j_obj['link'],'alternate');
+
store_item_tag($u[0]['channel_id'],$p[0]['id'],TERM_OBJ_POST,TERM_HASHTAG,$j_obj['title'],$j_obj['id']);
$x = q("update item set edited = '%s', received = '%s', changed = '%s' where mid = '%s' and uid = %d limit 1",
dbesc(datetime_convert()),
diff --git a/include/text.php b/include/text.php
index d549f206e..95e59c54c 100755
--- a/include/text.php
+++ b/include/text.php
@@ -1190,6 +1190,33 @@ function format_categories(&$item,$writeable) {
return $s;
}
+// Add any hashtags which weren't mentioned in the message body, e.g. community tags
+
+function format_hashtags(&$item) {
+
+ $s = '';
+ $terms = get_terms_oftype($item['term'],TERM_HASHTAG);
+ if($terms) {
+ $categories = array();
+ foreach($terms as $t) {
+ $term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8',false) ;
+ if(! trim($term))
+ continue;
+ if(strpos($item['body'], $t['url']))
+ continue;
+
+ if($s)
+ $s .= '&nbsp';
+
+ $s .= '#<a href="' . zid($t['url']) . '" >' . $term . '</a>';
+ }
+ }
+ return $s;
+}
+
+
+
+
function format_filer(&$item) {
@@ -1242,6 +1269,9 @@ function prepare_body(&$item,$attach = false) {
$writeable = ((get_observer_hash() == $item['owner_xchan']) ? true : false);
+
+ $s .= format_hashtags($item);
+
$s .= format_categories($item,$writeable);
if(local_user() == $item['uid'])