Quick Search:
 
 PHP Code: Auto Link Maker Jump to:  
Category: >> PHP Code >> Auto Link Maker  

<< lastnext >>

Snippet Name: Auto Link Maker

Description: Automatically make active links to URLs. Works for both 'http:' and 'mailto:' links.

Also see:
» Truncate Links Over X Chars long
» Nice 'Read More...' links
» Get Link Text
» Auto Link Maker #2
» Secure Auto-Link Maker

Comment: (none)

Language:
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?PHP
 
FUNCTION change_string($str){
     $str = TRIM($str);
     $str = HTMLSPECIALCHARS($str);
     $str = PREG_REPLACE('#(.*)\@(.*)\.(.*)#','<a href="mailto:\\1@\\2.\\3">Send email</a>',$str);
     $str = PREG_REPLACE('=([^\s]*)(www.)([^\s]*)=','<a href="http://\\2\\3" target=\'_new\'>\\2\\3</a>',$str);
     RETURN $str;
   }
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org