/** * Turns all urls and email addresses into clickable links. The "$link" * parameter can limit what should be linked. * * Options are "all" (default), "email_addresses", and "urls". * * Example: * * <?=$text_helper->auto_link("Go to http://www.akelos.org and say hello to bermi@example.com");?> * //outputs: Go to <a href="http://www.akelos.org">http://www.akelos.org</a> and * say hello to <a href="mailto:example.com">bermi@example.com</a> * */ static function auto_link($text, $link = 'all', $href_options = array(), $email_link_options = array()) { if (empty($text)) { return ''; } switch ($link) { case 'all': return AkTextHelper::auto_link_urls(AkTextHelper::auto_link_email_addresses($text, $email_link_options), $href_options); break; case 'email_addresses': return AkTextHelper::auto_link_email_addresses($text, $email_link_options); break; case 'urls': return AkTextHelper::auto_link_urls($text, $href_options); break; default: return AkTextHelper::auto_link($text, 'all', $href_options); break; } }