You are here

function _messaging_debug_format_object in Messaging 6.2

Same name and namespace in other branches
  1. 6.3 messaging_debug/messaging_debug.module \_messaging_debug_format_object()

Format objects/array in logs

1 call to _messaging_debug_format_object()
_messaging_debug_format_log in messaging_debug/messaging_debug.module
Format complex log as collapsible fieldset

File

messaging_debug/messaging_debug.module, line 349
Simple messaging using html page. Messaging method plug-in

Code

function _messaging_debug_format_object($data, $name) {
  $rows = array();
  foreach ($data as $key => $value) {
    if (is_object($value) || is_array($value)) {
      $content = _messaging_debug_format_object($value, $key);
    }
    else {

      // Make line endings visible
      $content = str_replace("\n", '\\n<br />', check_plain($value));
    }
    $rows[] = array(
      check_plain($key),
      $content,
    );
  }
  $header = array(
    check_plain($name),
    is_object($data) ? t('Object') : t('Array'),
  );
  return theme('table', $header, $rows);
}