<?php

function text2html($text,$ifnoe) {
	if (is_null($text) || preg_match('#^\s*$#',$text)===1)
		return $ifnoe;
	$text=preg_replace(['#<#','#>#'],['&lt;','&gt;'],$text);
	$text=preg_replace('#(https?://.+?)(\s|$|\W\s|\W$)#m','<a href="$1" target="_blank">$1</a>$2',$text);
	$text=nl2br($text);
	return $text;
}

?>
