diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-12 14:25:51 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-12 14:25:51 +0000 |
commit | 0ff815358cae570c3ccc3cb4306f9775c443ecc7 (patch) | |
tree | 623819ba7725fc0ef68a32b07fc7bad37e47674c /admin | |
parent | f598526d2b661b220e50c6c7f1793ebbb2a402ca (diff) | |
download | elgg-0ff815358cae570c3ccc3cb4306f9775c443ecc7.tar.gz elgg-0ff815358cae570c3ccc3cb4306f9775c443ecc7.tar.bz2 |
Missed this file when committing categories for plugins.
git-svn-id: http://code.elgg.org/elgg/trunk@5697 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'admin')
-rw-r--r-- | admin/plugins.php | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/admin/plugins.php b/admin/plugins.php index 55035830a..39478f153 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -9,17 +9,40 @@ * @link http://elgg.org/ */ -// Get the Elgg framework require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); - -// Make sure only valid admin users can see this admin_gatekeeper(); - -// Regenerate plugin list regenerate_plugin_list(); +$show_category = get_input('category', NULL); + +// Get a list of the all categories +// and trim down the plugin list if we're not viewing all categories. +// @todo this could be cached somewhere after have the manifest loaded +$categories = array(); +$installed_plugins = get_installed_plugins(); + +foreach ($installed_plugins as $i => $plugin) { + $plugin_categories = $plugin['manifest']['category']; + + // handle plugins that don't declare categories + if ((!$plugin_categories && $show_category) || ($show_category && !in_array($show_category, $plugin_categories))) { + unset($installed_plugins[$i]); + } + + foreach ($plugin_categories as $category) { + if (!array_key_exists($category, $categories)) { + $categories[$category] = elgg_echo("admin:plugins:label:moreinfo:categories:$category"); + } + } +} + // Display main admin menu -$vars = array('installed_plugins' => get_installed_plugins()); +$vars = array( + 'installed_plugins' => $installed_plugins, + 'categories' => $categories, + 'show_category' => $show_category +); + $main_box = elgg_view("admin/plugins", $vars); $content = elgg_view_layout("one_column_with_sidebar", $main_box); |