tag linking
* to that URL
* - Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML tag linking
* to http://www.xxxx.yyyy[/zzzz]
* - Goes through the given string, and replaces xxxx@yyyy with an HTML mailto: tag linking
* to that email address
* - Only matches these 2 patterns either after a space, or at the beginning of a line
*
* Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe
* have it require something like xxxx@yyyy.zzzz or such. We'll see.
*/
function make_clickable($string) {
// TODO: eregi_replace() is deprecated as of PHP 5.3
if (!stristr($string, ' src=') && !stristr($string, ' href=')) {
$string = eregi_replace("(https?|ftp)://([a-z0-9#?/&=._+:~%-]+)", "\\1://\\2", $string);
$string = eregi_replace("([a-z0-9_.-]+@[a-z0-9.-]+)", "\\1", $string);
}
return $string;
}
/**
* Applies parsing the content for tex commands that are separated by [tex]
* [/tex] to make it readable for techexplorer plugin.
* @param string $text The text to parse
* @return string The text after parsing.
* @author Patrick Cool
* @version June 2004
*/
function api_parse_tex($textext) {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
return str_replace(array('[tex]', '[/tex]'), array(""), $textext);
}
return str_replace(array('[tex]', '[/tex]'), array("