You are here

function advagg_add_resource_hints_array in Advanced CSS/JS Aggregation 7.2

Find dns_prefetch and call advagg_add_dns_prefetch().

Parameters

array $values: Attributes added via code for the file.

1 call to advagg_add_resource_hints_array()
_advagg_process_html in ./advagg.module
Replacement for template_process_html().

File

./advagg.module, line 2555
Advanced CSS/JS aggregation module.

Code

function advagg_add_resource_hints_array(array $values) {
  if (variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT)) {
    if (!empty($values['type']) && ($values['type'] === 'external' || $values['type'] === 'file')) {

      // Get external domains.
      advagg_add_dns_prefetch($values['data']);
    }
    if (!empty($values['dns_prefetch'])) {

      // Grab domains that will be access when this file is loaded.
      if (is_array($values['dns_prefetch'])) {
        foreach ($values['dns_prefetch'] as $url) {
          advagg_add_dns_prefetch($url);
        }
      }
      else {
        advagg_add_dns_prefetch($values['dns_prefetch']);
      }
    }
  }
  if (!empty($values['preload']) && variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD)) {
    if (is_array($values['preload'])) {
      foreach ($values['preload'] as $url) {
        advagg_add_preload_header($url);
      }
    }
    else {
      advagg_add_preload_header($values['preload']);
    }
  }
}