Exemple #1
0
 protected function setup()
 {
     Tribe__Events__Main::instance()->displaying = 'day';
     $this->shortcode->prepare_default();
     Tribe__Events__Pro__Template_Factory::asset_package('ajax-dayview');
     $this->shortcode->set_template_object(new Tribe__Events__Template__Day($this->shortcode->get_query_args()));
 }
Exemple #2
0
 protected function setup()
 {
     Tribe__Events__Main::instance()->displaying = 'photo';
     $this->shortcode->set_current_page();
     $this->shortcode->prepare_default();
     Tribe__Events__Pro__Main::instance()->enqueue_pro_scripts();
     Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css');
     Tribe__Events__Pro__Template_Factory::asset_package('ajax-photoview');
     $this->shortcode->set_template_object(new Tribe__Events__Pro__Templates__Photo($this->shortcode->get_query_args()));
 }
 public function __construct($attributes)
 {
     $this->arguments = shortcode_atts($this->default_args, $attributes);
     $this->parse_args();
     $this->set_date();
     // If we don't have an event date we cannot display the timer
     if (!isset($this->arguments['event_date'])) {
         return;
     }
     // If the ECP CSS has not already been added lets lazily add it now
     Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css');
     ob_start();
     the_widget('Tribe__Events__Pro__Countdown_Widget', $this->arguments, $this->arguments);
     $this->output = ob_get_clean();
 }
Exemple #4
0
 /**
  * Enqueue the proper styles depending on what is requred by a given page load.
  *
  * @return void
  */
 public function enqueue_styles()
 {
     if (tribe_is_event_query() || is_active_widget(false, false, 'tribe-events-adv-list-widget') || is_active_widget(false, false, 'tribe-mini-calendar') || is_active_widget(false, false, 'tribe-events-countdown-widget') || is_active_widget(false, false, 'next_event') || is_active_widget(false, false, 'tribe-events-venue-widget')) {
         Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css');
     }
 }
Exemple #5
0
 /**
  * Enqueue the maps JS in all the views (Needed for the location filter in the Tribe Bar)
  */
 public function scripts()
 {
     if (tribe_is_event_query() && !is_single()) {
         Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps');
     }
 }
Exemple #6
0
 /**
  * Take care of common setup needs including enqueing various assets required by the default views.
  */
 public function prepare_default()
 {
     global $wp_query;
     /**
      * We overwrite the global $wp_query object to facilitate embedding the requested view (the
      * original will be restored during tribe_events_pro_tribe_events_shortcode_post_render):
      * this isn't ideal, but further restructuring of our template classes and event views would
      * be needed to avoid it.
      *
      * @see $this->reset_query()
      * @todo revise in a future release
      */
     $wp_query = new WP_Query($this->query_args);
     // Assets required by all our supported views
     wp_enqueue_script('jquery');
     Tribe__Events__Template_Factory::asset_package('bootstrap-datepicker');
     Tribe__Events__Template_Factory::asset_package('calendar-script');
     Tribe__Events__Template_Factory::asset_package('jquery-resize');
     Tribe__Events__Template_Factory::asset_package('events-css');
     Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css');
     // Tribe Events Bar support
     if ($this->is_attribute_truthy('tribe-bar', true)) {
         add_filter('tribe_get_option', array($this, 'filter_tribe_disable_bar'), 10, 2);
         // Make sure the filters have been initialized
         tribe_events_get_filters();
         add_filter('tribe-events-bar-should-show', array($this, 'enable_tribe_bar'));
         remove_action('tribe_events_bar_before_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_before'));
         remove_action('tribe_events_bar_after_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_after'));
         Tribe__Events__Template_Factory::asset_package('jquery-placeholder');
         Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps');
         Tribe__Events__Template_Factory::asset_package('jquery-resize');
         add_action('tribe_events_bar_before_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_before'));
         add_action('tribe_events_bar_after_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_after'));
         remove_filter('tribe_get_option', array($this, 'filter_tribe_disable_bar'));
     }
     // Add the method responsible for rendering each of the default supported views
     add_filter('tribe_events_pro_tribe_events_shortcode_output', array($this, 'render_view'));
     // View selector URLs will need to be adjusted (so that the user is not taken to /events/new-view/)
     add_filter('tribe-events-bar-views', array($this, 'modify_view_urls'), 100);
 }