* Render actions localized
*/
function localize_item(&$item){
-
+ $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){
$r = q("SELECT * from `item`,`contact` WHERE
$item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
}
-
+ if ($item['verb']===ACTIVITY_TAG){
+ $r = q("SELECT * from `item`,`contact` WHERE
+ `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
+ dbesc($item['parent-uri']));
+ if(count($r)==0) return;
+ $obj=$r[0];
+
+ $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
+ $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
+
+ switch($obj['verb']){
+ case ACTIVITY_POST:
+ switch ($obj['object-type']){
+ case ACTIVITY_OBJ_EVENT:
+ $post_type = t('event');
+ break;
+ default:
+ $post_type = t('status');
+ }
+ break;
+ default:
+ if($obj['resource-id']){
+ $post_type = t('photo');
+ $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
+ $rr['plink'] = $m[1];
+ } else {
+ $post_type = t('status');
+ }
+ }
+ $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
+
+ $parsedobj = parse_xml_string($xmlhead.$item['object']);
+
+ $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->link, $parsedobj->content);
+ $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
+
+
+ }
}
// array with html for each thread (parent+comments)
- $treads = array();
- $treadsid = -1;
+ $threads = array();
+ $threadsid = -1;
if(count($items)) {
$tpl = get_markup_template('search_item.tpl');
foreach($items as $item) {
- $treadsid++;
+ $threadsid++;
$comment = '';
$owner_url = '';
$body = prepare_body($item,true);
- $treads[$treadsid] .= replace_macros($tpl,array(
+ $tmp_item = replace_macros($tpl,array(
'$id' => $item['item_id'],
'$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'$profile_url' => $profile_link,
'$wait' => t('Please wait'),
));
+ $arr = array('item' => $item, 'output' => $tmp_item);
+ call_hooks('display_item', $arr);
+
+ $threads[$threadsid] .= $arr['output'];
+
}
}
$comments_seen = 0;
$comments_collapsed = false;
- $treadsid++;
- $treads[$treadsid] = "";
+ $threadsid++;
+ $threads[$threadsid] = "";
}
else {
// prevent private email from leaking into public conversation
if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
if(! $comments_collapsed) {
- $treads[$treadsid] .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent']
+ $threads[$threadsid] .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent']
. '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\'); $(\'#ccollapse-wrapper-' . $item['parent'] . '\').hide();" >'
. sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>'
. '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
}
}
if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
- $treads[$treadsid] .= '</div>';
+ $threads[$threadsid] .= '</div>';
}
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
);
$star = false;
- $starred = "unstarred";
+ $isstarred = "unstarred";
if ($profile_owner == local_user() && $toplevelpost) {
$isstarred = (($item['starred']) ? "starred" : "unstarred");
'classdo' => (($item['starred']) ? "hidden" : ""),
'classundo' => (($item['starred']) ? "" : "hidden"),
'starred' => t('starred'),
+ 'tagger' => t("add tag"),
+ 'classtagger' => "",
);
}
//
localize_item($item);
+
+ $tags=array();
+ foreach(explode(',',$item['tag']) as $tag){
+ $tag = trim($tag);
+ if ($tag!="") $tags[] = bbcode($tag);
+ }
+
+
// Build the HTML
$body = prepare_body($item,true);
-
+
$tmp_item = replace_macros($template,array(
+ '$type' => implode("",array_slice(split("/",$item['verb']),-1)),
+ '$tags' => $tags,
'$body' => template_escape($body),
'$id' => $item['item_id'],
'$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
'$osparkle' => $osparkle,
'$sparkle' => $sparkle,
'$title' => template_escape($item['title']),
- '$ago' => ((($item['app']) && ($item['id'] == $item['parent'])) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
+ '$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
'$lock' => $lock,
'$location' => template_escape($location),
'$indent' => $indent,
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
- $treads[$treadsid] .= $arr['output'];
+ $threads[$threadsid] .= $arr['output'];
}
}
}
// if author collapsing is in force but didn't get closed, close it off now.
/*if($blowhard_count >= 3)
- $treads[$treadsid] .= '</div>';*/
+ $threads[$threadsid] .= '</div>';*/
$page_template = get_markup_template("conversation.tpl");
$o .= replace_macros($page_template, array(
- '$treads' => $treads,
+ '$threads' => $threads,
'$dropping' => ($dropping?t('Delete Selected Items'):False),
));
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
+ '$newpost' => 'true',
'$baseurl' => $a->get_baseurl(),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),
'$linkurl' => t('Please enter a link URL:'),
- '$utubeurl' => t('Please enter a YouTube link:'),
- '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"),
- '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"),
+ '$vidurl' => t("Please enter a video link/URL:"),
+ '$audurl' => t("Please enter an audio link/URL:"),
+ '$term' => t('Tag term:'),
'$whereareu' => t('Where are you right now?'),
'$title' => t('Enter a title for this item')
));
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
+ '$video' => t('Insert video link'),
+ '$audio' => t('Insert audio link'),
'$setloc' => t('Set your location'),
'$noloc' => t('Clear browser location'),
'$title' => t('Set title'),