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


PHP Zend_Validate_EmailAddress::getMessages方法代码示例

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


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

示例1: testSettingHostnameMessagesThroughEmailValidator

    /**
     * @group ZF-7490
     */
    public function testSettingHostnameMessagesThroughEmailValidator()
    {
        $translations = array(
            'hostnameIpAddressNotAllowed' => 'hostnameIpAddressNotAllowed translation',
            'hostnameUnknownTld' => 'hostnameUnknownTld translation',
            'hostnameDashCharacter' => 'hostnameDashCharacter translation',
            'hostnameInvalidHostnameSchema' => 'hostnameInvalidHostnameSchema translation',
            'hostnameUndecipherableTld' => 'hostnameUndecipherableTld translation',
            'hostnameInvalidHostname' => 'hostnameInvalidHostname translation',
            'hostnameInvalidLocalName' => 'hostnameInvalidLocalName translation',
            'hostnameLocalNameNotAllowed' => 'hostnameLocalNameNotAllowed translation',
        );

        $this->_validator->setMessages($translations);
        $this->_validator->isValid('_XX.!!3xx@0.239,512.777');
        $messages = $this->_validator->getMessages();
        $found = false;
        foreach ($messages as $code => $message) {
            if (array_key_exists($code, $translations)) {
                $this->assertEquals($translations[$code], $message);
                $found = true;
                break;
            }
        }

        $this->assertTrue($found);
    }
开发者ID:htecvc2x,项目名称:htecvc2x-zf-training,代码行数:30,代码来源:EmailAddressTest.php

示例2: 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

示例3: 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 = 'illustratedpdx@gmail.com';
         $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

示例4: _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

示例5: validateAddress

 /**
  * Validates an e-mail address
  *
  * @param   string $address Address
  * @throws  Opus_Mail_Exception Thrown if the e-mail address is not valid
  * @return  string              Address
  */
 public static function validateAddress($address)
 {
     $validator = new Zend_Validate_EmailAddress();
     if ($validator->isValid($address) === false) {
         foreach ($validator->getMessages() as $message) {
             throw new Opus_Mail_Exception($message);
         }
     }
     return $address;
 }
开发者ID:alexukua,项目名称:opus4,代码行数:17,代码来源:SendMail.php

示例6: sendAction

 public function sendAction()
 {
     $form = new Form_MessageUsers();
     $formData = $this->_request->getPost();
     $form->populate($formData);
     if (!$form->isValid($formData)) {
         return $this->_redirectFaultyForm($form);
     }
     $cc = $form->getValue('cc');
     $bccArr = array();
     if (trim($cc) != '') {
         $validator = new Zend_Validate_EmailAddress();
         $bccArr = explode(',', $cc);
         for ($i = 0; $i < count($bccArr); $i++) {
             $bccArr[$i] = trim($bccArr[$i]);
             if (!$validator->isValid($bccArr[$i])) {
                 foreach ($validator->getMessages() as $messageId => $message) {
                     $form->cc->addError($this->view->translate('CC field must be a comma-separated list of valid E-mails'));
                     return $this->_redirectFaultyForm($form);
                 }
             }
         }
     }
     $mail = self::getMail($form->getValue('subject'), $this->_getParam('messageType'), $this->_getParam('messageType') == 'plain' ? $form->getValue('bodyPlain') : $form->getValue('bodyHTML'));
     $mail->setSubject($form->getValue('subject'));
     if ($this->_getParam('messageType') == 'plain') {
         $mail->setBodyText($form->getValue('bodyPlain'));
     } else {
         $mail->setBodyHtml($form->getValue('bodyHTML'));
     }
     $users = new Users_Model_Users();
     // here we get the users emails stored in the users table, even if using LDAP, for performance reasons.
     // Do know however, that a user email is synced with the LDAP repository every time he logs in.
     foreach ($users->getUsers() as $user) {
         if ($user->role == Users_Model_User::ROLE_ADMIN) {
             continue;
         }
         $mail->addBcc($user->email);
     }
     foreach ($bccArr as $bcc) {
         $mail->addBcc($bcc);
     }
     try {
         $mail->send();
         $this->_helper->FlashMessenger->addMessage($this->view->translate('Message has been sent'));
     } catch (Zend_Mail_Protocol_Exception $e) {
         $this->_helper->FlashMessenger->addMessage($this->view->translate('There was an error trying to send the message'));
         if ($this->_config->logging->level == Zend_Log::DEBUG) {
             $this->_helper->FlashMessenger->addMessage($e->getMessage());
             return $this->_redirectFaultyForm($form);
         }
     }
     $this->_redirect('');
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:54,代码来源:MessageusersController.php

示例7: validateEmail

 public function validateEmail($email)
 {
     //Check each post variable for blanks or spaces
     $email_validator = new Zend_Validate_EmailAddress();
     if (!$email_validator->isValid($email)) {
         foreach ($email_validator->getMessages() as $error) {
             array_push($this->messages, $error);
         }
     }
     return $this->messages;
 }
开发者ID:kellancraddock,项目名称:portfolio,代码行数:11,代码来源:Message.php

示例8: _validateEmail

 protected function _validateEmail()
 {
     if ($this->_doctor->getEmail() != '') {
         $val = new Zend_Validate_EmailAddress();
         if ($val->isValid($this->_doctor->getEmail())) {
             return true;
         }
         $msg = Sanmax_MessageStack::getInstance('SxModule_Doctor');
         $msg->addMessage('email', $val->getMessages());
         return false;
     }
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:12,代码来源:BaseValidator.php

示例9: emailAction

 public function emailAction()
 {
     $v = new Zend_Validate_EmailAddress();
     $string = 'chiquitto@gmail.com.unipar';
     if ($v->isValid($string)) {
         echo "{$string} eh email";
     } else {
         echo "{$string} nao eh email";
         $erros = $v->getMessages();
         print_r($erros);
     }
     exit;
 }
开发者ID:JoaoAntonioMaruti,项目名称:AulasUnipar2015,代码行数:13,代码来源:ValidadorController.php

示例10: _validateEmail

 /**
  * Validates email address
  *
  * @return boolean
  */
 protected function _validateEmail()
 {
     $validator = new Zend_Validate_EmailAddress();
     $msg = Sanmax_MessageStack::getInstance('SxCms_User');
     if (!$validator->isValid($this->_user->getEmail())) {
         $msg->addMessage('email', $validator->getMessages());
     }
     $exclude = array('field' => 'user_id', 'value' => (int) $this->_user->getId());
     $validator = new Zend_Validate_Db_NoRecordExists('User', 'email', $exclude);
     if (!$validator->isValid($this->_user->getEmail())) {
         $msg->addMessage('email', $validator->getMessages(), 'common');
     }
     return false == $msg->getMessages('email');
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:19,代码来源:BaseValidator.php

示例11: emailCheck

 public function emailCheck()
 {
     $email = $this->_data['email'];
     if ($this->_db_user->usernameIsExist($email)) {
         $this->addMessage('email', $this->_t->_('This user is exist.'));
     }
     $validator = new Zend_Validate_EmailAddress();
     if (!$validator->isValid($email)) {
         // email is invalid; print the reasons
         foreach ($validator->getMessages() as $message) {
             $this->addMessage('email', $this->_t->_($message));
         }
     }
 }
开发者ID:sandin,项目名称:iMemo,代码行数:14,代码来源:RegisterFormCheck.php

示例12: testGetMessages

 /**
  * Ensures that getMessages() returns expected default value (an empty array)
  *
  * @return void
  */
 public function testGetMessages()
 {
     $this->assertEquals(array(), $this->_validator->getMessages());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:EmailAddressTest.php

示例13: recAction

    function recAction()
    {
        Zend_Loader::loadClass('Zend_Filter_StripTags');
        Zend_Loader::loadClass('Zend_Mail');
        Zend_Loader::loadClass('Zend_Validate_EmailAddress');
        $filter = new Zend_Filter_StripTags();
        $email = trim($filter->filter($this->_request->getPost('rec-email')));
        $warnings = new Zend_Session_Namespace();
        $error_msg = '';
        $mail_val = new Zend_Validate_EmailAddress();
        if ($email == '') {
            $error_msg .= '<p>Enter your email.</p>';
        } else {
            if (!$mail_val->isValid($email)) {
                foreach ($mail_val->getMessages() as $message) {
                    $error_msg .= '<p>' . $message . '</p>';
                }
            }
        }
        $data = new Users();
        $query = 'email = "' . $email . '"';
        $data_row = $data->fetchRow($query);
        if (!count($data_row)) {
            $error_msg .= '<p>Can`t find user with such email.</p>';
        } else {
            $salt = $data_row['salt'];
        }
        if ($error_msg != '') {
            $warnings->error = $error_msg;
            $warnings->status = '';
            $this->_redirect('/register/recovery');
        } else {
            $ranges = array(range('a', 'z'), range('A', 'Z'), range(1, 9));
            $length = 8;
            $pass = '';
            for ($i = 0; $i < $length; $i++) {
                $rkey = array_rand($ranges);
                $vkey = array_rand($ranges[$rkey]);
                $pass .= $ranges[$rkey][$vkey];
            }
            $hash = sha1($pass . $salt);
            $user_update = new Users();
            $where = 'email = "' . $email . '"';
            $dates = array('password' => $hash);
            $user_update->update($dates, $where);
            $mail = new Zend_Mail();
            $url = $this->getRequest()->getServer('HTTP_HOST');
            $mail->setBodyHtml('<p>Your new password.</p>
								<p>Password: ' . $pass . '</p>
								');
            $mail->setFrom('punk1213@yandex.com', 'Administrator');
            $mail->addTo($email, $data_row['login']);
            $mail->setSubject('Test password recovery');
            $mail->send();
            $warnings->error = '<p>Password was sent to ' . $email . '.</p>';
            $warnings->status = ' reg_ok';
            $this->_redirect('/register/recovery');
            return;
        }
    }
开发者ID:epoleacov,项目名称:Zend,代码行数:60,代码来源:RegisterController.php

示例14: 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

示例15: _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


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