Документация по Joomla 1.7

Joomla.Platform\JFTP
libraries/joomla/client/ftp.php at line 56

Class JFTP

JObject
└─JFTP

public class JFTP
extends JObject

FTP client class

Subpackage:
Client
Since:
11.1

Field Summary
private string Native OS Type

$_OS

private array Array to hold ascii format file extensions

$_autoAscii

private resource Socket resource

$_conn

private resource Data port connection resource

$_dataconn

private array

$_lineEndings

Array to hold native line ending characters

private array Passive connection information

$_pasv

private string Response Message

$_response

private integer Timeout limit

$_timeout

private integer Transfer Type

$_type

Fields inherited from Joomla.Platform\JObject
_errors
Constructor Summary

__construct(array options, mixed properties)

JFTP object constructor

Method Summary
JFTP

getInstance(string host, string port, array options, string user, string pass)

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

static boolean

setOptions(array options)

Set client options

boolean

connect(string host, string port)

Method to connect to a FTP server

boolean

isConnected()

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

boolean

login(string user, string pass)

Method to login to a server once connected

boolean

quit()

Method to quit and close the connection

string

pwd()

Method to retrieve the current working directory on the FTP server

string

syst()

Method to system string from the FTP server

boolean

chdir(string path)

Method to change the current working directory on the FTP server

boolean

reinit()

Method to reinitialise the server, ie.

boolean

rename(string from, string to)

Method to rename a file/folder on the FTP server

boolean

chmod(string path, mixed mode)

Method to change mode for a path on the FTP server

boolean

delete(string path)

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

boolean

mkdir(string path)

Method to create a directory on the FTP server

boolean

restart(integer point)

Method to restart data transfer at a given byte

boolean

create(string path)

Method to create an empty file on the FTP server

boolean

read(string remote, string buffer)

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

boolean

get(string local, string remote, string property, mixed default)

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

boolean

store(string local, string remote)

Method to store a file to the FTP server

boolean

write(string remote, string buffer)

Method to write a string to the FTP server

string

listNames(string path)

Method to list the filenames of the contents of a directory on the FTP serverNote: Some servers also return folder names.

mixed

listDetails(string path, string type, boolean search)

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

private boolean

_putCmd(string cmd, mixed expectedResponse)

Send command to the FTP server and validate an expected response code

private boolean

_verifyResponse(mixed expected)

Verify the response code from the server and log response if flag is set

private boolean

_passive()

Set server to passive mode and open a data port connection

private integer

_findMode(string fileName)

Method to find out the correct transfer mode for a specific file

private boolean

_mode(integer mode)

Set transfer mode

Methods inherited from Joomla.Platform\JObject
__construct, __toString, def, get, getError, getErrors, getProperties, set, setError, setProperties, toString

Field Detail

libraries/joomla/client/ftp.php at line 99

_OS

private string Native OS Type $_OS = null

Since:
11.1

libraries/joomla/client/ftp.php at line 105

_autoAscii

private array Array to hold ascii format file extensions $_autoAscii = array(...)

Since:
11.1

libraries/joomla/client/ftp.php at line 63

_conn

private resource Socket resource $_conn = null

Since:
11.1

libraries/joomla/client/ftp.php at line 69

_dataconn

private resource Data port connection resource $_dataconn = null

Since:
11.1

libraries/joomla/client/ftp.php at line 113

_lineEndings

private array $_lineEndings = array(...)

Array to hold native line ending characters

Since:
11.1

libraries/joomla/client/ftp.php at line 75

_pasv

private array Passive connection information $_pasv = null

Since:
11.1

libraries/joomla/client/ftp.php at line 81

_response

private string Response Message $_response = null

Since:
11.1

libraries/joomla/client/ftp.php at line 87

_timeout

private integer Timeout limit $_timeout = 15

Since:
11.1

libraries/joomla/client/ftp.php at line 93

_type

private integer Transfer Type $_type = null

Since:
11.1

Constructor Detail

libraries/joomla/client/ftp.php at line 123

__construct

public __construct(array options, mixed properties)

JFTP object constructor

Parameters:
options - Associative array of options to set
Since:
11.1

Method Detail

libraries/joomla/client/ftp.php at line 180

getInstance

public JFTP getInstance(string host, string port, array options, string user, string pass)

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

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.

Parameters:
host - Host to connect to
port - Port to connect to
options - Array with any of these options: type=>[FTP_AUTOASCII|FTP_ASCII|FTP_BINARY], timeout=>(int)
user - Username to use for a connection
pass - Password to use for a connection
Returns:
The FTP Client object.
Since:
11.1

libraries/joomla/client/ftp.php at line 212

setOptions

public static boolean setOptions(array options)

Set client options

Parameters:
options - Associative array of options to set
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 232

connect

public boolean connect(string host, string port)

Method to connect to a FTP server

Parameters:
host - Host to connect to [Default: 127.0.0.1]
port - Port to connect on [Default: port 21]
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 280

isConnected

public boolean isConnected()

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

Returns:
True if connected
Since:
11.1

libraries/joomla/client/ftp.php at line 294

login

public boolean login(string user, string pass)

Method to login to a server once connected

Parameters:
user - Username to login to the server
pass - Password to login to the server
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 331

quit

public boolean quit()

Method to quit and close the connection

Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 352

pwd

public string pwd()

Method to retrieve the current working directory on the FTP server

Returns:
Current working directory
Since:
11.1

libraries/joomla/client/ftp.php at line 385

syst

public string syst()

Method to system string from the FTP server

Returns:
System identifier string
Since:
11.1

libraries/joomla/client/ftp.php at line 423

chdir

public boolean chdir(string path)

Method to change the current working directory on the FTP server

Parameters:
path - Path to change into on the server
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 451

reinit

public boolean reinit()

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

NOTE: This command not available on all servers

Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 480

rename

public boolean rename(string from, string to)

Method to rename a file/folder on the FTP server

Parameters:
from - Path to change file/folder from
to - Path to change file/folder to
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 515

chmod

public boolean chmod(string path, mixed mode)

Method to change mode for a path on the FTP server

Parameters:
path - Path to change mode on
mode - Octal value to change mode to, e.g. '0777', 0777 or 511 (string or integer)
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 556

delete

public boolean delete(string path)

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

Parameters:
path - Path to delete
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 587

mkdir

public boolean mkdir(string path)

Method to create a directory on the FTP server

Parameters:
path - Directory to create
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 614

restart

public boolean restart(integer point)

Method to restart data transfer at a given byte

Parameters:
point - Byte to restart transfer at
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 642

create

public boolean create(string path)

Method to create an empty file on the FTP server

Parameters:
path - Path local file to store on the FTP server
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 694

read

public boolean read(string remote, string buffer)

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

Parameters:
remote - Path to remote file to read on the FTP server
buffer - Buffer variable to read file contents into
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 768

get

public boolean get(string local, string remote, string property, mixed default)

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

Parameters:
local - Local path to save remote file to
remote - Path to remote file to get on the FTP server
Returns:
True if successful
Since:
11.1
See Also:
getProperties()

libraries/joomla/client/ftp.php at line 837

store

public boolean store(string local, string remote)

Method to store a file to the FTP server

Parameters:
local - Path to local file to store on the FTP server
remote - FTP path to file to create
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 924

write

public boolean write(string remote, string buffer)

Method to write a string to the FTP server

Parameters:
remote - FTP path to file to write to
buffer - Contents to write to the FTP server
Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 997

listNames

public string listNames(string path)

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

Parameters:
path - Path local file to store on the FTP server
Returns:
Directory listing
Since:
11.1

libraries/joomla/client/ftp.php at line 1081

listDetails

public mixed listDetails(string path, string type, boolean search)

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

Parameters:
path - Path to the local file to be stored on the FTP server
type - Return type [raw|all|folders|files]
search - Recursively search subdirectories
Returns:
If $type is raw: string Directory listing, otherwise array of string with file-names

libraries/joomla/client/ftp.php at line 1280

_putCmd

private boolean _putCmd(string cmd, mixed expectedResponse)

Send command to the FTP server and validate an expected response code

Parameters:
cmd - Command to send to the FTP server
expectedResponse - Integer response code or array of integer response codes
Returns:
True if command executed successfully
Since:
11.1

libraries/joomla/client/ftp.php at line 1303

_verifyResponse

private boolean _verifyResponse(mixed expected)

Verify the response code from the server and log response if flag is set

Parameters:
expected - Integer response code or array of integer response codes
Returns:
True if response code from the server is expected

libraries/joomla/client/ftp.php at line 1348

_passive

private boolean _passive()

Set server to passive mode and open a data port connection

Returns:
True if successful
Since:
11.1

libraries/joomla/client/ftp.php at line 1418

_findMode

private integer _findMode(string fileName)

Method to find out the correct transfer mode for a specific file

Parameters:
fileName - Name of the file
Returns:
Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]
Since:
11.1

libraries/joomla/client/ftp.php at line 1445

_mode

private boolean _mode(integer mode)

Set transfer mode

Parameters:
mode - Integer representation of data transfer mode [1:Binary|0:Ascii] Defined constants can also be used [FTP_BINARY|FTP_ASCII]
Returns:
True if successful
Since:
11.1

Документация по Joomla 1.7