wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_normalize_path › WordPress Function
Seit3.9.0
Veraltetn/v
› wp_normalize_path ( $path )
Parameter: |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
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.Ähnliche Funktionen: wp_normalize_site_data, wp_localize_script, normalize_whitespace, wp_get_original_image_path, wp_kses_normalize_entities
Quellcode
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; }