From dfc41712e3343c6e9ab3ba8327c454c5cd3179b1 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 22 May 2008 11:14:47 +0000 Subject: Plugins can now set context git-svn-id: https://code.elgg.org/elgg/trunk@677 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/pageowner.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'engine/lib/pageowner.php') diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php index b1a3fe8ff..4531b5037 100644 --- a/engine/lib/pageowner.php +++ b/engine/lib/pageowner.php @@ -108,4 +108,39 @@ } + /** + * Sets the functional context of a page + * + * @param string $context The context of the page + * @return string|false Either the context string, or false on failure + */ + function set_context($context) { + + global $CONFIG; + if (!empty($context)) { + $context = trim($context); + $context = strtolower($context); + $CONFIG->context = $context; + return $context; + } else { + return false; + } + + } + + /** + * Returns the functional context of a page + * + * @return string The context, or 'main' if no context has been provided + */ + function get_context() { + + global $CONFIG; + if (isset($CONFIG->context) && !empty($CONFIG->context)) { + return $CONFIG->context; + } + return "main"; + + } + ?> \ No newline at end of file -- cgit v1.2.3