diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-12 21:33:56 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-12 21:33:56 +0000 |
commit | 555b567e9156dc217f3b28dfe65d6f4d0c24f4ab (patch) | |
tree | 2cc60c3ca41bf19d57288bdfcf485be4218d0cbb /engine/lib/deprecated-1.8.php | |
parent | a8d8681569d5a44723704e3990b0938f8486cb3d (diff) | |
download | elgg-555b567e9156dc217f3b28dfe65d6f4d0c24f4ab.tar.gz elgg-555b567e9156dc217f3b28dfe65d6f4d0c24f4ab.tar.bz2 |
Refs #650: Deprecated find_metadata() with elgg_get_metadata(). Deprecated get_metadata_for_entity() and get_metadata_byname() <twitch>. Added elgg_get_metastrings_based_objects() to deal with the commonalities between the metadata and annotation getter functions.
git-svn-id: http://code.elgg.org/elgg/trunk@8174 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/deprecated-1.8.php')
-rw-r--r-- | engine/lib/deprecated-1.8.php | 108 |
1 files changed, 103 insertions, 5 deletions
diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index 37f9d7fdd..4e8b02d28 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -3107,8 +3107,8 @@ function clear_all_plugin_settings($plugin_id = "") { function get_annotations($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $timelower = 0, $timeupper = 0, $entity_owner_guid = 0) { - global $CONFIG; + elgg_deprecated_notice('get_annotations() is deprecated by elgg_get_annotations()', 1.8); $options = array(); if ($entity_guid) { @@ -3139,7 +3139,7 @@ $timeupper = 0, $entity_owner_guid = 0) { $options['offset'] = $offset; if ($order_by == 'desc') { - $options['order_by'] = 'a.time_created desc'; + $options['order_by'] = 'n_table.time_created desc'; } if ($timelower) { @@ -3181,7 +3181,7 @@ function list_annotations($entity_guid, $name = "", $limit = 25, $asc = true) { $options = array( 'guid' => $entity_guid, 'limit' => $limit, - 'order_by' => "a.time_created $asc" + 'order_by' => "n_table.time_created $asc" ); return elgg_list_annotations($options); @@ -3233,7 +3233,7 @@ $timeupper = 0, $calculation = '') { } if ($order_by == 'desc') { - $options['order_by'] = 'a.time_created desc'; + $options['order_by'] = 'n_table.time_created desc'; } if ($timelower) { @@ -3479,4 +3479,102 @@ function set_view_location($view, $location, $viewtype = '') { function register_entity_url_handler($function_name, $entity_type = "all", $entity_subtype = "all") { elgg_deprecated_notice("register_entity_url_handler() was deprecated by elgg_register_entity_url_handler()", 1.8); return elgg_register_entity_url_handler($entity_type, $entity_subtype, $function_name); -}
\ No newline at end of file +} + + +/** + * Get the metadata where the entities they are referring to match a given criteria. + * + * @param mixed $meta_name Metadata name + * @param mixed $meta_value Metadata value + * @param string $entity_type The type of entity to look for, eg 'site' or 'object' + * @param string $entity_subtype The subtype of the entity. + * @param int $limit Limit + * @param int $offset Offset + * @param string $order_by Optional ordering. + * @param int $site_guid Site GUID. 0 for current, -1 for any + * + * @return mixed + * @deprecated 1.8 Use elgg_get_metadata() + */ +function find_metadata($meta_name = "", $meta_value = "", $entity_type = "", $entity_subtype = "", + $limit = 10, $offset = 0, $order_by = "", $site_guid = 0) { + + elgg_deprecated_notice('get_metadata() is deprecated by elgg_get_metadata()', 1.8); + + $options = array(); + + if ($meta_name) { + $options['annotation_name'] = $meta_name; + } + + if ($meta_value) { + $options['annotation_value'] = $meta_value; + } + + if ($entity_type) { + $options['type'] = $entity_type; + } + + if ($entity_subtype) { + $options['subtype'] = $entity_subtype; + } + + $options['limit'] = $limit; + $options['offset'] = $offset; + + if ($order_by == 'desc') { + $options['order_by'] = 'n_table.time_created desc'; + } + + if ($site_guid) { + $options['site_guid'] = $site_guid; + } + + return elgg_get_metadata($options); +} + + +/** + * Get metadata objects by name. + * + * @param int $entity_guid Entity GUID + * @param string $meta_name Metadata name + * + * @return mixed ElggMetadata object, an array of ElggMetadata or false. + * @deprecated 1.8 Use elgg_get_metadata() + */ +function get_metadata_byname($entity_guid, $meta_name) { + elgg_deprecated_notice('get_metadata_byname() is deprecated by elgg_get_metadata()', 1.8); + + $options = array( + 'guid' => $entity_guid, + 'metadata_name' => $meta_name + ); + + $md = elgg_get_metadata($options); + + if ($md && count($md) == 1) { + return $md[0]; + } + + return $md; +} + +/** + * Return all the metadata for a given GUID. + * + * @param int $entity_guid Entity GUID + * + * @return mixed + * @deprecated 1.8 Use elgg_get_metadata() + */ +function get_metadata_for_entity($entity_guid) { + elgg_deprecated_notice('get_metadata_for_entity() is deprecated by elgg_get_metadata()', 1.8); + + $options = array( + 'guid' => $entity_guid + ); + + return elgg_get_metadata($options); +} |