From 96c8e74438d4f7c324c96893720fd4018925de4f Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 27 Oct 2012 04:43:39 -0700 Subject: start on network/home notification refactor --- include/features.php | 13 ++++++------ include/notify.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 include/notify.php (limited to 'include') diff --git a/include/features.php b/include/features.php index 2bb874095..d74718540 100644 --- a/include/features.php +++ b/include/features.php @@ -16,13 +16,12 @@ function get_features() { $arr = array( -'multi_delete' => t('Multiple Deletion'), -'expire' => t('Content Expiration'), -'commtag' => t('Community Tagging'), -'categories' => t('Post Categories'), -'filing' => t('Saved Folders'), -'archives' => t('Archives'), - +'multi_delete' => t('Multiple Deletion'), +'expire' => t('Content Expiration'), +'commtag' => t('Community Tagging'), +'categories' => t('Post Categories'), +'filing' => t('Saved Folders'), +'archives' => t('Search by Date'), ); diff --git a/include/notify.php b/include/notify.php new file mode 100644 index 000000000..33ea5843c --- /dev/null +++ b/include/notify.php @@ -0,0 +1,60 @@ + $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'], + '$itemem_image' => $item['author-avatar'], + '$itemem_text' => sprintf( t("%s liked %s's post"), $item['author-name'], $item['pname']), + '$itemem_when' => relative_date($item['created']) + )); + break; + + case ACTIVITY_DISLIKE: + $notif_content .= replace_macros($tpl_item_dislikes,array( + '$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'], + '$itemem_image' => $item['author-avatar'], + '$itemem_text' => sprintf( t("%s disliked %s's post"), $item['author-name'], $item['pname']), + '$itemem_when' => relative_date($item['created']) + )); + break; + + case ACTIVITY_FRIEND: + + $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; + $obj = parse_xml_string($xmlhead.$item['object']); + $item['fname'] = $obj->title; + + $notif_content .= replace_macros($tpl_item_friends,array( + '$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'], + '$itemem_image' => $item['author-avatar'], + '$itemem_text' => sprintf( t("%s is now friends with %s"), $item['author-name'], $item['fname']), + '$itemem_when' => relative_date($item['created']) + )); + break; + + default: + $itemem_text = (($item['id'] == $item['parent']) + ? sprintf( t("%s created a new post"), $item['author-name']) + : sprintf( t("%s commented on %s's post"), $item['author-name'], $item['pname'])); + $tpl = (($item['id'] == $item['parent']) ? $tpl_item_posts : $tpl_item_comments); + + $notif_content .= replace_macros($tpl,array( + '$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'], + '$itemem_image' => $item['author-avatar'], + '$itemem_text' => $itemem_text, + '$itemem_when' => relative_date($it['created']) + )); + } +} + -- cgit v1.2.3