class VarStream
{
- // {{{ properties
-
// Stream handler to read from global variables
- var $varname;
- var $position;
-
- // }}}
- // {{{ stream_open
+ private $varname;
+ private $position;
function stream_open($path, $mode, $options, &$opened_path)
{
return true;
}
- // }}}
- // {{{ stream_close
-
function stream_close()
{
}
- // }}}
- // {{{ stream_read
-
function stream_read($count)
{
$ret = substr($GLOBALS[$this->varname], $this->position, $count);
return $ret;
}
- // }}}
- // {{{ stream_write
-
function stream_write($data)
{
$len = strlen($data);
$this->position += $len;
}
- // }}}
- // {{{ stream_eof
-
function stream_eof()
{
return $this->position >= strlen($GLOBALS[$this->varname]);
}
- // }}}
- // {{{ stream_tell
-
function stream_tell()
{
return $this->position;
}
- // }}}
- // {{{ stream_seek
-
function stream_seek($offs, $whence)
{
switch ($whence) {
return 0;
}
- // }}}
- // {{{ stream_flush
-
function stream_flush()
{
}
- // }}}
+ static function init()
+ {
+ stream_wrapper_register('var','VarStream');
+ }
}
-stream_wrapper_register('var','VarStream');
-
?>