__('Displays upcoming events with optional filters.', AEC_NAME)); parent::WP_Widget(false, __('AEC Upcoming Events', AEC_NAME), $widget_ops); } function query_events_by_category ($category_id, $eventlimit) { global $wpdb; $start = date('Y-m-d'); $andcategory = ($category_id) ? ' AND category_id = ' . $category_id : ''; $results = $wpdb->get_results($wpdb->prepare('SELECT id, title, start, end, allDay, category_id FROM ' . $wpdb->prefix . AEC_EVENT_TABLE . ' WHERE (start >= %s OR end >= %s)' . $andcategory . ' ORDER BY start LIMIT %d;', $start, $start, $eventlimit)); if ($results !== false) { return $results; } } function query_categories() { global $wpdb; $results = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . AEC_CATEGORY_TABLE . ' ORDER BY id;'); if ($results !== false) { return $results; } } function widget($args, $instance) { extract($args, EXTR_SKIP); $whitelabel = ($instance['whitelabel']) ? apply_filters('widget_whitelabel', $instance['whitelabel']) : false; $eventlimit = ($instance['eventlimit']) ? apply_filters('widget_eventlimit', $instance['eventlimit']) : 4; $category = ($instance['category']) ? apply_filters('widget_category', $instance['category']) : 0; $title = ($instance['title']) ? apply_filters('widget_title', $instance['title']) : __('Upcoming Events', AEC_NAME); $callink = ($instance['callink']) ? apply_filters('widget_callink', $instance['callink']) : 0; echo $before_widget; echo $before_title . $title . $after_title; $out = ''; echo $out; echo $after_widget; } function update ($new_instance, $old_instance) { $instance = $old_instance; $instance['whitelabel'] = (isset($new_instance['whitelabel']) ? 1 : 0); $instance['callink'] = $new_instance['callink']; $instance['eventlimit'] = $new_instance['eventlimit']; $instance['title'] = $new_instance['title']; $instance['category'] = $new_instance['category']; return $instance; } /** @see WP_Widget::form */ function form ($instance) { $instance = wp_parse_args((array) $instance, array('eventlimit' => 4, 'title' => __('Upcoming Events', AEC_NAME), 'category' => 0, 'whitelabel' => false, 'callink' => '')); $whitelabel = $instance['whitelabel']; $eventlimit = $instance['eventlimit']; $title = $instance['title']; $category = $instance['category']; $callink = $instance['callink']; ?>

IMPORTANT:
This widget will be removed from future versions of the Ajax Event Calendar plugin. Instead, use the [eventlist] shortcode, explained here, which offers more customization and placement options than the widget.

NOTE:
This widget will not properly render repeat events.


id="get_field_id('whitelabel'); ?>" name="get_field_name('whitelabel'); ?>" />