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


PHP Zend_Validate_EmailAddress::setOptions方法代码示例

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


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

示例1: init

 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_FieldLogin();
     $elements = array();
     // Add email field
     $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
     $validator = new Zend_Validate_EmailAddress();
     $validator->setOptions(array('domain' => false));
     $input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add password field
     $input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:', 'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..'));
     $input->addValidators(array(new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add checkbox field
     $input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox'));
     $decoratorCheckBox = new My_Decorator_CheckBox();
     $input->addDecorator($decoratorCheckBox);
     $elements[] = $input;
     $input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass'));
     $input->addDecorator(new My_Decorator_AnchoraForm());
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
 }
开发者ID:cioionut,项目名称:products-webEcommerce,代码行数:34,代码来源:Login.php

示例2: testSetOptions

 /**
  * Testing setOptions
  */
 public function testSetOptions()
 {
     $this->_validator->setOptions(array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'TestMessage')));
     $messages = $this->_validator->getMessageTemplates();
     $this->assertEquals('TestMessage', $messages[Zend_Validate_EmailAddress::INVALID]);
     $oldHostname = $this->_validator->getHostnameValidator();
     $this->_validator->setOptions(array('hostname' => new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL)));
     $hostname = $this->_validator->getHostnameValidator();
     $this->assertNotEquals($oldHostname, $hostname);
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:13,代码来源:EmailAddressTest.php

示例3: setOptions

 public function setOptions(array $options = array())
 {
     parent::setOptions($options);
     if (!array_key_exists('hostname', $this->_options)) {
         throw new Zend_Validate_Exception("Wymagane określenie opcji hostname (walidatora Zend_Validate_Hostname)");
     }
     if (array_key_exists('alloweddomains', $options)) {
         $this->_options['alloweddomains'] = $options['alloweddomains'];
     } else {
         $this->_options['alloweddomains'] = array();
     }
 }
开发者ID:knatorski,项目名称:SMS,代码行数:12,代码来源:EmailAddressInDomain.php

示例4: _validateEmail

 /**
  * Validates email address
  *
  * @return bool
  */
 protected function _validateEmail()
 {
     if (!strlen($this->_job->getEmail())) {
         return true;
     }
     $validator = new Zend_Validate_EmailAddress();
     $validator->setOptions(array('domain' => false, 'mx' => false));
     if ($validator->isValid($this->_job->getEmail())) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance('SxCms_Job');
     $msg->addMessage('email', $validator->getMessages(), 'location');
     return false;
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:19,代码来源:BaseValidator.php


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