You are here

function akamai_context_http_header_build in Akamai 6

Same name and namespace in other branches
  1. 6.2 akamai.module \akamai_context_http_header_build()

Parameters

$http_header_items:

Implemantation of hook_http_header_build from context_http_header module build the akamai edge control headers array( 'header-1' => array('value1', 'value2', etc), 'header-2' => array(...), )

File

./akamai.module, line 306
akamai.module Integration with the Akamai CDN Cache Control Web Service.

Code

function akamai_context_http_header_build($http_header_items) {
  $header_builds = array();
  if ($value = $http_header_items['akamai_ttl']) {
    $header_builds["Edge-Control"][] = "Cache-maxage=" . check_plain($value);
  }
  if ($value = $http_header_items['akamai_nostore']) {
    if ($value == 'on') {
      $header_builds["Edge-Control"][] = "No-store";
    }
    elseif ($value == 'off') {
      $header_builds["Edge-Control"][] = "!No-store";
    }
  }
  if ($value = $http_header_items['akamai_bypass_cache']) {
    if ($value == 'on') {
      $header_builds["Edge-Control"][] = "bypass-cache";
    }
    elseif ($value == 'off') {
      $header_builds["Edge-Control"][] = "!bypass-cache";
    }
  }
  if ($value = $http_header_items['akamai_dynamic_content_assembly']) {
    if ($value == 'noop') {
      $header_builds["Edge-Control"][] = "dca=noop";
    }
    if ($value == 'esi') {
      $header_builds["Edge-Control"][] = "dca=esi";
    }
    if ($value == 'akamaizer') {
      $header_builds["Edge-Control"][] = "dca=akamaizer";
    }
  }
  return $header_builds;
}