diff options
-rw-r--r-- | engine/lib/input.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php index 80329462e..dd0480d9f 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -107,6 +107,7 @@ return $path; }
+ /**
* Takes a string and turns any URLs into formatted links
@@ -115,17 +116,17 @@ * @return string The output stirng with formatted links
**/
- function parse_urls($text) {
-
- if (preg_match_all('/(?<!=["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\!\(\)]+)/ie', $text, $urls)) {
-
- foreach (array_unique($urls[1]) AS $url){
- $urltext = str_replace('/', '/<wbr />', $url);
- $text = str_replace($url, '<a href="'. $url .'" style="text-decoration:underline;">'. $urltext .'</a>', $text); - }
- }
-
- return $text;
+ function parse_urls($text) { + + return preg_replace_callback('/(?<!=["\'])((ht|f)tps?:\/\/[^\s\r\n\t<>"\'\!\(\)]+)/i', + create_function( + '$matches', + ' + $url = $matches[1]; + $urltext = str_replace("/", "/<wbr />", $url); + return "<a href=\"$url\" style=\"text-decoration:underline;\">$urltext</a>"; + ' + ), $text);
}
function autop($pee, $br = 1) {
|