From 5b007cbcf532a8efe7fe40bc6d7f5ce4bb708985 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Mon, 17 Nov 2008 05:00:39 -0500 Subject: [PATCH] format_url() now adds http:// if there's no : --- format.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/format.php b/format.php index f93d47f..7acdde3 100644 --- a/format.php +++ b/format.php @@ -146,8 +146,14 @@ function format_email($str) { } function format_url($str) { - # FIXME - return format_oneline($str); + # FIXME check for TLD? encode special chars? + $str = trim(format_oneline($str)); + if($str !== '') { + if(strpos($str, ':') === false) { + $str = 'http://' . $str; + } + } + return $str; } function format_money($str, $display_cents = true) { -- 1.7.10.4