#558: In case of 404, try to propose the nearest valid address
[platal.git] / classes / varstream.php
index 49c31f6..744ca34 100644 (file)
 
 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)
     {
@@ -43,16 +38,10 @@ class VarStream
         return true;
     }
 
-    // }}}
-    // {{{ stream_close
-
     function stream_close()
     {
     }
 
-    // }}}
-    // {{{ stream_read
-
     function stream_read($count)
     {
         $ret = substr($GLOBALS[$this->varname], $this->position, $count);
@@ -60,9 +49,6 @@ class VarStream
         return $ret;
     }
 
-    // }}}
-    // {{{ stream_write
-
     function stream_write($data)
     {
         $len = strlen($data);
@@ -74,25 +60,16 @@ class VarStream
         $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) {
@@ -116,16 +93,14 @@ class VarStream
         return 0;
     }
 
-    // }}}
-    // {{{ stream_flush
-
     function stream_flush()
     {
     }
 
-    // }}}
+    static function init()
+    {
+        stream_wrapper_register('var','VarStream');
+    }
 }
 
-stream_wrapper_register('var','VarStream');
-
 ?>