]> git.wh0rd.org Git - tt-rss.git/commitdiff
add -list-plugins option; about sections to plugins
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 24 Dec 2012 11:39:42 +0000 (15:39 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 24 Dec 2012 11:39:42 +0000 (15:39 +0400)
18 files changed:
classes/pluginhost.php
plugins/digest/digest.php
plugins/example/example.php
plugins/example_feed/example_feed.php
plugins/example_routing/example_routing.php
plugins/flattr/flattr.php
plugins/googleplus/googleplus.php
plugins/identica/identica.php
plugins/import_export/import_export.php
plugins/instances/instances.php
plugins/mail/mail.php
plugins/note/note.php
plugins/pinterest/pinterest.php
plugins/pocket/pocket.php
plugins/redditimgur/redditimgur.php
plugins/share/share.php
plugins/updater/updater.php
update.php

index c55667e1268345f73efa00c01f11080d2a4c9e11..a637a52169773a0ffa520450168bb2179a055f04 100644 (file)
@@ -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);
index 5535c3222b4d841f984e307103fe5f3bd3b4cbe3..d0cbd5b0f9490df16f26dcc6e529c3ded71de3cd 100644 (file)
@@ -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;
index e49ee5f27e14afcbf2cb41175d11974cb2a56c28..42550b1713d0091268f4328d6cd57b34c9b49a44 100644 (file)
@@ -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;
index 26f392bd78ff1bf4df9da73499fab9dac647c547..205594edd5ce4eada71dfc1f0e49735e861584ec 100644 (file)
@@ -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;
index c8d352ac80dcaa8003df3df0f90bd04b99ee0ce5..024bf5b222e4e35f7c385950dbf96cf8a6fc1767 100644 (file)
@@ -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;
index 3bc42721156f871a0c57398ec1842aa0ece9fdfc..e5042632c6481c20e10ea775dd0f2c3f26521a34 100644 (file)
@@ -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"];
index 9505b409612f50da19af4316c64649f582ade155..a100573de1fc4694685194e2f6a0853cf2a414c4 100644 (file)
@@ -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");
        }
index 5b7d4b3f6571902f239f4956e09b90ae8572d0cf..67ca6ae2c61394e0a6a6d69917ee56a5a3b7a851 100644 (file)
@@ -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");
        }
index 7a843c45bab4bb76dcb0121273983779af5e422c..68597978b1fd648cfda1e82bf91cd34bfd5b2098 100644 (file)
@@ -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);
 
index f95d511ffc4ce5d866e7b47cea7b35c3445ff49f..c6a5531cd6858e9917e7a96f690b778ef14236c2 100644 (file)
@@ -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;
index c9b6ed541c0150806acb715942bec4fecba01c19..648148cd3f28c3a52b28b2482f1ed7ff6c684ea4 100644 (file)
@@ -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;
index ebb0b5a25be5f069f090fcc7464c2d04fcd95f69..c6c1ef903fac1596e855b493e906ff809dcdf8a7 100644 (file)
@@ -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;
index d50691baf4bf156f116f01e9fc847fd97a735b96..c4254917023dde20cb6c4c9471ce42f3d30b88e7 100644 (file)
@@ -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;
index 6449b891dcb6fac81f391641f200960b83a2c356..6b5ccddecf05bdf7724895f2595548ff5cfd9cae 100644 (file)
@@ -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;
index 0255dd71b6b8bb176265a97589b557156c208b6a..59bb4d15dd6155b15a7ca3f47289c479732ab86d 100644 (file)
@@ -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;
index 3c7d7943b6fa6f17a544b299a92ac20d136dca47..254b68bca61a71399212db87a450efe5a752420b 100644 (file)
@@ -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;
index 0aee1ba79835cefd52db03975da268be10a341bb..c85ef32807b792511e5ebac0f55bed875678d011 100644 (file)
@@ -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;
index 0da46647a19d4a1b454121cc73462cc8e7b53d88..7bf6807ffb4b2145a59a32d3c92125e8d96f4b46 100755 (executable)
@@ -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";
 
                                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);