/**
  *    get_cart_results
  *
  * @access    public
  * @param int $ticket_count
  * @return string
  */
 public static function get_cart_results($ticket_count = 0)
 {
     // total tickets in cart
     $total_tickets = EE_Registry::instance()->CART->all_ticket_quantity_count();
     // what page the user is currently on
     $referer_uri = isset($_SERVER['HTTP_REFERER']) ? basename($_SERVER['HTTP_REFERER']) : '';
     $term_exists = term_exists($referer_uri, 'espresso_event_categories');
     //EEH_Debug_Tools::printr( $term_exists, '$term_exists', __FILE__, __LINE__ );
     if (isset($term_exists['term_id'])) {
         $return_url = get_category_link($term_exists['term_id']);
         $close_modal = ' close-modal-js';
     } else {
         if ($referer_uri == basename(EE_EVENTS_LIST_URL)) {
             $return_url = EE_EVENTS_LIST_URL;
             $close_modal = ' close-modal-js';
         } else {
             $return_url = EE_EVENTS_LIST_URL;
             $close_modal = '';
         }
     }
     $template_args = array('results' => apply_filters('FHEE__EED_Multi_Event_Registration__get_cart_results_results_message', sprintf(_n('1 item was successfully added for this event.', '%1$s items were successfully added for this event.', $ticket_count, 'event_espresso'), $ticket_count), $ticket_count), 'current_cart' => apply_filters('FHEE__EED_Multi_Event_Registration__get_cart_results_current_cart_message', sprintf(_n('There is currently 1 item in the %2$s.', 'There are currently %1$d items in the %2$s.', $total_tickets, 'event_espresso'), $total_tickets, EED_Multi_Event_Registration::event_cart_name()), $total_tickets), 'event_cart_name' => EED_Multi_Event_Registration::event_cart_name(), 'return_url' => $return_url, 'register_url' => EE_EVENT_QUEUE_BASE_URL, 'view_event_cart_url' => add_query_arg(array('event_cart' => 'view'), EE_EVENT_QUEUE_BASE_URL), 'close_modal' => $close_modal, 'btn_class' => apply_filters('FHEE__EED_Multi_Event_Registration__event_cart_template__btn_class', ''));
     return EEH_Template::display_template(EE_MER_PATH . 'templates' . DS . 'cart_results_modal_dialog.template.php', $template_args, true);
 }
    /**
     *        display the widget
     *
     * @access public
     * @param array $args
     * @param array $instance
     * @throws \EE_Error
     */
    function widget($args, $instance)
    {
        $instance['title'] = !empty($instance['title']) ? $instance['title'] : __('Your Registrations', 'event_espresso');
        $instance['template'] = !empty($instance['template']) ? $instance['template'] : EE_MER_PATH . 'templates' . DS . 'widget_minicart_table.template.php';
        // autoload Line_Item_Display classes
        EE_Registry::instance()->load_core('Cart');
        EE_Registry::instance()->load_helper('Line_Item');
        EE_Registry::instance()->load_core('Request_Handler');
        extract($args);
        /** @type string $before_widget */
        /** @type string $after_widget */
        /** @type string $before_title */
        /** @type string $after_title */
        $checkout_page = false;
        if (EE_Registry::instance()->REQ->get_post_name_from_request() == basename(EE_Registry::instance()->CFG->core->reg_page_url()) && EE_Registry::instance()->REQ->get('event_cart', '') !== 'view') {
            $checkout_page = true;
        }
        $template_args = array();
        $template_args['before_widget'] = $before_widget;
        $template_args['after_widget'] = $after_widget;
        $template_args['before_title'] = $before_title;
        $template_args['after_title'] = $after_title;
        $template_args['title'] = apply_filters('widget_title', $instance['title']);
        $template_args['event_cart_name'] = EED_Multi_Event_Registration::event_cart_name();
        // hide "Proceed to Checkout" button on checkout page
        $template_args['checkout_page'] = $checkout_page;
        $template_args['events_list_url'] = EE_EVENTS_LIST_URL;
        $template_args['register_url'] = EE_EVENT_QUEUE_BASE_URL;
        $template_args['view_event_cart_url'] = add_query_arg(array('event_cart' => 'view'), EE_EVENT_QUEUE_BASE_URL);
        $template_args['btn_class'] = apply_filters('FHEE__EEW_Mini_Cart__event_cart_template__btn_class', '');
        $template_args['mini_cart_display'] = EE_Registry::instance()->CART->all_ticket_quantity_count() > 0 ? '' : ' 	style="display:none;"';
        $template_args['event_cart'] = $this->get_mini_cart($instance['template']);
        // ugh... inline css... well... better than loading another stylesheet on every page
        // and at least it's filterable...
        echo apply_filters('FHEE__EEW_Mini_Cart__widget__minicart_css', '
<style>
.mini-cart-tbl-qty-th,
.mini-cart-tbl-qty-td {
	padding: 0 .25em;
}
#mini-cart-whats-next-buttons {
	text-align: right;
}
.mini-cart-button {
	box-sizing: border-box;
	display: inline-block;
	padding: 8px;
	margin: 4px 0 4px 4px;
	vertical-align: middle;
	line-height: 8px;
	font-size: 12px;
	font-weight: normal;
	-webkit-user-select: none;
	border-radius: 2px !important;
	text-align: center !important;
	cursor: pointer !important;
	white-space: nowrap !important;
}
</style>
');
        echo EEH_Template::display_template($instance['template'], $template_args, true);
    }