diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php index 3211e4a953..927873ff39 100644 --- a/wp-admin/upload-functions.php +++ b/wp-admin/upload-functions.php @@ -16,10 +16,13 @@ function wp_upload_display( $dims = false, $href = '' ) { if ( $image_src = strstr($innerHTML, 'src="') ) { $image_src = explode('"', $image_src); $image_src = $image_src[1]; + $thumb_src = wp_make_link_relative($image_src); $class = 'image'; - $innerHTML = ' ' . $innerHTML; + $innerHTML = ' ' . str_replace($image_src, $thumb_src, $innerHTML); } + $src = wp_make_link_relative( get_the_guid() ); + $r = ''; if ( $href ) @@ -29,10 +32,10 @@ function wp_upload_display( $dims = false, $href = '' ) { if ( $href ) $r .= "\n"; $r .= "\n\t\t
\n\t\t\t

\n"; - $r .= "\t\t\t\t\n"; + $r .= "\t\t\t\t\n"; if ( $image_src ) - $r .= "\t\t\t\t\n"; + $r .= "\t\t\t\t\n"; if ( isset($width) ) { $r .= "\t\t\t\t\n"; $r .= "\t\t\t\t\n"; diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 11f006789c..3dd3d73a69 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1070,11 +1070,8 @@ function js_escape($text) { return preg_replace("/\r?\n/", "\\n", addslashes($text)); } -function wp_make_link_relative( $link, $base = '' ) { - if ( !$base ) - $base = get_option( 'home' ); - if ( 0 === strpos($link, $base) ) - $link = substr_replace($link, '', 0, strlen($base)); - return $link; +function wp_make_link_relative( $link ) { + return preg_replace('|https?://[^/]+(/.*)|i', '$1', $link ); } + ?>