aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-01 19:41:21 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-01 19:41:21 +0000
commit1f669812407501050980057021b44b65d5ccff74 (patch)
treef12e8c4839cbeb8729a7f78b08da9b052d2232d0 /engine/lib
parentc13882f685cbad429f323808427207c4dbdef826 (diff)
downloadelgg-1f669812407501050980057021b44b65d5ccff74.tar.gz
elgg-1f669812407501050980057021b44b65d5ccff74.tar.bz2
Added elgg_get_array_value() helper function.
git-svn-id: http://code.elgg.org/elgg/trunk@6312 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 7a3e47e7d..f890b3518 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -3419,6 +3419,7 @@ function elgg_walled_garden() {
*
* @param string $view_type
* @return bool
+ * @since 1.7
*/
function elgg_is_valid_view_type($view_type) {
global $CONFIG;
@@ -3427,6 +3428,21 @@ function elgg_is_valid_view_type($view_type) {
}
/**
+ * Checks for $array[$key] and returns its value if it exists, else
+ * returns $default.
+ *
+ * Shorthand for $value = (isset($array['key'])) ? $array['key'] : 'default';
+ *
+ * @param string $key The key to check.
+ * @param array $array The array to check against.
+ * @param mixed $default Default value to return if nothing is found.
+ * @since 1.8
+ */
+function elgg_get_array_value($key, array $array, $default = NULL) {
+ return (isset($array[$key])) ? $array[$key] : $default;
+}
+
+/**
* Some useful constant definitions
*/
define('ACCESS_DEFAULT', -1);