wp_normalize_path

The timeline below displays how wordpress function wp_normalize_path has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Normalizes a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardize all paths to use '/'.
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter.
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 5.4

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use '/'.
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter.
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 9.7

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 9.3

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .20

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 9.2

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .10

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 4.9

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: 8.7

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 8.2

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .10

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 6.3

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .20

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 6.2

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .12

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 5.4

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .30

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 5.3

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .20

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 5.2

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .15

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 4.5

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: 4.4

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Ensures that no duplicate slashes exist.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .30

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 4.3

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Ensures that no duplicate slashes exist.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .20

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 4.2

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Ensures that no duplicate slashes exist.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: .16

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 4.4

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Ensures that no duplicate slashes exist.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $path;
}

WordPress Version: 3.4

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .30

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 3.3

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .20

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 3.2

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .17

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 2.4

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .30

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 2.3

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .21

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 1.5

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .40

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 1.4

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .30

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 1.3

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .24

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 0.4

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .30

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 0.3

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .24

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}

WordPress Version: 4.0

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems, and ensures
 * no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: 3.9

/**
 * Normalize a filesystem path.
 *
 * Replaces backslashes with forward slashes for Windows systems,
 * and ensures no duplicate slashes exist.
 *
 * @since 3.9.0
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $path = str_replace('\\', '/', $path);
    $path = preg_replace('|/+|', '/', $path);
    return $path;
}

WordPress Version: .27

/**
 * Normalize a filesystem path.
 *
 * On windows systems, replaces backslashes with forward slashes
 * and forces upper-case drive letters.
 * Allows for two leading slashes for Windows network shares, but
 * ensures that all other duplicate slashes are reduced to a single.
 *
 * @since 3.9.0
 * @since 4.4.0 Ensures upper-case drive letters on Windows systems.
 * @since 4.5.0 Allows for Windows network shares.
 * @since 4.9.7 Allows for PHP file wrappers.
 *
 * @param string $path Path to normalize.
 * @return string Normalized path.
 */
function wp_normalize_path($path)
{
    $wrapper = '';
    if (wp_is_stream($path)) {
        list($wrapper, $path) = explode('://', $path, 2);
        $wrapper .= '://';
    }
    // Standardise all paths to use /
    $path = str_replace('\\', '/', $path);
    // Replace multiple slashes down to a singular, allowing for network shares having two slashes.
    $path = preg_replace('|(?<=.)/+|', '/', $path);
    // Windows paths should uppercase the drive letter
    if (':' === substr($path, 1, 1)) {
        $path = ucfirst($path);
    }
    return $wrapper . $path;
}