wppaste
WordPress

POMO_FileReader

Source
wp-includes/pomo/streams.php:155

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 1

$_fresource|falsepublic
File pointer resource.

Methods · 8

Source code

	class POMO_FileReader extends POMO_Reader { 		/**		 * File pointer resource.		 *		 * @var resource|false		 */		public $_f; 		/**		 * @param string $filename		 */		public function __construct( $filename ) {			parent::__construct();			$this->_f = fopen( $filename, 'rb' );		} 		/**		 * PHP4 constructor.		 *		 * @deprecated 5.4.0 Use __construct() instead.		 *		 * @see POMO_FileReader::__construct()		 */		public function POMO_FileReader( $filename ) {			_deprecated_constructor( self::class, '5.4.0', static::class );			self::__construct( $filename );		} 		/**		 * @param int $bytes		 * @return string|false Returns read string, otherwise false.		 */		public function read( $bytes ) {			return fread( $this->_f, $bytes );		} 		/**		 * @param int $pos		 * @return bool		 */		public function seekto( $pos ) {			if ( -1 === fseek( $this->_f, $pos, SEEK_SET ) ) {				return false;			}			$this->_pos = $pos;			return true;		} 		/**		 * @return bool		 */		public function is_resource() {			return is_resource( $this->_f );		} 		/**		 * @return bool		 */		public function feof() {			return feof( $this->_f );		} 		/**		 * @return bool		 */		public function close() {			return fclose( $this->_f );		} 		/**		 * @return string		 */		public function read_all() {			return stream_get_contents( $this->_f );		}	}

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/pomo/streams.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.