You are here

function _cdn_build_css_path in CDN 6.2

Same name and namespace in other branches
  1. 7.2 cdn.basic.css.inc \_cdn_build_css_path()
1 call to _cdn_build_css_path()
_cdn_build_css_cache in ./cdn.basic.css.inc
1 string reference to '_cdn_build_css_path'
_cdn_build_css_cache in ./cdn.basic.css.inc

File

./cdn.basic.css.inc, line 130
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_build_css_path($matches, $base = NULL) {
  static $_base;

  // Store base path for preg_replace_callback.
  if (isset($base)) {
    $_base = $base;
  }

  // Prefix with base and remove '../' segments where possible.
  $path = $_base . $matches[1];
  $last = '';
  while ($path != $last) {
    $last = $path;
    $path = preg_replace('`(^|/)(?!\\.\\./)([^/]+)/\\.\\./`', '$1', $path);
  }
  return 'url(' . _cdn_css_file_create_url($path) . ')';
}