Created
March 21, 2013 08:22
-
-
Save MattSkala/5211497 to your computer and use it in GitHub Desktop.
Linkify helper for Nette. It converts all links in text ito clickable <a> elements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->template->registerHelper('linkify', function($text) { | |
return preg_replace('"\b(http(s)?://\S+)"', '<a href="$1">$1</a>', $text); | |
}); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment