aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metadata.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-03-13 02:13:17 +0100
committerSem <sembrestels@riseup.net>2013-03-13 02:13:17 +0100
commitd730a0c5861c2e79faa3e58dd2b171ca4d197c6f (patch)
treecb4658e1c60a60c5f663845d49b108dd4608a89a /engine/lib/metadata.php
parent0fb3e5396d10d21323eb3bbc04727fd4a5a6d06d (diff)
parent34b14b305f5a106316fdc403c4ce80b25e89b51d (diff)
downloadelgg-d730a0c5861c2e79faa3e58dd2b171ca4d197c6f.tar.gz
elgg-d730a0c5861c2e79faa3e58dd2b171ca4d197c6f.tar.bz2
Merge tag '1.8.14' of git://github.com/Elgg/Elgg into foxglove-3
Elgg 1.8.14 Conflicts: mod/tinymce/vendor/tinymce/jscripts/tiny_mce/langs/en.js mod/tinymce/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r--engine/lib/metadata.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index f76c20f24..305e9918b 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -277,10 +277,18 @@ $access_id = ACCESS_PRIVATE, $allow_multiple = false) {
* all metadata that match the query instead of returning
* ElggMetadata objects.
*
- * @return mixed
+ * @return ElggMetadata[]|mixed
* @since 1.8.0
*/
function elgg_get_metadata(array $options = array()) {
+
+ // @todo remove support for count shortcut - see #4393
+ // support shortcut of 'count' => true for 'metadata_calculation' => 'count'
+ if (isset($options['count']) && $options['count']) {
+ $options['metadata_calculation'] = 'count';
+ unset($options['count']);
+ }
+
$options['metastring_type'] = 'metadata';
return elgg_get_metastring_based_objects($options);
}
@@ -302,11 +310,14 @@ function elgg_delete_metadata(array $options) {
if (!elgg_is_valid_options_for_batch_operation($options, 'metadata')) {
return false;
}
+ $options['metastring_type'] = 'metadata';
+ $result = elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
+ // This moved last in case an object's constructor sets metadata. Currently the batch
+ // delete process has to create the entity to delete its metadata. See #5214
elgg_get_metadata_cache()->invalidateByOptions('delete', $options);
- $options['metastring_type'] = 'metadata';
- return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback', false);
+ return $result;
}
/**
@@ -412,7 +423,7 @@ function elgg_enable_metadata(array $options) {
*
* metadata_owner_guids => NULL|ARR guids for metadata owners
*
- * @return mixed If count, int. If not count, array. false on errors.
+ * @return ElggEntity[]|mixed If count, int. If not count, array. false on errors.
* @since 1.7.0
*/
function elgg_get_entities_from_metadata(array $options = array()) {
@@ -461,7 +472,7 @@ function elgg_get_entities_from_metadata(array $options = array()) {
* @param array|null $order_by_metadata Array of names / direction
* @param array|null $owner_guids Array of owner GUIDs
*
- * @return FALSE|array False on fail, array('joins', 'wheres')
+ * @return false|array False on fail, array('joins', 'wheres')
* @since 1.7.0
* @access private
*/
@@ -774,10 +785,10 @@ function string_to_tag_array($string) {
$ar = explode(",", $string);
$ar = array_map('trim', $ar);
$ar = array_filter($ar, 'is_not_null');
+ $ar = array_map('strip_tags', $ar);
return $ar;
}
return false;
-
}
/**