diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-11 10:18:29 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-11 10:18:29 +0000 |
commit | bf1e40afcf8da4ea6e9d663531dfe3bc934483dc (patch) | |
tree | 374a9b640ab1cf21948fc466eeecda4c826882b7 /engine/lib/entities.php | |
parent | b805a9bd7f1356e66fed15ced2c591cf4e9071fc (diff) | |
download | elgg-bf1e40afcf8da4ea6e9d663531dfe3bc934483dc.tar.gz elgg-bf1e40afcf8da4ea6e9d663531dfe3bc934483dc.tar.bz2 |
Added a search submenu.
git-svn-id: https://code.elgg.org/elgg/trunk@1819 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index c938727ff..4cbc4eccc 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1866,6 +1866,70 @@ return $url; } + }
+
+ /**
+ * Registers and entity type and subtype to return in search and other places.
+ * A description in the elgg_echo languages file of the form item:type:subtype
+ * is also expected.
+ *
+ * @param string $type The type of entity (object, site, user, group)
+ * @param string $subtype The subtype to register (may be blank)
+ * @return true|false Depending on success
+ */
+ function register_entity_type($type, $subtype) {
+
+ global $CONFIG;
+
+ $type = strtolower($type);
+ if (!in_array($type,array('object','site','group','user'))) return false;
+
+ if (!isset($CONFIG->registered_entities)) $CONFIG->registered_entities = array();
+ $CONFIG->registered_entities[$type][] = $subtype;
+
+ return true;
+
+ }
+
+ /**
+ * Returns registered entity types and subtypes
+ *
+ * @see register_entity_type
+ *
+ * @param string $type The type of entity (object, site, user, group) or blank for all
+ * @return array|false Depending on whether entities have been registered
+ */
+ function get_registered_entity_types($type = '') {
+
+ global $CONFIG;
+
+ if (!isset($CONFIG->registered_entities)) return false;
+ if (!empty($type)) $type = strtolower($type);
+ if (!empty($type) && empty($CONFIG->registered_entities[$type])) return false;
+
+ if (empty($type))
+ return $CONFIG->registered_entities;
+
+ return $CONFIG->registered_entities[$type];
+
+ }
+
+ /**
+ * Determines whether or not the specified entity type and subtype have been registered in the system
+ *
+ * @param string $type The type of entity (object, site, user, group)
+ * @param string $subtype The subtype (may be blank)
+ * @return true|false Depending on whether or not the type has been registered
+ */
+ function is_registered_entity_type($type, $subtype) {
+
+ global $CONFIG;
+
+ if (!isset($CONFIG->registered_entities)) return false;
+ $type = strtolower($type);
+ if (empty($CONFIG->registered_entities[$type])) return false;
+ if (in_array($subtype, $CONFIG->registered_entities[$type])) return true;
+
} /** |