defaults = array( 'title' => __('Event Locations','dbem'), 'scope' => 'future', 'order' => 'ASC', 'limit' => 5, 'format' => '#_LOCATIONLINK', 'orderby' => 'event_start_date,event_start_time,location_name' ); $this->em_orderby_options = array( 'event_start_date, event_start_time, location_name' => __('Event start date/time, location name','dbem'), 'location_name' => __('Location name','dbem') ); $widget_ops = array('description' => __( "Display a list of event locations on Events Manager.", 'dbem') ); parent::WP_Widget(false, $name = 'Event Locations', $widget_ops); } /** @see WP_Widget::widget */ function widget($args, $instance) { $instance = array_merge($this->defaults, $instance); echo $args['before_widget']; echo $args['before_title']; echo $instance['title']; echo $args['after_title']; $instance['owner'] = false; $locations = EM_Locations::get(apply_filters('em_widget_locations_get_args',$instance)); echo ""; echo $args['after_widget']; } /** @see WP_Widget::update */ function update($new_instance, $old_instance) { //filter the new instance and replace blanks with defaults foreach($this->defaults as $key => $value){ if( empty($new_instance[$key]) ){ $new_instance[$key] = $value; } } return $new_instance; } /** @see WP_Widget::form */ function form($instance) { $instance = array_merge($this->defaults, $instance); ?>