function _shurly_is_ip_address in ShURLy 6
Same name and namespace in other branches
- 8 shurly.module \_shurly_is_ip_address()
- 7 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 1046 - 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;
}