aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 0f15e3092..2aabe5c36 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -120,6 +120,28 @@
return $viewtype;
}
+
+ /**
+ * Return the location of a given view.
+ *
+ * @param string $view The view.
+ */
+ function elgg_get_view_location($view)
+ {
+ global $CONFIG;
+
+ if (!isset($CONFIG->views->locations[$view])) {
+ if (!isset($CONFIG->viewpath)) {
+ return dirname(dirname(dirname(__FILE__))) . "/views/";
+ } else {
+ return $CONFIG->viewpath;
+ }
+ } else {
+ return $CONFIG->views->locations[$view];
+ }
+
+ return false;
+ }
/**
* Handles templating views
@@ -192,16 +214,8 @@
// Start the output buffer, find the requested view file, and execute it
ob_start();
foreach($viewlist as $priority => $view) {
-
- if (!isset($CONFIG->views->locations[$view])) {
- if (!isset($CONFIG->viewpath)) {
- $view_location = dirname(dirname(dirname(__FILE__))) . "/views/";
- } else {
- $view_location = $CONFIG->viewpath;
- }
- } else {
- $view_location = $CONFIG->views->locations[$view];
- }
+
+ $view_location = elgg_get_view_location($view);
if (file_exists($view_location . "{$viewtype}/{$view}.php") && !@include($view_location . "{$viewtype}/{$view}.php")) {