function commerce_wishlist_generate_url_hash in Commerce Wishlist 7.3
Generate a short URL "hash" for a given wish list.
Parameters
object $wishlist: The wish list object.
Return value
string A hash of 8 characters, in base36. Not guaranteed to be unique.
1 call to commerce_wishlist_generate_url_hash()
- commerce_wishlist_add_wishlist_url in ./
commerce_wishlist.module - Create and store a shareable URL for a given wish list.
File
- ./
commerce_wishlist.module, line 1273 - Provides a wish list for use in Drupal Commerce.
Code
function commerce_wishlist_generate_url_hash($wishlist) {
return substr(base_convert(hash('sha256', serialize(array(
$wishlist->order_id,
$wishlist->mail,
$wishlist->created,
$wishlist->changed,
time(),
))), 16, 36), 0, COMMERCE_WISHLIST_HASH_LENGTH);
}