本文整理汇总了PHP中Zend_Filter::isHostname方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Filter::isHostname方法的具体用法?PHP Zend_Filter::isHostname怎么用?PHP Zend_Filter::isHostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Filter
的用法示例。
在下文中一共展示了Zend_Filter::isHostname方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHostname
/**
* 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
*/
public function testHostname($key, $allow = Zend_Filter::HOST_ALLOW_ALL)
{
if (!$this->keyExists($key)) {
return false;
}
if (Zend_Filter::isHostname($this->_source[$key], $allow)) {
return $this->_source[$key];
}
return FALSE;
}
示例2: validateHost
/**
* Returns true if and only if the host string passes validation. If no host is passed,
* then the host contained in the instance variable is used.
*
* @param string $host
* @return boolean
* @uses Zend_Filter
*/
public function validateHost($host = null)
{
if ($host === null) {
$host = $this->_host;
}
/**
* If the host is empty, then it is considered invalid
*/
if (strlen($host) == 0) {
return false;
}
/**
* Check the host against the allowed values; delegated to Zend_Filter. As a feature, this only
* validates Internet domain names and local network names; IP addresses are considered invalid.
*
* @link http://www.faqs.org/rfcs/rfc2396.html
*/
$allow = Zend_Filter::HOST_ALLOW_DNS | Zend_Filter::HOST_ALLOW_LOCAL;
return Zend_Filter::isHostname($host, $allow) !== FALSE;
}
示例3: isHostname
/**
* 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
* @throws Zend_Filter_Exception
* @return mixed
*/
public function isHostname($key, $allow = Zend_Filter::HOST_ALLOW_ALL)
{
return Zend_Filter::isHostname($this->_source[$key], $allow);
}
示例4: validateHost
/**
* Returns true if and only if the host string passes validation. If no host is passed,
* then the host contained in the instance variable is used.
*
* @param string $host
* @return boolean
* @uses Zend_Filter
*/
public function validateHost($host = null)
{
if ($host === null) {
$host = $this->_host;
}
/**
* If the host is empty, then it is considered invalid
*/
if (strlen($host) == 0) {
return false;
}
/**
* Check the host against the allowed values; delegated to Zend_Filter.
*/
return Zend_Filter::isHostname($host) !== FALSE;
}
示例5: testHostname
/**
* 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
*/
public function testHostname($key = null, $allow = Zend_Filter::HOST_ALLOW_ALL)
{
if (!($value = $this->keyExists($key))) {
return false;
}
if (Zend_Filter::isHostname($value, $allow)) {
return $value;
}
return FALSE;
}