[Edit] convert link and username text into links
Turn link and @username text into links function rich_str($text) { $hyperlink = "/(http:\/\/\S+)/"; if(preg_match($hyperlink, $text)) { $text = preg_replace($hyperlink, "<a href='$1'>$1</a>", $text); } $userlink = "/@([^()#@\s\,]+)/"; if(preg_match($userlink, $text)) { $text = preg_replace($userlink, "<a href='http://site.com/$1'>@$1</a>" , $text); } return $text; } |
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
© Advanced Web Core. All rights reserved