- Timestamp:
- 09/09/2013 02:54:50 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-base.php
r25082 r25305 21 21 */ 22 22 var $verbose = false; 23 23 24 /** 24 25 * Cached list of local filepaths to mapped remote filepaths. … … 48 49 function abspath() { 49 50 $folder = $this->find_folder(ABSPATH); 50 // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare.51 // Perhaps the FTP folder is rooted at the WordPress install, Check for wp-includes folder in root, Could have some false positives, but rare. 51 52 if ( ! $folder && $this->is_dir('/wp-includes') ) 52 53 $folder = '/'; 53 54 return $folder; 54 55 } 56 55 57 /** 56 58 * Returns the path on the remote filesystem of WP_CONTENT_DIR … … 63 65 return $this->find_folder(WP_CONTENT_DIR); 64 66 } 67 65 68 /** 66 69 * Returns the path on the remote filesystem of WP_PLUGIN_DIR … … 74 77 return $this->find_folder(WP_PLUGIN_DIR); 75 78 } 79 76 80 /** 77 81 * Returns the path on the remote filesystem of the Themes Directory … … 92 96 return $this->find_folder( $theme_root ); 93 97 } 98 94 99 /** 95 100 * Returns the path on the remote filesystem of WP_LANG_DIR … … 122 127 return $this->abspath(); 123 128 } 129 124 130 /** 125 131 * Locates a folder on the remote filesystem. … … 189 195 } 190 196 } elseif ( 'direct' == $this->method ) { 191 $folder = str_replace('\\', '/', $folder); // Windows path sanitisation197 $folder = str_replace('\\', '/', $folder); // Windows path sanitisation 192 198 return trailingslashit($folder); 193 199 } 194 200 195 $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there.196 $folder = str_replace('\\', '/', $folder); // Windows path sanitisation201 $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there. 202 $folder = str_replace('\\', '/', $folder); // Windows path sanitisation 197 203 198 204 if ( isset($this->cache[ $folder ] ) ) 199 205 return $this->cache[ $folder ]; 200 206 201 if ( $this->exists($folder) ) { // Folder exists at that absolute path.207 if ( $this->exists($folder) ) { // Folder exists at that absolute path. 202 208 $folder = trailingslashit($folder); 203 209 $this->cache[ $folder ] = $folder; … … 240 246 foreach ( $folder_parts as $index => $key ) { 241 247 if ( $index == $last_index ) 242 continue; // We want this to be caught by the next code block.243 244 // Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,248 continue; // We want this to be caught by the next code block. 249 250 // Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 245 251 // If it's found, change into it and follow through looking for it. 246 252 // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on. 247 253 // If it reaches the end, and still cant find it, it'll return false for the entire function. 248 254 if ( isset($files[ $key ]) ){ 249 // Lets try that folder:255 // Lets try that folder: 250 256 $newdir = trailingslashit(path_join($base, $key)); 251 257 if ( $this->verbose ) … … 258 264 } 259 265 260 // Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take.266 // Only check this as a last resort, to prevent locating the incorrect install. All above procedures will fail quickly if this is the right branch to take. 261 267 if (isset( $files[ $last_path ] ) ) { 262 268 if ( $this->verbose ) … … 373 379 */ 374 380 function is_binary( $text ) { 375 return (bool) preg_match( '|[^\x20-\x7E]|', $text); //chr(32)..chr(127)381 return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127) 376 382 } 377 383 }
Note: See TracChangeset
for help on using the changeset viewer.