/** * Enqueue the appropriate CSS for the calendar/advanced list widgets, which share * the same basic appearance. */ public static function enqueue_calendar_widget_styles() { // CSS file $event_file = 'widget-calendar.css'; $event_file_option = 'widget-calendar-theme.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // Choose the appropriate stylesheet in light of the current styling options switch ($stylesheet_option) { case 'skeleton': case 'full': $event_file_option = "widget-calendar-{$stylesheet_option}.css"; break; } $style_url = tribe_events_pro_resource_url($event_file_option); $style_url = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $style_url); $style_override_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/pro/' . $event_file, $style_url); // Load up stylesheet from theme or plugin if ($style_url && 'tribe' === $stylesheet_option) { wp_enqueue_style('widget-calendar-pro-style', tribe_events_pro_resource_url('widget-calendar-full.css'), array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } else { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } if ($style_override_url) { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '--widget-calendar-pro-override-style', $style_override_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } }
public function widget($args, $instance) { extract($args); extract($instance); if (empty($hide_if_empty)) { $hide_if_empty = false; } $event_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'venue' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'list', 'tribe_render_context' => 'widget'); /** * Filter Venue Widget tribe_get_event args * * @param array $event_args Arguments for the Venue Widget's call to tribe_get_events */ $event_args = apply_filters('tribe_events_pro_venue_widget_event_query_args', $event_args); // Get all the upcoming events for this venue. $events = tribe_get_events($event_args, true); // If there are no events, and the user has set to hide if empty, don't display the widget. if ($hide_if_empty && !$events->have_posts()) { return; } $ecp = Tribe__Events__Pro__Main::instance(); $tooltip_status = $ecp->recurring_info_tooltip_status(); $ecp->disable_recurring_info_tooltip(); echo $before_widget; do_action('tribe_events_venue_widget_before_the_title'); echo $instance['title'] ? $args['before_title'] . $instance['title'] . $args['after_title'] : ''; do_action('tribe_events_venue_widget_after_the_title'); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/venue-widget.php'); echo $after_widget; if ($tooltip_status) { $ecp->enable_recurring_info_tooltip(); } wp_reset_postdata(); }
public function widget($args, $instance) { // We need the Defaults to avoid problems on the Customizer $defaults = array('title' => '', 'venue_ID' => null, 'count' => 3, 'hide_if_empty' => true); $instance = wp_parse_args((array) $instance, $defaults); extract($args); extract($instance); if (empty($hide_if_empty) || 'false' === $hide_if_empty) { $hide_if_empty = false; } $event_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'venue' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'list', 'tribe_render_context' => 'widget'); /** * Filter Venue Widget tribe_get_event args * * @param array $event_args Arguments for the Venue Widget's call to tribe_get_events */ $event_args = apply_filters('tribe_events_pro_venue_widget_event_query_args', $event_args); // Get all the upcoming events for this venue. $events = tribe_get_events($event_args, true); // If there are no events, and the user has set to hide if empty, don't display the widget. if ($hide_if_empty && !$events->have_posts()) { return; } $ecp = Tribe__Events__Pro__Main::instance(); $tooltip_status = $ecp->recurring_info_tooltip_status(); $ecp->disable_recurring_info_tooltip(); echo $before_widget; do_action('tribe_events_venue_widget_before_the_title'); echo $instance['title'] ? $args['before_title'] . $instance['title'] . $args['after_title'] : ''; do_action('tribe_events_venue_widget_after_the_title'); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/venue-widget.php'); echo $after_widget; if ($tooltip_status) { $ecp->enable_recurring_info_tooltip(); } $jsonld_enable = isset($instance['jsonld_enable']) ? $instance['jsonld_enable'] : true; /** * Filters whether JSON LD information should be printed to the page or not for this widget type. * * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`. */ $jsonld_enable = apply_filters('tribe_events_' . $this->id_base . '_jsonld_enabled', $jsonld_enable); /** * Filters whether JSON LD information should be printed to the page for any widget type. * * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`. */ $jsonld_enable = apply_filters('tribe_events_widget_jsonld_enabled', $jsonld_enable); if ($jsonld_enable) { $this->print_jsonld_markup_for($events); } wp_reset_postdata(); }
public function get_output($event_ID, $complete, $show_seconds, $event_date = null) { $ret = $complete; ob_start(); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/countdown-widget'); $hourformat = ob_get_clean(); // Get the event start date. $startdate = tribe_is_recurring_event($event_ID) ? $event_date . ' ' . tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBTIMEFORMAT) : tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT); // Get the number of seconds remaining until the date in question. $seconds = strtotime($startdate) - current_time('timestamp'); if ($seconds > 0) { $ret = $this->generate_countdown_output($seconds, $complete, $hourformat, $event_ID, $event_date); } return $ret; }
/** * @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(); }
public function handle() { // check if responsive should be killed if (apply_filters('tribe_events_kill_responsive', false)) { add_filter('tribe_events_mobile_breakpoint', '__return_zero'); } $stylesheets = array(); $mobile_break = tribe_get_mobile_breakpoint(); // Get the selected style option $style_option = tribe_get_option('stylesheetOption', 'tribe'); // from `some-style-option` // to `Tribe__Events__Asset__Events_Css_Some_Style_Option` $child_class_name = $this->get_child_class_name($style_option); /** * @var Tribe__Events__Asset__Abstract_Events_Css */ $child_class_instance = new $child_class_name(); // `$stylesheets` passed by reference $child_class_instance->handle($stylesheets, $mobile_break); // put override css at the end of the array $stylesheets['tribe-events-calendar-override-style'] = 'tribe-events/tribe-events.css'; // do the enqueues foreach ($stylesheets as $name => $css_file) { if ($name == 'tribe-events-calendar-override-style') { $user_stylesheet_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/tribe-events.css'); if ($user_stylesheet_url) { wp_enqueue_style($name, $user_stylesheet_url); } } else { // get full URL $url = tribe_events_resource_url($css_file); // get the minified file $url = Tribe__Events__Template_Factory::getMinFile($url, true); // apply filters $url = apply_filters('tribe_events_stylesheet_url', $url, $name); // set the $media attribute if ($name == 'tribe-events-calendar-mobile-style' || $name == 'tribe-events-calendar-full-mobile-style') { $media = "only screen and (max-width: {$mobile_break}px)"; wp_enqueue_style($name, $url, array('tribe-events-calendar-style'), Tribe__Events__Main::VERSION, $media); } else { wp_register_style($name, $url, array(), Tribe__Events__Main::VERSION); wp_enqueue_style($name); } } } }
public function show_form() { // Locate the template, allow for The Events Calendar style overrides ... but don't // trust the returned filepath: at least as of TEC 3.8.x a non-existent path may be returned $template = Tribe__Events__Templates::getTemplateHierarchy('rsvp-form', array('disable_view_check' => true)); if (!$template || !file_exists($template)) { $template = EVENTROCKET_INC . '/templates/rsvp-form.php'; } // Load our settings $enabled = get_post_meta(get_the_ID(), EventRocket_RSVPManager::ENABLE_RSVP, true); $restricted = get_post_meta(get_the_ID(), EventRocket_RSVPManager::RESTRICT_RSVP, true); $limited = get_post_meta(get_the_ID(), EventRocket_RSVPManager::LIMIT_RSVP, true); $show_attendees = get_post_meta(get_the_ID(), EventRocket_RSVPManager::SHOW_ATTENDEES_RSVP, true); $attendance = eventrocket_rsvp()->attendance(); $anon_accepted = get_the_ID() === $this->anon_sub_accepted; $attendees = eventrocket_rsvp()->attendance(get_the_ID()); include $template; }
/** * @todo revise so that our stylesheet is enqueued in time for the link to be included within the head element */ protected function styles_and_scripts() { wp_enqueue_script('tribe-mini-calendar', tribe_events_pro_resource_url('widget-calendar.js'), array('jquery'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); Tribe__Events__Pro__Widgets::enqueue_calendar_widget_styles(); // Tribe Events CSS filename $event_file = 'widget-calendar.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // What Option was selected switch ($stylesheet_option) { case 'skeleton': $event_file_option = 'widget-calendar-' . $stylesheet_option . '.css'; break; case 'full': $event_file_option = 'widget-calendar-' . $stylesheet_option . '.css'; break; default: $event_file_option = 'widget-calendar-theme.css'; break; } $styleUrl = tribe_events_pro_resource_url($event_file_option); $styleUrl = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $styleUrl); $styleOverrideUrl = Tribe__Events__Templates::locate_stylesheet('tribe-events/pro/' . $event_file, $styleUrl); // Load up stylesheet from theme or plugin if ($styleUrl && $stylesheet_option == 'tribe') { wp_enqueue_style('widget-calendar-pro-style', tribe_events_pro_resource_url('widget-calendar-full.css'), array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $styleUrl, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } else { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $styleUrl, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } if ($styleOverrideUrl) { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '--widget-calendar-pro-override-style', $styleOverrideUrl, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } $widget_data = array('ajaxurl' => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); wp_localize_script('tribe-mini-calendar', 'TribeMiniCalendar', $widget_data); }
/** * Checks where we are are and determines if we should show events in the main loop * * @param WP_Query $query * * @return WP_Query */ public static function showInLoops($query) { if (!is_admin() && tribe_get_option('showInLoops') && ($query->is_home() || $query->is_tag) && empty($query->query_vars['post_type']) && false == $query->query_vars['suppress_filters']) { // @todo remove // 3.3 know-how for main query check if (self::is_main_loop($query)) { self::$isMainLoop = true; $post_types = array('post', Tribe__Events__Main::POSTTYPE); $query->set('post_type', $post_types); } } return $query; }
/** * Current Template * * Get the current page template that we are on * * @category Events * @todo Update the function name to ensure there are no namespace conflicts. * @return string Page template */ function tribe_get_current_template() { return apply_filters('tribe_get_current_template', Tribe__Events__Templates::get_current_page_template()); }
/** * Generates and returns the email template for a group of attendees. * * @param $tickets * * @return string */ public function generate_tickets_email_content($tickets) { ob_start(); include Tribe__Events__Templates::getTemplateHierarchy('tickets/email.php', array('namespace' => 'tickets')); return ob_get_clean(); }
/** * The main widget output function (called by the class's widget() function). * * @param array $args * @param array $instance * @param string $template_name The template name. * @param string $subfolder The subfolder where the template can be found. * @param string $namespace The namespace for the widget template stuff. * @param string $pluginPath The pluginpath so we can locate the template stuff. */ public function widget_output($args, $instance, $template_name = 'widgets/list-widget') { global $wp_query, $tribe_ecp, $post; $instance = wp_parse_args($instance, array('limit' => self::$limit, 'title' => '')); /** * @var $after_title * @var $after_widget * @var $before_title * @var $before_widget * @var $limit * @var $no_upcoming_events * @var $title */ extract($args, EXTR_SKIP); extract($instance, EXTR_SKIP); // Temporarily unset the tribe bar params so they don't apply $hold_tribe_bar_args = array(); foreach ($_REQUEST as $key => $value) { if ($value && strpos($key, 'tribe-bar-') === 0) { $hold_tribe_bar_args[$key] = $value; unset($_REQUEST[$key]); } } $title = apply_filters('widget_title', $title); self::$limit = absint($limit); if (!function_exists('tribe_get_events')) { return; } self::$posts = tribe_get_events(apply_filters('tribe_events_list_widget_query_args', array('eventDisplay' => 'list', 'posts_per_page' => self::$limit, 'tribe_render_context' => 'widget'))); // If no posts, and the don't show if no posts checked, let's bail if (empty(self::$posts) && $no_upcoming_events) { return; } echo $before_widget; do_action('tribe_events_before_list_widget'); if ($title) { do_action('tribe_events_list_widget_before_the_title'); echo $before_title . $title . $after_title; do_action('tribe_events_list_widget_after_the_title'); } // Include template file include Tribe__Events__Templates::getTemplateHierarchy($template_name); do_action('tribe_events_after_list_widget'); echo $after_widget; wp_reset_query(); // Reinstate the tribe bar params if (!empty($hold_tribe_bar_args)) { foreach ($hold_tribe_bar_args as $key => $value) { $_REQUEST[$key] = $value; } } }
/** * Enqueue the plugin stylesheet(s). * * @author caseypicker * @since 3.9 * @return void */ public function enqueue_styles() { //Only enqueue wootickets styles on singular event page if (is_singular(Tribe__Events__Main::POSTTYPE)) { $stylesheet_url = $this->pluginUrl . 'src/resources/css/wootickets.css'; // Get minified CSS if it exists $stylesheet_url = Tribe__Events__Template_Factory::getMinFile($stylesheet_url, true); // apply filters $stylesheet_url = apply_filters('tribe_wootickets_stylesheet_url', $stylesheet_url); wp_enqueue_style('TribeEventsWooTickets', $stylesheet_url, array(), apply_filters('tribe_events_wootickets_css_version', self::VERSION)); //Check for override stylesheet $user_stylesheet_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/wootickets/wootickets.css'); $user_stylesheet_url = apply_filters('tribe_events_wootickets_stylesheet_url', $user_stylesheet_url); //If override stylesheet exists, then enqueue it if ($user_stylesheet_url) { wp_enqueue_style('tribe-events-wootickets-override-style', $user_stylesheet_url); } } }
/** * Get the Output of the Widget based on the Instance from the Database * * @param array $instance The Array of arguments that will build the HTML * @param null $deprecated Deprecated Argument * @param null $deprecated_ Deprecated Argument * @param null $deprecated__ Deprecated Argument * @return string */ public function get_output($instance, $deprecated = null, $deprecated_ = null, $deprecated__ = null) { if ('next-event' === $instance['type']) { $event = tribe_get_events(array('eventDisplay' => 'list', 'posts_per_page' => 1)); $event = reset($event); } else { $event = get_post($instance['event']); } $ret = $instance['complete']; $show_seconds = $instance['show_seconds']; ob_start(); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/countdown-widget'); $hourformat = ob_get_clean(); if ($event instanceof WP_Post) { // Get the event start date. $startdate = tribe_get_start_date($event->ID, false, Tribe__Date_Utils::DBDATETIMEFORMAT); // Get the number of seconds remaining until the date in question. $seconds = strtotime($startdate) - current_time('timestamp'); } else { $seconds = 0; } if ($seconds > 0) { $ret = $this->generate_countdown_output($seconds, $instance['complete'], $hourformat, $event); } return $ret; }
/** * Get the path to the current events template. * * @param string $template The current template path. * * @return string The modified template path. */ public function select_page_template($template) { // venue view if (is_singular(Tribe__Events__Main::VENUE_POST_TYPE)) { $template = Tribe__Events__Templates::getTemplateHierarchy('pro/single-venue'); } // organizer view if (is_singular(Tribe__Events__Main::ORGANIZER_POST_TYPE)) { $template = Tribe__Events__Templates::getTemplateHierarchy('pro/single-organizer'); } // week view if (tribe_is_week()) { $template = Tribe__Events__Templates::getTemplateHierarchy('pro/week'); } // photo view if (tribe_is_photo()) { $template = Tribe__Events__Templates::getTemplateHierarchy('pro/photo'); } // map view if (tribe_is_map()) { $template = Tribe__Events__Templates::getTemplateHierarchy('pro/map'); } // recurring "all" view if (tribe_is_showing_all()) { $template = Tribe__Events__Templates::getTemplateHierarchy('list'); } return $template; }
/** * Set the message to display - or template to pull in - should no results be found. */ protected function set_fallbacks() { // Has a (usually short) piece of text been provided, ie "Nothing found"? if (isset($this->params['nothing_found_text']) && is_string($this->params['nothing_found_text'])) { $this->nothing_found_text = $this->params['nothing_found_text']; } // Has a template path been provided? if (!isset($this->params['nothing_found_template'])) { return; } // If not an absolute filepath use Tribe's template finder if (isset($this->params['nothing_found_template']) && 0 !== strpos($this->params['nothing_found_template'], '/')) { $this->nothing_found_template = Tribe__Events__Templates::getTemplateHierarchy($this->params['nothing_found_template']); } // Ensure the template exists if (!$this->nothing_found_template && file_exists($this->params['nothing_found_template'])) { $this->nothing_found_template = $this->params['nothing_found_template']; } }
/** * Help to ensure the list view works on the front page (when it is set to be the * default view). * * @param $template * @return string */ public function list_view_helper($template) { global $wp_query; // Determine if it's appropriate to interfere $events_frontpage = $wp_query->get('eventrocket_frontpage'); $is_list = tribe_is_list_view(); $single_template_chosen = false !== strpos($template, 'single-event.php'); // Bow out gracefully if we're not needed here if (!($events_frontpage && $is_list && $single_template_chosen)) { return $template; } // Otherwise, try to enforce use of the list view template return Tribe__Events__Templates::getTemplateHierarchy('list', array('disable_view_check' => true)); }
/** * Get the Output of the Widget based on the Instance from the Database * * @param array $instance The Array of arguments that will build the HTML * @param null $deprecated Deprecated Argument * @param null $deprecated_ Deprecated Argument * @param null $deprecated__ Deprecated Argument * @return string */ public function get_output($instance, $deprecated = null, $deprecated_ = null, $deprecated__ = null) { if ('next-event' === $instance['type']) { $event = tribe_get_events(array('eventDisplay' => 'list', 'posts_per_page' => 1)); $event = reset($event); } else { $event = get_post($instance['event']); } $ret = $instance['complete']; $show_seconds = $instance['show_seconds']; ob_start(); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/countdown-widget'); $hourformat = ob_get_clean(); if ($event instanceof WP_Post) { // Get the event start date. $startdate = tribe_get_start_date($event->ID, false, Tribe__Date_Utils::DBDATETIMEFORMAT); // Get the number of seconds remaining until the date in question. $seconds = strtotime($startdate) - current_time('timestamp'); } else { $seconds = 0; } if ($seconds > 0) { $ret = $this->generate_countdown_output($seconds, $instance['complete'], $hourformat, $event); } $jsonld_enable = isset($jsonld_enable) ? $jsonld_enable : true; /** * Filters whether JSON LD information should be printed to the page or not for this widget type. * * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`. */ $jsonld_enable = apply_filters('tribe_events_' . $this->id_base . '_jsonld_enabled', $jsonld_enable); /** * Filters whether JSON LD information should be printed to the page for any widget type. * * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`. */ $jsonld_enable = apply_filters('tribe_events_widget_jsonld_enabled', $jsonld_enable); if ($jsonld_enable) { $this->print_jsonld_markup_for($event); } return $ret; }
/** * Enqueue the plugin stylesheet(s). * * @author PaulHughes01 * @since 3.4 * @return void */ public function enqueueStylesAndScripts() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { $show_filter = apply_filters('tribe_events_filters_should_show', in_array(get_post_type(), array(Tribe__Events__Main::VENUE_POST_TYPE, Tribe__Events__Main::ORGANIZER_POST_TYPE)) ? false : true); if ($show_filter) { //Only display filters before template if the layout is horizontal if (tribe_get_option('events_filters_layout', 'vertical') == 'vertical') { add_action('tribe_events_bar_after_template', array($this, 'displaySidebar'), 25); } else { if (tribe_get_option('tribeDisableTribeBar', false) == true) { add_action('tribe_events_before_template', array($this, 'displaySidebar'), 25); } else { add_action('tribe_events_bar_after_template', array($this, 'displaySidebar'), 25); } } } // enqueue chosen for tag multi-select Tribe__Events__Template_Factory::asset_package('chosen'); Tribe__Events__Template_Factory::asset_package('calendar-script', array('jquery-ui-slider')); wp_enqueue_style('custom-jquery-styles'); wp_enqueue_style('Tribe__Events__Filterbar__View-css', Tribe__Events__Template_Factory::getMinFile($this->pluginUrl . 'src/resources/css/filter-view.css', true), array(), apply_filters('tribe_events_filters_css_version', self::VERSION)); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('Tribe__Events__Filterbar__View-scripts', Tribe__Events__Template_Factory::getMinFile($this->pluginUrl . 'src/resources/js/filter-scripts.js', true), array(), apply_filters('tribe_events_filters_js_version', self::VERSION)); //Check for override stylesheet $user_stylesheet_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/filterbar/filter-view.css'); $user_stylesheet_url = apply_filters('tribe_events_filterbar_stylesheet_url', $user_stylesheet_url); //If override stylesheet exists, then enqueue it if ($user_stylesheet_url) { wp_enqueue_style('tribe-events-filterbar-override-style', $user_stylesheet_url); } } }
/** * The main widget output function (called by the class's widget() function). * * @param array $args * @param array $instance * @param string $template_name The template name. * @param string $subfolder The subfolder where the template can be found. * @param string $namespace The namespace for the widget template stuff. * @param string $pluginPath The pluginpath so we can locate the template stuff. */ public function widget_output($args, $instance, $template_name = 'widgets/list-widget') { global $wp_query, $tribe_ecp, $post; $instance = wp_parse_args($instance, array('limit' => self::$limit, 'title' => '')); /** * @var $after_title * @var $after_widget * @var $before_title * @var $before_widget * @var $limit * @var $no_upcoming_events * @var $title */ extract($args, EXTR_SKIP); extract($instance, EXTR_SKIP); // Temporarily unset the tribe bar params so they don't apply $hold_tribe_bar_args = array(); foreach ($_REQUEST as $key => $value) { if ($value && strpos($key, 'tribe-bar-') === 0) { $hold_tribe_bar_args[$key] = $value; unset($_REQUEST[$key]); } } $title = apply_filters('widget_title', $title); self::$limit = absint($limit); if (!function_exists('tribe_get_events')) { return; } self::$posts = tribe_get_events(apply_filters('tribe_events_list_widget_query_args', array('eventDisplay' => 'list', 'posts_per_page' => self::$limit, 'tribe_render_context' => 'widget'))); // If no posts, and the don't show if no posts checked, let's bail if (empty(self::$posts) && $no_upcoming_events) { return; } echo $before_widget; do_action('tribe_events_before_list_widget'); if ($title) { do_action('tribe_events_list_widget_before_the_title'); echo $before_title . $title . $after_title; do_action('tribe_events_list_widget_after_the_title'); } // Include template file include Tribe__Events__Templates::getTemplateHierarchy($template_name); do_action('tribe_events_after_list_widget'); echo $after_widget; wp_reset_query(); $jsonld_enable = isset($jsonld_enable) ? $jsonld_enable : true; /** * Filters whether JSON LD information should be printed to the page or not for this widget type. * * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`. */ $jsonld_enable = apply_filters('tribe_events_' . $this->id_base . '_jsonld_enabled', $jsonld_enable); /** * Filters whether JSON LD information should be printed to the page for any widget type. * * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`. */ $jsonld_enable = apply_filters('tribe_events_widget_jsonld_enabled', $jsonld_enable); if ($jsonld_enable) { Tribe__Events__JSON_LD__Event::instance()->markup(self::$posts); } // Reinstate the tribe bar params if (!empty($hold_tribe_bar_args)) { foreach ($hold_tribe_bar_args as $key => $value) { $_REQUEST[$key] = $value; } } }
/** * This Week Widget - Ajax Change Week * * */ public function ajax_change_this_week() { $response = array('success' => false, 'html' => '', 'view' => 'this-week'); if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'this-week-ajax')) { wp_send_json_error(); } if (isset($_POST['start_date']) && isset($_POST['count'])) { //Disable Tooltips $ecp = Tribe__Events__Pro__Main::instance(); $tooltip_status = $ecp->recurring_info_tooltip_status(); $ecp->disable_recurring_info_tooltip(); $tax_query = isset($_POST['tax_query']) ? $_POST['tax_query'] : null; $_POST['start_date'] = trim($_POST['start_date']); if (false == strtotime($_POST['start_date'])) { wp_send_json_error(); } //Array of Variables to use for Data Attributes and Query $this_week_query_vars['start_date'] = $_POST['start_date']; $this_week_query_vars['end_date'] = tribe_get_last_week_day($_POST['start_date']); $this_week_query_vars['count'] = $_POST['count']; $this_week_query_vars['layout'] = $_POST['layout']; $this_week_query_vars['tax_query'] = $tax_query; $this_week_query_vars['hide_weekends'] = $_POST['hide_weekends']; //Setup Variables for Template $this_week_template_vars = self::this_week_template_vars($this_week_query_vars); //Setup Attributes for Ajax $this_week_data_attrs = self::this_week_data_attr($this_week_query_vars); //Setups This Week Object for Each Day $week_days = self::this_week_query($this_week_query_vars); ob_start(); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/this-week-widget.php'); $response['html'] = ob_get_clean(); $response['success'] = true; // Re-enable recurring event info if ($tooltip_status) { $ecp->enable_recurring_info_tooltip(); } } apply_filters('tribe_events_ajax_response', $response); wp_send_json($response); }
/** * Handles the "send to email" action for the attendees list. */ public function ajax_handler_attendee_mail_list() { if (!isset($_POST['event_id']) || !isset($_POST['email']) || !(is_numeric($_POST['email']) || is_email($_POST['email']))) { $this->ajax_error('Bad post'); } if (empty($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'email-attendee-list') || !current_user_can('edit_tribe_events')) { $this->ajax_error('Cheatin Huh?'); } if (is_email($_POST['email'])) { $email = $_POST['email']; } else { $user = get_user_by('id', $_POST['email']); $email = $user->data->user_email; } if (empty($GLOBALS['hook_suffix'])) { $GLOBALS['hook_suffix'] = 'tribe_ajax'; } $this->attendees_page_screen_setup(); $items = $this->_generate_filtered_attendees_list($_POST['event_id']); $event = get_post($_POST['event_id']); ob_start(); $attendee_tpl = Tribe__Events__Templates::getTemplateHierarchy('tickets/attendees-email.php', array('disable_view_check' => true)); include $attendee_tpl; $content = ob_get_clean(); add_filter('wp_mail_content_type', array($this, 'set_contenttype')); if (!wp_mail($email, sprintf(__('Attendee List for: %s', 'tribe-events-calendar'), $event->post_title), $content)) { $this->ajax_error('Error sending email'); } $this->ajax_ok(array()); }
/** * Specify the template for agenda view * * @param $template string containing the current template file * @return string **/ function tribe_events_agenda_setup_view_template($template) { error_log(">>> tribe_events_agenda_setup_view_template"); // agenda view if (tribe_is_agenda()) { $template = Tribe__Events__Templates::getTemplateHierarchy('agenda'); } return $template; }