get_home_path() improvements. Props akd907. fixes #9246
git-svn-id: https://develop.svn.wordpress.org/trunk@11187 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
aa9afc7810
commit
5b834b6daa
|
@ -67,11 +67,12 @@ function get_file_description( $file ) {
|
||||||
*/
|
*/
|
||||||
function get_home_path() {
|
function get_home_path() {
|
||||||
$home = get_option( 'home' );
|
$home = get_option( 'home' );
|
||||||
if ( $home != '' && $home != get_option( 'siteurl' ) ) {
|
$siteurl = get_option( 'siteurl' );
|
||||||
$home_path = parse_url( $home );
|
if ( $home != '' && $home != $siteurl ) {
|
||||||
$home_path = $home_path['path'];
|
$wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */
|
||||||
$root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] );
|
$pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home);
|
||||||
$home_path = trailingslashit( $root.$home_path );
|
$home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);
|
||||||
|
$home_path = trailingslashit( $home_path );
|
||||||
} else {
|
} else {
|
||||||
$home_path = ABSPATH;
|
$home_path = ABSPATH;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue