aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/pageowner.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
commit7ddd9521b3f3a397da3b0a6b56238d31414eb4be (patch)
tree6eb6a9a51db5fa0f5d3cc2ec6de29b9e258b12a1 /engine/lib/pageowner.php
parentbd3484417d170e62bc94e9db81d4ad37e8ddee6a (diff)
downloadelgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.gz
elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.bz2
Standardized code in all of core, not including language files, tests, or core mods.
git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/pageowner.php')
-rw-r--r--engine/lib/pageowner.php51
1 files changed, 46 insertions, 5 deletions
diff --git a/engine/lib/pageowner.php b/engine/lib/pageowner.php
index fb2e6255a..6b0ef491f 100644
--- a/engine/lib/pageowner.php
+++ b/engine/lib/pageowner.php
@@ -3,14 +3,15 @@
* Elgg page owner library
* Contains functions for managing page ownership and context
*
- * @package Elgg
- * @subpackage Core
+ * @package Elgg.Core
+ * @subpackage PageOwner
*/
-
/**
* Gets the guid of the entity that owns the current page.
+ *
* @param int $guid Optional parameter used by elgg_set_page_owner_guid().
+ *
* @return int The current page owner guid (0 if none).
* @since 1.8
*/
@@ -33,7 +34,11 @@ function elgg_get_page_owner_guid($guid = 0) {
}
/**
+ * Gets the guid of the entity that owns the current page.
+ *
* @deprecated 1.8 Use get_page_owner_guid()
+ *
+ * @return int The current page owner guid (0 if none).
*/
function page_owner() {
elgg_deprecated_notice('page_owner() was deprecated by elgg_get_page_owner_guid().', 1.8);
@@ -42,7 +47,9 @@ function page_owner() {
/**
* Gets the owner entity for the current page.
+ *
* @return ElggEntity|false The current page owner or false if none.
+ *
* @since 1.8
*/
function elgg_get_page_owner() {
@@ -55,7 +62,12 @@ function elgg_get_page_owner() {
}
/**
+ * Gets the owner entity for the current page.
+ *
* @deprecated 1.8 Use elgg_get_page_owner()
+ * @return ElggEntity|false The current page owner or false if none.
+ *
+ * @since 1.8
*/
function page_owner_entity() {
elgg_deprecated_notice('page_owner_entity() was deprecated by elgg_get_page_owner().', 1.8);
@@ -64,8 +76,11 @@ function page_owner_entity() {
/**
* Set the guid of the entity that owns this page
- * @param int $guid
+ *
+ * @param int $guid The guid of the page owner
+ *
* @since 1.8
+ * @return void
*/
function elgg_set_page_owner_guid($guid) {
elgg_get_page_owner_guid($guid);
@@ -73,14 +88,24 @@ function elgg_set_page_owner_guid($guid) {
/**
+ * Registers a page owner handler function
+ *
+ * @param string $functionname The callback function
+ *
* @deprecated 1.8 Use the 'page_owner', 'system' plugin hook
+ * @return void
*/
function add_page_owner_handler($functionname) {
elgg_deprecated_notice("add_page_owner_handler() was deprecated by the plugin hook 'page_owner', 'system'.", 1.8);
}
/**
+ * Set a page owner entity
+ *
+ * @param int $entitytoset The GUID of the entity
+ *
* @deprecated 1.8 Use elgg_set_page_owner_guid()
+ * @return void
*/
function set_page_owner($entitytoset = -1) {
elgg_deprecated_notice('set_page_owner() was deprecated by elgg_set_page_owner_guid().', 1.8);
@@ -91,6 +116,7 @@ function set_page_owner($entitytoset = -1) {
* 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) {
@@ -121,12 +147,22 @@ function get_context() {
return "main";
}
+/**
+ * Handles default page owners
+ *
+ * @param string $hook page_owner
+ * @param string $entity_type system
+ * @param mixed $returnvalue Previous function's return value
+ * @param mixed $params Params
+ *
+ * @return int
+ */
function default_page_owner_handler($hook, $entity_type, $returnvalue, $params) {
if ($returnvalue) {
return $returnvalue;
}
-
+
$username = get_input("username");
if ($username) {
if (substr_count($username, 'group:')) {
@@ -152,6 +188,11 @@ function default_page_owner_handler($hook, $entity_type, $returnvalue, $params)
return $returnvalue;
}
+/**
+ * Loads the page owner functions
+ *
+ * @return void
+ */
function page_owner_init() {
register_plugin_hook('page_owner', 'system', 'default_page_owner_handler');
}