| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace EventEspresso\modules\ticket_selector; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |     exit( 'No direct script access allowed' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * Class DisplayTicketSelector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * Description | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @package       Event Espresso | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @subpackage    core | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @author        Brent Christensen | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @since         $VID:$ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | class DisplayTicketSelector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * event that ticket selector is being generated for | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * @access protected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * @var \EE_Event $event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     protected $event; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * Used to flag when the ticket selector is being called from an external iframe. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * @var bool $iframe | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     protected $iframe = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * max attendees that can register for event at one time | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @var int $max_attendees | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     private $max_attendees = EE_INF; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |      *@var string $date_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     private $date_format = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      *@var string $time_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     private $time_format = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * DisplayTicketSelector constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     public function __construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         $this->date_format = apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |             'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             get_option('date_format') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $this->time_format = apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |             get_option('time_format') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      * @param boolean $iframe | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     public function setIframe( $iframe = true ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         $this->iframe = filter_var( $iframe, FILTER_VALIDATE_BOOLEAN ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * finds and sets the \EE_Event object for use throughout class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * @param    mixed $event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * @return    bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     protected function setEvent( $event = null ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         if ( $event === null ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             global $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |             $event = $post; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         if ( $event instanceof \EE_Event ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             $this->event = $event; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         } else if ( $event instanceof \WP_Post ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             if ( isset( $event->EE_Event ) && $event->EE_Event instanceof \EE_Event ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |                 $this->event = $event->EE_Event; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |             } else if ( $event->post_type === 'espresso_events' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                 $event->EE_Event = \EEM_Event::instance()->instantiate_class_from_post_object( $event ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |                 $this->event = $event->EE_Event; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             } | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 104 |  | View Code Duplication |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |             $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |             $dev_msg = $user_msg . __( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |                     'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |                     'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |                 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |             \EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * @return int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     public function getMaxAttendees() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         return $this->max_attendees; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      * @param int $max_attendees | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     public function setMaxAttendees($max_attendees) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         $this->max_attendees = absint( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |                 'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |                 $max_attendees | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |      * creates buttons for selecting number of attendees for an event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |      * @param \WP_Post|int $event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |      * @param bool         $view_details | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 150 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |     public function display( $event = null, $view_details = false ) | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  |         // reset filter for displaying submit button | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  |         remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 155 |  |  |         // poke and prod incoming event till it tells us what it is | 
            
                                                                        
                            
            
                                    
            
            
                | 156 |  |  |         if ( ! $this->setEvent( $event ) ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |             return false; | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  |         // begin gathering template arguments by getting event status | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  |         $template_args = array( 'event_status' => $this->event->get_active_status() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  |         if ( $this->activeEventAndShowTicketSelector($event, $template_args['event_status'], $view_details) ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 162 |  |  |             return ! is_single() ? $this->displayViewDetailsButton() : ''; | 
            
                                                                        
                            
            
                                    
            
            
                | 163 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 164 |  |  |         // filter the maximum qty that can appear in the Ticket Selector qty dropdowns | 
            
                                                                        
                            
            
                                    
            
            
                | 165 |  |  |         $this->setMaxAttendees($this->event->additional_limit()); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 166 |  |  |         if ($this->getMaxAttendees() < 1) { | 
            
                                                                        
                            
            
                                    
            
            
                | 167 |  |  |             return $this->ticketSalesClosedMessage(); | 
            
                                                                        
                            
            
                                    
            
            
                | 168 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 169 |  |  |         // is the event expired ? | 
            
                                                                        
                            
            
                                    
            
            
                | 170 |  |  |         $template_args['event_is_expired'] = $this->event->is_expired(); | 
            
                                                                        
                            
            
                                    
            
            
                | 171 |  |  |         if ( $template_args[ 'event_is_expired' ] ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 172 |  |  |             return $this->expiredEventMessage(); | 
            
                                                                        
                            
            
                                    
            
            
                | 173 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 174 |  |  |         // get all tickets for this event ordered by the datetime | 
            
                                                                        
                            
            
                                    
            
            
                | 175 |  |  |         $tickets = $this->getTickets(); | 
            
                                                                        
                            
            
                                    
            
            
                | 176 |  |  |         if (count($tickets) < 1) { | 
            
                                                                        
                            
            
                                    
            
            
                | 177 |  |  |             return $this->noTicketAvailableMessage(); | 
            
                                                                        
                            
            
                                    
            
            
                | 178 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 179 |  |  |         if (\EED_Events_Archive::is_iframe()){ | 
            
                                                                        
                            
            
                                    
            
            
                | 180 |  |  |             $this->setIframe(); | 
            
                                                                        
                            
            
                                    
            
            
                | 181 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 182 |  |  |         // redirecting to another site for registration ?? | 
            
                                                                        
                            
            
                                    
            
            
                | 183 |  |  |         $external_url = (string) $this->event->external_url(); | 
            
                                                                        
                            
            
                                    
            
            
                | 184 |  |  |         // if redirecting to another site for registration, then we don't load the TS | 
            
                                                                        
                            
            
                                    
            
            
                | 185 |  |  |         $ticket_selector = $external_url | 
            
                                                                        
                            
            
                                    
            
            
                | 186 |  |  |             ? $this->externalEventRegistration() | 
            
                                                                        
                            
            
                                    
            
            
                | 187 |  |  |             : $this->loadTicketSelector($tickets,$template_args); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 188 |  |  |         // now set up the form (but not for the admin) | 
            
                                                                        
                            
            
                                    
            
            
                | 189 |  |  |         $ticket_selector = ! is_admin() | 
            
                                                                        
                            
            
                                    
            
            
                | 190 |  |  |             ? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector | 
            
                                                                        
                            
            
                                    
            
            
                | 191 |  |  |             : $ticket_selector; | 
            
                                                                        
                            
            
                                    
            
            
                | 192 |  |  |         // submit button and form close tag | 
            
                                                                        
                            
            
                                    
            
            
                | 193 |  |  |         $ticket_selector .= ! is_admin() ? $this->displaySubmitButton($external_url) : ''; | 
            
                                                                        
                            
            
                                    
            
            
                | 194 |  |  |         return $ticket_selector; | 
            
                                                                        
                            
            
                                    
            
            
                | 195 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      * displayTicketSelector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * examines the event properties and determines whether a Ticket Selector should be displayed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |      * @param \WP_Post|int $event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |      * @param string       $_event_active_status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |      * @param bool         $view_details | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     protected function activeEventAndShowTicketSelector($event, $_event_active_status, $view_details) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         $event_post = $this->event instanceof \EE_Event ? $this->event->ID() : $event; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |         return ! is_admin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |                && ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |                    ! $this->event->display_ticket_selector() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |                    || $view_details | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |                    || post_password_required($event_post) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |                    || ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |                        $_event_active_status !== \EE_Datetime::active | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |                        && $_event_active_status !== \EE_Datetime::upcoming | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |                        && $_event_active_status !== \EE_Datetime::sold_out | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |                        && ! ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                            $_event_active_status === \EE_Datetime::inactive | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                            && is_user_logged_in() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |                        ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |                    ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |                ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |      * noTicketAvailableMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |      * notice displayed if event is expired | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     protected function expiredEventMessage() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |         return '<div class="ee-event-expired-notice"><span class="important-notice">' . esc_html__( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |             'We\'re sorry, but all tickets sales have ended because the event is expired.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |             'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         ) . '</span></div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * noTicketAvailableMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      * notice displayed if event has no more tickets available | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 255 |  | View Code Duplication |     protected function noTicketAvailableMessage() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |         $no_ticket_available_msg = esc_html__( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |         if (current_user_can('edit_post', $this->event->ID())) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |             $no_ticket_available_msg .= sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |                 esc_html__( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |                     '%1$sNote to Event Admin:%2$sNo tickets were found for this event. This effectively turns off ticket sales. Please ensure that at least one ticket is available for if you want people to be able to register.%3$s(click to edit this event)%4$s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |                     'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |                 '<div class="ee-attention" style="text-align: left;"><b>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |                 '</b><br />', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |                 '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link($this->event->ID()).'">', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |                 '</a></span></div>' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |         return ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |             <div class="ee-event-expired-notice"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                 <span class="important-notice">' . $no_ticket_available_msg . '</span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |             </div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |      * ticketSalesClosed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |      * notice displayed if event ticket sales are turned off | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 285 |  | View Code Duplication |     protected function ticketSalesClosedMessage() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |         $sales_closed_msg = esc_html__( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |             'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |             'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |         if (current_user_can('edit_post', $this->event->ID())) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |             $sales_closed_msg .= sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |                 esc_html__( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |                     '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |                     'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |                 '<div class="ee-attention" style="text-align: left;"><b>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |                 '</b><br />', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |                 '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link($this->event->ID()).'">', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |                 '</a></span></div>' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |      * getTickets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |      * @return \EE_Base_Class[]|\EE_Ticket[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |     protected function getTickets() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |         $ticket_query_args = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |             array('Datetime.EVT_ID' => $this->event->ID()), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |             'order_by' => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |                 'TKT_order'              => 'ASC', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |                 'TKT_required'           => 'DESC', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |                 'TKT_start_date'         => 'ASC', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |                 'TKT_end_date'           => 'ASC', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |                 'Datetime.DTT_EVT_start' => 'DESC', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |         if ( ! \EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |             //use the correct applicable time query depending on what version of core is being run. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |             $current_time = method_exists('EEM_Datetime', 'current_time_for_query') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |                 ? time() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |                 : current_time('timestamp'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |             $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |         return \EEM_Ticket::instance()->get_all($ticket_query_args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |      * loadTicketSelector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |      * begins to assemble template arguments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |      * and decides whether to load a "simple" ticket selector, or the standard | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |      * @param \EE_Ticket[] $tickets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |      * @param array $template_args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |     protected function loadTicketSelector(array $tickets, array $template_args) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         $template_args['event'] = $this->event; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         $template_args['EVT_ID'] = $this->event->ID(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |         $template_args['event_is_expired'] = $this->event->is_expired(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |         $template_args['max_atndz'] = $this->getMaxAttendees(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |         $template_args['date_format'] = $this->date_format; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |         $template_args['time_format'] = $this->time_format; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |         /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |          * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |          * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |          * @since 4.9.13 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |          * @param     string  '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |          * @param int $EVT_ID The Event ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |          */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |         $template_args['anchor_id'] = apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |             'FHEE__EE_Ticket_Selector__redirect_anchor_id', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |             '#tkt-slctr-tbl-' . $this->event->ID(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |             $this->event->ID() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |         $template_args['tickets'] = $tickets; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |         $template_args['ticket_count'] = count($tickets); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |         $ticket_selector = $this->simpleTicketSelector( $tickets, $template_args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |         return $ticket_selector instanceof TicketSelectorSimple | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |             ? $ticket_selector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |             : new TicketSelectorStandard( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |                 $this->event, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |                 $tickets, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |                 $this->getMaxAttendees(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |                 $template_args, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |                 $this->date_format, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |                 $this->time_format | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |      * simpleTicketSelector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |      * there's one ticket, and max attendees is set to one, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |      * so if the event is free, then this is a "simple" ticket selector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |      * a.k.a. "Dude Where's my Ticket Selector?" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |      * @param \EE_Ticket[] $tickets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |      * @param array  $template_args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |     protected function simpleTicketSelector($tickets, array $template_args) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |         // if there is only ONE ticket with a max qty of ONE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |         if (count($tickets) > 1 || $this->getMaxAttendees() !== 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |             return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         /** @var \EE_Ticket $ticket */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |         $ticket = reset($tickets); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |         // if the ticket is free... then not much need for the ticket selector | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         if ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |             apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |                 'FHEE__ticket_selector_chart_template__hide_ticket_selector', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |                 $ticket->is_free(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |                 $this->event->ID() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |         ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |             return new TicketSelectorSimple( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |                 $this->event, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |                 $ticket, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |                 $this->getMaxAttendees(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |                 $template_args | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |         return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |      * externalEventRegistration | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |     public function externalEventRegistration() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |         // if not we still need to trigger the display of the submit button | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |         //display notice to admin that registration is external | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         return is_admin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |             ? esc_html__( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |                 'Registration is at an external URL for this event.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |                 'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |             : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |      * formOpen | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |      * @param        int    $ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |      * @param        string $external_url | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |      * @return        string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |     public function formOpen( $ID = 0, $external_url = '' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |         // if redirecting, we don't need any anything else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         if ( $external_url ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |             $html = '<form method="GET" action="' . \EEH_URL::refactor_url($external_url) . '"'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |             // open link in new window ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |             $html .= apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |                 'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |                 \EED_Events_Archive::is_iframe() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |                 ? ' target="_blank"' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |                 : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |             $html .= '>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |             $query_args = \EEH_URL::get_query_string( $external_url ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |             foreach ( (array)$query_args as $query_arg => $value ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |                 $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |             return $html; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |         // if there is no submit button, then don't start building a form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |         // because the "View Details" button will build its own form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |         if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |             return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |         $checkout_url = \EEH_Event_View::event_link_url( $ID ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |         if ( ! $checkout_url ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |             \EE_Error::add_error( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |                 esc_html__( 'The URL for the Event Details page could not be retrieved.', 'event_espresso' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |                 __FILE__, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |                 __FUNCTION__, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |                 __LINE__ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |         // set no cache headers and constants | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |         \EE_System::do_not_cache(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |         $extra_params = $this->iframe ? ' target="_blank"' : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |         $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |         $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce_' . $ID, true, false ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |         $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |         $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         return $html; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |      * displaySubmitButton | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |      * @param  string $external_url | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |     public function displaySubmitButton($external_url = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |         $html = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |         if ( ! is_admin()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |             // standard TS displayed with submit button, ie: "Register Now" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |             if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                 $html .= $this->displayRegisterNowButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |                 $html .= empty($external_url) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |                     ? $this->ticketSelectorEndDiv() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |                     : $this->clearTicketSelector(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |                 $html .= '<br/>' . $this->formClose(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |             } else if ($this->getMaxAttendees() === 1) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |                 // its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |                 if ($this->event->is_sold_out()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |                     // then instead of a View Details or Submit button, just display a "Sold Out" message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |                     $html .= apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |                         'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__sold_out_msg', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |                         sprintf( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |                             __( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |                                 '%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |                                 'event_espresso' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |                             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |                             '<p class="no-ticket-selector-msg clear-float">', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |                             $this->event->name(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |                             '</p>', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |                             '<br />' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |                         ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |                         $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |                     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |                     if ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |                     apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |                         'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |                         false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |                         $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |                     ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |                     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |                         $html .= $this->displayRegisterNowButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |                     // sold out DWMTS event, no TS, no submit or view details button, but has additional content | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |                     $html .= $this->ticketSelectorEndDiv(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |                 } else if ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |                     apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |                     && ! is_single() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |                 ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |                     // this is a "Dude Where's my Ticket Selector?" (DWMTS) type event, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |                     // but no tickets are available, so display event's "View Details" button. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |                     // it is being viewed via somewhere other than a single post | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |                     $html .= $this->displayViewDetailsButton(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |             } else if (is_archive()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |                 // event list, no tickets available so display event's "View Details" button | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |                 $html .= $this->ticketSelectorEndDiv(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |                 $html .= $this->displayViewDetailsButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |                 if ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |                 apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |                     'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |                     false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |                     $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |                 ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |                 ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |                     $html .= $this->displayRegisterNowButton(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |                 // no submit or view details button, and no additional content | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |                 $html .= $this->ticketSelectorEndDiv(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |             if ( ! $this->iframe && ! is_archive()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |                 $html .= \EEH_Template::powered_by_event_espresso('', '', array('utm_content' => 'ticket_selector')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |         return $html; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |     public function displayRegisterNowButton() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |         $btn_text = apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |             'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |             __('Register Now', 'event_espresso'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |             $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |         $external_url = $this->event->external_url(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |         $html = \EEH_HTML::div( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |             '', 'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap', 'ticket-selector-submit-btn-wrap' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |         $html .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |         $html .= ' class="ticket-selector-submit-btn '; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |         $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |         $html .= ' type="submit" value="' . $btn_text . '" />'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |         $html .= \EEH_HTML::divx(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |         $html .= apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |             'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |             '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |             $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |         return $html; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |      * displayViewDetailsButton | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |      * @param bool $DWMTS indicates a "Dude Where's my Ticket Selector?" (DWMTS) type event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |      *                    (ie: $_max_atndz === 1) where there are no available tickets, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |      *                    either because they are sold out, expired, or not yet on sale. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |      *                    In this case, we need to close the form BEFORE adding any closing divs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |      * @throws \EE_Error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |     public function displayViewDetailsButton( $DWMTS = false ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |         if ( ! $this->event->get_permalink() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |             \EE_Error::add_error( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |                 esc_html__( 'The URL for the Event Details page could not be retrieved.', 'event_espresso' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |                 __FILE__, __FUNCTION__, __LINE__ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |         $view_details_btn = '<form method="POST" action="'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |         $view_details_btn .= apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |             'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_url', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |             $this->event->get_permalink(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |             $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |         $view_details_btn .= '"'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |         // open link in new window ? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |         $view_details_btn .= apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |             'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |             \EED_Events_Archive::is_iframe() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |             ? ' target="_blank"' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |             : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |         $view_details_btn .='>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |         $btn_text = apply_filters( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |             'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |             esc_html__('View Details', 'event_espresso'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |             $this->event | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |         $view_details_btn .= '<input id="ticket-selector-submit-' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |                              . $this->event->ID() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |                              . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |                              . $btn_text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |                              . '" />'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |         $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |         if ($DWMTS) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |             $view_details_btn .= $this->formClose(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |             $view_details_btn .= $this->ticketSelectorEndDiv(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |             $view_details_btn .= '<br/>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |             $view_details_btn .= $this->clearTicketSelector(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |             $view_details_btn .= '<br/>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |             $view_details_btn .= $this->formClose(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |         return $view_details_btn; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |     public function ticketSelectorEndDiv() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |         return '<div class="clear"></div></div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |     public function clearTicketSelector() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |         // standard TS displayed, appears after a "Register Now" or "view Details" button | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |         return '<div class="clear"></div>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |      * @access        public | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |      * @return        string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  |     public function formClose() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  |         return '</form>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  | } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 698 |  |  | // End of file DisplayTicketSelector.php | 
            
                                                        
            
                                    
            
            
                | 699 |  |  | // Location: /DisplayTicketSelector.php | 
            
                        
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.