Sanitize path.
beans_sanitize_path( string $path )
Return: (string) Sanitize path.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$path | string | true | - | Path to be sanitize. Accepts absolute and relative internal paths. |
Source
function beans_sanitize_path( $path ) {
// Try to convert it to real path.
if ( false !== realpath( $path ) ) {
$path = realpath( $path );
}
// Remove Windows drive for local installs if the root isn't cached yet.
$path = preg_replace( '#^[A-Z]\:#i', '', $path );
return wp_normalize_path( $path );
}