From 9ce11d138f9868b872fe8206dbc3c2f44723605a Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 15 Feb 2011 01:05:45 +0000 Subject: Fixes #2808: elgg_get_array_value => elgg_extract git-svn-id: http://code.elgg.org/elgg/trunk@8247 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggBatch.php | 4 ++-- engine/classes/ElggPluginManifest.php | 2 +- engine/lib/admin.php | 4 ++-- engine/lib/annotations.php | 2 +- engine/lib/elgglib.php | 2 +- engine/lib/metastrings.php | 4 ++-- engine/lib/plugins.php | 6 +++--- engine/lib/river.php | 2 +- engine/lib/views.php | 2 +- engine/lib/xml.php | 4 ++-- 10 files changed, 16 insertions(+), 16 deletions(-) (limited to 'engine') diff --git a/engine/classes/ElggBatch.php b/engine/classes/ElggBatch.php index a5051d16a..5c2172ae7 100644 --- a/engine/classes/ElggBatch.php +++ b/engine/classes/ElggBatch.php @@ -164,8 +164,8 @@ class ElggBatch } // store these so we can compare later - $this->offset = elgg_get_array_value('offset', $options, 0); - $this->limit = elgg_get_array_value('limit', $options, 10); + $this->offset = elgg_extract('offset', $options, 0); + $this->limit = elgg_extract('limit', $options, 10); // if passed a callback, create a new ElggBatch with the same options // and pass each to the callback. diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index e230cd3f2..fae12de10 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -659,7 +659,7 @@ class ElggPluginManifest { $return = array(); foreach ($struct as $index => $default) { - $return[$index] = elgg_get_array_value($index, $array, $default); + $return[$index] = elgg_extract($index, $array, $default); } return $return; diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 6d0b60101..854a978b5 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -345,9 +345,9 @@ function admin_settings_page_handler($page) { function admin_plugin_screenshot_page_handler($pages) { admin_gatekeeper(); - $plugin_id = elgg_get_array_value(0, $pages); + $plugin_id = elgg_extract(0, $pages); // only thumbnail or full. - $size = elgg_get_array_value(1, $pages, 'thumbnail'); + $size = elgg_extract(1, $pages, 'thumbnail'); // the rest of the string is the filename $filename_parts = array_slice($pages, 2); diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 0235476f2..d2f2c6386 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -405,7 +405,7 @@ function elgg_get_entities_from_annotation_calculation($options) { $options = array_merge($defaults, $options); - $function = sanitize_string(elgg_get_array_value('calculation', $options, 'sum', false)); + $function = sanitize_string(elgg_extract('calculation', $options, 'sum', false)); // you must cast this as an int or it sorts wrong. $options['selects'][] = "$function(cast(msv.string as signed)) as calculated"; diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index fbd33b219..e9ae8b0ad 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1432,7 +1432,7 @@ function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset * @return void * @since 1.8.0 */ -function elgg_get_array_value($key, array $array, $default = NULL, $strict = true) { +function elgg_extract($key, array $array, $default = NULL, $strict = true) { if ($strict) { return (isset($array[$key])) ? $array[$key] : $default; } else { diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 8c702239b..8f9debcc0 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -580,8 +580,8 @@ function elgg_normalize_metastrings_options(array $options = array()) { // support either metastrings_type or metastring_type // because I've made this mistake many times and hunting it down is a pain... - $type = elgg_get_array_value('metastring_type', $options, null); - $type = elgg_get_array_value('metastrings_type', $options, $type); + $type = elgg_extract('metastring_type', $options, null); + $type = elgg_extract('metastrings_type', $options, $type); $options['metastring_type'] = $type; diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index b8fd321a8..872984751 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -657,9 +657,9 @@ function elgg_check_plugins_provides($type, $name, $version = null, $comparison * @return array */ function elgg_get_plugin_dependency_strings($dep) { - $dep_system = elgg_get_array_value('type', $dep); - $info = elgg_get_array_value('dep', $dep); - $type = elgg_get_array_value('type', $info); + $dep_system = elgg_extract('type', $dep); + $info = elgg_extract('dep', $dep); + $type = elgg_extract('type', $info); if (!$dep_system || !$info || !$type) { return false; diff --git a/engine/lib/river.php b/engine/lib/river.php index 43a1c38d5..4cb9c30f4 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -515,7 +515,7 @@ function elgg_river_page_handler($page) { elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); - $page_type = elgg_get_array_value(0, $page, 'all'); + $page_type = elgg_extract(0, $page, 'all'); if ($page_type == 'owner') { $page_type = 'mine'; } diff --git a/engine/lib/views.php b/engine/lib/views.php index 1e0ce3764..865212a06 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -681,7 +681,7 @@ function elgg_view_menu($menu_name, array $vars = array()) { $vars['name'] = $menu_name; - $sort_by = elgg_get_array_value('sort_by', $vars, 'title'); + $sort_by = elgg_extract('sort_by', $vars, 'title'); $menu = $CONFIG->menus[$menu_name]; diff --git a/engine/lib/xml.php b/engine/lib/xml.php index 55ea1b5ad..813bc4ee0 100644 --- a/engine/lib/xml.php +++ b/engine/lib/xml.php @@ -127,8 +127,8 @@ function xml_to_object($xml) { if ($tag['type'] == "complete" || $tag['type'] == "open") { $elements[$index] = new XmlElement; $elements[$index]->name = $tag['tag']; - $elements[$index]->attributes = elgg_get_array_value('attributes', $tag, ''); - $elements[$index]->content = elgg_get_array_value('value', $tag, ''); + $elements[$index]->attributes = elgg_extract('attributes', $tag, ''); + $elements[$index]->content = elgg_extract('value', $tag, ''); if ($tag['type'] == "open") { $elements[$index]->children = array(); -- cgit v1.2.3