WordPress at a glance
function is not described

getid3_handler::fgets() protected WP 1.0

{} It's a method of the class: getid3_handler{}

No Hooks.

Return

String|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->fgets();

Code of getid3_handler::fgets() WP 5.7.2

<?php
protected function fgets() {
	// must be able to handle CR/LF/CRLF but not read more than one lineend
	$buffer   = ''; // final string we will return
	$prevchar = ''; // save previously-read character for end-of-line checking
	if ($this->data_string_flag) {
		while (true) {
			$thischar = substr($this->data_string, $this->data_string_position++, 1);
			if (($prevchar == "\r") && ($thischar != "\n")) {
				// read one byte too many, back up
				$this->data_string_position--;
				break;
			}
			$buffer .= $thischar;
			if ($thischar == "\n") {
				break;
			}
			if ($this->data_string_position >= $this->data_string_length) {
				// EOF
				break;
			}
			$prevchar = $thischar;
		}

	} else {

		// Ideally we would just use PHP's fgets() function, however...
		// it does not behave consistently with regards to mixed line endings, may be system-dependent
		// and breaks entirely when given a file with mixed \r vs \n vs \r\n line endings (e.g. some PDFs)
		//return fgets($this->getid3->fp);
		while (true) {
			$thischar = fgetc($this->getid3->fp);
			if (($prevchar == "\r") && ($thischar != "\n")) {
				// read one byte too many, back up
				fseek($this->getid3->fp, -1, SEEK_CUR);
				break;
			}
			$buffer .= $thischar;
			if ($thischar == "\n") {
				break;
			}
			if (feof($this->getid3->fp)) {
				break;
			}
			$prevchar = $thischar;
		}

	}
	return $buffer;
}