wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



normalize_whitespace › WordPress Function

Da2.7.0
Deprecaton/a
normalize_whitespace ( $str )
Parametri:
  • (string) $str The string to normalize.
    Richiesto:
Ritorna:
  • (string) The normalized string.
Definito a:
Codex:

Normalizes EOL characters and strips duplicate whitespace.



Sorgenti

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