當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Form_Element_Password::setOptions方法代碼示例

本文整理匯總了PHP中Zend_Form_Element_Password::setOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Form_Element_Password::setOptions方法的具體用法?PHP Zend_Form_Element_Password::setOptions怎麽用?PHP Zend_Form_Element_Password::setOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Form_Element_Password的用法示例。


在下文中一共展示了Zend_Form_Element_Password::setOptions方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     // $this->t = Zend_Registry::get('Zend_Translate');
     $username->setOptions(array('label' => $this->t('Username'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $authentification = new LoginAttempt();
     if ($authentification->canAttemptToLogin() == FALSE) {
         $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->t("no humain"), 'captcha' => array("captcha" => "Image", "wordLen" => 4, "font" => "font/tahoma.ttf", "height" => 100, "width" => 300, "fontSize" => 50, "imgDir" => "data/captchas", "imgUrl" => "data/captchas")));
         $this->addElement($captcha);
     }
     $connexion = new Zend_Form_Element_Submit('Connexion');
     $connexion->setOptions(array('label' => $this->t('Log In')));
     $connexion->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'openOnly' => true))));
     $this->addElement($connexion);
     $inscription = new Zend_Form_Element_Submit('inscription');
     $inscription->setOptions(array('label' => $this->t('Sign Up')));
     $inscription->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'dd', 'closeOnly' => true))));
     $this->addElement($inscription);
     $this->clearDecorators();
 }
開發者ID:omusico,項目名稱:logica,代碼行數:34,代碼來源:LoginForm.php

示例2: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $userid = new Zend_Form_Element_Hidden('UserID');
     $username = new Zend_Form_Element_Text('Username');
     $username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim')));
     $password = new Zend_Form_Element_Password('Password');
     $password->setOptions(array('label' => 'Password', 'required' => TRUE));
     $repassword = new Zend_Form_Element_Password('RePassword');
     $repassword->setOptions(array('label' => 'Retype Password', 'required' => TRUE));
     $role = new Zend_Form_Element_Hidden('Role');
     $fullname = new Zend_Form_Element_Text('FullName');
     $fullname->setOptions(array('label' => 'FullName'));
     $email = new Zend_Form_Element_Text('Email');
     $email->setOptions(array('label' => 'Email', 'required' => TRUE));
     $birthday = new Zend_Form_Element_Text("Birthday");
     $birthday->setOptions(array('label' => 'Birthday'));
     $group = new Zend_Form_Element_Text('Group');
     $group->setOptions(array('label' => 'Group'));
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setOptions(array('label' => 'Phone'));
     $address = new Zend_Form_Element_Text('Address');
     $address->setOptions(array('label' => 'Address'));
     $submit = new Zend_Form_Element_Submit('Submit');
     $this->setName('profile-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $password, $repassword, $role, $fullname, $email, $birthday, $group, $phone, $address, $submit))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form'));
 }
開發者ID:laiello,項目名稱:mock-project,代碼行數:28,代碼來源:Profile.php

示例3: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $user = Zend_Auth::getInstance()->getIdentity();
     $oldPasswordValidator = new App_Validate_PasswordExists(array('table' => 'backoffice_users', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkValue' => $user->id));
     $complexityValidator = new Zend_Validate_Regex('/^(?=.*\\d)(?=.*[a-z|A-Z]).{7,}$/');
     $complexityValidator->setMessage('The selected password does not meet the required complexity requirements');
     $stringLengthValidator = new Zend_Validate_StringLength();
     $stringLengthValidator->setMin(7);
     $stringLengthValidator->setMessage('Your password must be at least 7 characters long');
     $passwordHistoryValidator = new App_Validate_NoPasswordExists(array('table' => 'password_log', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkField' => 'user_id', 'userPkValue' => $user->id));
     $oldPassword = new Zend_Form_Element_Password('old_password');
     $oldPassword->setOptions(array('label' => $this->t('Old password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $oldPasswordValidator)));
     $this->addElement($oldPassword);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('New password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $stringLengthValidator, $complexityValidator, $passwordHistoryValidator)));
     $this->addElement($password);
     $sameAsValidator = new App_Validate_SameAs($password);
     $sameAsValidator->setMessage('The two passwords do not coincide.', App_Validate_SameAs::NOT_THE_SAME);
     $retypeNewPassword = new Zend_Form_Element_Password('retype_new_password');
     $retypeNewPassword->setOptions(array('label' => $this->t('Retype new password'), 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $sameAsValidator)));
     $this->addElement($retypeNewPassword);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => $this->t('Save password'), 'required' => TRUE));
     $this->addElement($submit);
 }
開發者ID:omusico,項目名稱:logica,代碼行數:35,代碼來源:ChangePasswordForm.php

示例4: init

 public function init()
 {
     // Set request method
     $this->setMethod('post');
     // Email entry
     $this->addElement('span', 'email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'formvalue', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address'))))));
     // 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);
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('Create your password');
     $passwordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Re-enter password');
     $confirmPasswordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $securityQuestionModel = new Datasource_Core_SecurityQuestion();
     $securityQuestionOptions = array(0 => '- Please Select -');
     foreach ($securityQuestionModel->getOptions() as $option) {
         $securityQuestionOptions[$option['id']] = $option['question'];
     }
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => false, 'multiOptions' => $securityQuestionOptions, 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     /* Value no longer mandatory, Redmine #11873
             $questionElement = $this->getElement('security_question');
             $validator = new Zend_Validate_GreaterThan(array('min'=> 0));
             $validator->setMessage('You must select a security question');
             $questionElement->addValidator($validator);
     */
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => false, 'filters' => array('StringTrim')));
     // Set custom subform decorator - this is the default and gets overridden by view scripts in the tenants' and landlords' Q&Bs
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/register.phtml'))));
     // Set element decorators
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
     // Grab view and add the client-side password validation JavaScript into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     $view->headScript()->appendFile('/assets/common/js/passwordValidation.js', 'text/javascript');
 }
開發者ID:AlexEvesDeveloper,項目名稱:hl-stuff,代碼行數:52,代碼來源:Register.php

示例5: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $username = new Zend_Form_Element_Text('username');
     $username->setOptions(array('label' => 'Username', 'required' => TRUE, 'filters' => array('StringTrim')));
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => 'Password', 'required' => TRUE));
     $login = new Zend_Form_Element_Submit('login');
     $login->setOptions(array('label' => 'Login'));
     $this->setName('login-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($username, $password, $login))->setDecorators(array('FormElements', 'Errors', array('HtmlTag', array('tag' => 'table', 'cellpadding' => '3')), 'Form'));
 }
開發者ID:laiello,項目名稱:mock-project,代碼行數:13,代碼來源:Login.php

示例6: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => $this->t('Password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $retypePassword = new Zend_Form_Element_Password('retypePassword');
     $retypePassword->setOptions(array('label' => $this->t('Retype password'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($retypePassword);
     $this->addDisplayGroup(array('password', 'retypePassword'), 'passwords')->getDisplayGroup('passwords')->setLegend('Password');
 }
開發者ID:omusico,項目名稱:logica,代碼行數:20,代碼來源:UserAddForm.php

示例7: getLoginForm

 /**
  * Create and return the login form
  *
  * @return object
  */
 protected function getLoginForm()
 {
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username:')->setRequired(true)->setDecorators(array(array('ViewScript', array('viewScript' => '_form/text.phtml', 'placement' => false))));
     $username->setOptions(array('placeholder' => 'username...', 'inputtype' => 'text'));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password:')->setRequired(true)->setDecorators(array(array('ViewScript', array('viewScript' => '_form/text.phtml', 'placement' => false))));
     $password->setOptions(array('placeholder' => 'password...', 'inputtype' => 'password'));
     $submit = new Zend_Form_Element_Submit('login');
     $submit->setLabel('Login');
     $loginForm = new Zend_Form();
     $loginForm->setAction($this->_request->getBaseUrl() . '/login/index/')->setMethod('post')->addElement($username)->addElement($password)->addElement($submit);
     return $loginForm;
 }
開發者ID:rapsli,項目名稱:404crawler,代碼行數:19,代碼來源:AuthController.php

示例8: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $username = new Zend_Form_Element_Text('username');
     $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($username);
     $password = new Zend_Form_Element_Password('password');
     $password->setOptions(array('label' => 'Password', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($password);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => 'Log in →', 'required' => true));
     $this->addElement($submit);
 }
開發者ID:omusico,項目名稱:logica,代碼行數:22,代碼來源:LoginForm.php


注:本文中的Zend_Form_Element_Password::setOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。