feature 2380: add URL for user comment

git-svn-id: http://piwigo.org/svn/trunk@17351 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
mistic100
2012-08-03 17:02:24 +00:00
parent efdb998cee
commit d7bf41b3ef
8 changed files with 82 additions and 5 deletions
+16
View File
@@ -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);
}
}
?>