code/libraries/joomlatools/library/filesystem/stream/abstract.php
public function addFilter($filter, $config = array())
    {
        $result = false;

        if(is_resource($this->_resource))
        {
            //Handle custom filters
            if(!in_array($filter, stream_get_filters()))
            {
                //Create the complete identifier if a partial identifier was passed
                if (is_string($filter) && strpos($filter, '.') === false)
                {
                    $identifier = $this->getIdentifier()->toArray();
                    $identifier['path'] = array('stream', 'filter');
                    $identifier['name'] = $filter;

                    $identifier = $this->getIdentifier($identifier);
                }
                else $identifier = $this->getIdentifier($filter);

                //Make sure the class
                $class = $this->getObject('manager')->getClass($identifier);

                if(array_key_exists('KFilesystemStreamFilterInterface', class_implements($class)))
                {
                    $filter = $class::getName();

                    if (!empty($filter) && !in_array($filter, stream_get_filters())) {
                        stream_filter_register($filter, $class);
                    }
                }
            }

            //If we have a valid filter name create the filter and append it
            if(is_string($filter) && !empty($filter))
            {
                $mode = 0;
                if($this->isReadable()) {
                    $mode = $mode & STREAM_FILTER_READ;
                }

                if($this->isWritable()) {
                    $mode = $mode & STREAM_FILTER_WRITE;
                }

                if($resource = stream_filter_append($this->_resource, $filter, $mode, $config))
                {
                    $this->_filters[$filter] = $filter;
                    $result = true;
                }
            }
        }

        return $result;
    }
public function addFilter($filter, $config = array())
    {
        $result = false;

        if(is_resource($this->_resource))
        {
            //Handle custom filters
            if(!in_array($filter, stream_get_filters()))
            {
                //Create the complete identifier if a partial identifier was passed
                if (is_string($filter) && strpos($filter, '.') === false)
                {
                    $identifier = $this->getIdentifier()->toArray();
                    $identifier['path'] = array('stream', 'filter');
                    $identifier['name'] = $filter;

                    $identifier = $this->getIdentifier($identifier);
                }
                else $identifier = $this->getIdentifier($filter);

                //Make sure the class
                $class = $this->getObject('manager')->getClass($identifier);

                if(array_key_exists('KFilesystemStreamFilterInterface', class_implements($class)))
                {
                    $filter = $class::getName();

                    if (!empty($filter) && !in_array($filter, stream_get_filters())) {
                        stream_filter_register($filter, $class);
                    }
                }
            }

            //If we have a valid filter name create the filter and append it
            if(is_string($filter) && !empty($filter))
            {
                $mode = 0;
                if($this->isReadable()) {
                    $mode = $mode & STREAM_FILTER_READ;
                }

                if($this->isWritable()) {
                    $mode = $mode & STREAM_FILTER_WRITE;
                }

                if($resource = stream_filter_append($this->_resource, $filter, $mode, $config))
                {
                    $this->_filters[$filter] = $filter;
                    $result = true;
                }
            }
        }

        return $result;
    }
public function addFilter ( $ filter , $ config = array ( ) ) { $ result = false ; if ( is_resource ( $ this -> _resource ) ) { //Handle custom filters if ( ! in_array ( $ filter , stream_get_filters ( ) ) ) { //Create the complete identifier if a partial identifier was passed if ( is_string ( $ filter ) && strpos ( $ filter , '.' ) === false ) { $ identifier = $ this -> getIdentifier ( ) -> toArray ( ) ; $ identifier [ 'path' ] = array ( 'stream' , 'filter' ) ; $ identifier [ 'name' ] = $ filter ; $ identifier = $ this -> getIdentifier ( $ identifier ) ; } else $ identifier = $ this -> getIdentifier ( $ filter ) ; //Make sure the class $ class = $ this -> getObject ( 'manager' ) -> getClass ( $ identifier ) ; if ( array_key_exists ( 'KFilesystemStreamFilterInterface' , class_implements ( $ class ) ) ) { $ filter = $ class :: getName ( ) ; if ( ! empty ( $ filter ) && ! in_array ( $ filter , stream_get_filters ( ) ) ) { stream_filter_register ( $ filter , $ class ) ; } } } //If we have a valid filter name create the filter and append it if ( is_string ( $ filter ) && ! empty ( $ filter ) ) { $ mode = 0 ; if ( $ this -> isReadable ( ) ) { $ mode = $ mode & STREAM_FILTER_READ ; } if ( $ this -> isWritable ( ) ) { $ mode = $ mode & STREAM_FILTER_WRITE ; } if ( $ resource = stream_filter_append ( $ this -> _resource , $ filter , $ mode , $ config ) ) { $ this -> _filters [ $ filter ] = $ filter ; $ result = true ; } } } return $ result ; }
Add a filter in FIFO order

@param mixed $filter An object that implements ObjectInterface, ObjectIdentifier object
or valid identifier string
@param array $config  An optional array of filter config options
@return  bool   Returns TRUE if the filter was added, FALSE otherwise
Add a filter in FIFO order