Changeset 8420
- Timestamp:
- 07/23/2008 06:56:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/streams.php
r8117 r8420 59 59 $this->_str = $str; 60 60 $this->_pos = 0; 61 // If string functions are overloaded, we need to use the mb versions 62 $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr'); 63 } 64 65 function _substr($string, $start, $length) { 66 if ($this->is_overloaded) { 67 return mb_substr($string,$start,$length,'ascii'); 68 } else { 69 return substr($string,$start,$length); 70 } 71 } 72 73 function _strlen($string) { 74 if ($this->is_overloaded) { 75 return mb_strlen($string,'ascii'); 76 } else { 77 return strlen($string); 78 } 61 79 } 62 80 63 81 function read($bytes) { 64 $data =substr($this->_str, $this->_pos, $bytes);82 $data = $this->_substr($this->_str, $this->_pos, $bytes); 65 83 $this->_pos += $bytes; 66 if ( strlen($this->_str)<$this->_pos)67 $this->_pos = strlen($this->_str);84 if ($this->_strlen($this->_str)<$this->_pos) 85 $this->_pos = $this->_strlen($this->_str); 68 86 69 87 return $data; … … 72 90 function seekto($pos) { 73 91 $this->_pos = $pos; 74 if ( strlen($this->_str)<$this->_pos)75 $this->_pos = strlen($this->_str);92 if ($this->_strlen($this->_str)<$this->_pos) 93 $this->_pos = $this->_strlen($this->_str); 76 94 return $this->_pos; 77 95 } … … 82 100 83 101 function length() { 84 return strlen($this->_str);102 return $this->_strlen($this->_str); 85 103 } 86 87 104 } 88 105 … … 150 167 class CachedFileReader extends StringReader { 151 168 function CachedFileReader($filename) { 169 parent::StringReader(); 170 152 171 if (file_exists($filename)) { 153 172 … … 156 175 157 176 if (!$fd) { 158 159 177 $this->error = 3; // Cannot read file, probably permissions 178 return false; 160 179 } 161 180 $this->_str = fread($fd, $length); 162 $this->_pos = 0;163 181 fclose($fd); 164 182
Note: See TracChangeset
for help on using the changeset viewer.