diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-02-17 23:14:33 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-02-17 23:14:33 +0000 |
commit | ba94a48ff66a001dd20c5ac2da34681880583945 (patch) | |
tree | 29b0ebfcd19ba03c69cd8ad7e4171c0002b3d207 | |
parent | b3012350e2d8dafaf696e2c472f8cf0ae5e1674b (diff) | |
download | elgg-ba94a48ff66a001dd20c5ac2da34681880583945.tar.gz elgg-ba94a48ff66a001dd20c5ac2da34681880583945.tar.bz2 |
Fixes #1488: Removed use of deprecated functions in core.
git-svn-id: http://code.elgg.org/elgg/trunk@3947 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | admin/user.php | 2 | ||||
-rw-r--r-- | dashboard/latest.php | 2 | ||||
-rw-r--r-- | engine/lib/activity.php | 12 | ||||
-rw-r--r-- | engine/lib/admin.php | 6 | ||||
-rw-r--r-- | engine/lib/entities.php | 17 | ||||
-rw-r--r-- | engine/lib/export.php | 4 | ||||
-rw-r--r-- | engine/lib/group.php | 13 | ||||
-rw-r--r-- | engine/lib/input.php | 6 | ||||
-rw-r--r-- | engine/lib/metadata.php | 19 | ||||
-rw-r--r-- | engine/lib/notification.php | 11 | ||||
-rw-r--r-- | engine/lib/objects.php | 8 | ||||
-rw-r--r-- | engine/lib/relationships.php | 21 | ||||
-rw-r--r-- | engine/lib/river2.php | 6 | ||||
-rw-r--r-- | engine/lib/sites.php | 40 | ||||
-rw-r--r-- | engine/lib/users.php | 86 | ||||
-rw-r--r-- | index.php | 6 |
16 files changed, 209 insertions, 50 deletions
diff --git a/admin/user.php b/admin/user.php index 47c3786de..4e853033b 100644 --- a/admin/user.php +++ b/admin/user.php @@ -25,7 +25,7 @@ $title = elgg_view_title(elgg_echo('admin:user')); set_context('search'); -$result = list_entities('user', '', 0, $limit, false); +$result = elgg_list_entities(array('type' => 'user', 'limit' => $limit, 'fullview' => FALSE)); set_context('admin'); diff --git a/dashboard/latest.php b/dashboard/latest.php index 033c66695..2017da944 100644 --- a/dashboard/latest.php +++ b/dashboard/latest.php @@ -17,7 +17,7 @@ require_once(dirname(dirname(__FILE__)) . "/engine/start.php"); global $CONFIG; $title = elgg_view_title(elgg_echo('content:latest')); set_context('search'); -$content = list_registered_entities(0,10,false,false,array('object','group')); +$content = elgg_list_registered_entities(array('limit' => 10, 'full_view' => FALSE, 'allowed_types' => array('object','group'))); set_context('latest'); $content = elgg_view_layout('two_column_left_sidebar', '', $title . $content); page_draw(elgg_echo('content:latest'), $content); diff --git a/engine/lib/activity.php b/engine/lib/activity.php index 30c81cb96..51b083531 100644 --- a/engine/lib/activity.php +++ b/engine/lib/activity.php @@ -143,8 +143,14 @@ function get_activity_stream_data($limit = 10, $offset = 0, $type = "", $subtype if ($owner_relationship) { $friendsarray = ""; - if ($friends = get_entities_from_relationship($owner_relationship, $owner_guid[0], - FALSE, "user", $subtype, 0, "time_created desc", 9999)) { + if ($friends = elgg_get_entities_from_relationship(array( + 'relationship' => $owner_relationship, + 'relationship_guid' => $owner_guid[0], + 'inverse_relationship' => FALSE, + 'types' => 'user', + 'subtypes' => $subtype, + 'limit' => 9999)) + ) { $friendsarray = array(); foreach($friends as $friend) { @@ -160,4 +166,4 @@ function get_activity_stream_data($limit = 10, $offset = 0, $type = "", $subtype WHERE 1 $user AND ($obj_query) ORDER BY sl.time_created desc limit $offset, $limit"; return get_data($query); -}
\ No newline at end of file +} diff --git a/engine/lib/admin.php b/engine/lib/admin.php index fc3ffd64c..c8ca90a2f 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -135,7 +135,11 @@ function send_admin_message($subject, $message) { * @param int $limit Limit */ function list_admin_messages($limit = 10) { - return list_entities('object', 'admin_message', 0, $limit); + return elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'admin_message', + 'limit' => $limit + )); } /** diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 8a532b275..d52b86005 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -563,8 +563,13 @@ abstract class ElggEntity implements * @return array|false An array of entities or false on failure */ function getEntitiesFromRelationship($relationship, $inverse = false, $limit = 50, $offset = 0) { - return get_entities_from_relationship($relationship, $this->getGUID(), $inverse, - "", "", "", "time_created desc", $limit, $offset); + return elgg_get_entities_from_relationship(array( + 'relationship' => $relationship, + 'relationship_guid' => $this->getGUID(), + 'inverse_relationship' => $inverse, + 'limit' => $limit, + 'offset' => $offset + )); } /** @@ -575,8 +580,12 @@ abstract class ElggEntity implements * @return int|false The number of entities or false on failure */ function countEntitiesFromRelationship($relationship, $inverse_relationship = FALSE) { - return get_entities_from_relationship($relationship, $this->getGUID(), $inverse_relationship, "", "", "", - "time_created desc", null, null, TRUE); + return elgg_get_entities_from_relationship(array( + 'relationship' => $relationship, + 'relationship_guid' => $this->getGUID(), + 'inverse_relationship' => $inverse_relationship, + 'count' => TRUE + )); } /** diff --git a/engine/lib/export.php b/engine/lib/export.php index e3acace5f..c541b583b 100644 --- a/engine/lib/export.php +++ b/engine/lib/export.php @@ -121,7 +121,7 @@ function is_uuid_this_domain($uuid) { function get_entity_from_uuid($uuid) { $uuid = sanitise_string($uuid); - $entities = get_entities_from_metadata("import_uuid", $uuid); + $entities = elgg_get_entities_from_metadata(array('metadata_name' => 'import_uuid', 'metadata_value' => $uuid)); if ($entities) { return $entities[0]; @@ -253,4 +253,4 @@ function export_init() { } // Register a startup event -register_elgg_event_handler('init', 'system', 'export_init', 100);
\ No newline at end of file +register_elgg_event_handler('init', 'system', 'export_init', 100); diff --git a/engine/lib/group.php b/engine/lib/group.php index ab6a7d3be..a87dbf071 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -746,7 +746,16 @@ function get_entities_from_metadata_groups_multi($group_guid, $meta_array, $enti * @return mixed */ function get_group_members($group_guid, $limit = 10, $offset = 0, $site_guid = 0, $count = false) { - return get_entities_from_relationship('member', $group_guid, true, 'user', '', 0, "", $limit, $offset, $count, $site_guid); + return elgg_get_entities_from_relationship(array( + 'relationship' => 'member', + 'relationship_guid' => $group_guid, + 'inverse_relationship' => TRUE, + 'types' => 'user', + 'limit' => $limit, + 'offset' => $offset, + 'count' => $count, + 'site_guid' => $site_guid + )); } /** @@ -796,7 +805,7 @@ function leave_group($group_guid, $user_guid) { * @param unknown_type $user_guid */ function get_users_membership($user_guid) { - return get_entities_from_relationship('member', $user_guid, false); + return elgg_get_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $user_guid, 'inverse_relationship' => FALSE)); } /** diff --git a/engine/lib/input.php b/engine/lib/input.php index 89bab5853..d6f044c90 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -247,7 +247,7 @@ function input_livesearch_page_handler($page) { case 'all': // only need to pull up title from objects. - if (!$entities = get_entities(null, null, $owner_guid, null, $limit) AND is_array($entities)) { + if (!$entities = elgg_get_entities(array('owner_guid' => $owner_guid, 'limit' => $limit)) AND is_array($entities)) { $results = array_merge($results, $entities); } break; @@ -331,7 +331,9 @@ function input_livesearch_page_handler($page) { default: // arbitrary subtype. - get_entities(null, $type, $owner_guid); + //@todo you cannot specify a subtype without a type. + // did this ever work? + elgg_get_entities(array('subtype' => $type, 'owner_guid' => $owner_guid)); break; } } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 159e9187a..71b6c2634 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -850,11 +850,24 @@ $count = FALSE, $case_sensitive = TRUE) { * * @return string A list of entities suitable for display */ -function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true, $case_sensitive = true ) { +function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = ELGG_ENTITIES_ANY_VALUE, $entity_subtype = ELGG_ENTITIES_ANY_VALUE, $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true, $case_sensitive = true ) { $offset = (int) get_input('offset'); $limit = (int) $limit; - $count = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, true, $case_sensitive ); - $entities = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, false, $case_sensitive ); + $options = array( + 'metadata_name' => $meta_name, + 'metadata_value' => $meta_value, + 'types' => $entity_type, + 'subtypes' => $entity_subtype, + 'owner_guid' => $owner_guid, + 'limit' => $limit, + 'offset' => $offset, + 'count' => TRUE, + 'case_sensitive' => $case_sensitive + ); + $count = elgg_get_entities_from_metadata($options); + + $options['count'] = FALSE; + $entities = elgg_get_entities_from_metadata($options); return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination); } diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 0e66e1ff9..adc4ebace 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -401,8 +401,13 @@ function object_notifications($event, $object_type, $object) { // Get users interested in content from this person and notify them // (Person defined by container_guid so we can also subscribe to groups if we want) foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $interested_users = get_entities_from_relationship('notify' . $method, - $object->container_guid, true, 'user', '', 0, '', 99999); + $interested_users = elgg_get_entities_from_relationship(array( + 'relationship' => 'notify' . $method, + 'relationship_guid' => $object->container_guid, + 'inverse_relationship' => TRUE, + 'types' => 'user', + 'limit' => 99999 + )); if ($interested_users && is_array($interested_users)) { foreach($interested_users as $user) { @@ -430,4 +435,4 @@ function object_notifications($event, $object_type, $object) { // Register a startup event register_elgg_event_handler('init','system','notification_init',0); -register_elgg_event_handler('create','object','object_notifications');
\ No newline at end of file +register_elgg_event_handler('create','object','object_notifications'); diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 331578ed6..85ad92a07 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -342,7 +342,13 @@ function get_object_sites($object_guid, $limit = 10, $offset = 0) { $limit = (int)$limit; $offset = (int)$offset; - return get_entities_from_relationship("member_of_site", $object_guid, false, "site", "", 0, "time_created desc", $limit, $offset); + return elgg_get_entities_from_relationship(array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $object_guid, + 'types' => 'site', + 'limit' => $limit, + 'offset' => $offset + )); } /** diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 789dd4575..c67596837 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -662,11 +662,24 @@ $count = false, $site_guid = 0) { * @param true|false $pagination Whether to display pagination (default: true) * @return string The viewable list of entities */ -function list_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) { +function list_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = ELGG_ENTITIES_ANY_VALUE, $subtype = ELGG_ENTITIES_ANY_VALUE, $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $pagination = true) { $limit = (int) $limit; $offset = (int) get_input('offset'); - $count = get_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship, $type, $subtype, $owner_guid, "", $limit, $offset, true); - $entities = get_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship, $type, $subtype, $owner_guid, "", $limit, $offset); + $options = array( + 'relationship' => $relationship, + 'relationship_guid' => $relationship_guid, + 'inverse_relationship' => $inverse_relationship, + 'types' => $type, + 'subtypes' => $subtype, + 'owner_guid' => $owner_guid, + 'order_by' => '', + 'limit' => $limit, + 'offset' => $offset, + 'count' => TRUE + ); + $count = elgg_get_entities_from_relationship($options); + $options['count'] = FALSE; + $entities = elgg_get_entities_from_relationship($options); return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination); } @@ -947,7 +960,7 @@ function already_attached($guid_one, $guid_two){ **/ function get_attachments($guid, $type=""){ - $attached = get_entities_from_relationship("attached", $guid, $inverse_relationship = false, $type, $subtype = "", $owner_guid = 0, $order_by = "time_created desc", $limit = 10, $offset = 0, $count = false, $site_guid = 0); + $attached = elgg_get_entities_from_relationship(array('relationship' => 'attached', 'relationship_guid' => $guid, 'inverse_relationship' => $inverse_relationship = false, 'types' => $type, 'subtypes' => '', 'owner_guid' => 0, 'order_by' => 'time_created desc', 'limit' => 10, 'offset' => 0, 'count' => false, 'site_guid' => 0)); return $attached; } diff --git a/engine/lib/river2.php b/engine/lib/river2.php index 02a2a0732..45a7f59ec 100644 --- a/engine/lib/river2.php +++ b/engine/lib/river2.php @@ -197,7 +197,11 @@ function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relations } } else { if (!is_array($subject_guid)) { - if ($entities = get_entities_from_relationship($subject_relationship,$subject_guid,false,'','',0,'',9999)) { + if ($entities = elgg_get_entities_from_relationship(array( + 'relationship' => $subject_relationship, + 'relationship_guid' => $subject_guid, + 'limit' => 9999)) + ) { $guids = array(); foreach($entities as $entity) { $guids[] = (int) $entity->guid; diff --git a/engine/lib/sites.php b/engine/lib/sites.php index e9da4bdab..13521a257 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -361,7 +361,13 @@ function get_site_members($site_guid, $limit = 10, $offset = 0) { $limit = (int)$limit; $offset = (int)$offset; - return get_entities_from_relationship("member_of_site", $site_guid, true, "user", "", 0, "time_created desc", $limit, $offset); + return elgg_get_entities_from_relationship(array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $site_guid, + 'inverse_relationship' => TRUE, + 'types' => 'user', + 'limit' => $limit, 'offset' => $offset + )); } /** @@ -375,7 +381,16 @@ function get_site_members($site_guid, $limit = 10, $offset = 0) { function list_site_members($site_guid, $limit = 10, $fullview = true) { $offset = (int) get_input('offset'); $limit = (int) $limit; - $count = (int) get_entities_from_relationship("member_of_site", $site_guid, true, "user", "", 0, "time_created desc", $limit, $offset, true); + $options = array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $site_guid, + 'inverse_relationship' => TRUE, + 'types' => 'user', + 'limit' => $limit, + 'offset' => $offset, + 'count' => TRUE + ); + $count = (int) elgg_get_entities_from_relationship($options); $entities = get_site_members($site_guid, $limit, $offset); return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview); @@ -424,7 +439,15 @@ function get_site_objects($site_guid, $subtype = "", $limit = 10, $offset = 0) { $limit = (int)$limit; $offset = (int)$offset; - return get_entities_from_relationship("member_of_site", $site_guid, true, "object", $subtype, 0, "time_created desc", $limit, $offset); + return elgg_get_entities_from_relationship(array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $site_guid, + 'inverse_relationship' => TRUE, + 'types' => 'object', + 'subtypes' => $subtype, + 'limit' => $limit, + 'offset' => $offset + )); } /** @@ -469,7 +492,16 @@ function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = $limit = (int)$limit; $offset = (int)$offset; - return get_entities_from_relationship("member_of_site", $site_guid, true, "collection", $subtype, 0, "time_created desc", $limit, $offset); + // collection isn't a valid type. This won't work. + return elgg_get_entities_from_relationship(array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $site_guid, + 'inverse_relationship' => TRUE, + 'types' => 'collection', + 'subtypes' => $subtype, + 'limit' => $limit, + 'offset' => $offset + )); } /** diff --git a/engine/lib/users.php b/engine/lib/users.php index 46379aca2..1c29858b6 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -544,7 +544,14 @@ function get_user_sites($user_guid, $limit = 10, $offset = 0) { $limit = (int)$limit; $offset = (int)$offset; - return get_entities_from_relationship("member_of_site", $user_guid, false, "site", "", 0, "time_created desc", $limit, $offset); + return elgg_get_entities_from_relationship(array( + 'relationship' => 'member_of_site', + 'relationship_guid' => $user_guid, + 'inverse_relationship' => FALSE, + 'types' => 'site', + 'limit' => $limit, + 'offset' => $offset) + ); } /** @@ -614,8 +621,15 @@ function user_is_friend($user_guid, $friend_guid) { * @param int $offset Indexing offset, if any * @return false|array Either an array of ElggUsers or false, depending on success */ -function get_user_friends($user_guid, $subtype = "", $limit = 10, $offset = 0) { - return get_entities_from_relationship("friend",$user_guid,false,"user",$subtype,0,"time_created desc",$limit,$offset); +function get_user_friends($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, $offset = 0) { + return elgg_get_entities_from_relationship(array( + 'relationship' => 'friend', + 'relationship_guid' => $user_guid, + 'types' => 'user', + 'subtypes' => $subtype, + 'limit' => $limit, + 'offset' => $offset + )); } /** @@ -627,8 +641,16 @@ function get_user_friends($user_guid, $subtype = "", $limit = 10, $offset = 0) { * @param int $offset Indexing offset, if any * @return false|array Either an array of ElggUsers or false, depending on success */ -function get_user_friends_of($user_guid, $subtype = "", $limit = 10, $offset = 0) { - return get_entities_from_relationship("friend",$user_guid,true,"user",$subtype,0,"time_created desc",$limit,$offset); +function get_user_friends_of($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, $offset = 0) { + return elgg_get_entities_from_relationship(array( + 'relationship' => 'friend', + 'relationship_guid' => $user_guid, + 'inverse_relationship' => TRUE, + 'types' => 'user', + 'subtypes' => $subtype, + 'limit' => $limit, + 'offset' => $offset + )); } /** @@ -642,8 +664,17 @@ function get_user_friends_of($user_guid, $subtype = "", $limit = 10, $offset = 0 * @param int $timeupper The latest time the entity can have been created. Default: all * @return false|array An array of ElggObjects or false, depending on success */ -function get_user_objects($user_guid, $subtype = "", $limit = 10, $offset = 0, $timelower = 0, $timeupper = 0) { - $ntt = get_entities('object',$subtype, $user_guid, "time_created desc", $limit, $offset,false,0,$user_guid,$timelower, $timeupper); +function get_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, $offset = 0, $timelower = 0, $timeupper = 0) { + $ntt = elgg_get_entities(array( + 'type' => 'object', + 'subtype' => $subtype, + 'owner_guid' => $user_guid, + 'limit' => $limit, + 'offset' => $offset, + 'container_guid' => $user_guid, + 'created_time_lower' => $timelower, + 'created_time_upper' => $timeupper + )); return $ntt; } @@ -656,8 +687,16 @@ function get_user_objects($user_guid, $subtype = "", $limit = 10, $offset = 0, $ * @param int $timeupper The latest time the entity can have been created. Default: all * @return int The number of objects the user owns (of this subtype) */ -function count_user_objects($user_guid, $subtype = "", $timelower = 0, $timeupper = 0) { - $total = get_entities('object', $subtype, $user_guid, "time_created desc", null, null, true, 0, $user_guid,$timelower,$timeupper); +function count_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $timelower = 0, $timeupper = 0) { + $total = elgg_get_entities(array( + 'type' => 'object', + 'subtype' => $subtype, + 'owner_guid' => $user_guid, + 'count' => TRUE, + 'container_guid' => $user_guid, + 'created_time_lower' => $timelower, + 'created_time_upper' => $timeupper + )); return $total; } @@ -676,7 +715,7 @@ function count_user_objects($user_guid, $subtype = "", $timelower = 0, $timeuppe * @param int $timeupper The latest time the entity can have been created. Default: all * @return string The list in a form suitable to display */ -function list_user_objects($user_guid, $subtype = "", $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) { +function list_user_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true, $timelower = 0, $timeupper = 0) { $offset = (int) get_input('offset'); $limit = (int) $limit; $count = (int) count_user_objects($user_guid, $subtype,$timelower,$timeupper); @@ -696,15 +735,24 @@ function list_user_objects($user_guid, $subtype = "", $limit = 10, $fullview = t * @param int $timeupper The latest time the entity can have been created. Default: all * @return false|array An array of ElggObjects or false, depending on success */ -function get_user_friends_objects($user_guid, $subtype = "", $limit = 10, $offset = 0, $timelower = 0, $timeupper = 0) { +function get_user_friends_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $limit = 10, $offset = 0, $timelower = 0, $timeupper = 0) { if ($friends = get_user_friends($user_guid, "", 999999, 0)) { $friendguids = array(); foreach($friends as $friend) { $friendguids[] = $friend->getGUID(); } - return get_entities('object',$subtype,$friendguids, "time_created desc", $limit, $offset, false, 0, $friendguids, $timelower, $timeupper); + return elgg_get_entities(array( + 'type' => 'object', + 'subtype' => $subtype, + 'owner_guids' => $friendguids, + 'limit' => $limit, + 'offset' => $offset, + 'container_guids' => $friendguids, + 'created_time_lower' => $timelower, + 'created_time_upper' => $timeupper + )); } - return false; + return FALSE; } /** @@ -716,13 +764,21 @@ function get_user_friends_objects($user_guid, $subtype = "", $limit = 10, $offse * @param int $timeupper The latest time the entity can have been created. Default: all * @return int The number of objects */ -function count_user_friends_objects($user_guid, $subtype = "", $timelower = 0, $timeupper = 0) { +function count_user_friends_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $timelower = 0, $timeupper = 0) { if ($friends = get_user_friends($user_guid, "", 999999, 0)) { $friendguids = array(); foreach($friends as $friend) { $friendguids[] = $friend->getGUID(); } - return get_entities('object',$subtype,$friendguids, "time_created desc", null, null, true, 0, $friendguids, $timelower, $timeupper); + return elgg_get_entities(array( + 'type' => 'object', + 'subtype' => $subtype, + 'owner_guids' => $friendguids, + 'count' => TRUE, + 'container_guids' => $friendguids, + 'created_time_lower' => $timelower, + 'created_time_upper' => $timeupper + )); } return 0; } @@ -14,7 +14,7 @@ define('externalpage',true); require_once(dirname(__FILE__) . "/engine/start.php"); -if (!trigger_plugin_hook('index','system',null,false)) { +if (!trigger_plugin_hook('index', 'system', null, FALSE)) { /** * Check to see if user is logged in, if not display login form **/ @@ -27,10 +27,10 @@ if (!trigger_plugin_hook('index','system',null,false)) { global $CONFIG; $title = elgg_view_title(elgg_echo('content:latest')); set_context('search'); - $content = list_registered_entities(0,10,false,false,array('object','group')); + $content = elgg_list_registered_entities(array('limit' => 10, 'full_view' => FALSE, 'allowed_types' => array('object','group'))); set_context('main'); global $autofeed; - $autofeed = false; + $autofeed = FALSE; $content = elgg_view_layout('two_column_left_sidebar', '', $title . $content, elgg_view("account/forms/login")); page_draw(null, $content); } |