Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct ($writeprefix='', $readprefix='', $context=array()) | |
__destruct () | |
open ( $filename, $mode='r', $useIncludePath=false, $context=null, $usePrefix=false, $relative=false, $detectProcessingMode=false) | |
close () | |
eof () | |
filesize () | |
gets ($length=0) | |
read ($length=0) | |
seek ($offset, $whence=SEEK_SET) | |
tell () | |
write (&$string, $length=0, $chunk=0) | |
chmod ($filename='', $mode=0) | |
get_meta_data () | |
_buildContext () | |
setContextOptions ($context) | |
addContextEntry ($wrapper, $name, $value) | |
deleteContextEntry ($wrapper, $name) | |
applyContextToStream () | |
appendFilter ($filterName, $readWrite=STREAM_FILTER_READ, $params=array()) | |
prependFilter ($filterName, $readWrite=STREAM_FILTER_READ, $params=array()) | |
removeFilter (&$resource, $byindex=false) | |
copy ($src, $dest, $context=null, $usePrefix=true, $relative=false) | |
move ($src, $dest, $context=null, $usePrefix=true, $relative=false) | |
delete ($filename, $context=null, $usePrefix=true, $relative=false) | |
upload ($src, $dest, $context=null, $usePrefix=true, $relative=false) | |
writeFile ($filename, &$buffer) | |
_getFilename ($filename, $mode, $usePrefix, $relative) | |
getFileHandle () | |
Fonctions membres publiques hérités de CMSObject | |
__construct ($properties=null) | |
__toString () | |
def ($property, $default=null) | |
get ($property, $default=null) | |
getProperties ($public=true) | |
getError ($i=null, $toString=true) | |
getErrors () | |
set ($property, $value=null) | |
setProperties ($properties) | |
setError ($error) | |
Attributs protégés | |
$filemode = 0644 | |
$dirmode = 0755 | |
$chunksize = 8192 | |
$filename | |
$writeprefix | |
$readprefix | |
$processingmethod = 'f' | |
$filters = array() | |
$fh | |
$filesize | |
$context = null | |
$contextOptions | |
$openmode | |
Attributs protégés hérités de CMSObject | |
$_errors = array() | |
Joomla! Stream Interface
The Joomla! stream interface is designed to handle files as streams where as the legacy File static class treated files in a rather atomic manner.
__construct | ( | $writeprefix = '' , |
|
$readprefix = '' , |
|||
$context = array() |
|||
) |
Constructor
string | $writeprefix | Prefix of the stream (optional). Unlike the JPATH_*, this has a final path separator! |
string | $readprefix | The read prefix (optional). |
array | $context | The context options (optional). |
Références $context.
__destruct | ( | ) |
Destructor
_buildContext | ( | ) |
_getFilename | ( | $filename, | |
$mode, | |||
$usePrefix, | |||
$relative | |||
) |
Determine the appropriate 'filename' of a file
string | $filename | Original filename of the file |
string | $mode | Mode string to retrieve the filename |
boolean | $usePrefix | Controls the use of a prefix |
boolean | $relative | Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped. |
Références $mode, FilesystemHelper\getWriteModes(), et JPATH_ROOT.
addContextEntry | ( | $wrapper, | |
$name, | |||
$value | |||
) |
Adds a particular options to the context
string | $wrapper | The wrapper to use |
string | $name | The option to set |
string | $value | The value of the option |
Stream Context Creation https://www.php.net/manual/en/context.php Context Options for various streams 1.7.0
appendFilter | ( | $filterName, | |
$readWrite = STREAM_FILTER_READ , |
|||
$params = array() |
|||
) |
applyContextToStream | ( | ) |
Applies the current context to the stream
Use this to change the values of the context after you've opened a stream
chmod | ( | $filename = '' , |
|
$mode = 0 |
|||
) |
Chmod wrapper
string | $filename | File name. |
mixed | $mode | Mode to use. |
Références $mode, Text\_(), et FilesystemHelper\ftpChmod().
close | ( | ) |
Copy a file from src to dest
string | $src | The file path to copy from. |
string | $dest | The file path to copy to. |
resource | $context | A valid context resource (optional) created with stream_context_create. |
boolean | $usePrefix | Controls the use of a prefix (optional). |
boolean | $relative | Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped. |
Delete a file
string | $filename | The file path to delete. |
resource | $context | A valid context resource (optional) created with stream_context_create. |
boolean | $usePrefix | Controls the use of a prefix (optional). |
boolean | $relative | Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped. |
deleteContextEntry | ( | $wrapper, | |
$name | |||
) |
eof | ( | ) |
Work out if we're at the end of the file for a stream
Références Text\_().
filesize | ( | ) |
Retrieve the file size of the path
Références Text\_(), et FilesystemHelper\remotefsize().
get_meta_data | ( | ) |
getFileHandle | ( | ) |
gets | ( | $length = 0 | ) |
Get a line from the stream source.
integer | $length | The number of bytes (optional) to read. |
Références Text\_().
Moves a file
string | $src | The file path to move from. |
string | $dest | The file path to move to. |
resource | $context | A valid context resource (optional) created with stream_context_create. |
boolean | $usePrefix | Controls the use of a prefix (optional). |
boolean | $relative | Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped. |
open | ( | $filename, | |
$mode = 'r' , |
|||
$useIncludePath = false , |
|||
$context = null , |
|||
$usePrefix = false , |
|||
$relative = false , |
|||
$detectProcessingMode = false |
|||
) |
Generic File Operations
Open a stream with some lazy loading smarts
string | $filename | Filename |
string | $mode | Mode string to use |
boolean | $useIncludePath | Use the PHP include path |
resource | $context | Context to use when opening |
boolean | $usePrefix | Use a prefix to open the file |
boolean | $relative | Filename is a relative path (if false, strips JPATH_ROOT to make it relative) |
boolean | $detectProcessingMode | Detect the processing method for the file and use the appropriate function to handle output automatically |
Références $context, $mode, $url, Text\_(), __DIR__, elseif, File\getExt(), et FilesystemHelper\isJoomlaStream().
prependFilter | ( | $filterName, | |
$readWrite = STREAM_FILTER_READ , |
|||
$params = array() |
|||
) |
read | ( | $length = 0 | ) |
removeFilter | ( | & | $resource, |
$byindex = false |
|||
) |
Remove a filter, either by resource (handed out from the append or prepend function) or via getting the filter list)
resource | $resource | The resource. |
boolean | $byindex | The index of the filter. |
seek | ( | $offset, | |
$whence = SEEK_SET |
|||
) |
Seek the file
Note: the return value is different to that of fseek
integer | $offset | Offset to use when seeking. |
integer | $whence | Seek mode to use. |
Références Joomla\Database\Query\$offset, et Text\_().
setContextOptions | ( | $context | ) |
tell | ( | ) |
Returns the current position of the file read/write pointer.
Références Text\_().
Upload a file
string | $src | The file path to copy from (usually a temp folder). |
string | $dest | The file path to copy to. |
resource | $context | A valid context resource (optional) created with stream_context_create. |
boolean | $usePrefix | Controls the use of a prefix (optional). |
boolean | $relative | Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped. |
write | ( | & | $string, |
$length = 0 , |
|||
$chunk = 0 |
|||
) |
File write
Whilst this function accepts a reference, the underlying fwrite will do a copy! This will roughly double the memory allocation for any write you do. Specifying chunked will get around this by only writing in specific chunk sizes. This defaults to 8192 which is a sane number to use most of the time (change the default with JStream::set('chunksize', newsize);) Note: This doesn't support gzip/bzip2 writing like reading does
string | $string | Reference to the string to write. |
integer | $length | Length of the string to write. |
integer | $chunk | Size of chunks to write in. |
writeFile | ( | $filename, | |
& | $buffer | ||
) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |