The Token API has also had several new methods added to it to make creation of tokens easier as well as making it possible to change tokens defined by other modules. Let's look at each new method in detail.
hook_tokens($type, $tokens, array $data = array(), array $options = array())
This method is called to perform the actual translation of tokens from placeholders into the correct value for the text. The tokens
array will contain a list of all tokens that were found in the source text. You should return an associative array with the values for each token that your module defines. For more information on translating tokens as well as the options available, see: http://api.drupal.org/api/function/hook_tokens/7.