当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Validate_Hostname::setMessages方法代码示例

本文整理汇总了PHP中Zend_Validate_Hostname::setMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_Hostname::setMessages方法的具体用法?PHP Zend_Validate_Hostname::setMessages怎么用?PHP Zend_Validate_Hostname::setMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Validate_Hostname的用法示例。


在下文中一共展示了Zend_Validate_Hostname::setMessages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * (non-PHPdoc)
  * @see library/Zend/Form/Zend_Form_Element#init()
  */
 public function init()
 {
     parent::init();
     /**
      * @todo Change this wired error messages to something more user friendly, or even use simple email regex matching validator
      */
     $validatorHostname = new Zend_Validate_Hostname();
     $validatorHostname->setMessages(array(Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED => "'%value%' appears to be an IP address, but IP addresses are not allowed", Zend_Validate_Hostname::UNKNOWN_TLD => "'%value%' appears to be a DNS hostname but cannot match TLD against known list", Zend_Validate_Hostname::INVALID_DASH => "'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position", Zend_Validate_Hostname::INVALID_HOSTNAME_SCHEMA => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", Zend_Validate_Hostname::UNDECIPHERABLE_TLD => "'%value%' appears to be a DNS hostname but cannot extract TLD part", Zend_Validate_Hostname::INVALID_HOSTNAME => "'%value%' does not match the expected structure for a DNS hostname", Zend_Validate_Hostname::INVALID_LOCAL_NAME => "'%value%' does not appear to be a valid local network name", Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED => "'%value%' appears to be a local network name but local network names are not allowed"));
     $validatorEmail = new Zend_Validate_EmailAddress(Zend_Validate_Hostname::ALLOW_DNS, false, $validatorHostname);
     $validatorEmail->setMessages(array(Zend_Validate_EmailAddress::INVALID => "'%value%' is not a valid email address", Zend_Validate_EmailAddress::INVALID_HOSTNAME => "'%hostname%' is not a valid hostname for email address '%value%'", Zend_Validate_EmailAddress::INVALID_MX_RECORD => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", Zend_Validate_EmailAddress::DOT_ATOM => "'%localPart%' not matched against dot-atom format", Zend_Validate_EmailAddress::QUOTED_STRING => "'%localPart%' not matched against quoted-string format", Zend_Validate_EmailAddress::INVALID_LOCAL_PART => "'%localPart%' is not a valid local part for email address '%value%'"));
     $this->addValidator($validatorEmail);
 }
开发者ID:xinghao,项目名称:shs,代码行数:16,代码来源:Email.php


注:本文中的Zend_Validate_Hostname::setMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。