function shurly_save_url in ShURLy 7
Same name and namespace in other branches
- 8 shurly.module \shurly_save_url()
- 6 shurly.module \shurly_save_url()
API function to save a URL @arg $custom is a TRUE/FALSE
2 calls to shurly_save_url()
- shurly_create_form_submit in ./
shurly.module - Submission 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 799 - description http://www.youtube.com/watch?v=Qo7qoonzTCE
Code
function shurly_save_url($long_url, $short_path, $account = NULL, $custom = NULL) {
if (is_null($account)) {
$account = $GLOBALS['user'];
}
$record = array();
$record['destination'] = $long_url;
$record['hash'] = md5($long_url);
$record['custom'] = $custom ? 1 : 0;
$record['created'] = time();
$record['source'] = $short_path;
$record['uid'] = $account->uid;
$record['count'] = $record['last_used'] = 0;
$record['active'] = 1;
return drupal_write_record('shurly', $record);
}