本文整理汇总了PHP中Zend_Validate_EmailAddress类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_EmailAddress类的具体用法?PHP Zend_Validate_EmailAddress怎么用?PHP Zend_Validate_EmailAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Validate_EmailAddress类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ceospeaksAction
public function ceospeaksAction()
{
$request = $this->getRequest();
if ($request->isPost()) {
// action body
$emails_str = str_replace(" ", "", $request->getParam('emails'));
// strips whitespace from string
$emails = explode(",", $emails_str);
// splits string into an array using comma to split
$validator = new Zend_Validate_EmailAddress();
foreach ($emails as $email) {
if (!$validator->isValid($email)) {
array_shift($emails);
// Remove invalid emails
}
}
$mail = new Zend_Mail();
$mail->setFrom('[email protected]', 'winsandwants.com');
$mail->setReplyTo('[email protected]', 'winsandwants.com');
$mail->addTo($emails);
$mail->setSubject('Sharing winsandwants.com');
$txt = "A friend would like to share with you this wonderful free site on goal-setting and the mastermind concept. Please visit: http://winsandwants.com";
$mail->setBodyText($txt, 'UTF-8');
$mail->send();
$this->view->msg = "Thank you for sharing this site. A link to this site has been sent to the following emails: " . implode(",", $emails) . ".";
}
}
开发者ID:jingjangjung,项目名称:WinsAndWants,代码行数:27,代码来源:IndexController.php
示例2: init
public function init()
{
$this->setMethod('post');
// Email entry
$this->addElement('text', 'email', array('label' => 'Email address', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address')))), 'attribs' => array('data-ctfilter' => 'yes')));
// Modify email error messages & add validator
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
$this->getElement('email')->addValidator($emailValidator);
// Password entry
$this->addElement('password', 'password', array('required' => true, 'label' => 'Password', 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your password')))), 'attribs' => array('data-ctfilter' => 'yes')));
// Set up the element decorators
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
// Add the submit button
$this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Login', 'class' => 'button noalt'));
// Add a forgotten password button
$this->addElement('submit', 'forgottenPassword', array('ignore' => true, 'label' => 'Resend Password', 'class' => 'button noalt'));
// Remove the label from the submit button
$element = $this->getElement('submit');
$element->removeDecorator('label');
$element = $this->getElement('forgottenPassword');
$element->removeDecorator('label');
// Set up the decorator on the form and add in decorators which are removed
$this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section one-col'))->addDecorator('Form');
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:25,代码来源:Login.php
示例3: init
public function init()
{
// Type of organisation Element
$this->addElement('select', 'organisation_type', array('label' => 'What sort of organisation are you?', 'required' => true, 'multiOptions' => array('' => '--- Please select ---', LettingAgents_Object_CompanyTypes::LimitedCompany => 'Limited Company', LettingAgents_Object_CompanyTypes::Partnership => 'Partnership', LettingAgents_Object_CompanyTypes::SoleTrader => 'Sole Trader', LettingAgents_Object_CompanyTypes::LimitedLiabilityPartnership => 'Limited liability partnership'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'What sort of organisation are you?', 'notEmptyInvalid' => 'What sort of organisation are you?'))))));
// date_firm_established Element
$this->addElement('text', 'date_established', array('id' => 'theDate', 'label' => 'When were you established?', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'When were you established?', 'notEmptyInvalid' => 'You have entered an invalid date for when were you established?'))))));
// Append Javascripts
//Grab view and add the date picker JavaScript files into the page head
$view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
$view->headLink()->appendStylesheet('/assets/cms/css/datePicker.css', 'screen');
$view->headScript()->appendFile('/assets/vendor/js/date.js', 'text/javascript')->appendFile('/assets/cms/js/jquery.datePicker.js', 'text/javascript')->appendFile('/assets/cms/js/letting-agents/DatePicker.js', 'text/javascript');
// is_associated Element
$this->addElement('select', 'is_associated', array('label' => 'Is your company associated with any other letting business?', 'required' => true, 'multiOptions' => array('' => '--- Please select ---', '1' => 'Yes', '0' => 'No'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Is your company associated with any other company?', 'notEmptyInvalid' => 'Is your company associated with any other company?'))))));
// if_yes Element
$this->addElement('text', 'associated_text', array('label' => 'If yes please state', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'If yes please state', 'notEmptyInvalid' => 'If yes please state'))))));
// contact_name Element
$this->addElement('text', 'contact_name', array('label' => 'Your contact name', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter a contact name', 'notEmptyInvalid' => 'Invalid entry for contact name'))))));
// contact_name Element
$this->addElement('text', 'contact_number', array('label' => 'Your phone number', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'A uk phone number is required', 'notEmptyInvalid' => 'Enter a valid uk phone number'))))));
$phoneValidator = new Zend_Validate_TelephoneNumber();
$phoneValidator->setMessages(array(Zend_Validate_TelephoneNumber::INVALID => "Enter a valid uk phone number"));
$this->getElement('contact_number')->addValidator($phoneValidator);
// General Email Element
$this->addElement('text', 'general_email', array('label' => 'Your general email address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'A general email address is required', 'notEmptyInvalid' => 'Enter a valid email address for the general email address'))))));
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
$this->getElement('general_email')->addValidator($emailValidator);
// Strip all tags to prevent XSS errors
$this->setElementFilters(array('StripTags'));
// Set custom subform decorator
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/personal-details.phtml'))));
$this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:33,代码来源:PersonalDetails.php
示例4: init
public function init()
{
// contactnameElement
$this->addElement('text', 'contactname', array('label' => 'Please give us a head office contact name', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please give us a head office contact name', 'notEmptyInvalid' => 'Invalid contact name'))))));
// telephone_numberl Element
$this->addElement('text', 'telephone_number', array('label' => 'Head office phone number', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter your Head Office telephone number', 'notEmptyInvalid' => 'Invalid UK telephone number for Head Office'))))));
$phoneValidator = new Zend_Validate_TelephoneNumber();
$phoneValidator->setMessages(array(Zend_Validate_TelephoneNumber::INVALID => "Invalid UK telephone number for Head Office"));
$this->getElement('telephone_number')->addValidator($phoneValidator);
// head_office_email_address Email Element
$this->addElement('text', 'head_office_email_address', array('label' => 'Head office email address', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter your head office email address', 'notEmptyInvalid' => 'Head office email address is invalid'))))));
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
$this->getElement('head_office_email_address')->addValidator($emailValidator);
// head_office_fax_number Element
$this->addElement('text', 'head_office_fax_number', array('label' => 'Head office fax number', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Enter your Head Office fax number', 'notEmptyInvalid' => 'Head Office Fax number is not a valid UK telephone number'))))));
$faxValidator = new Zend_Validate_TelephoneNumber();
$faxValidator->setMessages(array(Zend_Validate_TelephoneNumber::INVALID => "Head Office Fax number is not a valid UK telephone number"));
$this->getElement('head_office_fax_number')->addValidator($faxValidator);
// Strip all tags to prevent XSS errors
$this->setElementFilters(array('StripTags'));
// Set custom subform decorator
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/head-office.phtml'))));
$this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:25,代码来源:HeadOffice.php
示例5: isValid
/**
* Make sure the user is valid
*
* @return void
*/
public function isValid($value)
{
$valid = true;
$this->_user = $value;
$namePartsValidator = new Zend_Validate();
$namePartsValidator->addValidator(new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING))->addValidator(new Zend_Validate_Alpha(array('allowWhiteSpace' => true)))->addValidator(new Zend_Validate_StringLength(array('min' => 2)));
if (!$namePartsValidator->isValid($this->_user->getFirstName())) {
$valid = false;
$this->_error($this->_view->translate('The first name must have at least 2 characters and consist only of letters'));
}
if (!$namePartsValidator->isValid($this->_user->getLastName())) {
$valid = false;
$this->_error($this->_view->translate('The last name must have at least 2 characters and consist only of letters'));
}
$emailValidator = new Zend_Validate_EmailAddress();
if (!$emailValidator->isValid($this->_user->getEmail())) {
$valid = false;
$this->_error($this->_view->translate('You must entre a valid email'));
}
if ($this->_user->isNew()) {
$usernameValidator = new Zend_Validate();
$usernameValidator->addValidator(new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING))->addValidator(new Zend_Validate_Alnum(array('allowWhiteSpace' => false)))->addValidator(new Zend_Validate_StringLength(array('min' => 5)));
if (!$usernameValidator->isValid($this->_user->getUsername())) {
$this->_error($this->_view->translate('The username must have at least 5 characters and contains no white spaces'));
}
}
return $valid;
}
开发者ID:EricHogue,项目名称:Koryukan,代码行数:33,代码来源:UserValidator.php
示例6: init
/**
* Create insurance customer search form.
*
* @return void
*/
public function init()
{
$this->setMethod('get');
// Add first name element
$this->addElement('text', 'firstName', array('label' => 'Customer First Name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z\\-\\ \']+$/i', 'messages' => 'Customer First Name must contain alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
// Add last name element
$this->addElement('text', 'lastName', array('label' => 'Customer Last Name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z\\-\\ \']+$/i', 'messages' => 'Customer Last Name must contain alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
// Add line 1 property address element
$this->addElement('text', 'address1', array('label' => 'Street Address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z0-9\\-\\ \'\\,\\.]+$/i', 'messages' => 'Street Address must contain alphanumeric characters and only basic punctuation (hyphen, space, single quote, comma and full stop)')))));
// Add line 2 property address element
$this->addElement('text', 'address2', array('label' => 'Town/City', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z0-9\\-\\ \'\\,\\.]+$/i', 'messages' => 'Town/City must contain alphanumeric characters and only basic punctuation (hyphen, space, single quote, comma and full stop)')))));
// Add postcode element
$this->addElement('text', 'postcode', array('label' => 'Post Code', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[a-z0-9\\ ]+$/i', 'messages' => 'Post Code must only contain alphanumeric characters and spaces')))));
// Add telephone element
$this->addElement('text', 'telephone', array('label' => 'Telephone', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^((\\+44\\s?\\(0\\)\\s?\\d{2,4})|(\\+44\\s?(01|02|03|07|08)\\d{2,3})|(\\+44\\s?(1|2|3|7|8)\\d{2,3})|(\\(\\+44\\)\\s?\\d{3,4})|(\\(\\d{5}\\))|((01|02|03|07|08)\\d{2,3})|(\\d{5}))(\\s|-|.)(((\\d{3,4})(\\s|-)(\\d{3,4}))|((\\d{6,7})))$/', 'messages' => 'Not a valid phone number')))));
// Add e-mail element
$this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'filters' => array('StringTrim')));
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in email address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid email address'));
$this->getElement('email')->addValidator($emailValidator);
// Set up the element decorators
$this->setElementDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div'))));
// Add search button
$this->addElement('submit', 'search', array('label' => 'Search'));
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:30,代码来源:InsuranceSearchCustomer.php
示例7: init
/**
* Create property subform
*
* @return void
*/
public function init()
{
// Add title element
$this->addElement('select', 'title', array('label' => 'Title', 'required' => true, 'multiOptions' => array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Ms' => 'Ms', 'Miss' => 'Miss', 'Sir' => 'Sir', 'Mr and Mrs' => 'Mr and Mrs', 'Doctor' => 'Dr', 'Professor' => 'Professor', 'Reverend' => 'Rev', 'Other' => 'Other'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your title', 'notEmptyInvalid' => 'Please select landlord title'))))));
// Add first name element
$this->addElement('text', 'first_name', array('label' => 'First name', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name', 'notEmptyInvalid' => 'Please enter landlord first name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'First name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
// Add last name element
$this->addElement('text', 'last_name', array('label' => 'Last name', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord last name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Last name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
// Add e-mail element
$this->addElement('text', 'email_address', array('label' => 'Email address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord email address'))))));
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
$this->getElement('email_address')->addValidator($emailValidator);
// Add confirm e-mail element
$this->addElement('text', 'confirm_email_address', array('label' => 'Confirm email address', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please confirm landlord email address'))))));
// Add phone number element
$this->addElement('text', 'phone_number', array('label' => 'Phone number', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter landlord phone number'))))));
// Add Question-1 element
$this->addElement('radio', 'question1', array('label' => 'Are you aware of any circumstances which may give rise to a claim?', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to question: Are you aware of any circumstances which may give rise to a claim?', 'notEmptyInvalid' => 'Please select answer to question: Are you aware of any circumstances which may give rise to a claim?'))))));
// Additional claim information element - textarea box
$this->addElement('textarea', 'claiminfo', array('label' => 'Additional information', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please provide additional claim information.', 'notEmptyInvalid' => 'Please enter additional claim information'))))));
// Add Question-2 element
$this->addElement('radio', 'question2', array('label' => 'Will only permitted occupiers be living in the property?', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to question: Will only permitted occupiers be living in the property?', 'notEmptyInvalid' => 'Please select answer to question: Will only permitted occupiers be living in the property?'))))));
// Add Question-3 element
$this->addElement('radio', 'question3', array('label' => 'Any tenancy disputes, including late payment of rent?', 'required' => true, 'multiOptions' => array('yes' => 'Yes', 'no' => 'No'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to question: Any tenancy disputes, including late payment of rent?', 'notEmptyInvalid' => 'Please select answer to question: Any tenancy disputes, including late payment of rent?'))))));
// Add agreement element
$this->addElement('radio', 'agreement', array('label' => 'Type of tenancy agreement', 'required' => true, 'multiOptions' => array('AST' => 'AST', 'Company' => 'Company'), 'separator' => ' ', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select answer to Type of tenancy agreement', 'notEmptyInvalid' => 'Please select answer to Type of tenancy agreement'))))));
// Set custom subform decorator
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'rentguarantee/subforms/rent-recovery-plus-application-landlord.phtml'))));
$this->setElementFilters(array('StripTags'));
$this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:37,代码来源:Landlord.php
示例8: 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
示例9: init
/**
* Create user details form (single user).
*
* @return void
*/
public function init()
{
// Invoke the agent user manager
$agentUserManager = new Manager_Core_Agent_User();
// Create array of possible security questions
$securityQuestions = array('' => '--- please select ---');
$securityQuestions += $agentUserManager->getUserSecurityAllQuestions();
// Add real name element
$this->addElement('text', 'realname', array('label' => 'Full name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your full name', 'notEmptyInvalid' => 'Please enter your full name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
// Add username element
$this->addElement('text', 'username', array('label' => 'Username', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your username', 'notEmptyInvalid' => 'Please enter your username'))), array('regex', true, array('pattern' => '/^[a-z0-9]{1,64}$/i', 'messages' => 'Username must contain between 1 and 64 alphanumeric characters')))));
if ($this->_role == Model_Core_Agent_UserRole::MASTER) {
$this->getElement('username')->setRequired(true);
} else {
$this->getElement('username')->setAttrib('disabled', 'disabled');
}
// Add password1 element
$passwordElement1 = new Zend_Form_Element_Password('password1');
$passwordElement1->setRequired(false);
$passwordElement1->setLabel('New password:');
$passwordElement1->addValidator(new Zend_Validate_PasswordStrength());
$this->addElement($passwordElement1);
$validator = new Zend_Validate_Identical();
$validator->setToken('password2');
$validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
$passwordElement1->addValidator($validator);
$passwordElement2 = new Zend_Form_Element_Password('password2');
$passwordElement2->setRequired(false);
$passwordElement2->setLabel('New password (again)');
$this->addElement($passwordElement2);
// Add e-mail element
$this->addElement('text', 'email', array('label' => 'E-mail address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your e-mail address'))))));
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
$this->getElement('email')->addValidator($emailValidator);
if ($this->_role == Model_Core_Agent_UserRole::MASTER) {
$this->getElement('email')->setRequired(true);
} else {
$this->getElement('email')->setAttrib('disabled', 'disabled');
}
// Add e-mail element
$this->addElement('text', 'emailcopyto', array('label' => 'Copy e-mail to', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a copy-to e-mail address'))))));
$emailCopyToValidator = new Zend_Validate_EmailAddress();
$emailCopyToValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in copy-to e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid copy-to e-mail address'));
$this->getElement('emailcopyto')->addValidator($emailCopyToValidator);
// Add security question element
$this->addElement('select', 'question', array('label' => 'Security question', 'required' => false, 'multiOptions' => $securityQuestions));
// Add security answer element
$this->addElement('text', 'answer', array('label' => 'Security answer', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[\\w\\ \\.\\-\'\\,]{2,}$/i', 'messages' => 'Security answer must contain at least two characters and only basic punctuation (hyphen, apostrophe, comma, full stop and space)')))));
// Add master user element
$this->addElement('checkbox', 'master', array('label' => 'Master user', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
// Add agent reports element
$this->addElement('checkbox', 'reports', array('label' => 'Agent reports', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
// Add status element
$this->addElement('checkbox', 'status', array('label' => 'Active', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
// Set custom subform decorator
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'settings/subforms/useraccount.phtml', 'role' => $this->_role))));
$this->setElementFilters(array('StripTags'));
$this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:65,代码来源:UserAccount.php
示例10: gravatar
/**
* Returns an avatar from gravatar's service.
*
* @link http://en.gravatar.com/site/implement/images/php/
* @throws Zend_View_Exception
*
* @param string|null $email Valid email adress
* @param array $options Options
* 'imgSize' height of img to return
* 'defaultImg' img to return if email adress has not found
* 'rating' rating parametr for avatar
* @param array $attribs Attribs for img tag (title, alt etc.)
* @param bool $flag Use HTTPS? Default false.
* @return string
*/
public function gravatar($email = null, $options = array(), $attribs = array(), $flag = false)
{
if ($email === null) {
return '';
}
if (count($options) > 0) {
if (isset($options['imgSize'])) {
$this->setImgSize($options['imgSize']);
}
if (isset($options['defaultImg'])) {
$this->setDefaultImg($options['defaultImg']);
}
if (isset($options['rating'])) {
$this->setRating($options['rating']);
}
}
$validatorEmail = new Zend_Validate_EmailAddress();
$validatorResult = $validatorEmail->isValid($email);
if ($validatorResult === false) {
throw new Zend_View_Exception(current($validatorEmail->getMessages()));
}
$hashEmail = md5($email);
$src = $this->getGravatarUrl($flag) . '/' . $hashEmail . '?s=' . $this->getImgSize() . '&d=' . $this->getDefaultImg() . '&r=' . $this->getRating();
$attribs['src'] = $src;
$html = '<img' . $this->_htmlAttribs($attribs) . $this->getClosingBracket();
return $html;
}
开发者ID:BGCX262,项目名称:zweer-gdr-svn-to-git,代码行数:42,代码来源:Gravatar.php
示例11: gravatar
/**
* Returns an avatar from gravatar's service.
*
* @link http://pl.gravatar.com/site/implement/url
* @throws Zend_View_Exception
*
* @param string|null $email Valid email adress
* @param null|array $options Options
* 'imgSize' height of img to return
* 'defaultImg' img to return if email adress has not found
* 'rating' rating parameter for avatar
* @param null|array $attribs Attribs for img tag (title, alt etc.)
* @param null|bool Use HTTPS? Default false.
* @link http://pl.gravatar.com/site/implement/url More information about gravatar's service.
* @return string|Zend_View_Helper_Gravatar
*/
public function gravatar($email = null, $options = array(), $attribs = array(), $flag = false)
{
if ($email === null) {
return null;
}
if (count($options) > 0) {
if (isset($options['imgSize'])) {
$this->setImgSize($options['imgSize']);
}
if (isset($options['defaultImg'])) {
$this->setDefaultImg($options['defaultImg']);
}
if (isset($options['rating'])) {
$this->setRating($options['rating']);
}
}
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validatorEmail = new Zend_Validate_EmailAddress();
$validatorResult = $validatorEmail->isValid($email);
if ($validatorResult === false) {
return null;
}
$hashEmail = md5($email);
$src = $this->getGravatarUrl($flag) . '/' . $hashEmail . '?s=' . $this->getImgSize() . '&d=' . $this->getDefaultImg() . '&r=' . $this->getRating();
$attribs['src'] = $src;
$html = '<img' . $this->_htmlAttribs($attribs) . $this->getClosingBracket();
return $html;
}
开发者ID:kminkov,项目名称:Blog,代码行数:47,代码来源:Gravatar.php
示例12: mailAction
public function mailAction()
{
$error = array();
$posts = array('First Name' => $_POST['first_name'], 'Last Name' => $_POST['last_name'], 'Email' => $_POST['email'], 'Message' => $_POST['message']);
$validatorChain = new Zend_Validate();
$validatorChain->addValidator(new Zend_Validate_NotEmpty());
$valid_email = new Zend_Validate_EmailAddress();
if ($valid_email->isValid($posts['Email'])) {
} else {
foreach ($valid_email->getMessages() as $message) {
$error[] = "Email {$message}\n";
}
}
foreach ($posts as $key => $post) {
if ($validatorChain->isValid($post)) {
} else {
foreach ($validatorChain->getMessages() as $message) {
$error[] = "{$key} {$message}\n";
}
}
}
if (count($error) != 0) {
$this->view->alerts = $error;
} else {
$to = '[email protected]';
$subject = 'Email from Illustrated Portland';
$message = $posts['Message'];
$headers = "From: {$posts['First Name']} {$posts['Last Name']} <{$posts['Email']}>";
mail($to, $subject, $message, $headers);
//$this->view->alerts = array("Thank You! Your message has been sent.");
}
}
开发者ID:kellancraddock,项目名称:illustrated_portland,代码行数:32,代码来源:ContactController.php
示例13: init
/**
* Create lost login (password retrieval) form.
*
* @return void
*/
public function init()
{
// Invoke the agent user manager
$agentUserManager = new Manager_Core_Agent_User();
// Create array of possible security questions
$securityQuestions = array('' => '--- please select ---');
$securityQuestions += $agentUserManager->getUserSecurityAllQuestions();
$this->setMethod('post');
// Add agent scheme number element
$this->addElement('text', 'agentschemeno', array('label' => 'Agent Scheme Number', 'required' => false, 'filters' => array('Digits'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your Agent Scheme Number', 'notEmptyInvalid' => 'Please enter your Letting Agent Scheme Number'))), array('regex', true, array('pattern' => '/^\\d{5,}$/', 'messages' => 'Agent Scheme Number must contain at least 5 digits')))));
// Add username element
$this->addElement('text', 'username', array('label' => 'Username', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your username', 'notEmptyInvalid' => 'Please enter your username'))), array('regex', true, array('pattern' => '/^[a-z0-9]{6,64}$/i', 'messages' => 'Username must contain between 6 and 64 alphanumeric characters')))));
// Add password element
$this->addElement('password', 'password', array('label' => 'Password', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your password', 'notEmptyInvalid' => 'Please enter your password'))), array('regex', true, array('pattern' => '/^.{6,}$/', 'messages' => 'Password must contain at least 6 characters')))));
// Add real name element
$this->addElement('text', 'realname', array('label' => 'First name + last name', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name + last name', 'notEmptyInvalid' => 'Please enter your first name + last name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
// Add security question element
$this->addElement('select', 'question', array('label' => 'Security question', 'required' => false, 'multiOptions' => $securityQuestions, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select a security question', 'notEmptyInvalid' => 'Please select a security question'))))));
// Add security answer element
$this->addElement('text', 'answer', array('label' => 'Security answer', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your security answer', 'notEmptyInvalid' => 'Please enter your security answer'))), array('regex', true, array('pattern' => '/^[\\w\\ \\.\\-\'\\,]{2,}$/i', 'messages' => 'Security answer must contain at least two characters and only basic punctuation (hyphen, apostrophe, comma, full stop and space)')))));
// Add e-mail element
$this->addElement('text', 'email', array('label' => 'E-mail address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your e-mail address'))))));
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
$this->getElement('email')->addValidator($emailValidator);
$this->setElementFilters(array('StripTags'));
// Set up the element decorators
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
// Add login button
$this->addElement('submit', 'login', array('label' => 'Login'));
}
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:36,代码来源:LostLogin.php
示例14: registerAction
public function registerAction()
{
$name = $this->_getParam('name');
$avatar = $this->_getParam('avatar');
$sex = $this->_getParam('sex');
$birthday = $this->_getParam('birthday');
$email = $this->_getParam('email');
$passwd = $this->_getParam('passwd');
$phone = $this->_getParam('phone');
$department = $this->_getParam('department');
$city = $this->_getParam('city');
//$certified = $this->_getParam('certified');
$special = $this->_getParam('special');
$country = $this->_getParam('country');
$introduction = $this->_getParam('introduction');
$hospital = $this->_getParam('hospital');
$area = $this->_getParam('area');
$qualification = $this->_getParam('qualification');
if (!$passwd) {
$out['errno'] = '3';
$out['msg'] = Yy_ErrMsg_Doctor::getMsg('register', $out['errno']);
Yy_Utils::jsonOut($out);
return;
}
$validatorEmail = new Zend_Validate_EmailAddress();
if ($validatorEmail->isValid($email)) {
$bool = Application_Model_M_Doctor::fetchByEmail($email);
if ($bool) {
//已注册
$out['errno'] = '1';
} else {
$out['errno'] = '0';
$doctor = new Application_Model_O_Doctor();
$doctor->setName($name)->setSex($sex)->setBirthday($birthday)->setEmail($email)->setPasswd(md5($passwd))->setPhone($phone)->setDepartment($department)->setCity($city)->setSpecial($special)->setCountry($country)->setIntroduction($introduction)->setHospital($hospital)->setArea($area)->setQualification($qualification)->setCtime(date('Y-m-d H:i:s'));
$certified = ceil(count($doctor->getModifiedFields()) / 3);
$doctor->setCertified($certified);
$doctor->save();
//保存医生头像
$adapter = new Zend_File_Transfer_Adapter_Http();
$wrdir = Yy_Utils::getWriteDir();
$adapter->setDestination($wrdir);
if (!$adapter->receive()) {
$messages = $adapter->getMessages();
//echo implode("\n", $messages);
}
$filename = $adapter->getFileName();
if (is_string($filename)) {
$handle = fopen($filename, 'rb');
$avatar = addslashes(fread($handle, filesize($filename)));
fclose($handle);
Application_Model_M_Doctor::updateAvatar($doctor->getId(), $avatar);
}
}
} else {
$out['errno'] = '2';
}
$out['msg'] = Yy_ErrMsg_Doctor::getMsg('register', $out['errno']);
Yy_Utils::jsonOut($out);
}
开发者ID:baiooy,项目名称:hqimt_backend,代码行数:59,代码来源:DoctorController.php
示例15: indexAction
public function indexAction()
{
$emailValidator = new Zend_Validate_EmailAddress();
$nameValidator = new Zend_Validate_NotEmpty(array(Zend_Validate_NotEmpty::STRING, Zend_Validate_NotEmpty::SPACE));
$password1_Validator = new Zend_Validate();
$password1_Validator->addValidator(new Zend_Validate_StringLength(array('min' => 6, 'max' => 12)))->addValidator(new Zend_Validate_Alnum());
$password2_Validator = new Zend_Validate();
$password2_Validator->addValidator(new Zend_Validate_StringLength(array('min' => 6, 'max' => 12)))->addValidator(new Zend_Validate_Alnum());
$captcha = new Zend_Captcha_Image();
$captcha->setName('captchaword')->setFont(APPLICATION_PATH . '/data/arial.ttf')->setFontSize(28)->setImgDir(APPLICATION_PATH . '/../public/img')->setImgUrl('/img')->setWordLen(5)->setDotNoiseLevel(20)->setExpiration(300);
$request = $this->getRequest();
$post = $request->getPost();
// $passwordIdentical = new Zend_Validate_Identical(array('token' => $post['password1']));
$messages = array();
$error = array();
$noValiError = true;
|
请发表评论