Mercurial > defr > drupal > scald > dnd
diff dnd.module @ 7:e6378dbabe45
Added conditional logic to prevent choking on missing json data.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Thu, 19 Feb 2009 14:10:13 -0500 |
parents | ea5d7834d0dc |
children | b9cd179a30a8 a5b2b9fa2a1a |
line wrap: on
line diff
--- a/dnd.module Thu Feb 19 14:04:31 2009 -0500 +++ b/dnd.module Thu Feb 19 14:10:13 2009 -0500 @@ -120,7 +120,6 @@ if (!isset($url['scheme'])) { $settings['url'] = $base_url .'/'. $settings['url']; } - dpm($settings); $request = drupal_http_request($settings['url']); @@ -128,8 +127,10 @@ $json = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $request->data), TRUE); // Generate an array of editor representations to add - foreach ($json['editor_representations'] as $editor_id=>$editor_item) { - $editor_representations[$editor_id] = filter_xss_admin($editor_item); + if (is_array($json['editor_representations'])) { + foreach ($json['editor_representations'] as $editor_id=>$editor_item) { + $editor_representations[$editor_id] = filter_xss_admin($editor_item); + } } // Store editor representations in Drupal setting