render.php syntax error after plugin update
-
After updating the modern events calendar plugin, the site won’t load anymore. here’s the error I’m getting … Parse error: syntax error, unexpected ‘->’ (T_OBJECT_OPERATOR) on render.php file line 1009 which is this line
$event_period_days = ($this->main->date_diff($start_date['date'], $end_date['date']))->days;
But in order to load the site on the front end, I went ahead and commented out this entire block of code below…
I don’t know what’s wrong with it. Please help. Thank you
/** * Renders and Returns event dats * @author Webnus <[email protected]> * @param int $event_id * @param object $event * @param int $maximum * @param string $today * @return object|array */ /*public function dates($event_id, $event = NULL, $maximum = 6, $today = NULL) { if(!trim($today)) $today = date('Y-m-d'); // Original Start Date $original_start_date = $today; $dates = array(); // Get event data if it is NULL if(is_null($event)) $event = $this->data($event_id); $start_date = isset($event->meta['mec_date']['start']) ? $event->meta['mec_date']['start'] : array(); $end_date = isset($event->meta['mec_date']['end']) ? $event->meta['mec_date']['end'] : array(); // Return empty array if date is not valid if(!isset($start_date['date']) or (isset($start_date['date']) and !strtotime($start_date['date']))) return $dates; // Return empty array if mec data is not exists on mec_events table if(!isset($event->mec->end)) return $dates; $allday = isset($event->meta['mec_allday']) ? $event->meta['mec_allday'] : 0; $hide_time = isset($event->meta['mec_hide_time']) ? $event->meta['mec_hide_time'] : 0; $event_period = $this->main->date_diff($start_date['date'], $end_date['date']); $event_period_days = $event_period ? $event_period->days : 0; $finish_date = array('date'=>$event->mec->end, 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']); $exceptional_days = (isset($event->mec->not_in_days) and trim($event->mec->not_in_days)) ? explode(',', trim($event->mec->not_in_days, ', ')) : array(); // Event Passed $past = $this->main->is_past($finish_date['date'], $today); // Event is not passed for custom days if($past and isset($event->meta['mec_repeat_type']) and $event->meta['mec_repeat_type'] == 'custom_days') $past = 0; // Normal event if(isset($event->mec->repeat) and $event->mec->repeat == '0') { $dates[] = $this->add_timestamps(array( 'start'=>$start_date, 'end'=>$end_date, 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>$past )); } elseif($past) { $dates[] = $this->add_timestamps(array( 'start'=>$start_date, 'end'=>$end_date, 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>$past )); } elseif(!$past) { $repeat_type = $event->meta['mec_repeat_type']; $repeat_interval = 1; if(in_array($repeat_type, array('daily', 'weekly'))) { $repeat_interval = $event->meta['mec_repeat_interval']; $date_interval = $this->main->date_diff($start_date['date'], $today); $passed_days = $date_interval ? $date_interval->days : 0; // Check if date interval is negative (It means the event didn't start yet) if($date_interval and $date_interval->invert == 1) $remained_days_to_next_repeat = $passed_days; else $remained_days_to_next_repeat = $repeat_interval - ($passed_days%$repeat_interval); $start_date = date('Y-m-d', strtotime('+'.$remained_days_to_next_repeat.' Days', strtotime($today))); if(!$this->main->is_past($finish_date['date'], $start_date) and !in_array($start_date, $exceptional_days)) $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$start_date, 'hour'=>$event->meta['mec_date']['start']['hour'], 'minutes'=>$event->meta['mec_date']['start']['minutes'], 'ampm'=>$event->meta['mec_date']['start']['ampm']), 'end'=>array('date'=>date('Y-m-d', strtotime('+'.$event_period_days.' Days', strtotime($start_date))), 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); for($i=2; $i<=$maximum; $i++) { $start_date = date('Y-m-d', strtotime('+'.$repeat_interval.' Days', strtotime($start_date))); // Event finished if($this->main->is_past($finish_date['date'], $start_date)) break; if(!in_array($start_date, $exceptional_days)) $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$start_date, 'hour'=>$event->meta['mec_date']['start']['hour'], 'minutes'=>$event->meta['mec_date']['start']['minutes'], 'ampm'=>$event->meta['mec_date']['start']['ampm']), 'end'=>array('date'=>date('Y-m-d', strtotime('+'.$event_period_days.' Days', strtotime($start_date))), 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); } } elseif(in_array($repeat_type, array('weekday', 'weekend', 'certain_weekdays'))) { $date_interval = $this->main->date_diff($start_date['date'], $today); $passed_days = $date_interval ? $date_interval->days : 0; // Check if date interval is negative (It means the event didn't start yet) if($date_interval and $date_interval->invert == 1) $today = date('Y-m-d', strtotime('+'.$passed_days.' Days', strtotime($original_start_date))); $event_days = explode(',', trim($event->mec->weekdays, ', ')); $today_id = date('N', strtotime($today)); $found = 0; $i = 0; while($found < $maximum) { if($this->main->is_past($finish_date['date'], $today)) break; if(!in_array($today_id, $event_days)) { $today = date('Y-m-d', strtotime('+1 Days', strtotime($today))); $today_id = date('N', strtotime($today)); $i++; continue; } $start_date = $today; if(!in_array($start_date, $exceptional_days)) $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$start_date, 'hour'=>$event->meta['mec_date']['start']['hour'], 'minutes'=>$event->meta['mec_date']['start']['minutes'], 'ampm'=>$event->meta['mec_date']['start']['ampm']), 'end'=>array('date'=>date('Y-m-d', strtotime('+'.$event_period_days.' Days', strtotime($start_date))), 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); $today = date('Y-m-d', strtotime('+1 Days', strtotime($today))); $today_id = date('N', strtotime($today)); $found++; $i++; } } elseif($repeat_type == 'monthly') { // Start from Event Start Date if(strtotime($start_date['date']) > strtotime($original_start_date)) $original_start_date = $start_date['date']; $event_days = explode(',', trim($event->mec->day, ', ')); $event_start_day = $event_days[0]; // $event_period_days = ($this->main->date_diff($start_date['date'], $end_date['date']))->days; $found = 0; $i = 0; while($found < $maximum) { $t = strtotime('+'.$i.' Months', strtotime($original_start_date)); if(!$t) break; $today = date('Y-m-d', $t); if($this->main->is_past($finish_date['date'], $today)) break; $year = date('Y', strtotime($today)); $month = date('m', strtotime($today)); $day = $event_start_day; $hour = isset($event->meta['mec_date']['end']['hour']) ? sprintf('%02d', $event->meta['mec_date']['end']['hour']) : '06'; $minutes = isset($event->meta['mec_date']['end']['minutes']) ? sprintf('%02d', $event->meta['mec_date']['end']['minutes']) : '00'; $ampm = isset($event->meta['mec_date']['end']['ampm']) ? strtolower($event->meta['mec_date']['end']['ampm']) : 'pm'; // Fix for 31st, 30th, 29th of some months while(!checkdate($month, $day, $year)) $day--; $start_date = $year.'-'.$month.'-'.$day; $end_time = $hour.':'.$minutes.$ampm; if(strtotime($start_date.' '.$end_time) < strtotime($original_start_date)) { $i++; continue; } if(!in_array($start_date, $exceptional_days)) $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$start_date, 'hour'=>$event->meta['mec_date']['start']['hour'], 'minutes'=>$event->meta['mec_date']['start']['minutes'], 'ampm'=>$event->meta['mec_date']['start']['ampm']), 'end'=>array('date'=>date('Y-m-d', strtotime('+'.$event_period_days.' Days', strtotime($start_date))), 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); $found++; $i++; } } elseif($repeat_type == 'yearly') { // Start from Event Start Date if(strtotime($start_date['date']) > strtotime($original_start_date)) $original_start_date = $start_date['date']; $event_days = explode(',', trim($event->mec->day, ', ')); $event_months = explode(',', trim($event->mec->month, ', ')); $event_start_day = $event_days[0]; $event_period_days = ($this->main->date_diff($start_date['date'], $end_date['date']))->days; $found = 0; $i = 0; while($found < $maximum) { $t = strtotime('+'.$i.' Months', strtotime($original_start_date)); if(!$t) break; $today = date('Y-m-d', $t); if($this->main->is_past($finish_date['date'], $today)) break; $year = date('Y', strtotime($today)); $month = date('m', strtotime($today)); if(!in_array($month, $event_months)) { $i++; continue; } $day = $event_start_day; // Fix for 31st, 30th, 29th of some months while(!checkdate($month, $day, $year)) $day--; $event_date = $year.'-'.$month.'-'.$day; if(strtotime($event_date) < strtotime($original_start_date)) { $i++; continue; } $start_date = $event_date; if(!in_array($start_date, $exceptional_days)) $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$start_date, 'hour'=>$event->meta['mec_date']['start']['hour'], 'minutes'=>$event->meta['mec_date']['start']['minutes'], 'ampm'=>$event->meta['mec_date']['start']['ampm']), 'end'=>array('date'=>date('Y-m-d', strtotime('+'.$event_period_days.' Days', strtotime($start_date))), 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); $found++; $i++; } } elseif($repeat_type == 'custom_days') { $custom_days = explode(',', $event->mec->days); // Add current time if we're checking today's events if($today == current_time('Y-m-d')) $today .= ' '.current_time('H:i:s'); $found = 0; if((strtotime($event->mec->start) + $event->meta['mec_start_day_seconds']) >= strtotime($today) and !in_array($event->mec->start, $exceptional_days)) { $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$event->mec->start, 'hour'=>$event->meta['mec_date']['start']['hour'], 'minutes'=>$event->meta['mec_date']['start']['minutes'], 'ampm'=>$event->meta['mec_date']['start']['ampm']), 'end'=>array('date'=>$event->mec->end, 'hour'=>$event->meta['mec_date']['end']['hour'], 'minutes'=>$event->meta['mec_date']['end']['minutes'], 'ampm'=>$event->meta['mec_date']['end']['ampm']), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); $found++; } foreach($custom_days as $custom_day) { // Found maximum dates if($found >= $maximum) break; $cday = explode(':', $custom_day); $c_start = $cday[0]; if(isset($cday[2])) $c_start .= ' '.str_replace('-', ' ', substr_replace($cday[2], ':', strpos($cday[2], '-'), 1)); // Date is past if(strtotime($c_start) < strtotime($today)) continue; $cday_start_hour = $event->meta['mec_date']['start']['hour']; $cday_start_minutes = $event->meta['mec_date']['start']['minutes']; $cday_start_ampm = $event->meta['mec_date']['start']['ampm']; $cday_end_hour = $event->meta['mec_date']['end']['hour']; $cday_end_minutes = $event->meta['mec_date']['end']['minutes']; $cday_end_ampm = $event->meta['mec_date']['end']['ampm']; if(isset($cday[2]) and isset($cday[3])) { $cday_start_ex = explode('-', $cday[2]); $cday_start_hour = $cday_start_ex[0]; $cday_start_minutes = $cday_start_ex[1]; $cday_start_ampm = $cday_start_ex[2]; $cday_end_ex = explode('-', $cday[3]); $cday_end_hour = $cday_end_ex[0]; $cday_end_minutes = $cday_end_ex[1]; $cday_end_ampm = $cday_end_ex[2]; } if(!in_array($cday[0], $exceptional_days)) $dates[] = $this->add_timestamps(array( 'start'=>array('date'=>$cday[0], 'hour'=>$cday_start_hour, 'minutes'=>$cday_start_minutes, 'ampm'=>$cday_start_ampm), 'end'=>array('date'=>$cday[1], 'hour'=>$cday_end_hour, 'minutes'=>$cday_end_minutes, 'ampm'=>$cday_end_ampm), 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>0 )); $found++; } // No future date found so the event is passed if(!count($dates)) { $dates[] = $this->add_timestamps(array( 'start'=>$start_date, 'end'=>$finish_date, 'allday'=>$allday, 'hide_time'=>$hide_time, 'past'=>$past )); } } elseif($repeat_type == 'advanced') { // Get user specifed days of month for repeat $advanced_days = get_post_meta($event_id, 'mec_advanced_days', true); // Generate dates for event $event_info = array('start' => $start_date, 'end' => $end_date, 'allday' => $allday, 'hide_time' => $hide_time, 'finish_date' => $finish_date['date'], 'exceptional_days' => $exceptional_days, 'mec_repeat_end' => $event->meta['mec_repeat']['end'], 'occurrences' => $event->meta['mec_repeat']['end_at_occurrences']); $dates = $this->generate_advanced_days($advanced_days, $event_info, $maximum, $today); } } return $dates; }*/
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘render.php syntax error after plugin update’ is closed to new replies.