You are here

function _favorites_load_favorite_cookie in Favorites 7.2

Same name and namespace in other branches
  1. 7 favorites.module \_favorites_load_favorite_cookie()

Helper function: Load a single favorite from the user's cookies.

Used to abstract the storage model (cookie vs. db).

Parameters

$fid: The favorite's ID.

Return value

object|bool The favorite, if found in the DB. Otherwise FALSE.

See also

favorite_load().

1 call to _favorites_load_favorite_cookie()
favorite_load in ./favorites.module
Helper function to load a favorite.

File

./favorites.module, line 607
The favorites module allows users to bookmark any path within a site.

Code

function _favorites_load_favorite_cookie($fid) {
  $cookie_id = 'Drupal_visitor_favorites_' . $fid;
  if (!empty($_COOKIE[$cookie_id])) {
    return _favorites_parse_cookie($fid, $_COOKIE[$cookie_id]);
  }
  else {
    return FALSE;
  }
}