translate "like"/"dislike"/"friends with" messages at print time
This commit is contained in:
parent
60fbe0b39b
commit
1d8bd89fec
|
@ -8,11 +8,17 @@ 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":
|
||||
|
@ -22,10 +28,20 @@ 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];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue