- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-base.php
r47088 r47122 56 56 public function abspath() { 57 57 $folder = $this->find_folder( ABSPATH ); 58 // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. 58 // Perhaps the FTP folder is rooted at the WordPress install. 59 // Check for wp-includes folder in root. Could have some false positives, but rare. 59 60 if ( ! $folder && $this->is_dir( '/' . WPINC ) ) { 60 61 $folder = '/'; … … 97 98 $theme_root = get_theme_root( $theme ); 98 99 99 // Account for relative theme roots 100 // Account for relative theme roots. 100 101 if ( '/themes' == $theme_root || ! is_dir( $theme_root ) ) { 101 102 $theme_root = WP_CONTENT_DIR . $theme_root; … … 183 184 ); 184 185 185 // Direct matches ( folder = CONSTANT/ ) 186 // Direct matches ( folder = CONSTANT/ ). 186 187 foreach ( $constant_overrides as $constant => $dir ) { 187 188 if ( ! defined( $constant ) ) { … … 193 194 } 194 195 195 // Prefix Matches ( folder = CONSTANT/subdir )196 // Prefix matches ( folder = CONSTANT/subdir ), 196 197 foreach ( $constant_overrides as $constant => $dir ) { 197 198 if ( ! defined( $constant ) ) { 198 199 continue; 199 200 } 200 if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir 201 if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir. 201 202 $potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder ); 202 203 $potential_folder = trailingslashit( $potential_folder ); … … 209 210 } 210 211 } elseif ( 'direct' == $this->method ) { 211 $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation 212 $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation. 212 213 return trailingslashit( $folder ); 213 214 } 214 215 215 $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out windows drive letter if it's there.216 $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation 216 $folder = preg_replace( '|^([a-z]{1}):|i', '', $folder ); // Strip out Windows drive letter if it's there. 217 $folder = str_replace( '\\', '/', $folder ); // Windows path sanitisation. 217 218 218 219 if ( isset( $this->cache[ $folder ] ) ) { … … 241 242 * @param string $folder The folder to locate. 242 243 * @param string $base The folder to start searching from. 243 * @param bool $loop If the function has recursed ,Internal use only.244 * @param bool $loop If the function has recursed. Internal use only. 244 245 * @return string|false The location of the remote path, false to cease looping. 245 246 */ … … 304 305 305 306 // Prevent this function from looping again. 306 // No need to proceed if we've just searched in /307 // No need to proceed if we've just searched in `/`. 307 308 if ( $loop || '/' == $base ) { 308 309 return false; … … 329 330 public function gethchmod( $file ) { 330 331 $perms = intval( $this->getchmod( $file ), 8 ); 331 if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket 332 if ( ( $perms & 0xC000 ) == 0xC000 ) { // Socket. 332 333 $info = 's'; 333 } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link 334 } elseif ( ( $perms & 0xA000 ) == 0xA000 ) { // Symbolic Link. 334 335 $info = 'l'; 335 } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular 336 } elseif ( ( $perms & 0x8000 ) == 0x8000 ) { // Regular. 336 337 $info = '-'; 337 } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special 338 } elseif ( ( $perms & 0x6000 ) == 0x6000 ) { // Block special. 338 339 $info = 'b'; 339 } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory 340 } elseif ( ( $perms & 0x4000 ) == 0x4000 ) { // Directory. 340 341 $info = 'd'; 341 } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special 342 } elseif ( ( $perms & 0x2000 ) == 0x2000 ) { // Character special. 342 343 $info = 'c'; 343 } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe 344 } elseif ( ( $perms & 0x1000 ) == 0x1000 ) { // FIFO pipe. 344 345 $info = 'p'; 345 } else { // Unknown 346 } else { // Unknown. 346 347 $info = 'u'; 347 348 } 348 349 349 // Owner 350 // Owner. 350 351 $info .= ( ( $perms & 0x0100 ) ? 'r' : '-' ); 351 352 $info .= ( ( $perms & 0x0080 ) ? 'w' : '-' ); … … 354 355 ( ( $perms & 0x0800 ) ? 'S' : '-' ) ); 355 356 356 // Group 357 // Group. 357 358 $info .= ( ( $perms & 0x0020 ) ? 'r' : '-' ); 358 359 $info .= ( ( $perms & 0x0010 ) ? 'w' : '-' ); … … 361 362 ( ( $perms & 0x0400 ) ? 'S' : '-' ) ); 362 363 363 // World 364 // World. 364 365 $info .= ( ( $perms & 0x0004 ) ? 'r' : '-' ); 365 366 $info .= ( ( $perms & 0x0002 ) ? 'w' : '-' ); … … 828 829 } 829 830 830 } // WP_Filesystem_Base831 }
Note: See TracChangeset
for help on using the changeset viewer.