Class FOFDownload
Methods summary
public
|
#
__construct( )
Creates a new download object and assigns it the most fitting download
adapter
Creates a new download object and assigns it the most fitting download
adapter
|
public
|
#
setAdapter( string $className )
Forces the use of a specific adapter
Forces the use of a specific adapter
Parameters
- $className
string - $className The name of the class or the name of the adapter, e.g.
'FOFDownloadAdapterCurl' or 'curl'
|
public
string
|
#
getAdapterName( )
Returns the name of the current adapter
Returns the name of the current adapter
Returns
string
|
public
|
#
setAdapterOptions( array $options )
Sets the additional options for the adapter
Sets the additional options for the adapter
Parameters
- $options
array - $options
|
public
array
|
#
getAdapterOptions( )
Returns the additional options for the adapter
Returns the additional options for the adapter
Returns
array
|
public
boolean|string
|
#
getFromURL( string $url )
Download data from a URL and return it
Download data from a URL and return it
Parameters
- $url
string - $url The URL to download from
Returns
boolean|string - The downloaded data or false on failure
|
public
array
|
#
importFromURL( array $params )
Performs the staggered download of file. The downloaded file will be stored
in Joomla!'s temp-path using the basename of the URL as a filename
Performs the staggered download of file. The downloaded file will be stored
in Joomla!'s temp-path using the basename of the URL as a filename
The $params array can have any of the following keys url The file being
downloaded frag Rolling counter of the file fragment being downloaded totalSize
The total size of the file being downloaded, in bytes doneSize How many bytes we
have already downloaded maxExecTime Maximum execution time downloading file
fragments, in seconds length How many bytes to download at once
The array returned is in the following format:
status True if there are no errors, false if there are errors error A string
with the error message if there are errors frag The next file fragment to
download totalSize The total size of the downloaded file in bytes, if the server
supports HEAD requests doneSize How many bytes have already been downloaded
percent % of the file already downloaded (if totalSize could be determined)
localfile The name of the local file, without the path
Parameters
- $params
array - $params A parameters array, as sent by the user interface
Returns
array - A return status array
|
protected static
array
|
#
getFiles( string $path, array $ignoreFolders = array(), array $ignoreFiles = array() )
This method will crawl a starting directory and get all the valid files that
will be analyzed by __construct. Then it organizes them into an associative
array.
This method will crawl a starting directory and get all the valid files that
will be analyzed by __construct. Then it organizes them into an associative
array.
Parameters
- $path
string - $path Folder where we should start looking
- $ignoreFolders
array - $ignoreFolders Folder ignore list
- $ignoreFiles
array - $ignoreFiles File ignore list
Returns
array - Associative array, where the fullpath key contains the path to the
file, and the classname key contains the name of the class
|
protected static
array
|
#
scanDirectory( string $path, array $ignoreFolders = array(), array $ignoreFiles = array() )
Recursive function that will scan every directory unless it's in the ignore
list. Files that aren't in the ignore list are returned.
Recursive function that will scan every directory unless it's in the ignore
list. Files that aren't in the ignore list are returned.
Parameters
- $path
string - $path Folder where we should start looking
- $ignoreFolders
array - $ignoreFolders Folder ignore list
- $ignoreFiles
array - $ignoreFiles File ignore list
Returns
array - List of all the files
|
Magic methods summary