abstract class FileTransferFTP in Drupal 7
Base class for FTP implementations.
Hierarchy
- class \FileTransfer
- class \FileTransferFTP
Expanded class hierarchy of FileTransferFTP
1 string reference to 'FileTransferFTP'
- system_filetransfer_info in modules/
system/ system.module - Implements hook_filetransfer_info().
File
- includes/
filetransfer/ ftp.inc, line 6
View source
abstract class FileTransferFTP extends FileTransfer {
public function __construct($jail, $username, $password, $hostname, $port) {
$this->username = $username;
$this->password = $password;
$this->hostname = $hostname;
$this->port = $port;
parent::__construct($jail);
}
/**
* Return an object which can implement the FTP protocol.
*
* @param string $jail
* @param array $settings
* @return FileTransferFTP
* The appropriate FileTransferFTP subclass based on the available
* options. If the FTP PHP extension is available, use it.
*/
static function factory($jail, $settings) {
$username = empty($settings['username']) ? '' : $settings['username'];
$password = empty($settings['password']) ? '' : $settings['password'];
$hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname'];
$port = empty($settings['advanced']['port']) ? 21 : $settings['advanced']['port'];
if (function_exists('ftp_connect')) {
$class = 'FileTransferFTPExtension';
}
else {
throw new FileTransferException('No FTP backend available.');
}
return new $class($jail, $username, $password, $hostname, $port);
}
/**
* Returns the form to configure the FileTransfer class for FTP.
*/
public function getSettingsForm() {
$form = parent::getSettingsForm();
$form['advanced']['port']['#default_value'] = 21;
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileTransfer:: |
protected | property | ||
FileTransfer:: |
protected | property | 1 | |
FileTransfer:: |
protected | property | 1 | |
FileTransfer:: |
protected | property | 1 | |
FileTransfer:: |
final protected | function | Checks that the path is inside the jail and throws an exception if not. | |
FileTransfer:: |
final public | function | ||
FileTransfer:: |
abstract protected | function | Connect to the server. | 4 |
FileTransfer:: |
final public | function | Copies a directory. | |
FileTransfer:: |
protected | function | Copies a directory. | 1 |
FileTransfer:: |
final public | function | Copies a file. | |
FileTransfer:: |
abstract protected | function | Copies a file. | 4 |
FileTransfer:: |
final public | function | Creates a directory. | |
FileTransfer:: |
abstract protected | function | Creates a directory. | 4 |
FileTransfer:: |
function | Return the chroot property for this connection. | ||
FileTransfer:: |
final protected | function | Returns a modified path suitable for passing to the server. If a path is a windows path, makes it POSIX compliant by removing the drive letter. If $this->chroot has a value, it is stripped from the path to allow for chroot'd filetransfer systems. | |
FileTransfer:: |
abstract public | function | Checks if a particular path is a directory | 4 |
FileTransfer:: |
abstract public | function | Checks if a particular path is a file (not a directory). | 4 |
FileTransfer:: |
final public | function | Removes a directory. | |
FileTransfer:: |
abstract protected | function | Removes a directory. | 4 |
FileTransfer:: |
final public | function | Removes a file. | |
FileTransfer:: |
abstract protected | function | Removes a file. | 4 |
FileTransfer:: |
function | Changes backslashes to slashes, also removes a trailing slash. | ||
FileTransfer:: |
function | Sets the chroot and changes the jail to match the correct path scheme | ||
FileTransfer:: |
function | Implementation of the magic __get() method. | ||
FileTransferFTP:: |
static | function |
Return an object which can implement the FTP protocol. Overrides FileTransfer:: |
|
FileTransferFTP:: |
public | function |
Returns the form to configure the FileTransfer class for FTP. Overrides FileTransfer:: |
|
FileTransferFTP:: |
public | function |
The constructor for the UpdateConnection class. This method is also called
from the classes that extend this class and override this method. Overrides FileTransfer:: |