You are here

function advagg_unlimited_css_builder in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg.module \advagg_unlimited_css_builder()

Logic to figure out what kind of css tags to use.

Parameters

$external_no_preprocess: array of css files ($media, $href, $prefix, $suffix)

$module_no_preprocess: array of css files ($media, $href, $prefix, $suffix)

$output_no_preprocess: array of css files ($media, $href, $prefix, $suffix)

$output_preprocess: array of css files ($media, $href, $prefix, $suffix)

$theme_no_preprocess: array of css files ($media, $href, $prefix, $suffix)

$inline_no_preprocess: array of css data to inline ($media, $data)

$inline_included: array of inline css included. $a[$media][] = $datablob;

$files_included: array of css files included. $a[$media][] = $filename

$files_aggregates_included: array of css files & aggregates included. $a[$media][] = $filename

Return value

html for loading the css. html for the head.

1 string reference to 'advagg_unlimited_css_builder'
constants.inc in includes/constants.inc

File

includes/css.inc, line 333

Code

function advagg_unlimited_css_builder($external_no_preprocess, $module_no_preprocess, $output_no_preprocess, $output_preprocess, $theme_no_preprocess, $inline_no_preprocess, $files_included, $files_aggregates_included, $inline_included) {
  global $user;
  $styles = '';
  $files = array_merge($external_no_preprocess, $module_no_preprocess, $output_no_preprocess, $output_preprocess, $theme_no_preprocess, $inline_no_preprocess);

  // Select method for css html output
  if (count($files) < variable_get('advagg_css_count_threshold', ADVAGG_CSS_COUNT_THRESHOLD)) {
    advagg_unlimited_css_traditional($files, $styles);
  }
  elseif (variable_get('advagg_css_logged_in_ie_detect', ADVAGG_CSS_LOGGED_IN_IE_DETECT) && $user->uid != 0) {

    // Detect IE browsers here
    $is_ie = FALSE;
    if (isset($_SERVER['HTTP_USER_AGENT'])) {

      // Strings for testing found via
      // http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/
      // Test for v1 - v1.5 IE
      // Test for versions > 1.5
      // Test for Pocket IE
      if (stristr($_SERVER['HTTP_USER_AGENT'], 'microsoft internet explorer') || stristr($_SERVER['HTTP_USER_AGENT'], 'msie') || stristr($_SERVER['HTTP_USER_AGENT'], 'mspie')) {
        $is_ie = TRUE;
      }
    }
    else {
      $is_ie = TRUE;
    }
    if ($is_ie) {
      advagg_unlimited_css_import(array_merge($external_no_preprocess, $module_no_preprocess, $output_no_preprocess), $styles);
      advagg_unlimited_css_import($output_preprocess, $styles);
      advagg_unlimited_css_import($theme_no_preprocess, $styles);
      advagg_unlimited_css_traditional($inline_no_preprocess, $styles);
    }
    else {
      advagg_unlimited_css_traditional($files, $styles);
    }
  }
  else {
    advagg_unlimited_css_import(array_merge($external_no_preprocess, $module_no_preprocess, $output_no_preprocess), $styles);
    advagg_unlimited_css_import($output_preprocess, $styles);
    advagg_unlimited_css_import($theme_no_preprocess, $styles);
    advagg_unlimited_css_traditional($inline_no_preprocess, $styles);
  }
  return $styles;
}