Changes from branches/2.6/wp-includes/streams.php at r8421 to trunk/wp-includes/streams.php at r8117
- File:
-
- 1 edited
-
trunk/wp-includes/streams.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/streams.php
r8421 r8117 59 59 $this->_str = $str; 60 60 $this->_pos = 0; 61 // If string functions are overloaded, we need to use the mb versions62 $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 }79 61 } 80 62 81 63 function read($bytes) { 82 $data = $this->_substr($this->_str, $this->_pos, $bytes);64 $data = substr($this->_str, $this->_pos, $bytes); 83 65 $this->_pos += $bytes; 84 if ( $this->_strlen($this->_str)<$this->_pos)85 $this->_pos = $this->_strlen($this->_str);66 if (strlen($this->_str)<$this->_pos) 67 $this->_pos = strlen($this->_str); 86 68 87 69 return $data; … … 90 72 function seekto($pos) { 91 73 $this->_pos = $pos; 92 if ( $this->_strlen($this->_str)<$this->_pos)93 $this->_pos = $this->_strlen($this->_str);74 if (strlen($this->_str)<$this->_pos) 75 $this->_pos = strlen($this->_str); 94 76 return $this->_pos; 95 77 } … … 100 82 101 83 function length() { 102 return $this->_strlen($this->_str);84 return strlen($this->_str); 103 85 } 86 104 87 } 105 88 … … 167 150 class CachedFileReader extends StringReader { 168 151 function CachedFileReader($filename) { 169 parent::StringReader();170 171 152 if (file_exists($filename)) { 172 153 … … 175 156 176 157 if (!$fd) { 177 $this->error = 3; // Cannot read file, probably permissions178 return false;158 $this->error = 3; // Cannot read file, probably permissions 159 return false; 179 160 } 180 161 $this->_str = fread($fd, $length); 162 $this->_pos = 0; 181 163 fclose($fd); 182 164
Note: See TracChangeset
for help on using the changeset viewer.