function _dfp_token_replace_make_key in Doubleclick for Publishers (DFP) 7
Same name and namespace in other branches
- 7.2 dfp.module \_dfp_token_replace_make_key()
Generates an identifying key for the lookup to be processed.
Parameters
string $text: The text to be processed.
array $data: The array of data parameters that will be passed to token_generate(). We'll use knowledge of what is expected in that array to build a meaningful lookup key.
Return value
string The key in the lookup array that corresponds to this tokenization request.
1 call to _dfp_token_replace_make_key()
- _dfp_token_replace_cache in ./
dfp.module - Helper to store and retrieve tokens from cache.
File
- ./
dfp.module, line 948
Code
function _dfp_token_replace_make_key($text, array $data) {
// $text may be arbitrarily long, which can slow-down lookups. Hashing it
// keeps uniqueness but guarantees a manageable size. Since this value won't
// be used as the cache key itself we're not limited to 255 characters but
// it will be nicer on array lookups in PHP.
$keys[] = sha1($text);
$keys[] = isset($data['node']->nid) ? $data['node']->nid . '-' . entity_modified_last('node', $data['node']) : NULL;
$keys[] = isset($data['user']->uid) ? $data['user']->uid . '-' . entity_modified_last('user', $data['user']) : NULL;
$keys[] = isset($data['term']->tid) ? $data['term']->tid . '-' . entity_modified_last('taxonomy_term', $data['term']) : NULL;
$keys[] = isset($data['tag']->machinename) ? $data['tag']->machinename . '-' . entity_modified_last('tag', $data['tag']) : NULL;
return implode('|', array_filter($keys));
}