From 537bf91a71bcd2a9e8b632a1d863c03621a8281b Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 7 Jan 2011 21:17:59 +0000 Subject: Refs #2782: Fixed WSOD for invalid plugins on admin screen. Needs better CSS, but holding off until admin area CSS revamp. git-svn-id: http://code.elgg.org/elgg/trunk@7857 36083f99-b078-4883-b0ff-0f9b5a30f544 --- languages/en.php | 1 + views/default/admin/components/invalid_plugin.php | 23 +++++++++++++++++++++++ views/default/admin/components/plugin.php | 4 ++-- views/default/admin/plugins/advanced.php | 10 +++++++--- 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 views/default/admin/components/invalid_plugin.php diff --git a/languages/en.php b/languages/en.php index 10a99f9d3..1219a3de5 100644 --- a/languages/en.php +++ b/languages/en.php @@ -559,6 +559,7 @@ $english = array( 'admin:plugins:warning:elgg_version_unknown' => 'This plugin uses a legacy manifest file and does not specify a compatible Elgg version. It probably will not work!', 'admin:plugins:warning:unmet_dependencies' => 'This plugin has unmet dependencies and cannot be activated. Check dependencies under more info.', + 'admin:plugins:warning:invalid' => '%s is not a valid Elgg plugin. Check http://docs.elgg.org/Invalid_Plugin for more information.', 'admin:plugins:cannot_activate' => 'Cannot Activate', 'admin:plugins:set_priority:yes' => "Reordered %s.", diff --git a/views/default/admin/components/invalid_plugin.php b/views/default/admin/components/invalid_plugin.php new file mode 100644 index 000000000..91c073fac --- /dev/null +++ b/views/default/admin/components/invalid_plugin.php @@ -0,0 +1,23 @@ +getID(); +$path = htmlspecialchars($plugin->getPath()); +$message = elgg_echo('admin:plugins:warning:invalid', array($id)); + +?> + +
+

+

+
diff --git a/views/default/admin/components/plugin.php b/views/default/admin/components/plugin.php index d190e94a5..a64fa7216 100644 --- a/views/default/admin/components/plugin.php +++ b/views/default/admin/components/plugin.php @@ -1,6 +1,6 @@ getPriority(); $active = $plugin->isActive(); + $name = $plugin->manifest->getName(); $can_activate = $plugin->canActivate(); $max_priority = elgg_get_max_plugin_priority(); @@ -108,7 +109,6 @@ if ($can_activate) { } // Display categories -$categories = $plugin->manifest->getCategories(); $categories_html = ''; if ($categories) { $categories_arr = array(); diff --git a/views/default/admin/plugins/advanced.php b/views/default/admin/plugins/advanced.php index 1138ace4f..1a308df73 100644 --- a/views/default/admin/plugins/advanced.php +++ b/views/default/admin/plugins/advanced.php @@ -18,6 +18,10 @@ $show_category = get_input('category', null); $categories = array(); foreach ($installed_plugins as $plugin) { + if (!$plugin->isValid()) { + continue; + } + $plugin_categories = $plugin->manifest->getCategories(); // handle plugins that don't declare categories @@ -82,9 +86,9 @@ $buttons .= $category_form; // Display list of plugins foreach ($installed_plugins as $plugin) { - echo elgg_view('admin/components/plugin', array( - 'plugin' => $plugin, - 'max_priority' => $max_priority + $view = ($plugin->isValid()) ? 'admin/components/plugin' : 'admin/components/invalid_plugin'; + echo elgg_view($view, array( + 'plugin' => $plugin )); } ?> -- cgit v1.2.3