[Typo3-dev] Use T3 Database records for external applications

Stefan Beylen intsys at swissinfo.org
Fri Oct 7 10:56:54 CEST 2005


Stefan Beylen wrote:
> ...not needed anymore as I am already almost finished...

maybe it is useful for someone else...

p.s.: I disallowed my editors all other options in the RTE, so in my 
case this is all thats needed ;)
p.p.s: I am no Regexp-ert (as probably most can see)

---8<------
function RTEtransform($text){
	if (substr($text,4)!="<ul>") $text="<p>".$text;
	
	$text=str_replace("\n","</p><p>",$text);
	$text=str_replace("\r","</p><p>",$text);
	
	$text=str_replace("<p><ul>","<ul>",$text);
	$text=str_replace("</ul></p>","</ul>",$text);
	
	$text=str_replace("<b>","<strong>",$text);
	$text=str_replace("</b>","</strong>",$text);
	
	$text=str_replace("<i>","<em>",$text);
	$text=str_replace("</i>","</em>",$text);
	
	//mailtos
	$text=preg_replace("/\<LINK (.*?)@(.*?)>/", "<a 
href=\"mailto:$1@$2\">", $text);
	
	//external target
	$text=preg_replace("/\<LINK (.*?) (.*?)>/", "<a href=\"$1\" 
target=\"$2\">", $text);
	
	//internal target
	$text=preg_replace("/\<LINK (.*?)>/", "<a href=\"$1\">", $text);	

	
	$text=str_replace("</LINK>","</a>",$text);
	
	$text=str_replace("<br>","<br />",$text);
	
	if (substr($text,-5)!="</ul>") $text=$text."</p>";
	
	return $text;
}
---8<------




More information about the TYPO3-dev mailing list