You are here

function facebook_wall_get_expiry in Facebook Wall 7

Function for getting the expiry time of the User Access Token.

1 call to facebook_wall_get_expiry()
facebook_wall_settings_form in ./facebook_wall.admin.inc
Admin configure form for Facebook login & token access.

File

./facebook_wall.admin.inc, line 390
Contains the administrative functions of the Facebook Wall fetcher module.

Code

function facebook_wall_get_expiry() {
  $suffix = " Minutes";
  $time_diff = time() - variable_get('facebook_wall_access_token_start');
  $rem_time = variable_get('facebook_wall_access_token_expiry') - $time_diff;
  $time_remaining = (int) ($rem_time / 60);
  if ($time_remaining <= 0) {
    _facebook_wall_reset_token();
  }
  if ($time_remaining > 60) {
    $time_remaining = $time_remaining / 60;
    $suffix = " Hours";
    if ($time_remaining > 24) {
      $time_remaining = $time_remaining / 24;
      $suffix = " Days";
    }
  }
  $time_left['time'] = (int) $time_remaining;
  $time_left['suffix'] = $suffix;
  return $time_left;
}