You are here

public function LikeBtn::timeToSyncVotes in Like Button 8.2

Same name and namespace in other branches
  1. 7 likebtn.php \LikeBtn::timeToSyncVotes()

Check if it is time to sync votes.

1 call to LikeBtn::timeToSyncVotes()
LikeBtn::runSyncVotes in ./likebtn.php
Running votes synchronization.

File

./likebtn.php, line 38
LikeBtn like button.

Class

LikeBtn

Code

public function timeToSyncVotes($sync_period) {
  $last_sync_time = variable_get('likebtn_last_sync_time', 0);
  $now = time();
  if (!$last_sync_time) {
    variable_set('likebtn_last_sync_time', $now);
    self::$synchronized = TRUE;
    return TRUE;
  }
  else {
    if ($last_sync_time + $sync_period > $now) {
      return FALSE;
    }
    else {
      variable_set('likebtn_last_sync_time', $now);
      self::$synchronized = TRUE;
      return TRUE;
    }
  }
}