diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-22 11:14:47 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-22 11:14:47 +0000 |
commit | dfc41712e3343c6e9ab3ba8327c454c5cd3179b1 (patch) | |
tree | db5ad75af597eee2e4ab877e6d014910c36206a3 | |
parent | 5ea5c8f55b7560ac41bcf529482e6ac771b71ae0 (diff) | |
download | elgg-dfc41712e3343c6e9ab3ba8327c454c5cd3179b1.tar.gz elgg-dfc41712e3343c6e9ab3ba8327c454c5cd3179b1.tar.bz2 |
Plugins can now set context
git-svn-id: https://code.elgg.org/elgg/trunk@677 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/pageowner.php | 35 |
1 files changed, 35 insertions, 0 deletions
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 |