source/php/Widget/DisplayEvents.php
public function widget($args, $instance)
    {
        if ( ! isset( $args['widget_id'] ) ) {
            $args['widget_id'] = $this->id;
        }
        $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
        $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
        $limit = isset($instance['limit']) ? intval($instance['limit']) : null;
        $days_ahead = isset($instance['days_ahead']) ? $instance['days_ahead'] : null;
        $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : true;
        $show_image = isset( $instance['show_image'] ) ? $instance['show_image'] : false;
        $show_content = isset( $instance['show_content'] ) ? $instance['show_content'] : false;
        $show_location = isset( $instance['show_location'] ) ? $instance['show_location'] : false;
        $content_limit = isset($instance['content_limit']) ? $instance['content_limit'] : null;

        $start_date = date('Y-m-d H:i:s', strtotime("today midnight"));
        $end_date = date('Y-m-d H:i:s', strtotime("tomorrow midnight +$days_ahead days") - 1);
        $params = array('start_date'    => $start_date,
                        'end_date'      => $end_date,
                        'display_limit' => $limit
                        );
        $events = QueryEvents::getEventsByInterval($params);

        ?>
        <?php echo $args['before_widget']; ?>
        <?php if ( $title ) {
            echo $args['before_title'] . $title . $args['after_title'];
        } ?>
        <ul>
        <?php if (!$events) : ?>
            <li><?php _e('No events found', 'event-integration'); ?></li>
        <?php else: ?>
        <?php foreach ($events as $event) : ?>
            <li>
            <?php if ($show_image) : ?>
                <?php echo get_the_post_thumbnail( $event->ID, 'large', array('class' => 'event-img')); ?>
            <?php endif; ?>

            <?php if (! empty($event->post_title && isset($event->post_title))) : ?>
                <?php $date_url = preg_replace('/\D/', '', $event->start_date); ?>
                <a href="<?php echo esc_url( add_query_arg( 'date', $date_url, get_page_link($event->ID) ) )?>"><?php echo $event->post_title ?></a>
            <?php endif; ?>

            <?php if ($show_date && ! empty($event->start_date && isset($event->start_date))) : ?>
                <span><?php echo \EventManagerIntegration\App::formatEventDate($event->start_date, $event->end_date) ?></span>
            <?php endif; ?>

           <?php if ($show_location && get_post_meta($event->ID, 'location', true)) : ?>
                <?php $location = get_post_meta($event->ID, 'location', true); ?>
                <span><?php echo sprintf(__('Location: %s', 'event-integration'), $location['title']) ?></span>
            <?php endif; ?>

            <?php if ($show_content && $event->content_mode == 'custom' && ! empty($event->content)) : ?>
                <?php echo QueryEvents::stringLimiter( $event->content, $content_limit ); ?>
            <?php elseif($show_content && ! empty($event->post_content)): ?>
                <?php echo QueryEvents::stringLimiter( $event->post_content, $content_limit ); ?>
            <?php endif; ?>
            </li>
        <?php endforeach; ?>
        <?php endif; ?>
        </ul>
        <?php echo $args['after_widget'];
    }
public function widget($args, $instance)
    {
        if ( ! isset( $args['widget_id'] ) ) {
            $args['widget_id'] = $this->id;
        }
        $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
        $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
        $limit = isset($instance['limit']) ? intval($instance['limit']) : null;
        $days_ahead = isset($instance['days_ahead']) ? $instance['days_ahead'] : null;
        $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : true;
        $show_image = isset( $instance['show_image'] ) ? $instance['show_image'] : false;
        $show_content = isset( $instance['show_content'] ) ? $instance['show_content'] : false;
        $show_location = isset( $instance['show_location'] ) ? $instance['show_location'] : false;
        $content_limit = isset($instance['content_limit']) ? $instance['content_limit'] : null;

        $start_date = date('Y-m-d H:i:s', strtotime("today midnight"));
        $end_date = date('Y-m-d H:i:s', strtotime("tomorrow midnight +$days_ahead days") - 1);
        $params = array('start_date'    => $start_date,
                        'end_date'      => $end_date,
                        'display_limit' => $limit
                        );
        $events = QueryEvents::getEventsByInterval($params);

        ?>
        <?php echo $args['before_widget']; ?>
        <?php if ( $title ) {
            echo $args['before_title'] . $title . $args['after_title'];
        } ?>
        <ul>
        <?php if (!$events) : ?>
            <li><?php _e('No events found', 'event-integration'); ?></li>
        <?php else: ?>
        <?php foreach ($events as $event) : ?>
            <li>
            <?php if ($show_image) : ?>
                <?php echo get_the_post_thumbnail( $event->ID, 'large', array('class' => 'event-img')); ?>
            <?php endif; ?>

            <?php if (! empty($event->post_title && isset($event->post_title))) : ?>
                <?php $date_url = preg_replace('/\D/', '', $event->start_date); ?>
                <a href="<?php echo esc_url( add_query_arg( 'date', $date_url, get_page_link($event->ID) ) )?>"><?php echo $event->post_title ?></a>
            <?php endif; ?>

            <?php if ($show_date && ! empty($event->start_date && isset($event->start_date))) : ?>
                <span><?php echo \EventManagerIntegration\App::formatEventDate($event->start_date, $event->end_date) ?></span>
            <?php endif; ?>

           <?php if ($show_location && get_post_meta($event->ID, 'location', true)) : ?>
                <?php $location = get_post_meta($event->ID, 'location', true); ?>
                <span><?php echo sprintf(__('Location: %s', 'event-integration'), $location['title']) ?></span>
            <?php endif; ?>

            <?php if ($show_content && $event->content_mode == 'custom' && ! empty($event->content)) : ?>
                <?php echo QueryEvents::stringLimiter( $event->content, $content_limit ); ?>
            <?php elseif($show_content && ! empty($event->post_content)): ?>
                <?php echo QueryEvents::stringLimiter( $event->post_content, $content_limit ); ?>
            <?php endif; ?>
            </li>
        <?php endforeach; ?>
        <?php endif; ?>
        </ul>
        <?php echo $args['after_widget'];
    }
Outputs the content for the current Display Events widget instance.

@param array $args     Widget arguments.
@param array $instance Saved values from database.