You are here

function _dfp_prepare_tokens in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 dfp.module \_dfp_prepare_tokens()

Prepare token replacement values.

Parameters

(optional) object $tag:

Return value

array

1 call to _dfp_prepare_tokens()
dfp_token_replace in ./dfp.module
Replaces all tokens in a given string with appropriate values, with caching.

File

./dfp.module, line 858

Code

function _dfp_prepare_tokens($tag = NULL) {
  global $user;
  $data = array();
  $data['user'] = $user;
  $data['node'] = menu_get_object();

  // We cannot use menu_get_object because the views version of the taxonomy
  // term pages will not work properly.
  $data['term'] = arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) ? taxonomy_term_load(arg(2)) : NULL;
  if (!empty($tag)) {
    $data['tag'] = $tag;
  }
  return $data;
}