From b3012350e2d8dafaf696e2c472f8cf0ae5e1674b Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 17 Feb 2010 19:43:49 +0000 Subject: Refs #1523: elgg_get_entities() uses the constants for defaults and conditionals. Added some tests to check for no subtypes. Updated the documentation. git-svn-id: http://code.elgg.org/elgg/trunk@3946 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'engine/lib/elgglib.php') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 328316686..43dba4a43 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -2327,7 +2327,10 @@ function elgg_normalise_plural_options_array($options, $singulars) { $plural = $singular . 's'; // normalize the singular to plural - if (isset($options[$singular]) && $options[$singular] !== NULL && $options[$singular] !== FALSE) { + // isset() returns FALSE for array values of NULL, so they are ignored. + // everything else falsy is included. + //if (isset($options[$singular]) && $options[$singular] !== NULL && $options[$singular] !== FALSE) { + if (isset($options[$singular])) { if (isset($options[$plural])) { if (is_array($options[$plural])) { $options[$plural][] = $options[$singlar]; @@ -2338,7 +2341,7 @@ function elgg_normalise_plural_options_array($options, $singulars) { $options[$plural] = array($options[$singular]); } } - $options[$singular] = NULL; + unset($options[$singular]); } return $options; @@ -2731,12 +2734,15 @@ function elgg_api_test($hook, $type, $value, $params) { /** * Some useful constant definitions */ -define('ACCESS_DEFAULT',-1); -define('ACCESS_PRIVATE',0); -define('ACCESS_LOGGED_IN',1); -define('ACCESS_PUBLIC',2); -define('ACCESS_FRIENDS',-2); +define('ACCESS_DEFAULT', -1); +define('ACCESS_PRIVATE', 0); +define('ACCESS_LOGGED_IN', 1); +define('ACCESS_PUBLIC', 2); +define('ACCESS_FRIENDS', -2); -register_elgg_event_handler('init','system','elgg_init'); -register_elgg_event_handler('boot','system','elgg_boot',1000); +define('ELGG_ENTITIES_ANY_VALUE', NULL); +define('ELGG_ENTITIES_NO_VALUE', 0); + +register_elgg_event_handler('init', 'system', 'elgg_init'); +register_elgg_event_handler('boot', 'system', 'elgg_boot', 1000); register_plugin_hook('unit_test', 'system', 'elgg_api_test'); \ No newline at end of file -- cgit v1.2.3