function shurly_expand in ShURLy 7
Same name and namespace in other branches
- 8 shurly.module \shurly_expand()
- 6 shurly.module \shurly_expand()
Function to get the long url.
1 call to shurly_expand()
- shurly_service_expand in shurly_service/
shurly_service.inc - Callback for shurly/api/shorten
File
- ./
shurly.module, line 715 - description http://www.youtube.com/watch?v=Qo7qoonzTCE
Code
function shurly_expand($short, $account = NULL) {
global $base_url;
$error = '';
$success = FALSE;
$rate_limit = shurly_rate_limit_allowed($account);
if (!$rate_limit['allowed']) {
$error = t('Rate limit exceeded. You are limited to @rate requests per @time minute period.', array(
'@rate' => $rate_limit['rate'],
'@time' => $rate_limit['time'],
));
}
elseif ($redirect = shurly_get_redirect($short, TRUE)) {
$success = TRUE;
$long_url = $redirect->destination;
}
else {
$error = t('Not found');
}
return array(
'success' => $success,
'error' => $error,
'longUrl' => $long_url,
'shortUrl' => _surl($short, array(
'absolute' => TRUE,
'base_url' => variable_get('shurly_base', $base_url),
)),
);
}