Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/streams.php

    r8421 r8117  
    5959    $this->_str = $str;
    6060    $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     }
    7961  }
    8062
    8163  function read($bytes) {
    82       $data = $this->_substr($this->_str, $this->_pos, $bytes);
     64    $data = substr($this->_str, $this->_pos, $bytes);
    8365    $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);
    8668
    8769    return $data;
     
    9072  function seekto($pos) {
    9173    $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);
    9476    return $this->_pos;
    9577  }
     
    10082
    10183  function length() {
    102     return $this->_strlen($this->_str);
     84    return strlen($this->_str);
    10385  }
     86
    10487}
    10588
     
    167150class CachedFileReader extends StringReader {
    168151  function CachedFileReader($filename) {
    169     parent::StringReader();
    170 
    171152    if (file_exists($filename)) {
    172153
     
    175156
    176157      if (!$fd) {
    177         $this->error = 3; // Cannot read file, probably permissions
    178         return false;
     158    $this->error = 3; // Cannot read file, probably permissions
     159    return false;
    179160      }
    180161      $this->_str = fread($fd, $length);
     162      $this->_pos = 0;
    181163      fclose($fd);
    182164
Note: See TracChangeset for help on using the changeset viewer.