本文整理汇总了PHP中is_email函数的典型用法代码示例。如果您正苦于以下问题:PHP is_email函数的具体用法?PHP is_email怎么用?PHP is_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_email函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: send
function send($email, $template = null, $args = array())
{
if (!$template) {
return;
}
if (um_get_option($template . '_on') != 1) {
return;
}
if (!is_email($email)) {
return;
}
$this->attachments = null;
$this->headers = 'From: ' . um_get_option('mail_from') . ' <' . um_get_option('mail_from_addr') . '>' . "\r\n";
$this->subject = um_get_option($template . '_sub');
$this->subject = $this->convert_tags($this->subject, $args);
if (isset($args['admin']) || isset($args['plain_text'])) {
$this->force_plain_text = 'forced';
}
// HTML e-mail or text
if (um_get_option('email_html') && $this->email_template($template, $args)) {
add_filter('wp_mail_content_type', array(&$this, 'set_content_type'));
$this->message = file_get_contents($this->email_template($template, $args));
} else {
$this->message = um_get_option($template);
}
// Convert tags in body
$this->message = $this->convert_tags($this->message, $args);
// Send mail
wp_mail($email, $this->subject, $this->message, $this->headers, $this->attachments);
remove_filter('wp_mail_content_type', array(&$this, 'set_content_type'));
// reset globals
$this->force_plain_text = '';
}
开发者ID:emaxees,项目名称:elpandecadadia,代码行数:33,代码来源:um-mail.php
示例2: is_valid_student
/**
* 检查 学生的 准考证(exam_ticket)/邮箱(email) 和 登录密码是否正确
* @param string $keyword
* @param string $password
* @return boolean|array
*/
public function is_valid_student($keyword, $password = null)
{
$items = array('uid', 'email', 'first_name', 'last_name', 'exam_ticket', 'grade_id', 'sex', 'picture', 'school_id', 'password');
$this->db->select($items);
if (is_email($keyword)) {
//验证 邮箱
$query = $this->db->get_where(self::$_table_name, array('email' => $keyword), 1);
} else {
if (is_idcard($keyword)) {
//验证 邮箱
$query = $this->db->get_where(self::$_table_name, array('idcard' => $keyword), 1);
} else {
if (is_numeric($keyword)) {
//验证 准考证
$query = $this->db->get_where(self::$_table_name, array('exam_ticket' => $keyword), 1);
} else {
return false;
}
}
}
$row = $query->row_array();
if (!count($row)) {
return false;
}
if (is_null($password)) {
return $row;
}
if ($row['password'] != my_md5($password)) {
return false;
}
unset($row['password']);
return $row;
}
开发者ID:Vincent-Shen,项目名称:origin,代码行数:39,代码来源:student_model.php
示例3: sendContact
public function sendContact()
{
$res = new responseGmp();
$time = time();
$prevSendTime = (int) get_option(GMP_CODE . '_last__time_contact_send');
if ($prevSendTime && $time - $prevSendTime < 5 * 60) {
// Only one message per five minutes
$res->pushError(__('Please don\'t send contact requests so often - wait for response for your previous requests.'));
$res->ajaxExec();
}
$data = reqGmp::get('post');
$fields = $this->getModule()->getContactFormFields();
foreach ($fields as $fName => $fData) {
$validate = isset($fData['validate']) ? $fData['validate'] : false;
$data[$fName] = isset($data[$fName]) ? trim($data[$fName]) : '';
if ($validate) {
$error = '';
foreach ($validate as $v) {
if (!empty($error)) {
break;
}
switch ($v) {
case 'notEmpty':
if (empty($data[$fName])) {
$error = $fData['html'] == 'selectbox' ? __('Please select %s', GMP_LANG_CODE) : __('Please enter %s', GMP_LANG_CODE);
$error = sprintf($error, $fData['label']);
}
break;
case 'email':
if (!is_email($data[$fName])) {
$error = __('Please enter valid email address', GMP_LANG_CODE);
}
break;
}
if (!empty($error)) {
$res->pushError($error, $fName);
}
}
}
}
if (!$res->error()) {
$msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />';
$msg .= 'Plugin: ' . GMP_WP_PLUGIN_NAME . '<br />';
foreach ($fields as $fName => $fData) {
if (in_array($fName, array('name', 'email', 'subject'))) {
continue;
}
if ($fName == 'category') {
$data[$fName] = $fData['options'][$data[$fName]];
}
$msg .= '<b>' . $fData['label'] . '</b>: ' . nl2br($data[$fName]) . '<br />';
}
if (frameGmp::_()->getModule('mail')->send('[email protected]', $data['subject'], $msg, $data['name'], $data['email'])) {
update_option(GMP_CODE . '_last__time_contact_send', $time);
} else {
$res->pushError(frameGmp::_()->getModule('mail')->getMailErrors());
}
}
$res->ajaxExec();
}
开发者ID:Vibeosys,项目名称:VibeosysWeb,代码行数:60,代码来源:controller.php
示例4: sendemail
function sendemail()
{
if (isset($_POST['action']) and $_POST['action'] == 'send') {
$body = BODY;
if (!is_string($_POST['name']) or $_POST['name'] == '') {
return '<p class="error">Insert correct name</p>';
}
if (!is_email($_POST['email']) or $_POST['email'] == '') {
return '<p class="error">Insert correct email</p>';
}
$subject = $_POST['subject'];
if (!is_email($subject) or $subject == '') {
$subject = 'Email without subject.';
}
foreach (array_map('stripslashes', $_POST) as $id => $var) {
if ($id == 'message') {
$var = nl2br($var);
}
$body = str_replace("%{$id}%", $var, $body);
}
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= "From: [email protected]\r\n";
$sendmail = mail(TO, $subject, $body, $headers);
if ($sendmail) {
return '<p class="success">Email sent correctly!</p>';
} else {
return '<p class="error">An error has been encountered. Please try again.</p>';
}
}
}
开发者ID:uwitec,项目名称:7ido,代码行数:31,代码来源:sendmail.php
示例5: doemail
public function doemail()
{
global $_M;
if (!load::sys_class('pin', 'new')->check_pin($_M['form']['code'])) {
okinfo($_M['url']['getpassword'], $_M['word']['membercode']);
}
load::sys_func('str');
if (is_email($_M['form']['username'])) {
$user = $this->userclass->get_user_by_email($_M['form']['username']);
if (!$user) {
okinfo($_M['url']['getpassword'], $_M['word']['nouser']);
}
$valid = load::mod_class('user/class/valid', 'new');
if ($valid->get_email($_M['form']['username'], 'getpassword')) {
okinfo($_M['url']['login'], $_M['word']['emailsucpass']);
} else {
okinfo($_M['url']['login'], $_M['word']['emailfail']);
}
} elseif (is_phone($_M['form']['username'])) {
$user = $this->userclass->get_user_by_tel($_M['form']['username']);
if (!$user) {
okinfo($_M['url']['getpassword'], $_M['word']['nouser']);
}
require_once $this->template('tem/getpassword_telset');
} else {
okinfo($_M['url']['getpassword'], $_M['word']['emailvildtips3']);
}
}
开发者ID:nanfs,项目名称:lt,代码行数:28,代码来源:getpassword.class.php
示例6: validate
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since AvadaReduxFramework 1.0.0
*/
function validate()
{
if (!is_email($this->value)) {
$this->value = isset($this->current) ? $this->current : '';
$this->error = $this->field;
}
}
开发者ID:pedrom40,项目名称:sazoo.org,代码行数:13,代码来源:validation_email.php
示例7: wppb_change_login_with_email
function wppb_change_login_with_email()
{
if (!empty($_POST['log'])) {
// only do this for our form
if (isset($_POST['wppb_login'])) {
global $wpdb, $_POST;
$wppb_generalSettings = get_option('wppb_general_settings');
// if this setting is active, the posted username is, in fact the user's email
if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'email') {
$username = $wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->users} WHERE user_email= %s LIMIT 1", trim($_POST['log'])));
if (!empty($username)) {
$_POST['log'] = $username;
} else {
// if we don't have a username for the email entered we can't have an empty username because we will receive a field empty error
$_POST['log'] = 'this_is_an_invalid_email' . time();
}
}
// if this setting is active, the posted username is, in fact the user's email or username
if (isset($wppb_generalSettings['loginWith']) && $wppb_generalSettings['loginWith'] == 'usernameemail') {
if (is_email($_POST['log'])) {
$username = $wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->users} WHERE user_email= %s LIMIT 1", trim($_POST['log'])));
} else {
$username = $_POST['log'];
}
if (!empty($username)) {
$_POST['log'] = $username;
} else {
// if we don't have a username for the email entered we can't have an empty username because we will receive a field empty error
$_POST['log'] = 'this_is_an_invalid_email' . time();
}
}
}
}
}
开发者ID:nikwin333,项目名称:pcu_project,代码行数:34,代码来源:login.php
示例8: save
/**
* 保存配置信息
*/
public function save()
{
$setting = array();
$setting['admin_email'] = is_email($_POST['setting']['admin_email']) ? trim($_POST['setting']['admin_email']) : showmessage(L('email_illegal'), HTTP_REFERER);
$setting['maxloginfailedtimes'] = intval($_POST['setting']['maxloginfailedtimes']);
$setting['minrefreshtime'] = intval($_POST['setting']['minrefreshtime']);
$setting['mail_type'] = intval($_POST['setting']['mail_type']);
$setting['mail_server'] = trim($_POST['setting']['mail_server']);
$setting['mail_port'] = intval($_POST['setting']['mail_port']);
$setting['category_ajax'] = intval(abs($_POST['setting']['category_ajax']));
$setting['mail_user'] = trim($_POST['setting']['mail_user']);
$setting['mail_auth'] = intval($_POST['setting']['mail_auth']);
$setting['mail_from'] = trim($_POST['setting']['mail_from']);
$setting['mail_password'] = trim($_POST['setting']['mail_password']);
$setting['errorlog_size'] = trim($_POST['setting']['errorlog_size']);
$setting = array2string($setting);
$this->db->update(array('setting' => $setting), array('module' => 'admin'));
//存入admin模块setting字段
//如果开始盛大通行证接入,判断服务器是否支持curl
$snda_error = '';
if ($_POST['setconfig']['snda_akey'] || $_POST['setconfig']['snda_skey']) {
if (function_exists('curl_init') == FALSE) {
$snda_error = L('snda_need_curl_init');
$_POST['setconfig']['snda_enable'] = 0;
}
}
set_config($_POST['setconfig']);
//保存进config文件
$this->setcache();
showmessage(L('setting_succ') . $snda_error, HTTP_REFERER);
}
开发者ID:klj123wan,项目名称:czsz,代码行数:34,代码来源:setting.php
示例9: sso_check
/**
Plugin Name: SSO
Author: Garth Mortensen, Mike Hansen
Version: 0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
function sso_check()
{
if (!isset($_GET['salt']) || !isset($_GET['nonce']) || !isset($_GET['user'])) {
sso_req_login();
}
if (sso_check_blocked()) {
sso_req_login();
}
$nonce = esc_attr($_GET['nonce']);
$salt = esc_attr($_GET['salt']);
$user = esc_attr($_GET['user']);
$hash = base64_encode(hash('sha256', $nonce . $salt, false));
$hash = substr($hash, 0, 64);
if (get_transient('sso_token') == $hash) {
if (is_email($user)) {
$user = get_user_by('email', $user);
} else {
$user = get_user_by('id', (int) $user);
}
if (is_a($user, 'WP_User')) {
wp_set_current_user($user->ID, $user->user_login);
wp_set_auth_cookie($user->ID);
do_action('wp_login', $user->user_login);
delete_transient('sso_token');
wp_safe_redirect(admin_url());
} else {
sso_req_login();
}
} else {
sso_add_failed_attempt();
sso_req_login();
}
die;
}
开发者ID:annbransom,项目名称:techishowl_prod_backup,代码行数:41,代码来源:sso.php
示例10: wppb_mae_general_settings_sanitize_extra
function wppb_mae_general_settings_sanitize_extra($wppb_generalSettings)
{
if (isset($wppb_generalSettings['admin_emails']) && !empty($wppb_generalSettings['admin_emails'])) {
$invalid_email = false;
$invalid_email_count = 0;
$admin_emails = explode(',', $wppb_generalSettings['admin_emails']);
foreach ($admin_emails as $key => $admin_email) {
if (!is_email(trim($admin_email))) {
$invalid_email = true;
$invalid_email_count++;
unset($admin_emails[$key]);
}
}
if ($invalid_email) {
$wppb_generalSettings['admin_emails'] = implode(',', $admin_emails);
if ($invalid_email_count === 1) {
$invalid_email_is_are = __('is', 'profile-builder');
$invalid_email_has_have = __('has', 'profile-builder');
} else {
$invalid_email_is_are = __('are', 'profile-builder');
$invalid_email_has_have = __('have', 'profile-builder');
}
add_settings_error('wppb_general_settings', 'invalid-email', sprintf(__('%1$s of the emails provided in the Admin Emails field %2$s invalid and %3$s been removed from the list', 'profile-builder'), $invalid_email_count, $invalid_email_is_are, $invalid_email_has_have));
}
}
if (empty($wppb_generalSettings['admin_emails'])) {
$wppb_generalSettings['admin_emails'] = get_option('admin_email');
}
return $wppb_generalSettings;
}
开发者ID:seanlon,项目名称:profile-page,代码行数:30,代码来源:index.php
示例11: setEmail
/**
* @param $email
*
* @return bool
* @author Nicolas Juen
*/
public function setEmail($email)
{
if (!isset($email) || empty($email) || !is_email($email)) {
return false;
}
$this->email = $email;
}
开发者ID:asadowski10,项目名称:bea-sender,代码行数:13,代码来源:class.receiver.php
示例12: do_request
public function do_request()
{
global $wc_software;
$required = array('email', 'licence_key', 'product_id');
$this->check_required($required);
$input = $this->check_input(array('email', 'licence_key', 'product_id'));
// Validate email
if (!is_email($input['email'])) {
$this->wc_software_api->error('100', __('The email provided is invalid', 'wc_software'), null, array('reset' => false));
}
$data = $wc_software->get_licence_key($input['licence_key'], $input['product_id'], $input['email']);
if (!$data) {
$this->wc_software_api->error('101', __('No matching licence key exists', 'wc_software'), null, array('activated' => false));
}
// reset number of activations
if ($wc_software->deactivate_licence_key($data->key_id)) {
$output_data = get_object_vars($data);
$output_data['reset'] = true;
$output_data['timestamp'] = time();
$to_output = array();
$to_output['reset'] = 'reset';
$to_output['timestamp'] = 'timestamp';
$json = $this->prepare_output($to_output, $output_data);
return $json;
} else {
$this->wc_software_api->error('100', __('An undisclosed error occurred', 'wc_software'), null, array('reset' => false));
}
}
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:28,代码来源:class-wc-activation-reset-request.php
示例13: download_api_product
/**
* Check if we need to download a file and check validity
*/
public function download_api_product()
{
global $wpdb;
if (isset($_GET['download_api_product']) && isset($_GET['licence_key'])) {
$download_api_product = absint($_GET['download_api_product']);
$licence_key = sanitize_text_field($_GET['licence_key']);
$activation_email = sanitize_text_field($_GET['activation_email']);
$licence = wppl_get_licence_from_key($licence_key);
// Validation
if (!$licence) {
wp_die(__('Invalid or expired licence key.', 'wp-plugin-licencing'));
}
if (is_user_logged_in() && $licence->user_id && $licence->user_id != get_current_user_id()) {
wp_die(__('This licence does not appear to be yours.', 'wp-plugin-licencing'));
}
if (!is_email($activation_email) || $activation_email != $licence->activation_email) {
wp_die(__('Invalid activation email address.', 'wp-plugin-licencing'));
}
if (!in_array($download_api_product, wppl_get_licence_api_product_permissions($licence->product_id))) {
wp_die(__('This licence does not allow access to the requested product.', 'wp-plugin-licencing'));
}
// Get the download URL
$file_path = wppl_get_package_file_path($download_api_product);
// Log this download
$wpdb->insert($wpdb->prefix . 'wp_plugin_licencing_download_log', array('licence_key' => $licence_key, 'activation_email' => $activation_email, 'api_product_id' => $download_api_product, 'date_downloaded' => current_time('mysql'), 'user_ip_address' => sanitize_text_field(isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'])));
// Download it!
$this->download($file_path);
}
}
开发者ID:ChromeOrange,项目名称:wp-plugin-licencing,代码行数:32,代码来源:class-wp-plugin-licencing-download-handler.php
示例14: guessed
/**
* Guess values for the following fields
* - EMAIL
* - NAME
* - FNAME
* - LNAME
*
* @return array
*/
public function guessed()
{
$guessed = array();
$fields = $this->fields->all();
foreach ($fields as $field => $value) {
// transform value into array to support 1-level arrays
$sub_fields = is_array($value) ? $value : array($value);
foreach ($sub_fields as $sub_field_value) {
// is this an email value? if so, assume it's the EMAIL field
if (empty($guessed['EMAIL']) && is_string($sub_field_value) && is_email($sub_field_value)) {
$guessed['EMAIL'] = $sub_field_value;
continue 2;
}
}
// remove special characters from field name
$simple_key = str_replace(array('-', '_', ' '), '', $field);
if (empty($guessed['FNAME']) && $this->string_contains($simple_key, array('FIRSTNAME', 'FNAME', 'GIVENNAME', 'FORENAME'))) {
// find first name field
$guessed['FNAME'] = $value;
} elseif (empty($guessed['LNAME']) && $this->string_contains($simple_key, array('LASTNAME', 'LNAME', 'SURNAME', 'FAMILYNAME'))) {
// find last name field
$guessed['LNAME'] = $value;
} elseif (empty($guessed['NAME']) && $this->string_contains($simple_key, 'NAME')) {
// find name field
$guessed['NAME'] = $value;
}
}
return $guessed;
}
开发者ID:dannyvankooten,项目名称:mailchimp-for-wordpress,代码行数:38,代码来源:class-field-guesser.php
示例15: sendMail
/**
* Validate data and send mail.
*
* @see http://codex.wordpress.org/Function_Reference/wp_mail
* @return {int} Status of message:
* -2 => Invalid data
* -1 => Failed to send
* 1 => OK
*/
function sendMail()
{
header("Content-Type: application/json");
$response = array('status' => -2, 'errors' => array());
if (!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['message'])) {
echo json_encode($response);
die;
}
$name = esc_attr($_POST['name']);
$email = sanitize_email($_POST['email']);
$message = esc_textarea($_POST['message']);
if (!strlen($name)) {
$response['errors']['name'] = "C'mon, what's your name?";
}
if (!is_email($email)) {
$response['errors']['email'] = "Please, give us valid email.";
}
if (!strlen($message)) {
$response['errors']['message'] = "No message, huh?";
}
if (empty($response['errors'])) {
$to = get_bloginfo('admin_email');
$subject = 'Contact from ' . get_bloginfo('name');
$headers[] = "From: {$name} <{$email}>";
$isSent = wp_mail($to, $subject, $message, $headers);
$response['status'] = $isSent ? 1 : -1;
}
echo json_encode($response);
die;
}
开发者ID:sachsy,项目名称:snippets-1,代码行数:39,代码来源:wp.sendMail.php
示例16: lost_licence_key_form_handler
/**
* Handles actions on candidate dashboard
*/
public function lost_licence_key_form_handler()
{
if (!empty($_REQUEST['submit_lost_licence_form'])) {
$activation_email = sanitize_text_field($_REQUEST['activation_email']);
if (!is_email($activation_email)) {
wc_add_notice(__('Invalid email address.'), 'error');
return;
}
$keys = wppl_get_licences_from_activation_email($activation_email);
if (!$keys) {
wc_add_notice(__('No licences found.'), 'error');
} else {
ob_start();
// Try to get a user name
$user = get_user_by('email', $activation_email);
if ($user && !empty($user->first_name)) {
$user_first_name = $user->first_name;
} else {
$user_first_name = false;
}
wc_get_template('lost-licence-email.php', array('keys' => $keys, 'activation_email' => $activation_email, 'blogname' => get_option('blogname'), 'user_first_name' => $user_first_name), 'wp-plugin-licencing', WP_PLUGIN_LICENCING_PLUGIN_DIR . '/templates/');
// Get contents
$message = ob_get_clean();
if (wp_mail($activation_email, __('Your licence keys for WP Job Manager', 'wp-plugin-licencing'), $message)) {
wc_add_notice(sprintf(__('Your licences have been emailed to %s.'), $activation_email), 'success');
} else {
wc_add_notice(__('Your licences could not be sent. Please contact us for support.'), 'error');
}
}
}
}
开发者ID:ChromeOrange,项目名称:wp-plugin-licencing,代码行数:34,代码来源:class-wp-plugin-licencing-shortcodes.php
示例17: subscribe
public function subscribe()
{
$result = '';
if (!$_POST || !wp_verify_nonce($_POST[$this->pluginname . "_form_nonce"], $this->pluginname . "_form_submit")) {
$result = json_encode(array("status" => false, "type" => "request", "reason" => "Bad request"));
} else {
$email = $_POST['es-email'];
if (isset($email) && is_email($email)) {
// Register and reply with confirmation message
$ip = $_SERVER['REMOTE_ADDR'];
//Check IP to make sure it is valid and not spam
$saneip = filter_var($ip, FILTER_VALIDATE_IP);
if ($saneip) {
$res = $this->manager->subscribe($email, $saneip);
if ($res == ESMessageCode::ES_SUCCESS_SUB_ADDED) {
$result = json_encode(array("status" => true, "type" => "", "reason" => ""));
} else {
$result = json_encode(array("status" => false, "type" => "system", "reason" => "System error."));
}
} else {
ice_log("in subscribe - bad ip error");
$result = json_encode(array("status" => false, "type" => "ip", "reason" => "Invalid IP."));
}
} else {
// Reply with error
$result = json_encode(array("status" => false, "type" => "data", "reason" => "Invalid email."));
}
}
header("Content-Type: application/json");
echo $result;
die;
}
开发者ID:peeves6,项目名称:Imli-Core-Engine,代码行数:32,代码来源:ESPublic.php
示例18: save
public function save()
{
require_once WD_BWG_DIR . "/frontend/models/BWGModelGalleryBox.php";
$model = new BWGModelGalleryBox();
$option_row = $model->get_option_row_data();
if ($option_row->popup_enable_email) {
// Email validation.
$email = isset($_POST['bwg_email']) ? is_email(stripslashes($_POST['bwg_email'])) : FALSE;
} else {
$email = TRUE;
}
if ($option_row->popup_enable_captcha) {
$bwg_captcha_input = isset($_POST['bwg_captcha_input']) ? esc_html(stripslashes($_POST['bwg_captcha_input'])) : '';
@session_start();
$bwg_captcha_code = isset($_SESSION['bwg_captcha_code']) ? esc_html(stripslashes($_SESSION['bwg_captcha_code'])) : '';
if ($bwg_captcha_input === $bwg_captcha_code) {
$captcha = TRUE;
} else {
$captcha = FALSE;
}
} else {
$captcha = TRUE;
}
if ($email && $captcha) {
global $wpdb;
$image_id = isset($_POST['image_id']) ? (int) $_POST['image_id'] : 0;
$name = isset($_POST['bwg_name']) ? esc_html(stripslashes($_POST['bwg_name'])) : '';
$bwg_comment = isset($_POST['bwg_comment']) ? esc_html(stripslashes($_POST['bwg_comment'])) : '';
$bwg_email = isset($_POST['bwg_email']) ? esc_html(stripslashes($_POST['bwg_email'])) : '';
$published = current_user_can('manage_options') || !$option_row->comment_moderation ? 1 : 0;
$save = $wpdb->insert($wpdb->prefix . 'bwg_image_comment', array('image_id' => $image_id, 'name' => $name, 'date' => date('Y-m-d H:i'), 'comment' => $bwg_comment, 'url' => '', 'mail' => $bwg_email, 'published' => $published), array('%d', '%s', '%s', '%s', '%s', '%s', '%d'));
$wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_image SET comment_count=comment_count+1 WHERE id="%d"', $image_id));
}
$this->display();
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:35,代码来源:BWGControllerGalleryBox.php
示例19: wppb_check_email_value
function wppb_check_email_value($message, $field, $request_data, $form_location)
{
global $wpdb;
if (isset($request_data['email']) && trim($request_data['email']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
if (isset($request_data['email']) && !is_email(trim($request_data['email']))) {
return __('The email you entered is not a valid email address.', 'profilebuilder');
}
if (is_multisite() || !is_multisite() && (isset($wppb_generalSettings['emailConfirmation']) && $wppb_generalSettings['emailConfirmation'] == 'yes')) {
$user_signup = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_email = %s", $request_data['email']));
if (!empty($user_signup)) {
return __('This email is already reserved to be used soon.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
}
$users = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email']));
if (!empty($users)) {
if ($form_location == 'register') {
return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
if ($form_location == 'edit_profile') {
$current_user = wp_get_current_user();
foreach ($users as $user) {
if ($user->ID != $current_user->ID) {
return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
}
}
}
return $message;
}
开发者ID:DarussalamTech,项目名称:aims_prj,代码行数:31,代码来源:email.php
示例20: guessed
/**
* Guess values for the following fields
* - EMAIL
* - NAME
* - FNAME
* - LNAME
*
* @return array
*/
public function guessed()
{
$guessed = array();
$fields = $this->fields->all();
foreach ($fields as $field => $value) {
// is this an email value? assume email field
if (empty($guessed['EMAIL']) && is_string($value) && is_email($value)) {
$guessed['EMAIL'] = $value;
continue;
}
// remove special characters from field name
$simple_key = str_replace(array('-', '_'), '', $field);
if (empty($guessed['NAME']) && in_array($simple_key, array('NAME', 'YOURNAME', 'USERNAME', 'FULLNAME', 'CONTACTNAME'))) {
// find name field
$guessed['NAME'] = $value;
} elseif (empty($guessed['FNAME']) && in_array($simple_key, array('FIRSTNAME', 'FNAME', 'GIVENNAME', 'FORENAME'))) {
// find first name field
$guessed['FNAME'] = $value;
} elseif (empty($guessed['LNAME']) && in_array($simple_key, array('LASTNAME', 'LNAME', 'SURNAME', 'FAMILYNAME'))) {
// find last name field
$guessed['LNAME'] = $value;
}
}
return $guessed;
}
开发者ID:CAYdenberg,项目名称:mailchimp-for-wordpress,代码行数:34,代码来源:class-field-guesser.php
注:本文中的is_email函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论