You are here

function _twitter_replace_tokens in Twitter 6.2

This function exists because we have an extra-special shorturl token whose value should only be generated if the token is used. This problem goes away in D7's on-demand token system.

1 call to _twitter_replace_tokens()
twitter_nodeapi in ./twitter.module
Implementation of hook_nodeapi().

File

./twitter.inc, line 569
A wrapper API for the Twitter microblogging service.

Code

function _twitter_replace_tokens($text, $node) {
  if (module_exists('token')) {
    $full = token_get_values('node', $node);
    if (strstr($text, '[shorturl]') !== FALSE) {
      $full->tokens[] = '[shorturl]';
      $full->values[] = twitter_shorten_url(url('node/' . $node->nid, array(
        'absolute' => TRUE,
      )));
    }
    return _token_replace_tokens($text, $full->tokens, $full->values);
  }
}