function submitted_by_do_replace in Submitted By 7
Helper function to call token_replace().
4 calls to submitted_by_do_replace()
- submitted_by_comment_view in ./
submitted_by.module  - Implements hook_comment_view().
 - submitted_by_node_view in ./
submitted_by.module  - Implements hook_node_view().
 - submitted_by_process_comment in ./
submitted_by.module  - Implements hook_process_comment().
 - submitted_by_process_node in ./
submitted_by.module  - Implements hook_process_node().
 
File
- ./
submitted_by.module, line 150  - Take over the "Submitted by" theme function.
 
Code
function submitted_by_do_replace($entity, $view_mode = '', $entity_type = 'node') {
  global $language;
  $output = NULL;
  // Suppress un-replaced tokens.
  $options = array(
    'clear' => TRUE,
    'language' => $language,
  );
  if ($entity_type == 'node') {
    $submitted_by = variable_get('submitted_by_' . $entity->type, array());
    if ($submitted_by && !empty($submitted_by[$view_mode])) {
      // Translate the string, then get node tokens.
      $output = token_replace(t($submitted_by[$view_mode]), array(
        'node' => $entity,
      ), $options);
    }
  }
  else {
    $submitted_by = variable_get('submitted_by_' . $entity->node_type, array());
    if ($submitted_by && !empty($submitted_by)) {
      $output = token_replace(t($submitted_by), array(
        'comment' => $entity,
      ), $options);
    }
  }
  return $output;
}