forked from friendica/friendica-addons
Merge pull request #962 from MrPetovan/task/8318-widget_like-dislike-config
[widget_like] Add support for system.hide_dislike user config key
This commit is contained in:
commit
0fda21d637
|
@ -1,3 +1,5 @@
|
||||||
<style>body {font-size: 0.8em; margin: 0px; padding: 0px;}</style>
|
<style>body {font-size: 0.8em; margin: 0px; padding: 0px;}</style>
|
||||||
<span class='f9k_like' title="{{$strlike}}">{{$like}} <img src="{{$baseurl}}/images/like.gif" alt="like"/></span>
|
<span class='f9k_like' title="{{$strlike}}">{{$like}} <img src="{{$baseurl}}/images/like.gif" alt="like"/></span>
|
||||||
|
{{if $dislike}}
|
||||||
<span class='f9k_dislike' title="{{$strdislike}}">{{$dislike}} <img src="{{$baseurl}}/images/dislike.gif" alt="dislike"/></span>
|
<span class='f9k_dislike' title="{{$strdislike}}">{{$dislike}} <img src="{{$baseurl}}/images/dislike.gif" alt="dislike"/></span>
|
||||||
|
{{/if}}
|
||||||
|
|
|
@ -43,14 +43,18 @@ function like_widget_content(&$a, $conf){
|
||||||
DBA::escape($args[0])
|
DBA::escape($args[0])
|
||||||
);
|
);
|
||||||
$likes = $r[0]['c'];
|
$likes = $r[0]['c'];
|
||||||
$iid = $r[0]['id'];
|
|
||||||
|
|
||||||
// count dislikes
|
$dislikes = 0;
|
||||||
$r = q( $baseq . "AND `item`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
|
$strdislike = '';
|
||||||
intval($conf['uid']),
|
if (!DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
|
||||||
DBA::escape($args[0])
|
// count dislikes
|
||||||
);
|
$r = q( $baseq . "AND `item`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
|
||||||
$dislikes = $r[0]['c'];
|
intval($conf['uid']),
|
||||||
|
DBA::escape($args[0])
|
||||||
|
);
|
||||||
|
$dislikes = $r[0]['c'];
|
||||||
|
$strdislike = DI::l10n()->tt("%d person doesn't like this", "%d people don't like this", $dislikes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$o = "";
|
$o = "";
|
||||||
|
@ -62,7 +66,7 @@ function like_widget_content(&$a, $conf){
|
||||||
'$strlike' => DI::l10n()->tt("%d person likes this", "%d people like this", $likes),
|
'$strlike' => DI::l10n()->tt("%d person likes this", "%d people like this", $likes),
|
||||||
|
|
||||||
'$dislike' => $dislikes,
|
'$dislike' => $dislikes,
|
||||||
'$strdislike'=> DI::l10n()->tt("%d person doesn't like this", "%d people don't like this", $dislikes),
|
'$strdislike'=> $strdislike,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
Loading…
Reference in a new issue