- Timestamp:
- 06/19/2020 10:34:26 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-base.php
r47808 r48089 56 56 public function abspath() { 57 57 $folder = $this->find_folder( ABSPATH ); 58 58 59 // Perhaps the FTP folder is rooted at the WordPress install. 59 60 // Check for wp-includes folder in root. Could have some false positives, but rare. … … 61 62 $folder = '/'; 62 63 } 64 63 65 return $folder; 64 66 } … … 189 191 continue; 190 192 } 193 191 194 if ( $folder === $dir ) { 192 195 return trailingslashit( constant( $constant ) ); … … 199 202 continue; 200 203 } 204 201 205 if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir. 202 206 $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); … … 205 209 if ( $this->is_dir( $potential_folder ) ) { 206 210 $this->cache[ $folder ] = $potential_folder; 211 207 212 return $potential_folder; 208 213 } … … 211 216 } elseif ( 'direct' === $this->method ) { 212 217 $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation. 218 213 219 return trailingslashit( $folder ); 214 220 } … … 224 230 $folder = trailingslashit( $folder ); 225 231 $this->cache[ $folder ] = $folder; 232 226 233 return $folder; 227 234 } 235 228 236 $return = $this->search_for_folder( $folder ); 237 229 238 if ( $return ) { 230 239 $this->cache[ $folder ] = $return; 231 240 } 241 232 242 return $return; 233 243 } … … 280 290 // Let's try that folder: 281 291 $newdir = trailingslashit( path_join( $base, $key ) ); 292 282 293 if ( $this->verbose ) { 283 294 /* translators: %s: Directory name. */ … … 288 299 $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); 289 300 $ret = $this->search_for_folder( $newfolder, $newdir, $loop ); 301 290 302 if ( $ret ) { 291 303 return $ret; … … 301 313 printf( "\n" . __( 'Found %s' ) . "<br/>\n", $base . $last_path ); 302 314 } 315 303 316 return trailingslashit( $base . $last_path ); 304 317 } … … 330 343 public function gethchmod( $file ) { 331 344 $perms = intval( $this->getchmod( $file ), 8 ); 345 332 346 if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket. 333 347 $info = 's'; … … 368 382 ( ( $perms & 0x0200 ) ? 't' : 'x' ) : 369 383 ( ( $perms & 0x0200 ) ? 'T' : '-' ) ); 384 370 385 return $info; 371 386 } … … 403 418 for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) { 404 419 $key = array_search( $attarray[ $i ], $legal, true ); 420 405 421 if ( $key ) { 406 422 $realmode .= $legal[ $key ]; … … 421 437 $newmode .= $mode[4] + $mode[5] + $mode[6]; 422 438 $newmode .= $mode[7] + $mode[8] + $mode[9]; 439 423 440 return $newmode; 424 441 }
Note: See TracChangeset
for help on using the changeset viewer.