}
-/**
- * returns
- * [
- * //categories [
- * {
- * 'name': 'category name',
- * 'removeurl': 'url to remove this category',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ],
- * // folders [
- * 'name': 'folder name',
- * 'removeurl': 'url to remove this folder',
- * 'first': 'is the first in this array? true/false',
- * 'last': 'is the last in this array? true/false',
- * } ,
- * ....
- * ]
- * ]
- */
-function get_cats_and_terms($item) {
- $categories = array();
- $folders = array();
-
- $matches = false; $first = true;
- $cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
- if($cnt) {
- foreach($matches as $mtch) {
- $categories[] = array(
- 'name' => xmlify(file_tag_decode($mtch[1])),
- 'removeurl' => $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . xmlify(file_tag_decode($mtch[1])),
- 'first' => $first,
- 'last' => false
- );
- $first = false;
- }
- }
- if (count($categories)) $categories[count($categories)-1]['last'] = true;
-
-
-
- $matches = false; $first = true;
- $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
- if($cnt) {
- foreach($matches as $mtch) {
- $folders[] = array(
- 'name' => xmlify(file_tag_decode($mtch[1])),
- 'removeurl' => $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])),
- 'first' => $first,
- 'last' => false
- );
- $first = false;
- }
- }
-
- if (count($folders)) $folders[count($folders)-1]['last'] = true;
-
- return array($categories, $folders);
-}
-
-
/**
* Recursively prepare a thread for HTML
*/
}}
+/**
+ * returns
+ * [
+ * //categories [
+ * {
+ * 'name': 'category name',
+ * 'removeurl': 'url to remove this category',
+ * 'first': 'is the first in this array? true/false',
+ * 'last': 'is the last in this array? true/false',
+ * } ,
+ * ....
+ * ],
+ * // folders [
+ * 'name': 'folder name',
+ * 'removeurl': 'url to remove this folder',
+ * 'first': 'is the first in this array? true/false',
+ * 'last': 'is the last in this array? true/false',
+ * } ,
+ * ....
+ * ]
+ * ]
+ */
+function get_cats_and_terms($item) {
+ $a = get_app();
+ $categories = array();
+ $folders = array();
+
+ $matches = false; $first = true;
+ $cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $categories[] = array(
+ 'name' => xmlify(file_tag_decode($mtch[1])),
+ 'url' => "#",
+ 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&cat=' . xmlify(file_tag_decode($mtch[1])):""),
+ 'first' => $first,
+ 'last' => false
+ );
+ $first = false;
+ }
+ }
+ if (count($categories)) $categories[count($categories)-1]['last'] = true;
+
+
+
+ $matches = false; $first = true;
+ $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $folders[] = array(
+ 'name' => xmlify(file_tag_decode($mtch[1])),
+ 'url' => "#",
+ 'removeurl' => ((local_user() == $item['uid'])?$a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . xmlify(file_tag_decode($mtch[1])):""),
+ 'first' => $first,
+ 'last' => false
+ );
+ $first = false;
+ }
+ }
+
+ if (count($folders)) $folders[count($folders)-1]['last'] = true;
+
+ return array($categories, $folders);
+}
+
+
/**
* return atom link elements for all of our hubs
*/
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_google($locate));
$tags=array();
+ $hashtags = array();
+ $mentions = array();
foreach(explode(',',$item['tag']) as $tag){
$tag = trim($tag);
- if ($tag!="") $tags[] = bbcode($tag);
- }
+ if ($tag!="") {
+ $t = bbcode($tag);
+ $tags[] = $t;
+ if($t[0] == '#')
+ $hashtags[] = $t;
+ elseif($t[0] == '@')
+ $mentions[] = $t;
+ }
+
+ }
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
$body = prepare_body($item,true);
+ list($categories, $folders) = get_cats_and_terms($item);
+
$tmp_item = array(
'template' => $this->get_template(),
'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
'tags' => $tags,
+ 'hashtags' => $hashtags,
+ 'mentions' => $mentions,
+ 'categories' => $categories,
+ 'folders' => $folders,
'body' => template_escape($body),
'text' => strip_tags(template_escape($body)),
'id' => $this->get_id(),
}
}
+ if ($this->is_toplevel()) {
+ $result['total_comments_num'] = $total_children;
+ $result['total_comments_text'] = tt('comment', 'comments', $total_children);
+ }
+
$result['private'] = $item['private'];
$result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : '');