summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-10-28 02:27:09 +0000
committerDries Buytaert <dries@buytaert.net>2010-10-28 02:27:09 +0000
commit1d0f6479da4cdbd14b747ead6cb934a769a9579d (patch)
tree3875e9403a28aac4477a3531379c85b6b10cd660 /modules
parent0344a78d9643d97e1aff8ab94fec551bc091bfbc (diff)
downloadbrdo-1d0f6479da4cdbd14b747ead6cb934a769a9579d.tar.gz
brdo-1d0f6479da4cdbd14b747ead6cb934a769a9579d.tar.bz2
- Patch #839556 by jrchamp, dmitrig01: remove pointless usage of array_key_exists().
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block.module2
-rw-r--r--modules/comment/comment.module3
-rw-r--r--modules/field/modules/list/list.module2
-rw-r--r--modules/field_ui/field_ui.admin.inc2
-rw-r--r--modules/filter/filter.module14
-rw-r--r--modules/openid/openid.inc2
-rw-r--r--modules/openid/openid.module2
-rw-r--r--modules/profile/profile.admin.inc2
-rw-r--r--modules/system/image.gd.inc2
-rw-r--r--modules/system/system.api.php2
10 files changed, 16 insertions, 17 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 3a0be2520..7f0f21070 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -607,7 +607,7 @@ function block_theme_initialize($theme) {
$result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $block) {
// If the region isn't supported by the theme, assign the block to the theme's default region.
- if ($block['status'] && !array_key_exists($block['region'], $regions)) {
+ if ($block['status'] && !isset($regions[$block['region']])) {
$block['region'] = system_default_region($theme);
}
$block['theme'] = $theme;
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 52549f974..6b6dedb65 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2287,7 +2287,8 @@ function theme_comment_post_forbidden($variables) {
if (!isset($authenticated_post_comments)) {
// We only output a link if we are certain that users will get permission
// to post comments by logging in.
- $authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'skip comment approval'));
+ $comment_roles = user_roles(TRUE, 'post comments') + user_roles(TRUE, 'skip comment approval');
+ $authenticated_post_comments = isset($comment_roles[DRUPAL_AUTHENTICATED_RID]);
}
if ($authenticated_post_comments) {
diff --git a/modules/field/modules/list/list.module b/modules/field/modules/list/list.module
index 3ad913e58..7addd362d 100644
--- a/modules/field/modules/list/list.module
+++ b/modules/field/modules/list/list.module
@@ -261,7 +261,7 @@ function list_field_validate($entity_type, $entity, $field, $instance, $langcode
$allowed_values = list_allowed_values($field);
foreach ($items as $delta => $item) {
if (!empty($item['value'])) {
- if (count($allowed_values) && !array_key_exists($item['value'], $allowed_values)) {
+ if (!empty($allowed_values) && !isset($allowed_values[$item['value']])) {
$errors[$field['field_name']][$langcode][$delta][] = array(
'error' => 'list_illegal_value',
'message' => t('%name: illegal value.', array('%name' => t($instance['label']))),
diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc
index c88a51251..de77b9175 100644
--- a/modules/field_ui/field_ui.admin.inc
+++ b/modules/field_ui/field_ui.admin.inc
@@ -54,7 +54,7 @@ function field_ui_inactive_message($entity_type, $bundle) {
$list[] = t('%field (@field_name) field requires the %widget_type widget provided by %widget_module module', array(
'%field' => $instance['label'],
'@field_name' => $instance['field_name'],
- '%widget_type' => array_key_exists($instance['widget']['type'], $widget_types) ? $widget_types[$instance['widget']['type']]['label'] : $instance['widget']['type'],
+ '%widget_type' => isset($widget_types[$instance['widget']['type']]) ? $widget_types[$instance['widget']['type']]['label'] : $instance['widget']['type'],
'%widget_module' => $instance['widget']['module'],
));
}
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 617987421..5eb007fff 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -1301,14 +1301,12 @@ function _filter_html_tips($filter, $format, $long = FALSE) {
$header = array(t('Tag Description'), t('You Type'), t('You Get'));
preg_match_all('/<([a-z0-9]+)[^a-z0-9]/i', $allowed_html, $out);
foreach ($out[1] as $tag) {
- if (array_key_exists($tag, $tips)) {
- if ($tips[$tag]) {
- $rows[] = array(
- array('data' => $tips[$tag][0], 'class' => array('description')),
- array('data' => '<code>' . check_plain($tips[$tag][1]) . '</code>', 'class' => array('type')),
- array('data' => $tips[$tag][1], 'class' => array('get'))
- );
- }
+ if (!empty($tips[$tag])) {
+ $rows[] = array(
+ array('data' => $tips[$tag][0], 'class' => array('description')),
+ array('data' => '<code>' . check_plain($tips[$tag][1]) . '</code>', 'class' => array('type')),
+ array('data' => $tips[$tag][1], 'class' => array('get'))
+ );
}
else {
$rows[] = array(
diff --git a/modules/openid/openid.inc b/modules/openid/openid.inc
index 5a9326905..48af76669 100644
--- a/modules/openid/openid.inc
+++ b/modules/openid/openid.inc
@@ -501,7 +501,7 @@ function _openid_dh_rand($stop) {
// Used as the key for the duplicate cache
$rbytes = _openid_dh_long_to_binary($stop);
- if (array_key_exists($rbytes, $duplicate_cache)) {
+ if (isset($duplicate_cache[$rbytes])) {
list($duplicate, $nbytes) = $duplicate_cache[$rbytes];
}
else {
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index 7e7ebfd05..3e1b2c96b 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -932,7 +932,7 @@ function openid_verify_assertion_return_url($service, $response) {
// contains a number of other parameters added by the OpenID Provider.
parse_str(isset($return_to_parts['query']) ? $return_to_parts['query'] : '', $return_to_query_parameters);
foreach ($return_to_query_parameters as $name => $value) {
- if (!array_key_exists($name, $_GET) || $_GET[$name] != $value) {
+ if (!isset($_GET[$name]) || $_GET[$name] != $value) {
return FALSE;
}
}
diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc
index 864e847e0..9c20d3239 100644
--- a/modules/profile/profile.admin.inc
+++ b/modules/profile/profile.admin.inc
@@ -126,7 +126,7 @@ function theme_profile_admin_overview($variables) {
$category_number = 0;
foreach (element_children($form) as $key) {
// Don't take form control structures.
- if (array_key_exists('category', $form[$key])) {
+ if (isset($form[$key]['category'])) {
$field = &$form[$key];
$category = $field['category']['#default_value'];
diff --git a/modules/system/image.gd.inc b/modules/system/image.gd.inc
index 2f7a89fce..b10595f47 100644
--- a/modules/system/image.gd.inc
+++ b/modules/system/image.gd.inc
@@ -351,7 +351,7 @@ function image_gd_get_info(stdClass $image) {
if (isset($data) && is_array($data)) {
$extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
- $extension = array_key_exists($data[2], $extensions) ? $extensions[$data[2]] : '';
+ $extension = isset($extensions[$data[2]]) ? $extensions[$data[2]] : '';
$details = array(
'width' => $data[0],
'height' => $data[1],
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 262f53757..11780eec7 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2645,7 +2645,7 @@ function hook_file_url_alter(&$uri) {
// Serve files with one of the CDN extensions from CDN 1, all others from
// CDN 2.
$pathinfo = pathinfo($path);
- if (array_key_exists('extension', $pathinfo) && in_array($pathinfo['extension'], $cdn_extensions)) {
+ if (isset($pathinfo['extension']) && in_array($pathinfo['extension'], $cdn_extensions)) {
$uri = $cdn1 . '/' . $path;
}
else {