You are here

function __cronMonDaysFromWeekDays in Elysia Cron 7

Same name and namespace in other branches
  1. 5.2 elysia_cron_scheduler.inc \__cronMonDaysFromWeekDays()
  2. 5 elysia_cron_scheduler.inc \__cronMonDaysFromWeekDays()
  3. 6.2 elysia_cron_scheduler.inc \__cronMonDaysFromWeekDays()
  4. 6 elysia_cron_scheduler.inc \__cronMonDaysFromWeekDays()
1 call to __cronMonDaysFromWeekDays()
__cronDecodeRuleMday in ./elysia_cron_scheduler.inc

File

./elysia_cron_scheduler.inc, line 148

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;
}