2013-02-26 01:09:40 +00:00
|
|
|
<?php /** @file */
|
2012-10-27 11:43:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
function format_notification($item) {
|
|
|
|
|
2012-11-14 00:04:22 +00:00
|
|
|
$ret = '';
|
|
|
|
|
|
|
|
require_once('include/conversation.php');
|
|
|
|
|
|
|
|
// Call localize_item with the "brief" flag to get a one line status for activities.
|
|
|
|
// This should set $item['localized'] to indicate we have a brief summary.
|
|
|
|
|
2012-11-14 03:32:59 +00:00
|
|
|
localize_item($item);
|
2012-11-14 00:04:22 +00:00
|
|
|
|
2013-01-11 10:19:46 +00:00
|
|
|
if($item_localize) {
|
|
|
|
$itemem_text = $item['localize'];
|
|
|
|
}
|
|
|
|
else {
|
2015-01-23 01:41:16 +00:00
|
|
|
$itemem_text = (($item['item_thread_top'])
|
2013-01-11 10:19:46 +00:00
|
|
|
? t('created a new post')
|
|
|
|
: sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name']));
|
2012-11-14 00:04:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// convert this logic into a json array just like the system notifications
|
|
|
|
|
|
|
|
return array(
|
2013-01-11 10:19:46 +00:00
|
|
|
'notify_link' => $item['llink'],
|
2012-11-30 04:46:45 +00:00
|
|
|
'name' => $item['author']['xchan_name'],
|
|
|
|
'url' => $item['author']['xchan_url'],
|
|
|
|
'photo' => $item['author']['xchan_photo_s'],
|
|
|
|
'when' => relative_date($item['created']),
|
2015-02-13 01:45:25 +00:00
|
|
|
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
|
2012-11-30 04:46:45 +00:00
|
|
|
'message' => strip_tags(bbcode($itemem_text))
|
2012-11-14 00:04:22 +00:00
|
|
|
);
|
2012-10-27 11:43:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|