You are here

function simplenews_replace_vars in Simplenews 5

2 calls to simplenews_replace_vars()
simplenews_node_prepare in ./simplenews.module
Prepare node for sending
simplenews_view in ./simplenews.module
Implementation of hook_view().

File

./simplenews.module, line 2691

Code

function simplenews_replace_vars($node, $teaser = TRUE) {
  global $base_url;
  $user_mail = db_result(db_query('SELECT mail FROM {users} WHERE uid = %d', $node->uid));
  $variables = array(
    '%site' => variable_get('site_name', 'drupal'),
    '%uri' => $base_url,
    '%uri_brief' => drupal_substr($base_url, drupal_strlen('http://')),
    '%mymail' => $user_mail,
    '%date' => format_date(time()),
    '%login_uri' => url('user/login', NULL, NULL, TRUE),
  );
  $node->body = strtr($node->body, $variables);
  if ($teaser) {
    $node->teaser = strtr($node->teaser, $variables);
  }
  return $node;
}