/** * Constructor. * * @since 3.0.0 * * @param string|Calendar $calendar */ public function __construct($calendar = '') { if ($calendar instanceof Calendar) { if (isset($calendar->id)) { $this->post_id = $calendar->id; } if (isset($calendar->start)) { $this->calendar_start = $calendar->start; } $this->week_starts = isset($calendar->week_starts) ? $calendar->week_starts : get_option('start_of_week'); $this->events_template = !empty($calendar->events_template) ? $calendar->events_template : simcal_default_event_template(); if ($this->post_id > 0) { $this->set_cache(); $this->timezone_setting = get_post_meta($this->post_id, '_feed_timezone_setting', true); $this->timezone = $calendar->timezone; $this->set_earliest_event(); $this->set_latest_event(); } } }
/** * Default event template builder content. * * @since 3.0.0 * * @param string $content * @param \WP_Post $post * * @return string */ public function default_event_template($content, $post) { return 'calendar' == $post->post_type ? simcal_default_event_template() : $content; }