本文整理匯總了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;
}