How to automatically convert URLs into Links

The Kohana Text Class has 3 methods which can convert URLs into links.

Usage

Notice that email address are obfuscated to make them difficult to read.

  echo Text::auto_link('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
  My email is <a href="&#109;&#097;...&#x61;">&#115;&#x6f;..e&#46;&#99;&#x61;</a> and my web site is <a href="http://www.kohanaphp.com">www.kohanaphp.com</a>
  echo Text::auto_link_urls('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
  My email is someone@somewhere.ca and my web site is <a href="http://www.kohanaphp.com">www.kohanaphp.com</a>
  echo Text::auto_link_emails('My email is someone@somewhere.ca and my web site is www.kohanaphp.com');
  My email is <a href="&#109;&#097;...&#x61;">&#115;&#x6f;..e&#46;&#99;&#x61;</a> and my web site is www.kohanaphp.com
how_to_automatically_convert_urls_into_links.txt · Last modified: 2009/10/15 21:21 by kerkness