Make WordPress Core


Ignore:
Timestamp:
08/11/2011 04:29:35 AM (14 years ago)
Author:
nbachiyski
Message:

Sync pomo library with the current GlotPress version

File:
1 edited

Legend:

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

    r15590 r18528  
    44 * Based on the classes from Danilo Segan <danilo@kvota.net>
    55 *
    6  * @version $Id: streams.php 406 2010-02-07 11:10:24Z nbachiyski $
     6 * @version $Id: streams.php 597 2011-01-16 20:14:36Z nbachiyski $
    77 * @package pomo
    88 * @subpackage streams
     
    1111if ( !class_exists( 'POMO_Reader' ) ):
    1212class POMO_Reader {
    13 
     13   
    1414    var $endian = 'little';
    1515    var $_post = '';
    16 
     16   
    1717    function POMO_Reader() {
    1818        $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
    1919        $this->_pos = 0;
    2020    }
    21 
     21   
    2222    /**
    2323     * Sets the endianness of the file.
    2424     *
    25      * @param string $endian 'big' or 'little'
     25     * @param $endian string 'big' or 'little'
    2626     */
    2727    function setEndian($endian) {
     
    5858        return unpack($endian_letter.$count, $bytes);
    5959    }
    60 
    61 
     60   
     61   
    6262    function substr($string, $start, $length) {
    6363        if ($this->is_overloaded) {
     
    6767        }
    6868    }
    69 
     69   
    7070    function strlen($string) {
    7171        if ($this->is_overloaded) {
     
    7575        }
    7676    }
    77 
     77   
    7878    function str_split($string, $chunk_size) {
    7979        if (!function_exists('str_split')) {
     
    8787        }
    8888    }
    89 
    90 
     89   
     90       
    9191    function pos() {
    9292        return $this->_pos;
     
    9696        return true;
    9797    }
    98 
     98   
    9999    function close() {
    100100        return true;
     
    107107    function POMO_FileReader($filename) {
    108108        parent::POMO_Reader();
    109         $this->_f = fopen($filename, 'r');
    110     }
    111 
     109        $this->_f = fopen($filename, 'rb');
     110    }
     111   
    112112    function read($bytes) {
    113113        return fread($this->_f, $bytes);
    114114    }
    115 
     115   
    116116    function seekto($pos) {
    117117        if ( -1 == fseek($this->_f, $pos, SEEK_SET)) {
     
    121121        return true;
    122122    }
    123 
     123   
    124124    function is_resource() {
    125125        return is_resource($this->_f);
    126126    }
    127 
     127   
    128128    function feof() {
    129129        return feof($this->_f);
    130130    }
    131 
     131   
    132132    function close() {
    133133        return fclose($this->_f);
    134134    }
    135 
     135   
    136136    function read_all() {
    137137        $all = '';
     
    149149 */
    150150class POMO_StringReader extends POMO_Reader {
    151 
     151   
    152152    var $_str = '';
    153 
     153   
    154154    function POMO_StringReader($str = '') {
    155155        parent::POMO_Reader();
     
    179179        return $this->substr($this->_str, $this->_pos, $this->strlen($this->_str));
    180180    }
    181 
     181   
    182182}
    183183endif;
Note: See TracChangeset for help on using the changeset viewer.