@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function getShowHideLinks(): string |
| 119 | 119 | { |
| 120 | - if (! $this->showTicketDetails()) { |
|
| 120 | + if ( ! $this->showTicketDetails()) { |
|
| 121 | 121 | return ''; |
| 122 | 122 | } |
| 123 | 123 | return EEH_HTML::link( |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | "display-{$this->cssId()}", |
| 133 | 133 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
| 134 | 134 | '', |
| 135 | - 'rel="' . $this->cssId() . '"' |
|
| 136 | - ) . EEH_HTML::link( |
|
| 135 | + 'rel="'.$this->cssId().'"' |
|
| 136 | + ).EEH_HTML::link( |
|
| 137 | 137 | '', |
| 138 | 138 | sprintf(esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
| 139 | 139 | esc_attr( |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | "hide-{$this->cssId()}", |
| 146 | 146 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
| 147 | 147 | 'display:none;', |
| 148 | - 'rel="' . $this->cssId() . '"' |
|
| 148 | + 'rel="'.$this->cssId().'"' |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
| 192 | 192 | true |
| 193 | 193 | ); |
| 194 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
| 194 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
| 195 | 195 | 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
| 196 | 196 | esc_html__('Price', 'event_espresso') |
| 197 | 197 | ); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | return EEH_Template::locate_template( |
| 203 | 203 | apply_filters( |
| 204 | 204 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
| 205 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 205 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
| 206 | 206 | $this->ticket |
| 207 | 207 | ), |
| 208 | 208 | $template_args |
@@ -19,193 +19,193 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class TicketDetails |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var EE_Ticket $ticket |
|
| 24 | - */ |
|
| 25 | - protected $ticket; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var EE_Ticket_Selector_Config $template_settings |
|
| 29 | - */ |
|
| 30 | - protected $template_settings; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var string $date_format |
|
| 34 | - */ |
|
| 35 | - protected $date_format; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var string $time_format |
|
| 39 | - */ |
|
| 40 | - protected $time_format; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var bool $event_is_expired |
|
| 44 | - */ |
|
| 45 | - protected $event_is_expired; |
|
| 46 | - |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * TicketDetails constructor. |
|
| 50 | - * |
|
| 51 | - * @param EE_Ticket $ticket |
|
| 52 | - * @param EE_Ticket_Selector_Config $template_settings |
|
| 53 | - * @param array $template_args |
|
| 54 | - */ |
|
| 55 | - public function __construct( |
|
| 56 | - EE_Ticket $ticket, |
|
| 57 | - EE_Ticket_Selector_Config $template_settings, |
|
| 58 | - array $template_args |
|
| 59 | - ) { |
|
| 60 | - $this->ticket = $ticket; |
|
| 61 | - $this->template_settings = $template_settings; |
|
| 62 | - $this->date_format = $template_args['date_format']; |
|
| 63 | - $this->time_format = $template_args['time_format']; |
|
| 64 | - $this->event_is_expired = $template_args['event_is_expired']; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @return EE_Ticket |
|
| 70 | - */ |
|
| 71 | - public function getTicket(): EE_Ticket |
|
| 72 | - { |
|
| 73 | - return $this->ticket; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @return bool |
|
| 79 | - */ |
|
| 80 | - public function showTicketDetails(): bool |
|
| 81 | - { |
|
| 82 | - return $this->template_settings->show_ticket_details; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * @return EE_Ticket_Selector_Config |
|
| 88 | - */ |
|
| 89 | - public function getTemplateSettings(): EE_Ticket_Selector_Config |
|
| 90 | - { |
|
| 91 | - return $this->template_settings; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function getDateFormat(): string |
|
| 99 | - { |
|
| 100 | - return $this->date_format; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @return string |
|
| 106 | - */ |
|
| 107 | - public function getTimeFormat(): string |
|
| 108 | - { |
|
| 109 | - return $this->time_format; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * @return string |
|
| 115 | - * @throws EE_Error |
|
| 116 | - * @throws ReflectionException |
|
| 117 | - */ |
|
| 118 | - public function getShowHideLinks(): string |
|
| 119 | - { |
|
| 120 | - if (! $this->showTicketDetails()) { |
|
| 121 | - return ''; |
|
| 122 | - } |
|
| 123 | - return EEH_HTML::link( |
|
| 124 | - '', |
|
| 125 | - sprintf(esc_html__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 126 | - esc_attr( |
|
| 127 | - apply_filters( |
|
| 128 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 129 | - esc_html__('click to show additional ticket details', 'event_espresso') |
|
| 130 | - ) |
|
| 131 | - ), |
|
| 132 | - "display-{$this->cssId()}", |
|
| 133 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 134 | - '', |
|
| 135 | - 'rel="' . $this->cssId() . '"' |
|
| 136 | - ) . EEH_HTML::link( |
|
| 137 | - '', |
|
| 138 | - sprintf(esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 139 | - esc_attr( |
|
| 140 | - apply_filters( |
|
| 141 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 142 | - esc_html__('click to hide additional ticket details', 'event_espresso') |
|
| 143 | - ) |
|
| 144 | - ), |
|
| 145 | - "hide-{$this->cssId()}", |
|
| 146 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 147 | - 'display:none;', |
|
| 148 | - 'rel="' . $this->cssId() . '"' |
|
| 149 | - ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * @return string |
|
| 155 | - * @throws EE_Error |
|
| 156 | - * @throws ReflectionException |
|
| 157 | - */ |
|
| 158 | - public function cssId(): string |
|
| 159 | - { |
|
| 160 | - return apply_filters( |
|
| 161 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 162 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 163 | - ); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * @param float|string $ticket_price |
|
| 169 | - * @param int|string $remaining |
|
| 170 | - * @param int|string $cols |
|
| 171 | - * @return string |
|
| 172 | - * @throws EE_Error |
|
| 173 | - * @throws ReflectionException |
|
| 174 | - */ |
|
| 175 | - public function display( |
|
| 176 | - $ticket_price = 0.00, |
|
| 177 | - $remaining = EE_INF, |
|
| 178 | - $cols = 2 |
|
| 179 | - ): string { |
|
| 180 | - $template_args = []; |
|
| 181 | - $template_args['ticket'] = $this->ticket; |
|
| 182 | - $template_args['ticket_price'] = $ticket_price; |
|
| 183 | - $template_args['remaining'] = $remaining; |
|
| 184 | - $template_args['cols'] = $cols; |
|
| 185 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 186 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 187 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 188 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 189 | - $template_args['display_ticket_price'] = $ticket_price !== 0 |
|
| 190 | - && apply_filters( |
|
| 191 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 192 | - true |
|
| 193 | - ); |
|
| 194 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
| 195 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 196 | - esc_html__('Price', 'event_espresso') |
|
| 197 | - ); |
|
| 198 | - $template_args['date_format'] = $this->date_format; |
|
| 199 | - $template_args['time_format'] = $this->time_format; |
|
| 200 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 201 | - |
|
| 202 | - return EEH_Template::locate_template( |
|
| 203 | - apply_filters( |
|
| 204 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 205 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 206 | - $this->ticket |
|
| 207 | - ), |
|
| 208 | - $template_args |
|
| 209 | - ); |
|
| 210 | - } |
|
| 22 | + /** |
|
| 23 | + * @var EE_Ticket $ticket |
|
| 24 | + */ |
|
| 25 | + protected $ticket; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var EE_Ticket_Selector_Config $template_settings |
|
| 29 | + */ |
|
| 30 | + protected $template_settings; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var string $date_format |
|
| 34 | + */ |
|
| 35 | + protected $date_format; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var string $time_format |
|
| 39 | + */ |
|
| 40 | + protected $time_format; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var bool $event_is_expired |
|
| 44 | + */ |
|
| 45 | + protected $event_is_expired; |
|
| 46 | + |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * TicketDetails constructor. |
|
| 50 | + * |
|
| 51 | + * @param EE_Ticket $ticket |
|
| 52 | + * @param EE_Ticket_Selector_Config $template_settings |
|
| 53 | + * @param array $template_args |
|
| 54 | + */ |
|
| 55 | + public function __construct( |
|
| 56 | + EE_Ticket $ticket, |
|
| 57 | + EE_Ticket_Selector_Config $template_settings, |
|
| 58 | + array $template_args |
|
| 59 | + ) { |
|
| 60 | + $this->ticket = $ticket; |
|
| 61 | + $this->template_settings = $template_settings; |
|
| 62 | + $this->date_format = $template_args['date_format']; |
|
| 63 | + $this->time_format = $template_args['time_format']; |
|
| 64 | + $this->event_is_expired = $template_args['event_is_expired']; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @return EE_Ticket |
|
| 70 | + */ |
|
| 71 | + public function getTicket(): EE_Ticket |
|
| 72 | + { |
|
| 73 | + return $this->ticket; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @return bool |
|
| 79 | + */ |
|
| 80 | + public function showTicketDetails(): bool |
|
| 81 | + { |
|
| 82 | + return $this->template_settings->show_ticket_details; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @return EE_Ticket_Selector_Config |
|
| 88 | + */ |
|
| 89 | + public function getTemplateSettings(): EE_Ticket_Selector_Config |
|
| 90 | + { |
|
| 91 | + return $this->template_settings; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function getDateFormat(): string |
|
| 99 | + { |
|
| 100 | + return $this->date_format; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @return string |
|
| 106 | + */ |
|
| 107 | + public function getTimeFormat(): string |
|
| 108 | + { |
|
| 109 | + return $this->time_format; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * @return string |
|
| 115 | + * @throws EE_Error |
|
| 116 | + * @throws ReflectionException |
|
| 117 | + */ |
|
| 118 | + public function getShowHideLinks(): string |
|
| 119 | + { |
|
| 120 | + if (! $this->showTicketDetails()) { |
|
| 121 | + return ''; |
|
| 122 | + } |
|
| 123 | + return EEH_HTML::link( |
|
| 124 | + '', |
|
| 125 | + sprintf(esc_html__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 126 | + esc_attr( |
|
| 127 | + apply_filters( |
|
| 128 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 129 | + esc_html__('click to show additional ticket details', 'event_espresso') |
|
| 130 | + ) |
|
| 131 | + ), |
|
| 132 | + "display-{$this->cssId()}", |
|
| 133 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 134 | + '', |
|
| 135 | + 'rel="' . $this->cssId() . '"' |
|
| 136 | + ) . EEH_HTML::link( |
|
| 137 | + '', |
|
| 138 | + sprintf(esc_html__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 139 | + esc_attr( |
|
| 140 | + apply_filters( |
|
| 141 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 142 | + esc_html__('click to hide additional ticket details', 'event_espresso') |
|
| 143 | + ) |
|
| 144 | + ), |
|
| 145 | + "hide-{$this->cssId()}", |
|
| 146 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 147 | + 'display:none;', |
|
| 148 | + 'rel="' . $this->cssId() . '"' |
|
| 149 | + ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * @return string |
|
| 155 | + * @throws EE_Error |
|
| 156 | + * @throws ReflectionException |
|
| 157 | + */ |
|
| 158 | + public function cssId(): string |
|
| 159 | + { |
|
| 160 | + return apply_filters( |
|
| 161 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 162 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * @param float|string $ticket_price |
|
| 169 | + * @param int|string $remaining |
|
| 170 | + * @param int|string $cols |
|
| 171 | + * @return string |
|
| 172 | + * @throws EE_Error |
|
| 173 | + * @throws ReflectionException |
|
| 174 | + */ |
|
| 175 | + public function display( |
|
| 176 | + $ticket_price = 0.00, |
|
| 177 | + $remaining = EE_INF, |
|
| 178 | + $cols = 2 |
|
| 179 | + ): string { |
|
| 180 | + $template_args = []; |
|
| 181 | + $template_args['ticket'] = $this->ticket; |
|
| 182 | + $template_args['ticket_price'] = $ticket_price; |
|
| 183 | + $template_args['remaining'] = $remaining; |
|
| 184 | + $template_args['cols'] = $cols; |
|
| 185 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 186 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 187 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 188 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 189 | + $template_args['display_ticket_price'] = $ticket_price !== 0 |
|
| 190 | + && apply_filters( |
|
| 191 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 192 | + true |
|
| 193 | + ); |
|
| 194 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
| 195 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 196 | + esc_html__('Price', 'event_espresso') |
|
| 197 | + ); |
|
| 198 | + $template_args['date_format'] = $this->date_format; |
|
| 199 | + $template_args['time_format'] = $this->time_format; |
|
| 200 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 201 | + |
|
| 202 | + return EEH_Template::locate_template( |
|
| 203 | + apply_filters( |
|
| 204 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 205 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 206 | + $this->ticket |
|
| 207 | + ), |
|
| 208 | + $template_args |
|
| 209 | + ); |
|
| 210 | + } |
|
| 211 | 211 | } |