function shurly_get_latest_short in ShURLy 8
Same name and namespace in other branches
- 6 shurly.module \shurly_get_latest_short()
- 7 shurly.module \shurly_get_latest_short()
Get the latest generated short URL by a given user for a given long URL.
2 calls to shurly_get_latest_short()
- ShurlyCreateForm::validateForm in src/
Form/ ShurlyCreateForm.php - Form validation handler.
- shurly_shorten in ./
shurly.module - API function to shorten a URL.
File
- ./
shurly.module, line 603 - Description http://www.youtube.com/watch?v=Qo7qoonzTCE.
Code
function shurly_get_latest_short($long, $uid) {
$hash = md5($long);
return \Drupal::database()
->query("SELECT source FROM {shurly} WHERE hash = :hash AND uid = :uid AND custom = 0 AND active = 1 ORDER BY rid DESC LIMIT 1", [
'hash' => $hash,
'uid' => $uid,
])
->fetchField();
}