You are here

function notifications_digest_method in Notifications 5

Same name and namespace in other branches
  1. 6 notifications.module \notifications_digest_method()
  2. 6.2 notifications.module \notifications_digest_method()

Information about digesting method for a send interval.

Return value

array() Ditest information for that interval, or all the information if no interval

3 calls to notifications_digest_method()
notifications_process_send in ./notifications.cron.inc
Message delivery.
notifications_send_intervals_form in ./notifications.admin.inc
Send intervals administration
Notifications_Templates_Tests::testNotificationsTemplateAPI in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions

File

./notifications.module, line 1026
Notifications module

Code

function notifications_digest_method($send_interval = NULL, $refresh = FALSE) {
  static $digest_methods, $intervals;
  if (!isset($digest_methods) || $refresh) {

    // Method information
    foreach (notifications_module_information('digest methods') as $method) {
      $digest_methods[$method['type']] = $method;
    }

    // Mapping interval -> method
    $intervals = variable_get('notifications_digest_methods', array());
  }
  if (is_null($send_interval)) {
    return $digest_methods;
  }
  elseif (!empty($intervals[$send_interval]) && isset($digest_methods[$intervals[$send_interval]])) {
    return $digest_methods[$intervals[$send_interval]];
  }
  else {

    // Default, that will be 'short' if interval > 0, none otherwise
    return $send_interval > 0 ? $digest_methods['short'] : NULL;
  }
}