Example #1
0
 /**
  * Invokes hook_mostpopular_service('throttles') on the given service to get
  * the default throttles to use for the currently-configured intervals.
  *
  * @param integer $sid
  *   The service ID.
  * @return array
  *   An array, hashed by $sid and by $iid, of the default throttle
  *   strtotime() strings.
  */
 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;
 }