Make WordPress Core


Ignore:
Timestamp:
09/15/2009 02:21:00 AM (16 years ago)
Author:
azaozz
Message:

Include 'hidden' directories in filesystem dirlist by default, props dd32, fixes #10774

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-ssh2.php

    r11930 r11934  
    323323    }
    324324
    325     function dirlist($path, $incdot = false, $recursive = false) {
     325    function dirlist($path, $include_hidden = true, $recursive = false) {
    326326        if ( $this->is_file($path) ) {
    327             $limitFile = basename($path);
     327            $limit_file = basename($path);
    328328            $path = dirname($path);
    329329        } else {
    330             $limitFile = false;
    331         }
     330            $limit_file = false;
     331        }
     332
    332333        if ( ! $this->is_dir($path) )
    333334            return false;
     
    335336        $ret = array();
    336337        $dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') );
     338
    337339        if ( ! $dir )
    338340            return false;
     341
    339342        while (false !== ($entry = $dir->read()) ) {
    340343            $struc = array();
     
    343346            if ( '.' == $struc['name'] || '..' == $struc['name'] )
    344347                continue; //Do not care about these folders.
    345             if ( '.' == $struc['name'][0] && !$incdot)
     348
     349            if ( ! $include_hidden && '.' == $struc['name'][0] )
    346350                continue;
    347             if ( $limitFile && $struc['name'] != $limitFile)
     351
     352            if ( $limit_file && $struc['name'] != $limit_file )
    348353                continue;
    349354
     
    361366            if ( 'd' == $struc['type'] ) {
    362367                if ( $recursive )
    363                     $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
     368                    $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
    364369                else
    365370                    $struc['files'] = array();
Note: See TracChangeset for help on using the changeset viewer.