diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-13 23:51:42 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-13 23:51:42 +0000 |
commit | 7a217d76ab5eba957486333f861b45ad8ba08f21 (patch) | |
tree | a1977d102c1a4b41d9c374b8b2ca30784e33dae9 /engine | |
parent | 8ef2424123c8d07d418a191c20577a3e00ff2a78 (diff) | |
download | elgg-7a217d76ab5eba957486333f861b45ad8ba08f21.tar.gz elgg-7a217d76ab5eba957486333f861b45ad8ba08f21.tar.bz2 |
Allowing metastrings_type for metastring-based object functions.
git-svn-id: http://code.elgg.org/elgg/trunk@8211 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/metastrings.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 958afa1bf..3367b433f 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -231,10 +231,7 @@ function delete_orphaned_metastrings() { * @access private */ function elgg_get_metastring_based_objects($options) { - - if (!isset($options['metastring_type'])) { - return false; - } + $options = elgg_normalize_metastrings_options($options); switch ($options['metastring_type']) { case 'metadata': @@ -252,8 +249,6 @@ function elgg_get_metastring_based_objects($options) { return false; } - $options = elgg_normalize_metastrings_options($options); - $defaults = array( // entities 'types' => ELGG_ENTITIES_ANY_VALUE, @@ -580,6 +575,14 @@ function elgg_get_metastring_sql($table, $names = null, $values = null, * @return array */ function elgg_normalize_metastrings_options(array $options = array()) { + + // support either metastrings_type or metastring_type + // because I've made this mistake many times and hunting it down is a pain... + $type = elgg_get_array_value('metastring_type', $options, null); + $type = elgg_get_array_value('metastrings_type', $options, $type); + + $options['metastring_type'] = $type; + $prefixes = array('metadata_', 'annotation_'); // map the metadata_* options to metastring_* options |