當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。