public static function Helper::ip__v6_reduce in Anti Spam by CleanTalk 9.1.x
Same name and namespace in other branches
- 8.4 src/lib/Cleantalk/Common/Helper.php \Cleantalk\Common\Helper::ip__v6_reduce()
* Reduce IPv6 * *
Parameters
string $ip: * * @return string IPv6
1 call to Helper::ip__v6_reduce()
- Helper::ip__validate in src/
lib/ Cleantalk/ Common/ Helper.php - * Validating IPv4, IPv6 * *
File
- src/
lib/ Cleantalk/ Common/ Helper.php, line 429
Class
- Helper
- CleanTalk Helper class. Compatible with any CMS.
Namespace
Cleantalk\CommonCode
public static function ip__v6_reduce($ip) {
if (strpos($ip, ':') !== false) {
$ip = preg_replace('/:0{1,4}/', ':', $ip);
$ip = preg_replace('/:{2,}/', '::', $ip);
$ip = strpos($ip, '0') === 0 ? substr($ip, 1) : $ip;
}
return $ip;
}