add -list-plugins option; about sections to plugins
This commit is contained in:
parent
6b31c9f2fb
commit
7a866114e1
18 changed files with 112 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"];
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
13
update.php
13
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);
|
||||
|
|
Loading…
Reference in a new issue