From 17192a2f51507300ebc499b78aa010e9d38fb4f1 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 1 Dec 2010 22:35:19 +0000 Subject: 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 --- engine/lib/plugins.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'engine/lib') 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; } } -- cgit v1.2.3