Example #1
0
 /**
  * Check that the 'until' date is unaffected by included events.
  * Note until != schedule_last (see https://github.com/stephenharris/Event-Organiser/issues/259). 
  */
 public function testUntil()
 {
     $tz = eo_get_blog_timezone();
     $include = new DateTime('2015-05-23 15:30:00', $tz);
     $until = new DateTime('2015-05-09 15:30:00', $tz);
     $event = array('start' => new DateTime('2015-04-18 15:30:00', $tz), 'end' => new DateTime('2015-04-18 15:45:00', $tz), 'frequeny' => 1, 'schedule' => 'weekly', 'until' => $until, 'include' => array($include));
     //Create event and store occurrences
     $event_id = eo_insert_event($event);
     $schedule = eo_get_event_schedule($event_id);
     $this->assertEquals($include, eo_get_schedule_last(DATETIMEOBJ, $event_id));
     $this->assertEquals($include, $schedule['schedule_last']);
     $this->assertEquals($until, $schedule['until']);
 }
Example #2
0
/**
* Prints the formated date of the last occurrence of an event
* @since 1.0.0
* @deprecated 1.5 use eo_schedule_last
* @see eo_schedule_last
*
* @param string $format the format to use, using PHP Date format
* @param int $post_id Optional, the event (post) ID, 
*/
function eo_schedule_end($format = 'd-m-Y', $post_id = 0)
{
    echo eo_get_schedule_last($format, $post_id);
}
the_permalink();
?>
"><?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>";
/**
 * Callback for the delete expired events cron job. Deletes events that finished at least 24 hours ago.
 * For recurring events it is only deleted once the last occurrence has expired.
 *
 * @since 1.4.0
 * @ignore
 * @access private
 */
function eventorganiser_delete_expired_events()
{
    //Get expired events
    $events = eo_get_events(array('showrepeats' => 0, 'showpastevents' => 1, 'eo_interval' => 'expired'));
    $time_until_expired = (int) apply_filters('eventorganiser_events_expire_time', 24 * 60 * 60);
    $time_until_expired = max($time_until_expired, 0);
    if ($events) {
        $now = new DateTime('now', eo_get_blog_timezone());
        foreach ($events as $event) {
            $start = eo_get_the_start(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
            $end = eo_get_the_end(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
            $expired = round(abs($end->format('U') - $start->format('U'))) + $time_until_expired;
            //Duration + expire time
            $finished = eo_get_schedule_last(DATETIMEOBJ, $event->ID);
            $finished->modify("+{$expired} seconds");
            //[Expired time] after the last occurrence finishes
            //Delete if [expired time] has passed
            if ($finished <= $now) {
                wp_trash_post((int) $event->ID);
            }
        }
    }
}
Example #5
0
    ?>

			<?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 
}
?>

	<ul class="eo-event-meta">

		<?php 
if (!eo_reoccurs()) {
    ?>
				<!-- Single event -->
				<li><strong><?php 
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>";
}
/**
 * Callback for the delete expired events cron job. Deletes events that finished at least 24 hours ago.
 * For recurring events it is only deleted once the last occurrence has expired.
 *
 * @since 1.4.0
 * @ignore
 * @access private
 */
function eventorganiser_delete_expired_events()
{
    //Get expired events
    $events = eo_get_events(array('showrepeats' => 0, 'showpastevents' => 1, 'eo_interval' => 'expired'));
    /**
     * Filters how long (in seconds) after an event as finished it should be considered expired.
     * 
     * If enabled in *Settings > Event Organiser > General*, expired events are trashed.
     * 
     * @param int $time_until_expired Time (in seconds) to wait after an event has finished. Defaults to 24 hours. 
     */
    $time_until_expired = (int) apply_filters('eventorganiser_events_expire_time', 24 * 60 * 60);
    $time_until_expired = max($time_until_expired, 0);
    if ($events) {
        $now = new DateTime('now', eo_get_blog_timezone());
        foreach ($events as $event) {
            $start = eo_get_the_start(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
            $end = eo_get_the_end(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
            $expired = round(abs($end->format('U') - $start->format('U'))) + $time_until_expired;
            //Duration + expire time
            $finished = eo_get_schedule_last(DATETIMEOBJ, $event->ID);
            $finished->modify("+{$expired} seconds");
            //[Expired time] after the last occurrence finishes
            //Delete if [expired time] has passed
            if ($finished <= $now) {
                wp_trash_post((int) $event->ID);
            }
        }
    }
}