$this->method = 'ftpsockets';
$this->errors = new WP_Error();
// Check if possible to use ftp functions.
if ( ! @include_once( ABSPATH . 'wp-admin/includes/class-ftp.php' ) ) {
$this->method = 'ftpsockets';
$this->errors = new WP_Error();
// Check if possible to use ftp functions.
if ( ! @include_once( ABSPATH . 'wp-admin/includes/class-ftp.php' ) ) {
// Check if the options provided are OK.
if ( empty ($opt['username']) )
$this->errors->add('empty_username', __('FTP username is required'));
// Check if the options provided are OK.
if ( empty ($opt['username']) )
$this->errors->add('empty_username', __('FTP username is required'));
public function get_contents_array($file) {
return explode("\n", $this->get_contents($file) );
}
public function get_contents_array($file) {
return explode("\n", $this->get_contents($file) );
}
public function put_contents($file, $contents, $mode = false ) {
$temp = wp_tempnam( $file );
if ( ! $temphandle = @fopen($temp, 'w+') ) {
public function put_contents($file, $contents, $mode = false ) {
$temp = wp_tempnam( $file );
if ( ! $temphandle = @fopen($temp, 'w+') ) {
public function chmod($file, $mode = false, $recursive = false ) {
if ( ! $mode ) {
if ( $this->is_file($file) )
public function chmod($file, $mode = false, $recursive = false ) {
if ( ! $mode ) {
if ( $this->is_file($file) )
public function owner($file) {
$dir = $this->dirlist($file);
return $dir[$file]['owner'];
}
public function owner($file) {
$dir = $this->dirlist($file);
return $dir[$file]['owner'];
}
public function getchmod($file) {
$dir = $this->dirlist($file);
return $dir[$file]['permsn'];
}
public function getchmod($file) {
$dir = $this->dirlist($file);
return $dir[$file]['permsn'];
}
public function group($file) {
$dir = $this->dirlist($file);
return $dir[$file]['group'];
}
public function group($file) {
$dir = $this->dirlist($file);
return $dir[$file]['group'];
}
public function copy($source, $destination, $overwrite = false, $mode = false) {
if ( ! $overwrite && $this->exists($destination) )
return false;
public function copy($source, $destination, $overwrite = false, $mode = false) {
if ( ! $overwrite && $this->exists($destination) )
return false;
public function move($source, $destination, $overwrite = false ) {
return $this->ftp->rename($source, $destination);
}
public function move($source, $destination, $overwrite = false ) {
return $this->ftp->rename($source, $destination);
}
return !empty( $list ); //empty list = no file, so invert.
// Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
}
return !empty( $list ); //empty list = no file, so invert.
// Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
}
public function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
$path = untrailingslashit($path);
if ( empty($path) )
public function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
$path = untrailingslashit($path);
if ( empty($path) )
public function rmdir($path, $recursive = false ) {
$this->delete($path, $recursive);
}
public function rmdir($path, $recursive = false ) {
$this->delete($path, $recursive);
}
public function dirlist($path = '.', $include_hidden = true, $recursive = false ) {
if ( $this->is_file($path) ) {
$limit_file = basename($path);
public function dirlist($path = '.', $include_hidden = true, $recursive = false ) {
if ( $this->is_file($path) ) {
$limit_file = basename($path);