You are here

function multiple_email_var_replace in Multiple E-mail Addresses 5

Same name and namespace in other branches
  1. 6 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 (Email address in question) !confirm_code (Email'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 email message based on site settings.

File

./multiple_email.module, line 590
multiple_email module file

Code

function multiple_email_var_replace($text, $account, $email) {
  $vars = array(
    '!username' => $account->name,
    '!email' => $email->email,
    '!site' => variable_get('site_name', 'our web site'),
    '!confirm_code' => $email->confirm_code,
    '!confirm_url' => url("my-email-addresses/confirm/{$email->eid}/{$email->confirm_code}", null, null, true),
    '!confirm_deadline' => variable_get('multiple_email_confirm_deadline', 5) . ' days',
  );
  return str_ireplace(array_keys($vars), array_values($vars), $text);
}