Automattic\WooCommerce\StoreApi

Authentication::validate_ip()protected staticWC 1.0

Uses filter_var() to validate and return ipv4 and ipv6 addresses Will return 0.0.0.0 if the ip is not valid. This is done to group and still rate limit invalid ips.

Метод класса: Authentication{}

Хуков нет.

Возвращает

Строку.

Использование

$result = Authentication::validate_ip( $ip );
$ip(строка) (обязательный)
ipv4 or ipv6 ip string.

Код Authentication::validate_ip() WC 8.7.0

protected static function validate_ip( $ip ) {
	$ip = filter_var(
		$ip,
		FILTER_VALIDATE_IP,
		array( FILTER_FLAG_NO_RES_RANGE, FILTER_FLAG_IPV6 )
	);

	return $ip ?: '0.0.0.0';
}