aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/private_settings.php
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-01 06:36:29 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-01 06:36:29 +0000
commitbeaaf5c3bdc700a872df2b7a39e268ce36cc0012 (patch)
treed0cb1da31f2895f01683ed8ae8b8a12617636efe /engine/lib/private_settings.php
parent95caad1ac699e356b424cc9151ce8c91e1cb6221 (diff)
downloadelgg-beaaf5c3bdc700a872df2b7a39e268ce36cc0012.tar.gz
elgg-beaaf5c3bdc700a872df2b7a39e268ce36cc0012.tar.bz2
Reversing 7975
git-svn-id: http://code.elgg.org/elgg/trunk@7978 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/private_settings.php')
-rw-r--r--engine/lib/private_settings.php163
1 files changed, 163 insertions, 0 deletions
diff --git a/engine/lib/private_settings.php b/engine/lib/private_settings.php
index 77641e122..bf81e4a3a 100644
--- a/engine/lib/private_settings.php
+++ b/engine/lib/private_settings.php
@@ -9,6 +9,169 @@
*/
/**
+ * Get entities based on their private data.
+ *
+ * @param string $name The name of the setting
+ * @param string $value The value of the setting
+ * @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 string $order_by The field to order by; by default, time_created desc
+ * @param int $limit The number of entities to return; 10 by default
+ * @param int $offset The indexing offset, 0 by default
+ * @param boolean $count Return a count of entities
+ * @param int $site_guid The site to get entities for. 0 for current, -1 for any
+ * @param mixed $container_guid The container(s) GUIDs
+ *
+ * @return array A list of entities.
+ * @deprecated 1.8
+ */
+function get_entities_from_private_setting($name = "", $value = "", $type = "", $subtype = "",
+$owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0,
+$container_guid = null) {
+ elgg_deprecated_notice('get_entities_from_private_setting() was deprecated by elgg_get_entities_from_private_setting()!', 1.8);
+
+ $options = array();
+
+ $options['private_setting_name'] = $name;
+ $options['private_setting_value'] = $value;
+
+ // set container_guid to owner_guid to emulate old functionality
+ if ($owner_guid != "") {
+ if (is_null($container_guid)) {
+ $container_guid = $owner_guid;
+ }
+ }
+
+ if ($type) {
+ $options['types'] = $type;
+ }
+
+ if ($subtype) {
+ $options['subtypes'] = $subtype;
+ }
+
+ if ($owner_guid) {
+ if (is_array($owner_guid)) {
+ $options['owner_guids'] = $owner_guid;
+ } else {
+ $options['owner_guid'] = $owner_guid;
+ }
+ }
+
+ if ($container_guid) {
+ if (is_array($container_guid)) {
+ $options['container_guids'] = $container_guid;
+ } else {
+ $options['container_guid'] = $container_guid;
+ }
+ }
+
+ $options['limit'] = $limit;
+
+ if ($offset) {
+ $options['offset'] = $offset;
+ }
+
+ if ($order_by) {
+ $options['order_by'];
+ }
+
+ if ($site_guid) {
+ $options['site_guid'];
+ }
+
+ if ($count) {
+ $options['count'] = $count;
+ }
+
+ return elgg_get_entities_from_private_settings($options);
+}
+
+/**
+ * Get entities based on their private data by multiple keys.
+ *
+ * @param string $name The name of the setting
+ * @param mixed $type Entity type
+ * @param string $subtype Entity subtype
+ * @param int $owner_guid The GUID of the owning user
+ * @param string $order_by The field to order by; by default, time_created desc
+ * @param int $limit The number of entities to return; 10 by default
+ * @param int $offset The indexing offset, 0 by default
+ * @param bool $count Count entities
+ * @param int $site_guid Site GUID. 0 for current, -1 for any.
+ * @param mixed $container_guid Container GUID
+ *
+ * @return array A list of entities.
+ * @deprecated 1.8
+ */
+function get_entities_from_private_setting_multi(array $name, $type = "", $subtype = "",
+$owner_guid = 0, $order_by = "", $limit = 10, $offset = 0, $count = false,
+$site_guid = 0, $container_guid = null) {
+
+ elgg_deprecated_notice('get_entities_from_private_setting_multi() was deprecated by elgg_get_entities_from_private_setting()!', 1.8);
+
+ $options = array();
+
+ $pairs = array();
+ foreach ($name as $setting_name => $setting_value) {
+ $pairs[] = array('name' => $setting_name, 'value' => $setting_value);
+ }
+ $options['private_setting_name_value_pairs'] = $pairs;
+
+ // set container_guid to owner_guid to emulate old functionality
+ if ($owner_guid != "") {
+ if (is_null($container_guid)) {
+ $container_guid = $owner_guid;
+ }
+ }
+
+ if ($type) {
+ $options['types'] = $type;
+ }
+
+ if ($subtype) {
+ $options['subtypes'] = $subtype;
+ }
+
+ if ($owner_guid) {
+ if (is_array($owner_guid)) {
+ $options['owner_guids'] = $owner_guid;
+ } else {
+ $options['owner_guid'] = $owner_guid;
+ }
+ }
+
+ if ($container_guid) {
+ if (is_array($container_guid)) {
+ $options['container_guids'] = $container_guid;
+ } else {
+ $options['container_guid'] = $container_guid;
+ }
+ }
+
+ $options['limit'] = $limit;
+
+ if ($offset) {
+ $options['offset'] = $offset;
+ }
+
+ if ($order_by) {
+ $options['order_by'];
+ }
+
+ if ($site_guid) {
+ $options['site_guid'];
+ }
+
+ if ($count) {
+ $options['count'] = $count;
+ }
+
+ return elgg_get_entities_from_private_settings($options);
+}
+
+/**
* Returns entities based upon private settings. Also accepts all
* options available to elgg_get_entities(). Supports
* the singular option shortcut.