Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe 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, $appendToFile=false)
 
 _getFilename ($filename, $mode, $usePrefix, $relative)
 
 getFileHandle ()
 
 set ($property, $value=null)
 
 get ($property, $default=null)
 

Fonctions membres publiques statiques

static getStream ($usePrefix=true, $ua=null, $uamask=false)
 

Attributs protégés

 $filemode = 0644
 
 $dirmode = 0755
 
 $chunksize = 8192
 
 $filename
 
 $writeprefix
 
 $readprefix
 
 $processingmethod = 'f'
 
 $filters = array()
 
 $fh
 
 $filesize
 
 $context
 
 $contextOptions
 
 $openmode
 

Description détaillée

Joomla! Stream Interface

The Joomla! stream interface is designed to handle files as streams where as the legacy JFile static class treated files in a rather atomic manner.

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.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.0

Références Stream\$context, Stream\$readprefix, Stream\$writeprefix, et Stream\_buildContext().

◆ __destruct()

__destruct ( )

Destructor

Depuis
1.0

Références Stream\close().

Documentation des fonctions membres

◆ _buildContext()

_buildContext ( )

Stream contexts Builds the context from the array

Renvoie
void
Depuis
1.0

Références null.

Référencé par Stream\__construct(), Stream\addContextEntry(), Stream\deleteContextEntry(), et Stream\setContextOptions().

◆ _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.0

Références Stream\$filename, $mode, Stream\$readprefix, Stream\$writeprefix, Helper\getWriteModes(), et JPATH_ROOT.

Référencé par Stream\copy(), Stream\delete(), Stream\move(), et Stream\open().

◆ 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.0

Références $name, $value, et Stream\_buildContext().

◆ 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
resource|boolean

1.0 FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références $params, et null.

◆ 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
boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références null.

◆ chmod()

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

Chmod wrapper

Paramètres
string$filenameFile name.
mixed$modeMode to use.
Renvoie
boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$filemode, Stream\$filename, $mode, Helper\ftpChmod(), et null.

Référencé par Stream\close(), Stream\copy(), Stream\move(), et Stream\writeFile().

◆ 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.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\chmod(), et null.

Référencé par Stream\__destruct(), et Stream\writeFile().

◆ 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
boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$context, Stream\_getFilename(), Stream\chmod(), elseif, et null.

Référencé par Stream\upload().

◆ 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
boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$context, Stream\$filename, Stream\_getFilename(), elseif, et null.

◆ 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.0

Références $name, et Stream\_buildContext().

◆ eof()

eof ( )

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

Renvoie
boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références null.

Référencé par Stream\read().

◆ filesize()

filesize ( )

Retrieve the file size of the path

Renvoie
integer|boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$filesize, null, et Helper\remotefsize().

Référencé par Stream\read().

◆ get()

get (   $property,
  $default = null 
)

Returns a property of the object or the default value if the property is not set.

Paramètres
string$propertyThe name of the property.
mixed$defaultThe default value.
Renvoie
mixed The value of the property.
Depuis
1.0

Références $default.

◆ get_meta_data()

get_meta_data ( )

Get the stream metadata

Renvoie
array header/metadata

1.0 FilesystemException

◆ getFileHandle()

getFileHandle ( )

Return the internal file handle

Renvoie
File handler
Depuis
1.0

Références Stream\$fh.

◆ gets()

gets (   $length = 0)

Get a line from the stream source.

Paramètres
integer$lengthThe number of bytes (optional) to read.
Renvoie
string
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références null.

◆ getStream()

static getStream (   $usePrefix = true,
  $ua = null,
  $uamask = false 
)
static

Creates a new stream object with appropriate prefix

Paramètres
boolean$usePrefixPrefix the connections for writing
string$uaUA User agent to use
boolean$uamaskUser agent masking (prefix Mozilla)
Renvoie
Stream
Voir également
Stream
Depuis
1.0

Références Stream\$context, et JPATH_ROOT.

Référencé par Folder\copy(), File\copy(), Bzip2\extract(), Gzip\extract(), File\move(), Folder\move(), File\upload(), et File\write().

◆ 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
boolean
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$context, Stream\_getFilename(), Stream\chmod(), elseif, et null.

◆ 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.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$context, Stream\$filename, $mode, $url, Stream\_getFilename(), elseif, Helper\isJoomlaStream(), et null.

Référencé par Stream\writeFile().

◆ 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
resource|boolean

1.0 FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références $params, et null.

◆ 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
string

1.0 FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$filesize, Stream\eof(), Stream\filesize(), et null.

◆ 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.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références null.

◆ 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.0 FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références $offset, et null.

◆ set()

set (   $property,
  $value = null 
)

Modifies a property of the object, creating it if it does not already exist.

Paramètres
string$propertyThe name of the property.
mixed$valueThe value of the property to set.
Renvoie
mixed Previous value of the property.
Depuis
1.0

Références $value, et null.

◆ 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.0

Références Stream\$context, et Stream\_buildContext().

◆ tell()

tell ( )

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

Renvoie
integer
Depuis
1.0
Exceptions
FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références null.

◆ 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
boolean
Depuis
1.0
Exceptions
FilesystemException

Références Stream\$context, et Stream\copy().

◆ 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 Stream::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.0 FilesystemException

PhpElementIsNotAvailableInCurrentPhpVersionInspection

Références Stream\$chunksize, $start, et null.

Référencé par Stream\writeFile().

◆ writeFile()

writeFile (   $filename,
$buffer,
  $appendToFile = false 
)

Writes a chunk of data to a file.

Paramètres
string$filenameThe file name.
string$bufferThe data to write to the file.
boolean$appendToFileAppend to the file and not overwrite it.
Renvoie
boolean
Depuis
1.0

Références $buffer, Stream\$filename, Stream\chmod(), Stream\close(), Stream\open(), et Stream\write().

Documentation des champs

◆ $chunksize

$chunksize = 8192
protected

Référencé par Stream\write().

◆ $context

◆ $contextOptions

$contextOptions
protected

◆ $dirmode

$dirmode = 0755
protected

◆ $fh

$fh
protected

Référencé par Stream\getFileHandle().

◆ $filemode

$filemode = 0644
protected

Référencé par Stream\chmod().

◆ $filename

◆ $filesize

$filesize
protected

Référencé par Stream\filesize(), et Stream\read().

◆ $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 :