function drupal_http_header_attributes

drupal_http_header_attributes(array $attributes = array())

Formats an attribute string for an 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()

File

includes/common.inc, line 2389
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) : '';
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_http_header_attributes/7.x