diff options
author | fabrixxm <fabrix.xm@gmail.com> | 2011-04-18 20:38:48 +0200 |
---|---|---|
committer | fabrixxm <fabrix.xm@gmail.com> | 2011-04-18 20:38:48 +0200 |
commit | 1d8bd89fece18e861760eeed40ded146e01a0abb (patch) | |
tree | 05a2b24542b945501439034ffc2eaa50410b370f /include/conversation.php | |
parent | 60fbe0b39b02e9d1ce4521883c86b4783f4b9d4e (diff) | |
download | volse-hubzilla-1d8bd89fece18e861760eeed40ded146e01a0abb.tar.gz volse-hubzilla-1d8bd89fece18e861760eeed40ded146e01a0abb.tar.bz2 volse-hubzilla-1d8bd89fece18e861760eeed40ded146e01a0abb.zip |
translate "like"/"dislike"/"friends with" messages at print time
Diffstat (limited to 'include/conversation.php')
-rw-r--r-- | include/conversation.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/include/conversation.php b/include/conversation.php index a1ce19a7a..3ec0706e9 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -8,12 +8,18 @@ function localize_item(&$item){ if ($item['verb']=="http://activitystrea.ms/schema/1.0/like" || $item['verb']=="http://activitystrea.ms/schema/1.0/dislike"){ + $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]'; - #$objlink = preg_grep("|<link.*href=", $input)$item['object'] - // $item['verb']=="http://activitystrea.ms/schema/1.0/like" + $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]'; + $post_type = (($obj['resource-id']) ? t('photo') : t('status')); + $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]'; + switch($item['verb']){ case "http://activitystrea.ms/schema/1.0/like": $bodyverb = t('%1$s likes %2$s\'s %3$s'); @@ -22,11 +28,21 @@ function localize_item(&$item){ $bodyverb = t('%1$s doesn\'t like %2$s\'s %3$s'); break; } - $item['body'] = sprintf($bodyverb, $author, "tizio", "coso"); + $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink); } + if ($item['verb']=='http://activitystrea.ms/schema/1.0/make-friend'){ + $b = str_replace("[/url]","[/url]\n", $item['body']); + preg_match_all("|(\[url.*\[/url\])|", $b, $match); + $item['body'] = $match[0][0]." " + .t('is now friends with') + ." ".$match[0][1]."\n\n\n" + .$match[0][2]; + + } + } /** |