You are here

function _ldap_help_parse_status_to_text in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_help/ldap_help.status.inc \_ldap_help_parse_status_to_text()
  2. 7 ldap_help/ldap_help.status.inc \_ldap_help_parse_status_to_text()
1 call to _ldap_help_parse_status_to_text()
ldap_help_status in ldap_help/ldap_help.status.inc

File

ldap_help/ldap_help.status.inc, line 180
Status file for ldaphelp module.

Code

function _ldap_help_parse_status_to_text($status, $heading, $replacements = []) {
  $var_del = "\r\n------------------------------------------------\r\n";
  $section_del = "\r\n\r\n================================================\r\n";
  $name_val_del = ":\r\n";
  $lr = "\r\n";
  $replacements = array_merge($replacements, [
    '<br/>' => $lr,
    '<ul>' => $lr,
    '</ul>' => $lr,
    '<li>' => $lr,
    '</li>' => "",
    "<code>" => "",
    "</code>" => "",
    "<strong>" => "",
    "</strong>" => "",
  ]);
  $content = drupal_strtoupper($heading) . $lr;
  foreach ($status as $item) {
    $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;
}