本文整理汇总了PHP中JMailHelper::isEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP JMailHelper::isEmailAddress方法的具体用法?PHP JMailHelper::isEmailAddress怎么用?PHP JMailHelper::isEmailAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMailHelper
的用法示例。
在下文中一共展示了JMailHelper::isEmailAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remindUsername
/**
* Takes a user supplied e-mail address, looks
* it up in the database to find the username
* and then e-mails the username to the e-mail
* address given.
*
* @since 1.5
* @param string E-mail address
* @return bool True on success/false on failure
*/
function remindUsername($email)
{
jimport('joomla.mail.helper');
global $mainframe;
// Validate the e-mail address
if (!JMailHelper::isEmailAddress($email)) {
$message = JText::_('INVALID_EMAIL_ADDRESS');
$this->setError($message);
UserHelper::showMessage(ERROR, $message);
return false;
}
$db =& JFactory::getDBO();
$db->setQuery('SELECT username FROM #__users WHERE email = ' . $db->Quote($email), 0, 1);
// Get the username
if (!($username = $db->loadResult())) {
$message = JText::_('COULD_NOT_FIND_EMAIL');
$this->setError($message);
UserHelper::showMessage(ERROR, $message);
return false;
}
// Push the email address into the session
$mainframe->setUserState($this->_namespace . 'email', $email);
// Send the reminder email
if (!$this->_sendReminderMail($email, $username)) {
return false;
}
return true;
}
示例2: prepareDisplayedData
/**
*
* Get data
* @param Array $pk
*/
public function prepareDisplayedData($pk)
{
$data = null;
$params = $this->getState('params');
// Get some data from the models
$state = $this->getState();
$items = $this->getItems();
$pagination = $this->getPagination();
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadString($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = $item->email_to;
} else {
$item->email_to = '';
}
}
}
$JSNConfig = JSNFactory::getConfig();
$JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
$JSNConfig->megreGlobalParams('com_contact', $params, true);
$maxLevel = $params->get('maxLevel', -1);
$data->maxLevel = $maxLevel;
$data->state = $state;
$data->items = $items;
$data->params = $params;
$data->pagination = $pagination;
return $data;
}
示例3: changeEmail
function changeEmail()
{
// Initialise the App variables
$app = JFactory::getApplication();
if ($app->isAdmin()) {
$json = array();
$model = $this->getThisModel();
// Assign the get Id to the Variable
$email_id = $app->input->getString('email');
$new_email = $app->input->getString('new_email');
if (empty($new_email) && !JMailHelper::isEmailAddress($new_email)) {
$json = array('msg' => JText::_('Invalid Email Address'), 'msgType' => 'warning');
} else {
//incase an account already exists ?
if ($app->input->getString('task') == 'changeEmail') {
$json = array('msg' => JText::_('J2STORE_EMAIL_UPDATE_NO_WARNING'), 'msgType' => 'message');
$json = $this->validateEmailexists($new_email);
} elseif ($app->input->getString('task') == 'confirmchangeEmail') {
$json = array('redirect' => JUri::base() . 'index.php?option=com_j2store&view=customer&task=viewOrder&email_id=' . $new_email, 'msg' => JText::_('J2STORE_SUCCESS_SAVING_EMAIL'), 'msgType' => 'message');
if (!$model->savenewEmail()) {
$json = array('msg' => JText::_('J2STORE_ERROR_SAVING_EMAIL'), 'msgType' => 'warning');
}
}
}
echo json_encode($json);
$app->close();
}
}
示例4: requestReset
/**
* Verifies the validity of a username/e-mail address
* combination and creates a token to verify the request
* was initiated by the account owner. The token is
* sent to the account owner by e-mail
*
* @since 1.5
* @param string Username string
* @param string E-mail address
* @return bool True on success/false on failure
*/
function requestReset($email)
{
jimport('joomla.mail.helper');
jimport('joomla.user.helper');
$db =& JFactory::getDBO();
// Make sure the e-mail address is valid
if (!JMailHelper::isEmailAddress($email)) {
$this->setError(JText::_('INVALID_EMAIL_ADDRESS'));
return false;
}
// Build a query to find the user
$query = 'SELECT id FROM #__users' . ' WHERE email = ' . $db->Quote($email) . ' AND block = 0';
$db->setQuery($query);
// Check the results
if (!($id = $db->loadResult())) {
$this->setError(JText::_('COULD_NOT_FIND_USER'));
return false;
}
// Generate a new token
$token = JUtility::getHash(JUserHelper::genRandomPassword());
$salt = JUserHelper::getSalt('crypt-md5');
$hashedToken = md5($token . $salt) . ':' . $salt;
$query = 'UPDATE #__users' . ' SET activation = ' . $db->Quote($hashedToken) . ' WHERE id = ' . (int) $id . ' AND block = 0';
$db->setQuery($query);
// Save the token
if (!$db->query()) {
$this->setError(JText::_('DATABASE_ERROR'));
return false;
}
// Send the token to the user via e-mail
if (!$this->_sendConfirmationMail($email, $token)) {
return false;
}
return true;
}
示例5: validate_email_list
static function validate_email_list(&$email_list, $allow_blank = true)
{
$email_list = str_replace(' ', '', $email_list);
// remove spaces
$email_list = trim($email_list, ',');
// trim off any spare commas
if ($email_list == '') {
if ($allow_blank) {
$ret = '';
return $ret;
} else {
$ret = JText::_('COM_FLEXICONTACT_REQUIRED');
return $ret;
}
}
$email_list = strtolower($email_list);
// make all lower case for array_unique() call
$email_addresses = explode(',', $email_list);
// make it an array
$email_addresses = array_unique($email_addresses);
// remove any duplicates
$email_list = implode(',', $email_addresses);
// recreate the original email list to return
jimport('joomla.mail.helper');
foreach ($email_addresses as $address) {
if (!JMailHelper::isEmailAddress($address)) {
return '(' . $address . ')';
}
}
return '';
}
示例6: validateUser
public function validateUser()
{
try {
$email = JRequest::getVar('email', '', 'post', 'string');
if (!JMailHelper::isEmailAddress($email)) {
throw new Exception(JText::_('COM_AAWS_EMAIL_BAD_FORMAT'));
}
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Se valida unicamente mediante el correo, y se retorna el nombre de usuario para hacer el login
$query->select('id, name, username')->from('#__users')->where('email = ' . $db->Quote($email));
$db->setQuery($query);
$result = $db->loadObject();
if ($result != null && $result->id != 0) {
$answer = array('message' => JText::sprintf('COM_AAWS_USER_IDENTIFIED', $result->name), 'username' => $result->username, 'type' => 'info');
} else {
$answer = array('message' => '', 'type' => 'info');
}
echo json_encode($answer);
} catch (Exception $e) {
echo json_encode(array('message' => $e->getMessage(), 'type' => 'error'));
}
$app = JFactory::getApplication();
$app->close();
}
示例7: validemail
function validemail($emailid)
{
if (!JMailHelper::isEmailAddress($emailid)) {
return false;
} else {
return true;
}
}
示例8: display
/**
* Display the view
*
* @return mixed False on error, null otherwise.
*/
function display($tpl = null)
{
$comName = JRequest::getCmd('option');
$document =& JFactory::getDocument();
$app = JFactory::getApplication();
$params = $app->getParams();
//Check whether category access level allows access.
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
//Load resources
$document->addStyleSheet($this->baseurl . "/media/{$comName}/css/styles.css");
//Get some data from the models
$state = $this->get('State');
$items = $this->get('Items');
$category = $this->get('Category');
$children = $this->get('Children');
$parent = $this->get('Parent');
$pagination = $this->get('Pagination');
//Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
//Prepare the data
//Compute the contact slug
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadJSON($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = JHtml::_('email.cloak', $item->email_to);
} else {
$item->email_to = '';
}
}
}
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$maxLevel = $params->get('maxLevel', -1);
$this->assignRef('maxLevel', $maxLevel);
$this->assignRef('state', $state);
$this->assignRef('items', $items);
$this->assignRef('category', $category);
$this->assignRef('children', $children);
$this->assignRef('params', $params);
$this->assignRef('parent', $parent);
$this->assignRef('pagination', $pagination);
//define some few document params
$this->_prepareDocument();
//Display the view
parent::display($tpl);
}
示例9: process
/**
* do the plugin action
* @return number of records updated
*/
function process(&$data)
{
$app = JFactory::getApplication();
jimport('joomla.mail.helper');
$params = $this->getParams();
$msg = $params->get('message');
$to = $params->get('to');
$w = new FabrikWorker();
$MailFrom = $app->getCfg('mailfrom');
$FromName = $app->getCfg('fromname');
$subject = $params->get('subject', 'Fabrik cron job');
$eval = $params->get('cronemail-eval');
$condition = $params->get('cronemail_condition', '');
$updates = array();
foreach ($data as $group) {
if (is_array($group)) {
foreach ($group as $row) {
if (!empty($condition)) {
$this_condition = $w->parseMessageForPlaceHolder($condition, $row);
if (eval($this_condition === false)) {
continue;
}
}
$row = JArrayHelper::fromObject($row);
$thisto = $w->parseMessageForPlaceHolder($to, $row);
if (JMailHelper::isEmailAddress($thisto)) {
$thismsg = $w->parseMessageForPlaceHolder($msg, $row);
if ($eval) {
$thismsg = eval($thismsg);
}
$thissubject = $w->parseMessageForPlaceHolder($subject, $row);
$res = JUTility::sendMail( $MailFrom, $FromName, $thisto, $thissubject, $thismsg, true);
}
$updates[] = $row['__pk_val'];
}
}
}
$field = $params->get('cronemail-updatefield');
if (!empty( $updates) && trim($field ) != '') {
//do any update found
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId($params->get('table'));
$table = $listModel->getTable();
$connection = $params->get('connection');
$field = $params->get('cronemail-updatefield');
$value = $params->get('cronemail-updatefield-value');
$field = str_replace("___", ".", $field);
$query = "UPDATE $table->db_table_name set $field = " . $fabrikDb->Quote($value) . " WHERE $table->db_primary_key IN (" . implode(',', $updates) . ")";
$fabrikDb = $listModel->getDb();
$fabrikDb->setQuery($query);
$fabrikDb->query();
}
return count($updates);
}
示例10: prepareDisplayedData
/**
*
* Get data
*
* @param Array $pk
*/
public function prepareDisplayedData($pk)
{
$data = null;
jimport('joomla.application.categories');
$this->setState('category.id', $pk['id']);
$params = $this->getState('params');
// Get some data from the models
$state = $this->getState();
$items = $this->getItems();
$category = $this->getCategory();
$children = $this->getChildren();
$parent = $this->getParent();
$pagination = $this->getPagination();
// Check for errors.
if ($category == false) {
echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
}
if ($parent == false) {
echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND');
}
// Prepare the data.
// Compute the contact slug.
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadString($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = JHtml::_('email.cloak', $item->email_to);
} else {
$item->email_to = '';
}
}
}
// Setup the category parameters.
$cparams = $category->getParams();
$category->params = clone $params;
$category->params->merge($cparams);
$JSNConfig = JSNFactory::getConfig();
$JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact');
$JSNConfig->megreGlobalParams('com_contact', $params, true);
$children = array($category->id => $children);
$maxLevel = $params->get('maxLevel', -1);
$data->maxLevel = $maxLevel;
$data->state = $state;
$data->items = $items;
$data->category = $category;
$data->children = $children;
$data->params = $params;
$data->parent = $parent;
$data->pagination = $pagination;
return $data;
}
示例11: send
/**
* Sends a new share to a user.
*
* @since 1.0
* @access public
*/
public function send()
{
FD::checkToken();
$token = JRequest::getString('token', '');
$recipients = JRequest::getVar('recipients', array());
$content = JRequest::getVar('content', '');
// Get the current view.
$view = $this->getCurrentView();
// Cleaning
if (is_string($recipients)) {
$recipients = explode(',', FD::string()->escape($recipients));
}
if (is_array($recipients)) {
foreach ($recipients as &$recipient) {
$recipient = FD::string()->escape($recipient);
if (!JMailHelper::isEmailAddress($recipient)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_RECIPIENT'));
}
}
}
$content = FD::string()->escape($content);
// Check for valid data
if (empty($recipients)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_NO_RECIPIENTS'));
}
if (empty($token)) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_TOKEN'));
}
$session = JFactory::getSession();
$config = FD::config();
$limit = $config->get('sharing.email.limit', 0);
$now = FD::date()->toUnix();
$time = $session->get('easysocial.sharing.email.time');
$count = $session->get('easysocial.sharing.email.count');
if (is_null($time)) {
$session->set('easysocial.sharing.email.time', $now);
$time = $now;
}
if (is_null($count)) {
$session->set('easysocial.sharing.email.count', 0);
}
$diff = $now - $time;
if ($diff <= 3600) {
if ($limit > 0 && $count >= $limit) {
return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_SHARING_LIMIT_MAXED'));
}
$count++;
$session->set('easysocial.sharing.email.count', $count);
} else {
$session->set('easysocial.sharing.email.time', $now);
$session->set('easysocial.sharing.email.count', 1);
}
$library = FD::get('Sharing');
$library->sendLink($recipients, $token, $content);
$view->call(__FUNCTION__, true);
}
示例12: validateData
/**
* @see plugins/tienda/payment_paypalpro/library/plgTiendaPayment_Paypalpro_Processor#validateData()
*/
function validateData()
{
/*
* perform initial checks
*/
if (!count($this->_data)) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_NO_DATA_IS_PROVIDED'));
return false;
}
if (!JRequest::checkToken()) {
$this->setError(JText::_('COM_TIENDA_INVALID_TOKEN'));
return false;
}
// if (!$this->getSubscrTypeObj()) {
// $this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_INVALID_ITEM_TYPE'));
// return false;
// }
if (!$this->_getParam('api_username') || !$this->_getParam('api_password') || !$this->_getParam('api_signature')) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_MERCHANT_CREDENTIALS_ARE_INVALID'));
return false;
}
/*
* do form verification to make sure information is both present and valid
*/
// check required fields
foreach ($this->_required as $required_field) {
if (empty($this->_data[$required_field])) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_FILL_IN_REQUIRED_FIELDS'));
return false;
}
}
// check some specific fields
if (JString::strlen($this->_data['state']) != 2) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_STATE_INVALID'));
return false;
}
$user = JFactory::getUser();
if (!$user->id) {
// require email address for guest users
jimport('joomla.mail.helper');
if (empty($this->_data['email']) || !JMailHelper::isEmailAddress($this->_data['email'])) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_EMAIL_ADDRESS_REQUIRED'));
return false;
}
if (TiendaHelperUser::emailExists($this->_data['email'])) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_EMAIL_EXISTS'));
return false;
}
}
if (JString::strlen($this->_data['cardexp_month']) != 2 || JString::strlen($this->_data['cardexp_year']) != 4) {
$this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_EXPIRATION_DATE_INVALID='));
return false;
}
return true;
}
示例13: display
/**
* Display the view
*
* @return mixed False on error, null otherwise.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
// Get some data from the models
$state = $this->get('State');
$items = $this->get('Items');
$category = $this->get('Category');
$children = $this->get('Children');
$parent = $this->get('Parent');
$pagination = $this->get('Pagination');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Check whether category access level allows access.
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
// Prepare the data.
// Compute the contact slug.
for ($i = 0, $n = count($items); $i < $n; $i++) {
$item =& $items[$i];
$item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
$temp = new JRegistry();
$temp->loadString($item->params);
$item->params = clone $params;
$item->params->merge($temp);
if ($item->params->get('show_email', 0) == 1) {
$item->email_to = trim($item->email_to);
if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) {
$item->email_to = JHtml::_('email.cloak', $item->email_to);
} else {
$item->email_to = '';
}
}
}
// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
$maxLevel = $params->get('maxLevel', -1);
$this->maxLevel =& $maxLevel;
$this->state =& $state;
$this->items =& $items;
$this->category =& $category;
$this->children =& $children;
$this->params =& $params;
$this->parent =& $parent;
$this->pagination =& $pagination;
$this->_prepareDocument();
parent::display($tpl);
}
示例14: check
public function check()
{
// get fieldtype
$q = ' SELECT fieldtype FROM #__rwf_fields WHERE id = ' . $this->_db->Quote($this->field_id);
$this->_db->setQuery($q, 0, 1);
$fieldtype = $this->_db->loadResult();
if ($fieldtype == 'recipients') {
jimport('joomla.mail.helper');
if (!JMailHelper::isEmailAddress($this->value)) {
$this->setError(JText::_('COM_REDFORM_INVALID_EMAIL_FORMAT'));
return false;
}
}
return true;
}
示例15: check
function check()
{
if (JFilterInput::checkAttribute(array('href', $this->website))) {
$this->setError(JText::_('Please provide a valid URL'));
return false;
}
// check for http on website
if (strlen($this->website) > 0 && !(eregi('http://', $this->website) || eregi('https://', $this->website) || eregi('ftp://', $this->website))) {
$this->website = 'http://' . $this->website;
}
if (!JMailHelper::isEmailAddress($this->emailid)) {
$this->setError(JText::_('Please provide a valid EmailID for company.'));
return false;
}
return true;
}