aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-08 02:07:34 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-08 02:07:34 +0000
commit567591c5f1d3c51d9062c47de6951a1a116c44a9 (patch)
tree17e39bf29cf39386f74a7ff07ca7429ccb487922
parent02e0a58f8907c66a0dbe7241621e5ad0bb264426 (diff)
downloadelgg-567591c5f1d3c51d9062c47de6951a1a116c44a9.tar.gz
elgg-567591c5f1d3c51d9062c47de6951a1a116c44a9.tar.bz2
elgg_get_entities_from_metadata() and egef_annotations() support singular -> plural rewrites. (Why didn't I add this originally?!)
git-svn-id: http://code.elgg.org/elgg/trunk@6390 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/annotations.php17
-rw-r--r--engine/lib/metadata.php3
2 files changed, 13 insertions, 7 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 13e7ed790..ac002f394 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -297,16 +297,16 @@ $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $time
} else {
$entity_guid = (int)$entity_guid;
}
-
+
$entity_type = sanitise_string($entity_type);
-
+
if ($entity_subtype) {
if (!$entity_subtype = get_subtype_id($entity_type, $entity_subtype)) {
// requesting a non-existing subtype: return false
return FALSE;
}
}
-
+
if ($name) {
$name = get_metastring_id($name);
@@ -465,6 +465,9 @@ function elgg_get_entities_from_annotations(array $options = array()) {
$options = array_merge($defaults, $options);
+ $singulars = array('annotation_name', 'annotation_value', 'annotation_name_value_pair', 'annotation_owner_guid');
+ $options = elgg_normalise_plural_options_array($options, $singulars);
+
if (!$options = elgg_entities_get_metastrings_options('annotation', $options)) {
return FALSE;
}
@@ -737,14 +740,14 @@ function __get_annotations_calculate_x($sum = "avg", $entity_guid, $entity_type
$entity_type = sanitise_string($entity_type);
$timeupper = (int)$timeupper;
$timelower = (int)$timelower;
-
+
if ($entity_subtype) {
if (!$entity_subtype = get_subtype_id($entity_type, $entity_subtype)) {
// requesting a non-existing subtype: return false
return FALSE;
}
}
-
+
if ($name != '' AND !$name = get_metastring_id($name)) {
return 0;
}
@@ -837,14 +840,14 @@ function __get_entities_from_annotations_calculate_x($sum = "sum", $entity_type
$sum = sanitise_string($sum);
$entity_type = sanitise_string($entity_type);
-
+
if ($entity_subtype) {
if (!$entity_subtype = get_subtype_id($entity_type, $entity_subtype)) {
// requesting a non-existing subtype: return false
return FALSE;
}
}
-
+
$name = get_metastring_id($name);
$limit = (int) $limit;
$offset = (int) $offset;
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index d9b310b15..d28999a77 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -581,6 +581,9 @@ function elgg_get_entities_from_metadata(array $options = array()) {
$options = array_merge($defaults, $options);
+ $singulars = array('metadata_name', 'metadata_value', 'metadata_name_value_pair', 'metadata_owner_guid');
+ $options = elgg_normalise_plural_options_array($options, $singulars);
+
if (!$options = elgg_entities_get_metastrings_options('metadata', $options)) {
return FALSE;
}