You are here

function twitter_shorten_url in Twitter 7.4

Same name and namespace in other branches
  1. 6.5 twitter.module \twitter_shorten_url()
  2. 6.2 twitter.module \twitter_shorten_url()
  3. 6.3 twitter.module \twitter_shorten_url()
  4. 6.4 twitter.module \twitter_shorten_url()
  5. 7.6 twitter.module \twitter_shorten_url()
  6. 7.3 twitter.module \twitter_shorten_url()
  7. 7.5 twitter.module \twitter_shorten_url()

Very lightweight helper function to generate a TinyURL for a given post.

2 calls to twitter_shorten_url()
twitter_actions_set_status_action in twitter_actions/twitter_actions.module
Implementation of a configurable Twitter action. @todo Implementation for language negotiation for the body and sumary. Also need implementation for bodies with multiple values. Right now it is hard coded and it will only get body and summary for…
twitter_post_node_insert in twitter_post/twitter_post.module
Implementation of hook_node_insert().

File

./twitter.module, line 116
Provides API integration with the Twitter microblogging service.

Code

function twitter_shorten_url($url) {
  if (module_exists('shorten')) {
    return shorten_url($url);
  }
  else {
    $response = drupal_http_request(variable_get('twitter_tinyurl', TWITTER_TINYURL) . "/api-create.php?url=" . $url);
    if ($response->code == 200) {
      return $response->data;
    }
    else {
      return $url;
    }
  }
}