public static function MostPopularLastRun::getDefaultThrottles in Drupal Most Popular 6
Same name and namespace in other branches
- 7 classes/lastrun.php \MostPopularLastRun::getDefaultThrottles()
Invokes hook_mostpopular_service('throttles') on the given service to get the default throttles to use for the currently-configured intervals.
Parameters
integer $sid: The service ID.
Return value
array An array, hashed by $sid and by $iid, of the default throttle strtotime() strings.
2 calls to MostPopularLastRun::getDefaultThrottles()
- MostPopularLastRun::MostPopularLastRun in classes/
lastrun.php - Constructs a new MostPopularLastRun object, only used internally.
- MostPopularLastRun::resetThrottles in classes/
lastrun.php - Resets the throttles for the given service to the defaults.
File
- classes/
lastrun.php, line 141 - Defines a wrapper for the mostpopular_last_run table.
Class
- MostPopularLastRun
- @file Defines a wrapper for the mostpopular_last_run table.
Code
public static function getDefaultThrottles($sid) {
if (!isset(self::$default_throttles[$sid])) {
$service = MostPopularService::fetch($sid);
$intervals = MostPopularInterval::fetchAll();
$options = array();
foreach ($intervals as $interval) {
$options[$interval->iid] = $interval
->timestamp();
}
$out = module_invoke($service->module, 'mostpopular_service', 'throttles', $service->delta, $options);
foreach ($intervals as $interval) {
if (!isset($out[$interval->iid])) {
$out[$interval->iid] = '';
}
}
self::$default_throttles[$sid] = $out;
}
return self::$default_throttles;
}