From 5e9dd72accfac397356b9135cc7cc709df98c247 Mon Sep 17 00:00:00 2001 From: sullrich Date: Fri, 27 Nov 2009 20:43:01 -0500 Subject: Add is_URL() --- etc/inc/util.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 18b31b0..02c8711 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -1099,4 +1099,19 @@ function color($color = "0m") { } } +/****f* util/is_URL + * NAME + * is_URL + * INPUTS + * string to check + * RESULT + * Returns true if item is a URL + ******/ +function is_URL($url) { + $match = preg_match("'\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))'", $url); + if($match) + return true; + return false; +} + ?> \ No newline at end of file -- cgit v1.1