PX : code

function makeClickable(string text) by florian geiges
Download this code


<?php

/**
 * function makeClickable(string $text)
 * Macht aus URLs klickbare links.
 * by florian geiges
 * <mailto:arsonist@phreaker.net>
 * einsatz: echo makeClickable($text");
**/
function makeClickable($text) {
    if (
strlen($text) < 1)
    {
        echo(
"NO TEXT TO MAKE URL FROM...");
    }
    else
    {
        
$ret eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])",    "<a href=\"\\1://\\2\\3\" target=\"_blank\" target=\"_new\"><u>\\1://\\2\\3</u></a>"$text);
        
$ret eregi_replace("(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))",  "<a href=\"mailto:\\1\" target=\"_new\"><u>\\1</u></a>"$ret);
        return(
$ret);
    }
}
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.