Changeset 51622
- Timestamp:
- 08/16/2021 08:16:13 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp.php
r51518 r51622 171 171 list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] ); 172 172 $self = $_SERVER['PHP_SELF']; 173 $home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' ); 174 $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) ); 173 174 $home_path = parse_url( home_url(), PHP_URL_PATH ); 175 $home_path_regex = ''; 176 if ( is_string( $home_path ) && '' !== $home_path ) { 177 $home_path = trim( $home_path, '/' ); 178 $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) ); 179 } 175 180 176 181 /* … … 181 186 $req_uri = str_replace( $pathinfo, '', $req_uri ); 182 187 $req_uri = trim( $req_uri, '/' ); 183 $req_uri = preg_replace( $home_path_regex, '', $req_uri );184 $req_uri = trim( $req_uri, '/' );185 $pathinfo = trim( $pathinfo, '/' );186 $pathinfo = preg_replace( $home_path_regex, '', $pathinfo );187 188 $pathinfo = trim( $pathinfo, '/' ); 188 189 $self = trim( $self, '/' ); 189 $self = preg_replace( $home_path_regex, '', $self ); 190 $self = trim( $self, '/' ); 190 191 if ( ! empty( $home_path_regex ) ) { 192 $req_uri = preg_replace( $home_path_regex, '', $req_uri ); 193 $req_uri = trim( $req_uri, '/' ); 194 $pathinfo = preg_replace( $home_path_regex, '', $pathinfo ); 195 $pathinfo = trim( $pathinfo, '/' ); 196 $self = preg_replace( $home_path_regex, '', $self ); 197 $self = trim( $self, '/' ); 198 } 191 199 192 200 // The requested permalink is in $pathinfo for path info requests and
Note: See TracChangeset
for help on using the changeset viewer.