MakeItLink

Intro

Finding URLs in text and transforming them into links is handy tool to have around. WordPress does this via the make_clickable function. I extracted this into a stand alone PHP class called MakeItLink.

MakeItLink – Detecting URLs In Text And Making Them Links is the original version of the code and initial blog post.

Source

The MakeItLink class can be viewed as PHP highlighted source code or the plain text version.

Example

require dirname( __FILE__ ) . '/makeitlink.php';

$example = 'My home page is at http://josephscott.org/';
$with_links = MakeItLink::transform( $example );

echo $with_links;

Change Log

0.2.0 – 26 Oct 2009

  • Sync with WordPress 2.9 make_clickable()

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>