Joomla CMS  3.8.5 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.8.5 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', $use_include_path=false, $context=null, $use_prefix=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, $read_write=STREAM_FILTER_READ, $params=array())
 
 prependFilter ($filtername, $read_write=STREAM_FILTER_READ, $params=array())
 
 removeFilter (&$resource, $byindex=false)
 
 copy ($src, $dest, $context=null, $use_prefix=true, $relative=false)
 
 move ($src, $dest, $context=null, $use_prefix=true, $relative=false)
 
 delete ($filename, $context=null, $use_prefix=true, $relative=false)
 
 upload ($src, $dest, $context=null, $use_prefix=true, $relative=false)
 
 writeFile ($filename, &$buffer)
 
 _getFilename ($filename, $mode, $use_prefix, $relative)
 
 getFileHandle ()
 
 set ($property, $value=null)
 
 get ($property, $default=null)
 

Fonctions membres publiques statiques

static getStream ($use_prefix=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 = null
 
 $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:

Voir également
http://php.net/manual/en/function.stream-get-wrappers.php
http://php.net/manual/en/intro.stream.php PHP Stream Manual
http://php.net/manual/en/wrappers.php Stream Wrappers
http://php.net/manual/en/filters.php Stream Filters
http://php.net/manual/en/transports.php Socket Transports (used by some options, particularly HTTP proxy)
Depuis
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
mixed
Depuis
1.0

Références null.

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

◆ _getFilename()

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

Determine the appropriate 'filename' of a file

Paramètres
string$filenameOriginal filename of the file
string$modeMode string to retrieve the filename
boolean$use_prefixControls 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
Voir également
http://php.net/stream_context_create Stream Context Creation
http://php.net/manual/en/context.php Context Options for various streams
Depuis
1.0

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

◆ appendFilter()

appendFilter (   $filtername,
  $read_write = STREAM_FILTER_READ,
  $params = array() 
)

Stream filters Append a filter to the chain

Paramètres
string$filternameThe key name of the filter.
integer$read_writeOptional. Defaults to STREAM_FILTER_READ.
array$paramsAn array of params for the stream_filter_append call.
Renvoie
mixed
Voir également
http://php.net/manual/en/function.stream-filter-append.php
Depuis
1.0
Exceptions
FilesystemException

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

◆ chmod()

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

Chmod wrapper

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

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

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

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

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

◆ copy()

copy (   $src,
  $dest,
  $context = null,
  $use_prefix = 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$use_prefixControls 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.0
Exceptions
FilesystemException

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

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

◆ delete()

delete (   $filename,
  $context = null,
  $use_prefix = 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$use_prefixControls 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.0
Exceptions
FilesystemException

Références Stream\$context, Stream\$filename, Stream\_getFilename(), 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
Voir également
http://php.net/stream_context_create
Depuis
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

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

◆ filesize()

filesize ( )

Retrieve the file size of the path

Renvoie
mixed
Depuis
1.0
Exceptions
FilesystemException

Références 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
Voir également
http://php.net/manual/en/function.stream-get-meta-data.php
Depuis
1.0
Exceptions
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
mixed
Depuis
1.0
Exceptions
FilesystemException

◆ getStream()

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

Creates a new stream object with appropriate prefix

Paramètres
boolean$use_prefixPrefix 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,
  $use_prefix = 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$use_prefixControls 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.0
Exceptions
FilesystemException

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

◆ open()

open (   $filename,
  $mode = 'r',
  $use_include_path = false,
  $context = null,
  $use_prefix = 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$use_include_pathUse the PHP include path
resource$contextContext to use when opening
boolean$use_prefixUse 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

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

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

◆ prependFilter()

prependFilter (   $filtername,
  $read_write = STREAM_FILTER_READ,
  $params = array() 
)

Prepend a filter to the chain

Paramètres
string$filternameThe key name of the filter.
integer$read_writeOptional. Defaults to STREAM_FILTER_READ.
array$paramsAn array of params for the stream_filter_prepend call.
Renvoie
mixed
Voir également
http://php.net/manual/en/function.stream-filter-prepend.php
Depuis
1.0
Exceptions
FilesystemException

Références Stream\$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
Voir également
http://php.net/manual/en/function.fread.php
Depuis
1.0
Exceptions
FilesystemException

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

◆ 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

◆ 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
Voir également
http://php.net/manual/en/function.fseek.php
Depuis
1.0
Exceptions
FilesystemException

Références $offset.

◆ 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
Voir également
http://php.net/stream_context_create
Depuis
1.0

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

◆ tell()

tell ( )

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

Renvoie
mixed
Depuis
1.0
Exceptions
FilesystemException

◆ upload()

upload (   $src,
  $dest,
  $context = null,
  $use_prefix = 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$use_prefixControls 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.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
Voir également
http://php.net/manual/en/function.fwrite.php
Depuis
1.0
Exceptions
FilesystemException

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

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

◆ 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.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\read().

◆ $filters

$filters = array()
protected

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

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