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 JStream
+ Graphe d'héritage de JStream:

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

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.

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

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
11.1

Références $context.

◆ __destruct()

__destruct ( )

Destructor

Depuis
11.1

Documentation des fonctions membres

◆ _buildContext()

_buildContext ( )

Stream contexts Builds the context from the array

Renvoie
mixed
Depuis
11.1

Références null.

◆ _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
11.1

Références $mode, JFilesystemHelper\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://secure.php.net/manual/en/context.php Context Options for various streams 11.1

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

◆ 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

11.1

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
11.1

◆ chmod()

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

Chmod wrapper

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

Références $mode, et JFilesystemHelper\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
11.1

Références null.

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

Références $context, et elseif.

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

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

11.1

Références $name.

◆ eof()

eof ( )

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

Renvoie
boolean
Depuis
11.1

◆ filesize()

filesize ( )

Retrieve the file size of the path

Renvoie
mixed
Depuis
11.1

Références JFilesystemHelper\remotefsize().

◆ get_meta_data()

get_meta_data ( )

Get the stream metadata

Renvoie
array header/metadata

11.1

◆ getFileHandle()

getFileHandle ( )

Return the internal file handle

Renvoie
resource File handler
Depuis
11.1

◆ gets()

gets (   $length = 0)

Get a line from the stream source.

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

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

Références $context, 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
11.1

Références $context, $mode, $url, elseif, JFile\getExt(), et JFilesystemHelper\isJoomlaStream().

◆ 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

11.1

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

11.1

Références $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
11.1

◆ 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

11.1

Références $offset.

◆ 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

11.1

Références $context.

◆ tell()

tell ( )

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

Renvoie
mixed
Depuis
11.1

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

Références $context.

◆ 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

11.1

Références $start, 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
11.1

Références $buffer.

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 :