/** * */ public function testIsHostname() { $input = '192.168.1.1'; $this->assertTrue(Inspekt::isHostname($input)); }
/** * Returns value if it is a valid hostname, FALSE otherwise. * Depending upon the value of $allow, Internet domain names, IP * addresses, and/or local network names are considered valid. * The default is HOST_ALLOW_ALL, which considers all of the * above to be valid. * * @param mixed $key * @param integer $allow bitfield for HOST_ALLOW_DNS, HOST_ALLOW_IP, HOST_ALLOW_LOCAL * @return mixed * * @tag validator */ function testHostname($key, $allow = ISPK_HOST_ALLOW_ALL) { if (!$this->keyExists($key)) { return false; } if (Inspekt::isHostname($this->_getValue($key), $allow)) { return $this->_getValue($key); } return FALSE; }
/** * Returns value if it is a valid hostname, FALSE otherwise. * Depending upon the value of $allow, Internet domain names, IP * addresses, and/or local network names are considered valid. * The default is HOST_ALLOW_ALL, which considers all of the * above to be valid. * * @param mixed $key * @param int $allow bitfield for HOST_ALLOW_DNS, HOST_ALLOW_IP, HOST_ALLOW_LOCAL * @return mixed * @throws Exception * @tag validator */ public function testHostname($key, $allow = Inspekt::ISPK_HOST_ALLOW_ALL) { $value = $this->getValueOrNull($key); if (!is_null($value) && Inspekt::isHostname($value, $allow)) { return $value; } return false; }