diff options
26 files changed, 164 insertions, 592 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index f38e621f7..52fec80e7 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -217,9 +217,38 @@ class Feeds extends Handler_Protected { $search_mode = $method; } // error_log("search_mode: " . $search_mode); - $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view, - $search, $search_mode, $override_order, $offset, 0, - false, 0, $include_children); + + if (!$cat_view && is_numeric($feed) && $feed < PLUGIN_FEED_BASE_INDEX) { + global $pluginhost; + + $handler = $pluginhost->get_feed_handler( + PluginHost::feed_to_pfeed_id($feed)); + + // function queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false) { + + if ($handler) { + $options = array( + "limit" => $limit, + "view_mode" => $view_mode, + "cat_view" => $cat_view, + "search" => $search, + "search_mode" => $search_mode, + "override_order" => $override_order, + "offset" => $offset, + "owner_uid" => $_SESSION["uid"], + "filter" => false, + "since_id" => 0, + "include_children" => $include_children); + + $qfh_ret = $handler->get_headlines(PluginHost::feed_to_pfeed_id($feed), + $options); + } + + } else { + $qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view, + $search, $search_mode, $override_order, $offset, 0, + false, 0, $include_children); + } if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info); diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 0ef17b77e..5f584cd00 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -6,6 +6,7 @@ class PluginHost { private $handlers = array(); private $commands = array(); private $storage = array(); + private $feeds = array(); private $owner_uid; private $debug; @@ -301,5 +302,43 @@ class PluginHost { function get_debug() { return $this->debug; } + + // Plugin feed functions are *EXPERIMENTAL*! + + // cat_id: only -1 is supported (Special) + function add_feed($cat_id, $title, $icon, $sender) { + if (!$this->feeds[$cat_id]) $this->feeds[$cat_id] = array(); + + $id = count($this->feeds[$cat_id]); + + array_push($this->feeds[$cat_id], + array('id' => $id, 'title' => $title, 'sender' => $sender, 'icon' => $icon)); + + return $id; + } + + function get_feeds($cat_id) { + return $this->feeds[$cat_id]; + } + + // convert feed_id (e.g. -129) to pfeed_id first + function get_feed_handler($pfeed_id) { + foreach ($this->feeds as $cat) { + foreach ($cat as $feed) { + if ($feed['id'] == $pfeed_id) { + return $feed['sender']; + } + } + } + } + + static function pfeed_to_feed_id($label) { + return PLUGIN_FEED_BASE_INDEX - 1 - abs($label); + } + + static function feed_to_pfeed_id($feed) { + return PLUGIN_FEED_BASE_INDEX - 1 + abs($feed); + } + } ?> diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index a6811f3fc..d2e69c502 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -115,6 +115,32 @@ class Pref_Feeds extends Handler_Protected { array_push($cat['items'], $this->feedlist_init_feed($i)); } + /* Plugin feeds for -1 */ + + global $pluginhost; + + $feeds = $pluginhost->get_feeds(-1); + + if ($feeds) { + foreach ($feeds as $feed) { + $feed_id = PluginHost::pfeed_to_feed_id($feed['id']); + + $item = array(); + $item['id'] = 'FEED:' . $feed_id; + $item['bare_id'] = (int)$feed_id; + $item['name'] = $feed['title']; + $item['checkbox'] = false; + $item['error'] = ''; + $item['icon'] = $feed['icon']; + + $item['param'] = ''; + $item['unread'] = 0; //$feed['sender']->get_unread($feed['id']); + $item['type'] = 'feed'; + + array_push($cat['items'], $item); + } + } + if ($enable_cats) { array_push($root['items'], $cat); } else { diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 45bbba424..28a19f729 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -629,7 +629,9 @@ class Pref_Prefs extends Handler_Protected { print "<h2>".__("Plugins")."</h2>"; - print_notice(__("You will need to reload Tiny Tiny RSS for plugin changes to take effect.")); + print_notice(__("Download more plugins at <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/forum/viewforum.php?f=22\">Tiny Tiny RSS forums</a>.")); + + print "<p class='insensitive'>" . __("You will need to reload Tiny Tiny RSS for plugin changes to take effect.") . "</p>"; print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">"; diff --git a/include/functions.php b/include/functions.php index b2f1a6559..c2bd7673b 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3,6 +3,7 @@ define('SCHEMA_VERSION', 109); define('LABEL_BASE_INDEX', -1024); + define('PLUGIN_FEED_BASE_INDEX', -128); $fetch_last_error = false; $pluginhost = false; @@ -1430,6 +1431,20 @@ array_push($ret_arr, $cv); } + global $pluginhost; + + if ($pluginhost) { + $feeds = $pluginhost->get_feeds(-1); + + foreach ($feeds as $feed) { + $cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']), + "counter" => $feed['sender']->get_unread($feed['id'])); + + array_push($ret_arr, $cv); + } + + } + return $ret_arr; } diff --git a/plugins/example_vfeed/init.php b/plugins/example_vfeed/init.php new file mode 100644 index 000000000..e646809a4 --- /dev/null +++ b/plugins/example_vfeed/init.php @@ -0,0 +1,49 @@ +<?php +class Example_VFeed extends Plugin { + + // Demonstrates how to create a dummy special feed and chain + // headline generation to queryFeedHeadlines(); + + // Not implemented yet: stuff for 3 panel mode + + private $link; + private $host; + private $dummy_id; + + function about() { + return array(1.0, + "Example vfeed plugin", + "fox", + false); + } + + function init($host) { + $this->link = $host->get_link(); + $this->host = $host; + + $this->dummy_id = $host->add_feed(-1, 'Dummy feed', 'images/pub_set.svg', $this); + } + + function get_unread($feed_id) { + return 1234; + } + + function get_headlines($feed_id, $options) { + $qfh_ret = queryFeedHeadlines($this->link, -4, + $options['limit'], + $options['view_mode'], $options['cat_view'], + $options['search'], + $options['search_mode'], + $options['override_order'], + $options['offset'], + $options['owner_uid'], + $options['filter'], + $options['since_id'], + $options['include_children']); + + $qfh_ret[1] = 'Dummy feed'; + + return $qfh_ret; + } +} +?> diff --git a/plugins/flattr/flattr.png b/plugins/flattr/flattr.png Binary files differdeleted file mode 100644 index 4933ffc21..000000000 --- a/plugins/flattr/flattr.png +++ /dev/null diff --git a/plugins/flattr/init.php b/plugins/flattr/init.php deleted file mode 100644 index b91019880..000000000 --- a/plugins/flattr/init.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -class Flattr extends Plugin { - private $link; - private $host; - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function about() { - return array(1.1, - "Share articles on Flattr (if they exist in their catalogue)", - "F. Eitel, N. Honing"); - } - - function hook_article_button($line) { - - $rv = ""; - $article_link = $line['link']; - - 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); - $image = "<img src=\"plugins/flattr/flattr.png\" - class='tagsPic' style=\"cursor : pointer\" - title='".__('Flattr this article.')."'>"; - // if Flattr has it in the catalogue, we display the button - if ($response and array_key_exists('link', $response)) { - $rv = "<a id='flattr' target='_blank' href='" . $response['link'] . "'> . $image . </a>"; - } else { - // We can't submit a thing to the catalogue without giving a Flattr user id (who would be the owner) - // see http://developers.flattr.net/auto-submit - //$rv = "<a id='flattr' href='https://flattr.com/submit/auto?url=" . $encoded . "'>" . $image . "</a>"; - $rv = ''; - // Another useful thing would be any rel=payment link (which would have the user id as well), - // but tt-rss is not checking that (yet), I believe. See http://developers.flattr.net/feed - } - } - return $rv; - } -} -?> diff --git a/plugins/googleplus/googleplus.js b/plugins/googleplus/googleplus.js deleted file mode 100644 index 027d9b40e..000000000 --- a/plugins/googleplus/googleplus.js +++ /dev/null @@ -1,29 +0,0 @@ - function shareArticleToGooglePlus(id) { - try { - var query = "?op=pluginhandler&plugin=googleplus&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=500,height=450,scrollbars=1,menubar=0"); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - var ti = JSON.parse(transport.responseText); - - var share_url = "https://plus.google.com/share?url=" + param_escape(ti.link); - - w.location.href = share_url; - - } }); - - - } catch (e) { - exception_error("tweetArticle", e); - } - } - diff --git a/plugins/googleplus/googleplus.png b/plugins/googleplus/googleplus.png Binary files differdeleted file mode 100644 index ac46126d7..000000000 --- a/plugins/googleplus/googleplus.png +++ /dev/null diff --git a/plugins/googleplus/init.php b/plugins/googleplus/init.php deleted file mode 100644 index 6045d2df6..000000000 --- a/plugins/googleplus/init.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -class GooglePlus extends Plugin { - private $link; - private $host; - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function about() { - return array(1.0, - "Share article on Google+", - "homolibere"); - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/googleplus.js"); - } - - function hook_article_button($line) { - $article_id = $line["id"]; - - $rv = "<img src=\"plugins/googleplus/googleplus.png\" - class='tagsPic' style=\"cursor : pointer\" - onclick=\"shareArticleToGooglePlus($article_id)\" - title='".__('Share on Google+')."'>"; - - return $rv; - } - - function getInfo() { - $id = db_escape_string($this->link, $_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.js b/plugins/identica/identica.js deleted file mode 100644 index d31fc55f4..000000000 --- a/plugins/identica/identica.js +++ /dev/null @@ -1,31 +0,0 @@ - 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.png b/plugins/identica/identica.png Binary files differdeleted file mode 100644 index ee3cb61ea..000000000 --- a/plugins/identica/identica.png +++ /dev/null diff --git a/plugins/identica/init.php b/plugins/identica/init.php deleted file mode 100644 index 8e0ad4b9a..000000000 --- a/plugins/identica/init.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -class Identica extends Plugin { - private $link; - private $host; - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function about() { - return array(1.0, - "Share articles on Identi.ca", - "fox"); - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/identica.js"); - } - - function hook_article_button($line) { - $article_id = $line["id"]; - - $rv = "<img src=\"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($this->link, $_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/owncloud/init.php b/plugins/owncloud/init.php deleted file mode 100644 index 5d215b386..000000000 --- a/plugins/owncloud/init.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php -require_once "config.php"; - -class OwnCloud extends Plugin { - private $link; - private $host; - - function about() { - return array(1.0, - "Adds support for OwnCloud ReadLater", - "cy8aer"); - } - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - $host->add_hook($host::HOOK_PREFS_TAB, $this); - } - - function save() { - $owncloud_url = db_escape_string($this->link, $_POST["owncloud_url"]); - $this->host->set($this, "owncloud", $owncloud_url); - echo "Value set to $owncloud_url"; - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/owncloud.js"); - } - - function hook_prefs_tab($args) { - if ($args != "prefPrefs") return; - - print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("Owncloud")."\">"; - - print "<br/>"; - - $value = $this->host->get($this, "owncloud"); - print "<form dojoType=\"dijit.form.Form\">"; - - print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\"> - evt.preventDefault(); - if (this.validate()) { - console.log(dojo.objectToQuery(this.getValues())); - new Ajax.Request('backend.php', { - parameters: dojo.objectToQuery(this.getValues()), - onComplete: function(transport) { - notify_info(transport.responseText); - } - }); - } - </script>"; - - print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">"; - print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">"; - print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"owncloud\">"; - print "<table width=\"100%\" class=\"prefPrefsList\">"; - print "<tr><td width=\"40%\">".__("Owncloud url")."</td>"; - print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"owncloud_url\" regExp='^(http|https)://.*' value=\"$value\"></td></tr>"; - print "</table>"; - print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".__("Save")."</button>"; - - print "</form>"; - - print "</div>"; #pane - - } - - function hook_article_button($line) { - return "<img src=\"plugins/owncloud/owncloud.png\" - style=\"cursor : pointer\" style=\"cursor : pointer\" - onclick=\"ownArticle(".$line["id"].")\" - class='tagsPic' title='".__('Bookmark on OwnCloud ')."'>"; - } - - function getOwnCloud() { - $id = db_escape_string($this->link, $_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'); - } - - $own_url = $this->host->get($this, "owncloud"); - - print json_encode(array("title" => $title, "link" => $article_link, - "id" => $id, "ownurl" => $own_url)); - } -} -?> diff --git a/plugins/owncloud/owncloud.js b/plugins/owncloud/owncloud.js deleted file mode 100644 index df929e015..000000000 --- a/plugins/owncloud/owncloud.js +++ /dev/null @@ -1,27 +0,0 @@ -function ownArticle(id) { - try { - var query = "?op=pluginhandler&plugin=owncloud&method=getOwnCloud&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 = ti.ownurl + "/apps/bookmarks/addBm.php?output=popup&url=" + param_escape(ti.link) - + '&title=' + ti.title; - - w.location.href = share_url; - } }); - } catch (e) { - exception_error("ownArticle", e); - } -} - diff --git a/plugins/owncloud/owncloud.png b/plugins/owncloud/owncloud.png Binary files differdeleted file mode 100644 index d31ba924b..000000000 --- a/plugins/owncloud/owncloud.png +++ /dev/null diff --git a/plugins/pinterest/init.php b/plugins/pinterest/init.php deleted file mode 100644 index 11fe64eb5..000000000 --- a/plugins/pinterest/init.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -class Pinterest extends Plugin { - private $link; - private $host; - - function about() { - return array(1.0, - "Share article on Pinterest", - "?"); - } - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/pinterest.js"); - } - - function hook_article_button($line) { - $article_id = $line["id"]; - - $rv = "<img src=\"plugins/pinterest/pinterest.png\" - class='tagsPic' style=\"cursor : pointer\" - onclick=\"pinterest($article_id)\" - title='".__('Pinterest')."'>"; - - return $rv; - } - - function getInfo() { - $id = db_escape_string($this->link, $_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/pinterest/pinterest.js b/plugins/pinterest/pinterest.js deleted file mode 100644 index 01c525f55..000000000 --- a/plugins/pinterest/pinterest.js +++ /dev/null @@ -1,31 +0,0 @@ - function pinterest(id) { - try { - var query = "?op=pluginhandler&plugin=pinterest&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=650,height=600,scrollbars=1,menubar=0"); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - var ti = JSON.parse(transport.responseText); - - var share_url = "http://pinterest.com/pin/create/button/?" + - "url=" + param_escape(ti.link) + - "&description=" + param_escape(ti.title); - - w.location.href = share_url; - - } }); - - - } catch (e) { - exception_error("tweetArticle", e); - } - } - diff --git a/plugins/pinterest/pinterest.png b/plugins/pinterest/pinterest.png Binary files differdeleted file mode 100644 index b85aed3cd..000000000 --- a/plugins/pinterest/pinterest.png +++ /dev/null diff --git a/plugins/pocket/init.php b/plugins/pocket/init.php deleted file mode 100644 index e96d08001..000000000 --- a/plugins/pocket/init.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -class Pocket extends Plugin { - - private $link; - private $host; - - function about() { - return array(1.0, - "Share article on Pocket (formerly Read It Later)", - "?"); - } - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/pocket.js"); - } - - function hook_article_button($line) { - $article_id = $line["id"]; - - $rv = "<img src=\"plugins/pocket/pocket.png\" - class='tagsPic' style=\"cursor : pointer\" - onclick=\"shareArticleToPocket($article_id)\" - title='".__('Pocket')."'>"; - - return $rv; - } - - function getInfo() { - $id = db_escape_string($this->link, $_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/pocket/pocket.js b/plugins/pocket/pocket.js deleted file mode 100644 index 021d5bb05..000000000 --- a/plugins/pocket/pocket.js +++ /dev/null @@ -1,31 +0,0 @@ - function shareArticleToPocket(id) { - try { - var query = "?op=pluginhandler&plugin=pocket&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=500,height=400,scrollbars=1,menubar=0"); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - var ti = JSON.parse(transport.responseText); - - var share_url = "https://getpocket.com/save?" + - "&title=" + param_escape(ti.title) + - "&url=" + param_escape(ti.link); - - w.location.href = share_url; - - } }); - - - } catch (e) { - exception_error("tweetArticle", e); - } - } - diff --git a/plugins/pocket/pocket.png b/plugins/pocket/pocket.png Binary files differdeleted file mode 100644 index ff6bc85a4..000000000 --- a/plugins/pocket/pocket.png +++ /dev/null diff --git a/plugins/tweet/init.php b/plugins/tweet/init.php deleted file mode 100644 index bbcf7836c..000000000 --- a/plugins/tweet/init.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -class Tweet extends Plugin { - private $link; - private $host; - - function init($host) { - $this->link = $host->get_link(); - $this->host = $host; - - $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); - } - - function about() { - return array(1.0, - "Share article on Twitter", - "fox"); - } - - function get_js() { - return file_get_contents(dirname(__FILE__) . "/tweet.js"); - } - - function hook_article_button($line) { - $article_id = $line["id"]; - - $rv = "<img src=\"plugins/tweet/tweet.png\" - class='tagsPic' style=\"cursor : pointer\" - onclick=\"tweetArticle($article_id)\" - title='".__('Share on Twitter')."'>"; - - return $rv; - } - - function getInfo() { - $id = db_escape_string($this->link, $_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/tweet/tweet.js b/plugins/tweet/tweet.js deleted file mode 100644 index 07e89d5f8..000000000 --- a/plugins/tweet/tweet.js +++ /dev/null @@ -1,31 +0,0 @@ - function tweetArticle(id) { - try { - var query = "?op=pluginhandler&plugin=tweet&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=500,height=400,scrollbars=1,menubar=0"); - - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - var ti = JSON.parse(transport.responseText); - - var share_url = "http://twitter.com/share?_=" + ts + - "&text=" + param_escape(ti.title) + - "&url=" + param_escape(ti.link); - - w.location.href = share_url; - - } }); - - - } catch (e) { - exception_error("tweetArticle", e); - } - } - diff --git a/plugins/tweet/tweet.png b/plugins/tweet/tweet.png Binary files differdeleted file mode 100644 index ad3c177a2..000000000 --- a/plugins/tweet/tweet.png +++ /dev/null |