Make WordPress Core


Ignore:
Timestamp:
09/09/2013 02:54:50 AM (12 years ago)
Author:
dd32
Message:

WP_Filesystem: Let the code breathe, add some additional whitespace between method definitions and comments.

File:
1 edited

Legend:

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

    r25304 r25305  
    2626        $this->errors = new WP_Error();
    2727    }
     28
    2829    /**
    2930     * connect filesystem.
     
    3435        return true;
    3536    }
     37
    3638    /**
    3739     * Reads entire file into a string
     
    4345        return @file_get_contents($file);
    4446    }
     47
    4548    /**
    4649     * Reads entire file into an array
     
    5255        return @file($file);
    5356    }
     57
    5458    /**
    5559     * Write a string to a file
     
    7680        return true;
    7781    }
     82
    7883    /**
    7984     * Gets the current working directory
     
    8489        return @getcwd();
    8590    }
     91
    8692    /**
    8793     * Change directory
     
    9399        return @chdir($dir);
    94100    }
     101
    95102    /**
    96103     * Changes file group
     
    108115        if ( ! $this->is_dir($file) )
    109116            return @chgrp($file, $group);
    110         //Is a directory, and we want recursive
     117        // Is a directory, and we want recursive
    111118        $file = trailingslashit($file);
    112119        $filelist = $this->dirlist($file);
     
    116123        return true;
    117124    }
     125
    118126    /**
    119127     * Changes filesystem permissions
     
    136144        if ( ! $recursive || ! $this->is_dir($file) )
    137145            return @chmod($file, $mode);
    138         //Is a directory, and we want recursive
     146        // Is a directory, and we want recursive
    139147        $file = trailingslashit($file);
    140148        $filelist = $this->dirlist($file);
     
    144152        return true;
    145153    }
     154
    146155    /**
    147156     * Changes file owner
     
    159168        if ( ! $this->is_dir($file) )
    160169            return @chown($file, $owner);
    161         //Is a directory, and we want recursive
     170        // Is a directory, and we want recursive
    162171        $filelist = $this->dirlist($file);
    163172        foreach ($filelist as $filename) {
     
    166175        return true;
    167176    }
     177
    168178    /**
    169179     * Gets file owner
     
    181191        return $ownerarray['name'];
    182192    }
     193
    183194    /**
    184195     * Gets file permissions
     
    192203        return substr(decoct(@fileperms($file)),3);
    193204    }
     205
    194206    function group($file) {
    195207        $gid = @filegroup($file);
     
    229241
    230242    function delete($file, $recursive = false, $type = false) {
    231         if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
    232             return false;
    233         $file = str_replace('\\', '/', $file); //for win32, occasional problems deleting files otherwise
     243        if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
     244            return false;
     245        $file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
    234246
    235247        if ( 'f' == $type || $this->is_file($file) )
     
    238250            return @rmdir($file);
    239251
    240         //At this point it's a folder, and we're in recursive mode
     252        // At this point it's a folder, and we're in recursive mode
    241253        $file = trailingslashit($file);
    242254        $filelist = $this->dirlist($file, true);
    243255
    244256        $retval = true;
    245         if ( is_array($filelist) ) //false if no files, So check first.
    246             foreach ($filelist as $filename => $fileinfo)
     257        if ( is_array( $filelist ) ) {
     258            foreach ( $filelist as $filename => $fileinfo ) {
    247259                if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
    248260                    $retval = false;
     261            }
     262        }
    249263
    250264        if ( file_exists($file) && ! @rmdir($file) )
    251265            $retval = false;
     266
    252267        return $retval;
    253268    }
     
    280295        return @filemtime($file);
    281296    }
     297
    282298    function size($file) {
    283299        return @filesize($file);
Note: See TracChangeset for help on using the changeset viewer.