public static function Helper::ip_validate in Anti Spam by CleanTalk 8.3
2 calls to Helper::ip_validate()
- Helper::ip_get in src/
lib/ Cleantalk/ Common/ Helper.php - SFW::ip_get in src/
lib/ Cleantalk/ Antispam/ SFW.php
File
- src/
lib/ Cleantalk/ Common/ Helper.php, line 194
Class
- Helper
- Cleantalk's hepler class
Namespace
Drupal\cleantalk\lib\Cleantalk\CommonCode
public static function ip_validate($ip) {
if (!$ip) {
return false;
}
// NULL || FALSE || '' || so on...
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
return 'v4';
}
// IPv4
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
return 'v6';
}
// IPv6
return false;
// Unknown
}