_drupal_build_css_path

Versions
6 – 7
_drupal_build_css_path($matches, $base = NULL)

Helper function for drupal_build_css_cache().

This function will prefix all paths within a CSS file.

▾ 1 function calls _drupal_build_css_path()

drupal_build_css_cache in includes/common.inc
Aggregate and optimize CSS files, putting them in the files directory.

Code

includes/common.inc, line 3358

<?php
function _drupal_build_css_path($matches, $base = NULL) {
  $_base = &drupal_static(__FUNCTION__);
  // 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 . ')';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.