You are here

function hosting_path_normalize in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 hosting.inc \hosting_path_normalize()
  2. 7.4 hosting.inc \hosting_path_normalize()

Make a path canonical.

This removes duplicate slashes, trailing slashes and /./ occurences. It does not (yet?) resolve .. instances.

2 calls to hosting_path_normalize()
hosting_platform_form in platform/hosting_platform.module
Implements hook_form().
hosting_platform_form_publish_path_validate in platform/hosting_platform.module
Element validator for publish_path. Only run when field is editable. (New node or failed validation and no makefile.)

File

./hosting.inc, line 92
General purpose Hosting module functions.

Code

function hosting_path_normalize($path) {
  return rtrim(preg_replace('/(\\/\\/*\\.)?\\/\\/*/', '/', $path), '/');
}