diff options
author | sullrich <sullrich@pfsense.org> | 2009-11-27 20:43:01 -0500 |
---|---|---|
committer | sullrich <sullrich@pfsense.org> | 2009-11-27 20:43:01 -0500 |
commit | 5e9dd72accfac397356b9135cc7cc709df98c247 (patch) | |
tree | 268ab5786ddb8f43deff77b1d0964345d63eeb0b /etc/inc | |
parent | 772d3121333349d01e193afbc746026ac3387b8e (diff) | |
download | pfsense-5e9dd72accfac397356b9135cc7cc709df98c247.zip pfsense-5e9dd72accfac397356b9135cc7cc709df98c247.tar.gz |
Add is_URL()
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/util.inc | 15 |
1 files changed, 15 insertions, 0 deletions
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 |