function user_sanitize($text, $strict = false) { if (function_exists('user_sanitize')) { // bbPress native return user_sanitize($text, $strict); } if ($strict) { $text = preg_replace('/[^a-z0-9-]/i', '', $text); $text = preg_replace('|-+|', '-', $text); } else { $text = preg_replace('/[^a-z0-9_-]/i', '', $text); } return $text; }
function user_sanitize($text, $strict = false) { // whitelisted chars if (function_exists('user_sanitize')) { return user_sanitize($text, $strict); } if ($strict) { $text = preg_replace('/[^a-z0-9-]/i', '', $text); $text = preg_replace('|-+|', '-', $text); } else { $text = preg_replace('/[^a-z0-9_-]/i', '', $text); } return $text; }