function eventorganiser_event_fill_columns($column_name, $id)
{
    global $post;
    $series_id = empty($post->event_id) ? $id : '';
    $phpFormat = 'M, j Y';
    if (!eo_is_all_day($series_id)) {
        $phpFormat .= '\\<\\/\\b\\r\\>' . get_option('time_format');
    }
    switch ($column_name) {
        case 'venue':
            $venue_id = eo_get_venue($post->ID);
            $venue_slug = eo_get_venue_slug($post->ID);
            if ($venue_id) {
                echo '<a href="' . add_query_arg('event-venue', $venue_slug) . '">' . esc_html(eo_get_venue_name($venue_id)) . '</a>';
                echo '<input type="hidden" value="' . $venue_id . '"/>';
            }
            break;
        case 'datestart':
            eo_the_start($phpFormat, $series_id);
            break;
        case 'dateend':
            eo_the_end($phpFormat, $series_id);
            break;
        case 'reoccurence':
            eo_display_reoccurence($series_id);
            break;
        case 'eventcategories':
            $terms = get_the_terms($post->ID, 'event-category');
            if (!empty($terms)) {
                foreach ($terms as $term) {
                    $post_terms[] = '<a href="' . add_query_arg('event-category', $term->slug) . '">' . esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'event-category', 'display')) . '</a>';
                }
                echo join(', ', $post_terms);
            }
            break;
        default:
            break;
    }
    // end switch
}
Exemple #2
0
/**
 * Ajax response for the admin full calendar. 
 *
 * This gets events and generates summaries for events to be displayed.
 * in the admin 'calendar view'. 
 * Applies 'eventorganiser_admin_cal_summary' to event summary
 * Applies eventorganiser_admin_calendar to the event array
 *
 *@since 1.0
 *@access private
 *@ignore
*/
function eventorganiser_admin_calendar()
{
    //request
    $request = array('event_end_after' => $_GET['start'], 'event_start_before' => $_GET['end']);
    //Presets
    $presets = array('posts_per_page' => -1, 'post_type' => 'event', 'group_events_by' => '', 'perm' => 'readable');
    $calendar = get_transient('eo_full_calendar_admin');
    $key = $_GET['start'] . '--' . $_GET['end'] . 'u=' . get_current_user_id();
    if ((!defined('WP_DEBUG') || !WP_DEBUG) && $calendar && is_array($calendar) && isset($calendar[$key])) {
        echo json_encode($calendar[$key]);
        exit;
    }
    //Create query
    $query_array = array_merge($presets, $request);
    $query = new WP_Query($query_array);
    //Retrieve events
    $query->get_posts();
    $eventsarray = array();
    //Blog timezone
    $tz = eo_get_blog_timezone();
    //Loop through events
    global $post;
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $event = array();
            $colour = '';
            //Get title, append status if applicable
            $title = get_the_title();
            if (!empty($post->post_password)) {
                $title .= ' - ' . __('Protected');
            } elseif ($post->post_status == 'private') {
                $title .= ' - ' . __('Private');
            } elseif ($post->post_status == 'draft') {
                $title .= ' - ' . __('Draft');
            }
            $event['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
            $event['event_id'] = $post->ID;
            $event['occurrence_id'] = $post->occurrence_id;
            $schedule = eo_get_event_schedule($post->ID);
            //Check if all day, set format accordingly
            if ($schedule['all_day']) {
                $event['allDay'] = true;
                $format = get_option('date_format');
            } else {
                $event['allDay'] = false;
                $format = get_option('date_format') . '  ' . get_option('time_format');
            }
            //Get author (or organiser)
            $organiser = get_userdata($post->post_author)->display_name;
            //Get Event Start and End date, set timezone to the blog's timzone
            $event_start = new DateTime($post->StartDate . ' ' . $post->StartTime, $tz);
            $event_end = new DateTime($post->EndDate . ' ' . $post->FinishTime, $tz);
            $event['start'] = $event_start->format('Y-m-d\\TH:i:s\\Z');
            $event['end'] = $event_end->format('Y-m-d\\TH:i:s\\Z');
            //Produce summary of event
            $summary = "<table class='form-table' >" . "<tr><th> " . __('Start', 'eventorganiser') . ": </th><td> " . eo_format_datetime($event_start, $format) . "</td></tr>" . "<tr><th> " . __('End', 'eventorganiser') . ": </th><td> " . eo_format_datetime($event_end, $format) . "</td></tr>";
            if (eo_is_multi_event_organiser()) {
                $summary .= "<tr><th> " . __('Organiser', 'eventorganiser') . ": </th><td>" . $organiser . "</td></tr>";
            }
            $event['className'] = array('event');
            $now = new DateTime(null, $tz);
            if ($event_start <= $now) {
                $event['className'][] = 'past-event';
            }
            //Include venue if this is set
            $venue = eo_get_venue($post->ID);
            if ($venue && !is_wp_error($venue)) {
                $summary .= "<tr><th>" . __('Where', 'eventorganiser') . ": </th><td>" . eo_get_venue_name($venue) . "</td></tr>";
                $event['className'][] = 'venue-' . eo_get_venue_slug($post->ID);
                $event['venue'] = $venue;
            }
            /**
             * Filters the summary of the event as it appears in the admin 
             * calendar's modal.
             *
             * **Note:** As the calendar is cached, changes made using this filter
             * will not take effect immediately. You can clear the cache by
             * updating an event.
             *
             * @package admin-calendar
             * @param string  $summary       The event (admin) summary,
             * @param int     $event_id      The event's post ID.
             * @param int     $occurrence_id The event's occurrence ID.
             * @param WP_Post $post          The event (post) object.
             */
            $summary = apply_filters('eventorganiser_admin_cal_summary', $summary, $post->ID, $post->occurrence_id, $post);
            $summary .= "</table><p>";
            //Include schedule summary if event reoccurrs
            if ($schedule['schedule'] != 'once') {
                $summary .= '<em>' . __('This event reoccurs', 'eventorganiser') . ' ' . eo_get_schedule_summary() . '</em>';
            }
            $summary .= '</p>';
            //Include edit link in summary if user has permission
            if (current_user_can('edit_event', $post->ID)) {
                $edit_link = get_edit_post_link($post->ID, '');
                $summary .= "<span class='edit'><a title='Edit this item' href='" . $edit_link . "'> " . __('Edit Event', 'eventorganiser') . "</a></span>";
                $event['url'] = $edit_link;
            }
            //Include a delete occurrence link in summary if user has permission
            if (current_user_can('delete_event', $post->ID)) {
                $admin_url = admin_url('edit.php');
                $delete_url = add_query_arg(array('post_type' => 'event', 'page' => 'calendar', 'series' => $post->ID, 'event' => $post->occurrence_id, 'action' => 'delete_occurrence'), $admin_url);
                $delete_url = wp_nonce_url($delete_url, 'eventorganiser_delete_occurrence_' . $post->occurrence_id);
                $summary .= sprintf('<span class="delete"><a class="submitdelete" style="color:red;float:right" title="%1$s" href="%2$s">%1$s</a></span>', esc_attr__('Delete this occurrence', 'eventorganiser'), $delete_url);
                if ($schedule['schedule'] != 'once') {
                    $break_url = add_query_arg(array('post_type' => 'event', 'page' => 'calendar', 'series' => $post->ID, 'event' => $post->occurrence_id, 'action' => 'break_series'), $admin_url);
                    $break_url = wp_nonce_url($break_url, 'eventorganiser_break_series_' . $post->occurrence_id);
                    $summary .= sprintf('<span class="break"><a class="submitbreak" style="color:red;float:right;padding-right:2em;" title="%1$s" href="%2$s">%1$s</a></span>', esc_attr__('Break this series', 'eventorganiser'), $break_url);
                }
            }
            //Event categories
            $terms = get_the_terms($post->ID, 'event-category');
            $event['category'] = array();
            if ($terms) {
                foreach ($terms as $term) {
                    $event['category'][] = $term->slug;
                    $event['className'][] = 'category-' . $term->slug;
                }
            }
            //Event colour
            $event['textColor'] = '#ffffff';
            //default text colour
            if (eo_get_event_color()) {
                $event['color'] = eo_get_event_color();
                $event['textColor'] = eo_get_event_textcolor($event['color']) ? eo_get_event_textcolor($event['color']) : '#ffffff';
            }
            //Event summary
            $event['summary'] = '<div id="eo-cal-meta">' . $summary . '</div>';
            //Filter the event array
            /**
             * @ignore
             */
            $event = apply_filters('eventorganiser_admin_calendar', $event, $post);
            /**
             * Filters the event before its sent to the admin calendar.
             *
             * **Note:** As the calendar is cached, changes made using this filter
             * will not take effect immediately. You can clear the cache by
             * updating an event.
             * 
             * @package admin-calendar
             * @param array $event         The event array.
             * @param int   $event_id      The event's post ID.
             * @param int   $occurrence_id The event's occurrence ID.
             */
            $event = apply_filters('eventorganiser_admin_fullcalendar_event', $event, $post->ID, $post->occurrence_id);
            //Add event to array
            $eventsarray[] = $event;
        }
    }
    if (!$calendar || !is_array($calendar)) {
        $calendar = array();
    }
    $calendar[$key] = $eventsarray;
    set_transient('eo_full_calendar_admin', $calendar, 60 * 60 * 24);
    //Echo result and exit
    echo json_encode($eventsarray);
    exit;
}
Exemple #3
0
function eventorganiser_posterboard_ajax_response()
{
    $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    $query = empty($_GET['query']) ? array() : $_GET['query'];
    foreach (array('category', 'tag', 'venue') as $tax) {
        if (isset($query['event_' . $tax])) {
            $query['event-' . $tax] = $query['event_' . $tax];
            unset($query['event_' . $tax]);
        }
    }
    if (isset($query['event-venue']) && '%this%' == $query['event-venue']) {
        if (eo_get_venue_slug()) {
            $query['event-venue'] = eo_get_venue_slug();
        } else {
            unset($query['event-venue']);
        }
    }
    if (isset($query['users_events']) && 'true' == strtolower($query['users_events'])) {
        $query['bookee_id'] = get_current_user_id();
    }
    $query = array_merge(array('event_start_after' => 'today', 'posts_per_page' => 10), $query, array('post_type' => 'event', 'paged' => $page, 'post_status' => array('publish', 'private'), 'perm' => 'readable', 'supress_filters' => false));
    $event_query = new WP_Query($query);
    $response = array();
    if ($event_query->have_posts()) {
        global $post;
        while ($event_query->have_posts()) {
            $event_query->the_post();
            $start_format = get_option('time_format');
            if (eo_get_the_start('Y-m-d') == eo_get_the_end('Y-m-d')) {
                $end_format = get_option('time_format');
            } else {
                $end_format = 'j M ' . get_option('time_format');
            }
            $venue_id = eo_get_venue();
            $categories = get_the_terms(get_the_ID(), 'event-category');
            $colour = eo_get_event_color() ? eo_get_event_color() : '#1e8cbe';
            $address = eo_get_venue_address($venue_id);
            $event = array('event_id' => get_the_ID(), 'occurrence_id' => $post->occurrence_id, 'event_title' => get_the_title(), 'event_color' => $colour, 'event_color_light' => eo_color_luminance($colour, 0.3), 'event_start_day' => eo_get_the_start('j'), 'event_start_month' => eo_get_the_start('M'), 'event_content' => get_the_content(), 'event_excerpt' => get_the_excerpt(), 'event_thumbnail' => get_the_post_thumbnail(get_the_ID(), array('200', '200'), array('class' => 'aligncenter')), 'event_permalink' => get_permalink(), 'event_categories' => get_the_term_list(get_the_ID(), 'event-category', '#', ', #', ''), 'event_venue' => $venue_id ? eo_get_venue_name($venue_id) : false, 'event_venue_id' => $venue_id, 'event_venue_city' => $venue_id ? $address['city'] : false, 'event_venue_state' => $venue_id ? $address['state'] : false, 'event_venue_country' => $venue_id ? $address['country'] : false, 'event_venue_url' => $venue_id ? eo_get_venue_link($venue_id) : false, 'event_is_all_day' => eo_is_all_day(), 'event_cat_ids' => $categories ? array_values(wp_list_pluck($categories, 'term_id')) : array(0), 'event_range' => eo_get_the_start($start_format) . ' - ' . eo_get_the_end($end_format));
            $event = apply_filters('eventorganiser_posterboard_item', $event, $event['event_id'], $event['occurrence_id']);
            $response[] = $event;
        }
    }
    wp_reset_postdata();
    echo json_encode($response);
    exit;
}
 static function handle_eventlist_shortcode($atts = array(), $content = null)
 {
     $taxs = array('category', 'tag', 'venue');
     foreach ($taxs as $tax) {
         if (isset($atts['event_' . $tax])) {
             $atts['event-' . $tax] = $atts['event_' . $tax];
             unset($atts['event_' . $tax]);
         }
     }
     if (isset($atts['venue']) && $atts['venue'] == '%this%' || isset($atts['event-venue']) && $atts['event-venue'] == '%this%') {
         if (eo_get_venue_slug()) {
             $atts['event-venue'] = eo_get_venue_slug();
         } else {
             unset($atts['venue']);
             unset($atts['event-venue']);
         }
     }
     if (isset($atts['users_events']) && strtolower($atts['users_events']) == 'true') {
         $atts['bookee_id'] = get_current_user_id();
     }
     $args = array('class' => 'eo-events eo-events-shortcode', 'template' => $content, 'no_events' => isset($atts['no_events']) ? $atts['no_events'] : '', 'type' => 'shortcode');
     return eventorganiser_list_events($atts, $args, 0);
 }
/**
* Returns an array of classes associated with an event. Adds the following classes
* 
*  * `eo-event-venue-[venue slug]` - if the event has a venue
*  * `eo-event-cat-[category slug]` - for each event category the event belongs to. 
*  * `eo-event-[future|past|running]` - depending on occurrence
* 
* Applies filter {@see `eventorganiser_event_classes`} so you can add/remove classes.
* 
* @since 1.6
* @param int $post_id The event (post) ID. Uses current event if empty.
* @param int $occurrence_id The occurrence ID. Uses current event if empty.
* @return array Array of classes
*/
function eo_get_event_classes($post_id = 0, $occurrence_id = 0)
{
    global $post;
    $post_id = (int) (empty($post_id) ? get_the_ID() : $post_id);
    $occurrence_id = (int) (empty($occurrence_id) && isset($post->occurrence_id) ? $post->occurrence_id : $occurrence_id);
    $event_classes = array();
    //Add venue class
    if ($venue_slug = eo_get_venue_slug($post_id)) {
        $event_classes[] = 'eo-event-venue-' . $venue_slug;
    }
    //Add category classes
    $cats = get_the_terms($post_id, 'event-category');
    if ($cats && !is_wp_error($cats)) {
        foreach ($cats as $cat) {
            $event_classes[] = 'eo-event-cat-' . $cat->slug;
        }
    }
    //Event tags
    if (eventorganiser_get_option('eventtag')) {
        $terms = get_the_terms($post_id, 'event-tag');
        if ($terms && !is_wp_error($terms)) {
            foreach ($terms as $term) {
                $event_classes[] = 'eo-event-tag-' . $term->slug;
            }
        }
    }
    //Add 'time' class
    $start = eo_get_the_start(DATETIMEOBJ, $post_id, null, $occurrence_id);
    $end = eo_get_the_end(DATETIMEOBJ, $post_id, null, $occurrence_id);
    $now = new DateTime('now', eo_get_blog_timezone());
    if ($start > $now) {
        $event_classes[] = 'eo-event-future';
    } elseif ($end < $now) {
        $event_classes[] = 'eo-event-past';
    } else {
        $event_classes[] = 'eo-event-running';
    }
    //Add class if event starts and ends on different days
    if ($start instanceof DateTime && $end instanceof DateTime) {
        if ($start->format('Y-m-d') != $end->format('Y-m-d')) {
            $event_classes[] = 'eo-multi-day';
        }
    }
    if (eo_is_all_day($post_id)) {
        $event_classes[] = 'eo-all-day';
    }
    /**
     * Filters an array of classes for specified event (occurrence) 
     *
     * @param array $event_classes An array of class pertaining to this occurrence
     * @param int $post_id The ID of the event
     * @param into $occurrence_id The ID of the occurrence
     */
    $event_classes = apply_filters('eventorganiser_event_classes', $event_classes, $post_id, $occurrence_id);
    $event_classes = array_unique($event_classes);
    $event_classes = array_map('sanitize_html_class', $event_classes);
    $event_classes = array_filter($event_classes);
    return $event_classes;
}
/**
* Returns an array of classes associated with an event. Adds the following classes
* 
*  * `eo-event-venue-[venue slug]` - if the event has a venue
*  * `eo-event-cat-[category slug]` - for each event category the event belongs to. 
*  * `eo-event-[future|past|running]` - depending on occurrence
* 
* Applies filter {@see `eventorganiser_event_classes`} so you can add/remove classes.
* 
* @since 1.6
* @param int $post_id The event (post) ID. Uses current event if empty.
* @param int $occurrence_id The occurrence ID. Uses current event if empty.
* @return array Array of classes
*/
function eo_get_event_classes($post_id = 0, $occurrence_id = 0)
{
    global $post;
    $post_id = (int) (empty($post_id) ? get_the_ID() : $post_id);
    $occurrence_id = (int) (empty($occurrence_id) && isset($post->occurrence_id) ? $post->occurrence_id : $occurrence_id);
    $event_classes = array();
    //Add venue class
    if ($venue_slug = eo_get_venue_slug($post_id)) {
        $event_classes[] = 'eo-event-venue-' . $venue_slug;
    }
    //Add category classes
    $cats = get_the_terms($post_id, 'event-category');
    if ($cats && !is_wp_error($cats)) {
        foreach ($cats as $cat) {
            $event_classes[] = 'eo-event-cat-' . $cat->slug;
        }
    }
    //Add 'time' class
    $start = eo_get_the_start(DATETIMEOBJ, $post_id, null, $occurrence_id);
    $end = eo_get_the_end(DATETIMEOBJ, $post_id, null, $occurrence_id);
    $now = new DateTime('now', eo_get_blog_timezone());
    if ($start > $now) {
        $event_classes[] = 'eo-event-future';
    } elseif ($end < $now) {
        $event_classes[] = 'eo-event-past';
    } else {
        $event_classes[] = 'eo-event-running';
    }
    $event_classes = apply_filters('eventorganiser_event_classes', $event_classes, $post_id, $occurrence_id);
    $event_classes = array_unique($event_classes);
    $event_classes = array_map('sanitize_html_class', $event_classes);
    $event_classes = array_filter($event_classes);
    return $event_classes;
}
 function handle_eventlist_shortcode($atts = array(), $content = null)
 {
     global $post;
     $tmp_post = $post;
     $taxs = array('category', 'tag', 'venue');
     foreach ($taxs as $tax) {
         if (isset($atts['event_' . $tax])) {
             $atts['event-' . $tax] = $atts['event_' . $tax];
             unset($atts['event_' . $tax]);
         }
     }
     if (isset($atts['venue']) && $atts['venue'] == '%this%' || isset($atts['event-venue']) && $atts['event-venue'] == '%this%') {
         if (!empty($post->Venue)) {
             $atts['event-venue'] = eo_get_venue_slug();
         } else {
             unset($atts['venue']);
             unset($atts['event-venue']);
         }
     }
     $events = eo_get_events($atts);
     $tz = eo_get_blog_timezone();
     if ($events) {
         $return = '<ul class="eo-events eo-events-shortcode">';
         foreach ($events as $post) {
             setup_postdata($post);
             //Check if all day, set format accordingly
             if (eo_is_all_day()) {
                 $format = get_option('date_format');
             } else {
                 $format = get_option('date_format') . '  ' . get_option('time_format');
             }
             $dateTime = new DateTime($post->StartDate . ' ' . $post->StartTime, $tz);
             if (empty($content)) {
                 $return .= '<li><a title="' . the_title_attribute(array('echo' => false)) . '" href="' . get_permalink() . '">' . get_the_title() . '</a> ' . __('on', 'eventorganiser') . ' ' . eo_format_date($post->StartDate . ' ' . $post->StartTime, $format) . '</li>';
             } else {
                 $return .= '<li>' . self::read_template($content) . '</li>';
             }
         }
         $return .= '</ul>';
         $post = $tmp_post;
         wp_reset_postdata();
         return $return;
     }
 }
function eventorganiser_admin_calendar()
{
    //request
    $request = array('event_end_after' => $_GET['start'], 'event_start_before' => $_GET['end']);
    //Presets
    $presets = array('posts_per_page' => -1, 'post_type' => 'event', 'group_events_by' => '', 'perm' => 'readable');
    //Create query
    $query_array = array_merge($presets, $request);
    $query = new WP_Query($query_array);
    //Retrieve events
    $query->get_posts();
    $eventsarray = array();
    //Blog timezone
    $tz = eo_get_blog_timezone();
    //Loop through events
    global $post;
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $event = array();
            $colour = '';
            //Get title, append status if applicable
            $title = get_the_title();
            if (!empty($post->post_password)) {
                $title .= ' - ' . __('Protected');
            } elseif ($post->post_status == 'private') {
                $title .= ' - ' . __('Private');
            } elseif ($post->post_status == 'draft') {
                $title .= ' - ' . __('Draft');
            }
            $event['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
            //Check if all day, set format accordingly
            if (eo_is_all_day()) {
                $event['allDay'] = true;
                $format = get_option('date_format');
            } else {
                $event['allDay'] = false;
                $format = get_option('date_format') . '  ' . get_option('time_format');
            }
            //Get author (or organiser)
            $organiser = get_userdata($post->post_author)->display_name;
            //Get Event Start and End date, set timezone to the blog's timzone
            $event_start = new DateTime($post->StartDate . ' ' . $post->StartTime, $tz);
            $event_end = new DateTime($post->EndDate . ' ' . $post->FinishTime, $tz);
            $event['start'] = $event_start->format('Y-m-d\\TH:i:s\\Z');
            $event['end'] = $event_end->format('Y-m-d\\TH:i:s\\Z');
            //Produce summary of event
            $summary = "<table>" . "<tr><th> " . __('Start', 'eventorganiser') . ": </th><td> " . eo_format_datetime($event_start, $format) . "</td></tr>" . "<tr><th> " . __('End', 'eventorganiser') . ": </th><td> " . eo_format_datetime($event_end, $format) . "</td></tr>" . "<tr><th> " . __('Organiser', 'eventorganiser') . ": </th><td>" . $organiser . "</td></tr>";
            $event['className'] = array('event');
            $now = new DateTIme(null, $tz);
            if ($event_start <= $now) {
                $event['className'][] = 'past-event';
            }
            //Include venue if this is set
            $venue = eo_get_venue($post->ID);
            if ($venue && !is_wp_error($venue)) {
                $summary .= "<tr><th>" . __('Where', 'eventorganiser') . ": </th><td>" . eo_get_venue_name($venue) . "</td></tr>";
                $event['className'][] = 'venue-' . eo_get_venue_slug($post->ID);
                $event['venue'] = $venue;
            }
            $summary = apply_filters('eventorganiser_admin_cal_summary', $summary, $post->ID, $post->event_id, $post);
            $summary .= "</table><p>";
            //Include schedule summary if event reoccurrs
            if ($post->event_schedule != 'once') {
                $summary .= '<em>' . __('This event reoccurs', 'eventorganiser') . ' ' . eo_get_schedule_summary() . '</em>';
            }
            $summary .= '</p>';
            //Include edit link in summary if user has permission
            if (current_user_can('edit_event', $post->ID)) {
                $edit_link = get_edit_post_link($post->ID, '');
                $summary .= "<span class='edit'><a title='Edit this item' href='" . $edit_link . "'> " . __('Edit Event', 'eventorganiser') . "</a></span>";
                $event['url'] = $edit_link;
            }
            //Include a delete occurrence link in summary if user has permission
            if (current_user_can('delete_event', $post->ID)) {
                $admin_url = admin_url('edit.php');
                $delete_url = add_query_arg(array('post_type' => 'event', 'page' => 'calendar', 'series' => $post->ID, 'event' => $post->event_id, 'action' => 'delete_occurrence'), $admin_url);
                $delete_url = wp_nonce_url($delete_url, 'eventorganiser_delete_occurrence_' . $post->event_id);
                $summary .= "<span class='delete'>\n\t\t\t\t\t<a class='submitdelete' style='color:red;float:right' title='" . __('Delete this occurrence', 'eventorganiser') . "' href='" . $delete_url . "'> " . __('Delete this occurrence', 'eventorganiser') . "</a>\n\t\t\t\t\t</span>";
                if ($post->event_schedule != 'once') {
                    $break_url = add_query_arg(array('post_type' => 'event', 'page' => 'calendar', 'series' => $post->ID, 'event' => $post->event_id, 'action' => 'break_series'), $admin_url);
                    $break_url = wp_nonce_url($break_url, 'eventorganiser_break_series_' . $post->event_id);
                    $summary .= "<span class='break'>\n\t\t\t\t\t\t<a class='submitbreak' style='color:red;float:right;padding-right: 2em;' title='" . __('Break this series', 'eventorganiser') . "' href='" . $break_url . "'> " . __('Break this series', 'eventorganiser') . "</a>\n\t\t\t\t\t\t</span>";
                }
            }
            $terms = get_the_terms($post->ID, 'event-category');
            $event['category'] = array();
            if ($terms) {
                foreach ($terms as $term) {
                    $event['category'][] = $term->slug;
                    if (empty($event['color'])) {
                        $event['color'] = isset($term->color) ? $term->color : '';
                    }
                    $event['className'][] = 'category-' . $term->slug;
                }
            }
            $event['summary'] = $summary;
            //Add event to array
            $eventsarray[] = $event;
        }
    }
    //Echo result and exit
    echo json_encode($eventsarray);
    exit;
}