wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



normalize_whitespace › WordPress Function

Desde2.7.0
Obsoleton/a
normalize_whitespace ( $str )
Parâmetros:
  • (string) $str The string to normalize.
    Required: Yes
Retorna:
  • (string) The normalized string.
Definido em:
Codex:

Normalizes EOL characters and strips duplicate whitespace.



Fonte

function normalize_whitespace( $str ) {
	$str = trim( $str );
	$str = str_replace( "\r", "\n", $str );
	$str = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
	return $str;
}