You are here

function advagg_relocate_parse_cache_control in Advanced CSS/JS Aggregation 7.2

Parse the cache-control string into a key value array.

Parameters

string $cache_control: The cache-control string.

Return value

array Returns a key value array.

1 call to advagg_relocate_parse_cache_control()
advagg_relocate_process_http_request in advagg_relocate/advagg_relocate.advagg.inc
Get the TTL and fix UTF-8 encoding.

File

advagg_relocate/advagg_relocate.advagg.inc, line 936
Advanced aggregation relocate module.

Code

function advagg_relocate_parse_cache_control($cache_control) {
  $cache_control_array = explode(',', $cache_control);
  $cache_control_array = array_map('trim', $cache_control_array);
  $cache_control_parsed = array();
  foreach ($cache_control_array as $value) {
    if (strpos($value, '=') !== FALSE) {
      $temp = array();
      parse_str($value, $temp);
      $cache_control_parsed += $temp;
    }
    else {
      $cache_control_parsed[$value] = TRUE;
    }
  }
  return $cache_control_parsed;
}