Changeset 11934
- Timestamp:
- 09/15/2009 02:21:00 AM (15 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-filesystem-direct.php
r11930 r11934 308 308 } 309 309 310 function dirlist($path, $inc dot = false, $recursive = false) {310 function dirlist($path, $include_hidden = true, $recursive = false) { 311 311 if ( $this->is_file($path) ) { 312 $limit File = basename($path);312 $limit_file = basename($path); 313 313 $path = dirname($path); 314 314 } else { 315 $limitFile = false; 316 } 315 $limit_file = false; 316 } 317 317 318 if ( ! $this->is_dir($path) ) 318 319 return false; 319 320 320 $ret = array();321 321 $dir = @dir($path); 322 322 if ( ! $dir ) 323 323 return false; 324 325 $ret = array(); 326 324 327 while (false !== ($entry = $dir->read()) ) { 325 328 $struc = array(); … … 327 330 328 331 if ( '.' == $struc['name'] || '..' == $struc['name'] ) 329 continue; //Do not care about these folders.330 if ( '.' == $struc['name'][0] && !$incdot)331 332 continue; 332 if ( $limitFile && $struc['name'] != $limitFile) 333 334 if ( ! $include_hidden && '.' == $struc['name'][0] ) 335 continue; 336 337 if ( $limit_file && $struc['name'] != $limit_file) 333 338 continue; 334 339 … … 346 351 if ( 'd' == $struc['type'] ) { 347 352 if ( $recursive ) 348 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $inc dot, $recursive);353 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); 349 354 else 350 355 $struc['files'] = array(); -
trunk/wp-admin/includes/class-wp-filesystem-ftpext.php
r11930 r11934 324 324 } 325 325 326 function dirlist($path = '.', $inc dot = false, $recursive = false) {326 function dirlist($path = '.', $include_hidden = true, $recursive = false) { 327 327 if ( $this->is_file($path) ) { 328 $limit File = basename($path);328 $limit_file = basename($path); 329 329 $path = dirname($path) . '/'; 330 330 } else { 331 $limit File = false;331 $limit_file = false; 332 332 } 333 333 … … 343 343 continue; 344 344 345 if ( '.' == $entry[ "name"] || '..' == $entry["name"] )345 if ( '.' == $entry['name'] || '..' == $entry['name'] ) 346 346 continue; 347 347 348 if ( ! $include_hidden && '.' == $entry['name'][0] ) 349 continue; 350 351 if ( $limit_file && $entry['name'] != $limit_file) 352 continue; 353 348 354 $dirlist[ $entry['name'] ] = $entry; 349 355 } … … 351 357 if ( ! $dirlist ) 352 358 return false; 353 if ( empty($dirlist) )354 return array();355 359 356 360 $ret = array(); 357 foreach ( $dirlist as $struc ) { 358 361 foreach ( (array)$dirlist as $struc ) { 359 362 if ( 'd' == $struc['type'] ) { 360 $struc['files'] = array(); 361 362 if ( $incdot ) { 363 //We're including the doted starts 364 if ( '.' != $struc['name'] && '..' != $struc['name'] ) { //Ok, It isnt a special folder 365 if ($recursive) 366 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive); 367 } 368 } else { //No dots 369 if ($recursive) 370 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive); 371 } 363 if ( $recursive ) 364 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); 365 else 366 $struc['files'] = array(); 372 367 } 373 //File 374 $ret[ $struc['name']] = $struc;368 369 $ret[ $struc['name'] ] = $struc; 375 370 } 376 371 return $ret; -
trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r11930 r11934 123 123 124 124 $temp = wp_tempnam( $file ); 125 if ( ! $temphandle = fopen($temp, 'w+') ) {125 if ( ! $temphandle = fopen($temp, 'w+') ) { 126 126 unlink($temp); 127 127 return false; … … 167 167 return $this->ftp->chmod($file, $mode); 168 168 } 169 169 170 //Is a directory, and we want recursive 170 171 $filelist = $this->dirlist($file); 171 foreach ($filelist as $filename){172 foreach ( $filelist as $filename ) 172 173 $this->chmod($file . '/' . $filename, $mode, $recursive); 173 } 174 174 175 return true; 175 176 } … … 283 284 } 284 285 285 function dirlist($path = '.', $inc dot = false, $recursive = false ) {286 function dirlist($path = '.', $include_hidden = true, $recursive = false ) { 286 287 if ( $this->is_file($path) ) { 287 $limit File = basename($path);288 $limit_file = basename($path); 288 289 $path = dirname($path) . '/'; 289 290 } else { 290 $limit File = false;291 $limit_file = false; 291 292 } 292 293 … … 294 295 if ( ! $list ) 295 296 return false; 296 if ( empty($list) )297 return array();298 297 299 298 $ret = array(); 300 299 foreach ( $list as $struc ) { 301 300 301 if ( '.' == $struct['name'] || '..' == $struc['name'] ) 302 continue; 303 304 if ( ! $include_hidden && '.' == $struc['name'][0] ) 305 continue; 306 307 if ( $limit_file && $srtuc['name'] != $limit_file ) 308 continue; 309 302 310 if ( 'd' == $struc['type'] ) { 303 $struc['files'] = array(); 304 305 if ( $incdot ){ 306 //We're including the doted starts 307 if ( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder 308 if ($recursive) 309 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive); 310 } 311 } else { //No dots 312 if ($recursive) 313 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive); 314 } 311 if ( $recursive ) 312 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); 313 else 314 $struc['files'] = array(); 315 315 } 316 //File 317 $ret[ $struc['name']] = $struc;316 317 $ret[ $struc['name'] ] = $struc; 318 318 } 319 319 return $ret; -
trunk/wp-admin/includes/class-wp-filesystem-ssh2.php
r11930 r11934 323 323 } 324 324 325 function dirlist($path, $inc dot = false, $recursive = false) {325 function dirlist($path, $include_hidden = true, $recursive = false) { 326 326 if ( $this->is_file($path) ) { 327 $limit File = basename($path);327 $limit_file = basename($path); 328 328 $path = dirname($path); 329 329 } else { 330 $limitFile = false; 331 } 330 $limit_file = false; 331 } 332 332 333 if ( ! $this->is_dir($path) ) 333 334 return false; … … 335 336 $ret = array(); 336 337 $dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') ); 338 337 339 if ( ! $dir ) 338 340 return false; 341 339 342 while (false !== ($entry = $dir->read()) ) { 340 343 $struc = array(); … … 343 346 if ( '.' == $struc['name'] || '..' == $struc['name'] ) 344 347 continue; //Do not care about these folders. 345 if ( '.' == $struc['name'][0] && !$incdot) 348 349 if ( ! $include_hidden && '.' == $struc['name'][0] ) 346 350 continue; 347 if ( $limitFile && $struc['name'] != $limitFile) 351 352 if ( $limit_file && $struc['name'] != $limit_file ) 348 353 continue; 349 354 … … 361 366 if ( 'd' == $struc['type'] ) { 362 367 if ( $recursive ) 363 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $inc dot, $recursive);368 $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); 364 369 else 365 370 $struc['files'] = array();
Note: See TracChangeset
for help on using the changeset viewer.