aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 17:33:12 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-31 17:33:12 +0000
commit9124bf4a77eb91f599cc806cb4a41bac529c3a12 (patch)
tree09486a558d25b7d0dca9b11eee2241889f1ec4a0 /engine
parented8487f155047c79d427e25c32cb93cd1cbcc3ac (diff)
downloadelgg-9124bf4a77eb91f599cc806cb4a41bac529c3a12.tar.gz
elgg-9124bf4a77eb91f599cc806cb4a41bac529c3a12.tar.bz2
Refs #2684, #2754: Merged r7701 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@7796 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/entities.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 339b7755d..e38b0f924 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -2182,7 +2182,7 @@ function default_entity_icon_hook($hook, $entity_type, $returnvalue, $params) {
* @link http://docs.elgg.org/Search
* @link http://docs.elgg.org/Tutorials/Search
*/
-function register_entity_type($type, $subtype) {
+function register_entity_type($type, $subtype=null) {
global $CONFIG;
$type = strtolower($type);
@@ -2255,13 +2255,13 @@ function unregister_entity_type($type, $subtype) {
* @return array|false Depending on whether entities have been registered
* @see register_entity_type()
*/
-function get_registered_entity_types($type = '') {
+function get_registered_entity_types($type = null) {
global $CONFIG;
if (!isset($CONFIG->registered_entities)) {
return false;
}
- if (!empty($type)) {
+ if ($type) {
$type = strtolower($type);
}
if (!empty($type) && empty($CONFIG->registered_entities[$type])) {
@@ -2283,19 +2283,25 @@ function get_registered_entity_types($type = '') {
*
* @return true|false Depending on whether or not the type has been registered
*/
-function is_registered_entity_type($type, $subtype) {
+function is_registered_entity_type($type, $subtype=null) {
global $CONFIG;
if (!isset($CONFIG->registered_entities)) {
return false;
}
+
$type = strtolower($type);
- if (empty($CONFIG->registered_entities[$type])) {
+
+ // @todo registering a subtype implicitly registers the type.
+ // see #2684
+ if (!isset($CONFIG->registered_entities[$type])) {
return false;
}
- if (in_array($subtype, $CONFIG->registered_entities[$type])) {
- return true;
+
+ if ($subtype && !in_array($subtype, $CONFIG->registered_entities[$type])) {
+ return false;
}
+ return true;
}
/**
@@ -2569,4 +2575,4 @@ elgg_register_plugin_hook_handler('volatile', 'metadata', 'volatile_data_export_
elgg_register_plugin_hook_handler('entity:icon:url', 'all', 'default_entity_icon_hook', 1000);
/** Register init system event **/
-elgg_register_event_handler('init', 'system', 'entities_init'); \ No newline at end of file
+elgg_register_event_handler('init', 'system', 'entities_init');