You are here

function _cdn_css_file_create_url in CDN 6.2

Generate CDN file URL without file_create_url() if the core patch has not been applied.

2 calls to _cdn_css_file_create_url()
_cdn_build_css_path in ./cdn.basic.css.inc
_cdn_css_aggregate in ./cdn.basic.css.inc
Mostly based on drupal_get_css().

File

./cdn.basic.css.inc, line 152
Overrides of Drupal's CSS aggregation system. Ensures that files referenced by CSS files are also served from the CDN, according to the CDN module's CSS aggregation rules.

Code

function _cdn_css_file_create_url($path) {
  if (variable_get(CDN_THEME_LAYER_FALLBACK_VARIABLE, FALSE) == TRUE) {

    // Store the current path as the old path, then let cdn_file_url_alter()
    // do its magic by invoking all file_url_alter hooks. When the path hasn't
    // changed and is not already root-relative or protocol-relative, then
    // generate a file URL as Drupal core would: prepend the base path.
    $old_path = $path;
    drupal_alter('file_url', $path);
    if ($path == $old_path && drupal_substr($path, 0, 1) != '/' && drupal_substr($path, 0, 2) != '//') {
      $path = base_path() . $path;
    }
    return $path;
  }
  else {
    return file_create_url($path);
  }
}