]>
git.wh0rd.org - tt-rss.git/blob - plugins/flattr/flattr.php
2 class Flattr
extends Plugin
{
7 $this->link
= $host->get_link();
10 $host->add_hook($host::HOOK_ARTICLE_BUTTON
, $this);
15 "Share on Flattr plugin",
19 function hook_article_button($line) {
21 $article_id = $line["id"];
23 $result = db_query($this->link
, "SELECT link
24 FROM ttrss_entries, ttrss_user_entries
25 WHERE id = '$article_id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
27 if (db_num_rows($result) != 0) {
28 $article_link = db_fetch_result($result, 0, 'link');
33 $encoded = urlencode($article_link);
34 $r = file_get_contents("https://api.flattr.com/rest/v2/things/lookup/?url=$encoded");
35 $response = json_decode($r, true);
39 if ($response and array_key_exists('link', $response)) {
40 $rv = "<a id='flattr' href='" . $response['link'] . "'>
41 <img src=\"".theme_image($this->link
, 'plugins/flattr/flattr.png')."\"
42 class='tagsPic' style=\"cursor : pointer\"
43 title='".__('Flattr article')."'>