Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Stream
+ Graphe d'héritage de Stream:

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()
 

Description détaillée

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.

Note
This class adheres to the stream wrapper operations: https://www.php.net/manual/en/intro.stream.php PHP Stream Manual https://www.php.net/manual/en/wrappers.php Stream Wrappers https://www.php.net/manual/en/filters.php Stream Filters https://www.php.net/manual/en/transports.php Socket Transports (used by some options, particularly HTTP proxy) 1.7.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $writeprefix = '',
  $readprefix = '',
  $context = array() 
)

Constructor

Paramètres
string$writeprefixPrefix of the stream (optional). Unlike the JPATH_*, this has a final path separator!
string$readprefixThe read prefix (optional).
array$contextThe context options (optional).
Depuis
1.7.0

Références $context.

◆ __destruct()

__destruct ( )

Destructor

Depuis
1.7.0

Documentation des fonctions membres

◆ _buildContext()

_buildContext ( )

Stream contexts Builds the context from the array

Renvoie
mixed
Depuis
1.7.0

Références null.

◆ _getFilename()

_getFilename (   $filename,
  $mode,
  $usePrefix,
  $relative 
)

Determine the appropriate 'filename' of a file

Paramètres
string$filenameOriginal filename of the file
string$modeMode string to retrieve the filename
boolean$usePrefixControls the use of a prefix
boolean$relativeDetermines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped.
Renvoie
string
Depuis
1.7.0

Références $mode, FilesystemHelper\getWriteModes(), et JPATH_ROOT.

◆ addContextEntry()

addContextEntry (   $wrapper,
  $name,
  $value 
)

Adds a particular options to the context

Paramètres
string$wrapperThe wrapper to use
string$nameThe option to set
string$valueThe value of the option
Renvoie
void

Stream Context Creation https://www.php.net/manual/en/context.php Context Options for various streams 1.7.0

Références $name, $value, et $wrapper.

◆ appendFilter()

appendFilter (   $filterName,
  $readWrite = STREAM_FILTER_READ,
  $params = array() 
)

Stream filters Append a filter to the chain

Paramètres
string$filterNameThe key name of the filter.
integer$readWriteOptional. Defaults to STREAM_FILTER_READ.
array$paramsAn array of params for the stream_filter_append call.
Renvoie
mixed

1.7.0

Références $params.

◆ applyContextToStream()

applyContextToStream ( )

Applies the current context to the stream

Use this to change the values of the context after you've opened a stream

Renvoie
mixed
Depuis
1.7.0

◆ chmod()

chmod (   $filename = '',
  $mode = 0 
)

Chmod wrapper

Paramètres
string$filenameFile name.
mixed$modeMode to use.
Renvoie
boolean
Depuis
1.7.0

Références $mode, Text\_(), et FilesystemHelper\ftpChmod().

◆ close()

close ( )

Attempt to close a file handle

Will return false if it failed and true on success If the file is not open the system will return true, this function destroys the file handle as well

Renvoie
boolean
Depuis
1.7.0

Références Text\_(), et null.

◆ copy()

copy (   $src,
  $dest,
  $context = null,
  $usePrefix = true,
  $relative = false 
)

Copy a file from src to dest

Paramètres
string$srcThe file path to copy from.
string$destThe file path to copy to.
resource$contextA valid context resource (optional) created with stream_context_create.
boolean$usePrefixControls the use of a prefix (optional).
boolean$relativeDetermines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped.
Renvoie
mixed
Depuis
1.7.0

Références $context, et elseif.

◆ delete()

delete (   $filename,
  $context = null,
  $usePrefix = true,
  $relative = false 
)

Delete a file

Paramètres
string$filenameThe file path to delete.
resource$contextA valid context resource (optional) created with stream_context_create.
boolean$usePrefixControls the use of a prefix (optional).
boolean$relativeDetermines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped.
Renvoie
mixed
Depuis
1.7.0

Références $context, et elseif.

◆ deleteContextEntry()

deleteContextEntry (   $wrapper,
  $name 
)

Deletes a particular setting from a context

Paramètres
string$wrapperThe wrapper to use
string$nameThe option to unset
Renvoie
void

1.7.0

Références $name, et $wrapper.

◆ eof()

eof ( )

Work out if we're at the end of the file for a stream

Renvoie
boolean
Depuis
1.7.0

Références Text\_().

◆ filesize()

filesize ( )

Retrieve the file size of the path

Renvoie
mixed
Depuis
1.7.0

Références Text\_(), et FilesystemHelper\remotefsize().

◆ get_meta_data()

get_meta_data ( )

Get the stream metadata

Renvoie
array|boolean header/metadata

1.7.0

Références Text\_().

◆ getFileHandle()

getFileHandle ( )

Return the internal file handle

Renvoie
resource File handler
Depuis
1.7.0

◆ gets()

gets (   $length = 0)

Get a line from the stream source.

Paramètres
integer$lengthThe number of bytes (optional) to read.
Renvoie
mixed
Depuis
1.7.0

Références Text\_().

◆ move()

move (   $src,
  $dest,
  $context = null,
  $usePrefix = true,
  $relative = false 
)

Moves a file

Paramètres
string$srcThe file path to move from.
string$destThe file path to move to.
resource$contextA valid context resource (optional) created with stream_context_create.
boolean$usePrefixControls the use of a prefix (optional).
boolean$relativeDetermines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped.
Renvoie
mixed
Depuis
1.7.0

Références $context, et elseif.

◆ open()

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

Paramètres
string$filenameFilename
string$modeMode string to use
boolean$useIncludePathUse the PHP include path
resource$contextContext to use when opening
boolean$usePrefixUse a prefix to open the file
boolean$relativeFilename is a relative path (if false, strips JPATH_ROOT to make it relative)
boolean$detectProcessingModeDetect the processing method for the file and use the appropriate function to handle output automatically
Renvoie
boolean
Depuis
1.7.0

Références $context, $mode, $url, Text\_(), __DIR__, elseif, File\getExt(), et FilesystemHelper\isJoomlaStream().

◆ prependFilter()

prependFilter (   $filterName,
  $readWrite = STREAM_FILTER_READ,
  $params = array() 
)

Prepend a filter to the chain

Paramètres
string$filterNameThe key name of the filter.
integer$readWriteOptional. Defaults to STREAM_FILTER_READ.
array$paramsAn array of params for the stream_filter_prepend call.
Renvoie
mixed

1.7.0

Références $filters, et $params.

◆ read()

read (   $length = 0)

Read a file

Handles user space streams appropriately otherwise any read will return 8192

Paramètres
integer$lengthLength of data to read
Renvoie
mixed

1.7.0

Références $filesize, et Text\_().

◆ removeFilter()

removeFilter ( $resource,
  $byindex = false 
)

Remove a filter, either by resource (handed out from the append or prepend function) or via getting the filter list)

Paramètres
resource$resourceThe resource.
boolean$byindexThe index of the filter.
Renvoie
boolean Result of operation
Depuis
1.7.0

◆ seek()

seek (   $offset,
  $whence = SEEK_SET 
)

Seek the file

Note: the return value is different to that of fseek

Paramètres
integer$offsetOffset to use when seeking.
integer$whenceSeek mode to use.
Renvoie
boolean True on success, false on failure

1.7.0

Références Joomla\Database\Query\$offset, et Text\_().

◆ setContextOptions()

setContextOptions (   $context)

Updates the context to the array

Format is the same as the options for stream_context_create

Paramètres
array$contextOptions to create the context with
Renvoie
void

1.7.0

Références $context.

◆ tell()

tell ( )

Returns the current position of the file read/write pointer.

Renvoie
mixed
Depuis
1.7.0

Références Text\_().

◆ upload()

upload (   $src,
  $dest,
  $context = null,
  $usePrefix = true,
  $relative = false 
)

Upload a file

Paramètres
string$srcThe file path to copy from (usually a temp folder).
string$destThe file path to copy to.
resource$contextA valid context resource (optional) created with stream_context_create.
boolean$usePrefixControls the use of a prefix (optional).
boolean$relativeDetermines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped.
Renvoie
mixed
Depuis
1.7.0

Références $context, et Text\_().

◆ write()

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

Paramètres
string$stringReference to the string to write.
integer$lengthLength of the string to write.
integer$chunkSize of chunks to write in.
Renvoie
boolean

1.7.0

Références $start, Text\_(), et elseif.

◆ writeFile()

writeFile (   $filename,
$buffer 
)

Writes a chunk of data to a file.

Paramètres
string$filenameThe file name.
string$bufferThe data to write to the file.
Renvoie
boolean
Depuis
1.7.0

Références $buffer, et $result.

Documentation des champs

◆ $chunksize

$chunksize = 8192
protected

◆ $context

$context = null
protected

◆ $contextOptions

$contextOptions
protected

◆ $dirmode

$dirmode = 0755
protected

◆ $fh

$fh
protected

◆ $filemode

$filemode = 0644
protected

◆ $filename

$filename
protected

◆ $filesize

$filesize
protected

◆ $filters

$filters = array()
protected

◆ $openmode

$openmode
protected

◆ $processingmethod

$processingmethod = 'f'
protected

◆ $readprefix

$readprefix
protected

◆ $writeprefix

$writeprefix
protected

La documentation de cette classe a été générée à partir du fichier suivant :