public static function Helper::ip__validate in Anti Spam by CleanTalk 8.4
Same name and namespace in other branches
- 9.1.x src/lib/Cleantalk/Common/Helper.php \Cleantalk\Common\Helper::ip__validate()
* Validating IPv4, IPv6 * *
Parameters
string $ip: * * @return string|bool
8 calls to Helper::ip__validate()
- FirewallModule::ipAppendAdditional in src/
lib/ Cleantalk/ Common/ Firewall/ FirewallModule.php - Configure and set additional properties: real_ip, test_ip, test
- FirewallUpdater::writeDbExclusions in src/
lib/ Cleantalk/ Common/ Firewall/ FirewallUpdater.php - Writing to the DB self IPs
- Helper::cidr__validate in src/
lib/ Cleantalk/ Common/ Helper.php - Validate CIDR
- Helper::ip__get in src/
lib/ Cleantalk/ Common/ Helper.php - Getting arrays of IP (REMOTE_ADDR, X-Forwarded-For, X-Real-Ip, Cf_Connecting_Ip)
- Helper::ip__is_cleantalks in src/
lib/ Cleantalk/ Common/ Helper.php - * Get URL form IP. Check if it's belong to cleantalk. * *
File
- src/
lib/ Cleantalk/ Common/ Helper.php, line 374
Class
- Helper
- CleanTalk Helper class. Compatible with any CMS.
Namespace
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) && $ip != '0.0.0.0') {
return 'v4';
}
// IPv4
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && self::ip__v6_reduce($ip) != '0::0') {
return 'v6';
}
// IPv6
return false;
// Unknown
}