/** Returns TRUE if this iterator points to an event. */ function valid() { if ($this->_idx < $this->_limit) { return TRUE; } ec3_reset_wp_query(); return FALSE; }
function generate() { $result = ''; $curr_dateobj = $this->begin_dateobj; while ($curr_dateobj->less_than($this->limit_dateobj)) { $days_in_month = $curr_dateobj->days_in_month(); $week_day = ($curr_dateobj->week_day() + 7 - intval(get_option('start_of_week'))) % 7; $col = 0; $monthstr = ''; $weekstr = ''; while (True) { $this->dateobj = clone $curr_dateobj; if ($col > 6) { $monthstr .= $this->wrap_week($weekstr, $curr_dateobj); $weekstr = ''; $col = 0; } if ($col < $week_day) { // insert padding $weekstr .= $this->make_pad($week_day - $col, true); $col = $week_day; } // insert day $datetime = $curr_dateobj->to_mysqldate(); $this->dayobj = $this->_days[$datetime]; // might be empty $dayarr = $this->make_day(); $weekstr .= $this->wrap_day($dayarr); $col++; $curr_dateobj->increment_day(); if (1 == $curr_dateobj->day_num) { break; } $week_day = ($week_day + 1) % 7; } // insert padding $weekstr .= $this->make_pad(7 - $col, false); $monthstr .= $this->wrap_week($weekstr); $result .= $this->wrap_month($monthstr); } ec3_reset_wp_query(); return $result; }