From 14177ba3ef9d1ebae5fa9e7db1a53eff6509c486 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 5 May 2009 02:45:40 +0000 Subject: [PATCH] get_home_path() improvements. Props akd907. fixes #9246 git-svn-id: http://svn.automattic.com/wordpress/trunk@11187 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 578b780b21..ad8d113974 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -67,11 +67,12 @@ function get_file_description( $file ) { */ function get_home_path() { $home = get_option( 'home' ); - if ( $home != '' && $home != get_option( 'siteurl' ) ) { - $home_path = parse_url( $home ); - $home_path = $home_path['path']; - $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] ); - $home_path = trailingslashit( $root.$home_path ); + $siteurl = get_option( 'siteurl' ); + if ( $home != '' && $home != $siteurl ) { + $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ + $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); + $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); + $home_path = trailingslashit( $home_path ); } else { $home_path = ABSPATH; }