You are here

function cdn_clean_filepath in CDN 5

Removes the leading "/", "/" or "../"'s from a path.

Parameters

$file_path: A path.

Return value

The cleaned path.

1 call to cdn_clean_filepath()
cdn_file_url in ./cdn.inc
Given a file path relative to the Drupal root directory, get the URL of the corresponding file on the CDN, or the normal URL if the corresponding file does not (yet) exist on the CDN.
1 string reference to 'cdn_clean_filepath'
_cdn_cron_get_files_to_sync in ./cdn_cron.inc
Generates the list of files that has to be sync, based on a file name pattern, a list of ignored directories, a list of directories of which any file will be included, and an exclude pattern.

File

./cdn.inc, line 153
Basic functions for CDN integration and synchronization.

Code

function cdn_clean_filepath($file_path) {
  return preg_replace('/^(?:(?:\\.\\.\\/)+|\\.\\/|\\/)?(.*)/', '$1', $file_path);
}