You are here

function _shurly_is_ip_address in ShURLy 7

Same name and namespace in other branches
  1. 8 shurly.module \_shurly_is_ip_address()
  2. 6 shurly.module \_shurly_is_ip_address()

Check whether the given test string matches the pattern of an IP address.

Parameters

string $test_string: Host address or whatever should be tested.

Return value

bool TRUE if the $test_string matches an IP address pattern; otherwise FALSE.

1 call to _shurly_is_ip_address()
shurly_host_is_resolveable in ./shurly.module
Check whether the input $hostname can be resolved to a valid IP address.

File

./shurly.module, line 1261
description http://www.youtube.com/watch?v=Qo7qoonzTCE

Code

function _shurly_is_ip_address($test_string) {
  if (!!filter_var($test_string, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
    return TRUE;
  }
  if (!!filter_var($test_string, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
    return TRUE;
  }
  return FALSE;
}