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


PHP Validation::email方法代码示例

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


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

示例1: individualMail

 public function individualMail($section, $arr = array())
 {
     $this->autoRender = false;
     $contents = $this->Mail->findBySection($section);
     $content = $contents['Mail']['content'];
     foreach ($arr as $key => $val) {
         $content = str_replace("~~{$key}~~", $val, $content);
     }
     if (!empty($arr['TO_EMAIL']) && Validation::email($arr['TO_EMAIL'], true)) {
         $email = new CakeEmail();
         $email->template('default');
         $email->config('default');
         $email->emailFormat('html')->to($arr['TO_EMAIL'])->subject($contents['Mail']['subject']);
         try {
             if ($email->send($content)) {
                 return;
             } else {
                 return;
             }
         } catch (Exception $e) {
             return;
         }
     }
     return;
 }
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:25,代码来源:MailController.php

示例2: validateEmailFormat

 function validateEmailFormat($check)
 {
     if (empty($check['email'])) {
         return true;
     }
     return Validation::email($check['email']);
 }
开发者ID:adityar003,项目名称:Cake-Resume-Builder,代码行数:7,代码来源:resume_reference.php

示例3: answerFileValidation

 /**
  * answerValidation 登録内容の正当性
  *
  * @param object &$model use model
  * @param array $data Validation対象データ
  * @param array $question 登録データに対応する項目
  * @param array $allAnswers 入力された登録すべて
  * @return bool
  */
 public function answerFileValidation(&$model, $data, $question, $allAnswers)
 {
     if ($question['question_type'] != $this->_myType) {
         return true;
     }
     return Validation::email($data['answer_value']);
 }
开发者ID:NetCommons3,项目名称:Registrations,代码行数:16,代码来源:RegistrationAnswerFileBehavior.php

示例4: register

 function register()
 {
     global $timezones;
     $this->pageTitle = __('register', true);
     $this->set('tzs', $timezones);
     $this->set('utz', $this->data['User']['tz']);
     if (!empty($this->data)) {
         $this->Security->requirePost('register');
         $v = new Validation();
         if ($this->data['User']['email'] !== $this->data['User']['confemail']) {
             $this->User->invalidate('confemail');
         }
         if ($this->User->findByEmail($this->data['User']['email']) || !$v->email($this->data['User']['email'])) {
             $this->User->invalidate('email');
         }
         if ($this->data['User']['password'] !== $this->data['User']['confpass']) {
             $this->User->invalidate('confpass');
         }
         if (!$v->url($this->data['User']['website']) && !empty($this->data['User']['website'])) {
             $this->User->invalidate('website');
         }
         if ($this->User->validates()) {
             $clean = new Sanitize();
             // Generate and set the password, salt and activation key
             $pass = $this->Hash->password($this->data['User']['password'], $this->data['User']['email']);
             $this->data['User']['active'] = $this->Hash->keygen(10, true);
             $this->data['User']['password'] = $pass['pass'];
             $this->data['User']['salt'] = $pass['salt'];
             // Save a few fields from the wrath of cleanArray()
             $temp = array('lat' => $this->data['User']['lat'], 'lng' => $this->data['User']['lng'], 'tz' => $this->data['User']['tz'], 'email' => $this->data['User']['email']);
             // Scrub 'a dub
             $clean->clean($this->data);
             $this->data['User']['email'] = $clean->escape($temp['email']);
             $this->data['User']['lng'] = floatval($temp['lng']);
             $this->data['User']['lat'] = floatval($temp['lat']);
             $this->data['User']['tz'] = intval($temp['tz']);
             $this->data['User']['role'] = 0;
             $this->User->begin();
             if ($this->User->save($this->data)) {
                 $this->Email->to = $this->data['User']['email'];
                 $this->Email->replyTo = $this->data['User']['email'];
                 $this->Email->from = APP_NAME . ' <' . APP_EMAIL . '>';
                 $this->Email->subject = sprintf(__('email_subject_welcome', true), APP_NAME);
                 $this->Email->template = 'register';
                 $this->Email->sendAs = 'both';
                 $this->set('actcode', $this->data['User']['active']);
                 if ($this->Email->send()) {
                     $this->User->commit();
                     $this->Session->setFlash('Account created!');
                 } else {
                     $this->User->rollback();
                     $this->Session->setFlash('Error!');
                 }
             } else {
                 $this->User->rollback();
                 $this->Session->setFlash('Error\'d');
             }
         }
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:60,代码来源:users_controller.php

示例5: startup

 public function startup(Controller $Controller)
 {
     $this->Controller = $Controller;
     if (extension_loaded('mbstring')) {
         switch (Configure::read('Config.language')) {
             case 'jpn':
                 $lang = "ja";
                 break;
             case 'eng':
                 $lang = "en";
                 break;
             default:
                 $lang = "uni";
         }
         mb_language($lang);
         mb_internal_encoding("UTF-8");
     }
     //tmp crash fix
     $email = "candycane@example.com";
     if (Validation::email($this->Controller->Setting->mail_from)) {
         $email = $this->Controller->Setting->mail_from;
     }
     $this->Email = new CakeEmail(array('transport' => $this->Controller->Setting->mail_transport, 'from' => $email, 'host' => $this->Controller->Setting->mail_host, 'port' => $this->Controller->Setting->mail_port, 'username' => $this->Controller->Setting->mail_username, 'password' => $this->Controller->Setting->mail_password));
     $this->Email->viewVars(array('footer' => $this->Controller->Setting->emails_footer));
     if ($this->Controller->Setting->plain_text_mail) {
         $this->Email->emailFormat('text');
     } else {
         $this->Email->emailFormat('both');
     }
 }
开发者ID:gildonei,项目名称:candycane,代码行数:30,代码来源:MailerComponent.php

示例6: create_user

 public function create_user($username, $password, $email, $phone, $bdate, $information, $interests, $city, $image)
 {
     $user = new User();
     try {
         $user->set_username(Validation::username($username));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_password(Validation::password($password));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_email(Validation::email($email));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_phone(Validation::phone($phone));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_bdate(Validation::bdate($bdate));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_information(Validation::information($information));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_interests(Validation::interests($interests));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_city(Validation::city($city));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     try {
         $user->set_image(Validation::image($image));
     } catch (Exception $ex) {
         echo 'Failed: ', $ex->getMessage();
         exit;
     }
     return $user;
 }
开发者ID:RuseHackV2,项目名称:LifePlus,代码行数:59,代码来源:register.php

示例7: secretEmail

 /**
  * Takes an email and hides the identity. If the string is not an email address
  * it will be returned as-is
  *
  * @param string $email
  */
 public function secretEmail($email = '')
 {
     if (Validation::email($email)) {
         $emailSplit = explode('@', $email);
         $identity = $emailSplit[0][0] . '.....' . $emailSplit[0][strlen($emailSplit[0]) - 1];
         return $identity . '@' . $emailSplit[1];
     }
     return $email;
 }
开发者ID:styfle,项目名称:core,代码行数:15,代码来源:formatting.php

示例8: answerEmailValidation

 /**
  * answerValidation 登録内容の正当性
  *
  * @param object &$model use model
  * @param array $data Validation対象データ
  * @param array $question 登録データに対応する項目
  * @param array $allAnswers 入力された登録すべて
  * @return bool
  */
 public function answerEmailValidation(&$model, $data, $question, $allAnswers)
 {
     if ($question['question_type'] != $this->_myType) {
         return true;
     }
     if ($question['is_require'] === true || $data['answer_value']) {
         return Validation::email($data['answer_value']);
     }
     return true;
 }
开发者ID:NetCommons3,项目名称:Registrations,代码行数:19,代码来源:RegistrationAnswerEmailBehavior.php

示例9: multiEmail

 public function multiEmail($check)
 {
     $email_list = preg_split("/[\\s,]+/", $check['contact_email']);
     $V = new Validation();
     foreach ($email_list as $email) {
         if (!$V->email(trim($email))) {
             return false;
         }
     }
     return true;
 }
开发者ID:evelynmitchell,项目名称:conference-list,代码行数:11,代码来源:Conference.php

示例10: email

 /**
  * Resets all emails - e.g. to your admin email (for local development).
  *
  * @return void
  */
 public function email()
 {
     $this->out('Email:');
     App::uses('Validation', 'Utility');
     while (empty($email) || !Validation::email($email)) {
         $email = $this->in(__('New email address (must have a valid form at least)'));
     }
     $this->User = ClassRegistry::init(CLASS_USER);
     if (!$this->User->hasField('email')) {
         return $this->error(CLASS_USER . ' model doesnt have an email field!');
     }
     $this->hr();
     $this->out('resetting...');
     Configure::write('debug', 2);
     $this->User->recursive = -1;
     $this->User->updateAll(array('User.email' => '\'' . $email . '\''), array('User.email !=' => $email));
     $count = $this->User->getAffectedRows();
     $this->out($count . ' emails resetted - DONE');
 }
开发者ID:Jony01,项目名称:LLD,代码行数:24,代码来源:ResetShell.php

示例11: update

 public function update()
 {
     if (Login::get_instance()->check_login() == 'valid') {
         if ($_POST) {
             $errors = array();
             $user_info = array();
             $user_data = Register::get_instance()->get_current_user();
             $user_info['id'] = $user_data['id'];
             $user_info['username'] = addslashes($_POST['username']);
             $user_info['email'] = addslashes($_POST['email']);
             $user_info['phone'] = '1' . $_POST['phone'];
             if (!empty($_POST['new_pass'])) {
                 $user_info['password'] = md5($_POST['new_pass']);
             }
             if ($user_data['password'] != md5($_POST['old_pass'])) {
                 $errors[] = 'كلمة المرور خاطئة';
             }
             if (md5($_POST['new_pass']) != md5($_POST['new_pass_confirm'])) {
                 $errors[] = 'خطأ فى تأكيد كلمة المرور';
             }
             if (!is_numeric($_POST['phone'])) {
                 $errors[] = 'رقم الهاتف غير صحيح';
             }
             if (!Validation::email($_POST['email'])) {
                 $errors[] = 'البريد الاكترونى غير صحيح';
             }
             if (!empty($_POST['username']) && is_numeric($_POST['username'])) {
                 $errors[] = 'اسم المستخدم يتكون من حروف فقط';
             }
             a:
             if (empty($errors)) {
                 Operations::get_instance()->init($user_info, 'users', 'update');
                 $this->img_upload();
                 if (isset($user_info['password'])) {
                     $_SESSION['user_info']['password'] = $user_info['password'];
                 }
                 echo json_encode(array('operation' => 1));
             } else {
                 echo json_encode(array('operation' => 2, 'errors' => $errors));
             }
         }
     }
 }
开发者ID:abdouh,项目名称:pets,代码行数:43,代码来源:userController.php

示例12: email

 /**
  * email method
  *
  * @param string $entrytypeLabel
  * @param string $id
  * @return void
  */
 public function email($id = null)
 {
     App::uses('Validation', 'Utility');
     $this->layout = false;
     /* GET access not allowed */
     if ($this->request->is('get')) {
         $data = array('status' => 'error', 'msg' => __d('webzash', 'Method not allowed.'));
         $this->set('data', $data);
         return;
     }
     /* Check if valid id */
     if (empty($id)) {
         $data = array('status' => 'error', 'msg' => __d('webzash', 'Entry not specified.'));
         $this->set('data', $data);
         return;
     }
     /* Check if entry exists */
     $entry = $this->Entry->findById($id);
     if (!$entry) {
         $data = array('status' => 'error', 'msg' => __d('webzash', 'Entry not found.'));
         $this->set('data', $data);
         return;
     }
     /* On POST */
     if ($this->request->is('post') || $this->request->is('put')) {
         if (!empty($this->request->data)) {
             if (!Validation::email($this->request->data['email'])) {
                 $data = array('status' => 'error', 'msg' => __d('webzash', 'Invalid email specified.'));
                 $this->set('data', $data);
                 return;
             }
             /* Get entry type */
             $entrytype = $this->Entrytype->findById($entry['Entry']['entrytype_id']);
             if (!$entrytype) {
                 $data = array('status' => 'error', 'msg' => __d('webzash', 'Invalid entry type.'));
                 $this->set('data', $data);
                 return;
             }
             /* Get entry items */
             $entryitems = array();
             $rawentryitems = $this->Entryitem->find('all', array('conditions' => array('Entryitem.entry_id' => $id)));
             foreach ($rawentryitems as $row => $entryitem) {
                 if ($entryitem['Entryitem']['dc'] == 'D') {
                     $entryitems[$row] = array('dc' => 'D', 'ledger_id' => $entryitem['Entryitem']['ledger_id'], 'ledger_name' => $this->Ledger->getName($entryitem['Entryitem']['ledger_id']), 'dr_amount' => toCurrency('D', $entryitem['Entryitem']['amount']), 'cr_amount' => '');
                 } else {
                     $entryitems[$row] = array('dc' => 'C', 'ledger_id' => $entryitem['Entryitem']['ledger_id'], 'ledger_name' => $this->Ledger->getName($entryitem['Entryitem']['ledger_id']), 'dr_amount' => '', 'cr_amount' => toCurrency('C', $entryitem['Entryitem']['amount']));
                 }
             }
             /* Sending email */
             $viewVars = array('entry' => $entry, 'entryitems' => $entryitems, 'entrytype' => $entrytype);
             $email_status = $this->Generic->sendEmail($this->request->data['email'], h($entrytype['Entrytype']['name']) . ' Number ' . $this->getEntryNumber($entry['Entry']['number'], $entry['Entry']['entrytype_id']), 'entry_email', $viewVars, Configure::read('Account.email_use_default'), false);
             if ($email_status) {
                 $data = array('status' => 'success', 'msg' => __d('webzash', 'Email sent.'));
             } else {
                 $data = array('status' => 'error', 'msg' => __d('webzash', 'Failed to send email. Please check your email settings.'));
             }
             $this->set('data', $data);
             return;
         } else {
             $data = array('status' => 'error', 'msg' => __d('webzash', 'No data. Please, try again.'));
             $this->set('data', $data);
             return;
         }
     }
     return;
 }
开发者ID:lognaume,项目名称:webzash,代码行数:73,代码来源:EntriesController.php

示例13: _newUser

 /**
  * Gather all the data for creating a new user.
  *
  * @access protected
  * @param string $mode
  * @return string
  */
 protected function _newUser($mode)
 {
     switch ($mode) {
         case 'username':
             $username = trim($this->in('Username:'));
             if (empty($username)) {
                 $username = $this->_newUser($mode);
             } else {
                 $result = $this->db->fetchRow(sprintf("SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE `%s` = %s", $this->config['userMap']['username'], $this->db->value($username)));
                 if ($this->db->hasResult() && $result[0]['count']) {
                     $this->out('Username already exists, please try again.');
                     $username = $this->_newUser($mode);
                 }
             }
             return $username;
             break;
         case 'password':
             $password = trim($this->in('Password:'));
             if (empty($password)) {
                 $password = $this->_newUser($mode);
             }
             return $password;
             break;
         case 'email':
             $email = trim($this->in('Email:'));
             if (empty($email)) {
                 $email = $this->_newUser($mode);
             } else {
                 if (!Validation::email($email)) {
                     $this->out('Invalid email address, please try again.');
                     $email = $this->_newUser($mode);
                 } else {
                     $result = $this->db->fetchRow(sprintf("SELECT COUNT(*) AS `count` FROM `users` AS `User` WHERE `%s` = %s", $this->config['userMap']['email'], $this->db->value($email)));
                     if ($this->db->hasResult() && $result[0]['count']) {
                         $this->out('Email already exists, please try again.');
                         $email = $this->_newUser($mode);
                     }
                 }
             }
             return $email;
             break;
     }
 }
开发者ID:rintaun,项目名称:cake-forum,代码行数:50,代码来源:InstallShell.php

示例14: getFieldInput

 /**
  * Get the value of an input.
  *
  * @param string $field
  * @return string
  */
 public function getFieldInput($field)
 {
     $model = ClassRegistry::init($this->usersModel);
     switch ($field) {
         case 'username':
             $username = trim($this->in('Username:'));
             if (!$username) {
                 $username = $this->getFieldInput($field);
             } else {
                 $result = $model->find('count', array('conditions' => array($model->alias . '.' . $this->userFields['username'] => $username)));
                 if ($result) {
                     $this->out('<error>Username already exists, please try again</error>');
                     $username = $this->getFieldInput($field);
                 }
             }
             return $username;
             break;
         case 'email':
             $email = trim($this->in('Email:'));
             if (!$email) {
                 $email = $this->getFieldInput($field);
             } else {
                 if (!Validation::email($email)) {
                     $this->out('<error>Invalid email address, please try again</error>');
                     $email = $this->getFieldInput($field);
                 } else {
                     $result = $model->find('count', array('conditions' => array($model->alias . '.' . $this->userFields['email'] => $email)));
                     if ($result) {
                         $this->out('<error>Email already exists, please try again</error>');
                         $email = $this->getFieldInput($field);
                     }
                 }
             }
             return $email;
             break;
             // Password, others...
         // Password, others...
         default:
             $value = trim($this->in(sprintf('%s:', Inflector::humanize($field))));
             if (!$value) {
                 $value = $this->getFieldInput($field);
             }
             return $value;
             break;
     }
 }
开发者ID:alescx,项目名称:cakephp-utils,代码行数:52,代码来源:BaseInstallShell.php

示例15: Validation

<?php

require_once __DIR__ . '/val.php';
$a = new Validation();
echo $a->email();
开发者ID:alexruliov,项目名称:mysite,代码行数:5,代码来源:email.php


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