function shurly_get_redirect in ShURLy 7
Same name and namespace in other branches
- 8 shurly.module \shurly_get_redirect()
- 6 shurly.module \shurly_get_redirect()
Given the short URL, return the long one NOTE: Always check $redirect->active before using the result
2 calls to shurly_get_redirect()
- shurly_expand in ./
shurly.module - Function to get the long url.
- shurly_url_exists in ./
shurly.module - Check to see if this short URL already exists
File
- ./
shurly.module, line 1083 - description http://www.youtube.com/watch?v=Qo7qoonzTCE
Code
function shurly_get_redirect($short_url, $check_active = FALSE) {
$query = "SELECT * FROM {shurly} WHERE source = :short";
if ($check_active) {
$query .= ' AND active = 1';
}
$redirect = db_query($query, array(
'short' => $short_url,
))
->fetchObject();
return $redirect;
}