You are here

function multiple_email_var_replace in Multiple E-mail Addresses 6

Same name and namespace in other branches
  1. 5 multiple_email.module \multiple_email_var_replace()
  2. 7 multiple_email.module \multiple_email_var_replace()
  3. 2.x multiple_email.module \multiple_email_var_replace()

Replaces various tokens with their value

Valid tokens: !username (User's username) !site (Site's name) !email (E-mail address in question) !confirm_code (E-mail's confirmation code) !confirm_url (URL to confirmation page for address) !confirm_deadline (Human-readable time within which to confirm)

Parameters

string $text:

object $account:

object $email:

Return value

string

1 call to multiple_email_var_replace()
multiple_email_message_part in ./multiple_email.module
Returns the part of the specified e-mail message based on site settings.

File

./multiple_email.module, line 743
multiple_email module file

Code

function multiple_email_var_replace($text, $account, $email) {
  $deadline = variable_get('multiple_email_confirm_deadline', 5);
  $vars = array(
    '!username' => $account->name,
    '!email' => $email->email,
    '!site' => variable_get('site_name', 'our web site'),
    '!confirm_code' => $email->confirm_code,
    '!confirm_url' => url('user/' . $email->uid . '/edit/email-addresses/confirm/' . $email->eid . '/' . $email->confirm_code, array(
      'absolute' => TRUE,
    )),
    '!confirm_deadline' => $deadline ? format_plural($deadline, t('1 day'), t('@days days', array(
      '@days' => $deadline,
    ))) : t('unlimited days'),
  );
  return str_ireplace(array_keys($vars), array_values($vars), $text);
}