// content parser
function 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('
', '', '' . preg_replace('#([\r\n]\s*?[\r\n]){1,}#', '
$0', $str) . '
');
return $str;
}
// content parser
function _nl2br($str) {
$str = preg_replace( "/([0-9A-Za-z.!?])\n/", "$1
", $str);
return $str;
}
// content parser
// Main parse-function
function am_parse($str) {
if (!get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
$str = _nl2br(nls2p($str));
return $str;
}