PO::read_line() WordPress Method

The PO::read_line() method is used to read a line from a PO file. The method takes a line number as an argument and returns the line as a string. The method can be used to read a PO file from a stream or from a string.

PO::read_line( resource $f, string $action = 'read' ) #


Parameters

$f

(resource)(Required)

$action

(string)(Optional)

Default value: 'read'


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/pomo/po.php

		public function read_line( $f, $action = 'read' ) {
			static $last_line     = '';
			static $use_last_line = false;
			if ( 'clear' === $action ) {
				$last_line = '';
				return true;
			}
			if ( 'put-back' === $action ) {
				$use_last_line = true;
				return true;
			}
			$line          = $use_last_line ? $last_line : fgets( $f );
			$line          = ( "\r\n" === substr( $line, -2 ) ) ? rtrim( $line, "\r\n" ) . "\n" : $line;
			$last_line     = $line;
			$use_last_line = false;
			return $line;
		}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.