/** * Turns the provided link data into a proper, escaped HTML hyperlink. * * $link : the URL as a string, or a Linkable object that provides URL and text information * $text : the raw text, of the URL is a string * $class : optional CSS class to add to the link * $charLimit : optional character limit to truncate the text to */ function urlize($link, $text = null, $class = null, $charLimit = null) { if (is_string($link)) { assert($text !== null); $linkObject = new Hyperlink(new LinkData($link, $text)); } else { assert($link instanceof Linkable); $linkObject = new Hyperlink($link, $text); } return $linkObject->getLinkHTML($class, $charLimit); }