wpcf7_normalize_newline()CF7 1.0

Normalizes newline characters.

Хуков нет.

Возвращает

Строку. Normalized text.

Использование

wpcf7_normalize_newline( $text, $to );
$text(строка) (обязательный)
Input text.
$to(строка)
The newline character that is used in the output.
По умолчанию: "\n"

Код wpcf7_normalize_newline() CF7 5.9.3

function wpcf7_normalize_newline( $text, $to = "\n" ) {
	if ( ! is_string( $text ) ) {
		return $text;
	}

	$nls = array( "\r\n", "\r", "\n" );

	if ( ! in_array( $to, $nls ) ) {
		return $text;
	}

	return str_replace( $nls, $to, $text );
}