Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5. Some parts of this website may be subject to other licenses.

 Class JFTP

Description

FTP client class

Located in /joomla/client/ftp.php (line 61)

Class JObject   (Subpackage Base)

Class JFTP   (Subpackage Client)
Method Summary
Constructor JFTP __construct ([array $options = array()])
Destructor void __destruct ()
Method boolean chdir (string $path)
Method boolean chmod (string $path, string/int $mode)
Method boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
Method boolean create (string $path)
Method boolean delete (string $path)
Method boolean get (string $local, string $remote)
Method JFTP &getInstance ([string $host = '127.0.0.1'], [string $port = '21'], [array $options = null], [string $user = null], [string $pass = null])
Method boolean isConnected ()
Method mixed listDetails ([string $path = null], [string $type = 'all'], boolean $search)
Method string listNames ([string $path = null])
Method boolean login ([string $user = 'anonymous'], [string $pass = 'jftp@joomla.org'])
Method boolean mkdir (string $path)
Method string pwd ()
Method boolean quit ()
Method boolean read (string $remote,  &$buffer, string $buffer)
Method boolean reinit ()
Method boolean rename (string $from, string $to)
Method boolean restart (int $point)
Method boolean setOptions (array $options)
Method boolean store (string $local, [string $remote = null])
Method string syst ()
Method boolean write (string $remote, string $buffer)
Variables

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 145)

JFTP object constructor

  • since: 1.5
  • access: protected
JFTP __construct ([array $options = array()])
  • array $options: Associative array of options to set

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
Destructor __destruct (line 182)

JFTP object destructor

Closes an existing connection, if we have one

  • since: 1.5
  • access: protected
void __destruct ()
chdir (line 448)

Method to change the current working directory on the FTP server

  • return: True if successful
  • access: public
boolean chdir (string $path)
  • string $path: Path to change into on the server
chmod (line 538)

Method to change mode for a path on the FTP server

  • return: True if successful
  • access: public
boolean chmod (string $path, string/int $mode)
  • string $path: Path to change mode on
  • string/int $mode: Octal value to change mode to, e.g. '0777', 0777 or 511
connect (line 258)

Method to connect to a FTP server

  • return: True if successful
  • access: public
boolean connect ([string $host = '127.0.0.1'], [string $port = 21])
  • string $host: Host to connect to [Default: 127.0.0.1]
  • string $port: Port to connect on [Default: port 21]
create (line 661)

Method to create an empty file on the FTP server

  • return: True if successful
  • access: public
boolean create (string $path)
  • string $path: Path local file to store on the FTP server
delete (line 578)

Method to delete a path [file/folder] on the FTP server

  • return: True if successful
  • access: public
boolean delete (string $path)
  • string $path: Path to delete
get (line 785)

Method to get a file from the FTP server and save it to a local file

  • return: True if successful
  • access: public
boolean get (string $local, string $remote)
  • string $local: Path to local file to save remote file as
  • string $remote: Path to remote file to get on the FTP server

Redefinition of:
JObject::get()
Returns a property of the object or the default value if the property is not set.
getInstance (line 208)

Returns a reference to the global FTP connector object, only creating it if it doesn't already exist.

This method must be invoked as:

  $ftp = &JFTP::getInstance($host);

You may optionally specify a username and password in the parameters. If you do so, you may not login() again with different credentials using the same object. If you do not use this option, you must quit() the current connection when you are done, to free it for use by others.

  • return: The FTP Client object.
  • since: 1.5
JFTP &getInstance ([string $host = '127.0.0.1'], [string $port = '21'], [array $options = null], [string $user = null], [string $pass = null])
  • string $host: Host to connect to
  • string $port: Port to connect to
  • array $options: Array with any of these options: type=>[FTP_AUTOASCII|FTP_ASCII|FTP_BINARY], timeout=>(int)
  • string $user: Username to use for a connection
  • string $pass: Password to use for a connection
isConnected (line 307)

Method to determine if the object is connected to an FTP server

  • return: True if connected
  • since: 1.5
  • access: public
boolean isConnected ()
listDetails (line 1094)

Method to list the contents of a directory on the FTP server

  • return: : if $type is raw: string Directory listing, otherwise array of string with file-names
  • access: public
mixed listDetails ([string $path = null], [string $type = 'all'], boolean $search)
  • string $path: Path local file to store on the FTP server
  • string $type: Return type [raw|all|folders|files]
  • boolean $search: Recursively search subdirectories
listNames (line 1010)

Method to list the filenames of the contents of a directory on the FTP server

Note: Some servers also return folder names. However, to be sure to list folders on all servers, you should use listDetails() instead, if you also need to deal with folders

  • return: Directory listing
  • access: public
string listNames ([string $path = null])
  • string $path: Path local file to store on the FTP server
login (line 320)

Method to login to a server once connected

  • return: True if successful
  • access: public
boolean login ([string $user = 'anonymous'], [string $pass = 'jftp@joomla.org'])
  • string $user: Username to login to the server
  • string $pass: Password to login to the server
mkdir (line 608)

Method to create a directory on the FTP server

  • return: True if successful
  • access: public
boolean mkdir (string $path)
  • string $path: Directory to create
pwd (line 378)

Method to retrieve the current working directory on the FTP server

  • return: Current working directory
  • access: public
string pwd ()
quit (line 357)

Method to quit and close the connection

  • return: True if successful
  • access: public
boolean quit ()
read (line 712)

Method to read a file from the FTP server's contents into a buffer

  • return: True if successful
  • access: public
boolean read (string $remote,  &$buffer, string $buffer)
  • string $remote: Path to remote file to read on the FTP server
  • string $buffer: Buffer variable to read file contents into
  • &$buffer
reinit (line 476)

Method to reinitialize the server, ie. need to login again

NOTE: This command not available on all servers

  • return: True if successful
  • access: public
boolean reinit ()
rename (line 504)

Method to rename a file/folder on the FTP server

  • return: True if successful
  • access: public
boolean rename (string $from, string $to)
  • string $from: Path to change file/folder from
  • string $to: Path to change file/folder to
restart (line 634)

Method to restart data transfer at a given byte

  • return: True if successful
  • access: public
boolean restart (int $point)
  • int $point: Byte to restart transfer at
setOptions (line 239)

Set client options

  • return: True if successful
  • access: public
boolean setOptions (array $options)
  • array $options: Associative array of options to set
store (line 852)

Method to store a file to the FTP server

  • return: True if successful
  • access: public
boolean store (string $local, [string $remote = null])
  • string $local: Path to local file to store on the FTP server
  • string $remote: FTP path to file to create
syst (line 411)

Method to system string from the FTP server

  • return: System identifier string
  • access: public
string syst ()
write (line 938)

Method to write a string to the FTP server

  • return: True if successful
  • access: public
boolean write (string $remote, string $buffer)
  • string $remote: FTP path to file to write to
  • string $buffer: Contents to write to the FTP server

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::getPublicProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::toString()

Documentation generated on Tue, 29 Jan 2008 18:46:15 +0000 by phpDocumentor 1.3.1