det imllem [code] og [/code]
hej jeg vil gerne have sådan den tekst mellem [kode] .. [/kode] og [code] .. [/code]bliver til
<div class="kodeEks">..</div>
udfra denne fil.
function tjek($txt)
{
$username = "[a-z0-9_\-]+";
$password = "[a-z0-9_\-!#]+";
$host = "[a-z0-9_\-]+\.[a-z0-9\-\.]+";
$port = "\d{1,5}";
$path = "\/[a-z0-9_\/\-\.\(\)\%]*";
$querystr = "\?[a-z0-9_&=\-\.%\(\)]+";
$proto = "(https?|ftp):\/\/";
$url = "$host(:$port)?($path($querystr)?)?";
$protodomain = "/$proto(($username(:$password)?@)?$url)/i";
$domain = "/(^| )(www\.$url)/im";
$protomail = "/mailto:($username@$host)/i";
$mail = "/(^| )($username@$host)/im";
$replacements = array(
$protodomain => "<a href=\"\\0\" target=\"_blank\"><span class=\"link\">\\2</span></a>"
,$domain => "\\1<a href=\"http://\\2\" target=\"_blank\"><span class=\"link\">\\2</span></a>"
,$protomail => "<a href=\"\\0\"><span class=\"link\">\\1</span></a>"
,$mail => "\\1<a href=\"mailto:\\2\"><span class=\"link\">\\2</span></a>"
);
return preg_replace( array_keys( $replacements ), array_values( $replacements ), $txt );
}
please hjælp forstår intet i den kode
