Make WordPress Core


Ignore:
Timestamp:
09/15/2009 02:21:00 AM (17 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-direct.php

    r11930 r11934  
    308308    }
    309309
    310     function dirlist($path, $incdot = false, $recursive = false) {
     310    function dirlist($path, $include_hidden = true, $recursive = false) {
    311311        if ( $this->is_file($path) ) {
    312             $limitFile = basename($path);
     312            $limit_file = basename($path);
    313313            $path = dirname($path);
    314314        } else {
    315             $limitFile = false;
    316         }
     315            $limit_file = false;
     316        }
     317
    317318        if ( ! $this->is_dir($path) )
    318319            return false;
    319320
    320         $ret = array();
    321321        $dir = @dir($path);
    322322        if ( ! $dir )
    323323            return false;
     324
     325        $ret = array();
     326
    324327        while (false !== ($entry = $dir->read()) ) {
    325328            $struc = array();
     
    327330
    328331            if ( '.' == $struc['name'] || '..' == $struc['name'] )
    329                 continue; //Do not care about these folders.
    330             if ( '.' == $struc['name'][0] && !$incdot)
    331332                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)
    333338                continue;
    334339
     
    346351            if ( 'd' == $struc['type'] ) {
    347352                if ( $recursive )
    348                     $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
     353                    $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
    349354                else
    350355                    $struc['files'] = array();
Note: See TracChangeset for help on using the changeset viewer.