public function widget($args, $instance) { global $xi_widget_args, $xi_widget_instance, $upcoming_events; $xi_widget_args = $ags; $xi_widget_instance = $instance; if (!is_array($instance['terms'])) { $upcoming_events = XiQuery::get_upcoming_events($instance['num_events']); } else { $upcoming_events = XiQuery::get_upcoming_events($instance['num_events'], $instance['terms']); } XiUtilities::include_template('widget_upcoming-events.php'); }
/** * Get a list of events, optionally filterable by category */ public static function events_list($atts) { $atts = shortcode_atts(array('calendar_id' => '', 'category_id' => '', 'events_per_page' => 10, 'show_category_filter' => 'true'), $atts, 'xi_events_list'); $terms = array(); $terms[XiEvents::$category_taxonomy_name] = array(); $terms[XiEvents::$calendar_taxonomy_name] = array(); if (!empty($atts['category_id'])) { $terms[XiEvents::$category_taxonomy_name] = explode(',', $atts['category_id']); $terms[XiEvents::$category_taxonomy_name] = array_map('trim', $terms[XiEvents::$category_taxonomy_name]); } if (!empty($atts['calendar_id'])) { $terms[XiEvents::$calendar_taxonomy_name] = explode(',', $atts['calendar_id']); $terms[XiEvents::$calendar_taxonomy_name] = array_map('trim', $terms[XiEvents::$calendar_taxonomy_name]); } global $xi_shortcode_attributes, $xi_events; $xi_shortcode_attributes = $atts; $xi_events = XiQuery::get_upcoming_events($atts['events_per_page'], $terms); $template = XiUtilities::get_include_template('shortcode_event-list.php'); return $template; }