| 7 file.inc | file_stream_wrapper_uri_normalize($uri) |
| 8 file.inc | file_stream_wrapper_uri_normalize($uri) |
Normalizes a URI by making it syntactically correct.
A stream is referenced as "scheme://target".
The following actions are taken:
- Remove trailing slashes from target
- Trim erroneous leading slashes from target. e.g. ":///" becomes "://".
Parameters
$uri: String reference containing the URI to normalize.
Return value
The normalized URI.
Related topics
6 calls to file_stream_wrapper_uri_normalize()
File
- includes/
file.inc, line 275 - API for handling file uploads and server file management.
Code
function file_stream_wrapper_uri_normalize($uri) {
$scheme = file_uri_scheme($uri);
if ($scheme && file_stream_wrapper_valid_scheme($scheme)) {
$target = file_uri_target($uri);
if ($target !== FALSE) {
$uri = $scheme . '://' . $target;
}
}
else {
// The default scheme is file://
$url = 'file://' . $uri;
}
return $uri;
}
Login or register to post comments