function _drupal_build_css_path

7.x common.inc _drupal_build_css_path($matches, $base = NULL)
6.x common.inc _drupal_build_css_path($matches, $base = NULL)

Helper function for drupal_build_css_cache().

This function will prefix all paths within a CSS file.

2 calls to _drupal_build_css_path()
color_scheme_form_submit in drupal-6.x/modules/color/color.module
Submit handler for color change form.
drupal_build_css_cache in drupal-6.x/includes/common.inc
Aggregate and optimize CSS files, putting them in the files directory.
2 string references to '_drupal_build_css_path'
color_scheme_form_submit in drupal-6.x/modules/color/color.module
Submit handler for color change form.
drupal_build_css_cache in drupal-6.x/includes/common.inc
Aggregate and optimize CSS files, putting them in the files directory.

File

drupal-6.x/includes/common.inc, line 2015
Common functions that many Drupal modules will need to reference.

Code

function _drupal_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(' . $path . ')';
}