/** * Generates the ICS RRULE fromthe event schedule data. * @access private * @ignore * @since 1.0.0 * @package ical-functions * * @param int $post_id The event (post) ID. Uses current event if empty. * @return string The RRULE to be used in an ICS calendar */ function eventorganiser_generate_ics_rrule($post_id = 0) { $post_id = (int) (empty($post_id) ? get_the_ID() : $post_id); $rrule = eo_get_event_schedule($post_id); if (!$rrule) { return false; } extract($rrule); $schedule_last->setTimezone(new DateTimeZone('UTC')); $schedule_last = $schedule_last->format('Ymd\\THis\\Z'); switch ($schedule) { case 'once': return false; case 'yearly': return "FREQ=YEARLY;INTERVAL=" . $frequency . ";UNTIL=" . $schedule_last; case 'monthly': //TODO Account for possible day shifts with timezone set to UTC $reoccurrence_rule = "FREQ=MONTHLY;INTERVAL=" . $frequency . ";"; $reoccurrence_rule .= $schedule_meta . ";"; $reoccurrence_rule .= "UNTIL=" . $schedule_last; return $reoccurrence_rule; case 'weekly': if (!eo_is_all_day($post_id)) { //None all day event, setting event timezone to UTC may cause it to shift days. //E.g. a 9pm Monday event in New York will a Tuesday event in UTC. //We may need to correct the BYDAY attribute to be valid for UTC. $days_of_week = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'); $UTC = new DateTimeZone('UTC'); //Get day shift upon timezone set to UTC $start = eo_get_schedule_start(DATETIMEOBJ, $post_id); $local_day = (int) $start->format('w'); $start->setTimezone($UTC); $utc_day = (int) $start->format('w'); $diff = $utc_day - $local_day + 7; //ensure difference is positive (should be 0, +1 or +6). //If there is a shift correct BYDAY if ($diff) { $utc_days = array(); foreach ($schedule_meta as $day) { $utc_day_index = (array_search($day, $days_of_week) + $diff) % 7; $utc_days[] = $days_of_week[$utc_day_index]; } $schedule_meta = $utc_days; } } return "FREQ=WEEKLY;INTERVAL=" . $frequency . ";BYDAY=" . implode(',', $schedule_meta) . ";UNTIL=" . $schedule_last; case 'daily': return "FREQ=DAILY;INTERVAL=" . $frequency . ";UNTIL=" . $schedule_last; default: } return false; }
<?php if (eo_reoccurs()) { ?> <!-- Single event --> <li><strong><?php _e('Date', 'eventorganiser'); ?> :</strong> <?php echo eo_get_schedule_start('F j, Y'); ?> </li> <li><strong><?php _e('Time or Route Order', 'eventorganiser'); ?> :</strong> <?php echo eo_get_schedule_start($time_format); ?> </li> <li><strong><?php _e('Address', 'eventorganiser'); ?> :</strong> <?php $address_details = eo_get_venue_address(); echo $address_details['address']; ?> </li> <li><strong><?php _e('Location', 'eventorganiser'); ?> :</strong> <?php $address_details = eo_get_venue_address();
<!-- Is event recurring or a single event --> <?php if (eo_reoccurs()) { ?> <!-- Event reoccurs - is there a next occurrence? --> <?php $next = eo_get_next_occurrence($date_format); ?> <?php if ($next) { ?> <!-- If the event is occurring again in the future, display the date --> <?php printf('<p>' . __('This event is running from %1$s until %2$s. It is next occurring on %3$s', 'eventorganiser') . '.</p>', eo_get_schedule_start('j F Y'), eo_get_schedule_last('j F Y'), $next); ?> <?php } else { ?> <!-- Otherwise the event has finished (no more occurrences) --> <?php printf('<p>' . __('This event finished on %s', 'eventorganiser') . '.</p>', eo_get_schedule_last('d F Y', '')); ?> <?php } ?> <?php } ?>
"><?php the_title(); ?> </a></h2> <!-- Event Meta --> <?php get_post_type(); if ('event' == get_post_type()) { ?> <p class="event-meta"> <?php if (eo_reoccurs()) { printf(__('%1$s – %2$s'), eo_get_schedule_start('D d.m.'), eo_get_schedule_last('D d.m. ' . get_option('time_format'))); } else { printf(__('%1$s'), eo_get_schedule_start('D d.m. ' . get_option('time_format'))); } echo "<br>"; $preserve_post = get_post(); // preserve the current post in the higher loop $location = get_field('locationpage')[0]; if ($location) { $post = $location; setup_postdata($post); echo "<a href='"; the_permalink($location); echo "'>"; the_title(); echo "</a>"; echo " | "; echo the_field('ort');
function event_meta() { echo "<p class='event-meta'>"; if (eo_reoccurs()) { printf('<p>' . __('%1$s – %2$s') . '</p>', eo_get_schedule_start('D d.m.'), eo_get_schedule_last('D d.m. ' . get_option('time_format'))); } else { printf('<p>' . __('%1$s') . '</p>', eo_get_schedule_start('D d.m. ' . get_option('time_format'))); } echo the_field('musikgenre'); echo " "; echo the_field('theatergenre'); echo " "; echo the_field('region'); echo "</p>"; }
static function parse_template($matches) { global $post; $replacement = ''; switch ($matches[1]) { case 'event_title': $replacement = get_the_title(); break; case 'start': case 'end': case 'schedule_start': case 'schedule_last': case 'schedule_end': switch (count($matches)) { case 2: $dateFormat = get_option('date_format'); $dateTime = get_option('time_format'); break; case 3: $dateFormat = self::eo_clean_input($matches[2]); $dateTime = ''; break; case 5: $dateFormat = self::eo_clean_input($matches[3]); $dateTime = self::eo_clean_input($matches[4]); break; } $format = eo_is_all_day(get_the_ID()) ? $dateFormat : $dateFormat . $dateTime; switch ($matches[1]) { case 'start': $replacement = eo_get_the_start($format); break; case 'end': $replacement = eo_get_the_end($format); break; case 'schedule_start': $replacement = eo_get_schedule_start($format); break; case 'schedule_last': case 'schedule_end': $replacement = eo_get_schedule_end($format); break; } break; case 'event_duration': $start = eo_get_the_start(DATETIMEOBJ); $end = clone eo_get_the_end(DATETIMEOBJ); if (eo_is_all_day()) { $end->modify('+1 minute'); } if (function_exists('date_diff')) { $duration = date_diff($start, $end); $replacement = $duration->format($matches[2]); } else { $replacement = eo_date_interval($start, $end, $matches[2]); } $replacement = false; break; case 'event_tags': $replacement = get_the_term_list(get_the_ID(), 'event-tag', '', ', ', ''); break; case 'event_cats': $replacement = get_the_term_list(get_the_ID(), 'event-category', '', ', ', ''); break; case 'event_venue': $replacement = eo_get_venue_name(); break; case 'event_venue_map': if (eo_get_venue()) { $class = isset($matches[2]) ? self::eo_clean_input($matches[2]) : ''; $class = !empty($class) ? 'class=' . $class : ''; $replacement = eo_get_venue_map(eo_get_venue(), compact('class')); } break; case 'event_venue_url': $venue_link = eo_get_venue_link(); $replacement = !is_wp_error($venue_link) ? $venue_link : ''; break; case 'event_venue_address': $address = eo_get_venue_address(); $replacement = $address['address']; break; case 'event_venue_postcode': $address = eo_get_venue_address(); $replacement = $address['postcode']; break; case 'event_venue_city': $address = eo_get_venue_address(); $replacement = $address['city']; break; case 'event_venue_country': $address = eo_get_venue_address(); $replacement = $address['country']; break; case 'event_venue_state': $address = eo_get_venue_address(); $replacement = $address['state']; break; case 'event_venue_city': $address = eo_get_venue_address(); $replacement = $address['city']; break; case 'event_thumbnail': $size = isset($matches[2]) ? self::eo_clean_input($matches[2]) : ''; $size = !empty($size) ? $size : 'thumbnail'; $attr = isset($matches[3]) ? self::eo_clean_input($matches[3]) : ''; //Decode HTML entities as shortcode encodes them $attr = html_entity_decode($attr); $replacement = get_the_post_thumbnail(get_the_ID(), $size, $attr); break; case 'event_url': $replacement = get_permalink(); break; case 'event_custom_field': $field = $matches[2]; $meta = get_post_meta(get_the_ID(), $field); $replacement = implode($meta); break; case 'event_excerpt': $length = isset($matches[2]) ? intval($matches[2]) : 55; //Using get_the_excerpt adds a link.... if (post_password_required($post)) { $output = __('There is no excerpt because this is a protected post.'); } else { $output = $post->post_excerpt; } $replacement = eventorganiser_trim_excerpt($output, $length); break; case 'event_content': $replacement = get_the_content(); break; case 'cat_color': $replacement = eo_get_event_color(); break; case 'event_title_attr': $replacement = get_the_title(); break; } return $replacement; }
} ?> <?php if (eo_reoccurs()) { ?> <!-- Event reoccurs - is there a next occurrence? --> <?php $next = eo_get_next_occurrence($date_format); ?> <?php if ($next) { ?> <!-- If the event is occurring again in the future, display the date --> <?php printf(__('This event is running from %1$s until %2$s. It is next occurring at %3$s', 'eventorganiser'), eo_get_schedule_start('d F Y'), eo_get_schedule_end('d F Y'), $next); ?> <?php } else { ?> <!-- Otherwise the event has finished (no more occurrences) --> <?php printf(__('This event finished on %s', 'eventorganiser'), eo_get_schedule_end('d F Y', '')); ?> <?php } ?> <?php } else {
/** * Prints the formated date of first occurrence of an event * @since 1.0.0 * @uses eo_get_schedule_start() * @package event-date-functions * * @param string $format The format to use, using PHP Date format * @param int $post_id The event (post) ID. Uses current event if empty. */ function eo_schedule_start($format = 'd-m-Y', $post_id = 0) { echo eo_get_schedule_start($format, $post_id); }
/** * Echos the formated date of the first occurrence * * @param string - the format to use, using PHP Date format * @param id - Optional, the event (post) ID, * * @uses eo_get_schedule_start * * @since 1.0.0 */ function eo_schedule_start($format = 'd-m-Y', $id = '') { echo eo_get_schedule_start($format, $id); }