3 use Friendica\Core\L10n;
5 function like_widget_name() {
8 function like_widget_help() {
9 return "Search first item which contains <em>KEY</em> and print like/dislike count";
12 function like_widget_args(){
16 function like_widget_size(){
17 return ['60px','20px'];
21 function like_widget_content(&$a, $conf){
22 $args = explode(",",$_GET['a']);
25 $baseq="SELECT COUNT(`item`.`id`) as `c`, `p`.`id`
27 (SELECT `i`.`id` FROM `item` as `i` WHERE
28 `i`.`visible` = 1 AND `i`.`deleted` = 0
29 AND (( `i`.`wall` = 1 AND `i`.`allow_cid` = ''
30 AND `i`.`allow_gid` = ''
31 AND `i`.`deny_cid` = ''
32 AND `i`.`deny_gid` = '' )
34 AND `i`.`body` LIKE '%%%s%%' LIMIT 1) as `p`
35 WHERE `item`.`parent` = `p`.`id` ";
38 $r = q( $baseq . "AND `item`.`verb` = 'http://activitystrea.ms/schema/1.0/like'",
46 $r = q( $baseq . "AND `item`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
50 $dislikes = $r[0]['c'];
53 require_once("include/conversation.php");
57 # $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
58 $t = get_markup_template("widget_like.tpl", "addon/widgets/");
59 $o .= replace_macros($t, [
61 '$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes),
63 '$dislike' => $dislikes,
64 '$strdislike'=> L10n::tt("%d person doesn't like this", "%d people don't like this", $dislikes),
66 '$baseurl' => $a->get_baseurl(),