You are here

function _ldaphelp_parse_status_to_text in LDAP integration 6

1 call to _ldaphelp_parse_status_to_text()
ldaphelp_status in ldaphelp/ldaphelp_status.inc

File

ldaphelp/ldaphelp_status.inc, line 349
status file for ldaphelp module

Code

function _ldaphelp_parse_status_to_text($status, $heading, $replacements = array()) {
  $var_del = "\r\n------------------------------------------------\r\n";
  $section_del = "\r\n================================================\r\n";
  $name_val_del = ":\r\n";
  $lr = "\r\n";
  $replacements = array_merge($replacements, array(
    '<br/>' => $lr,
    '<ul>' => $lr,
    '</ul>' => $lr,
    '<li>' => $lr,
    '</li>' => "",
    "<code>" => "",
    "</code>" => "",
    "<strong>" => "",
    "</strong>" => "",
  ));
  $content = $section_del . drupal_strtoupper($heading) . $section_del;
  foreach ($status as $item) {

    //  $item['value'] = str_replace(array('<br/>','<ul>','</ul>','<li>','</li>',"<code>","</code>"),
    // array("\r\n","\r\n","\r\n","\r\n","\r\n"),$item['value'] );
    $item['value'] = str_replace(array_keys($replacements), array_values($replacements), $item['value']);
    $item['title'] = str_replace(array_keys($replacements), array_values($replacements), $item['title']);
    $content .= $item['title'] . $name_val_del . $item['value'] . $var_del;
  }
  return $content;
}