diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-01 22:35:19 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-01 22:35:19 +0000 |
commit | 17192a2f51507300ebc499b78aa010e9d38fb4f1 (patch) | |
tree | 37a6eb28a96ab548cc986687be6f92fd24c9e714 /engine/lib | |
parent | fc8dedf9ded76a366ec8da24c9254a6517b33b3d (diff) | |
download | elgg-17192a2f51507300ebc499b78aa010e9d38fb4f1.tar.gz elgg-17192a2f51507300ebc499b78aa010e9d38fb4f1.tar.bz2 |
Fixes #1457. Added optional status param for get_installed_plugins()
git-svn-id: http://code.elgg.org/elgg/trunk@7488 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/plugins.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index 258a48fb5..7624b1768 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -276,7 +276,7 @@ function load_plugin_manifest($plugin) { $xml_file = get_config('pluginspath') . "$plugin/manifest.xml"; try { - $manifest = new ElggPluginManifest($xml_file); + $manifest = new ElggPluginManifest($xml_file, $plugin); } catch(Exception $e) { return false; } @@ -579,9 +579,10 @@ function clear_all_plugin_settings($plugin_name = "") { /** * Return an array of installed plugins. * + * @param string $status any|enabled|disabled * @return array */ -function get_installed_plugins() { +function get_installed_plugins($status = 'any') { global $CONFIG; $installed_plugins = array(); @@ -594,8 +595,29 @@ function get_installed_plugins() { if (!$manifest = load_plugin_manifest($mod)) { continue; } + + $enabled = is_plugin_enabled($mod); + + switch ($status) { + case 'enabled': + if ($enabled != true) { + continue 2; + } + break; + + case 'disabled': + if ($enabled == true) { + continue 2; + } + break; + + case 'any': + default: + break; + } + $installed_plugins[$mod] = array(); - $installed_plugins[$mod]['active'] = is_plugin_enabled($mod); + $installed_plugins[$mod]['active'] = $enabled; $installed_plugins[$mod]['manifest'] = $manifest; } } |