From 7252abe3ea5703b3cf75a3745e560499cfde500a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 23 Dec 2012 15:18:41 +0400 Subject: add contributed plugins; load note plugin by default --- plugins/flattr/flattr.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ plugins/flattr/flattr.png | Bin 0 -> 693 bytes 2 files changed, 46 insertions(+) create mode 100644 plugins/flattr/flattr.php create mode 100644 plugins/flattr/flattr.png (limited to 'plugins/flattr') diff --git a/plugins/flattr/flattr.php b/plugins/flattr/flattr.php new file mode 100644 index 000000000..6af6cb9c3 --- /dev/null +++ b/plugins/flattr/flattr.php @@ -0,0 +1,46 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); + } + + function hook_article_button($line) { + + $article_id = $line["id"]; + + $result = db_query($this->link, "SELECT link + FROM ttrss_entries, ttrss_user_entries + WHERE id = '$article_id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']); + + if (db_num_rows($result) != 0) { + $article_link = db_fetch_result($result, 0, 'link'); + } + + $response = null; + if ($article_link) { + $encoded = urlencode($article_link); + $r = file_get_contents("https://api.flattr.com/rest/v2/things/lookup/?url=$encoded"); + $response = json_decode($r, true); + } + + $rv = null; + if ($response and array_key_exists('link', $response)) { + $rv = " + link, 'plugins/flattr/flattr.png')."\" + class='tagsPic' style=\"cursor : pointer\" + title='".__('Flattr article')."'> + "; + } else { + $rv = ""; + } + + return $rv; + } +} +?> diff --git a/plugins/flattr/flattr.png b/plugins/flattr/flattr.png new file mode 100644 index 000000000..4933ffc21 Binary files /dev/null and b/plugins/flattr/flattr.png differ -- cgit v1.2.3