Changeset 28489
- Timestamp:
- 05/19/2014 12:11:21 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php
r26869 r28489 16 16 */ 17 17 class WP_Filesystem_FTPext extends WP_Filesystem_Base { 18 var$link;19 var$errors = null;20 var$options = array();21 22 function __construct($opt='') {18 public $link; 19 public $errors = null; 20 public $options = array(); 21 22 public function __construct($opt='') { 23 23 $this->method = 'ftpext'; 24 24 $this->errors = new WP_Error(); … … 64 64 } 65 65 66 function connect() {66 public function connect() { 67 67 if ( isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect') ) 68 68 $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT); … … 88 88 } 89 89 90 function get_contents( $file ) {90 public function get_contents( $file ) { 91 91 $tempfile = wp_tempnam($file); 92 92 $temp = fopen($tempfile, 'w+'); … … 109 109 } 110 110 111 function get_contents_array($file) {111 public function get_contents_array($file) { 112 112 return explode("\n", $this->get_contents($file)); 113 113 } 114 114 115 function put_contents($file, $contents, $mode = false ) {115 public function put_contents($file, $contents, $mode = false ) { 116 116 $tempfile = wp_tempnam($file); 117 117 $temp = fopen( $tempfile, 'wb+' ); … … 144 144 } 145 145 146 function cwd() {146 public function cwd() { 147 147 $cwd = @ftp_pwd($this->link); 148 148 if ( $cwd ) … … 151 151 } 152 152 153 function chdir($dir) {153 public function chdir($dir) { 154 154 return @ftp_chdir($this->link, $dir); 155 155 } 156 156 157 function chgrp($file, $group, $recursive = false ) {157 public function chgrp($file, $group, $recursive = false ) { 158 158 return false; 159 159 } 160 160 161 function chmod($file, $mode = false, $recursive = false) {161 public function chmod($file, $mode = false, $recursive = false) { 162 162 if ( ! $mode ) { 163 163 if ( $this->is_file($file) ) … … 182 182 } 183 183 184 function owner($file) {184 public function owner($file) { 185 185 $dir = $this->dirlist($file); 186 186 return $dir[$file]['owner']; 187 187 } 188 188 189 function getchmod($file) {189 public function getchmod($file) { 190 190 $dir = $this->dirlist($file); 191 191 return $dir[$file]['permsn']; 192 192 } 193 193 194 function group($file) {194 public function group($file) { 195 195 $dir = $this->dirlist($file); 196 196 return $dir[$file]['group']; 197 197 } 198 198 199 function copy($source, $destination, $overwrite = false, $mode = false) {199 public function copy($source, $destination, $overwrite = false, $mode = false) { 200 200 if ( ! $overwrite && $this->exists($destination) ) 201 201 return false; … … 206 206 } 207 207 208 function move($source, $destination, $overwrite = false) {208 public function move($source, $destination, $overwrite = false) { 209 209 return ftp_rename($this->link, $source, $destination); 210 210 } 211 211 212 function delete($file, $recursive = false, $type = false) {212 public function delete($file, $recursive = false, $type = false) { 213 213 if ( empty($file) ) 214 214 return false; … … 225 225 } 226 226 227 function exists($file) {227 public function exists($file) { 228 228 $list = @ftp_nlist($this->link, $file); 229 229 return !empty($list); //empty list = no file, so invert. 230 230 } 231 231 232 function is_file($file) {232 public function is_file($file) { 233 233 return $this->exists($file) && !$this->is_dir($file); 234 234 } 235 235 236 function is_dir($path) {236 public function is_dir($path) { 237 237 $cwd = $this->cwd(); 238 238 $result = @ftp_chdir($this->link, trailingslashit($path) ); … … 244 244 } 245 245 246 function is_readable($file) {246 public function is_readable($file) { 247 247 return true; 248 248 } 249 249 250 function is_writable($file) {250 public function is_writable($file) { 251 251 return true; 252 252 } 253 253 254 function atime($file) {254 public function atime($file) { 255 255 return false; 256 256 } 257 257 258 function mtime($file) {258 public function mtime($file) { 259 259 return ftp_mdtm($this->link, $file); 260 260 } 261 261 262 function size($file) {262 public function size($file) { 263 263 return ftp_size($this->link, $file); 264 264 } 265 265 266 function touch($file, $time = 0, $atime = 0) {266 public function touch($file, $time = 0, $atime = 0) { 267 267 return false; 268 268 } 269 269 270 function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {270 public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { 271 271 $path = untrailingslashit($path); 272 272 if ( empty($path) ) … … 283 283 } 284 284 285 function rmdir($path, $recursive = false) {285 public function rmdir($path, $recursive = false) { 286 286 return $this->delete($path, $recursive); 287 287 } 288 288 289 function parselisting($line) {289 public function parselisting($line) { 290 290 static $is_windows; 291 291 if ( is_null($is_windows) ) … … 360 360 } 361 361 362 function dirlist($path = '.', $include_hidden = true, $recursive = false) {362 public function dirlist($path = '.', $include_hidden = true, $recursive = false) { 363 363 if ( $this->is_file($path) ) { 364 364 $limit_file = basename($path); … … 409 409 } 410 410 411 function __destruct() {411 public function __destruct() { 412 412 if ( $this->link ) 413 413 ftp_close($this->link);
Note: See TracChangeset
for help on using the changeset viewer.