wp-admin/includes/class-wp-filesystem-ftpext.php:24WordPress Filesystem Class for implementing FTP.
$linkFTP\Connection|resource|falsepublic$optionsarraypublicclass WP_Filesystem_FTPext extends WP_Filesystem_Base { /** * @since 2.5.0 * @var FTP\Connection|resource|false */ public $link; /** * @since 7.1.0 * @var array * @phpstan-var Options */ public $options; /** * Constructor. * * @since 2.5.0 * * @param array $opt { * Array of connection options. * * @type string $hostname Required. FTP server hostname. * @type string $username Required. FTP username. * @type string $password Required. FTP password. * @type int $port Optional. FTP server port. Default 21. * @type string $connection_type Optional. Connection type. Use 'ftps' to enable SSL. * } * @phpstan-param array{ * hostname: non-empty-string, * username: non-empty-string, * password: string, * port?: non-negative-int, * connection_type?: 'ftps', * }|null $opt */ public function __construct( $opt = null ) { $this->method = 'ftpext'; $this->errors = new WP_Error(); $this->options = array( 'port' => 21, 'hostname' => '', 'username' => '', 'password' => '', 'ssl' => false, ); // Check if possible to use ftp functions. if ( ! extension_loaded( 'ftp' ) ) { $this->errors->add( 'no_ftp_ext', __( 'The ftp PHP extension is not available' ) ); return; } // This class uses the timeout on a per-connection basis, others use it on a per-action basis. if ( ! defined( 'FS_TIMEOUT' ) ) { define( 'FS_TIMEOUT', 4 * MINUTE_IN_SECONDS ); } if ( ! is_array( $opt ) ) { $opt = array(); } if ( ! empty( $opt['port'] ) ) { $this->options['port'] = $opt['port']; } if ( empty( $opt['hostname'] ) ) { $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) ); } else { $this->options['hostname'] = $opt['hostname']; } // Check if the options provided are OK. if ( empty( $opt['username'] ) ) { $this->errors->add( 'empty_username', __( 'FTP username is required' ) ); } else { $this->options['username'] = $opt['username']; }Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-admin/includes/class-wp-filesystem-ftpext.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.