summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorsullrich <sullrich@pfsense.org>2009-11-27 20:43:01 -0500
committersullrich <sullrich@pfsense.org>2009-11-27 20:43:01 -0500
commit5e9dd72accfac397356b9135cc7cc709df98c247 (patch)
tree268ab5786ddb8f43deff77b1d0964345d63eeb0b /etc
parent772d3121333349d01e193afbc746026ac3387b8e (diff)
downloadpfsense-5e9dd72accfac397356b9135cc7cc709df98c247.zip
pfsense-5e9dd72accfac397356b9135cc7cc709df98c247.tar.gz
Add is_URL()
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/util.inc15
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
OpenPOWER on IntegriCloud