Changeset 42387
- Timestamp:
- 12/12/2017 04:15:54 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r42343 r42387 1765 1765 * @since 4.4.0 Ensures upper-case drive letters on Windows systems. 1766 1766 * @since 4.5.0 Allows for Windows network shares. 1767 * @since 5.0.0 Allows for PHP file wrappers. 1767 1768 * 1768 1769 * @param string $path Path to normalize. … … 1770 1771 */ 1771 1772 function wp_normalize_path( $path ) { 1773 $wrapper = ''; 1774 if ( wp_is_stream( $path ) ) { 1775 list( $wrapper, $path ) = explode( '://', $path, 2 ); 1776 $wrapper .= '://'; 1777 } 1778 1779 // Standardise all paths to use / 1772 1780 $path = str_replace( '\\', '/', $path ); 1781 1782 // Replace multiple slashes down to a singular, allowing for network shares having two slashes. 1773 1783 $path = preg_replace( '|(?<=.)/+|', '/', $path ); 1784 1785 // Windows paths should uppercase the drive letter 1774 1786 if ( ':' === substr( $path, 1, 1 ) ) { 1775 1787 $path = ucfirst( $path ); 1776 1788 } 1777 return $path; 1789 1790 return $wrapper . $path; 1778 1791 } 1779 1792 -
trunk/tests/phpunit/tests/functions.php
r42343 r42387 151 151 array( '/www/path/////', '/www/path/' ), 152 152 array( '/www/path', '/www/path' ), 153 154 // PHP Stream wrappers 155 array( 'php://input', 'php://input' ), 156 array( 'http://example.com//path.ext', 'http://example.com/path.ext' ), 157 array( 'file://c:\\www\\path\\', 'file://C:/www/path/' ), 153 158 ); 154 159 }
Note: See TracChangeset
for help on using the changeset viewer.