From: Andrew Dolgov Date: Mon, 24 Dec 2012 11:39:42 +0000 (+0400) Subject: add -list-plugins option; about sections to plugins X-Git-Tag: 1.7.0~136 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7a866114e1236da92c0a35c9441903640a6bdf63;p=tt-rss.git add -list-plugins option; about sections to plugins --- diff --git a/classes/pluginhost.php b/classes/pluginhost.php index c55667e1..a637a521 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -65,6 +65,10 @@ class PluginHost { return array(); } } + function load_all() { + $plugins = array_map("basename", glob("plugins/*")); + $this->load(join(",", $plugins)); + } function load($classlist) { $plugins = explode(",", $classlist); diff --git a/plugins/digest/digest.php b/plugins/digest/digest.php index 5535c322..d0cbd5b0 100644 --- a/plugins/digest/digest.php +++ b/plugins/digest/digest.php @@ -4,6 +4,12 @@ class Digest extends Plugin implements IHandler { private $link; private $host; + function _about() { + return array(1.0, + "Digest mode for tt-rss (tablet friendly UI)", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/example/example.php b/plugins/example/example.php index e49ee5f2..42550b17 100644 --- a/plugins/example/example.php +++ b/plugins/example/example.php @@ -6,6 +6,12 @@ class Example extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Example plugin #1", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/example_feed/example_feed.php b/plugins/example_feed/example_feed.php index 26f392bd..205594ed 100644 --- a/plugins/example_feed/example_feed.php +++ b/plugins/example_feed/example_feed.php @@ -7,6 +7,12 @@ class Example_Feed extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Example feed plugin", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/example_routing/example_routing.php b/plugins/example_routing/example_routing.php index c8d352ac..024bf5b2 100644 --- a/plugins/example_routing/example_routing.php +++ b/plugins/example_routing/example_routing.php @@ -15,6 +15,12 @@ class Example_Routing extends Plugin implements IHandler { private $link; private $host; + function _about() { + return array(1.0, + "Example routing plugin", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/flattr/flattr.php b/plugins/flattr/flattr.php index 3bc42721..e5042632 100644 --- a/plugins/flattr/flattr.php +++ b/plugins/flattr/flattr.php @@ -10,6 +10,12 @@ class Flattr extends Plugin { $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); } + function _about() { + return array(1.0, + "Share on Flattr plugin", + "Nic Honing"); + } + function hook_article_button($line) { $article_id = $line["id"]; diff --git a/plugins/googleplus/googleplus.php b/plugins/googleplus/googleplus.php index 9505b409..a100573d 100644 --- a/plugins/googleplus/googleplus.php +++ b/plugins/googleplus/googleplus.php @@ -10,6 +10,12 @@ class GooglePlus extends Plugin { $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); } + function _about() { + return array(1.0, + "Share on Google+ plugin", + "homolibere"); + } + function get_js() { return file_get_contents(dirname(__FILE__) . "/googleplus.js"); } diff --git a/plugins/identica/identica.php b/plugins/identica/identica.php index 5b7d4b3f..67ca6ae2 100644 --- a/plugins/identica/identica.php +++ b/plugins/identica/identica.php @@ -10,6 +10,12 @@ class Identica extends Plugin { $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); } + function _about() { + return array(1.0, + "Share on Identi.ca", + "fox"); + } + function get_js() { return file_get_contents(dirname(__FILE__) . "/identica.js"); } diff --git a/plugins/import_export/import_export.php b/plugins/import_export/import_export.php index 7a843c45..68597978 100644 --- a/plugins/import_export/import_export.php +++ b/plugins/import_export/import_export.php @@ -12,6 +12,12 @@ class Import_Export extends Plugin implements IHandler { $host->add_command("xml-import", "USER FILE: import articles from XML", $this); } + function _about() { + return array(1.0, + "Imports and exports user data using a neutral XML format", + "fox"); + } + function xml_import($args) { array_shift($args); diff --git a/plugins/instances/instances.php b/plugins/instances/instances.php index f95d511f..c6a5531c 100644 --- a/plugins/instances/instances.php +++ b/plugins/instances/instances.php @@ -10,6 +10,12 @@ class Instances extends Plugin implements IHandler { 2 => "Invalid object received", 16 => "Access denied" ); + function _about() { + return array(1.0, + "Support for linking tt-rss instances together and sharing popular feeds.", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/mail/mail.php b/plugins/mail/mail.php index c9b6ed54..648148cd 100644 --- a/plugins/mail/mail.php +++ b/plugins/mail/mail.php @@ -4,6 +4,12 @@ class Mail extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Adds a share article via email button", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/note/note.php b/plugins/note/note.php index ebb0b5a2..c6c1ef90 100644 --- a/plugins/note/note.php +++ b/plugins/note/note.php @@ -3,6 +3,12 @@ class Note extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Adds support for setting article notes", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/pinterest/pinterest.php b/plugins/pinterest/pinterest.php index d50691ba..c4254917 100644 --- a/plugins/pinterest/pinterest.php +++ b/plugins/pinterest/pinterest.php @@ -3,6 +3,12 @@ class Pinterest extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Share article via Pinterest", + "?"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/pocket/pocket.php b/plugins/pocket/pocket.php index 6449b891..6b5ccdde 100644 --- a/plugins/pocket/pocket.php +++ b/plugins/pocket/pocket.php @@ -4,6 +4,12 @@ class Pocket extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Share article via Pocket (formerly Read It Later)", + "?"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/redditimgur/redditimgur.php b/plugins/redditimgur/redditimgur.php index 0255dd71..59bb4d15 100644 --- a/plugins/redditimgur/redditimgur.php +++ b/plugins/redditimgur/redditimgur.php @@ -4,6 +4,12 @@ class RedditImgur extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Inline image links in Reddit RSS feeds", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/share/share.php b/plugins/share/share.php index 3c7d7943..254b68bc 100644 --- a/plugins/share/share.php +++ b/plugins/share/share.php @@ -3,6 +3,12 @@ class Share extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Share article by unique URL", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/plugins/updater/updater.php b/plugins/updater/updater.php index 0aee1ba7..c85ef328 100644 --- a/plugins/updater/updater.php +++ b/plugins/updater/updater.php @@ -4,6 +4,12 @@ class Updater extends Plugin { private $link; private $host; + function _about() { + return array(1.0, + "Updates tt-rss installation to latest version.", + "fox"); + } + function __construct($host) { $this->link = $host->get_link(); $this->host = $host; diff --git a/update.php b/update.php index 0da46647..7bf6807f 100755 --- a/update.php +++ b/update.php @@ -22,7 +22,6 @@ init_connection($link); - $op = $argv; if (count($argv) == 0 && !defined('STDIN')) { @@ -55,6 +54,7 @@ print " -indexes - recreate missing schema indexes\n"; print " -convert-filters - convert type1 filters to type2\n"; print " -force-update - force update of all feeds\n"; + print " -list-plugins - list all available plugins\n"; print " -help - show this help\n"; print "Plugin options:\n"; @@ -258,6 +258,17 @@ last_updated = '1970-01-01'"); } + if (in_array("-list-plugins", $op)) { + $tmppluginhost = new PluginHost($link); + $tmppluginhost->load_all(); + foreach ($tmppluginhost->get_plugins() as $name => $plugin) { + $about = $plugin->_about(); + + printf("%-60s - v%.2f (by %s)\n%s\n\n", + $name, $about[0], $about[2], $about[1]); + } + } + $pluginhost->run_commands($op); db_close($link);