static function TextToHtml($txt) 
	{
		//Kills double spaces and spaces inside tags.
		while( !( strpos($txt,'  ') === FALSE ) ) $txt = str_replace('  ',' ',$txt);
		$txt = str_replace(' >','>',$txt);
		$txt = str_replace('< ','<',$txt);
	
		//Transforms accents in html entities.
		$txt = htmlentities($txt);
	
		//We need some HTML entities back!
		$txt = str_replace('&quot;','"',$txt);
		$txt = str_replace('&lt;','<',$txt);
		$txt = str_replace('&gt;','>',$txt);
		$txt = str_replace('&amp;','&',$txt);
	
		//Ajdusts links - anything starting with HTTP opens in a new window
		//$txt = str_ireplace("<a href=\"http://","<a target=\"_blank\" href=\"http://",$txt);
		//$txt = str_ireplace("<a href=http://","<a target=\"_blank\" href=http://",$txt);

		
		//Basic formatting
		$eol = ( strpos($txt,"\r") === FALSE ) ? "\n" : "\r\n";
		$html = '<p>'.str_replace("$eol$eol","</p><p>",$txt).'</p>';
		$html = str_replace("$eol","<br />\n",$html);
		$html = str_replace("</p>","</p>\n\n",$html);
		$html = str_replace("<p></p>","<p>&nbsp;</p>",$html);
	
		//Wipes <br> after block tags (for when the user includes some html in the text).
		$wipebr = Array("table","tr","td","blockquote","ul","ol","li");
	
		for($x = 0; $x < count($wipebr); $x++) 
		{
			$tag = $wipebr[$x];
			$html = str_ireplace("<$tag><br />","<$tag>",$html);
			$html = str_ireplace("</$tag><br />","</$tag>",$html);
		}
	
		return $html;
	}
static function TextToHtml($txt) 
	{
		//Kills double spaces and spaces inside tags.
		while( !( strpos($txt,'  ') === FALSE ) ) $txt = str_replace('  ',' ',$txt);
		$txt = str_replace(' >','>',$txt);
		$txt = str_replace('< ','<',$txt);
	
		//Transforms accents in html entities.
		$txt = htmlentities($txt);
	
		//We need some HTML entities back!
		$txt = str_replace('&quot;','"',$txt);
		$txt = str_replace('&lt;','<',$txt);
		$txt = str_replace('&gt;','>',$txt);
		$txt = str_replace('&amp;','&',$txt);
	
		//Ajdusts links - anything starting with HTTP opens in a new window
		//$txt = str_ireplace("<a href=\"http://","<a target=\"_blank\" href=\"http://",$txt);
		//$txt = str_ireplace("<a href=http://","<a target=\"_blank\" href=http://",$txt);

		
		//Basic formatting
		$eol = ( strpos($txt,"\r") === FALSE ) ? "\n" : "\r\n";
		$html = '<p>'.str_replace("$eol$eol","</p><p>",$txt).'</p>';
		$html = str_replace("$eol","<br />\n",$html);
		$html = str_replace("</p>","</p>\n\n",$html);
		$html = str_replace("<p></p>","<p>&nbsp;</p>",$html);
	
		//Wipes <br> after block tags (for when the user includes some html in the text).
		$wipebr = Array("table","tr","td","blockquote","ul","ol","li");
	
		for($x = 0; $x < count($wipebr); $x++) 
		{
			$tag = $wipebr[$x];
			$html = str_ireplace("<$tag><br />","<$tag>",$html);
			$html = str_ireplace("</$tag><br />","</$tag>",$html);
		}
	
		return $html;
	}
static function TextToHtml ( $ txt ) { //Kills double spaces and spaces inside tags. while ( ! ( strpos ( $ txt , '  ' ) === FALSE ) ) $ txt = str_replace ( '  ' , ' ' , $ txt ) ; $ txt = str_replace ( ' >' , '>' , $ txt ) ; $ txt = str_replace ( '< ' , '<' , $ txt ) ; //Transforms accents in html entities. $ txt = htmlentities ( $ txt ) ; //We need some HTML entities back! $ txt = str_replace ( '&quot;' , '"' , $ txt ) ; $ txt = str_replace ( '&lt;' , '<' , $ txt ) ; $ txt = str_replace ( '&gt;' , '>' , $ txt ) ; $ txt = str_replace ( '&amp;' , '&' , $ txt ) ; //Ajdusts links - anything starting with HTTP opens in a new window //$txt = str_ireplace("<a href=\"http://","<a target=\"_blank\" href=\"http://",$txt); //$txt = str_ireplace("<a href=http://","<a target=\"_blank\" href=http://",$txt); //Basic formatting $ eol = ( strpos ( $ txt , "\r" ) === FALSE ) ? "\n" : "\r\n" ; $ html = '<p>' . str_replace ( "$eol$eol" , "</p><p>" , $ txt ) . '</p>' ; $ html = str_replace ( "$eol" , "<br />\n" , $ html ) ; $ html = str_replace ( "</p>" , "</p>\n\n" , $ html ) ; $ html = str_replace ( "<p></p>" , "<p>&nbsp;</p>" , $ html ) ; //Wipes <br> after block tags (for when the user includes some html in the text). $ wipebr = Array ( "table" , "tr" , "td" , "blockquote" , "ul" , "ol" , "li" ) ; for ( $ x = 0 ; $ x < count ( $ wipebr ) ; $ x ++ ) { $ tag = $ wipebr [ $ x ] ; $ html = str_ireplace ( "<$tag><br />" , "<$tag>" , $ html ) ; $ html = str_ireplace ( "</$tag><br />" , "</$tag>" , $ html ) ; } return $ html ; }
Transforms plain text into formatted HTML.

@param string plain text
@return string HTML
Transforms plain text into formatted HTML .