From de612e7a3850d3053c7038e94098c0681d46983b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 25 Dec 2012 00:45:10 +0400 Subject: experimental support for per-user plugins (bump schema) --- classes/pref/feeds.php | 2 +- classes/pref/prefs.php | 131 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 1 deletion(-) (limited to 'classes/pref') diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 447aa8947..b28bd5491 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1480,11 +1480,11 @@ class Pref_Feeds extends Handler_Protected { print ""; #pane global $pluginhost; + $pluginhost->run_hooks($pluginhost::HOOK_PREFS_TAB, "hook_prefs_tab", "prefFeeds"); print ""; #container - } private function feedlist_init_cat($cat_id, $hidden = false) { diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index db7a3e04f..bb1b44ece 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -621,8 +621,133 @@ class Pref_Prefs extends Handler_Protected { "; + print ""; print ''; # inner pane print ''; # border container + + print ""; #pane + + print "
"; + + print "

".__("Plugins")."

"; + + print_notice("You will need to reload Tiny Tiny RSS for plugin changes to take effect."); + + print "
"; + + print ""; + + print ""; + print ""; + + print ""; + + print ""; + + print " + + + + + "; + + $system_enabled = array_map("trim", explode(",", PLUGINS)); + $user_enabled = array_map("trim", explode(",", get_pref($this->link, "_ENABLED_PLUGINS"))); + + $tmppluginhost = new PluginHost($link); + $tmppluginhost->load_all(); + + foreach ($tmppluginhost->get_plugins() as $name => $plugin) { + $about = $plugin->_about(); + + if ($about[3]) { + if (in_array($name, $system_enabled)) { + $checked = "checked='1'"; + } else { + $checked = ""; + } + + print ""; + + print ""; + + print ""; + print ""; + print ""; + print ""; + + print ""; + + } + } + + print ""; + + print " + + + + + "; + + + foreach ($tmppluginhost->get_plugins() as $name => $plugin) { + $about = $plugin->_about(); + + if (!$about[3]) { + + if (in_array($name, $system_enabled)) { + $checked = "checked='1'"; + $disabled = "disabled='1'"; + } else if (in_array($name, $user_enabled)) { + $checked = "checked='1'"; + $disabled = ""; + } else { + $checked = ""; + $disabled = ""; + } + + print ""; + + print ""; + + print ""; + print ""; + print ""; + print ""; + + print ""; + + + + } + + } + + print "

".__("System plugins")."

 ".__('Plugin')."".__('Description')."".__('Version')."".__('Author')."
$name" . htmlspecialchars($about[1]) . "" . htmlspecialchars(sprintf("%.2f", $about[0])) . "" . htmlspecialchars($about[2]) . "

".__("User plugins")."

 ".__('Plugin')."".__('Description')."".__('Version')."".__('Author')."
$name" . htmlspecialchars($about[1]) . "" . htmlspecialchars(sprintf("%.2f", $about[0])) . "" . htmlspecialchars($about[2]) . "
"; + + print "

"; + print "
"; print "
"; #pane @@ -698,5 +823,11 @@ class Pref_Prefs extends Handler_Protected { } } + + function setplugins() { + $plugins = join(",", $_REQUEST["plugins"]); + + set_pref($this->link, "_ENABLED_PLUGINS", $plugins); + } } ?> -- cgit v1.2.3