本文整理汇总了PHP中Validation::isEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isEmail方法的具体用法?PHP Validation::isEmail怎么用?PHP Validation::isEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validation
的用法示例。
在下文中一共展示了Validation::isEmail方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OrganizationPreferenceToverify
$orgPrefVrfObj = new OrganizationPreferenceToverify();
}
if (isset($_POST) && is_array($_POST) && count($_POST) > 0) {
$ere = '';
//
### SERVER SIDE VALIDATION ####
include SITE_CLASS_GEN . "class.validation.php";
$validation = new Validation();
$RequiredFiledArr = array('vUserName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_USER_NAME'), 'vPassword' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_PASSWORD'), 'vFirstName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_FIRST_NAME'), 'vLastName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_LAST_NAME'), 'vCompanyName' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_ORGANIZATION'), 'vCompCode' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMP_CODE'), 'vCompanyRegNo' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMP_REG_NO'), 'eOrganizationType' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_ORGANIZATION'), 'vEmail' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMPANY') . ' ' . $smarty->get_template_vars('LBL_EMAIL'), 'vpEmail' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_PERSONAL') . ' ' . $smarty->get_template_vars('LBL_EMAIL'), 'vPhone' => $smarty->get_template_vars('LBL_ENTER_PHONE_NO'), 'vCity' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_CITY'), 'vCountry' => $smarty->get_template_vars('LBL_SELECT_COUNTRY'), 'vState' => $smarty->get_template_vars('LBL_SELECT_STATE'), 'vZipcode' => $smarty->get_template_vars('LBL_SELECT_STATE'), 'vVatId' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_ZIP_CODE'), 'vAddressLine1' => $smarty->get_template_vars('LBL_ENTER') . ' ' . $smarty->get_template_vars('LBL_COMPANY') . ' ' . $smarty->get_template_vars('LBL_ADDR_LINE'));
$resArr = $validation->isEmpty($RequiredFiledArr);
$tempData = $_POST;
$vNum = $validation->isNum(array($tempData['vPhone'], $tempData['vZipcode']), array('Valid Phone Number', 'Valid ZipCode'), 'empty');
###check Valid Email###
// prints($tempData['vEmail']);exit;
if ($tempData['vEmail'] != '') {
$vmail = $validation->isEmail(array($tempData['vEmail']), array($smarty->get_template_vars('MSG_VALID_EMAIL')));
}
###check duplicate Email###
if ($tempData['vEmail'] != '') {
$vlmsg[] = $smarty->get_template_vars('MSG_DUP_EMAIL');
$DupEmail = $validation->ChekDupEmail('', 'iOrganizationID', PRJ_DB_PREFIX . "_organization_master", $tempData['vEmail'], $vlmsg);
}
if ($tempData['vpEmail'] != '') {
$vlmsg[] = $smarty->get_template_vars('MSG_DUP_EMAIL');
$pDupEmail = $validation->ChekDupEmail('', 'iUserID', PRJ_DB_PREFIX . "_organization_user", $tempData['vpEmail'], $vlmsg);
}
###End check duplicate Email###
###check duplicate Username###
$vlmsg[] = $smarty->get_template_vars('MSG_VALID_USER');
if ($tempData['vUserName'] != '') {
$DupUser = $validation->ChekDupUserName("", 'iUserID', PRJ_DB_PREFIX . "_organization_user", $tempData['vUserName'], $vlmsg, "");
示例2: perform
/**
* Method used to perform a specific action to an issue.
*
* @access public
* @param integer $issue_id The issue ID
* @param array $reminder The reminder details
* @param array $action The action details
* @return boolean
*/
function perform($issue_id, $reminder, $action)
{
$type = '';
// - see which action type we're talking about here...
$action_type = Reminder_Action::getActionType($action['rma_rmt_id']);
// - do we also need to alert the group leader about this?
$group_leader_usr_id = 0;
if ($action['rma_alert_group_leader']) {
if (Reminder::isDebug()) {
echo " - Processing Group Leader notification\n";
}
$group_id = Issue::getGroupID($issue_id);
// check if there's even a group associated with this issue
if (empty($group_id)) {
if (Reminder::isDebug()) {
echo " - No group associated with issue {$issue_id}\n";
}
} else {
$group_details = Group::getDetails($group_id);
if (!empty($group_details['grp_manager_usr_id'])) {
$group_leader_usr_id = $group_details['grp_manager_usr_id'];
}
}
}
if (Reminder::isDebug()) {
echo " - Performing action '{$action_type}' for issue #{$issue_id}\n";
}
switch ($action_type) {
case 'email_assignee':
$type = 'email';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
$to[] = User::getFromHeader($assignee);
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'email_list':
$type = 'email';
$list = Reminder_Action::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
} else {
$to[] = User::getFromHeader($key);
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'sms_assignee':
$type = 'sms';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
if (User::isClockedIn($assignee)) {
$sms_email = User::getSMS($assignee);
if (!empty($sms_email)) {
$to[] = $sms_email;
}
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
$leader_sms_email = User::getSMS($group_leader_usr_id);
if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
$to[] = $leader_sms_email;
}
}
break;
case 'sms_list':
$type = 'sms';
$list = Reminder_Action::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
//.........这里部分代码省略.........
示例3: save
/**
* Save the data of a user
*
* @param int $id user's id
* @param array $data user's data
*/
public function save($id, $data)
{
$user_data = array();
// Email
if (isset($data['mail'])) {
if ($data['mail'] != '' && !Validation::isEmail($data['mail'])) {
throw new FormException('mail');
}
$user_data['mail'] = $data['mail'];
}
// MSN
if (isset($data['msn'])) {
if ($data['msn'] != '' && !Validation::isEmail($data['msn'])) {
throw new FormException('msn');
}
$user_data['msn'] = $data['msn'];
}
// Jabber
if (isset($data['jabber'])) {
if ($data['jabber'] != '' && !Validation::isEmail($data['jabber'])) {
throw new FormException('jabber');
}
$user_data['jabber'] = $data['jabber'];
}
// Address
if (isset($data['address'])) {
$user_data['address'] = $data['address'];
}
// Zipcode
if (isset($data['zipcode'])) {
if ($data['zipcode'] != '' && !ctype_digit(trim($data['zipcode']))) {
throw new FormException('zipcode');
}
$user_data['zipcode'] = $data['zipcode'] == '' ? null : (int) trim($data['zipcode']);
}
// City
if (isset($data['city'])) {
$user_data['city'] = $data['city'];
}
// Cellphone
if (isset($data['cellphone'])) {
if ($data['cellphone'] != '' && !preg_match('#^0[67]([ \\.-]?)[0-9]{2}(?:\\1[0-9]{2}){3}$#', $data['cellphone'])) {
throw new FormException('cellphone');
}
$user_data['cellphone'] = $data['cellphone'];
}
// Phone
if (isset($data['phone'])) {
if ($data['phone'] != '' && !preg_match('#^0[1-59]([ \\.-]?)[0-9]{2}(?:\\1[0-9]{2}){3}$#', $data['phone'])) {
throw new FormException('phone');
}
$user_data['phone'] = $data['phone'];
}
// Birthday
if (isset($data['birthday'])) {
if (!($birthday = strptime($data['birthday'], __('USER_EDIT_FORM_BIRTHDAY_FORMAT_PARSE')))) {
throw new FormException('birthday');
}
$user_data['birthday'] = $birthday['tm_year'] + 1900 . '-' . ($birthday['tm_mon'] + 1) . '-' . $birthday['tm_mday'];
}
// Update the DB
$this->createQuery()->set($user_data)->update($id);
}
示例4: checkOptions
/**
* Check value
*
* @param array $options
*/
public final function checkOptions($checkOptions)
{
$attributes = get_object_vars($this);
$checkPass = true;
foreach ($attributes as $attribute => $value) {
if (in_array($attribute, array('primary', 'tableName', 'fieldMap', 'conditions'))) {
continue;
}
$checkOptionString = trim($checkOptions[$attribute]);
if (strlen($checkOptionString) <= 0) {
continue;
}
$checkList = explode(';', $checkOptionString);
//var_dump($checkList);
foreach ($checkList as $check) {
//var_dump($check);
$field = strtoupper($attribute);
$checkInfo = explode(':', $check);
//var_dump($checkInfo);
//var_dump($valueObject->$attribute, $field, $checkInfo[1]);
switch ($checkInfo[0]) {
case 'required':
if (!trim($this->{$attribute})) {
$message = Language::content($checkInfo[1]);
Errors::addError($message, $field);
$checkPass = false;
}
break;
case 'number':
if (strlen(trim($this->{$attribute})) <= 0) {
break;
}
if (strlen($valueObject->{$attribute}) > 0 && !is_numeric($valueObject->{$attribute})) {
$message = Language::content($checkInfo[1]);
Errors::addError($message, $field);
$checkPass = false;
}
break;
case 'email':
if (strlen(trim($this->{$attribute})) <= 0) {
break;
}
if (!Validation::isEmail($valueObject->{$attribute})) {
$message = Language::content($checkInfo[1]);
Errors::addError($message, $field);
$checkPass = false;
}
break;
case 'date':
//var_dump($valueObject->$attribute);
if (strlen(trim($this->{$attribute})) <= 0) {
break;
}
if (!Validation::isDate($valueObject->{$attribute})) {
$message = Language::content($checkInfo[1]);
Errors::addError($message, $field);
$checkPass = false;
break;
}
case 'alnum':
if (strlen(trim($this->{$attribute})) <= 0) {
break;
}
if (!Validation::isAlnum($valueObject->{$attribute})) {
$message = Language::content($checkInfo[1]);
Errors::addError($message, $field);
$checkPass = false;
}
break;
case 'minLength':
if (strlen(trim($this->{$attribute})) <= 0) {
break;
}
if (strlen($valueObject->{$attribute}) < $checkInfo[2]) {
$messageTpl = Language::content($checkInfo[1]);
$message = str_replace('{0}', $checkInfo[2], $messageTpl);
Errors::addError($message, $field);
$checkPass = false;
}
break;
case 'maxLength':
if (strlen(trim($this->{$attribute})) <= 0) {
break;
}
if (strlen($valueObject->{$attribute}) > $checkInfo[2]) {
$messageTpl = Language::content($checkInfo[1]);
$message = str_replace('{0}', $checkInfo[2], $messageTpl);
Errors::addError($message, $field);
$checkPass = false;
}
break;
}
}
}
return $checkPass;
//.........这里部分代码省略.........
示例5: perform
/**
* Method used to perform a specific action to an issue.
*
* @param integer $issue_id The issue ID
* @param array $reminder The reminder details
* @param array $action The action details
* @return boolean
*/
public static function perform($issue_id, $reminder, $action)
{
$type = '';
// - see which action type we're talking about here...
$action_type = self::getActionType($action['rma_rmt_id']);
// - do we also need to alert the group leader about this?
$group_leader_usr_id = 0;
if ($action['rma_alert_group_leader']) {
if (Reminder::isDebug()) {
echo ' - ' . ev_gettext('Processing Group Leader notification') . "\n";
}
$group_id = Issue::getGroupID($issue_id);
// check if there's even a group associated with this issue
if (empty($group_id)) {
if (Reminder::isDebug()) {
echo ' - ' . ev_gettext('No group associated with issue %1$s', $issue_id) . "\n";
}
} else {
$group_details = Group::getDetails($group_id);
if (!empty($group_details['grp_manager_usr_id'])) {
$group_leader_usr_id = $group_details['grp_manager_usr_id'];
}
}
}
if (Reminder::isDebug()) {
echo ' - ' . ev_gettext('Performing action %1$s for issue # %2$s', $action_type, $issue_id) . "\n";
}
switch ($action_type) {
case 'email_assignee':
$type = 'email';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
$to[] = User::getFromHeader($assignee);
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'email_list':
$type = 'email';
$list = self::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
} else {
$to[] = User::getFromHeader($key);
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id)) {
$leader_email = User::getFromHeader($group_leader_usr_id);
if (!empty($leader_email) && !in_array($leader_email, $to)) {
$to[] = $leader_email;
}
}
break;
case 'sms_assignee':
$type = 'sms';
$assignees = Issue::getAssignedUserIDs($issue_id);
$to = array();
foreach ($assignees as $assignee) {
if (User::isClockedIn($assignee)) {
$sms_email = User::getSMS($assignee);
if (!empty($sms_email)) {
$to[] = $sms_email;
}
}
}
// add the group leader to the recipient list, if needed
if (!empty($group_leader_usr_id) && User::isClockedIn($group_leader_usr_id)) {
$leader_sms_email = User::getSMS($group_leader_usr_id);
if (!empty($leader_sms_email) && !in_array($leader_sms_email, $to)) {
$to[] = $leader_sms_email;
}
}
break;
case 'sms_list':
$type = 'sms';
$list = self::getUserList($action['rma_id']);
$to = array();
foreach ($list as $key => $value) {
// add the recipient to the list if it's a simple email address
if (Validation::isEmail($key)) {
$to[] = $key;
} else {
//.........这里部分代码省略.........
示例6: Validation
} else {
include SITE_CLASS_GEN . "class.validation.php";
$validation = new Validation();
### SERVER SIDE VALIDATION ####
$RequiredFiledArr = array('vFirstName' => $smarty->get_template_vars('LBL_ENTER_FIRST_NAME'), 'vLastName' => $smarty->get_template_vars('LBL_ENTER_LAST_NAME'), 'vUserName' => $smarty->get_template_vars('LBL_ENTER_USER_NAME'), 'vPassword' => $smarty->get_template_vars('LBL_ENTER_PASSWORD'), 'cPassword' => $smarty->get_template_vars('LBL_ENTER_CPASSWORD'), 'vCountry' => $smarty->get_template_vars('LBL_ENTER_COUNTRY'), 'vState' => $smarty->get_template_vars('LBL_ENTER_STATE'), 'vZipCode' => $smarty->get_template_vars('LBL_ZIPCODE'), 'vEmail' => $smarty->get_template_vars('LBL_EMAIL_ADDRESS'), 'vCity' => $smarty->get_template_vars('LBL_ENTER_CITY'), 'iOrganizationID' => $smarty->get_template_vars('MSG_SELECT_ORGANIZATION'), 'vAddressLine1' => $smarty->get_template_vars('LBL_ENTER_ADDRESSLINE1'), 'vAnswer' => $smarty->get_template_vars('LBL_ENTER_ANSWER'), 'iSecretQuestion1ID' => $smarty->get_template_vars('LBL_ENTER_QESTION'));
$resArr = $validation->isEmpty($RequiredFiledArr);
//prints($resArr);exit;
### ENDS HERE ###
$id = $Data['iUserID'];
$val = $Data['vEmail'];
$user = $Data['vUserName'];
###check Valid Email###
$chekemail = array('vEmail' => $val);
$validEmailmsg[] = $smarty->get_template_vars('MSG_VALID_EMAIL');
if ($Data['vEmail'] != '') {
$vmail = $validation->isEmail($chekemail, $validEmailmsg);
}
### End check Valid Email###
if ($Data['vZipcode'] != '') {
$vZipCode = $Data['vZipcode'];
}
$arr = array();
if ($Data['vPhone'] != '') {
$arr = $Data['vPhone'];
}
$ar = array(explode('-', $arr));
$Data['vPhone'] = $ar[0][1];
$Data['vPhoneCode'] = $ar[0][0];
if ($Data['vMobile'] != '') {
$arr = $Data['vMobile'];
}
示例7: create
/**
* Create a group
*
* @param array $data Group's data
* @return string URL name
*/
public function create($data)
{
$group_data = array();
// Name
$change_name = false;
if (!isset($data['name'])) {
throw new FormException('invalid_name');
}
$name = trim($data['name']);
$group_data['name'] = $name;
// URL name
$url_name = Text::forURL($name);
if ($url_name == '') {
throw new FormException('invalid_name');
}
$i = '';
while (self::urlExists($url_name . $i)) {
$i = $i == '' ? 1 : $i + 1;
}
$url_name .= $i;
$group_data['url_name'] = $url_name;
// Creation date
if (!isset($data['creation_date']) || !($creation_date = strptime($data['creation_date'], __('GROUP_EDIT_FORM_CREATION_DATE_FORMAT_PARSE')))) {
throw new FormException('invalid_creation_date');
}
$group_data['creation_date'] = $creation_date['tm_year'] + 1900 . '-' . ($creation_date['tm_mon'] + 1) . '-' . $creation_date['tm_mday'];
// Email
if (isset($data['mail'])) {
if ($data['mail'] != '' && !Validation::isEmail($data['mail'])) {
throw new FormException('invalid_mail');
}
$group_data['mail'] = $data['mail'];
}
// Description
if (isset($data['description'])) {
$group_data['description'] = $data['description'];
}
// Avatar
if (!isset($data['avatar_path']) || !File::exists($data['avatar_path']) || !isset($data['avatar_big_path']) && !File::exists($data['avatar_big_path'])) {
throw new FormException('avatar');
}
// Insertion in the DB
$id = $this->createQuery()->set($group_data)->insert();
// Avatar
$avatar_path = self::getAvatarPath($id, true);
$avatar_dir = File::getPath($avatar_path);
if (!is_dir($avatar_dir)) {
File::makeDir($avatar_dir, 0777, true);
}
File::rename($data['avatar_path'], $avatar_path);
$avatar_path = self::getAvatarPath($id, false);
$avatar_dir = File::getPath($avatar_path);
if (!is_dir($avatar_dir)) {
File::makeDir($avatar_dir, 0777, true);
}
File::rename($data['avatar_big_path'], $avatar_path);
// Members
if (isset($data['members']) && is_array($data['members'])) {
$i = 0;
foreach ($data['members'] as &$member) {
$member['order'] = $i++;
}
if (count($data['members']) != 0) {
$users = DB::createQuery('users')->fields('id')->where('id IN (' . implode(',', array_keys($data['members'])) . ')')->select();
foreach ($users as $user) {
DB::createQuery('groups_users')->set(array('group_id' => $id, 'user_id' => $user['id'], 'title' => $data['members'][(int) $user['id']]['title'], 'admin' => $data['members'][(int) $user['id']]['admin'] ? '1' : '0', 'order' => $data['members'][(int) $user['id']]['order']))->insert();
}
}
}
// Add to the search index
$search_model = new Search_Model();
$search_model->index(array('name' => Search_Model::sanitize($group_data['name']), 'url_name' => $group_data['url_name'], 'description' => Search_Model::sanitize($group_data['description'])), 'group', $id);
self::clearCache();
return $url_name;
}
示例8: Validation
<?php
require 'validation.php';
$validation = new Validation();
$nome = $_POST['nome'];
$email = $_POST['email'];
$site = $_POST['site'];
$telefone = $_POST['telefone'];
$mensagem = $validation->purifier($_POST['mensagem']);
if (!$validation->isLetter($nome)) {
$nome = '';
}
if (!$validation->isEmail($email)) {
$email = '';
}
if (!$validation->isTelephone($telefone)) {
$telefone = '';
}
$assunto = '[tmartins.com.br] Contato do Site';
$sender = 'thamartins@msn.com';
$senderCopy = 'thaismartinsweb@gmail.com';
$senderName = 'Thais Martins';
if (PATH_SEPARATOR == ";") {
$quebra_linha = "\r\n";
} else {
$quebra_linha = "\n";
}
$headers = "MIME-Version: 1.1" . $quebra_linha;
$headers .= "Content-type: text/html; charset=utf-8" . $quebra_linha;
$headers .= "From:" . $senderName . "<" . $sender . ">" . $quebra_linha;
$headers .= "Reply-To: " . $email . $quebra_linha;