Skip navigation
Help

drupal_http_header_attributes

7 common.inc drupal_http_header_attributes(array $attributes = array())

Format an attribute string for a HTTP header.

Parameters

$attributes: An associative array of attributes such as 'rel'.

Return value

A ; separated string ready for insertion in a HTTP header. No escaping is performed for HTML entities, so this string is not safe to be printed.

See also

drupal_add_http_header()

1 call to drupal_http_header_attributes()

File

drupal/includes/common.inc, line 2216
Common functions that many Drupal modules will need to reference.

Code

function drupal_http_header_attributes(array $attributes = array()) {
  foreach ($attributes as $attribute => &$data) {
    if (is_array($data)) {
      $data = implode(' ', $data);
    }
    $data = $attribute . '="' . $data . '"';
  }
  return $attributes ? ' ' . implode('; ', $attributes) : '';
}