protected function _parser($shortcode) { EE_Registry::instance()->load_helper('Template'); $this->_ticket = $this->_data instanceof EE_Ticket ? $this->_data : null; $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; $aee = !$aee instanceof EE_Messages_Addressee && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $aee; //possible EE_Line_Item may be incoming data $this->_ticket = empty($this->_ticket) && $this->_data instanceof EE_Line_Item && $aee instanceof EE_Messages_Addressee && !empty($aee->line_items_with_children[$this->_data->ID()]['EE_Ticket']) && $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] instanceof EE_Ticket ? $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] : $this->_ticket; //if still no ticket, then let's see if there is a reg_obj. If there IS, then we'll try and grab the ticket from the reg_obj instead. if (empty($this->_ticket)) { $this->_ticket = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration ? $aee->reg_obj->ticket() : NULL; } //If there is no event object by now then get out. if (!$this->_ticket instanceof EE_Ticket) { return ''; } switch ($shortcode) { case '[TICKET_ID]': return $this->_ticket->ID(); break; case '[TICKET_NAME]': return $this->_ticket->get('TKT_name'); break; case '[TICKET_DESCRIPTION]': return $this->_ticket->get('TKT_description'); break; case '[TICKET_PRICE]': return EEH_Template::format_currency($this->_ticket->get('TKT_price')); break; case '[TICKET_PRICE_WITH_TAXES]': return EEH_Template::format_currency($this->_ticket->get_ticket_total_with_taxes()); break; case '[TKT_QTY_PURCHASED]': return $aee instanceof EE_Messages_Addressee ? $aee->tickets[$this->_ticket->ID()]['count'] : ''; break; } if (strpos($shortcode, '[TKT_USES_*') !== FALSE) { $attrs = $this->_get_shortcode_attrs($shortcode); $schema = empty($attrs['schema']) ? null : $attrs['schema']; return $this->_ticket->get_pretty('TKT_uses', $schema); } return ''; }