API16

JStream/prependFilter

From Joomla! Documentation

< API16:JStream
Revision as of 17:48, 22 March 2010 by Doxiki (talk | contribs) (New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JStream/prependFil...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

[Edit Descripton]

Template:Description:JStream/prependFilter

Syntax[edit]

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

Defined in[edit]

libraries/joomla/filesystem/stream.php

Importing[edit]

jimport( 'joomla.filesystem.stream' );

Source Body[edit]

function prependFilter($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_prepend($this->_fh, $filtername, $read_write, $params);
                if(!$res && $php_errormsg)
                {
                        $this->setError($php_errormsg); // set the error msg
                }
                else
                {
                        array_unshift($res,'');
                        $res[0] =&$this->filters;
                }
                // restore error tracking to what it was before
                ini_set('track_errors',$track_errors);
        }
        return $res;
}

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

Examples[edit]

<CodeExamplesForm />