From fcf9dcf201ed1088b84c38236d43d5d4f1c2e2e3 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 28 May 2010 23:14:07 +0000 Subject: Refs #2115: Added elgg_is_valid_view_type(). Currently calculated at each load but will want to cache like view paths. Cleaned up autoregister_views() and load_plugins() code. Added spaces between function params in numerous places. C'mon guys...spaces are free. git-svn-id: http://code.elgg.org/elgg/trunk@6274 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/plugins.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'engine/lib/plugins.php') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index b365585c8..b8cf5c2d2 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -239,11 +239,18 @@ function load_plugins() { } if (!$cached_view_paths) { - if (is_dir($CONFIG->pluginspath . $mod . "/views")) { - if ($handle = opendir($CONFIG->pluginspath . $mod . "/views")) { - while ($viewtype = readdir($handle)) { - if (!in_array($viewtype,array('.','..','.svn','CVS')) && is_dir($CONFIG->pluginspath . $mod . "/views/" . $viewtype)) { - autoregister_views("",$CONFIG->pluginspath . $mod . "/views/" . $viewtype,$CONFIG->pluginspath . $mod . "/views/", $viewtype); + $view_dir = $CONFIG->pluginspath . $mod . '/views/'; + + if (is_dir($view_dir) && ($handle = opendir($view_dir))) { + while (FALSE !== ($view_type = readdir($handle))) { + $view_type_dir = $view_dir . $view_type; + + if ('.' !== substr($view_type, 0, 1) && is_dir($view_type_dir)) { + if (autoregister_views('', $view_type_dir, $view_dir, $view_type)) { + // add the valid view type. + if (!in_array($view_type, $CONFIG->view_types)) { + $CONFIG->view_types[] = $view_type; + } } } } -- cgit v1.2.3