function drupagram_shorten_url in Drupagram 7
Very lightweight helper function to generate a TinyURL for a given post.
1 call to drupagram_shorten_url()
- drupagram_actions_set_status_action in drupagram_actions/
drupagram_actions.module - Implementation of a configurable Instagram actions. @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…
File
- ./
drupagram.module, line 152 - Provides API integration with the Instagram microblogging service.
Code
function drupagram_shorten_url($url) {
if (module_exists('shorten')) {
return shorten_url($url);
}
else {
$conf = InstagramConf::instance();
$response = drupal_http_request("http://" . $conf
->get('tiny_url') . "/api-create.php?url=" . $url);
if ($response->code == 200) {
return $response->data;
}
else {
return $url;
}
}
}