Ticket #24068: link-template.php.diff
File link-template.php.diff, 1.3 KB (added by , 11 years ago) |
---|
-
wp-includes/link-template.php
2036 2036 * @package WordPress 2037 2037 * @since 2.6.0 2038 2038 * 2039 * @param string $path Optional. Path relative to the content url .2039 * @param string $path Optional. Path relative to the content url, or an absolute real path pointing inside WP_CONTENT_DIR 2040 2040 * @return string Content url link with optional path appended. 2041 2041 */ 2042 2042 function content_url($path = '') { 2043 2043 $url = set_url_scheme( WP_CONTENT_URL ); 2044 $original_path = $path; 2044 2045 2045 if ( $path && is_string( $path ) ) 2046 if ( $path && is_string( $path ) ) { 2047 // Handle absolute path pointing inside WP_CONTENT_DIR 2048 if ( strpos( $path, WP_CONTENT_DIR ) === 0 ) { 2049 $path = realpath($path); 2050 $content_dir_segment = DIRECTORY_SEPARATOR . basename( WP_CONTENT_DIR ) . DIRECTORY_SEPARATOR; 2051 $until_content_dir_pattern = sprintf( '#^.+%s#', preg_quote( $content_dir_segment, '#' ) ); 2052 $path = preg_replace( $until_content_dir_pattern, '', $path ); 2053 $path = str_replace('\\', '/', $path); // sanitize for Win32 installs 2054 } 2046 2055 $url .= '/' . ltrim($path, '/'); 2056 } 2047 2057 2048 return apply_filters('content_url', $url, $ path);2058 return apply_filters('content_url', $url, $original_path); 2049 2059 } 2050 2060 2051 2061 /**