Fixes variable use.
[platal.git] / classes / varstream.php
index 49c31f6..2418668 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
 
 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)
+    public function stream_open($path, $mode, $options, &$opened_path)
     {
         $url            = parse_url($path);
         $this->varname  = $url['host'];
@@ -43,27 +38,18 @@ class VarStream
         return true;
     }
 
-    // }}}
-    // {{{ stream_close
-
-    function stream_close()
+    public function stream_close()
     {
     }
 
-    // }}}
-    // {{{ stream_read
-
-    function stream_read($count)
+    public function stream_read($count)
     {
         $ret = substr($GLOBALS[$this->varname], $this->position, $count);
         $this->position += strlen($ret);
         return $ret;
     }
 
-    // }}}
-    // {{{ stream_write
-
-    function stream_write($data)
+    public function stream_write($data)
     {
         $len = strlen($data);
         if ($len > $this->position + strlen($GLOBALS[$this->varname])) {
@@ -74,26 +60,17 @@ class VarStream
         $this->position += $len;
     }
 
-    // }}}
-    // {{{ stream_eof
-
-    function stream_eof()
+    public function stream_eof()
     {
         return $this->position >= strlen($GLOBALS[$this->varname]);
     }
 
-    // }}}
-    // {{{ stream_tell
-
-    function stream_tell()
+    public function stream_tell()
     {
         return $this->position;
     }
 
-    // }}}
-    // {{{ stream_seek
-
-    function stream_seek($offs, $whence)
+    public function stream_seek($offs, $whence)
     {
         switch ($whence) {
             case SEEK_SET:
@@ -116,16 +93,15 @@ class VarStream
         return 0;
     }
 
-    // }}}
-    // {{{ stream_flush
-
-    function stream_flush()
+    public function stream_flush()
     {
     }
 
-    // }}}
+    static public function init()
+    {
+        stream_wrapper_register('var','VarStream');
+    }
 }
 
-stream_wrapper_register('var','VarStream');
-
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>