From: <cl...@us...> - 2003-09-21 18:18:22
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1:/tmp/cvs-serv16075/functions Modified Files: ical_parser.php Log Message: Somewhat better BYMONTH support. Still seems flakey in year view for some reason. :( Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** ical_parser.php 20 Sep 2003 19:43:16 -0000 1.108 --- ical_parser.php 21 Sep 2003 18:18:19 -0000 1.109 *************** *** 439,442 **** --- 439,443 ---- break; case 'MONTHLY': + if (!isset($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); $next_range_time = strtotime(date('Y-m-01', $next_range_time)); // month has two cases, either $bymonthday or $byday *************** *** 464,470 **** $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $next_range_time); } elseif (is_array($bymonthday)) { // This supports MONTHLY where BYDAY and BYMONTH are both set - if (!isset($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); foreach($bymonthday as $day) { $year = date('Y', $next_range_time); --- 465,474 ---- $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $next_range_time); + $month = date('m', $next_date_time); + if (in_array($month, $bymonth)) { + $recur_data[] = $next_date_time; + } } elseif (is_array($bymonthday)) { // This supports MONTHLY where BYDAY and BYMONTH are both set foreach($bymonthday as $day) { $year = date('Y', $next_range_time); *************** *** 478,484 **** } } ! } elseif (isset($byday_arr[1])) { $next_date_time = strtotime($on_day.' +'.$nth.' week', $next_range_time); ! $recur_data[] = $next_date_time; } $next_date = date('Ymd', $next_date_time); --- 482,491 ---- } } ! } elseif ((isset($byday_arr[1])) && ($byday_arr[1] != '-')) { $next_date_time = strtotime($on_day.' +'.$nth.' week', $next_range_time); ! $month = date('m', $next_date_time); ! if (in_array($month, $bymonth)) { ! $recur_data[] = $next_date_time; ! } } $next_date = date('Ymd', $next_date_time); |