You are here

function _cronMonDaysFromWeekDays in Elysia Cron 7.2

Same name and namespace in other branches
  1. 5.2 elysia_cron_scheduler_old.inc \_cronMonDaysFromWeekDays()
  2. 5 elysia_cron_scheduler_old.inc \_cronMonDaysFromWeekDays()
  3. 6.2 elysia_cron_scheduler_old.inc \_cronMonDaysFromWeekDays()
  4. 6 elysia_cron_scheduler_old.inc \_cronMonDaysFromWeekDays()
  5. 7 elysia_cron_scheduler_old.inc \_cronMonDaysFromWeekDays()

Helper function for _elysia_cron_next_run().

1 call to _cronMonDaysFromWeekDays()
_cronDecodeRuleMday in ./elysia_cron_scheduler.inc
Helper function for _elysia_cron_next_run().

File

./elysia_cron_scheduler.inc, line 187
Schedules cron runs.

Code

function _cronMonDaysFromWeekDays($year, $mon, $weekdays, $offset = 0) {
  if ($mon > 12) {
    $year++;
    $mon = $mon - 12;
  }
  $result = array();
  for ($i = 1; checkdate($mon, $i, $year); $i++) {
    $w = date('w', mktime(12, 00, 00, $mon, $i, $year));
    if (in_array($w, $weekdays)) {
      $result[] = $i + $offset;
    }
  }
  return $result;
}