53 // This block will process a request if the current network or current site objects |
53 // This block will process a request if the current network or current site objects |
54 // have not been populated in the global scope through something like `sunrise.php`. |
54 // have not been populated in the global scope through something like `sunrise.php`. |
55 if ( ! isset( $current_site ) || ! isset( $current_blog ) ) { |
55 if ( ! isset( $current_site ) || ! isset( $current_blog ) ) { |
56 |
56 |
57 $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); |
57 $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); |
58 if ( ':80' === substr( $domain, -3 ) ) { |
58 if ( str_ends_with( $domain, ':80' ) ) { |
59 $domain = substr( $domain, 0, -3 ); |
59 $domain = substr( $domain, 0, -3 ); |
60 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); |
60 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); |
61 } elseif ( ':443' === substr( $domain, -4 ) ) { |
61 } elseif ( str_ends_with( $domain, ':443' ) ) { |
62 $domain = substr( $domain, 0, -4 ); |
62 $domain = substr( $domain, 0, -4 ); |
63 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); |
63 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); |
64 } |
64 } |
65 |
65 |
66 $path = stripslashes( $_SERVER['REQUEST_URI'] ); |
66 $path = stripslashes( $_SERVER['REQUEST_URI'] ); |