Esempio n. 1
0
 /**
  * Includes a template part, similar to the WP get template part, but looks
  * in the correct directories for Tribe Events templates
  *
  * @param string      $slug
  * @param null|string $name
  * @param array       $data optional array of vars to inject into the template part
  *
  * @uses TribeEventsTemplates::getTemplateHierarchy
  **/
 function tribe_get_template_part($slug, $name = null, array $data = null)
 {
     // Execute code for this part
     do_action('tribe_pre_get_template_part_' . $slug, $slug, $name);
     // Setup possible parts
     $templates = array();
     if (isset($name)) {
         $templates[] = $slug . '-' . $name . '.php';
     }
     $templates[] = $slug . '.php';
     // Allow template parts to be filtered
     $templates = apply_filters('tribe_get_template_part_templates', $templates, $slug, $name);
     // Make any provided variables available in the template's symbol table
     if (is_array($data)) {
         extract($data);
     }
     // loop through templates, return first one found.
     foreach ($templates as $template) {
         $file = TribeEventsTemplates::getTemplateHierarchy($template, array('disable_view_check' => true));
         $file = apply_filters('tribe_get_template_part_path', $file, $template, $slug, $name);
         $file = apply_filters('tribe_get_template_part_path_' . $template, $file, $slug, $name);
         if (file_exists($file)) {
             ob_start();
             do_action('tribe_before_get_template_part', $template, $file, $template, $slug, $name);
             include $file;
             do_action('tribe_after_get_template_part', $template, $file, $slug, $name);
             $html = ob_get_clean();
             echo apply_filters('tribe_get_template_part_content', $html, $template, $file, $slug, $name);
         }
     }
     do_action('tribe_post_get_template_part_' . $slug, $slug, $name);
 }
Esempio n. 2
0
 function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     if (empty($hide_if_empty)) {
         $hide_if_empty = false;
     }
     // Get all the upcoming events for this venue.
     $events = tribe_get_events(array('post_type' => TribeEvents::POSTTYPE, 'venue' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'upcoming'), 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 = TribeEventsPro::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 TribeEventsTemplates::getTemplateHierarchy('pro/widgets/venue-widget.php');
     echo $after_widget;
     if ($tooltip_status) {
         $ecp->enable_recurring_info_tooltip();
     }
     wp_reset_postdata();
 }
/**
 * Specify the template for agenda view
 *
 * @param $template string containing the current template file
 * @return string
 **/
function tribe_events_agenda_setup_view_template($template)
{
    // agenda view
    if (tribe_is_agenda()) {
        $template = TribeEventsTemplates::getTemplateHierarchy('agenda');
    }
    return $template;
}
 /**
  * Add the Tribe Bar to the tribe_events_before_html filter.
  * @param $content
  *
  * @filter tribe-events-bar-should-show set it to false to prevent infinite nesting
  * @filter tribe-events-bar-filters to get the list of registered filters
  * @filter tribe-events-bar-views to get the list of registered views
  *
  * To add filters:
  *
  * add_filter( 'tribe-events-bar-filters',  'setup_my_field_in_bar', 1, 1 );
  *
  * public function setup_my_field_in_bar( $filters ) {
  *   $filters[] = array( 'name'    => 'tribe-bar-my-field',
  *                       'caption' => 'My Field',
  *                       'html'    => '<input type="text" name="tribe-bar-my-field" id="tribe-bar-my-field">' );
  *   return $filters;
  * }
  *
  * To add views:
  *
  * add_filter( 'tribe-events-bar-views',  'my_setup_view_for_bar', 10);
  *
  * public function my_setup_view_for_bar( $views ) {
  *     $tec = TribeEvents::instance();
  *     $views[] = array('displaying' => 'myview', 'anchor' => 'My view', 'url' =>  $tec->getOption( 'eventsSlug', 'events' ) . '/my_view_slug'  );
  *     return $views;
  * }
  *
  * @return string
  */
 public function show($content)
 {
     $tec = TribeEvents::instance();
     //set it to false to prevent infinite nesting
     add_filter('tribe-events-bar-should-show', '__return_false', 9999);
     // Load the registered filters and views for the Bar. This values will be used in the template.
     $filters = apply_filters('tribe-events-bar-filters', self::instance()->filters);
     $views = apply_filters('tribe-events-bar-views', self::instance()->views);
     //Load the template
     ob_start();
     include TribeEventsTemplates::getTemplateHierarchy('bar.php', array('subfolder' => 'modules'));
     $html = ob_get_clean() . $content;
     echo apply_filters('tribe_events_bar_show', $html, $filters, $views, $content);
 }
Esempio n. 5
0
 function get_output($event_ID, $complete, $show_seconds, $event_date = null)
 {
     $ret = $complete;
     ob_start();
     include TribeEventsTemplates::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, TribeDateUtils::DBTIMEFORMAT) : tribe_get_start_date($event_ID, false, TribeDateUtils::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;
 }
 function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     if (empty($hide_if_empty)) {
         $hide_if_empty = false;
     }
     // Get all the upcoming events for this venue.
     $events = tribe_get_events(array('post_type' => TribeEvents::POSTTYPE, 'meta_key' => '_EventVenueID', 'meta_value' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'upcoming'));
     // If there are no events, and the user has set to hide if empty, don't display the widget.
     if ($hide_if_empty && empty($events)) {
         return;
     }
     echo $before_widget;
     $title = $before_title . apply_filters('widget_title', $title) . $after_title;
     include TribeEventsTemplates::getTemplateHierarchy('widgets/venue-widget.php');
     echo $after_widget;
 }
Esempio n. 7
0
 function widget_output($args, $instance, $template_name = 'events-list-load-widget-display')
 {
     global $wp_query, $tribe_ecp, $post;
     extract($args, EXTR_SKIP);
     extract($instance, EXTR_SKIP);
     // extracting $instance provides $title, $limit
     $title = apply_filters('widget_title', $title);
     if (!isset($category)) {
         $category = null;
     }
     if (tribe_get_option('viewOption') == 'upcoming') {
         $event_url = tribe_get_listview_link($category != -1 ? intval($category) : null);
     } else {
         $event_url = tribe_get_gridview_link($category != -1 ? intval($category) : null);
     }
     if (function_exists('tribe_get_events')) {
         $posts = tribe_get_events('eventDisplay=upcoming&posts_per_page=' . $limit . '&eventCat=' . $category);
         $template = TribeEventsTemplates::getTemplateHierarchy($template_name);
     }
     // if no posts, and the don't show if no posts checked, let's bail
     if (!$posts && $no_upcoming_events) {
         return;
     }
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     echo $title ? $before_title . $title . $after_title : '';
     if ($posts) {
         /* Display list of events. */
         echo "<ul class='upcoming'>";
         foreach ($posts as $post) {
             setup_postdata($post);
             include $template;
         }
         echo "</ul>";
         /* Display link to all events */
         echo '<div class="dig-in"><a href="' . $event_url . '">' . __('View All Events', 'tribe-events-calendar') . '</a></div>';
     } else {
         _e('There are no upcoming events at this time.', 'tribe-events-calendar');
     }
     /* After widget (defined by themes). */
     echo $after_widget;
     wp_reset_query();
 }
Esempio n. 8
0
 function widget($args, $instance)
 {
     global $wp_query, $post;
     $old_post = $post;
     extract($args, EXTR_SKIP);
     extract($instance, EXTR_SKIP);
     // extracting $instance provides $title, $limit, $no_upcoming_events, $start, $end, $venue, $address, $city, $state, $province'], $zip, $country, $phone , $cost
     $title = apply_filters('widget_title', $title);
     if (tribe_get_option('viewOption') == 'upcoming') {
         $event_url = tribe_get_listview_link();
     } else {
         $event_url = tribe_get_gridview_link();
     }
     if (function_exists('tribe_get_events')) {
         $posts = tribe_get_events('eventDisplay=upcoming&numResults=1&eventCat=' . $category);
         $template = TribeEventsTemplates::getTemplateHierarchy('widget-featured-display');
     }
     // if no posts, and the don't show if no posts checked, let's bail
     if (!$posts && isset($no_upcoming_events) && $no_upcoming_events) {
         return;
     }
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     echo $title ? $before_title . $title . $after_title : '';
     if ($posts) {
         /* Display list of events. */
         foreach ($posts as $post) {
             setup_postdata($post);
             include $template;
         }
     } else {
         echo "<p>";
         _e('There are no upcoming events at this time.', 'tribe-events-calendar-pro');
         echo "</p>";
     }
     /* After widget (defined by themes). */
     echo $after_widget;
     $post = $old_post;
 }
 /**
  *  Returns the full address of an event along with HTML markup.  It 
  *  loads the full-address template to generate the HTML
  */
 public function fullAddress($postId = null, $includeVenueName = false)
 {
     ob_start();
     load_template(TribeEventsTemplates::getTemplateHierarchy('full-address'), false);
     $address = ob_get_contents();
     ob_end_clean();
     return $address;
 }
Esempio n. 10
0
 /**
  * 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 TribeEventsTemplates::getTemplateHierarchy('email.php', array('subfolder' => 'tickets'));
     return ob_get_clean();
 }
Esempio n. 11
0
 /**
  *	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 = TribeEventsTemplates::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());
 }
 /**
  * Get the path to the current events template.
  *
  * @param string $template The current template path.
  * @return string The modified template path.
  * @author Timothy Wood
  * @since 3.0
  */
 public function select_page_template($template)
 {
     // venue view
     if (is_singular(TribeEvents::VENUE_POST_TYPE)) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/single-venue');
     }
     // organizer view
     if (is_singular(TribeEvents::ORGANIZER_POST_TYPE)) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/single-organizer');
     }
     // week view
     if (tribe_is_week()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/week');
     }
     // day view
     if (tribe_is_day()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/day');
     }
     // photo view
     if (tribe_is_photo()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/photo');
     }
     // map view
     if (tribe_is_map()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/map');
     }
     return $template;
 }
 /**
  * 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.
  */
 function widget_output($args, $instance, $template_name = 'widgets/list-widget')
 {
     global $wp_query, $tribe_ecp, $post;
     $instance = wp_parse_args($instance, array('limit' => 5, '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);
     if (!function_exists('tribe_get_events')) {
         return;
     }
     $posts = tribe_get_events(apply_filters('tribe_events_list_widget_query_args', array('eventDisplay' => 'list', 'posts_per_page' => $limit)));
     // If no posts, and the don't show if no posts checked, let's bail
     if (!$posts && $no_upcoming_events) {
         return;
     }
     echo $before_widget;
     do_action('tribe_events_before_list_widget');
     do_action('tribe_events_list_widget_before_the_title');
     echo $title ? $before_title . $title . $after_title : '';
     do_action('tribe_events_list_widget_after_the_title');
     // Include template file
     include TribeEventsTemplates::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;
         }
     }
 }
 /**
  * Load recurrence data for ECP.
  *
  * @param int $postId The event id.
  * @return void
  * @author Nick Ciske
  * @since 1.0
  */
 public function loadRecurrenceData($postId)
 {
     $context = $this->getContext();
     $tribe_event_id = $context['id'];
     include TribeEventsTemplates::getTemplateHierarchy('community/modules/recurrence');
 }
 /**
  * Calendar Mini Grid (Display)
  *
  * Displays the mini grid calendar table (usually in a widget)
  *
  * @uses load_template()
  * @since 2.0
  */
 function tribe_calendar_mini_grid()
 {
     set_query_var('eventDisplay', 'bydate');
     load_template(TribeEventsTemplates::getTemplateHierarchy('table-mini'));
 }
Esempio n. 16
0
 /**
  * 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.
  */
 function widget_output($args, $instance, $template_name = 'list-widget', $subfolder = 'widgets', $namespace = '/', $pluginPath = '')
 {
     global $wp_query, $tribe_ecp, $post;
     extract($args, EXTR_SKIP);
     // The view expects all these $instance variables, which may not be set without pro
     $instance = wp_parse_args($instance, array('limit' => 5, 'title' => ''));
     extract($instance, EXTR_SKIP);
     // extracting $instance provides $title, $limit
     $title = apply_filters('widget_title', $title);
     if (!isset($category) || $category === '-1') {
         $category = 0;
     }
     if (tribe_get_option('viewOption') == 'upcoming') {
         $event_url = tribe_get_listview_link($category);
     } else {
         $event_url = tribe_get_gridview_link($category);
     }
     if (function_exists('tribe_get_events')) {
         $args = array('eventDisplay' => 'upcoming', 'posts_per_page' => $limit);
         if (!empty($category)) {
             $args['tax_query'] = array(array('taxonomy' => TribeEvents::TAXONOMY, 'terms' => $category, 'field' => 'ID', 'include_children' => false));
         }
         $posts = tribe_get_events($args);
     }
     // if no posts, and the don't show if no posts checked, let's bail
     if (!$posts && $no_upcoming_events) {
         return;
     }
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     echo $title ? $before_title . $title . $after_title : '';
     if ($posts) {
         /* Display list of events. */
         echo '<ol class="hfeed vcalendar">';
         foreach ($posts as $post) {
             setup_postdata($post);
             include TribeEventsTemplates::getTemplateHierarchy('widgets/list-widget.php');
         }
         echo "</ol><!-- .hfeed -->";
         /* Display link to all events */
         echo '<p class="tribe-events-widget-link"><a href="' . $event_url . '" rel="bookmark">' . __('View All Events', 'tribe-events-calendar') . '</a></p>';
     } else {
         echo '<p>' . __('There are no upcoming events at this time.', 'tribe-events-calendar') . '</p>';
     }
     /* After widget (defined by themes). */
     echo $after_widget;
     wp_reset_query();
 }
Esempio n. 17
0
 /**
  * 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(TribeEvents::VENUE_POST_TYPE)) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/single-venue');
     }
     // organizer view
     if (is_singular(TribeEvents::ORGANIZER_POST_TYPE)) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/single-organizer');
     }
     // week view
     if (tribe_is_week()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/week');
     }
     // photo view
     if (tribe_is_photo()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/photo');
     }
     // map view
     if (tribe_is_map()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('pro/map');
     }
     // recurring "all" view
     if (tribe_is_showing_all()) {
         $template = TribeEventsTemplates::getTemplateHierarchy('list');
         // don't show pagination on the "all" view
         add_filter('tribe_get_template_part_path_list/nav.php', '__return_empty_string');
     }
     return $template;
 }
 /**
  * Gets the venue template.
  *
  * @param string $file
  * @return string The path for the template.
  */
 public function load_venue_template($file)
 {
     return TribeEventsTemplates::getTemplateHierarchy('single-venue', '', 'pro', $this->pluginPath);
 }
Esempio n. 19
0
 public function select_venue_template($template)
 {
     return is_singular(TribeEvents::VENUE_POST_TYPE) ? TribeEventsTemplates::getTemplateHierarchy('single-venue') : $template;
 }
Esempio n. 20
0
 /**
  * filters the_content to show the event when
  * we are in the main loop and showing events
  *
  * @return string filtered $content
  * @since 2.1
  */
 public static function hijackContentInMainLoop($content)
 {
     // only run once!!!
     remove_filter('the_content', array(__CLASS__, 'hijackContentInMainLoop'));
     global $post;
     if (tribe_is_in_main_loop() && tribe_is_event($post->ID)) {
         ob_start();
         echo stripslashes(tribe_get_option('tribeEventsBeforeHTML'));
         include_once TribeEventsTemplates::getTemplateHierarchy('in-loop');
         echo stripslashes(tribe_get_option('tribeEventsAfterHTML'));
         $content = ob_get_contents();
         ob_end_clean();
     }
     return $content;
 }