WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/09/2013 02:54:50 AM (8 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-ftpext.php

    r25304 r25305  
    2424        $this->errors = new WP_Error();
    2525
    26         //Check if possible to use ftp functions.
     26        // Check if possible to use ftp functions.
    2727        if ( ! extension_loaded('ftp') ) {
    2828            $this->errors->add('no_ftp_ext', __('The ftp PHP extension is not available'));
     
    3030        }
    3131
    32         // Set defaults:
    33         //This Class uses the timeout on a per-connection basis, Others use it on a per-action basis.
     32        // This Class uses the timeout on a per-connection basis, Others use it on a per-action basis.
    3433
    3534        if ( ! defined('FS_TIMEOUT') )
     
    8180        }
    8281
    83         //Set the Connection to use Passive FTP
     82        // Set the Connection to use Passive FTP
    8483        @ftp_pasv( $this->link, true );
    8584        if ( @ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FS_TIMEOUT )
     
    9998            return false;
    10099
    101         fseek($temp, 0); //Skip back to the start of the file being written to
     100        fseek( $temp, 0 ); // Skip back to the start of the file being written to
    102101        $contents = '';
    103102
     
    109108        return $contents;
    110109    }
     110
    111111    function get_contents_array($file) {
    112112        return explode("\n", $this->get_contents($file));
     
    137137        return $ret;
    138138    }
     139
    139140    function cwd() {
    140141        $cwd = @ftp_pwd($this->link);
     
    143144        return $cwd;
    144145    }
     146
    145147    function chdir($dir) {
    146148        return @ftp_chdir($this->link, $dir);
    147149    }
     150
    148151    function chgrp($file, $group, $recursive = false ) {
    149152        return false;
    150153    }
     154
    151155    function chmod($file, $mode = false, $recursive = false) {
    152156        if ( ! $mode ) {
     
    171175        return (bool)@ftp_chmod($this->link, $mode, $file);
    172176    }
     177
    173178    function chown($file, $owner, $recursive = false ) {
    174179        return false;
    175180    }
     181
    176182    function owner($file) {
    177183        $dir = $this->dirlist($file);
    178184        return $dir[$file]['owner'];
    179185    }
     186
    180187    function getchmod($file) {
    181188        $dir = $this->dirlist($file);
    182189        return $dir[$file]['permsn'];
    183190    }
     191
    184192    function group($file) {
    185193        $dir = $this->dirlist($file);
    186194        return $dir[$file]['group'];
    187195    }
     196
    188197    function copy($source, $destination, $overwrite = false, $mode = false) {
    189198        if ( ! $overwrite && $this->exists($destination) )
     
    194203        return $this->put_contents($destination, $content, $mode);
    195204    }
     205
    196206    function move($source, $destination, $overwrite = false) {
    197207        return ftp_rename($this->link, $source, $destination);
     
    217227        return !empty($list); //empty list = no file, so invert.
    218228    }
     229
    219230    function is_file($file) {
    220231        return $this->exists($file) && !$this->is_dir($file);
    221232    }
     233
    222234    function is_dir($path) {
    223235        $cwd = $this->cwd();
     
    229241        return false;
    230242    }
     243
    231244    function is_readable($file) {
    232         //Get dir list, Check if the file is readable by the current user??
    233245        return true;
    234246    }
     247
    235248    function is_writable($file) {
    236         //Get dir list, Check if the file is writable by the current user??
    237249        return true;
    238250    }
     251
    239252    function atime($file) {
    240253        return false;
    241254    }
     255
    242256    function mtime($file) {
    243257        return ftp_mdtm($this->link, $file);
    244258    }
     259
    245260    function size($file) {
    246261        return ftp_size($this->link, $file);
    247262    }
     263
    248264    function touch($file, $time = 0, $atime = 0) {
    249265        return false;
    250266    }
     267
    251268    function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
    252269        $path = untrailingslashit($path);
     
    263280        return true;
    264281    }
     282
    265283    function rmdir($path, $recursive = false) {
    266284        return $this->delete($path, $recursive);
Note: See TracChangeset for help on using the changeset viewer.