]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Allowing metastrings_type for metastring-based object functions.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 13 Feb 2011 23:51:42 +0000 (23:51 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 13 Feb 2011 23:51:42 +0000 (23:51 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8211 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/metastrings.php

index 958afa1bf32fdcdfe10c2bf368983cacc37b24e9..3367b433f7db8a3714ba90ea770b7d5d61a519c2 100644 (file)
@@ -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