diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-02-17 19:43:49 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-02-17 19:43:49 +0000 |
commit | b3012350e2d8dafaf696e2c472f8cf0ae5e1674b (patch) | |
tree | cc0dd15d97f2a8846448823eae1555d280e9623a /engine/lib/elgglib.php | |
parent | ccb5a69319a6a367988534296c678c8abf322879 (diff) | |
download | elgg-b3012350e2d8dafaf696e2c472f8cf0ae5e1674b.tar.gz elgg-b3012350e2d8dafaf696e2c472f8cf0ae5e1674b.tar.bz2 |
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
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r-- | engine/lib/elgglib.php | 24 |
1 files changed, 15 insertions, 9 deletions
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 |