function twitter_shorten_url in Twitter 6.4
Same name and namespace in other branches
- 6.5 twitter.module \twitter_shorten_url()
- 6.2 twitter.module \twitter_shorten_url()
- 6.3 twitter.module \twitter_shorten_url()
- 7.6 twitter.module \twitter_shorten_url()
- 7.3 twitter.module \twitter_shorten_url()
- 7.4 twitter.module \twitter_shorten_url()
- 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 Drupal action. Sends an email.
- twitter_nodeapi in twitter_post/
twitter_post.module - Implementation of hook_nodeapi().
File
- ./
twitter.module, line 110 - Establishes an interface to communicate with Twitter
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;
}
}
}