From 9b2cbc33ae0a4adfca156085898eeef5fd471657 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Tue, 15 Nov 2011 17:41:51 +0100 Subject: [PATCH] ping: show tags --- mod/ping.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/mod/ping.php b/mod/ping.php index 9965ea91..9f6ae197 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -8,9 +8,10 @@ function ping_init(&$a) { echo " "; + $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; if(local_user()){ - + $tags = array(); $comments = array(); $likes = array(); $dislikes = array(); @@ -29,6 +30,11 @@ function ping_init(&$a) { $network = count($r); foreach ($r as $it) { switch($it['verb']){ + case ACTIVITY_TAG: + $obj = parse_xml_string($xmlhead.$it['object']); + $it['tname'] = $obj->content; + $tags[] = $it; + break; case ACTIVITY_LIKE: $likes[] = $it; break; @@ -36,7 +42,6 @@ function ping_init(&$a) { $dislikes[] = $it; break; case ACTIVITY_FRIEND: - $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $obj = parse_xml_string($xmlhead.$it['object']); $it['fname'] = $obj->title; $friends[] = $it; @@ -61,6 +66,11 @@ function ping_init(&$a) { $home = count($r); foreach ($r as $it) { switch($it['verb']){ + case ACTIVITY_TAG: + $obj = parse_xml_string($xmlhead.$it['object']); + $it['tname'] = $obj->content; + $tags[] = $it; + break; case ACTIVITY_LIKE: $likes[] = $it; break; @@ -68,7 +78,6 @@ function ping_init(&$a) { $dislikes[] = $it; break; case ACTIVITY_FRIEND: - $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; $obj = parse_xml_string($xmlhead.$it['object']); $it['fname'] = $obj->title; $friends[] = $it; @@ -129,7 +138,7 @@ function ping_init(&$a) { $home"; if ($register!=0) echo "$register"; - $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts); + $tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags); echo ' '; if ($intro>0){ @@ -173,6 +182,11 @@ function ping_init(&$a) { echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} posted") ) ); }; } + if (count($tags)){ + foreach ($tags as $i) { + echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) ); + }; + } echo " "; }