$day) { /* set $byday_arr [0] => byday string, e.g. 4TH [1] => sign/modifier [2] => 4 number [3] => TH day abbr */ ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); $on_day = two2threeCharDays($byday_arr[3]); switch($freq_type){ case 'week': #need to find the first day of the appropriate week. if ($key == 0){ $next_date_time = strtotime("next $on_day",strtotime($the_sunday)) + (12 * 60 * 60); }else{ $next_date_time = strtotime("next $on_day",$next_date_time) + (12 * 60 * 60); } default: $next_date_time = strtotime($byday_arr[1].$byday_arr[2].$on_day, $time); } $times[] = $next_date_time; } return $times; } function restrict_bymonth($times,$freq=''){ global $bymonth; if (empty($bymonth)) return $times; foreach ($times as $time) if(in_array(date("m", $time), $bymonth)) $new_times[] = $time; return $new_times; } function restrict_byweekno($times,$freq=''){ global $byweekno; if(empty($byweekno)) return $times; foreach ($times as $time) if(in_array(date("W", $time), $byweekno)) $new_times[] = $time; return $new_times; } function restrict_byyearday($times,$freq=''){ global $byyearday; if(empty($byyearday)) return $times; foreach ($times as $time) if(in_array(date("z", $time), $byyearday)) $new_times[] = $time; return $new_times; } function restrict_bymonthday($times,$freq=''){ global $bymonthday; if(empty($bymonthday)) return $times; foreach ($times as $time) if(in_array(date("j", $time), $bymonthday)) $new_times[] = $time; return $new_times; } function restrict_byday($times,$freq=''){ global $byday; if(empty($byday)) return $times; foreach($byday as $key=>$day) $byday3[] = two2threeCharDays($day); foreach ($times as $time) if(in_array(strtolower(date("D", $time)), $byday3)) $new_times[] = $time; return $new_times; } function restrict_bysetpos($times,$freq=''){ global $rrule_array, $bysetpos; if(empty($bysetpos)) return $times; }