本文整理汇总了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')));
}
示例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);
}
示例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();
}
}
示例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;
}