You are here

public function LikeBtn::timeToSync in Like Button 7

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

Check if it is time to sync locales.

2 calls to LikeBtn::timeToSync()
LikeBtn::runSyncLocales in ./likebtn.php
Run locales synchronization.
LikeBtn::runSyncStyles in ./likebtn.php
Run styles synchronization.

File

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

Class

LikeBtn

Code

public function timeToSync($sync_period, $sync_variable) {
  $last_sync_time = variable_get($sync_variable, 0);
  $now = time();
  if (!$last_sync_time) {
    variable_set($sync_variable, $now);
    return TRUE;
  }
  else {
    if ($last_sync_time + $sync_period > $now) {
      return FALSE;
    }
    else {
      variable_set($sync_variable, $now);
      return TRUE;
    }
  }
}