WordPress.org

Make WordPress Core

Changeset 11187


Ignore:
Timestamp:
05/05/09 02:45:40 (5 years ago)
Author:
ryan
Message:

get_home_path() improvements. Props akd907. fixes #9246

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r11180 r11187  
    6868function get_home_path() { 
    6969    $home = get_option( 'home' ); 
    70     if ( $home != '' && $home != get_option( 'siteurl' ) ) { 
    71         $home_path = parse_url( $home ); 
    72         $home_path = $home_path['path']; 
    73         $root = str_replace( $_SERVER["PHP_SELF"], '', $_SERVER["SCRIPT_FILENAME"] ); 
    74         $home_path = trailingslashit( $root.$home_path ); 
     70    $siteurl = get_option( 'siteurl' ); 
     71    if ( $home != '' && $home != $siteurl ) { 
     72            $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ 
     73            $pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); 
     74            $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);         
     75        $home_path = trailingslashit( $home_path ); 
    7576    } else { 
    7677        $home_path = ABSPATH; 
Note: See TracChangeset for help on using the changeset viewer.