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


PHP Zend_Validate_EmailAddress::setMessage方法代码示例

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


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

示例1: testSetSingleMessage

 /**
  * Testing setMessage
  */
 public function testSetSingleMessage()
 {
     $messages = $this->_validator->getMessageTemplates();
     $this->assertNotEquals('TestMessage', $messages[Zend_Validate_EmailAddress::INVALID]);
     $this->_validator->setMessage('TestMessage');
     $messages = $this->_validator->getMessageTemplates();
     $this->assertEquals('TestMessage', $messages[Zend_Validate_EmailAddress::INVALID]);
 }
开发者ID:netvlies,项目名称:zf,代码行数:11,代码来源:EmailAddressTest.php

示例2: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $language = $translate->getLocale();
     $baseurl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $actionUrl = $baseurl . '/' . $language . '/account/fetchpassword';
     $this->setName('fetchpassword_form');
     $this->setAction($actionUrl);
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $mailvalid = new Zend_Validate_EmailAddress();
     $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID);
     $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME);
     $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD);
     $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM);
     $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING);
     $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
     $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME);
     $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
     $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME);
     $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
     // Username input form element
     $username = new Zend_Form_Element_Text('email');
     $username->setLabel($translate->_("account-fetchpassword-email"))->removeDecorator('DtDdWrapper')->addFilter('StringtoLower')->setRequired(true)->addValidators(array($mailvalid))->setDecorators(array('FetchPasswordDecorator'));
     $hidden = new Zend_Form_Element_Hidden('submittedform');
     $hidden->setValue('fetchpassword');
     // Form submit buttom element
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("account-fetchpassword-submit"))->removeDecorator('DtDdWrapper')->setAttrib('class', 'fetchpassword-submit left');
     // Add elements to form
     $this->addElements(array($username, $submit, $hidden));
 }
开发者ID:jannev,项目名称:site,代码行数:34,代码来源:FetchPasswordForm.php

示例3: init

 /**
  * Konfiguriert das Formularelement.
  */
 public function init()
 {
     parent::init();
     $this->setAttrib('placeholder', $this->getTranslator()->translate('email_format'));
     $this->setAttrib('size', 60);
     $validator = new Zend_Validate_EmailAddress();
     $validator->setMessage('admin_validate_error_email');
     $this->addValidator($validator);
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:12,代码来源:Email.php

示例4: init

 public function init()
 {
     parent::init();
     $this->setAction(WEB_ROOT . '/commenting/comment/add');
     $this->setAttrib('id', 'comment-form');
     $user = current_user();
     /************************************************************
      *REVISIONS
      * Ver        Date       Author          Description
      * --------  ----------  --------------  ----------------------
      * 1.0       09/02/2015  mrs175          1. added validators/form limitations for author name, email, and comment
      ************************************************************/
     //Validators
     //------------------------------------------------------------------
     $notEmptyValidator = array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Please fill in this box.'), Zend_Validate_NotEmpty::INVALID => __('Please only use letters numbers and punctuation.'))));
     $alphaNumericValidator = array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '#^[a-zA-Z0-9.*@+!\\-_%\\#\\^&$ ]*$#u', 'messages' => array(Zend_Validate_Regex::INVALID => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'), Zend_Validate_Regex::ERROROUS => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'), Zend_Validate_Regex::NOT_MATCH => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'))));
     //form element options
     //----------------------------------------------------------
     $nameOptions = array('label' => __('Name (required)'), 'required' => true, 'size' => '25', 'maxlength' => '25', 'validators' => array($notEmptyValidator, $alphaNumericValidator));
     $emailOptions = array('label' => __('Email (required)'), 'required' => true, 'size' => '100', 'maxlength' => '70', 'validators' => array($notEmptyValidator));
     $commentOptions = array('label' => __('1500 character limit'), 'id' => 'comment-form-body', 'rows' => "8", 'cols' => "50", 'maxlength' => '1500', 'required' => true, 'filters' => array(array('StripTags', array('allowTags' => array('p', 'span', 'em', 'strong', 'a', 'ul', 'ol', 'li'), 'allowAttribs' => array('style', 'href')))), 'validators' => array($notEmptyValidator));
     //Adding Elements to the form
     //-------------------------------------------------------------------------------
     //auto-filling the email and name boxes for logged in users
     //then making them read only, so logged in users must use their registered name and email
     if ($user) {
         $emailOptions['value'] = $user->email;
         $emailOptions['readonly'] = true;
         $emailOptions['onfocus'] = "this.blur()";
         $nameOptions['value'] = $user->name;
         $nameOptions['readonly'] = true;
         $nameOptions['onfocus'] = "this.blur()";
     }
     $this->addElement('text', 'author_name', $nameOptions);
     $this->addElement('text', 'author_email', $emailOptions);
     $this->addElement('textarea', 'body', $commentOptions);
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessage('Please enter an email address like stuff@email.com');
     $this->getElement('author_email')->addValidator($emailValidator, true, array());
     if (get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
         $this->addElement('captcha', 'captcha', array('label' => __("Please verify you're a human"), 'captcha' => array('captcha' => 'ReCaptcha', 'pubkey' => get_option('recaptcha_public_key'), 'privkey' => get_option('recaptcha_private_key'), 'ssl' => true)));
         $this->getElement('captcha')->removeDecorator('ViewHelper');
     }
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $params = $request->getParams();
     $record_id = $this->_getRecordId($params);
     $record_type = $this->_getRecordType($params);
     $this->addElement('hidden', 'record_id', array('value' => $record_id, 'decorators' => array('ViewHelper')));
     $this->addElement('hidden', 'path', array('value' => $request->getPathInfo(), 'decorators' => array('ViewHelper')));
     if (isset($params['module'])) {
         $this->addElement('hidden', 'module', array('value' => $params['module'], 'decorators' => array('ViewHelper')));
     }
     $this->addElement('hidden', 'record_type', array('value' => $record_type, 'decorators' => array('ViewHelper')));
     fire_plugin_hook('commenting_form', array('comment_form' => $this));
     $this->addElement('submit', 'submit', array('label' => __('Submit')));
 }
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:56,代码来源:CommentForm.php

示例5: __construct

 public function __construct()
 {
     // Validators --------------------------
     $notEmpty = new Zend_Validate_NotEmpty(array(true));
     $notEmpty->setMessage($this->_errorMessages['isEmpy']);
     $digits = new Zend_Validate_Digits();
     $digits->setMessage($this->_errorMessages['digits']);
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessage($this->_errorMessages['emailValidator']);
     $foneValidator = new Zend_Validate_StringLength();
     $foneValidator->setMin(8);
     $foneValidator->setMessage($this->_errorMessages['foneValidator']);
     //--------------------------------------
     $nome = new Zend_Form_Element_Text('nome');
     $nome->setAttrib('class', 'form-control');
     $nome->setRequired(true);
     $nome->addValidator($notEmpty, true);
     //--------------------------------------------------------
     $fone = new Zend_Form_Element_Text('fone');
     $fone->setAttrib('class', 'form-control');
     $fone->setRequired(true);
     $fone->addValidator($notEmpty, true);
     $fone->addValidator($digits, true);
     $fone->addValidator($foneValidator, true);
     //--------------------------------------------------------
     $email = new Zend_Form_Element_Text('email');
     $email->setAttrib('class', 'form-control');
     $email->setRequired(true);
     $email->addValidator($notEmpty, true);
     $email->addValidator($emailValidator, true);
     //--------------------------------------------------------
     $mensagem = new Zend_Form_Element_Textarea('mensagem');
     $mensagem->setAttrib('class', 'form-control');
     $mensagem->setAttrib('cols', 30);
     $mensagem->setAttrib('rows', 10);
     $mensagem->setRequired(true);
     $mensagem->addValidator($notEmpty, true);
     //--------------------------------------------------------
     $this->addElement($nome);
     $this->addElement($fone);
     $this->addElement($email);
     $this->addElement($mensagem);
     $this->setElementDecorators(array('ViewHelper', 'Errors'));
 }
开发者ID:elvisdandrea,项目名称:esselence,代码行数:44,代码来源:FaleConoscoForm.php

示例6: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $this->removeDecorator('DtDdWrapper');
     $this->setName('register_form');
     $this->setAttrib('id', 'register_form');
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->addElementPrefixPath('Oibs_Validators', 'OIBS/Validators/', 'validate');
     $city = new Zend_Form_Element_Text('city');
     $city->setLabel($translate->_("account-register-city"))->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('Regex', true, array('/^[\\p{L}0-9.\\- ]*$/'))))->setDecorators(array('RegistrationDecorator'));
     $mailvalid = new Zend_Validate_EmailAddress();
     $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID);
     $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME);
     $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD);
     $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM);
     $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING);
     $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
     $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME);
     $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
     $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME);
     $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($translate->_("account-register-email"))->setRequired(true)->addFilter('StringtoLower')->addValidators(array($mailvalid))->addErrorMessage('email-invalid')->setDecorators(array('RegistrationDecorator'));
     $e_options = array("" => "account-select", "private_sector" => "account-register_private_sector", "public_sector" => "account-register_public_sector", "education_sector" => "account-register_education_sector", "student" => "account-register_student", "pentioner" => "account-register_pentioner", "other" => "account-register_other");
     $employment = new Zend_Form_Element_Select('employment');
     $employment->setLabel($translate->_("account-register-employment"))->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty')))))->addMultiOptions($e_options)->setDecorators(array('RegistrationDecorator'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel($translate->_("account-register-username"))->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', false, array(4, 16, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long'))), new Oibs_Validators_UsernameExists('username'), new Oibs_Validators_Username('username')))->setDecorators(array('RegistrationDecorator'));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel($translate->_("account-register-password"));
     $password->setRequired(true);
     $password->addValidators(array(new Oibs_Validators_RepeatValidator('confirm_password'), array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty'))), array('StringLength', false, array(4, 16, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long')))));
     $password->setDecorators(array('RegistrationDecorator'));
     $confirm_password = new Zend_Form_Element_Password('confirm_password');
     $confirm_password->setLabel($translate->_("account-register-password_confirm"));
     $confirm_password->setRequired(true);
     $confirm_password->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty')));
     $confirm_password->addValidator('StringLength', false, array(4, 16, 'messages' => array('stringLengthTooShort' => 'field-too-short', 'stringLengthTooLong' => 'field-too-long')));
     $confirm_password->setDecorators(array('RegistrationDecorator'));
     $captcha = new Zend_Form_Element('captcha');
     $captcha->setDecorators(array('CaptchaDecorator'));
     $captcha_text = new Zend_Form_Element_Text('captcha_text');
     $captcha_text->setLabel($translate->_("account-register-enter_text"))->addValidators(array(new Oibs_Validators_CaptchaValidator(), array('NotEmpty', true, array('messages' => array('isEmpty' => 'field-empty')))))->setRequired(true)->setDecorators(array('RegistrationDecorator'));
     $text = sprintf($translate->_("account-register-terms_and_privacy"), "terms", "privacy");
     // this solution sucks. the codes are in the translate block directly.
     // anyone think of a fix to move codes out of there?
     // - Joel
     $terms = new Zend_Form_Element_Checkbox('terms');
     $terms->setDescription($text)->setLabel("account-register-terms")->setChecked(false)->setRequired(true)->addValidators(array(new Oibs_Validators_CheckboxValidator()))->setDecorators(array('RegistrationTermsDecorator'));
     // checkboxes always have a value of 1or0, this is a "feature" in ZF
     // custom validator is a workaround
     // -Joel
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($translate->_("account-register-submit"))->removeDecorator('DtDdWrapper')->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'registration_submit_div'))))->setAttrib('class', 'registration_form_submit_' . $translate->getLocale());
     $this->addElements(array($username, $password, $confirm_password, $city, $email, $employment, $captcha, $captcha_text, $terms, $submit));
     /*$this->addDisplayGroup(array('username', 'password', 'confirm_password'), 'account_information');
       $this->account_information->setLegend('register-account-information');
       $this->account_information->removeDecorator('DtDdWrapper');
       $this->addDisplayGroup(array('city', 'email', 'employment'), 'personal_information');
       $this->personal_information->removeDecorator('DtDdWrapper');
       $this->personal_information->setLegend('register-personal-information');
       
       $this->addDisplayGroup(array('captcha', 'captcha_text', 'terms', 'submit'), 'confirmations');
       $this->confirmations->removeDecorator('DtDdWrapper');
       $this->confirmations->setLegend('register-confirmations');*/
 }
开发者ID:jannev,项目名称:site,代码行数:69,代码来源:RegistrationForm.php

示例7: _getValidationRulesBeforeSave

 /**
  * Add validation rules for particular fields
  *
  * @return \Zend_Validate_Interface
  */
 protected function _getValidationRulesBeforeSave()
 {
     $userNameNotEmpty = new \Zend_Validate_NotEmpty();
     $userNameNotEmpty->setMessage(__('User Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY);
     $firstNameNotEmpty = new \Zend_Validate_NotEmpty();
     $firstNameNotEmpty->setMessage(__('First Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY);
     $lastNameNotEmpty = new \Zend_Validate_NotEmpty();
     $lastNameNotEmpty->setMessage(__('Last Name is a required field.'), \Zend_Validate_NotEmpty::IS_EMPTY);
     $emailValidity = new \Zend_Validate_EmailAddress();
     $emailValidity->setMessage(__('Please enter a valid email.'), \Zend_Validate_EmailAddress::INVALID);
     /** @var $validator \Magento\Framework\Validator\Object */
     $validator = $this->_validatorObject->create();
     $validator->addRule($userNameNotEmpty, 'username')->addRule($firstNameNotEmpty, 'firstname')->addRule($lastNameNotEmpty, 'lastname')->addRule($emailValidity, 'email');
     if ($this->_willSavePassword()) {
         $this->_addPasswordValidation($validator);
     }
     return $validator;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:23,代码来源:User.php

示例8: validateEmail

 /**
  * @param  string $email
  * @param  string  $field
  * @return boolean
  */
 protected function validateEmail($email, $field = 'email')
 {
     $emailValidator = new EmailValidator(array('hostname' => new \Zend_Validate_Hostname(array('tld' => false))));
     $emailValidator->setMessage('Ungültiger Typ. String erwartet', EmailValidator::INVALID);
     $emailValidator->setMessage("'%value%' ist keine gültige Email nach dem Format name@hostname", EmailValidator::INVALID_FORMAT);
     $emailValidator->setMessage("'%hostname%' ist kein gültiger Hostname für die Email '%value%'", EmailValidator::INVALID_HOSTNAME);
     $emailValidator->setMessage("'%value%' ist länger als die zulässige Länge", EmailValidator::LENGTH_EXCEEDED);
     if (!$emailValidator->isValid($email)) {
         $messages = array_values($emailValidator->getMessages());
         $this->addError(new Error($field, $email, $messages));
         return false;
     }
     return true;
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:19,代码来源:Base.php

示例9: step2Action

 public function step2Action()
 {
     $this->reloadConfig();
     configureTheme(APPLICATION_THEME, 'install');
     $session = new Zend_Session_Namespace('Install');
     // Set up Doctrine DB
     require_once APPLICATION_DIRECTORY . '/Joobsbox/Db/Doctrine.php';
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->pushAutoloader(array('Doctrine', 'autoload'));
     $doctrineConfig = new Zend_Config_Xml(APPLICATION_DIRECTORY . "/config/db.xml", "doctrine");
     $manager = Doctrine_Manager::getInstance();
     $manager->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, $this->config->db->prefix . '%s');
     $manager->setCollate('utf8_unicode_ci');
     $manager->setCharset('utf8');
     $manager->openConnection($doctrineConfig->connection_string);
     Doctrine::createTablesFromModels($doctrineConfig->models_path);
     $db = Zend_Registry::get("db");
     $db->delete($this->config->db->prefix . "categories", array("Name='Uncategorized'"));
     $db->insert($this->config->db->prefix . "categories", array('ID' => 0, 'Name' => 'Uncategorized', 'Link' => 'Uncategorized', 'OrderIndex' => 100, 'Parent' => 0));
     // Make the form
     $this->adminForm = new Zend_Form();
     $this->adminForm->setAction($this->view->baseUrl . "/install/step2")->setMethod('post')->setLegend('Administrator credentials');
     $notEmpty = new Zend_Validate_NotEmpty();
     $realname = $this->adminForm->createElement('text', 'realname')->setLabel('Your name:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Real name is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $username = $this->adminForm->createElement('text', 'username')->setLabel('Username:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Username is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $password = $this->adminForm->createElement('text', 'password')->setLabel('Password:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Password is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $emailValidator = new Zend_Validate_EmailAddress();
     $email = $this->adminForm->createElement('text', 'email')->setLabel('Email:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[email,required]')->addValidator($notEmpty->setMessage($this->view->translate("Email is mandatory")))->addValidator($emailValidator->setMessage($this->view->translate("Email is invalid")))->setRequired(true);
     $submit = $this->adminForm->createElement('submit', 'Save')->setLabel('Save');
     $this->adminForm->addElement($realname)->addElement($username)->addElement($password)->addElement($email)->addElement($submit);
     $dg = $this->adminForm->addDisplayGroup(array('realname', 'username', 'password', 'email', 'Save'), 'user');
     if ($this->getRequest()->isPost()) {
         $this->validateAdminUser();
         return;
     }
     $this->view->form = $this->adminForm->render();
 }
开发者ID:hashemgamal,项目名称:joobsbox-php,代码行数:40,代码来源:InstallController.php

示例10: _validateInputRule

 /**
  * Validate value by attribute input validation rule
  *
  * @param string $value
  * @return string
  */
 protected function _validateInputRule($value)
 {
     // skip validate empty value
     if (empty($value)) {
         return true;
     }
     $label = Mage::helper('customer')->__($this->getAttribute()->getStoreLabel());
     $validateRules = $this->getAttribute()->getValidateRules();
     if (!empty($validateRules['input_validation'])) {
         switch ($validateRules['input_validation']) {
             case 'alphanumeric':
                 $validator = new Zend_Validate_Alnum(true);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Alnum::INVALID);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" has not only alphabetic and digit characters.', $label), Zend_Validate_Alnum::NOT_ALNUM);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is an empty string.', $label), Zend_Validate_Alnum::STRING_EMPTY);
                 if (!$validator->isValid($value)) {
                     return $validator->getMessages();
                 }
                 break;
             case 'numeric':
                 $validator = new Zend_Validate_Digits();
                 $validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Digits::INVALID);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" contains not only digit characters.', $label), Zend_Validate_Digits::NOT_DIGITS);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is an empty string.', $label), Zend_Validate_Digits::STRING_EMPTY);
                 if (!$validator->isValid($value)) {
                     return $validator->getMessages();
                 }
                 break;
             case 'alpha':
                 $validator = new Zend_Validate_Alpha(true);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Alpha::INVALID);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" has not only alphabetic characters.', $label), Zend_Validate_Alpha::NOT_ALPHA);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is an empty string.', $label), Zend_Validate_Alpha::STRING_EMPTY);
                 if (!$validator->isValid($value)) {
                     return $validator->getMessages();
                 }
                 break;
             case 'email':
                 /**
                 $this->__("'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded")
                 $this->__("Invalid type given. String expected")
                 $this->__("'%value%' appears to be a DNS hostname but contains a dash in an invalid position")
                 $this->__("'%value%' does not match the expected structure for a DNS hostname")
                 $this->__("'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'")
                 $this->__("'%value%' does not appear to be a valid local network name")
                 $this->__("'%value%' does not appear to be a valid URI hostname")
                 $this->__("'%value%' appears to be an IP address, but IP addresses are not allowed")
                 $this->__("'%value%' appears to be a local network name but local network names are not allowed")
                 $this->__("'%value%' appears to be a DNS hostname but cannot extract TLD part")
                 $this->__("'%value%' appears to be a DNS hostname but cannot match TLD against known list")
                 */
                 $validator = new Zend_Validate_EmailAddress();
                 $validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_EmailAddress::INVALID);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::INVALID_FORMAT);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid hostname.', $label), Zend_Validate_EmailAddress::INVALID_HOSTNAME);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid hostname.', $label), Zend_Validate_EmailAddress::INVALID_MX_RECORD);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid hostname.', $label), Zend_Validate_EmailAddress::INVALID_MX_RECORD);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::DOT_ATOM);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::QUOTED_STRING);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid email address.', $label), Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" exceeds the allowed length.', $label), Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be an IP address, but IP addresses are not allowed"), Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot match TLD against known list"), Zend_Validate_Hostname::UNKNOWN_TLD);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but contains a dash in an invalid position"), Zend_Validate_Hostname::INVALID_DASH);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'"), Zend_Validate_Hostname::INVALID_HOSTNAME_SCHEMA);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot extract TLD part"), Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' does not appear to be a valid local network name"), Zend_Validate_Hostname::INVALID_LOCAL_NAME);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a local network name but local network names are not allowed"), Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
                 $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"), Zend_Validate_Hostname::CANNOT_DECODE_PUNYCODE);
                 if (!$validator->isValid($value)) {
                     return array_unique($validator->getMessages());
                 }
                 break;
             case 'url':
                 $parsedUrl = parse_url($value);
                 if ($parsedUrl === false || empty($parsedUrl['scheme']) || empty($parsedUrl['host'])) {
                     return array(Mage::helper('customer')->__('"%s" is not a valid URL.', $label));
                 }
                 $validator = new Zend_Validate_Hostname();
                 if (!$validator->isValid($parsedUrl['host'])) {
                     return array(Mage::helper('customer')->__('"%s" is not a valid URL.', $label));
                 }
                 break;
             case 'date':
                 $validator = new Zend_Validate_Date(Varien_Date::DATE_INTERNAL_FORMAT);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" invalid type entered.', $label), Zend_Validate_Date::INVALID);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" is not a valid date.', $label), Zend_Validate_Date::INVALID_DATE);
                 $validator->setMessage(Mage::helper('customer')->__('"%s" does not fit the entered date format.', $label), Zend_Validate_Date::FALSEFORMAT);
                 if (!$validator->isValid($value)) {
                     return array_unique($validator->getMessages());
                 }
                 break;
         }
     }
//.........这里部分代码省略.........
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:101,代码来源:Abstract.php

示例11: _createEmailEmailAddressValidator

 protected function _createEmailEmailAddressValidator($errorMessage)
 {
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessage($errorMessage, Zend_Validate_EmailAddress::INVALID_FORMAT);
     return $emailValidator;
 }
开发者ID:rizkioa,项目名称:etak6,代码行数:6,代码来源:Form.php

示例12: _validateEmail

 protected function _validateEmail($value = null)
 {
     if ($value) {
         $validator = new Zend_Validate_EmailAddress();
         $validator->setMessage(Mage::helper('eav')->__('"%s" invalid type entered.', $value), Zend_Validate_EmailAddress::INVALID);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid email address.', $value), Zend_Validate_EmailAddress::INVALID_FORMAT);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid hostname.', $value), Zend_Validate_EmailAddress::INVALID_HOSTNAME);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid hostname.', $value), Zend_Validate_EmailAddress::INVALID_MX_RECORD);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid hostname.', $value), Zend_Validate_EmailAddress::INVALID_MX_RECORD);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid email address.', $value), Zend_Validate_EmailAddress::DOT_ATOM);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid email address.', $value), Zend_Validate_EmailAddress::QUOTED_STRING);
         $validator->setMessage(Mage::helper('eav')->__('"%s" is not a valid email address.', $value), Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
         $validator->setMessage(Mage::helper('eav')->__('"%s" exceeds the allowed length.', $value), Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be an IP address, but IP addresses are not allowed"), Zend_Validate_Hostname::IP_ADDRESS_NOT_ALLOWED);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot match TLD against known list"), Zend_Validate_Hostname::UNKNOWN_TLD);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but contains a dash in an invalid position"), Zend_Validate_Hostname::INVALID_DASH);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'"), Zend_Validate_Hostname::INVALID_HOSTNAME_SCHEMA);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but cannot extract TLD part"), Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' does not appear to be a valid local network name"), Zend_Validate_Hostname::INVALID_LOCAL_NAME);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a local network name but local network names are not allowed"), Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
         $validator->setMessage(Mage::helper('customer')->__("'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded"), Zend_Validate_Hostname::CANNOT_DECODE_PUNYCODE);
         if (!$validator->isValid($value)) {
             return array_unique($validator->getMessages());
         }
     }
     return;
 }
开发者ID:VinuWebtech,项目名称:production267,代码行数:27,代码来源:OnepageController.php

示例13: step2Action

 public function step2Action()
 {
     $this->reloadConfig();
     configureTheme(APPLICATION_THEME, 'install');
     $session = new Zend_Session_Namespace('Install');
     // Create tables
     $xmlSchema = ezcDbSchema::createFromFile('xml', APPLICATION_DIRECTORY . '/data/schema.xml');
     $schema =& $xmlSchema->getSchema();
     if ($this->config->db->prefix != "") {
         $keys = array_keys($schema);
         foreach ($keys as $tableName) {
             $schema[$this->config->db->prefix . $tableName] = clone $schema[$tableName];
             unset($schema[$tableName]);
         }
     }
     $dbconfig = new Zend_Config_Xml(DB_CONFIG_LOCATION, 'zend_db');
     $db = ezcDbFactory::create($dbconfig->connection_string);
     $xmlSchema->writeToDb($db);
     $db = Zend_Registry::get("db");
     $db->delete($this->config->db->prefix . $this->config->dbtables->categories, array("name='General'"));
     $db->insert($this->config->db->prefix . $this->config->dbtables->categories, array('id' => 0, 'name' => 'General', 'link' => 'general', 'orderindex' => 100, 'parent' => 0));
     // Make the form
     $this->adminForm = new Zend_Form();
     $this->adminForm->setAction($this->view->baseUrl . "/install/step2")->setMethod('post')->setLegend('Administrator credentials');
     $notEmpty = new Zend_Validate_NotEmpty();
     $realname = $this->adminForm->createElement('text', 'realname')->setLabel('Your name:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Real name is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $username = $this->adminForm->createElement('text', 'username')->setLabel('Username:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Username is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $password = $this->adminForm->createElement('text', 'password')->setLabel('Password:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Password is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $emailValidator = new Zend_Validate_EmailAddress();
     $email = $this->adminForm->createElement('text', 'email')->setLabel('Email:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[email,required]')->addValidator($notEmpty->setMessage($this->view->translate("Email is mandatory")))->addValidator($emailValidator->setMessage($this->view->translate("Email is invalid")))->setRequired(true);
     $submit = $this->adminForm->createElement('submit', 'save')->setLabel('Save');
     $this->adminForm->addElement($realname)->addElement($username)->addElement($password)->addElement($email)->addElement($submit);
     $dg = $this->adminForm->addDisplayGroup(array('realname', 'username', 'password', 'email', 'save'), 'user');
     if ($this->getRequest()->isPost()) {
         $this->validateAdminUser();
         return;
     }
     $this->view->form = $this->adminForm->render();
 }
开发者ID:valentinbora,项目名称:joobsbox-php,代码行数:42,代码来源:InstallController.php

示例14: overrideEmailAddressValidator

 public static function overrideEmailAddressValidator()
 {
     $validator = new Zend_Validate_EmailAddress();
     $validator->setMessage(_("'%value%' is no valid email address in the basic format local-part@hostname"), Zend_Validate_EmailAddress::INVALID_FORMAT);
     return $validator;
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:6,代码来源:ValidationTypes.php

示例15: init

 public function init()
 {
     $this->setMethod('post');
     $this->setEnctype('multipart/form-data');
     $this->setName('edit_profile_form');
     $this->setAttrib('id', 'edit-profile-form');
     $this->addElementPrefixPath('Oibs_Form_Decorator', 'Oibs/Form/Decorator/', 'decorator');
     $mailvalid = new Zend_Validate_EmailAddress();
     $mailvalid->setMessage('email-invalid', Zend_Validate_EmailAddress::INVALID);
     $mailvalid->setMessage('email-invalid-hostname', Zend_Validate_EmailAddress::INVALID_HOSTNAME);
     $mailvalid->setMessage('email-invalid-mx-record', Zend_Validate_EmailAddress::INVALID_MX_RECORD);
     $mailvalid->setMessage('email-dot-atom', Zend_Validate_EmailAddress::DOT_ATOM);
     $mailvalid->setMessage('email-quoted-string', Zend_Validate_EmailAddress::QUOTED_STRING);
     $mailvalid->setMessage('email-invalid-local-part', Zend_Validate_EmailAddress::INVALID_LOCAL_PART);
     $mailvalid->setMessage('email-length-exceeded', Zend_Validate_EmailAddress::LENGTH_EXCEEDED);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-hostname', Zend_Validate_Hostname::INVALID_HOSTNAME);
     $mailvalid->hostnameValidator->setMessage('hostname-local-name-not-allowed', Zend_Validate_Hostname::LOCAL_NAME_NOT_ALLOWED);
     $mailvalid->hostnameValidator->setMessage('hostname-unknown-tld', Zend_Validate_Hostname::UNKNOWN_TLD);
     $mailvalid->hostnameValidator->setMessage('hostname-invalid-local-name', Zend_Validate_Hostname::INVALID_LOCAL_NAME);
     $mailvalid->hostnameValidator->setMessage('hostname-undecipherable-tld', Zend_Validate_Hostname::UNDECIPHERABLE_TLD);
     // Clear div
     $clear = '<div class="clear"></div>';
     // Headers
     $accountInformation = new Oibs_Form_Element_Note('accountinformation');
     $accountInformation->setValue($clear . '<h3>Account information</h3>' . $clear);
     $personalInformation = new Oibs_Form_Element_Note('personalinformation');
     $personalInformation->setValue('<h3>Personal Information</h3>' . $clear);
     $locationInformation = new Oibs_Form_Element_Note('locationinformation');
     $locationInformation->setValue('<h3>Location Information</h3>' . $clear);
     $employmentInformation = new Oibs_Form_Element_Note('employmentinformation');
     $employmentInformation->setValue('<h3>Employment Information</h3>' . $clear);
     $subscribeInformation = new Oibs_Form_Element_Note('subscribeinformation');
     $subscribeInformation->setValue('<h3>Subscribe settings</h3>' . $clear);
     // Public text
     $publictext = 'Public';
     // Username for description
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $usernametext = $identity->username;
     $username = new Zend_Form_Element_Hidden('username');
     $username->setLabel('Username')->setDescription($usernametext);
     $usernamepublic = new Zend_Form_Element_Hidden('username_publicity');
     $usernamepublic->setLabel($publictext);
     $openid = new Zend_Form_Element_Text('openid');
     $openid->setLabel('Open-ID')->setAttrib('id', 'open-ID')->addValidators(array(new Oibs_Validators_OpenidExists()));
     $openidclear = new Oibs_Form_Element_Note('openidclear');
     $openidclear->setValue($clear);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('New password')->setAttrib('id', 'password')->addValidators(array(new Oibs_Validators_RepeatValidator('confirm_password'), array('NotEmpty', true, array('messages' => array('isEmpty' => 'Empty'))), array('StringLength', false, array(4, 22, 'messages' => array('stringLengthTooShort' => 'Password too short (4-22 characters)', 'stringLengthTooLong' => 'Password too long (4-22 characters)')))));
     $passwordclear = new Oibs_Form_Element_Note('passwordclear');
     $passwordclear->setValue($clear);
     $confirmpassword = new Zend_Form_Element_Password('confirm_password');
     $confirmpassword->setLabel('Confirm password')->setAttrib('id', 'confirm-password')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Empty'))), array('StringLength', false, array(4, 22, 'messages' => array('stringLengthTooShort' => 'Password too short (4-22 characters)', 'stringLengthTooLong' => 'Password too long (4-22 characters)')))));
     $confirmpasswordclear = new Oibs_Form_Element_Note('confirm_passwordclear');
     $confirmpasswordclear->setValue($clear);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setAttrib('id', 'email')->setRequired(true)->addFilter('StringtoLower')->addValidators(array($mailvalid, array('NotEmpty', true, array('messages' => array('isEmpty' => 'Email empty'))), array('StringLength', false, array(6, 50, 'messages' => array('stringLengthTooShort' => 'Email too short (6-50 characters)', 'stringLengthTooLong' => 'Email too long (6-50 characters)')))));
     $emailclear = new Oibs_Form_Element_Note('emailclear');
     $emailclear->setValue($clear);
     $gravatar = new Zend_Form_Element_Hidden('gravatartext');
     $gravatar->setLabel('Gravatar')->setDescription('<div style="text-align: right;">Enable <a href="http://www.gravatar.com">gravatar</a></div>');
     $gravatarcheck = new Zend_Form_Element_Checkbox('gravatar');
     $phone = new Zend_Form_Element_Text('phone');
     $phone->setLabel('Phone')->setAttrib('id', 'phone');
     $phonepublic = new Zend_Form_Element_Checkbox('phone_publicity');
     $phonepublic->setLabel($publictext);
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name')->setAttrib('id', 'first-name');
     $firstnamepublic = new Zend_Form_Element_Checkbox('firstname_publicity');
     $firstnamepublic->setLabel($publictext);
     // DB: surname
     $lastname = new Zend_Form_Element_Text('surname');
     $lastname->setLabel('Last name')->setAttrib('id', 'last-name');
     $lastnamepublic = new Zend_Form_Element_Checkbox('surname_publicity');
     $lastnamepublic->setLabel($publictext);
     $gender = new Zend_Form_Element_Select('gender');
     $gender->setLabel('Gender')->setAttrib('id', 'gender')->addMultiOptions(array('Select', 'Male', 'Female'));
     $genderpublic = new Zend_Form_Element_Checkbox('gender_publicity');
     $genderpublic->setLabel($publictext);
     $birthday = new Zend_Form_Element_Text('birthday');
     $birthday->setLabel('Date of Birth')->setAttrib('id', 'birthday')->setValidators(array(new Zend_Validate_Date('birthday')));
     $birthdaypublic = new Zend_Form_Element_Checkbox('birthday_publicity');
     $birthdaypublic->setLabel($publictext);
     $biography = new Zend_Form_Element_Textarea('biography');
     $biography->setLabel('Biography')->setAttrib('id', 'biography')->setAttrib('rows', 30)->setAttrib('cols', 45)->addValidators(array(array('StringLength', false, array(0, 4000, 'messages' => array('stringLengthTooLong' => 'Biography too long')))));
     //->setDescription('<div id="progressbar_biography" class="progress_ok"></div>');
     $biographypublic = new Zend_Form_Element_Checkbox('biography_publicity');
     $biographypublic->setLabel($publictext);
     $intereststext = new Oibs_Form_Element_Note('intereststext');
     $intereststext->setValue('<div class="input-column1"></div>' . '<div class="input-column2 help">(Use commas to separate tags)</div><div class="clear"></div>');
     $interests = new Zend_Form_Element_Text('interests');
     $interests->setLabel('My interest (tags)')->setAttrib('id', 'interests');
     $interestsclear = new Oibs_Form_Element_Note('interestsclear');
     $interestsclear->setValue($clear);
     $weblinks_websites = new Oibs_Form_Element_Note('weblinks_websites');
     $weblinks_websites->setValue('<div class="input-column-website1"><label><strong>Links to my websites:</strong></label></div>');
     $weblinks_name = new Oibs_Form_Element_Note('weblinks_name');
     $weblinks_name->setValue('<div class="input-column-website2">Name</div>');
     $weblinks_url = new Oibs_Form_Element_Note('weblinks_url');
     $weblinks_url->setValue('<div class="input-column-website3">Url</div><div class="clear"></div>');
//.........这里部分代码省略.........
开发者ID:jannev,项目名称:site,代码行数:101,代码来源:AccountSettingsForm.php


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