]>
git.wh0rd.org - tt-rss.git/blob - plugins/flattr/init.php
2 class Flattr
extends Plugin
{
7 $this->link
= $host->get_link();
10 $host->add_hook($host::HOOK_ARTICLE_BUTTON
, $this);
15 "Share articles on Flattr (if they exist in their catalogue)",
16 "F. Eitel, N. Honing");
19 function hook_article_button($line) {
22 $article_link = $line['link'];
25 $encoded = urlencode($article_link);
26 $r = file_get_contents("https://api.flattr.com/rest/v2/things/lookup/?url=$encoded");
27 $response = json_decode($r, true);
28 $image = "<img src=\"plugins/flattr/flattr.png\"
29 class='tagsPic' style=\"cursor : pointer\"
30 title='".__('Flattr this article.')."'>";
31 // if Flattr has it in the catalogue, we display the button
32 if ($response and array_key_exists('link', $response)) {
33 $rv = "<a id='flattr' target='_blank' href='" . $response['link'] . "'> . $image . </a>";
35 // We can't submit a thing to the catalogue without giving a Flattr user id (who would be the owner)
36 // see http://developers.flattr.net/auto-submit
37 //$rv = "<a id='flattr' href='https://flattr.com/submit/auto?url=" . $encoded . "'>" . $image . "</a>";
39 // Another useful thing would be any rel=payment link (which would have the user id as well),
40 // but tt-rss is not checking that (yet), I believe. See http://developers.flattr.net/feed