share email +twitter / class messages

This commit is contained in:
Nicolas Lœuillet
2013-08-05 15:54:37 +02:00
parent b161295d0b
commit 55821e04c1
25 changed files with 339 additions and 112 deletions

View File

@ -210,4 +210,15 @@ class Tools
{
return ((isset ($_REQUEST["$var"])) ? htmlentities($_REQUEST["$var"]) : $default);
}
public static function getDomain($url)
{
$pieces = parse_url($url);
$domain = isset($pieces['host']) ? $pieces['host'] : '';
if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
return $regs['domain'];
}
return FALSE;
}
}