aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions.inc.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 12be821e7..14ee6b42c 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -1692,4 +1692,20 @@ function mobile_theme()
return $is_mobile_theme;
}
+
+/**
+ * check url format
+ */
+function url_check_format($url)
+{
+ if (version_compare(PHP_VERSION, '5.2.0') >= 0)
+ {
+ return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)!==false;
+ }
+ else
+ {
+ // http://mathiasbynens.be/demo/url-regex @imme_emosol
+ return (bool)preg_match('@^https?://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@iS', $url);
+ }
+}
?> \ No newline at end of file