You are here

function advagg_process_html_css in Advanced CSS/JS Aggregation 7

1 call to advagg_process_html_css()
advagg_process_html in ./advagg.module
Implements hook_process_html().

File

includes/css.inc, line 3

Code

function advagg_process_html_css(&$variables) {

  // dpm($variables);
  return;
  $schema = advagg_get_server_schema();
  $css_var = $variables['css'];
  $css_orig = $css_var;
  if (!variable_get('advagg_only_css_from_variables', ADVAGG_ONLY_CSS_FROM_VARIABLES)) {
    $css_func = drupal_add_css(CSS_DEFAULT);
    advagg_css_array_fixer($css_func);
  }
  else {
    $css_func = array();
  }
  $css = array_merge($css_var, $css_func);
  $css_func_inline = advagg_add_css_inline();
  if (!empty($css_func_inline)) {
    $css = advagg_merge_inline_css($css, $css_func_inline);
  }
  $css_conditional_styles = !empty($variables['conditional_styles']) ? $variables['conditional_styles'] : '';
  $css_styles = $variables['styles'];

  // Try cache.
  if (variable_get('advagg_use_full_cache', ADVAGG_USE_FULL_CACHE)) {

    // Build the cache ID
    // md5 of the CSS input
    // http or https
    // hostname
    // the js rendering function
    // css/js query string
    $cid = 'advagg_processor:css:' . md5(serialize(array(
      $css,
      $css_conditional_styles,
    ))) . ':' . $schema . ':' . $_SERVER['HTTP_HOST'] . ':' . variable_get('advagg_css_render_function', ADVAGG_CSS_RENDER_FUNCTION) . ':' . substr(variable_get('css_js_query_string', '0'), 0, 1);
    $cache = cache_get($cid, 'cache_advagg_bundle_reuse');
  }
  elseif (isset($cid)) {
    unset($cid);
  }
  if (!empty($cache->data)) {
    $variables['styles'] = $cache->data;
  }
  else {

    // Build HTML code.
    $processed_css = advagg_process_css($css);
    if (!empty($processed_css)) {
      $variables['styles'] = $processed_css;
    }
    $variables['styles'] .= $css_conditional_styles;

    // Cache output.
    if (isset($cid) && variable_get('advagg_use_full_cache', ADVAGG_USE_FULL_CACHE) && lock_acquire($cid)) {
      cache_set($cid, $variables['styles'], 'cache_advagg_bundle_reuse', CACHE_TEMPORARY);
      lock_release($cid);
    }
  }
}