Changeset View
Changeset View
Standalone View
Standalone View
src/parser/calendar/data/PhutilCalendarRecurrenceRule.php
Show First 20 Lines • Show All 566 Lines • ▼ Show 20 Lines | protected function nextMonth() { | ||||
$by_month = $this->getByMonth(); | $by_month = $this->getByMonth(); | ||||
$by_setpos = $this->getBySetPosition(); | $by_setpos = $this->getBySetPosition(); | ||||
// If we have a BYMONTHDAY, we consider that set of days in every month. | // If we have a BYMONTHDAY, we consider that set of days in every month. | ||||
// For example, "FREQ=YEARLY;BYMONTHDAY=3" means "the third day of every | // For example, "FREQ=YEARLY;BYMONTHDAY=3" means "the third day of every | ||||
// month", so we need to expand the month set if the constraint is present. | // month", so we need to expand the month set if the constraint is present. | ||||
$by_monthday = $this->getByMonthDay(); | $by_monthday = $this->getByMonthDay(); | ||||
// Likewise, we need to generate all months if we have BYYEARDAY. | |||||
$by_yearday = $this->getByYearDay(); | |||||
while (!$this->setMonths) { | while (!$this->setMonths) { | ||||
$this->nextYear(); | $this->nextYear(); | ||||
if ($is_monthly || $by_month || $by_monthday) { | $is_dynamic = $is_monthly | ||||
|| $by_month | |||||
|| $by_monthday | |||||
|| $by_yearday | |||||
|| ($scale < self::SCALE_MONTHLY); | |||||
if ($is_dynamic) { | |||||
$months = $this->newMonthsSet( | $months = $this->newMonthsSet( | ||||
($is_monthly ? $interval : 1), | ($is_monthly ? $interval : 1), | ||||
$by_month); | $by_month); | ||||
} else if ($scale < self::SCALE_MONTHLY) { | |||||
$months = $this->newMonthsSet( | |||||
1, | |||||
array()); | |||||
} else { | } else { | ||||
$months = array( | $months = array( | ||||
$this->cursorMonth, | $this->cursorMonth, | ||||
); | ); | ||||
} | } | ||||
if ($is_monthly && $by_setpos) { | if ($is_monthly && $by_setpos) { | ||||
$months = $this->applySetPos($months, $by_setpos); | $months = $this->applySetPos($months, $by_setpos); | ||||
▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | foreach ($selection as $key => $info) { | ||||
if ($by_monthday) { | if ($by_monthday) { | ||||
if (empty($by_monthday[$info['monthday']]) && | if (empty($by_monthday[$info['monthday']]) && | ||||
empty($by_monthday[$info['-monthday']])) { | empty($by_monthday[$info['-monthday']])) { | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
if ($by_yearday) { | if ($by_yearday) { | ||||
if (empty($by_monthday[$info['yearday']]) && | if (empty($by_yearday[$info['yearday']]) && | ||||
empty($by_monthday[$info['-yearday']])) { | empty($by_yearday[$info['-yearday']])) { | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
if ($by_weekno) { | if ($by_weekno) { | ||||
if (empty($by_weekno[$info['week']]) && | if (empty($by_weekno[$info['week']]) && | ||||
empty($by_weekno[$info['-week']])) { | empty($by_weekno[$info['-week']])) { | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |