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/identica/identica.js | 31 ++++++++++++++++++++++++++++ plugins/identica/identica.php | 47 ++++++++++++++++++++++++++++++++++++++++++ plugins/identica/identica.png | Bin 0 -> 121 bytes 3 files changed, 78 insertions(+) create mode 100644 plugins/identica/identica.js create mode 100644 plugins/identica/identica.php create mode 100644 plugins/identica/identica.png (limited to 'plugins/identica') diff --git a/plugins/identica/identica.js b/plugins/identica/identica.js new file mode 100644 index 000000000..d31fc55f4 --- /dev/null +++ b/plugins/identica/identica.js @@ -0,0 +1,31 @@ + function shareArticleToIdentica(id) { + try { + var query = "?op=pluginhandler&plugin=identica&method=getInfo&id=" + param_escape(id); + + console.log(query); + + var d = new Date(); + var ts = d.getTime(); + + var w = window.open('backend.php?op=backend&method=loading', 'ttrss_tweet', + "status=0,toolbar=0,location=0,width=600,height=500,scrollbars=1,menubar=0"); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + var ti = JSON.parse(transport.responseText); + + var share_url = "http://identi.ca/index.php?action=bookmarkpopup&_=" + ts + + "&title=" + param_escape(ti.title) + + "&url=" + param_escape(ti.link); + + w.location.href = share_url; + + } }); + + + } catch (e) { + exception_error("shareArticleIdentica", e); + } + } + diff --git a/plugins/identica/identica.php b/plugins/identica/identica.php new file mode 100644 index 000000000..e7a5b3573 --- /dev/null +++ b/plugins/identica/identica.php @@ -0,0 +1,47 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); + } + + function get_js() { + return file_get_contents(dirname(__FILE__) . "/identica.js"); + } + + function hook_article_button($line) { + $article_id = $line["id"]; + + $rv = "link, 'plugins/identica/identica.png')."\" + class='tagsPic' style=\"cursor : pointer\" + onclick=\"shareArticleToIdentica($article_id)\" + title='".__('Share on identi.ca')."'>"; + + return $rv; + } + + function getInfo() { + $id = db_escape_string($_REQUEST['id']); + + $result = db_query($this->link, "SELECT title, link + FROM ttrss_entries, ttrss_user_entries + WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']); + + if (db_num_rows($result) != 0) { + $title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')), + 100, '...'); + $article_link = db_fetch_result($result, 0, 'link'); + } + + print json_encode(array("title" => $title, "link" => $article_link, + "id" => $id)); + } + + +} +?> diff --git a/plugins/identica/identica.png b/plugins/identica/identica.png new file mode 100644 index 000000000..ee3cb61ea Binary files /dev/null and b/plugins/identica/identica.png differ -- cgit v1.2.3