aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/entities.php602
1 files changed, 300 insertions, 302 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 0fd7d6976..b6a8f916a 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -39,10 +39,10 @@
* Any field not appearing in this will be viewed as a
*/
protected $attributes;
-
- /**
- * If set, overrides the value of getURL()
- */
+
+ /**
+ * If set, overrides the value of getURL()
+ */
protected $url_override;
/**
@@ -80,7 +80,7 @@
$this->attributes['guid'] = "";
$this->attributes['type'] = "";
$this->attributes['subtype'] = "";
- $this->attributes['owner_guid'] = $_SESSION['guid'];
+ $this->attributes['owner_guid'] = $_SESSION['guid'];
$this->attributes['container_guid'] = $_SESSION['guid'];
$this->attributes['site_guid'] = 0;
$this->attributes['access_id'] = 0;
@@ -239,7 +239,7 @@
unset($this->temp_metadata[$name]);
remove_metadata($this->getGUID(), $name);
foreach ($value as $v) {
- if ((int) $this->guid > 0) {
+ if ((int) $this->guid > 0) {
$multiple = true;
if (!create_metadata($this->getGUID(), $name, $v, $value_type, $this->getOwner(), $this->getAccessID(), $multiple)) return false;
} else {
@@ -262,7 +262,7 @@
return true;
}
else
- {
+ {
unset($this->temp_metadata[$name]);
if ((int) $this->guid > 0) {
return create_metadata($this->getGUID(), $name, $value, $value_type, $this->getOwner(), $this->getAccessID(), $multiple);
@@ -439,17 +439,17 @@
*/
function canEdit($user_guid = 0) {
return can_edit_entity($this->getGUID(),$user_guid);
- }
-
- /**
- * Determines whether or not the specified user (by default the current one) can edit metadata on the entity
- *
- * @param ElggMetadata $metadata The piece of metadata to specifically check
- * @param int $user_guid The user GUID, optionally (defaults to the currently logged in user)
- * @return true|false
- */
- function canEditMetadata($metadata = null, $user_guid = 0) {
- return can_edit_entity_metadata($this->getGUID(), $user_guid, $metadata);
+ }
+
+ /**
+ * Determines whether or not the specified user (by default the current one) can edit metadata on the entity
+ *
+ * @param ElggMetadata $metadata The piece of metadata to specifically check
+ * @param int $user_guid The user GUID, optionally (defaults to the currently logged in user)
+ * @return true|false
+ */
+ function canEditMetadata($metadata = null, $user_guid = 0) {
+ return can_edit_entity_metadata($this->getGUID(), $user_guid, $metadata);
}
/**
@@ -528,20 +528,20 @@
*
* @return string The URL
*/
- public function getURL() {
- if (!empty($this->url_override)) return $this->url_override;
- return get_entity_url($this->getGUID());
- }
-
- /**
- * Overrides the URL returned by getURL
- *
- * @param string $url The new item URL
- * @return string The URL
- */
- public function setURL($url) {
- $this->url_override = $url;
- return $url;
+ public function getURL() {
+ if (!empty($this->url_override)) return $this->url_override;
+ return get_entity_url($this->getGUID());
+ }
+
+ /**
+ * Overrides the URL returned by getURL
+ *
+ * @param string $url The new item URL
+ * @return string The URL
+ */
+ public function setURL($url) {
+ $this->url_override = $url;
+ return $url;
}
/**
@@ -1154,49 +1154,49 @@
}
}
- }
-
- /**
- * Determine whether a given user is able to write to a given container.
- *
- * @param int $user_guid The user guid, or 0 for $_SESSION['user']->getGUID()
- * @param int $container_guid The container, or 0 for the current page owner.
- */
- function can_write_to_container($user_guid = 0, $container_guid = 0, $entity_type = 'all')
- {
- global $CONFIG;
-
- $user_guid = (int)$user_guid;
- if (!$user_guid) $user_guid = (int) $_SESSION['guid'];
- $user = get_entity($user_guid);
-
- $container_guid = (int)$container_guid;
- if (!$container_guid) $container_guid = page_owner();
- if (!$container_guid) return true;
-
- $container = get_entity($container_guid);
-
- if (($container) && ($user))
- {
-
- // If the user can edit the container, they can also write to it
- if ($container->canEdit()) return true;
-
- // Basics, see if the user is a member of the group.
- if ($container instanceof ElggGroup) {
- if (!$container->isMember($user)) {
- return false;
- } else {
- return true;
- }
- }
-
- // See if anyone else has anything to say
- return trigger_plugin_hook('container_permissions_check',$entity_type,array('container' => $container, 'user' => $user), false);
-
- }
-
- return false;
+ }
+
+ /**
+ * Determine whether a given user is able to write to a given container.
+ *
+ * @param int $user_guid The user guid, or 0 for $_SESSION['user']->getGUID()
+ * @param int $container_guid The container, or 0 for the current page owner.
+ */
+ function can_write_to_container($user_guid = 0, $container_guid = 0, $entity_type = 'all')
+ {
+ global $CONFIG;
+
+ $user_guid = (int)$user_guid;
+ if (!$user_guid) $user_guid = (int) $_SESSION['guid'];
+ $user = get_entity($user_guid);
+
+ $container_guid = (int)$container_guid;
+ if (!$container_guid) $container_guid = page_owner();
+ if (!$container_guid) return true;
+
+ $container = get_entity($container_guid);
+
+ if (($container) && ($user))
+ {
+
+ // If the user can edit the container, they can also write to it
+ if ($container->canEdit()) return true;
+
+ // Basics, see if the user is a member of the group.
+ if ($container instanceof ElggGroup) {
+ if (!$container->isMember($user)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ // See if anyone else has anything to say
+ return trigger_plugin_hook('container_permissions_check',$entity_type,array('container' => $container, 'user' => $user), false);
+
+ }
+
+ return false;
}
/**
@@ -1221,9 +1221,9 @@
if ($site_guid == 0)
$site_guid = $CONFIG->site_guid;
$site_guid = (int) $site_guid;
- if ($container_guid == 0) $container_guid = $owner_guid;
-
- if (!can_write_to_container($owner_guid, $container_guid, $type)) return false;
+ if ($container_guid == 0) $container_guid = $owner_guid;
+
+ if (!can_write_to_container($owner_guid, $container_guid, $type)) return false;
if ($type=="") throw new InvalidParameterException(elgg_echo('InvalidParameterException:EntityTypeNotSet'));
@@ -1327,8 +1327,8 @@
* @param int $limit The number of entities to return; 10 by default
* @param int $offset The indexing offset, 0 by default
* @param boolean $count Set to true to get a count rather than the entities themselves (limits and offsets don't apply in this context). Defaults to false.
- * @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
- * @param int|array $container_guid The container or containers to get entities from (default: all containers).
+ * @param int $site_guid The site to get entities for. Leave as 0 (default) for the current site; -1 for all sites.
+ * @param int|array $container_guid The container or containers to get entities from (default: all containers).
* @return array A list of entities.
*/
function get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0, $container_guid = null)
@@ -1337,7 +1337,7 @@
if ($subtype === false || $subtype === null || $subtype === 0)
return false;
-
+
if ($order_by == "") $order_by = "time_created desc";
$order_by = sanitise_string($order_by);
$limit = (int)$limit;
@@ -1347,64 +1347,64 @@
$site_guid = $CONFIG->site_guid;
$where = array();
-
- if (is_array($type)) {
- $tempwhere = "";
- if (sizeof($type))
- foreach($type as $typekey => $subtypearray) {
- foreach($subtypearray as $subtypeval) {
- $typekey = sanitise_string($typekey);
- if (!empty($subtypeval)) {
- $subtypeval = (int) get_subtype_id($typekey, $subtypeval);
- } else {
- $subtypeval = 0;
- }
- if (!empty($tempwhere)) $tempwhere .= " or ";
- $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
- }
- }
- if (!empty($tempwhere)) $where[] = "({$tempwhere})";
-
- } else {
-
- $type = sanitise_string($type);
- $subtype = get_subtype_id($type, $subtype);
+
+ if (is_array($type)) {
+ $tempwhere = "";
+ if (sizeof($type))
+ foreach($type as $typekey => $subtypearray) {
+ foreach($subtypearray as $subtypeval) {
+ $typekey = sanitise_string($typekey);
+ if (!empty($subtypeval)) {
+ $subtypeval = (int) get_subtype_id($typekey, $subtypeval);
+ } else {
+ $subtypeval = 0;
+ }
+ if (!empty($tempwhere)) $tempwhere .= " or ";
+ $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
+ }
+ }
+ if (!empty($tempwhere)) $where[] = "({$tempwhere})";
+
+ } else {
+
+ $type = sanitise_string($type);
+ $subtype = get_subtype_id($type, $subtype);
if ($type != "")
$where[] = "type='$type'";
if ($subtype!=="")
- $where[] = "subtype=$subtype";
-
- }
+ $where[] = "subtype=$subtype";
+
+ }
if ($owner_guid != "") {
- if (!is_array($owner_guid)) {
+ if (!is_array($owner_guid)) {
$owner_array = array($owner_guid);
$owner_guid = (int) $owner_guid;
// $where[] = "owner_guid = '$owner_guid'";
- } else if (sizeof($owner_guid) > 0) {
+ } else if (sizeof($owner_guid) > 0) {
$owner_array = array_map('sanitise_int', $owner_guid);
// Cast every element to the owner_guid array to int
// $owner_guid = array_map("sanitise_int", $owner_guid);
// $owner_guid = implode(",",$owner_guid);
// $where[] = "owner_guid in ({$owner_guid})";
- }
- if (is_null($container_guid)) {
- $container_guid = $owner_array;
+ }
+ if (is_null($container_guid)) {
+ $container_guid = $owner_array;
}
}
if ($site_guid > 0)
$where[] = "site_guid = {$site_guid}";
-
- if (!is_null($container_guid)) {
- if (is_array($container_guid)) {
- foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
- $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
- } else {
- $container_guid = (int) $container_guid;
- $where[] = "container_guid = {$container_guid}";
- }
- }
+
+ if (!is_null($container_guid)) {
+ if (is_array($container_guid)) {
+ foreach($container_guid as $key => $val) $container_guid[$key] = (int) $val;
+ $where[] = "container_guid in (" . implode(",",$container_guid) . ")";
+ } else {
+ $container_guid = (int) $container_guid;
+ $where[] = "container_guid = {$container_guid}";
+ }
+ }
if (!$count) {
$query = "SELECT * from {$CONFIG->dbprefix}entities where ";
@@ -1424,28 +1424,28 @@
return $total->total;
}
}
-
- /**
- * Returns a viewable list of entities
- *
- * @see elgg_view_entity_list
- *
- * @param string $type The type of entity (eg "user", "object" etc)
- * @param string $subtype The arbitrary subtype of the entity
- * @param int $owner_guid The GUID of the owning user
- * @param int $limit The number of entities to display per page (default: 10)
- * @param true|false $fullview Whether or not to display the full view (default: true)
- * @param true|false $viewtypetoggle Whether or not to allow gallery view
- * @return string A viewable list of entities
- */
- function list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false) {
-
- $offset = (int) get_input('offset');
- $count = get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true);
- $entities = get_entities($type, $subtype, $owner_guid, "", $limit, $offset);
-
- return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
-
+
+ /**
+ * Returns a viewable list of entities
+ *
+ * @see elgg_view_entity_list
+ *
+ * @param string $type The type of entity (eg "user", "object" etc)
+ * @param string $subtype The arbitrary subtype of the entity
+ * @param int $owner_guid The GUID of the owning user
+ * @param int $limit The number of entities to display per page (default: 10)
+ * @param true|false $fullview Whether or not to display the full view (default: true)
+ * @param true|false $viewtypetoggle Whether or not to allow gallery view
+ * @return string A viewable list of entities
+ */
+ function list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false) {
+
+ $offset = (int) get_input('offset');
+ $count = get_entities($type, $subtype, $owner_guid, "", $limit, $offset, true);
+ $entities = get_entities($type, $subtype, $owner_guid, "", $limit, $offset);
+
+ return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
+
}
/**
@@ -1465,7 +1465,7 @@
$entities = get_objects_in_group($container_guid, $subtype, $owner_guid, 0, "", $limit, $offset);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview);
- }
+ }
/**
* Disable an entity but not delete it.
@@ -1495,28 +1495,28 @@
}
}
return false;
- }
-
- /**
- * Disables all of a user's entities
- *
- * @param int $owner_guid The owner GUID
- * @return true|false Depending on success
- */
- function disable_entities($owner_guid) {
-
- global $CONFIG;
- $owner_guid = (int) $owner_guid;
+ }
+
+ /**
+ * Disables all of a user's entities
+ *
+ * @param int $owner_guid The owner GUID
+ * @return true|false Depending on success
+ */
+ function disable_entities($owner_guid) {
+
+ global $CONFIG;
+ $owner_guid = (int) $owner_guid;
if ($entity = get_entity($owner_guid)) {
- if (trigger_elgg_event('disable',$entity->type,$entity)) {
- if ($entity->canEdit()) {
- $res = update_data("UPDATE {$CONFIG->dbprefix}entities set enabled='no' where owner_guid={$owner_guid} or container_guid = {$owner_guid}");
- return $res;
+ if (trigger_elgg_event('disable',$entity->type,$entity)) {
+ if ($entity->canEdit()) {
+ $res = update_data("UPDATE {$CONFIG->dbprefix}entities set enabled='no' where owner_guid={$owner_guid} or container_guid = {$owner_guid}");
+ return $res;
}
- }
- }
- return false;
-
+ }
+ }
+ return false;
+
}
/**
@@ -1785,11 +1785,11 @@
// Test user if possible - should default to false unless a plugin hook says otherwise
if (!is_null($user))
{
- if ($entity->getOwner() == $user->getGUID()) $return = true;
+ if ($entity->getOwner() == $user->getGUID()) $return = true;
if ($entity->container_guid == $user->getGUID()) $return = true;
- if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) $return = true;
- if ($container_entity = get_entity($entity->container_guid)) {
- if ($container_entity->canEdit()) $return = true;
+ if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) $return = true;
+ if ($container_entity = get_entity($entity->container_guid)) {
+ if ($container_entity->canEdit()) $return = true;
}
}
@@ -1800,39 +1800,39 @@
}
- }
-
- /**
- * Determines whether or not the specified user can edit metadata on the specified entity.
- *
- * This is extendible by registering a plugin hook taking in the parameters 'entity' and 'user',
- * which are the entity and user entities respectively
- *
- * @see register_plugin_hook
- *
- * @param int $entity_guid The GUID of the entity
- * @param int $user_guid The GUID of the user
- * @param ElggMetadata $metadata The metadata to specifically check (if any; default null)
- * @return true|false Whether the specified user can edit the specified entity.
- */
- function can_edit_entity_metadata($entity_guid, $user_guid = 0, $metadata = null) {
-
- if ($entity = get_entity($entity_guid)) {
-
- $return = null;
-
- if ($metadata->owner_guid == 0) $return = true;
- if (is_null($return))
+ }
+
+ /**
+ * Determines whether or not the specified user can edit metadata on the specified entity.
+ *
+ * This is extendible by registering a plugin hook taking in the parameters 'entity' and 'user',
+ * which are the entity and user entities respectively
+ *
+ * @see register_plugin_hook
+ *
+ * @param int $entity_guid The GUID of the entity
+ * @param int $user_guid The GUID of the user
+ * @param ElggMetadata $metadata The metadata to specifically check (if any; default null)
+ * @return true|false Whether the specified user can edit the specified entity.
+ */
+ function can_edit_entity_metadata($entity_guid, $user_guid = 0, $metadata = null) {
+
+ if ($entity = get_entity($entity_guid)) {
+
+ $return = null;
+
+ if ($metadata->owner_guid == 0) $return = true;
+ if (is_null($return))
$return = can_edit_entity($entity_guid, $user_guid);
- $user = get_entity($user_guid);
- $return = trigger_plugin_hook('permissions_check:metadata',$entity->type,array('entity' => $entity, 'user' => $user, 'metadata' => $metadata),$return);
- return $return;
-
- } else {
- return false;
- }
-
+ $user = get_entity($user_guid);
+ $return = trigger_plugin_hook('permissions_check:metadata',$entity->type,array('entity' => $entity, 'user' => $user, 'metadata' => $metadata),$return);
+ return $return;
+
+ } else {
+ return false;
+ }
+
}
@@ -1888,21 +1888,19 @@
global $CONFIG;
if ($entity = get_entity($entity_guid)) {
- $url = "";
+ $url = "";
if (isset($CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()])) {
$function = $CONFIG->entity_url_handler[$entity->getType()][$entity->getSubType()];
if (is_callable($function)) {
$url = $function($entity);
}
- }
- if (isset($CONFIG->entity_url_handler[$entity->getType()]['all'])) {
+ } elseif (isset($CONFIG->entity_url_handler[$entity->getType()]['all'])) {
$function = $CONFIG->entity_url_handler[$entity->getType()]['all'];
if (is_callable($function)) {
$url = $function($entity);
}
- }
- if (isset($CONFIG->entity_url_handler['all']['all'])) {
+ } elseif (isset($CONFIG->entity_url_handler['all']['all'])) {
$function = $CONFIG->entity_url_handler['all']['all'];
if (is_callable($function)) {
$url = $function($entity);
@@ -1976,70 +1974,70 @@
return $url;
}
- }
-
- /**
- * Registers and entity type and subtype to return in search and other places.
- * A description in the elgg_echo languages file of the form item:type:subtype
- * is also expected.
- *
- * @param string $type The type of entity (object, site, user, group)
- * @param string $subtype The subtype to register (may be blank)
- * @return true|false Depending on success
- */
- function register_entity_type($type, $subtype) {
-
- global $CONFIG;
-
- $type = strtolower($type);
- if (!in_array($type,array('object','site','group','user'))) return false;
-
- if (!isset($CONFIG->registered_entities)) $CONFIG->registered_entities = array();
- $CONFIG->registered_entities[$type][] = $subtype;
-
- return true;
-
- }
-
- /**
- * Returns registered entity types and subtypes
- *
- * @see register_entity_type
- *
- * @param string $type The type of entity (object, site, user, group) or blank for all
- * @return array|false Depending on whether entities have been registered
- */
- function get_registered_entity_types($type = '') {
-
- global $CONFIG;
-
- if (!isset($CONFIG->registered_entities)) return false;
- if (!empty($type)) $type = strtolower($type);
- if (!empty($type) && empty($CONFIG->registered_entities[$type])) return false;
-
- if (empty($type))
- return $CONFIG->registered_entities;
-
- return $CONFIG->registered_entities[$type];
-
- }
-
- /**
- * Determines whether or not the specified entity type and subtype have been registered in the system
- *
- * @param string $type The type of entity (object, site, user, group)
- * @param string $subtype The subtype (may be blank)
- * @return true|false Depending on whether or not the type has been registered
- */
- function is_registered_entity_type($type, $subtype) {
-
- global $CONFIG;
-
- if (!isset($CONFIG->registered_entities)) return false;
- $type = strtolower($type);
- if (empty($CONFIG->registered_entities[$type])) return false;
- if (in_array($subtype, $CONFIG->registered_entities[$type])) return true;
-
+ }
+
+ /**
+ * Registers and entity type and subtype to return in search and other places.
+ * A description in the elgg_echo languages file of the form item:type:subtype
+ * is also expected.
+ *
+ * @param string $type The type of entity (object, site, user, group)
+ * @param string $subtype The subtype to register (may be blank)
+ * @return true|false Depending on success
+ */
+ function register_entity_type($type, $subtype) {
+
+ global $CONFIG;
+
+ $type = strtolower($type);
+ if (!in_array($type,array('object','site','group','user'))) return false;
+
+ if (!isset($CONFIG->registered_entities)) $CONFIG->registered_entities = array();
+ $CONFIG->registered_entities[$type][] = $subtype;
+
+ return true;
+
+ }
+
+ /**
+ * Returns registered entity types and subtypes
+ *
+ * @see register_entity_type
+ *
+ * @param string $type The type of entity (object, site, user, group) or blank for all
+ * @return array|false Depending on whether entities have been registered
+ */
+ function get_registered_entity_types($type = '') {
+
+ global $CONFIG;
+
+ if (!isset($CONFIG->registered_entities)) return false;
+ if (!empty($type)) $type = strtolower($type);
+ if (!empty($type) && empty($CONFIG->registered_entities[$type])) return false;
+
+ if (empty($type))
+ return $CONFIG->registered_entities;
+
+ return $CONFIG->registered_entities[$type];
+
+ }
+
+ /**
+ * Determines whether or not the specified entity type and subtype have been registered in the system
+ *
+ * @param string $type The type of entity (object, site, user, group)
+ * @param string $subtype The subtype (may be blank)
+ * @return true|false Depending on whether or not the type has been registered
+ */
+ function is_registered_entity_type($type, $subtype) {
+
+ global $CONFIG;
+
+ if (!isset($CONFIG->registered_entities)) return false;
+ $type = strtolower($type);
+ if (empty($CONFIG->registered_entities[$type])) return false;
+ if (in_array($subtype, $CONFIG->registered_entities[$type])) return true;
+
}
/**
@@ -2053,40 +2051,40 @@
set_input('guid',$page[0]);
@include($CONFIG->path . "entities/index.php");
}
- }
-
- /**
- * Returns a viewable list of entities based on the registered types
- *
- * @see elgg_view_entity_list
- *
- * @param string $type The type of entity (eg "user", "object" etc)
- * @param string $subtype The arbitrary subtype of the entity
- * @param int $owner_guid The GUID of the owning user
- * @param int $limit The number of entities to display per page (default: 10)
- * @param true|false $fullview Whether or not to display the full view (default: true)
- * @param true|false $viewtypetoggle Whether or not to allow gallery view
- * @return string A viewable list of entities
- */
- function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $allowedtypes = true) {
-
- $typearray = array();
-
- if ($object_types = get_registered_entity_types()) {
- foreach($object_types as $object_type => $subtype_array) {
- if (is_array($subtype_array) && sizeof($subtype_array) && (in_array($object_type,$allowedtypes) || $allowedtypes === true))
- foreach($subtype_array as $object_subtype) {
- $typearray[$object_type][] = $object_subtype;
- }
- }
- }
-
- $offset = (int) get_input('offset');
- $count = get_entities($typearray, '', $owner_guid, "", $limit, $offset, true);
- $entities = get_entities($typearray, '', $owner_guid, "", $limit, $offset);
-
- return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
-
+ }
+
+ /**
+ * Returns a viewable list of entities based on the registered types
+ *
+ * @see elgg_view_entity_list
+ *
+ * @param string $type The type of entity (eg "user", "object" etc)
+ * @param string $subtype The arbitrary subtype of the entity
+ * @param int $owner_guid The GUID of the owning user
+ * @param int $limit The number of entities to display per page (default: 10)
+ * @param true|false $fullview Whether or not to display the full view (default: true)
+ * @param true|false $viewtypetoggle Whether or not to allow gallery view
+ * @return string A viewable list of entities
+ */
+ function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $allowedtypes = true) {
+
+ $typearray = array();
+
+ if ($object_types = get_registered_entity_types()) {
+ foreach($object_types as $object_type => $subtype_array) {
+ if (is_array($subtype_array) && sizeof($subtype_array) && (in_array($object_type,$allowedtypes) || $allowedtypes === true))
+ foreach($subtype_array as $object_subtype) {
+ $typearray[$object_type][] = $object_subtype;
+ }
+ }
+ }
+
+ $offset = (int) get_input('offset');
+ $count = get_entities($typearray, '', $owner_guid, "", $limit, $offset, true);
+ $entities = get_entities($typearray, '', $owner_guid, "", $limit, $offset);
+
+ return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
+
}
/**