function adaptivetheme_css_alter

cis7 alter.inc adaptivetheme_css_alter(&$css)
cle7 alter.inc adaptivetheme_css_alter(&$css)
elmsmedia7 alter.inc adaptivetheme_css_alter(&$css)
icor7 alter.inc adaptivetheme_css_alter(&$css)
meedjum_blog7 alter.inc adaptivetheme_css_alter(&$css)
mooc7 alter.inc adaptivetheme_css_alter(&$css)

hook_css_alter()

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc, line 213
General alters.

Code

function adaptivetheme_css_alter(&$css) {
  global $theme_key;

  // Never allow this to run in our admin theme and only if the extension is enabled.
  if (at_get_setting('enable_exclude_css') === 1 && $theme_key !== 'adaptivetheme_admin') {

    // Get $css_data from the cache
    if ($cache = cache_get('at_get_css_files')) {
      $css_data = $cache->data;
    }
    else {
      $css_data = at_get_css_files($theme_key);
    }

    // We need the right theme name to get the theme settings
    $_get_active_theme_data = array_pop($css_data);
    if ($_get_active_theme_data['type'] == 'theme') {
      $theme_name = $_get_active_theme_data['source'];
    }
    else {
      $theme_name = $theme_key;
    }

    // Get the theme setting and unset files
    foreach ($css_data as $key => $value) {
      $setting = 'unset_css_' . preg_replace('/[^a-zA-Z0-9-]+/', '_', $key);
      if (at_get_setting($setting, $theme_name) === 1) {
        if (isset($css[$key])) {
          unset($css[$key]);
        }
      }
    }

    // Unset -rtl.css files if language dir is RTL, in some contexts dir is
    // unset, but I don't know if this is a core bug or not.
    if (isset($language->dir) && $language->dir === 'rtl') {
      foreach ($css_data as $key => $value) {
        $setting = 'unset_css_' . preg_replace('/[^a-zA-Z0-9-]+/', '_', $key);
        if (at_get_setting($setting, $theme_name) === 1) {
          $key = str_replace('.css', '-rtl.css', $key);
          if (isset($css[$key])) {
            unset($css[$key]);
          }
        }
      }
    }
  }

  // Combine CSS files into one per type, this is not perfect
  if (at_get_setting('combine_css_files', $theme_key) === 1) {
    uasort($css, 'drupal_sort_css_js');
    $print = array();
    $weight = 0;
    foreach ($css as $name => $style) {
      // Leave  the conditional stylesheets untouched
      if ($css[$name]['browsers']['!IE']) {
        $css[$name]['group'] = 0;
        $css[$name]['weight'] = $weight++;
        $css[$name]['every_page'] = TRUE;
      }
      if ($css[$name]['media'] == 'print') {
        $print[$name] = $css[$name];
        unset($css[$name]);
      }
    }
    $css = array_merge($css, $print);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.