You are here

function shurly_get_latest_short in ShURLy 7

Same name and namespace in other branches
  1. 8 shurly.module \shurly_get_latest_short()
  2. 6 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()
shurly_create_form_validate in ./shurly.module
Validation of the main form
shurly_shorten in ./shurly.module
API function to shorten a URL @arg $long_url - the long URL to shorten @arg $custom - optional custom short URL

File

./shurly.module, line 1095
description http://www.youtube.com/watch?v=Qo7qoonzTCE

Code

function shurly_get_latest_short($long, $uid) {
  $hash = md5($long);
  return db_query("SELECT source FROM {shurly} WHERE hash = :hash AND uid = :uid AND custom = 0 AND active = 1 ORDER BY rid DESC LIMIT 1", array(
    'hash' => $hash,
    'uid' => $uid,
  ))
    ->fetchField();
}