wp/wp-includes/pomo/streams.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     9  */
     9  */
    10 
    10 
    11 if ( ! class_exists( 'POMO_Reader', false ) ) :
    11 if ( ! class_exists( 'POMO_Reader', false ) ) :
    12 	class POMO_Reader {
    12 	class POMO_Reader {
    13 
    13 
    14 		var $endian = 'little';
    14 		public $endian = 'little';
    15 		var $_post  = '';
    15 		public $_post  = '';
    16 
    16 
    17 		/**
    17 		/**
    18 		 * PHP5 constructor.
    18 		 * PHP5 constructor.
    19 		 */
    19 		 */
    20 		function __construct() {
    20 		function __construct() {
    21 			$this->is_overloaded = ( ( ini_get( 'mbstring.func_overload' ) & 2 ) != 0 ) && function_exists( 'mb_substr' ); // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
    21 			if ( function_exists( 'mb_substr' )
    22 			$this->_pos          = 0;
    22 				&& ( (int) ini_get( 'mbstring.func_overload' ) & 2 ) // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
       
    23 			) {
       
    24 				$this->is_overloaded = true;
       
    25 			} else {
       
    26 				$this->is_overloaded = false;
       
    27 			}
       
    28 
       
    29 			$this->_pos = 0;
    23 		}
    30 		}
    24 
    31 
    25 		/**
    32 		/**
    26 		 * PHP4 constructor.
    33 		 * PHP4 constructor.
    27 		 *
    34 		 *
    60 		}
    67 		}
    61 
    68 
    62 		/**
    69 		/**
    63 		 * Reads an array of 32-bit Integers from the Stream
    70 		 * Reads an array of 32-bit Integers from the Stream
    64 		 *
    71 		 *
    65 		 * @param integer $count How many elements should be read
    72 		 * @param int $count How many elements should be read
    66 		 * @return mixed Array of integers or false if there isn't
    73 		 * @return mixed Array of integers or false if there isn't
    67 		 *  enough data or on error
    74 		 *  enough data or on error
    68 		 */
    75 		 */
    69 		function readint32array( $count ) {
    76 		function readint32array( $count ) {
    70 			$bytes = $this->read( 4 * $count );
    77 			$bytes = $this->read( 4 * $count );
   173 			return fread( $this->_f, $bytes );
   180 			return fread( $this->_f, $bytes );
   174 		}
   181 		}
   175 
   182 
   176 		/**
   183 		/**
   177 		 * @param int $pos
   184 		 * @param int $pos
   178 		 * @return boolean
   185 		 * @return bool
   179 		 */
   186 		 */
   180 		function seekto( $pos ) {
   187 		function seekto( $pos ) {
   181 			if ( -1 == fseek( $this->_f, $pos, SEEK_SET ) ) {
   188 			if ( -1 == fseek( $this->_f, $pos, SEEK_SET ) ) {
   182 				return false;
   189 				return false;
   183 			}
   190 			}
   224 	 * Provides file-like methods for manipulating a string instead
   231 	 * Provides file-like methods for manipulating a string instead
   225 	 * of a physical file.
   232 	 * of a physical file.
   226 	 */
   233 	 */
   227 	class POMO_StringReader extends POMO_Reader {
   234 	class POMO_StringReader extends POMO_Reader {
   228 
   235 
   229 		var $_str = '';
   236 		public $_str = '';
   230 
   237 
   231 		/**
   238 		/**
   232 		 * PHP5 constructor.
   239 		 * PHP5 constructor.
   233 		 */
   240 		 */
   234 		function __construct( $str = '' ) {
   241 		function __construct( $str = '' ) {