diff options
author | mistic100 <mistic@piwigo.org> | 2012-08-03 17:02:24 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-08-03 17:02:24 +0000 |
commit | d7bf41b3ef59453e5e84e0d5352e698e9274f660 (patch) | |
tree | 10f65c86201cecb06615f5cc199be219080014a1 /include/functions.inc.php | |
parent | efdb998cee7d3a6cdeda811fd86f04f3092fd467 (diff) |
feature 2380: add URL for user comment
git-svn-id: http://piwigo.org/svn/trunk@17351 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions.inc.php | 16 |
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 |