@@ -21,127 +21,127 @@ |
||
| 21 | 21 | class TicketSelectorStandard extends TicketSelector |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var string $date_format |
|
| 26 | - */ |
|
| 27 | - protected $date_format; |
|
| 24 | + /** |
|
| 25 | + * @var string $date_format |
|
| 26 | + */ |
|
| 27 | + protected $date_format; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var string $time_format |
|
| 31 | - */ |
|
| 32 | - protected $time_format; |
|
| 29 | + /** |
|
| 30 | + * @var string $time_format |
|
| 31 | + */ |
|
| 32 | + protected $time_format; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var EE_Ticket_Selector_Config $ticket_selector_config |
|
| 36 | - */ |
|
| 37 | - protected $ticket_selector_config; |
|
| 34 | + /** |
|
| 35 | + * @var EE_Ticket_Selector_Config $ticket_selector_config |
|
| 36 | + */ |
|
| 37 | + protected $ticket_selector_config; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var EE_Tax_Config $tax_config |
|
| 41 | - */ |
|
| 42 | - protected $tax_config; |
|
| 39 | + /** |
|
| 40 | + * @var EE_Tax_Config $tax_config |
|
| 41 | + */ |
|
| 42 | + protected $tax_config; |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * TicketSelectorSimple constructor. |
|
| 47 | - * |
|
| 48 | - * @param EE_Ticket_Selector_Config $ticket_selector_config |
|
| 49 | - * @param EE_Tax_Config $tax_config |
|
| 50 | - * @param EE_Event $event |
|
| 51 | - * @param EE_Ticket[] $tickets |
|
| 52 | - * @param int $max_attendees |
|
| 53 | - * @param array $template_args |
|
| 54 | - * @param string $date_format |
|
| 55 | - * @param string $time_format |
|
| 56 | - */ |
|
| 57 | - public function __construct( |
|
| 58 | - EE_Ticket_Selector_Config $ticket_selector_config, |
|
| 59 | - EE_Tax_Config $tax_config, |
|
| 60 | - EE_Event $event, |
|
| 61 | - array $tickets, |
|
| 62 | - $max_attendees, |
|
| 63 | - array $template_args, |
|
| 64 | - $date_format = 'Y-m-d', |
|
| 65 | - $time_format = 'g:i a' |
|
| 66 | - ) { |
|
| 67 | - $this->ticket_selector_config = $ticket_selector_config; |
|
| 68 | - $this->tax_config = $tax_config; |
|
| 69 | - $this->date_format = $date_format; |
|
| 70 | - $this->time_format = $time_format; |
|
| 71 | - parent::__construct($event, $tickets, $max_attendees, $template_args); |
|
| 72 | - } |
|
| 45 | + /** |
|
| 46 | + * TicketSelectorSimple constructor. |
|
| 47 | + * |
|
| 48 | + * @param EE_Ticket_Selector_Config $ticket_selector_config |
|
| 49 | + * @param EE_Tax_Config $tax_config |
|
| 50 | + * @param EE_Event $event |
|
| 51 | + * @param EE_Ticket[] $tickets |
|
| 52 | + * @param int $max_attendees |
|
| 53 | + * @param array $template_args |
|
| 54 | + * @param string $date_format |
|
| 55 | + * @param string $time_format |
|
| 56 | + */ |
|
| 57 | + public function __construct( |
|
| 58 | + EE_Ticket_Selector_Config $ticket_selector_config, |
|
| 59 | + EE_Tax_Config $tax_config, |
|
| 60 | + EE_Event $event, |
|
| 61 | + array $tickets, |
|
| 62 | + $max_attendees, |
|
| 63 | + array $template_args, |
|
| 64 | + $date_format = 'Y-m-d', |
|
| 65 | + $time_format = 'g:i a' |
|
| 66 | + ) { |
|
| 67 | + $this->ticket_selector_config = $ticket_selector_config; |
|
| 68 | + $this->tax_config = $tax_config; |
|
| 69 | + $this->date_format = $date_format; |
|
| 70 | + $this->time_format = $time_format; |
|
| 71 | + parent::__construct($event, $tickets, $max_attendees, $template_args); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * sets any and all template args that are required for this Ticket Selector |
|
| 77 | - * |
|
| 78 | - * @return void |
|
| 79 | - * @throws EE_Error |
|
| 80 | - * @throws ReflectionException |
|
| 81 | - */ |
|
| 82 | - protected function addTemplateArgs() |
|
| 83 | - { |
|
| 84 | - $this->ticket_rows = 0; |
|
| 85 | - $all_ticket_rows_html = ''; |
|
| 86 | - $required_ticket_sold_out = false; |
|
| 87 | - // flag to indicate that at least one taxable ticket has been encountered |
|
| 88 | - $taxable_tickets = false; |
|
| 89 | - $datetime_selector = null; |
|
| 90 | - $this->template_args['datetime_selector'] = ''; |
|
| 91 | - if ( |
|
| 92 | - $this->ticket_selector_config->getShowDatetimeSelector() |
|
| 93 | - !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
|
| 94 | - ) { |
|
| 95 | - $datetime_selector = new DatetimeSelector( |
|
| 96 | - $this->event, |
|
| 97 | - $this->tickets, |
|
| 98 | - $this->ticket_selector_config, |
|
| 99 | - $this->date_format, |
|
| 100 | - $this->time_format |
|
| 101 | - ); |
|
| 102 | - $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector(); |
|
| 103 | - } |
|
| 104 | - $total_tickets = count($this->tickets); |
|
| 105 | - // loop through tickets |
|
| 106 | - foreach ($this->tickets as $ticket) { |
|
| 107 | - if ($ticket instanceof EE_Ticket) { |
|
| 108 | - $this->ticket_rows++; |
|
| 109 | - $cols = 2; |
|
| 110 | - $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
|
| 111 | - $ticket_selector_row = new TicketSelectorRowStandard( |
|
| 112 | - new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args), |
|
| 113 | - $this->tax_config, |
|
| 114 | - $total_tickets, |
|
| 115 | - $this->max_attendees, |
|
| 116 | - $this->ticket_rows, |
|
| 117 | - $cols, |
|
| 118 | - $required_ticket_sold_out, |
|
| 119 | - $this->template_args['event_status'], |
|
| 120 | - $datetime_selector instanceof DatetimeSelector |
|
| 121 | - ? $datetime_selector->getTicketDatetimeClasses($ticket) |
|
| 122 | - : '' |
|
| 123 | - ); |
|
| 124 | - $ticket_row_html = $ticket_selector_row->getHtml(); |
|
| 125 | - // check if something was actually returned |
|
| 126 | - if (! empty($ticket_row_html)) { |
|
| 127 | - // add any output to the cumulative HTML |
|
| 128 | - $all_ticket_rows_html .= $ticket_row_html; |
|
| 129 | - } |
|
| 130 | - if (empty($ticket_row_html) || ! $ticket_selector_row->isOnSale()) { |
|
| 131 | - // decrement the ticket row count since it looks like one has been removed |
|
| 132 | - $this->ticket_rows--; |
|
| 133 | - } |
|
| 75 | + /** |
|
| 76 | + * sets any and all template args that are required for this Ticket Selector |
|
| 77 | + * |
|
| 78 | + * @return void |
|
| 79 | + * @throws EE_Error |
|
| 80 | + * @throws ReflectionException |
|
| 81 | + */ |
|
| 82 | + protected function addTemplateArgs() |
|
| 83 | + { |
|
| 84 | + $this->ticket_rows = 0; |
|
| 85 | + $all_ticket_rows_html = ''; |
|
| 86 | + $required_ticket_sold_out = false; |
|
| 87 | + // flag to indicate that at least one taxable ticket has been encountered |
|
| 88 | + $taxable_tickets = false; |
|
| 89 | + $datetime_selector = null; |
|
| 90 | + $this->template_args['datetime_selector'] = ''; |
|
| 91 | + if ( |
|
| 92 | + $this->ticket_selector_config->getShowDatetimeSelector() |
|
| 93 | + !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
|
| 94 | + ) { |
|
| 95 | + $datetime_selector = new DatetimeSelector( |
|
| 96 | + $this->event, |
|
| 97 | + $this->tickets, |
|
| 98 | + $this->ticket_selector_config, |
|
| 99 | + $this->date_format, |
|
| 100 | + $this->time_format |
|
| 101 | + ); |
|
| 102 | + $this->template_args['datetime_selector'] = $datetime_selector->getDatetimeSelector(); |
|
| 103 | + } |
|
| 104 | + $total_tickets = count($this->tickets); |
|
| 105 | + // loop through tickets |
|
| 106 | + foreach ($this->tickets as $ticket) { |
|
| 107 | + if ($ticket instanceof EE_Ticket) { |
|
| 108 | + $this->ticket_rows++; |
|
| 109 | + $cols = 2; |
|
| 110 | + $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
|
| 111 | + $ticket_selector_row = new TicketSelectorRowStandard( |
|
| 112 | + new TicketDetails($ticket, $this->ticket_selector_config, $this->template_args), |
|
| 113 | + $this->tax_config, |
|
| 114 | + $total_tickets, |
|
| 115 | + $this->max_attendees, |
|
| 116 | + $this->ticket_rows, |
|
| 117 | + $cols, |
|
| 118 | + $required_ticket_sold_out, |
|
| 119 | + $this->template_args['event_status'], |
|
| 120 | + $datetime_selector instanceof DatetimeSelector |
|
| 121 | + ? $datetime_selector->getTicketDatetimeClasses($ticket) |
|
| 122 | + : '' |
|
| 123 | + ); |
|
| 124 | + $ticket_row_html = $ticket_selector_row->getHtml(); |
|
| 125 | + // check if something was actually returned |
|
| 126 | + if (! empty($ticket_row_html)) { |
|
| 127 | + // add any output to the cumulative HTML |
|
| 128 | + $all_ticket_rows_html .= $ticket_row_html; |
|
| 129 | + } |
|
| 130 | + if (empty($ticket_row_html) || ! $ticket_selector_row->isOnSale()) { |
|
| 131 | + // decrement the ticket row count since it looks like one has been removed |
|
| 132 | + $this->ticket_rows--; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut(); |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - $this->template_args['row'] = $this->ticket_rows; |
|
| 139 | - $this->template_args['ticket_row_html'] = $all_ticket_rows_html; |
|
| 140 | - $this->template_args['taxable_tickets'] = $taxable_tickets; |
|
| 141 | - $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes; |
|
| 142 | - // now load template |
|
| 143 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH |
|
| 144 | - . 'standard_ticket_selector.template.php'; |
|
| 145 | - remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
| 146 | - } |
|
| 135 | + $required_ticket_sold_out = $ticket_selector_row->getRequiredTicketSoldOut(); |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + $this->template_args['row'] = $this->ticket_rows; |
|
| 139 | + $this->template_args['ticket_row_html'] = $all_ticket_rows_html; |
|
| 140 | + $this->template_args['taxable_tickets'] = $taxable_tickets; |
|
| 141 | + $this->template_args['prices_displayed_including_taxes'] = $this->tax_config->prices_displayed_including_taxes; |
|
| 142 | + // now load template |
|
| 143 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH |
|
| 144 | + . 'standard_ticket_selector.template.php'; |
|
| 145 | + remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
| 146 | + } |
|
| 147 | 147 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $this->ticket_selector_config->getShowDatetimeSelector() |
| 93 | 93 | !== EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR |
| 94 | 94 | ) { |
| 95 | - $datetime_selector = new DatetimeSelector( |
|
| 95 | + $datetime_selector = new DatetimeSelector( |
|
| 96 | 96 | $this->event, |
| 97 | 97 | $this->tickets, |
| 98 | 98 | $this->ticket_selector_config, |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | ? $datetime_selector->getTicketDatetimeClasses($ticket) |
| 122 | 122 | : '' |
| 123 | 123 | ); |
| 124 | - $ticket_row_html = $ticket_selector_row->getHtml(); |
|
| 124 | + $ticket_row_html = $ticket_selector_row->getHtml(); |
|
| 125 | 125 | // check if something was actually returned |
| 126 | - if (! empty($ticket_row_html)) { |
|
| 126 | + if ( ! empty($ticket_row_html)) { |
|
| 127 | 127 | // add any output to the cumulative HTML |
| 128 | 128 | $all_ticket_rows_html .= $ticket_row_html; |
| 129 | 129 | } |
@@ -15,27 +15,27 @@ |
||
| 15 | 15 | class TicketSelectorRowSimple extends TicketSelectorRow |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @throws EE_Error |
|
| 20 | - * @throws ReflectionException |
|
| 21 | - */ |
|
| 22 | - public function setupTicketStatusDisplay() |
|
| 23 | - { |
|
| 24 | - $remaining = $this->ticket->remaining(); |
|
| 25 | - $this->setTicketMinAndMax($remaining); |
|
| 26 | - $this->setTicketStatusClasses($remaining); |
|
| 27 | - $this->setTicketStatusDisplay($remaining); |
|
| 28 | - } |
|
| 18 | + /** |
|
| 19 | + * @throws EE_Error |
|
| 20 | + * @throws ReflectionException |
|
| 21 | + */ |
|
| 22 | + public function setupTicketStatusDisplay() |
|
| 23 | + { |
|
| 24 | + $remaining = $this->ticket->remaining(); |
|
| 25 | + $this->setTicketMinAndMax($remaining); |
|
| 26 | + $this->setTicketStatusClasses($remaining); |
|
| 27 | + $this->setTicketStatusDisplay($remaining); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | - public function getTicketDescription() |
|
| 32 | - { |
|
| 33 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
| 34 | - if ($filtered_row_content !== false) { |
|
| 35 | - remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 36 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
| 37 | - return $filtered_row_content; |
|
| 38 | - } |
|
| 39 | - return $this->ticket->description(); |
|
| 40 | - } |
|
| 31 | + public function getTicketDescription() |
|
| 32 | + { |
|
| 33 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
| 34 | + if ($filtered_row_content !== false) { |
|
| 35 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 36 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_false'); |
|
| 37 | + return $filtered_row_content; |
|
| 38 | + } |
|
| 39 | + return $this->ticket->description(); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -20,358 +20,358 @@ |
||
| 20 | 20 | class TicketSelectorRowStandard extends TicketSelectorRow |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var TicketDetails |
|
| 25 | - */ |
|
| 26 | - protected $ticket_details; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var EE_Ticket_Selector_Config |
|
| 30 | - */ |
|
| 31 | - protected $template_settings; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var EE_Tax_Config |
|
| 35 | - */ |
|
| 36 | - protected $tax_settings; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @var boolean |
|
| 40 | - */ |
|
| 41 | - protected $prices_displayed_including_taxes; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @var int |
|
| 45 | - */ |
|
| 46 | - protected $row; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @var int |
|
| 50 | - */ |
|
| 51 | - protected $cols; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @var boolean |
|
| 55 | - */ |
|
| 56 | - protected $hidden_input_qty; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @var string |
|
| 60 | - */ |
|
| 61 | - protected $ticket_datetime_classes; |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * TicketDetails constructor. |
|
| 66 | - * |
|
| 67 | - * @param TicketDetails $ticket_details |
|
| 68 | - * @param EE_Tax_Config $tax_settings |
|
| 69 | - * @param int $total_tickets |
|
| 70 | - * @param int $max_attendees |
|
| 71 | - * @param int $row |
|
| 72 | - * @param int $cols |
|
| 73 | - * @param boolean $required_ticket_sold_out |
|
| 74 | - * @param string $event_status |
|
| 75 | - * @param string $ticket_datetime_classes |
|
| 76 | - * @throws EE_Error |
|
| 77 | - * @throws UnexpectedEntityException |
|
| 78 | - */ |
|
| 79 | - public function __construct( |
|
| 80 | - TicketDetails $ticket_details, |
|
| 81 | - EE_Tax_Config $tax_settings, |
|
| 82 | - $total_tickets, |
|
| 83 | - $max_attendees, |
|
| 84 | - $row, |
|
| 85 | - $cols, |
|
| 86 | - $required_ticket_sold_out, |
|
| 87 | - $event_status, |
|
| 88 | - $ticket_datetime_classes |
|
| 89 | - ) { |
|
| 90 | - $this->ticket_details = $ticket_details; |
|
| 91 | - $this->template_settings = $ticket_details->getTemplateSettings(); |
|
| 92 | - $this->tax_settings = $tax_settings; |
|
| 93 | - $this->row = $row; |
|
| 94 | - $this->cols = $cols; |
|
| 95 | - $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
| 96 | - parent::__construct( |
|
| 97 | - $ticket_details->getTicket(), |
|
| 98 | - $max_attendees, |
|
| 99 | - $ticket_details->getDateFormat(), |
|
| 100 | - $event_status, |
|
| 101 | - $required_ticket_sold_out, |
|
| 102 | - $total_tickets |
|
| 103 | - ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * other ticket rows will need to know if a required ticket is sold out, |
|
| 109 | - * so that they are not offered for sale |
|
| 110 | - * |
|
| 111 | - * @return boolean |
|
| 112 | - */ |
|
| 113 | - public function getRequiredTicketSoldOut() |
|
| 114 | - { |
|
| 115 | - return $this->required_ticket_sold_out; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @return int |
|
| 121 | - */ |
|
| 122 | - public function getCols() |
|
| 123 | - { |
|
| 124 | - return $this->cols; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * getHtml |
|
| 130 | - * |
|
| 131 | - * @return string |
|
| 132 | - * @throws EE_Error |
|
| 133 | - * @throws ReflectionException |
|
| 134 | - */ |
|
| 135 | - public function getHtml() |
|
| 136 | - { |
|
| 137 | - $this->min = 0; |
|
| 138 | - $this->max = $this->ticket->max(); |
|
| 139 | - $remaining = $this->ticket->remaining(); |
|
| 140 | - $this->setTicketMinAndMax($remaining); |
|
| 141 | - // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
| 142 | - $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
| 143 | - ? $this->ticket->start_date() |
|
| 144 | - : $this->required_ticket_sold_out; |
|
| 145 | - $this->setTicketPriceDetails(); |
|
| 146 | - $this->setTicketStatusClasses($remaining); |
|
| 147 | - $filtered_row_html = $this->getFilteredRowHtml(); |
|
| 148 | - if ($filtered_row_html !== false) { |
|
| 149 | - return $filtered_row_html; |
|
| 150 | - } |
|
| 151 | - $ticket_selector_row_html = EEH_HTML::tr( |
|
| 152 | - '', |
|
| 153 | - '', |
|
| 154 | - "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} " |
|
| 155 | - . espresso_get_object_css_class($this->ticket) |
|
| 156 | - ); |
|
| 157 | - $filtered_row_content = $this->getFilteredRowContents(); |
|
| 158 | - if ($filtered_row_content !== false && $this->max_attendees === 1) { |
|
| 159 | - return $ticket_selector_row_html |
|
| 160 | - . $filtered_row_content |
|
| 161 | - . $this->ticketQtyAndIdHiddenInputs() |
|
| 162 | - . EEH_HTML::trx(); |
|
| 163 | - } |
|
| 164 | - if ($filtered_row_content !== false) { |
|
| 165 | - return $ticket_selector_row_html |
|
| 166 | - . $filtered_row_content |
|
| 167 | - . EEH_HTML::trx(); |
|
| 168 | - } |
|
| 169 | - $this->hidden_input_qty = $this->max_attendees > 1; |
|
| 170 | - |
|
| 171 | - $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
| 172 | - $ticket_selector_row_html .= $this->ticketPriceTableCell(); |
|
| 173 | - $ticket_selector_row_html .= EEH_HTML::td( |
|
| 174 | - '', |
|
| 175 | - '', |
|
| 176 | - 'tckt-slctr-tbl-td-qty cntr', |
|
| 177 | - '', |
|
| 178 | - 'headers="quantity-' . $this->EVT_ID . '"' |
|
| 179 | - ); |
|
| 180 | - $this->setTicketStatusDisplay($remaining); |
|
| 181 | - if (empty($this->ticket_status_display)) { |
|
| 182 | - if ($this->max_attendees === 1) { |
|
| 183 | - // only ONE attendee is allowed to register at a time |
|
| 184 | - $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
| 185 | - } elseif ($this->max > 0) { |
|
| 186 | - $ticket_selector_row_html .= $this->ticketQuantitySelector(); |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - $ticket_selector_row_html .= $this->ticket_status_display; |
|
| 190 | - $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
| 191 | - $ticket_selector_row_html .= $this->ticket_details->display( |
|
| 192 | - $this->ticket_price, |
|
| 193 | - $remaining, |
|
| 194 | - $this->cols |
|
| 195 | - ); |
|
| 196 | - $ticket_selector_row_html .= EEH_HTML::tdx(); |
|
| 197 | - $ticket_selector_row_html .= EEH_HTML::trx(); |
|
| 198 | - |
|
| 199 | - |
|
| 200 | - $this->row++; |
|
| 201 | - return $ticket_selector_row_html; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * getTicketPriceDetails |
|
| 207 | - * |
|
| 208 | - * @return void |
|
| 209 | - * @throws EE_Error |
|
| 210 | - */ |
|
| 211 | - protected function setTicketPriceDetails() |
|
| 212 | - { |
|
| 213 | - $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
| 214 | - ? $this->ticket->get_ticket_total_with_taxes() |
|
| 215 | - : $this->ticket->get_ticket_subtotal(); |
|
| 216 | - $this->ticket_bundle = false; |
|
| 217 | - $ticket_min = $this->ticket->min(); |
|
| 218 | - // for ticket bundles, set min and max qty the same |
|
| 219 | - if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
| 220 | - $this->ticket_price *= $ticket_min; |
|
| 221 | - $this->ticket_bundle = true; |
|
| 222 | - } |
|
| 223 | - $this->ticket_price = apply_filters( |
|
| 224 | - 'FHEE__ticket_selector_chart_template__ticket_price', |
|
| 225 | - $this->ticket_price, |
|
| 226 | - $this->ticket |
|
| 227 | - ); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * ticketNameTableCell |
|
| 233 | - * |
|
| 234 | - * @return string |
|
| 235 | - * @throws EE_Error |
|
| 236 | - * @throws ReflectionException |
|
| 237 | - */ |
|
| 238 | - protected function ticketNameTableCell() |
|
| 239 | - { |
|
| 240 | - $html = EEH_HTML::td( |
|
| 241 | - '', |
|
| 242 | - '', |
|
| 243 | - 'tckt-slctr-tbl-td-name', |
|
| 244 | - '', |
|
| 245 | - 'headers="details-' . $this->EVT_ID . '"' |
|
| 246 | - ); |
|
| 247 | - $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
| 248 | - $html .= $this->ticket_details->getShowHideLinks(); |
|
| 249 | - if ($this->ticket->required()) { |
|
| 250 | - $html .= EEH_HTML::p( |
|
| 251 | - apply_filters( |
|
| 252 | - 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
| 253 | - esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
| 254 | - ), |
|
| 255 | - '', |
|
| 256 | - 'ticket-required-pg' |
|
| 257 | - ); |
|
| 258 | - } |
|
| 259 | - $html .= EEH_HTML::tdx(); |
|
| 260 | - return $html; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * ticketPriceTableCell |
|
| 266 | - * |
|
| 267 | - * @return string |
|
| 268 | - * @throws EE_Error |
|
| 269 | - */ |
|
| 270 | - protected function ticketPriceTableCell() |
|
| 271 | - { |
|
| 272 | - $html = ''; |
|
| 273 | - if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
| 274 | - $html .= EEH_HTML::td( |
|
| 275 | - '', |
|
| 276 | - '', |
|
| 277 | - 'tckt-slctr-tbl-td-price jst-rght', |
|
| 278 | - '', |
|
| 279 | - 'headers="price-' . $this->EVT_ID . '"' |
|
| 280 | - ); |
|
| 281 | - $html .= EEH_Template::format_currency($this->ticket_price); |
|
| 282 | - $html .= $this->ticket->taxable() |
|
| 283 | - ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
| 284 | - : ''; |
|
| 285 | - $html .= ' '; |
|
| 286 | - // phpcs:disable WordPress.WP.I18n.NoEmptyStrings |
|
| 287 | - $html .= EEH_HTML::span( |
|
| 288 | - $this->ticket_bundle |
|
| 289 | - ? apply_filters( |
|
| 290 | - 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
| 291 | - esc_html__(' / bundle', 'event_espresso') |
|
| 292 | - ) |
|
| 293 | - : apply_filters( |
|
| 294 | - 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
| 295 | - esc_html__('', 'event_espresso') |
|
| 296 | - ), |
|
| 297 | - '', |
|
| 298 | - 'smaller-text no-bold' |
|
| 299 | - ); |
|
| 300 | - $html .= ' '; |
|
| 301 | - $html .= EEH_HTML::tdx(); |
|
| 302 | - $this->cols++; |
|
| 303 | - } |
|
| 304 | - return $html; |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * onlyOneAttendeeCanRegister |
|
| 310 | - * |
|
| 311 | - * @return string |
|
| 312 | - */ |
|
| 313 | - protected function onlyOneAttendeeCanRegister() |
|
| 314 | - { |
|
| 315 | - // display submit button since we have tickets available |
|
| 316 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 317 | - $this->hidden_input_qty = false; |
|
| 318 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
| 319 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
| 320 | - $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
| 321 | - $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 322 | - $html .= ' id="' . $id . '"'; |
|
| 323 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 324 | - $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
|
| 325 | - $html .= ' title=""/>'; |
|
| 326 | - return $html; |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * ticketQuantitySelector |
|
| 332 | - * |
|
| 333 | - * @return string |
|
| 334 | - * @throws EE_Error |
|
| 335 | - */ |
|
| 336 | - protected function ticketQuantitySelector() |
|
| 337 | - { |
|
| 338 | - // display submit button since we have tickets available |
|
| 339 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 340 | - $this->hidden_input_qty = false; |
|
| 341 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
| 342 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
| 343 | - $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
| 344 | - $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 345 | - $html .= ' id="' . $id . '"'; |
|
| 346 | - $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
| 347 | - // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
| 348 | - if ($this->min !== 0 && ! $this->ticket->required()) { |
|
| 349 | - $html .= '<option value="0"> 0 </option>'; |
|
| 350 | - } |
|
| 351 | - // offer ticket quantities from the min to the max |
|
| 352 | - for ($i = $this->min; $i <= $this->max; $i++) { |
|
| 353 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 354 | - } |
|
| 355 | - $html .= '</select>'; |
|
| 356 | - return $html; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - |
|
| 360 | - /** |
|
| 361 | - * getHiddenInputs |
|
| 362 | - * |
|
| 363 | - * @return string |
|
| 364 | - * @throws EE_Error |
|
| 365 | - */ |
|
| 366 | - protected function ticketQtyAndIdHiddenInputs() |
|
| 367 | - { |
|
| 368 | - $html = ''; |
|
| 369 | - // depending on group reg we need to change the format for qty |
|
| 370 | - if ($this->hidden_input_qty) { |
|
| 371 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 372 | - } |
|
| 373 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 374 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 375 | - return $html; |
|
| 376 | - } |
|
| 23 | + /** |
|
| 24 | + * @var TicketDetails |
|
| 25 | + */ |
|
| 26 | + protected $ticket_details; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var EE_Ticket_Selector_Config |
|
| 30 | + */ |
|
| 31 | + protected $template_settings; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var EE_Tax_Config |
|
| 35 | + */ |
|
| 36 | + protected $tax_settings; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @var boolean |
|
| 40 | + */ |
|
| 41 | + protected $prices_displayed_including_taxes; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @var int |
|
| 45 | + */ |
|
| 46 | + protected $row; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @var int |
|
| 50 | + */ |
|
| 51 | + protected $cols; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @var boolean |
|
| 55 | + */ |
|
| 56 | + protected $hidden_input_qty; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @var string |
|
| 60 | + */ |
|
| 61 | + protected $ticket_datetime_classes; |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * TicketDetails constructor. |
|
| 66 | + * |
|
| 67 | + * @param TicketDetails $ticket_details |
|
| 68 | + * @param EE_Tax_Config $tax_settings |
|
| 69 | + * @param int $total_tickets |
|
| 70 | + * @param int $max_attendees |
|
| 71 | + * @param int $row |
|
| 72 | + * @param int $cols |
|
| 73 | + * @param boolean $required_ticket_sold_out |
|
| 74 | + * @param string $event_status |
|
| 75 | + * @param string $ticket_datetime_classes |
|
| 76 | + * @throws EE_Error |
|
| 77 | + * @throws UnexpectedEntityException |
|
| 78 | + */ |
|
| 79 | + public function __construct( |
|
| 80 | + TicketDetails $ticket_details, |
|
| 81 | + EE_Tax_Config $tax_settings, |
|
| 82 | + $total_tickets, |
|
| 83 | + $max_attendees, |
|
| 84 | + $row, |
|
| 85 | + $cols, |
|
| 86 | + $required_ticket_sold_out, |
|
| 87 | + $event_status, |
|
| 88 | + $ticket_datetime_classes |
|
| 89 | + ) { |
|
| 90 | + $this->ticket_details = $ticket_details; |
|
| 91 | + $this->template_settings = $ticket_details->getTemplateSettings(); |
|
| 92 | + $this->tax_settings = $tax_settings; |
|
| 93 | + $this->row = $row; |
|
| 94 | + $this->cols = $cols; |
|
| 95 | + $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
| 96 | + parent::__construct( |
|
| 97 | + $ticket_details->getTicket(), |
|
| 98 | + $max_attendees, |
|
| 99 | + $ticket_details->getDateFormat(), |
|
| 100 | + $event_status, |
|
| 101 | + $required_ticket_sold_out, |
|
| 102 | + $total_tickets |
|
| 103 | + ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * other ticket rows will need to know if a required ticket is sold out, |
|
| 109 | + * so that they are not offered for sale |
|
| 110 | + * |
|
| 111 | + * @return boolean |
|
| 112 | + */ |
|
| 113 | + public function getRequiredTicketSoldOut() |
|
| 114 | + { |
|
| 115 | + return $this->required_ticket_sold_out; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @return int |
|
| 121 | + */ |
|
| 122 | + public function getCols() |
|
| 123 | + { |
|
| 124 | + return $this->cols; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * getHtml |
|
| 130 | + * |
|
| 131 | + * @return string |
|
| 132 | + * @throws EE_Error |
|
| 133 | + * @throws ReflectionException |
|
| 134 | + */ |
|
| 135 | + public function getHtml() |
|
| 136 | + { |
|
| 137 | + $this->min = 0; |
|
| 138 | + $this->max = $this->ticket->max(); |
|
| 139 | + $remaining = $this->ticket->remaining(); |
|
| 140 | + $this->setTicketMinAndMax($remaining); |
|
| 141 | + // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
| 142 | + $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
| 143 | + ? $this->ticket->start_date() |
|
| 144 | + : $this->required_ticket_sold_out; |
|
| 145 | + $this->setTicketPriceDetails(); |
|
| 146 | + $this->setTicketStatusClasses($remaining); |
|
| 147 | + $filtered_row_html = $this->getFilteredRowHtml(); |
|
| 148 | + if ($filtered_row_html !== false) { |
|
| 149 | + return $filtered_row_html; |
|
| 150 | + } |
|
| 151 | + $ticket_selector_row_html = EEH_HTML::tr( |
|
| 152 | + '', |
|
| 153 | + '', |
|
| 154 | + "tckt-slctr-tbl-tr {$this->status_class}{$this->ticket_datetime_classes} " |
|
| 155 | + . espresso_get_object_css_class($this->ticket) |
|
| 156 | + ); |
|
| 157 | + $filtered_row_content = $this->getFilteredRowContents(); |
|
| 158 | + if ($filtered_row_content !== false && $this->max_attendees === 1) { |
|
| 159 | + return $ticket_selector_row_html |
|
| 160 | + . $filtered_row_content |
|
| 161 | + . $this->ticketQtyAndIdHiddenInputs() |
|
| 162 | + . EEH_HTML::trx(); |
|
| 163 | + } |
|
| 164 | + if ($filtered_row_content !== false) { |
|
| 165 | + return $ticket_selector_row_html |
|
| 166 | + . $filtered_row_content |
|
| 167 | + . EEH_HTML::trx(); |
|
| 168 | + } |
|
| 169 | + $this->hidden_input_qty = $this->max_attendees > 1; |
|
| 170 | + |
|
| 171 | + $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
| 172 | + $ticket_selector_row_html .= $this->ticketPriceTableCell(); |
|
| 173 | + $ticket_selector_row_html .= EEH_HTML::td( |
|
| 174 | + '', |
|
| 175 | + '', |
|
| 176 | + 'tckt-slctr-tbl-td-qty cntr', |
|
| 177 | + '', |
|
| 178 | + 'headers="quantity-' . $this->EVT_ID . '"' |
|
| 179 | + ); |
|
| 180 | + $this->setTicketStatusDisplay($remaining); |
|
| 181 | + if (empty($this->ticket_status_display)) { |
|
| 182 | + if ($this->max_attendees === 1) { |
|
| 183 | + // only ONE attendee is allowed to register at a time |
|
| 184 | + $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
| 185 | + } elseif ($this->max > 0) { |
|
| 186 | + $ticket_selector_row_html .= $this->ticketQuantitySelector(); |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + $ticket_selector_row_html .= $this->ticket_status_display; |
|
| 190 | + $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
| 191 | + $ticket_selector_row_html .= $this->ticket_details->display( |
|
| 192 | + $this->ticket_price, |
|
| 193 | + $remaining, |
|
| 194 | + $this->cols |
|
| 195 | + ); |
|
| 196 | + $ticket_selector_row_html .= EEH_HTML::tdx(); |
|
| 197 | + $ticket_selector_row_html .= EEH_HTML::trx(); |
|
| 198 | + |
|
| 199 | + |
|
| 200 | + $this->row++; |
|
| 201 | + return $ticket_selector_row_html; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * getTicketPriceDetails |
|
| 207 | + * |
|
| 208 | + * @return void |
|
| 209 | + * @throws EE_Error |
|
| 210 | + */ |
|
| 211 | + protected function setTicketPriceDetails() |
|
| 212 | + { |
|
| 213 | + $this->ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
| 214 | + ? $this->ticket->get_ticket_total_with_taxes() |
|
| 215 | + : $this->ticket->get_ticket_subtotal(); |
|
| 216 | + $this->ticket_bundle = false; |
|
| 217 | + $ticket_min = $this->ticket->min(); |
|
| 218 | + // for ticket bundles, set min and max qty the same |
|
| 219 | + if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
| 220 | + $this->ticket_price *= $ticket_min; |
|
| 221 | + $this->ticket_bundle = true; |
|
| 222 | + } |
|
| 223 | + $this->ticket_price = apply_filters( |
|
| 224 | + 'FHEE__ticket_selector_chart_template__ticket_price', |
|
| 225 | + $this->ticket_price, |
|
| 226 | + $this->ticket |
|
| 227 | + ); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * ticketNameTableCell |
|
| 233 | + * |
|
| 234 | + * @return string |
|
| 235 | + * @throws EE_Error |
|
| 236 | + * @throws ReflectionException |
|
| 237 | + */ |
|
| 238 | + protected function ticketNameTableCell() |
|
| 239 | + { |
|
| 240 | + $html = EEH_HTML::td( |
|
| 241 | + '', |
|
| 242 | + '', |
|
| 243 | + 'tckt-slctr-tbl-td-name', |
|
| 244 | + '', |
|
| 245 | + 'headers="details-' . $this->EVT_ID . '"' |
|
| 246 | + ); |
|
| 247 | + $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
| 248 | + $html .= $this->ticket_details->getShowHideLinks(); |
|
| 249 | + if ($this->ticket->required()) { |
|
| 250 | + $html .= EEH_HTML::p( |
|
| 251 | + apply_filters( |
|
| 252 | + 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
| 253 | + esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
| 254 | + ), |
|
| 255 | + '', |
|
| 256 | + 'ticket-required-pg' |
|
| 257 | + ); |
|
| 258 | + } |
|
| 259 | + $html .= EEH_HTML::tdx(); |
|
| 260 | + return $html; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * ticketPriceTableCell |
|
| 266 | + * |
|
| 267 | + * @return string |
|
| 268 | + * @throws EE_Error |
|
| 269 | + */ |
|
| 270 | + protected function ticketPriceTableCell() |
|
| 271 | + { |
|
| 272 | + $html = ''; |
|
| 273 | + if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
| 274 | + $html .= EEH_HTML::td( |
|
| 275 | + '', |
|
| 276 | + '', |
|
| 277 | + 'tckt-slctr-tbl-td-price jst-rght', |
|
| 278 | + '', |
|
| 279 | + 'headers="price-' . $this->EVT_ID . '"' |
|
| 280 | + ); |
|
| 281 | + $html .= EEH_Template::format_currency($this->ticket_price); |
|
| 282 | + $html .= $this->ticket->taxable() |
|
| 283 | + ? EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
| 284 | + : ''; |
|
| 285 | + $html .= ' '; |
|
| 286 | + // phpcs:disable WordPress.WP.I18n.NoEmptyStrings |
|
| 287 | + $html .= EEH_HTML::span( |
|
| 288 | + $this->ticket_bundle |
|
| 289 | + ? apply_filters( |
|
| 290 | + 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
| 291 | + esc_html__(' / bundle', 'event_espresso') |
|
| 292 | + ) |
|
| 293 | + : apply_filters( |
|
| 294 | + 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
| 295 | + esc_html__('', 'event_espresso') |
|
| 296 | + ), |
|
| 297 | + '', |
|
| 298 | + 'smaller-text no-bold' |
|
| 299 | + ); |
|
| 300 | + $html .= ' '; |
|
| 301 | + $html .= EEH_HTML::tdx(); |
|
| 302 | + $this->cols++; |
|
| 303 | + } |
|
| 304 | + return $html; |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * onlyOneAttendeeCanRegister |
|
| 310 | + * |
|
| 311 | + * @return string |
|
| 312 | + */ |
|
| 313 | + protected function onlyOneAttendeeCanRegister() |
|
| 314 | + { |
|
| 315 | + // display submit button since we have tickets available |
|
| 316 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 317 | + $this->hidden_input_qty = false; |
|
| 318 | + $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
| 319 | + $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
| 320 | + $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
| 321 | + $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 322 | + $html .= ' id="' . $id . '"'; |
|
| 323 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 324 | + $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
|
| 325 | + $html .= ' title=""/>'; |
|
| 326 | + return $html; |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * ticketQuantitySelector |
|
| 332 | + * |
|
| 333 | + * @return string |
|
| 334 | + * @throws EE_Error |
|
| 335 | + */ |
|
| 336 | + protected function ticketQuantitySelector() |
|
| 337 | + { |
|
| 338 | + // display submit button since we have tickets available |
|
| 339 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 340 | + $this->hidden_input_qty = false; |
|
| 341 | + $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
| 342 | + $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
| 343 | + $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
| 344 | + $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 345 | + $html .= ' id="' . $id . '"'; |
|
| 346 | + $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
| 347 | + // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
| 348 | + if ($this->min !== 0 && ! $this->ticket->required()) { |
|
| 349 | + $html .= '<option value="0"> 0 </option>'; |
|
| 350 | + } |
|
| 351 | + // offer ticket quantities from the min to the max |
|
| 352 | + for ($i = $this->min; $i <= $this->max; $i++) { |
|
| 353 | + $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 354 | + } |
|
| 355 | + $html .= '</select>'; |
|
| 356 | + return $html; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + |
|
| 360 | + /** |
|
| 361 | + * getHiddenInputs |
|
| 362 | + * |
|
| 363 | + * @return string |
|
| 364 | + * @throws EE_Error |
|
| 365 | + */ |
|
| 366 | + protected function ticketQtyAndIdHiddenInputs() |
|
| 367 | + { |
|
| 368 | + $html = ''; |
|
| 369 | + // depending on group reg we need to change the format for qty |
|
| 370 | + if ($this->hidden_input_qty) { |
|
| 371 | + $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 372 | + } |
|
| 373 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 374 | + $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 375 | + return $html; |
|
| 376 | + } |
|
| 377 | 377 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | '', |
| 176 | 176 | 'tckt-slctr-tbl-td-qty cntr', |
| 177 | 177 | '', |
| 178 | - 'headers="quantity-' . $this->EVT_ID . '"' |
|
| 178 | + 'headers="quantity-'.$this->EVT_ID.'"' |
|
| 179 | 179 | ); |
| 180 | 180 | $this->setTicketStatusDisplay($remaining); |
| 181 | 181 | if (empty($this->ticket_status_display)) { |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | '', |
| 243 | 243 | 'tckt-slctr-tbl-td-name', |
| 244 | 244 | '', |
| 245 | - 'headers="details-' . $this->EVT_ID . '"' |
|
| 245 | + 'headers="details-'.$this->EVT_ID.'"' |
|
| 246 | 246 | ); |
| 247 | 247 | $html .= EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
| 248 | 248 | $html .= $this->ticket_details->getShowHideLinks(); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | '', |
| 277 | 277 | 'tckt-slctr-tbl-td-price jst-rght', |
| 278 | 278 | '', |
| 279 | - 'headers="price-' . $this->EVT_ID . '"' |
|
| 279 | + 'headers="price-'.$this->EVT_ID.'"' |
|
| 280 | 280 | ); |
| 281 | 281 | $html .= EEH_Template::format_currency($this->ticket_price); |
| 282 | 282 | $html .= $this->ticket->taxable() |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | // display submit button since we have tickets available |
| 316 | 316 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 317 | 317 | $this->hidden_input_qty = false; |
| 318 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
| 319 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
| 320 | - $html .= esc_html__('Select this ticket', 'event_espresso') . '</label>'; |
|
| 321 | - $html .= '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 322 | - $html .= ' id="' . $id . '"'; |
|
| 323 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 318 | + $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row; |
|
| 319 | + $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">'; |
|
| 320 | + $html .= esc_html__('Select this ticket', 'event_espresso').'</label>'; |
|
| 321 | + $html .= '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"'; |
|
| 322 | + $html .= ' id="'.$id.'"'; |
|
| 323 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"'; |
|
| 324 | 324 | $html .= $this->total_tickets === 1 ? ' checked="checked"' : ''; |
| 325 | 325 | $html .= ' title=""/>'; |
| 326 | 326 | return $html; |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | // display submit button since we have tickets available |
| 339 | 339 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 340 | 340 | $this->hidden_input_qty = false; |
| 341 | - $id = 'ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row; |
|
| 342 | - $html = '<label class="ee-a11y-screen-reader-text" for="' . $id . '">'; |
|
| 343 | - $html .= esc_html__('Quantity', 'event_espresso') . '</label>'; |
|
| 344 | - $html .= '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 345 | - $html .= ' id="' . $id . '"'; |
|
| 341 | + $id = 'ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row; |
|
| 342 | + $html = '<label class="ee-a11y-screen-reader-text" for="'.$id.'">'; |
|
| 343 | + $html .= esc_html__('Quantity', 'event_espresso').'</label>'; |
|
| 344 | + $html .= '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"'; |
|
| 345 | + $html .= ' id="'.$id.'"'; |
|
| 346 | 346 | $html .= ' class="ticket-selector-tbl-qty-slct">'; |
| 347 | 347 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
| 348 | 348 | if ($this->min !== 0 && ! $this->ticket->required()) { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | // offer ticket quantities from the min to the max |
| 352 | 352 | for ($i = $this->min; $i <= $this->max; $i++) { |
| 353 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 353 | + $html .= '<option value="'.$i.'"> '.$i.' </option>'; |
|
| 354 | 354 | } |
| 355 | 355 | $html .= '</select>'; |
| 356 | 356 | return $html; |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | $html = ''; |
| 369 | 369 | // depending on group reg we need to change the format for qty |
| 370 | 370 | if ($this->hidden_input_qty) { |
| 371 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 371 | + $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>'; |
|
| 372 | 372 | } |
| 373 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 374 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 373 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"'; |
|
| 374 | + $html .= ' value="'.$this->ticket->ID().'"/>'; |
|
| 375 | 375 | return $html; |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -19,412 +19,412 @@ |
||
| 19 | 19 | abstract class TicketSelectorRow |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var EE_Ticket |
|
| 24 | - */ |
|
| 25 | - protected $ticket; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var int |
|
| 29 | - */ |
|
| 30 | - protected $total_tickets; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var int |
|
| 34 | - */ |
|
| 35 | - protected $max_attendees; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 40 | - protected $date_format; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var int |
|
| 44 | - */ |
|
| 45 | - protected $EVT_ID; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @var string |
|
| 49 | - */ |
|
| 50 | - protected $event_status; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @var boolean|string |
|
| 54 | - */ |
|
| 55 | - protected $required_ticket_sold_out; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 60 | - protected $ticket_status_display; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @var int |
|
| 64 | - */ |
|
| 65 | - protected $max = 0; |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @var int |
|
| 69 | - */ |
|
| 70 | - protected $min = 0; |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * @var float |
|
| 74 | - */ |
|
| 75 | - protected $ticket_price = 0.00; |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @var bool |
|
| 79 | - */ |
|
| 80 | - protected $ticket_bundle = false; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @var string |
|
| 84 | - */ |
|
| 85 | - protected $ticket_status_id = EE_Ticket::sold_out; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * @var string |
|
| 89 | - */ |
|
| 90 | - protected $ticket_status_html = 'ticket-sales-sold-out'; |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * @var string |
|
| 94 | - */ |
|
| 95 | - protected $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * used as an alternate way to indicate that a ticket is not available for sale |
|
| 99 | - * |
|
| 100 | - * @var bool |
|
| 101 | - */ |
|
| 102 | - protected $is_on_sale = true; |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @param EE_Ticket $ticket |
|
| 107 | - * @param int $max_attendees |
|
| 108 | - * @param string $date_format |
|
| 109 | - * @param string $event_status |
|
| 110 | - * @param boolean|string $required_ticket_sold_out |
|
| 111 | - * @param int $total_tickets |
|
| 112 | - * @throws EE_Error |
|
| 113 | - * @throws UnexpectedEntityException |
|
| 114 | - */ |
|
| 115 | - public function __construct( |
|
| 116 | - EE_Ticket $ticket, |
|
| 117 | - $max_attendees, |
|
| 118 | - $date_format, |
|
| 119 | - $event_status, |
|
| 120 | - $required_ticket_sold_out = false, |
|
| 121 | - $total_tickets = 1 |
|
| 122 | - ) { |
|
| 123 | - $this->ticket = $ticket; |
|
| 124 | - $this->max_attendees = $max_attendees; |
|
| 125 | - $this->date_format = $date_format; |
|
| 126 | - $this->EVT_ID = $this->ticket->get_event_ID(); |
|
| 127 | - $this->event_status = $event_status; |
|
| 128 | - $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
| 129 | - $this->total_tickets = $total_tickets; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * getTicketStatusClasses |
|
| 135 | - * |
|
| 136 | - * @param int $remaining |
|
| 137 | - * @return void |
|
| 138 | - * @throws EE_Error |
|
| 139 | - */ |
|
| 140 | - protected function setTicketStatusClasses($remaining = 0) |
|
| 141 | - { |
|
| 142 | - // if a previous required ticket with the same sale start date is sold out, |
|
| 143 | - // then mark this ticket as sold out as well. |
|
| 144 | - // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
| 145 | - $this->ticket_status_id = $this->required_ticket_sold_out !== false |
|
| 146 | - && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
| 147 | - ? EE_Ticket::sold_out |
|
| 148 | - : $this->ticket->ticket_status(); |
|
| 149 | - $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out |
|
| 150 | - ? EE_Ticket::sold_out |
|
| 151 | - : $this->ticket_status_id; |
|
| 152 | - // If at admin area, display expired tickets as on sale. |
|
| 153 | - $this->ticket_status_id = is_admin() && $this->ticket_status_id === EE_Ticket::expired |
|
| 154 | - ? EE_Ticket::onsale |
|
| 155 | - : $this->ticket_status_id; |
|
| 156 | - // check ticket status |
|
| 157 | - switch ($this->ticket_status_id) { |
|
| 158 | - // sold_out |
|
| 159 | - case EE_Ticket::sold_out: |
|
| 160 | - $ticket_status_class = 'ticket-sales-sold-out'; |
|
| 161 | - $this->status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 162 | - break; |
|
| 163 | - // expired |
|
| 164 | - case EE_Ticket::expired: |
|
| 165 | - $ticket_status_class = 'ticket-sales-expired'; |
|
| 166 | - $this->status_class = 'ticket-sales-expired lt-grey-text'; |
|
| 167 | - break; |
|
| 168 | - // archived |
|
| 169 | - case EE_Ticket::archived: |
|
| 170 | - $ticket_status_class = 'archived-ticket'; |
|
| 171 | - $this->status_class = 'archived-ticket hidden'; |
|
| 172 | - break; |
|
| 173 | - // pending |
|
| 174 | - case EE_Ticket::pending: |
|
| 175 | - $ticket_status_class = 'ticket-pending'; |
|
| 176 | - $this->status_class = 'ticket-pending'; |
|
| 177 | - break; |
|
| 178 | - // on sale |
|
| 179 | - case EE_Ticket::onsale: |
|
| 180 | - default: |
|
| 181 | - $ticket_status_class = 'ticket-on-sale'; |
|
| 182 | - $this->status_class = 'ticket-on-sale'; |
|
| 183 | - break; |
|
| 184 | - } |
|
| 185 | - $this->ticket_status_html = EEH_HTML::span( |
|
| 186 | - $this->ticket->ticket_status(true, ($remaining > 0)), |
|
| 187 | - "{$ticket_status_class}-{$this->ticket->ID()}", |
|
| 188 | - $ticket_status_class |
|
| 189 | - ); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * @return string |
|
| 195 | - */ |
|
| 196 | - public function getTicketStatusDisplay() |
|
| 197 | - { |
|
| 198 | - return $this->ticket_status_display; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * setTicketStatusDisplay |
|
| 204 | - * |
|
| 205 | - * @param int $remaining |
|
| 206 | - * @throws EE_Error |
|
| 207 | - * @throws ReflectionException |
|
| 208 | - */ |
|
| 209 | - protected function setTicketStatusDisplay($remaining) |
|
| 210 | - { |
|
| 211 | - $this->ticket_status_display = ''; |
|
| 212 | - |
|
| 213 | - // now depending on the ticket and other circumstances... |
|
| 214 | - if ($this->max_attendees === 0) { |
|
| 215 | - // registration is CLOSED because admin set max attendees to ZERO |
|
| 216 | - $this->ticket_status_display = $this->registrationClosed(); |
|
| 217 | - } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) { |
|
| 218 | - // SOLD OUT - no tickets remaining |
|
| 219 | - $this->ticket_status_display = $this->ticketsSoldOut(); |
|
| 220 | - } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) { |
|
| 221 | - // expired or archived ticket |
|
| 222 | - $this->ticket_status_display = $this->ticket_status_html; |
|
| 223 | - } elseif ($this->ticket_status_id === EE_Ticket::pending) { |
|
| 224 | - // ticket not on sale yet |
|
| 225 | - $this->ticket_status_display = $this->ticketsSalesPending(); |
|
| 226 | - } elseif ($this->ticket->min() > $remaining) { |
|
| 227 | - // min qty purchasable is less than tickets available |
|
| 228 | - $this->ticket_status_display = $this->notEnoughTicketsAvailable(); |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * registrationClosed |
|
| 235 | - */ |
|
| 236 | - protected function registrationClosed() |
|
| 237 | - { |
|
| 238 | - return EEH_HTML::span( |
|
| 239 | - apply_filters( |
|
| 240 | - 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
|
| 241 | - esc_html__('Closed', 'event_espresso') |
|
| 242 | - ), |
|
| 243 | - '', |
|
| 244 | - 'sold-out' |
|
| 245 | - ); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * ticketsSoldOut |
|
| 251 | - */ |
|
| 252 | - protected function ticketsSoldOut() |
|
| 253 | - { |
|
| 254 | - return EEH_HTML::span( |
|
| 255 | - apply_filters( |
|
| 256 | - 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
|
| 257 | - esc_html__('Sold Out', 'event_espresso') |
|
| 258 | - ), |
|
| 259 | - '', |
|
| 260 | - 'sold-out' |
|
| 261 | - ); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * ticketsSalesPending |
|
| 267 | - * |
|
| 268 | - * @throws EE_Error |
|
| 269 | - * @throws ReflectionException |
|
| 270 | - */ |
|
| 271 | - protected function ticketsSalesPending() |
|
| 272 | - { |
|
| 273 | - return EEH_HTML::span( |
|
| 274 | - EEH_HTML::span( |
|
| 275 | - apply_filters( |
|
| 276 | - 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
|
| 277 | - esc_html__('Goes On Sale', 'event_espresso') |
|
| 278 | - ), |
|
| 279 | - '', |
|
| 280 | - 'ticket-pending' |
|
| 281 | - ) |
|
| 282 | - . EEH_HTML::br() |
|
| 283 | - . EEH_HTML::span( |
|
| 284 | - $this->ticket->get_i18n_datetime( |
|
| 285 | - 'TKT_start_date', |
|
| 286 | - apply_filters( |
|
| 287 | - 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', |
|
| 288 | - $this->date_format |
|
| 289 | - ) |
|
| 290 | - ), |
|
| 291 | - '', |
|
| 292 | - 'small-text' |
|
| 293 | - ), |
|
| 294 | - '', |
|
| 295 | - 'ticket-pending-pg' |
|
| 296 | - ); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - |
|
| 300 | - /** |
|
| 301 | - * notEnoughTicketsAvailable |
|
| 302 | - */ |
|
| 303 | - protected function notEnoughTicketsAvailable() |
|
| 304 | - { |
|
| 305 | - return EEH_HTML::div( |
|
| 306 | - EEH_HTML::span( |
|
| 307 | - apply_filters( |
|
| 308 | - 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', |
|
| 309 | - esc_html__('Not Available', 'event_espresso') |
|
| 310 | - ), |
|
| 311 | - '', |
|
| 312 | - 'archived-ticket small-text' |
|
| 313 | - ) |
|
| 314 | - . EEH_HTML::br(), |
|
| 315 | - '', |
|
| 316 | - 'archived-ticket-pg' |
|
| 317 | - ); |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * setTicketMinAndMax |
|
| 323 | - * |
|
| 324 | - * @param int $remaining |
|
| 325 | - * @return void |
|
| 326 | - * @throws EE_Error |
|
| 327 | - */ |
|
| 328 | - protected function setTicketMinAndMax($remaining) |
|
| 329 | - { |
|
| 330 | - // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller |
|
| 331 | - $this->max = min($remaining, $this->max_attendees); |
|
| 332 | - // but... we also want to restrict the number of tickets by the ticket max setting, |
|
| 333 | - // however, the max still can't be higher than what was just set above |
|
| 334 | - $this->max = $this->ticket->max() > 0 |
|
| 335 | - ? min($this->ticket->max(), $this->max) |
|
| 336 | - : $this->max; |
|
| 337 | - // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
| 338 | - $this->min = $this->ticket->min() > 0 |
|
| 339 | - ? $this->ticket->min() |
|
| 340 | - : 0; |
|
| 341 | - // and if the ticket is required, then make sure that min qty is at least 1 |
|
| 342 | - $this->min = $this->ticket->required() |
|
| 343 | - ? max($this->min, 1) |
|
| 344 | - : $this->min; |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * Allow plugins to hook in and abort the generation and display of this row to do |
|
| 350 | - * something elseif they want. |
|
| 351 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 352 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 353 | - * current row. |
|
| 354 | - * |
|
| 355 | - * @return string|bool |
|
| 356 | - */ |
|
| 357 | - protected function getFilteredRowHtml() |
|
| 358 | - { |
|
| 359 | - return apply_filters( |
|
| 360 | - 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
| 361 | - false, |
|
| 362 | - $this->ticket, |
|
| 363 | - $this->max, |
|
| 364 | - $this->min, |
|
| 365 | - $this->required_ticket_sold_out, |
|
| 366 | - $this->ticket_price, |
|
| 367 | - $this->ticket_bundle, |
|
| 368 | - $this->ticket_status_html, |
|
| 369 | - $this->status_class, |
|
| 370 | - $this |
|
| 371 | - ); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * Allow plugins to hook in and abort the generation and display of the contents of this |
|
| 377 | - * row to do something elseif they want. |
|
| 378 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 379 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 380 | - * current row. |
|
| 381 | - * |
|
| 382 | - * @return string|bool |
|
| 383 | - */ |
|
| 384 | - protected function getFilteredRowContents() |
|
| 385 | - { |
|
| 386 | - $filtered_row_content = apply_filters( |
|
| 387 | - 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
| 388 | - false, |
|
| 389 | - $this->ticket, |
|
| 390 | - $this->max, |
|
| 391 | - $this->min, |
|
| 392 | - $this->required_ticket_sold_out, |
|
| 393 | - $this->ticket_price, |
|
| 394 | - $this->ticket_bundle, |
|
| 395 | - $this->ticket_status_html, |
|
| 396 | - $this->status_class, |
|
| 397 | - $this |
|
| 398 | - ); |
|
| 399 | - // if the ticket row html is overridden but does NOT contain some kind of input... |
|
| 400 | - if ( |
|
| 401 | - $filtered_row_content !== false |
|
| 402 | - && strpos($filtered_row_content, '<input') === false |
|
| 403 | - && strpos($filtered_row_content, '<select') === false |
|
| 404 | - ) { |
|
| 405 | - // then mark the ticket as not on sale |
|
| 406 | - $this->setIsOnSale(false); |
|
| 407 | - } |
|
| 408 | - return $filtered_row_content; |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - |
|
| 412 | - /** |
|
| 413 | - * @return bool |
|
| 414 | - * @since $VID:$ |
|
| 415 | - */ |
|
| 416 | - public function isOnSale() |
|
| 417 | - { |
|
| 418 | - return $this->is_on_sale; |
|
| 419 | - } |
|
| 420 | - |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * @param bool $is_on_sale |
|
| 424 | - * @since $VID:$ |
|
| 425 | - */ |
|
| 426 | - public function setIsOnSale($is_on_sale = true) |
|
| 427 | - { |
|
| 428 | - $this->is_on_sale = filter_var($is_on_sale, FILTER_VALIDATE_BOOLEAN); |
|
| 429 | - } |
|
| 22 | + /** |
|
| 23 | + * @var EE_Ticket |
|
| 24 | + */ |
|
| 25 | + protected $ticket; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var int |
|
| 29 | + */ |
|
| 30 | + protected $total_tickets; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var int |
|
| 34 | + */ |
|
| 35 | + protected $max_attendees; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | + protected $date_format; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var int |
|
| 44 | + */ |
|
| 45 | + protected $EVT_ID; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @var string |
|
| 49 | + */ |
|
| 50 | + protected $event_status; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @var boolean|string |
|
| 54 | + */ |
|
| 55 | + protected $required_ticket_sold_out; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | + protected $ticket_status_display; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @var int |
|
| 64 | + */ |
|
| 65 | + protected $max = 0; |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @var int |
|
| 69 | + */ |
|
| 70 | + protected $min = 0; |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * @var float |
|
| 74 | + */ |
|
| 75 | + protected $ticket_price = 0.00; |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @var bool |
|
| 79 | + */ |
|
| 80 | + protected $ticket_bundle = false; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @var string |
|
| 84 | + */ |
|
| 85 | + protected $ticket_status_id = EE_Ticket::sold_out; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * @var string |
|
| 89 | + */ |
|
| 90 | + protected $ticket_status_html = 'ticket-sales-sold-out'; |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * @var string |
|
| 94 | + */ |
|
| 95 | + protected $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * used as an alternate way to indicate that a ticket is not available for sale |
|
| 99 | + * |
|
| 100 | + * @var bool |
|
| 101 | + */ |
|
| 102 | + protected $is_on_sale = true; |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @param EE_Ticket $ticket |
|
| 107 | + * @param int $max_attendees |
|
| 108 | + * @param string $date_format |
|
| 109 | + * @param string $event_status |
|
| 110 | + * @param boolean|string $required_ticket_sold_out |
|
| 111 | + * @param int $total_tickets |
|
| 112 | + * @throws EE_Error |
|
| 113 | + * @throws UnexpectedEntityException |
|
| 114 | + */ |
|
| 115 | + public function __construct( |
|
| 116 | + EE_Ticket $ticket, |
|
| 117 | + $max_attendees, |
|
| 118 | + $date_format, |
|
| 119 | + $event_status, |
|
| 120 | + $required_ticket_sold_out = false, |
|
| 121 | + $total_tickets = 1 |
|
| 122 | + ) { |
|
| 123 | + $this->ticket = $ticket; |
|
| 124 | + $this->max_attendees = $max_attendees; |
|
| 125 | + $this->date_format = $date_format; |
|
| 126 | + $this->EVT_ID = $this->ticket->get_event_ID(); |
|
| 127 | + $this->event_status = $event_status; |
|
| 128 | + $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
| 129 | + $this->total_tickets = $total_tickets; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * getTicketStatusClasses |
|
| 135 | + * |
|
| 136 | + * @param int $remaining |
|
| 137 | + * @return void |
|
| 138 | + * @throws EE_Error |
|
| 139 | + */ |
|
| 140 | + protected function setTicketStatusClasses($remaining = 0) |
|
| 141 | + { |
|
| 142 | + // if a previous required ticket with the same sale start date is sold out, |
|
| 143 | + // then mark this ticket as sold out as well. |
|
| 144 | + // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
| 145 | + $this->ticket_status_id = $this->required_ticket_sold_out !== false |
|
| 146 | + && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
| 147 | + ? EE_Ticket::sold_out |
|
| 148 | + : $this->ticket->ticket_status(); |
|
| 149 | + $this->ticket_status_id = $this->event_status === EE_Datetime::sold_out |
|
| 150 | + ? EE_Ticket::sold_out |
|
| 151 | + : $this->ticket_status_id; |
|
| 152 | + // If at admin area, display expired tickets as on sale. |
|
| 153 | + $this->ticket_status_id = is_admin() && $this->ticket_status_id === EE_Ticket::expired |
|
| 154 | + ? EE_Ticket::onsale |
|
| 155 | + : $this->ticket_status_id; |
|
| 156 | + // check ticket status |
|
| 157 | + switch ($this->ticket_status_id) { |
|
| 158 | + // sold_out |
|
| 159 | + case EE_Ticket::sold_out: |
|
| 160 | + $ticket_status_class = 'ticket-sales-sold-out'; |
|
| 161 | + $this->status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 162 | + break; |
|
| 163 | + // expired |
|
| 164 | + case EE_Ticket::expired: |
|
| 165 | + $ticket_status_class = 'ticket-sales-expired'; |
|
| 166 | + $this->status_class = 'ticket-sales-expired lt-grey-text'; |
|
| 167 | + break; |
|
| 168 | + // archived |
|
| 169 | + case EE_Ticket::archived: |
|
| 170 | + $ticket_status_class = 'archived-ticket'; |
|
| 171 | + $this->status_class = 'archived-ticket hidden'; |
|
| 172 | + break; |
|
| 173 | + // pending |
|
| 174 | + case EE_Ticket::pending: |
|
| 175 | + $ticket_status_class = 'ticket-pending'; |
|
| 176 | + $this->status_class = 'ticket-pending'; |
|
| 177 | + break; |
|
| 178 | + // on sale |
|
| 179 | + case EE_Ticket::onsale: |
|
| 180 | + default: |
|
| 181 | + $ticket_status_class = 'ticket-on-sale'; |
|
| 182 | + $this->status_class = 'ticket-on-sale'; |
|
| 183 | + break; |
|
| 184 | + } |
|
| 185 | + $this->ticket_status_html = EEH_HTML::span( |
|
| 186 | + $this->ticket->ticket_status(true, ($remaining > 0)), |
|
| 187 | + "{$ticket_status_class}-{$this->ticket->ID()}", |
|
| 188 | + $ticket_status_class |
|
| 189 | + ); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * @return string |
|
| 195 | + */ |
|
| 196 | + public function getTicketStatusDisplay() |
|
| 197 | + { |
|
| 198 | + return $this->ticket_status_display; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * setTicketStatusDisplay |
|
| 204 | + * |
|
| 205 | + * @param int $remaining |
|
| 206 | + * @throws EE_Error |
|
| 207 | + * @throws ReflectionException |
|
| 208 | + */ |
|
| 209 | + protected function setTicketStatusDisplay($remaining) |
|
| 210 | + { |
|
| 211 | + $this->ticket_status_display = ''; |
|
| 212 | + |
|
| 213 | + // now depending on the ticket and other circumstances... |
|
| 214 | + if ($this->max_attendees === 0) { |
|
| 215 | + // registration is CLOSED because admin set max attendees to ZERO |
|
| 216 | + $this->ticket_status_display = $this->registrationClosed(); |
|
| 217 | + } elseif ($this->ticket_status_id === EE_Ticket::sold_out || $remaining === 0) { |
|
| 218 | + // SOLD OUT - no tickets remaining |
|
| 219 | + $this->ticket_status_display = $this->ticketsSoldOut(); |
|
| 220 | + } elseif ($this->ticket_status_id === EE_Ticket::expired || $this->ticket_status_id === EE_Ticket::archived) { |
|
| 221 | + // expired or archived ticket |
|
| 222 | + $this->ticket_status_display = $this->ticket_status_html; |
|
| 223 | + } elseif ($this->ticket_status_id === EE_Ticket::pending) { |
|
| 224 | + // ticket not on sale yet |
|
| 225 | + $this->ticket_status_display = $this->ticketsSalesPending(); |
|
| 226 | + } elseif ($this->ticket->min() > $remaining) { |
|
| 227 | + // min qty purchasable is less than tickets available |
|
| 228 | + $this->ticket_status_display = $this->notEnoughTicketsAvailable(); |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * registrationClosed |
|
| 235 | + */ |
|
| 236 | + protected function registrationClosed() |
|
| 237 | + { |
|
| 238 | + return EEH_HTML::span( |
|
| 239 | + apply_filters( |
|
| 240 | + 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
|
| 241 | + esc_html__('Closed', 'event_espresso') |
|
| 242 | + ), |
|
| 243 | + '', |
|
| 244 | + 'sold-out' |
|
| 245 | + ); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * ticketsSoldOut |
|
| 251 | + */ |
|
| 252 | + protected function ticketsSoldOut() |
|
| 253 | + { |
|
| 254 | + return EEH_HTML::span( |
|
| 255 | + apply_filters( |
|
| 256 | + 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
|
| 257 | + esc_html__('Sold Out', 'event_espresso') |
|
| 258 | + ), |
|
| 259 | + '', |
|
| 260 | + 'sold-out' |
|
| 261 | + ); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * ticketsSalesPending |
|
| 267 | + * |
|
| 268 | + * @throws EE_Error |
|
| 269 | + * @throws ReflectionException |
|
| 270 | + */ |
|
| 271 | + protected function ticketsSalesPending() |
|
| 272 | + { |
|
| 273 | + return EEH_HTML::span( |
|
| 274 | + EEH_HTML::span( |
|
| 275 | + apply_filters( |
|
| 276 | + 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
|
| 277 | + esc_html__('Goes On Sale', 'event_espresso') |
|
| 278 | + ), |
|
| 279 | + '', |
|
| 280 | + 'ticket-pending' |
|
| 281 | + ) |
|
| 282 | + . EEH_HTML::br() |
|
| 283 | + . EEH_HTML::span( |
|
| 284 | + $this->ticket->get_i18n_datetime( |
|
| 285 | + 'TKT_start_date', |
|
| 286 | + apply_filters( |
|
| 287 | + 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', |
|
| 288 | + $this->date_format |
|
| 289 | + ) |
|
| 290 | + ), |
|
| 291 | + '', |
|
| 292 | + 'small-text' |
|
| 293 | + ), |
|
| 294 | + '', |
|
| 295 | + 'ticket-pending-pg' |
|
| 296 | + ); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + |
|
| 300 | + /** |
|
| 301 | + * notEnoughTicketsAvailable |
|
| 302 | + */ |
|
| 303 | + protected function notEnoughTicketsAvailable() |
|
| 304 | + { |
|
| 305 | + return EEH_HTML::div( |
|
| 306 | + EEH_HTML::span( |
|
| 307 | + apply_filters( |
|
| 308 | + 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', |
|
| 309 | + esc_html__('Not Available', 'event_espresso') |
|
| 310 | + ), |
|
| 311 | + '', |
|
| 312 | + 'archived-ticket small-text' |
|
| 313 | + ) |
|
| 314 | + . EEH_HTML::br(), |
|
| 315 | + '', |
|
| 316 | + 'archived-ticket-pg' |
|
| 317 | + ); |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * setTicketMinAndMax |
|
| 323 | + * |
|
| 324 | + * @param int $remaining |
|
| 325 | + * @return void |
|
| 326 | + * @throws EE_Error |
|
| 327 | + */ |
|
| 328 | + protected function setTicketMinAndMax($remaining) |
|
| 329 | + { |
|
| 330 | + // offer the number of $tickets_remaining or $this->max_attendees, whichever is smaller |
|
| 331 | + $this->max = min($remaining, $this->max_attendees); |
|
| 332 | + // but... we also want to restrict the number of tickets by the ticket max setting, |
|
| 333 | + // however, the max still can't be higher than what was just set above |
|
| 334 | + $this->max = $this->ticket->max() > 0 |
|
| 335 | + ? min($this->ticket->max(), $this->max) |
|
| 336 | + : $this->max; |
|
| 337 | + // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
| 338 | + $this->min = $this->ticket->min() > 0 |
|
| 339 | + ? $this->ticket->min() |
|
| 340 | + : 0; |
|
| 341 | + // and if the ticket is required, then make sure that min qty is at least 1 |
|
| 342 | + $this->min = $this->ticket->required() |
|
| 343 | + ? max($this->min, 1) |
|
| 344 | + : $this->min; |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * Allow plugins to hook in and abort the generation and display of this row to do |
|
| 350 | + * something elseif they want. |
|
| 351 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 352 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 353 | + * current row. |
|
| 354 | + * |
|
| 355 | + * @return string|bool |
|
| 356 | + */ |
|
| 357 | + protected function getFilteredRowHtml() |
|
| 358 | + { |
|
| 359 | + return apply_filters( |
|
| 360 | + 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
| 361 | + false, |
|
| 362 | + $this->ticket, |
|
| 363 | + $this->max, |
|
| 364 | + $this->min, |
|
| 365 | + $this->required_ticket_sold_out, |
|
| 366 | + $this->ticket_price, |
|
| 367 | + $this->ticket_bundle, |
|
| 368 | + $this->ticket_status_html, |
|
| 369 | + $this->status_class, |
|
| 370 | + $this |
|
| 371 | + ); |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * Allow plugins to hook in and abort the generation and display of the contents of this |
|
| 377 | + * row to do something elseif they want. |
|
| 378 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 379 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 380 | + * current row. |
|
| 381 | + * |
|
| 382 | + * @return string|bool |
|
| 383 | + */ |
|
| 384 | + protected function getFilteredRowContents() |
|
| 385 | + { |
|
| 386 | + $filtered_row_content = apply_filters( |
|
| 387 | + 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
| 388 | + false, |
|
| 389 | + $this->ticket, |
|
| 390 | + $this->max, |
|
| 391 | + $this->min, |
|
| 392 | + $this->required_ticket_sold_out, |
|
| 393 | + $this->ticket_price, |
|
| 394 | + $this->ticket_bundle, |
|
| 395 | + $this->ticket_status_html, |
|
| 396 | + $this->status_class, |
|
| 397 | + $this |
|
| 398 | + ); |
|
| 399 | + // if the ticket row html is overridden but does NOT contain some kind of input... |
|
| 400 | + if ( |
|
| 401 | + $filtered_row_content !== false |
|
| 402 | + && strpos($filtered_row_content, '<input') === false |
|
| 403 | + && strpos($filtered_row_content, '<select') === false |
|
| 404 | + ) { |
|
| 405 | + // then mark the ticket as not on sale |
|
| 406 | + $this->setIsOnSale(false); |
|
| 407 | + } |
|
| 408 | + return $filtered_row_content; |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + |
|
| 412 | + /** |
|
| 413 | + * @return bool |
|
| 414 | + * @since $VID:$ |
|
| 415 | + */ |
|
| 416 | + public function isOnSale() |
|
| 417 | + { |
|
| 418 | + return $this->is_on_sale; |
|
| 419 | + } |
|
| 420 | + |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * @param bool $is_on_sale |
|
| 424 | + * @since $VID:$ |
|
| 425 | + */ |
|
| 426 | + public function setIsOnSale($is_on_sale = true) |
|
| 427 | + { |
|
| 428 | + $this->is_on_sale = filter_var($is_on_sale, FILTER_VALIDATE_BOOLEAN); |
|
| 429 | + } |
|
| 430 | 430 | } |
@@ -38,103 +38,103 @@ |
||
| 38 | 38 | * @since 4.0 |
| 39 | 39 | */ |
| 40 | 40 | if (function_exists('espresso_version')) { |
| 41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 42 | - /** |
|
| 43 | - * espresso_duplicate_plugin_error |
|
| 44 | - * displays if more than one version of EE is activated at the same time |
|
| 45 | - */ |
|
| 46 | - function espresso_duplicate_plugin_error() |
|
| 47 | - { |
|
| 48 | - ?> |
|
| 41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 42 | + /** |
|
| 43 | + * espresso_duplicate_plugin_error |
|
| 44 | + * displays if more than one version of EE is activated at the same time |
|
| 45 | + */ |
|
| 46 | + function espresso_duplicate_plugin_error() |
|
| 47 | + { |
|
| 48 | + ?> |
|
| 49 | 49 | <div class="error"> |
| 50 | 50 | <p> |
| 51 | 51 | <?php |
| 52 | - echo esc_html__( |
|
| 53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
| 54 | - 'event_espresso' |
|
| 55 | - ); ?> |
|
| 52 | + echo esc_html__( |
|
| 53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
| 54 | + 'event_espresso' |
|
| 55 | + ); ?> |
|
| 56 | 56 | </p> |
| 57 | 57 | </div> |
| 58 | 58 | <?php |
| 59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
| 63 | 63 | } else { |
| 64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
| 65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | - /** |
|
| 67 | - * espresso_minimum_php_version_error |
|
| 68 | - * |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - function espresso_minimum_php_version_error() |
|
| 72 | - { |
|
| 73 | - ?> |
|
| 64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
| 65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | + /** |
|
| 67 | + * espresso_minimum_php_version_error |
|
| 68 | + * |
|
| 69 | + * @return void |
|
| 70 | + */ |
|
| 71 | + function espresso_minimum_php_version_error() |
|
| 72 | + { |
|
| 73 | + ?> |
|
| 74 | 74 | <div class="error"> |
| 75 | 75 | <p> |
| 76 | 76 | <?php |
| 77 | - printf( |
|
| 78 | - esc_html__( |
|
| 79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 80 | - 'event_espresso' |
|
| 81 | - ), |
|
| 82 | - EE_MIN_PHP_VER_REQUIRED, |
|
| 83 | - PHP_VERSION, |
|
| 84 | - '<br/>', |
|
| 85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 86 | - ); |
|
| 87 | - ?> |
|
| 77 | + printf( |
|
| 78 | + esc_html__( |
|
| 79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
| 80 | + 'event_espresso' |
|
| 81 | + ), |
|
| 82 | + EE_MIN_PHP_VER_REQUIRED, |
|
| 83 | + PHP_VERSION, |
|
| 84 | + '<br/>', |
|
| 85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 86 | + ); |
|
| 87 | + ?> |
|
| 88 | 88 | </p> |
| 89 | 89 | </div> |
| 90 | 90 | <?php |
| 91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 92 | - } |
|
| 91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 95 | - } else { |
|
| 96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 97 | - /** |
|
| 98 | - * espresso_version |
|
| 99 | - * Returns the plugin version |
|
| 100 | - * |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - function espresso_version() |
|
| 104 | - { |
|
| 105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.23.rc.003'); |
|
| 106 | - } |
|
| 94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
| 95 | + } else { |
|
| 96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
| 97 | + /** |
|
| 98 | + * espresso_version |
|
| 99 | + * Returns the plugin version |
|
| 100 | + * |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + function espresso_version() |
|
| 104 | + { |
|
| 105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.23.rc.003'); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * espresso_plugin_activation |
|
| 110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 111 | - */ |
|
| 112 | - function espresso_plugin_activation() |
|
| 113 | - { |
|
| 114 | - update_option('ee_espresso_activation', true); |
|
| 115 | - } |
|
| 108 | + /** |
|
| 109 | + * espresso_plugin_activation |
|
| 110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
| 111 | + */ |
|
| 112 | + function espresso_plugin_activation() |
|
| 113 | + { |
|
| 114 | + update_option('ee_espresso_activation', true); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
| 118 | 118 | |
| 119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 120 | - bootstrap_espresso(); |
|
| 121 | - } |
|
| 119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 120 | + bootstrap_espresso(); |
|
| 121 | + } |
|
| 122 | 122 | } |
| 123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
| 124 | - /** |
|
| 125 | - * deactivate_plugin |
|
| 126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 127 | - * |
|
| 128 | - * @access public |
|
| 129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 130 | - * @return void |
|
| 131 | - */ |
|
| 132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
| 133 | - { |
|
| 134 | - if (! function_exists('deactivate_plugins')) { |
|
| 135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 136 | - } |
|
| 137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
| 138 | - deactivate_plugins($plugin_basename); |
|
| 139 | - } |
|
| 124 | + /** |
|
| 125 | + * deactivate_plugin |
|
| 126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
| 127 | + * |
|
| 128 | + * @access public |
|
| 129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
| 130 | + * @return void |
|
| 131 | + */ |
|
| 132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
| 133 | + { |
|
| 134 | + if (! function_exists('deactivate_plugins')) { |
|
| 135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 136 | + } |
|
| 137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
| 138 | + deactivate_plugins($plugin_basename); |
|
| 139 | + } |
|
| 140 | 140 | } |