All pastes #449635 Raw Edit

mm2000

public php v1 · immutable
·published 2007-04-20 10:23 UTC
rendered paste body
// content parserfunction nls2p($str) {	// temporary - we need to d something clever here to ignore inside code tags and	// no wrap paras around html tags	$str = str_replace('<p></p>', '', '<p>' . preg_replace('#([\r\n]\s*?[\r\n]){1,}#', '</p>$0<p>', $str) . '</p><br />');	return $str;}// content parserfunction _nl2br($str) {	$str = preg_replace( "/([0-9A-Za-z.!?])\n/", "$1<br />", $str);	return $str;}// content parser// Main parse-functionfunction am_parse($str) {	if (!get_magic_quotes_gpc()) {		$str = stripslashes($str);	}	$str = _nl2br(nls2p($str));        return $str;}