API16

API16:JStream/appendFilter

From Joomla! Documentation

Revision as of 22:48, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Append a filter to the chain <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowi...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Append a filter to the chain

[Edit Descripton]

Template:Description:JStream/appendFilter

Syntax

appendFilter($filtername, $read_write=STREAM_FILTER_READ, $params=Array())
Parameter Name Default Value Description
$filtername
$read_write STREAM_FILTER_READ
$params Array()

Defined in

libraries/joomla/filesystem/stream.php

Importing

jimport( 'joomla.filesystem.stream' );

Source Body

function appendFilter($filtername, $read_write=STREAM_FILTER_READ, $params=Array() )
{
        $res = false;
        if($this->_fh)
        {
                // Capture PHP errors
                $php_errormsg = '';
                $track_errors = ini_get('track_errors');
                ini_set('track_errors', true);

                $res = @stream_filter_append($this->_fh, $filtername, $read_write, $params);
                if(!$res && $php_errormsg) {
                        $this->setError($php_errormsg);
                } else {
                        $this->filters[] =& $res;
                }

                // restore error tracking to what it was before
                ini_set('track_errors',$track_errors);
        }
        return $res;
}

[Edit See Also] Template:SeeAlso:JStream/appendFilter

Examples

<CodeExamplesForm />