You are here

function imce_relative_path in IMCE 5

2 calls to imce_relative_path()
imce_browse in ./imce.module
Image Browser.
imce_menu in ./imce.module
Implementation of hook_menu().

File

./imce.module, line 807

Code

function imce_relative_path($path, $root = NULL) {
  $abs = str_replace('\\', '/', realpath($path));
  $root = str_replace('\\', '/', $root ? realpath($root) : dirname(realpath($_SERVER['SCRIPT_FILENAME'])));
  return strpos($abs, $root) === 0 ? trim(substr($abs, strlen($root)), '/') : substr($abs, ($pos = strpos($abs, '/')) ? $pos : 0);
}