/** * Get (and instantiate, if necessary) the instance of the class * * @static * @return Tribe__Events__Pro__This_Week */ public static function instance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
/** * @param $args * @param $instance */ public function widget($args, $instance) { // Initialize defaults. When the widget is added via the Customizer, the widget is rendered // prior to being saved and the instance is empty. This ensures that $instance holds the // defaults so the behavior is expected and doesn't throw notices. $instance = $this->instance_defaults($instance); //Disable Tooltips $ecp = Tribe__Events__Pro__Main::instance(); $tooltip_status = $ecp->recurring_info_tooltip_status(); $ecp->disable_recurring_info_tooltip(); //Check If a Taxonomy is set if (!empty($instance['raw_filters']) || isset($instance['filters'])) { $filters = isset($instance['raw_filters']) ? $instance['raw_filters'] : json_decode($instance['filters']); } else { $filters = null; } //Prepare Categories for Query $tax_query = Tribe__Events__Pro__Widgets::form_tax_query($filters, $instance['operand']); //Use Date to find start of week if provided in shortcode $start_date = isset($instance['start_date']) ? $instance['start_date'] : null; //Use Date to find start of week if provided in shortcode $week_offset = isset($instance['week_offset']) ? $instance['week_offset'] : null; //Array of Variables to use for Data Attributes and $this_week_query_vars['start_date'] = tribe_get_this_week_first_week_day($start_date, $week_offset); $this_week_query_vars['end_date'] = tribe_get_this_week_last_week_day($this_week_query_vars['start_date']); $this_week_query_vars['count'] = $instance['count']; $this_week_query_vars['layout'] = $instance['layout']; $this_week_query_vars['tax_query'] = $tax_query; $this_week_query_vars['hide_weekends'] = isset($instance['hide_weekends']) ? $instance['hide_weekends'] : false; //Setup Variables for Template $this_week_template_vars = Tribe__Events__Pro__This_Week::this_week_template_vars($this_week_query_vars); //Setup Attributes for Ajax $this_week_data_attrs = Tribe__Events__Pro__This_Week::this_week_data_attr($this_week_query_vars); //Setups This Week Object for Each Day $week_days = Tribe__Events__Pro__This_Week::this_week_query($this_week_query_vars); echo $args['before_widget']; do_action('tribe_events_this_week_widget_before_the_title'); echo !empty($instance['title']) ? $args['before_title'] . $instance['title'] . $args['after_title'] : ''; do_action('tribe_events_this_week_widget_after_the_title'); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/this-week-widget.php'); echo $args['after_widget']; // Re-enable recurring event info if ($tooltip_status) { $ecp->enable_recurring_info_tooltip(); } wp_reset_postdata(); }
/** * The class init function. * * @return void */ public function init() { Tribe__Events__Pro__Mini_Calendar::instance(); Tribe__Events__Pro__This_Week::instance(); Tribe__Events__Pro__Custom_Meta::init(); Tribe__Events__Pro__Recurrence_Meta::init(); Tribe__Events__Pro__Geo_Loc::instance(); Tribe__Events__Pro__Community_Modifications::init(); $this->displayMetaboxCustomFields(); $this->custom_meta_tools = new Tribe__Events__Pro__Admin__Custom_Meta_Tools(); $this->single_event_meta = new Tribe__Events__Pro__Single_Event_Meta(); $this->single_event_overrides = new Tribe__Events__Pro__Recurrence__Single_Event_Overrides(); $this->queue_processor = new Tribe__Events__Pro__Recurrence__Queue_Processor(); $this->queue_realtime = new Tribe__Events__Pro__Recurrence__Queue_Realtime(); $this->embedded_maps = new Tribe__Events__Pro__Embedded_Maps(); $this->widget_wrappers = new Tribe__Events__Pro__Shortcodes__Widget_Wrappers(); $this->singular_event_label = tribe_get_event_label_singular(); $this->plural_event_label = tribe_get_event_label_plural(); }