コード例 #1
0
 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();
 }
コード例 #2
0
ファイル: Venue_Widget.php プロジェクト: TakenCdosG/chefs
 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();
 }
コード例 #3
0
 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();
 }
コード例 #5
0
ファイル: form.php プロジェクト: michael-pratt/event-rocket
 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;
 }
コード例 #6
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 = 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());
 }
コード例 #7
0
ファイル: Main.php プロジェクト: TravisSperry/mpa_website
 /**
  * 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;
 }
コード例 #8
0
ファイル: general.php プロジェクト: TMBR/johnjohn
 /**
  * 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 Tribe__Events__Templates::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, $data);
     // 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 = Tribe__Events__Templates::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, $data);
 }
コード例 #9
0
ファイル: Tickets.php プロジェクト: awwong1/esps-wpsite
 /**
  * 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();
 }
コード例 #10
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.
  */
 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;
         }
     }
 }
コード例 #11
0
 /**
  * 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;
 }
コード例 #12
0
 /**
  * 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;
 }
コード例 #13
0
 /**
  * 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'];
     }
 }
コード例 #14
0
 /**
  * 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));
 }
コード例 #15
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.
  */
 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;
         }
     }
 }
コード例 #16
0
ファイル: This_Week.php プロジェクト: TakenCdosG/chefs
 /**
  * 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);
 }
コード例 #17
0
ファイル: Countdown_Widget.php プロジェクト: TakenCdosG/chefs
 /**
  * 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;
 }