You are here

function mostpopular_addthis_next_run in Drupal Most Popular 7

Implements the 'next_run' callback for the AddThis emailed mostpopular service.

Returns the timestamp at which to next refresh the data for this interval.

Parameters

array $service The service definition:

integer $span The number of seconds representing the current interval.:

integer $last_run The timestamp at which this service was last run for this interval.:

File

modules/mostpopular_addthis/mostpopular_addthis.module, line 194
Uses the AddThis.com Analytics API to provide Most Popular data.

Code

function mostpopular_addthis_next_run($service, $span, $last_run) {

  // If the interval is 2 days or less, refresh once per hour
  if ($span <= 60 * 60 * 24 * 2) {
    return strtotime('1 hour', $last_run);
  }
  elseif ($span >= 60 * 60 * 24 * 365) {
    return strtotime('1 week', $last_run);
  }

  // Otherwise, refresh once per day.
  return strtotime('1 day', $last_run);
}