summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/statusnet.php23
-rw-r--r--lib/util.php6
2 files changed, 24 insertions, 5 deletions
diff --git a/lib/statusnet.php b/lib/statusnet.php
index ff0502915..f8bf87960 100644
--- a/lib/statusnet.php
+++ b/lib/statusnet.php
@@ -169,22 +169,33 @@ class StatusNet
return $sites;
}
+ /**
+ * Return a list of plugins
+ */
+ public static function getPlugins() {
+ // Default plugins
+ $pluginlist = common_config('plugins', 'default');
+ // Enabled plugins
+ $enabled=common_config_section('plugin-list');
+ if ($enabled) {
+ $pluginlist = array_merge($pluginlist,$enabled);
+ }
+ return $pluginlist;
+ }
/**
* Fire initialization events for all instantiated plugins.
*/
protected static function initPlugins()
{
- // Load default plugins
- foreach (common_config('plugins', 'default') as $name => $params) {
+ // Load plugins
+ foreach (self::getPlugins() as $name => $params) {
$key = 'disable-' . $name;
if (common_config('plugins', $key)) {
continue;
}
- if (is_null($params)) {
- addPlugin($name);
- } else if (is_array($params)) {
+ if (is_array($params)) {
if (count($params) == 0) {
addPlugin($name);
} else {
@@ -197,6 +208,8 @@ class StatusNet
}
}
}
+ } else {
+ addPlugin($name);
}
}
diff --git a/lib/util.php b/lib/util.php
index f187926b5..a9ed91870 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1650,6 +1650,12 @@ function common_config($main, $sub)
array_key_exists($sub, $config[$main])) ? $config[$main][$sub] : false;
}
+function common_config_section($main)
+{
+ global $config;
+ return array_key_exists($main, $config) ? $config[$main] : false;
+}
+
function common_copy_args($from)
{
$to = array();