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


PHP Zend_Validate_EmailAddress::getHostnameValidator方法代码示例

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


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

示例1: testSetOptions

 /**
  * Testing setOptions
  */
 public function testSetOptions()
 {
     $this->_validator->setOptions(array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'TestMessage')));
     $messages = $this->_validator->getMessageTemplates();
     $this->assertEquals('TestMessage', $messages[Zend_Validate_EmailAddress::INVALID]);
     $oldHostname = $this->_validator->getHostnameValidator();
     $this->_validator->setOptions(array('hostname' => new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL)));
     $hostname = $this->_validator->getHostnameValidator();
     $this->assertNotEquals($oldHostname, $hostname);
 }
开发者ID:netvlies,项目名称:zf,代码行数:13,代码来源:EmailAddressTest.php

示例2: testValidEmailAddresses

 /**
  * SW-8258 - check if email addresses with new domains like .berlin are valid
  */
 public function testValidEmailAddresses()
 {
     $emailAddresses = array('test@example.de', 'test@example.com', 'test@example.org', 'test@example.berlin', 'test@example.email', 'test@example.systems', 'test@example.active', 'test@example.love', 'test@example.video');
     $invalidEmailAddresses = array('test', 'test@example', 'test@.de', '@example', '@example.de', '@.', ' @ .de');
     $validator = new Zend_Validate_EmailAddress();
     $validator->getHostnameValidator()->setValidateTld(false);
     foreach ($emailAddresses as $email) {
         $this->assertTrue($validator->isValid($email));
     }
     foreach ($invalidEmailAddresses as $email) {
         $this->assertFalse($validator->isValid($email));
     }
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:16,代码来源:AccountTest.php

示例3: validateEmails

 public function validateEmails($value)
 {
     // Not string?
     if (!is_string($value) || empty($value)) {
         return false;
     }
     // Validate emails
     $validate = new Zend_Validate_EmailAddress();
     $validate->getHostnameValidator()->setValidateTld(false);
     $emails = array_unique(array_filter(array_map('trim', preg_split("/[\\s,]+/", $value))));
     if (empty($emails)) {
         return false;
     }
     foreach ($emails as $email) {
         if (!$validate->isValid($email)) {
             return false;
         }
     }
     return true;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:20,代码来源:Invite.php

示例4: takenAction

 public function takenAction()
 {
     $username = $this->_getParam('username');
     $email = $this->_getParam('email');
     // Sent both or neither username/email
     if ((bool) $username == (bool) $email) {
         $this->view->status = false;
         $this->view->error = Zend_Registry::get('Zend_Translate')->_('Invalid param count');
         return;
     }
     // Username must be alnum
     if ($username) {
         $validator = new Zend_Validate_Alnum();
         if (!$validator->isValid($username)) {
             $this->view->status = false;
             $this->view->error = Zend_Registry::get('Zend_Translate')->_('Invalid param value');
             //$this->view->errors = $validator->getErrors();
             return;
         }
         $table = Engine_Api::_()->getItemTable('user');
         $row = $table->fetchRow($table->select()->where('username = ?', $username)->limit(1));
         $this->view->status = true;
         $this->view->taken = $row !== null;
         return;
     }
     if ($email) {
         $validator = new Zend_Validate_EmailAddress();
         $validator->getHostnameValidator()->setValidateTld(false);
         if (!$validator->isValid($email)) {
             $this->view->status = false;
             $this->view->error = Zend_Registry::get('Zend_Translate')->_('Invalid param value');
             //$this->view->errors = $validator->getErrors();
             return;
         }
         $table = Engine_Api::_()->getItemTable('user');
         $row = $table->fetchRow($table->select()->where('email = ?', $email)->limit(1));
         $this->view->status = true;
         $this->view->taken = $row !== null;
         return;
     }
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:41,代码来源:SignupController.php

示例5: importNewsletter

 /**
  * @param $filePath
  */
 public function importNewsletter($filePath)
 {
     $results = new Shopware_Components_CsvIterator($filePath, ';');
     $insertCount = 0;
     $updateCount = 0;
     $errors = array();
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->getHostnameValidator()->setValidateTld(false);
     foreach ($results as $newsletterData) {
         if (empty($newsletterData['email'])) {
             $errors[] = "Empty email field";
             continue;
         }
         if (!$emailValidator->isValid($newsletterData['email'])) {
             $errors[] = "Invalid email address: " . $newsletterData['email'];
             continue;
         }
         // Set newsletter recipient/group
         $group = null;
         if ($newsletterData['group']) {
             $group = $this->getGroupRepository()->findOneByName($newsletterData['group']);
         }
         if (!$group && $newsletterData['group']) {
             $group = new Group();
             $group->setName($newsletterData['group']);
             $this->getManager()->persist($group);
         } elseif (!$group && ($groupId = Shopware()->Config()->get("sNEWSLETTERDEFAULTGROUP"))) {
             $group = $this->getGroupRepository()->findOneBy($groupId);
         } elseif (!$group) {
             // If no group is specified and no default config exists, don't import the address
             // This should never actually happen, as a default should always exist
             // but its better to be safe than sorry
             continue;
         }
         //Create/Update the Address entry
         $recipient = $this->getAddressRepository()->findOneByEmail($newsletterData['email']) ?: new Address();
         if ($recipient->getId()) {
             $updateCount++;
         } else {
             $insertCount++;
         }
         $recipient->setEmail($newsletterData['email']);
         $recipient->setIsCustomer(!empty($newsletterData['userID']));
         //Only set the group if it was explicitly provided or it's a new entry
         if ($group && ($newsletterData['group'] || !$recipient->getId())) {
             $recipient->setNewsletterGroup($group);
         }
         $this->getManager()->persist($recipient);
         $this->getManager()->flush();
         //Create/Update the ContactData entry
         $contactData = $this->getContactDataRepository()->findOneByEmail($newsletterData['email']) ?: new ContactData();
         //sanitize to avoid setting fields the user's not supposed to access
         unset($newsletterData['added']);
         unset($newsletterData['deleted']);
         $contactData->fromArray($newsletterData);
         //Only set the group if it was explicitly provided or it's a new entry
         if ($group && ($newsletterData['group'] || !$contactData->getId())) {
             $contactData->setGroupId($group->getId());
         }
         $contactData->setAdded(new \DateTime());
         $this->getManager()->persist($contactData);
         $this->getManager()->flush();
     }
     if (!empty($errors)) {
         $message = implode("<br>\n", $errors);
         echo json_encode(array('success' => false, 'message' => sprintf("Errors: {$message}")));
         return;
     }
     echo json_encode(array('success' => true, 'message' => sprintf("Imported: %s. Updated: %s.", $insertCount, $updateCount)));
     return;
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:74,代码来源:ImportExport.php

示例6: ajaxValidateEmailAction

 /**
  * Checks if the given email isn't already registered
  */
 public function ajaxValidateEmailAction()
 {
     $error_flags = array();
     $error_messages = array();
     $validator = new Zend_Validate_EmailAddress();
     $validator->getHostnameValidator()->setValidateTld(false);
     if (empty($this->post['personal']['email'])) {
     } elseif (!$validator->isValid($this->post['personal']['email'])) {
         $error_messages[] = Shopware()->Snippets()->getNamespace("frontend")->get('RegisterAjaxEmailNotValid', 'Please enter a valid mail address.', true);
         $error_flags['email'] = true;
         if (!empty($this->post['personal']['emailConfirmation'])) {
             $error_flags['emailConfirmation'] = true;
         }
     } elseif (empty($this->post['personal']['skipLogin']) && $this->admin->sGetUserByMail($this->post['personal']['email'])) {
         $error_messages[] = Shopware()->Snippets()->getNamespace("frontend")->get('RegisterAjaxEmailForgiven', 'This mail address is already in use.', true);
         $error_flags['email'] = true;
         if (!empty($this->post['personal']['emailConfirmation'])) {
             $error_flags['emailConfirmation'] = true;
         }
     } elseif (empty($this->post['personal']['emailConfirmation'])) {
         $error_flags['email'] = false;
     } elseif ($this->post['personal']['emailConfirmation'] != $this->post['personal']['email']) {
         $error_messages[] = Shopware()->Snippets()->getNamespace("frontend")->get('RegisterAjaxEmailNotEqual', 'The mail addresses you have entered are not equal.', true);
         $error_flags['email'] = true;
         $error_flags['emailConfirmation'] = true;
     } else {
         $error_flags['email'] = false;
         $error_flags['emailConfirmation'] = false;
     }
     foreach ($error_messages as $key => $error_message) {
         $error_messages[$key] = $this->View()->fetch('string:' . $error_message);
     }
     echo Zend_Json::encode(array('success' => empty($error_messages), 'error_flags' => $error_flags, 'error_messages' => $error_messages));
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:37,代码来源:Register.php

示例7: testNotSetHostnameValidator

 /**
  * @group ZF-11239
  */
 public function testNotSetHostnameValidator()
 {
     $hostname = $this->_validator->getHostnameValidator();
     $this->assertTrue($hostname instanceof Zend_Validate_Hostname);
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:8,代码来源:EmailAddressTest.php

示例8: onNotifyAction

 /**
  * Called on register for status updates
  * Check user email address and send double optin to confirm the email
  * @static
  * @param Enlight_Event_EventArgs $args
  * @return
  */
 public static function onNotifyAction(Enlight_Event_EventArgs $args)
 {
     $args->setProcessed(true);
     $action = $args->getSubject();
     $id = (int) $action->Request()->sArticle;
     $email = $action->Request()->sNotificationEmail;
     $sError = false;
     $action->View()->NotifyEmailError = false;
     $notifyOrderNumber = $action->Request()->notifyOrdernumber;
     if (!empty($notifyOrderNumber)) {
         $validator = new Zend_Validate_EmailAddress();
         $validator->getHostnameValidator()->setValidateTld(false);
         if (empty($email) || !$validator->isValid($email)) {
             $sError = true;
             $action->View()->NotifyEmailError = true;
         } elseif (!empty($notifyOrderNumber)) {
             if (!empty(Shopware()->Session()->sNotificatedArticles)) {
                 if (in_array($notifyOrderNumber, Shopware()->Session()->sNotificatedArticles)) {
                     $sError = true;
                     $action->View()->ShowNotification = false;
                     $action->View()->NotifyAlreadyRegistered = true;
                 } else {
                     Shopware()->Session()->sNotificatedArticles[] = $notifyOrderNumber;
                 }
             } else {
                 Shopware()->Session()->sNotificatedArticles = array($notifyOrderNumber);
             }
         } else {
             $sError = true;
         }
         if (!$sError) {
             $AlreadyNotified = Shopware()->Db()->fetchRow('
                 SELECT *  FROM `s_articles_notification`
                 WHERE `ordernumber`=?
                 AND `mail` = ?
                 AND send = 0
             ', array($notifyOrderNumber, $email));
             if (empty($AlreadyNotified)) {
                 $action->View()->NotifyAlreadyRegistered = false;
                 $hash = md5(uniqid(rand()));
                 $link = $action->Front()->Router()->assemble(array('sViewport' => 'detail', 'sArticle' => $id, 'sNotificationConfirmation' => $hash, 'sNotify' => '1', 'action' => 'notifyConfirm'));
                 $name = Shopware()->Modules()->Articles()->sGetArticleNameByOrderNumber($notifyOrderNumber);
                 $basePath = $action->Front()->Router()->assemble(array('sViewport' => 'index'));
                 Shopware()->System()->_POST['sLanguage'] = Shopware()->System()->sLanguageData[Shopware()->System()->sLanguage]['isocode'];
                 Shopware()->System()->_POST['sShopPath'] = $basePath . Shopware()->Config()->sBASEFILE;
                 $sql = '
                     INSERT INTO s_core_optin (datum, hash, data)
                     VALUES (NOW(), ?, ?)
                 ';
                 Shopware()->Db()->query($sql, array($hash, serialize(Shopware()->System()->_POST->toArray())));
                 $context = array('sConfirmLink' => $link, 'sArticleName' => $name);
                 $mail = Shopware()->TemplateMail()->createMail('sACCEPTNOTIFICATION', $context);
                 $mail->addTo($email);
                 $mail->send();
                 Shopware()->Session()->sNotifcationArticleWaitingForOptInApprovement[$notifyOrderNumber] = true;
             } else {
                 $action->View()->NotifyAlreadyRegistered = true;
             }
         }
     }
     return $action->forward('index');
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:69,代码来源:Bootstrap.php

示例9: isEmailValid

 /**
  * Determine if an email is valid (does not validate TLDs).
  *
  * @param string $email
  *
  * @return bool
  */
 public static function isEmailValid($email)
 {
     $validator = new Zend_Validate_EmailAddress();
     $validator->getHostnameValidator()->setValidateTld(false)->setValidateIdn(false);
     return $validator->isValid($email);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:13,代码来源:Email.php

示例10: indexAction

 public function indexAction()
 {
     if (empty($this->Request()->sDetails)) {
         $id = $this->Request()->sArticle;
     } else {
         $id = $this->Request()->sDetails;
     }
     if (empty($id)) {
         return $this->forward("index", "index");
     }
     // Get Article-Information
     $sArticle = Shopware()->Modules()->Articles()->sGetPromotionById('fix', 0, intval($id));
     if (empty($sArticle["articleName"])) {
         return $this->forward("index", "index");
     }
     if ($this->Request()->getPost("sMailTo")) {
         $variables["sError"] = false;
         if (!$this->Request()->getPost("sName")) {
             $variables["sError"] = true;
         }
         if (!$this->Request()->getPost("sMail")) {
             $variables["sError"] = true;
         }
         if (!$this->Request()->getPost("sRecipient")) {
             $variables["sError"] = true;
         }
         if (preg_match("/;/", $this->Request()->getPost("sRecipient")) || strlen($this->Request()->getPost("sRecipient") >= 50)) {
             $variables["sError"] = true;
         }
         $validator = new Zend_Validate_EmailAddress();
         $validator->getHostnameValidator()->setValidateTld(false);
         if (!$validator->isValid($this->Request()->getPost("sRecipient"))) {
             $variables["sError"] = true;
         }
         if (!empty(Shopware()->Config()->CaptchaColor)) {
             $captcha = str_replace(' ', '', strtolower($this->Request()->sCaptcha));
             $rand = $this->Request()->getPost('sRand');
             if (empty($rand) || $captcha != substr(md5($rand), 0, 5)) {
                 $variables["sError"] = true;
             }
         }
         if ($variables["sError"] == false) {
             // Prepare eMail
             $sArticle["linkDetails"] = $this->Front()->Router()->assemble(array('sViewport' => 'detail', 'sArticle' => $sArticle["articleID"]));
             $context = array('sName' => $this->sSYSTEM->_POST["sName"], 'sArticle' => html_entity_decode($sArticle["articleName"]), 'sLink' => $sArticle["linkDetails"]);
             if ($this->sSYSTEM->_POST["sComment"]) {
                 $context['sComment'] = strip_tags(html_entity_decode($this->sSYSTEM->_POST["sComment"]));
             } else {
                 $context['sComment'] = '';
             }
             $mail = Shopware()->TemplateMail()->createMail('sTELLAFRIEND', $context, null, array("fromMail" => $this->sSYSTEM->_POST["sMail"], "fromName" => $this->sSYSTEM->_POST["sName"]));
             $mail->addTo($this->sSYSTEM->_POST["sRecipient"]);
             $mail->send();
             $this->View()->sSuccess = true;
             $url = $this->Front()->Router()->assemble(array('controller' => 'tellafriend', 'action' => 'success'));
             $this->redirect($url);
         } else {
             $this->View()->sError = true;
             $this->View()->sName = $this->Request()->getPost("sName");
             $this->View()->sMail = $this->Request()->getPost("sMail");
             $this->View()->sRecipient = $this->Request()->getPost("sRecipient");
             $this->View()->sComment = $this->Request()->getPost("sComment");
         }
     }
     $this->View()->rand = md5(uniqid(rand()));
     $this->View()->sArticle = $sArticle;
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:67,代码来源:Tellafriend.php

示例11: ratingAction

 /**
  * Rating action method
  *
  * Save and review the product rating
  */
 public function ratingAction()
 {
     $id = (int) $this->Request()->sArticle;
     if (empty($id)) {
         return $this->forward('error');
     }
     $article = Shopware()->Modules()->Articles()->sGetArticleNameByArticleId($id);
     if (empty($article)) {
         return $this->forward('error');
     }
     $voteConfirmed = false;
     if ($hash = $this->Request()->sConfirmation) {
         $getVote = Shopware()->Db()->fetchRow('
             SELECT * FROM s_core_optin WHERE hash = ?
         ', array($hash));
         if (!empty($getVote['data'])) {
             Shopware()->System()->_POST = unserialize($getVote['data']);
             $voteConfirmed = true;
             Shopware()->Db()->query('DELETE FROM s_core_optin WHERE hash = ?', array($hash));
         }
     }
     if (empty(Shopware()->System()->_POST['sVoteName'])) {
         $sErrorFlag['sVoteName'] = true;
     }
     if (empty(Shopware()->System()->_POST['sVoteSummary'])) {
         $sErrorFlag['sVoteSummary'] = true;
     }
     if (!empty(Shopware()->Config()->CaptchaColor) && !$voteConfirmed) {
         $captcha = str_replace(' ', '', strtolower($this->Request()->sCaptcha));
         $rand = $this->Request()->getPost('sRand');
         if (empty($rand) || $captcha != substr(md5($rand), 0, 5)) {
             $sErrorFlag['sCaptcha'] = true;
         }
     }
     $validator = new Zend_Validate_EmailAddress();
     $validator->getHostnameValidator()->setValidateTld(false);
     if (!empty(Shopware()->Config()->sOPTINVOTE) && (empty(Shopware()->System()->_POST['sVoteMail']) || !$validator->isValid(Shopware()->System()->_POST['sVoteMail']))) {
         $sErrorFlag['sVoteMail'] = true;
     }
     if (empty($sErrorFlag)) {
         if (!empty(Shopware()->Config()->sOPTINVOTE) && !$voteConfirmed && empty(Shopware()->Session()->sUserId)) {
             $hash = md5(uniqid(rand()));
             $sql = '
                 INSERT INTO s_core_optin (datum, hash, data)
                 VALUES (NOW(), ?, ?)
             ';
             Shopware()->Db()->query($sql, array($hash, serialize(Shopware()->System()->_POST->toArray())));
             $link = $this->Front()->Router()->assemble(array('sViewport' => 'detail', 'action' => 'rating', 'sArticle' => $id, 'sConfirmation' => $hash));
             $context = array('sConfirmLink' => $link, 'sArticle' => array('articleName' => $article));
             $mail = Shopware()->TemplateMail()->createMail('sOPTINVOTE', $context);
             $mail->addTo($this->Request()->getParam('sVoteMail'));
             $mail->Send();
         } else {
             unset(Shopware()->Config()->sOPTINVOTE);
             Shopware()->Modules()->Articles()->sSaveComment($id);
         }
     } else {
         $this->View()->sFormData = Shopware()->System()->_POST->toArray();
         $this->View()->sErrorFlag = $sErrorFlag;
     }
     $this->View()->sAction = 'ratingAction';
     $this->forward('index');
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:68,代码来源:Detail.php

示例12: ratingAction

 /**
  * Rating action method
  *
  * Save and review the blog comment and rating
  */
 public function ratingAction()
 {
     $blogArticleId = intval($this->Request()->blogArticle);
     if (!empty($blogArticleId)) {
         $blogArticleQuery = $this->getRepository()->getDetailQuery($blogArticleId);
         $blogArticleData = $blogArticleQuery->getOneOrNullResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);
         if ($hash = $this->Request()->sConfirmation) {
             //customer confirmed the link in the mail
             $commentConfirmQuery = $this->getCommentConfirmRepository()->getConfirmationByHashQuery($hash);
             $getComment = $commentConfirmQuery->getOneOrNullResult();
             if ($getComment) {
                 $commentData = unserialize($getComment->getData());
                 //delete the data in the comment confirm table we don't need it anymore
                 Shopware()->Models()->remove($getComment);
                 Shopware()->Models()->flush();
                 $this->sSaveComment($commentData, $blogArticleId);
                 $this->View()->sAction = $this->Request()->getActionName();
                 return $this->forward('detail');
             }
         }
         //validation
         if (empty($this->Request()->name)) {
             $sErrorFlag['name'] = true;
         }
         if (empty($this->Request()->headline)) {
             $sErrorFlag['headline'] = true;
         }
         if (empty($this->Request()->comment)) {
             $sErrorFlag['comment'] = true;
         }
         if (!empty(Shopware()->Config()->CaptchaColor)) {
             $captcha = str_replace(' ', '', strtolower($this->Request()->sCaptcha));
             $rand = $this->Request()->getPost('sRand');
             if (empty($rand) || $captcha != substr(md5($rand), 0, 5)) {
                 $sErrorFlag['sCaptcha'] = true;
             }
         }
         $validator = new Zend_Validate_EmailAddress();
         $validator->getHostnameValidator()->setValidateTld(false);
         if (!empty(Shopware()->Config()->sOPTINVOTE) && (empty($this->Request()->eMail) || !$validator->isValid($this->Request()->eMail))) {
             $sErrorFlag['eMail'] = true;
         }
         if (empty($sErrorFlag)) {
             if (!empty(Shopware()->Config()->sOPTINVOTE) && empty(Shopware()->Session()->sUserId)) {
                 $hash = md5(uniqid(rand()));
                 //save comment confirm for the optin
                 $blogCommentModel = new \Shopware\Models\CommentConfirm\CommentConfirm();
                 $blogCommentModel->setCreationDate(new DateTime("now"));
                 $blogCommentModel->setHash($hash);
                 $blogCommentModel->setData(serialize($this->Request()->getPost()));
                 Shopware()->Models()->persist($blogCommentModel);
                 Shopware()->Models()->flush();
                 $link = $this->Front()->Router()->assemble(array('sViewport' => 'blog', 'action' => 'rating', 'blogArticle' => $blogArticleId, 'sConfirmation' => $hash));
                 $context = array('sConfirmLink' => $link, 'sArticle' => array('title' => $blogArticleData["title"]));
                 $mail = Shopware()->TemplateMail()->createMail('sOPTINVOTE', $context);
                 $mail->addTo($this->Request()->getParam('eMail'));
                 $mail->Send();
             } else {
                 //save comment
                 $commentData = $this->Request()->getPost();
                 $this->sSaveComment($commentData, $blogArticleId);
             }
             $this->View()->sAction = $this->Request()->getActionName();
         } else {
             $this->View()->sFormData = Shopware()->System()->_POST->toArray();
             $this->View()->sErrorFlag = $sErrorFlag;
         }
     }
     $this->forward('detail');
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:75,代码来源:Blog.php

示例13: validateStep1Email

 /**
  * Private helper method for sValidateStep1
  * Validates email data
  *
  * @param $edit
  * @param $postData
  * @param $sErrorMessages
  * @param $sErrorFlag
  * @return array Error data
  */
 private function validateStep1Email($edit, &$postData, &$sErrorMessages, &$sErrorFlag)
 {
     // Email is present in post data
     if (isset($postData["emailConfirmation"]) || isset($postData["email"])) {
         $postData["email"] = strtolower(trim($postData["email"]));
         $validator = new Zend_Validate_EmailAddress();
         $validator->getHostnameValidator()->setValidateTld(false);
         if (empty($postData["email"]) || !$validator->isValid($postData["email"])) {
             $sErrorFlag["email"] = true;
             $sErrorMessages[] = $this->snippetManager->getNamespace('frontend/account/internalMessages')->get('MailFailure', 'Please enter a valid mail address');
         }
         // Check email confirmation if needed
         if (isset($postData["emailConfirmation"])) {
             $postData["emailConfirmation"] = strtolower(trim($postData["emailConfirmation"]));
             if ($postData["email"] != $postData["emailConfirmation"]) {
                 $sErrorFlag["emailConfirmation"] = true;
                 $sErrorMessages[] = $this->snippetManager->getNamespace('frontend/account/internalMessages')->get('MailFailureNotEqual', 'The mail addresses entered are not equal');
             }
         }
     } elseif ($edit && empty($postData["email"])) {
         $userEmail = $this->session->offsetGet('sUserMail');
         if ($userEmail) {
             $this->front->Request()->setPost('email', $userEmail);
         }
         $postData["email"] = $userEmail;
     }
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:37,代码来源:sAdmin.php


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