@@ -239,7 +239,7 @@ |
||
| 239 | 239 | * setTicketMinAndMax |
| 240 | 240 | * |
| 241 | 241 | * @param int $remaining |
| 242 | - * @return array |
|
| 242 | + * @return integer[] |
|
| 243 | 243 | */ |
| 244 | 244 | protected function setTicketMinAndMax($remaining) |
| 245 | 245 | { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | $ticket_selector_row_html = \EEH_HTML::tr( |
| 184 | 184 | '', '', |
| 185 | - "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
| 185 | + "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} ".espresso_get_object_css_class($this->ticket) |
|
| 186 | 186 | ); |
| 187 | 187 | /** |
| 188 | 188 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $status_class |
| 207 | 207 | ); |
| 208 | 208 | if ($new_row_cells_content !== false) { |
| 209 | - return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
| 209 | + return $ticket_selector_row_html.$new_row_cells_content.\EEH_HTML::trx(); |
|
| 210 | 210 | } |
| 211 | 211 | $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
| 212 | 212 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
| 375 | 375 | $html .= \EEH_Template::format_currency($ticket_price); |
| 376 | 376 | $html .= $this->ticket->taxable() |
| 377 | - ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
| 377 | + ? \EEH_HTML::span('*', '', 'taxable-tickets-asterisk grey-text') |
|
| 378 | 378 | : ''; |
| 379 | 379 | $html .= ' '; |
| 380 | 380 | $html .= \EEH_HTML::span( |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | // display submit button since we have tickets available |
| 409 | 409 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 410 | 410 | $this->hidden_input_qty = false; |
| 411 | - $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 412 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 413 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 411 | + $html = '<input type="radio" name="tkt-slctr-qty-'.$this->EVT_ID.'"'; |
|
| 412 | + $html .= ' id="ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row.'"'; |
|
| 413 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="'.$this->row.'-1"'; |
|
| 414 | 414 | $html .= $this->row === 1 ? ' checked="checked"' : ''; |
| 415 | 415 | $html .= ' title=""/>'; |
| 416 | 416 | return $html; |
@@ -430,8 +430,8 @@ discard block |
||
| 430 | 430 | // display submit button since we have tickets available |
| 431 | 431 | add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
| 432 | 432 | $this->hidden_input_qty = false; |
| 433 | - $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 434 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 433 | + $html = '<select name="tkt-slctr-qty-'.$this->EVT_ID.'[]"'; |
|
| 434 | + $html .= ' id="ticket-selector-tbl-qty-slct-'.$this->EVT_ID.'-'.$this->row.'"'; |
|
| 435 | 435 | $html .= ' class="ticket-selector-tbl-qty-slct">'; |
| 436 | 436 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
| 437 | 437 | if ($min !== 0 && ! $this->ticket->required()) { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | // offer ticket quantities from the min to the max |
| 441 | 441 | for ($i = $min; $i <= $max; $i++) { |
| 442 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 442 | + $html .= '<option value="'.$i.'"> '.$i.' </option>'; |
|
| 443 | 443 | } |
| 444 | 444 | $html .= '</select>'; |
| 445 | 445 | return $html; |
@@ -457,10 +457,10 @@ discard block |
||
| 457 | 457 | $html = ''; |
| 458 | 458 | // depending on group reg we need to change the format for qty |
| 459 | 459 | if ($this->hidden_input_qty) { |
| 460 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 460 | + $html .= '<input type="hidden" name="tkt-slctr-qty-'.$this->EVT_ID.'[]" value="0"/>'; |
|
| 461 | 461 | } |
| 462 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 463 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 462 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-'.$this->EVT_ID.'[]"'; |
|
| 463 | + $html .= ' value="'.$this->ticket->ID().'"/>'; |
|
| 464 | 464 | return $html; |
| 465 | 465 | } |
| 466 | 466 | |
@@ -16,458 +16,458 @@ |
||
| 16 | 16 | class TicketSelectorRowStandard extends TicketSelectorRow |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var TicketDetails $ticket_details |
|
| 21 | - */ |
|
| 22 | - protected $ticket_details; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
| 26 | - */ |
|
| 27 | - protected $template_settings; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var \EE_Tax_Config $tax_settings |
|
| 31 | - */ |
|
| 32 | - protected $tax_settings; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var boolean $required_ticket_sold_out |
|
| 36 | - */ |
|
| 37 | - protected $required_ticket_sold_out; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var boolean $prices_displayed_including_taxes |
|
| 41 | - */ |
|
| 42 | - protected $prices_displayed_including_taxes; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @var string $event_status |
|
| 46 | - */ |
|
| 47 | - protected $event_status; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @var int $row |
|
| 51 | - */ |
|
| 52 | - protected $row; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @var int $cols |
|
| 56 | - */ |
|
| 57 | - protected $cols; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @var boolean $hidden_input_qty |
|
| 61 | - */ |
|
| 62 | - protected $hidden_input_qty; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @var string $ticket_datetime_classes |
|
| 66 | - */ |
|
| 67 | - protected $ticket_datetime_classes; |
|
| 68 | - |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * TicketDetails constructor. |
|
| 73 | - * |
|
| 74 | - * @param \EE_Ticket $ticket |
|
| 75 | - * @param TicketDetails $ticket_details |
|
| 76 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
| 77 | - * @param \EE_Tax_Config $tax_settings |
|
| 78 | - * @param int $max_atndz |
|
| 79 | - * @param int $row |
|
| 80 | - * @param int $cols |
|
| 81 | - * @param boolean $required_ticket_sold_out |
|
| 82 | - * @param string $event_status |
|
| 83 | - * @param string $date_format |
|
| 84 | - * @param string $ticket_datetime_classes |
|
| 85 | - */ |
|
| 86 | - public function __construct( |
|
| 87 | - \EE_Ticket $ticket, |
|
| 88 | - TicketDetails $ticket_details, |
|
| 89 | - \EE_Ticket_Selector_Config $template_settings, |
|
| 90 | - \EE_Tax_Config $tax_settings, |
|
| 91 | - $max_atndz, |
|
| 92 | - $row, |
|
| 93 | - $cols, |
|
| 94 | - $required_ticket_sold_out, |
|
| 95 | - $event_status, |
|
| 96 | - $date_format, |
|
| 97 | - $ticket_datetime_classes |
|
| 98 | - ) { |
|
| 99 | - $this->ticket = $ticket; |
|
| 100 | - $this->ticket_details = $ticket_details; |
|
| 101 | - $this->template_settings = $template_settings; |
|
| 102 | - $this->tax_settings = $tax_settings; |
|
| 103 | - $this->max_atndz = $max_atndz; |
|
| 104 | - $this->row = $row; |
|
| 105 | - $this->cols = $cols; |
|
| 106 | - $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
| 107 | - $this->event_status = $event_status; |
|
| 108 | - $this->date_format = $date_format; |
|
| 109 | - $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
| 110 | - parent::__construct($ticket, $max_atndz, $date_format); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * other ticket rows will need to know if a required ticket is sold out, |
|
| 117 | - * so that they are not offered for sale |
|
| 118 | - * |
|
| 119 | - * @return boolean |
|
| 120 | - */ |
|
| 121 | - public function getRequiredTicketSoldOut() |
|
| 122 | - { |
|
| 123 | - return $this->required_ticket_sold_out; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * @return int |
|
| 130 | - */ |
|
| 131 | - public function getCols() |
|
| 132 | - { |
|
| 133 | - return $this->cols; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * getHtml |
|
| 140 | - * |
|
| 141 | - * @return string |
|
| 142 | - * @throws \EE_Error |
|
| 143 | - */ |
|
| 144 | - public function getHtml() |
|
| 145 | - { |
|
| 146 | - $min = 0; |
|
| 147 | - $max = $this->ticket->max(); |
|
| 148 | - $remaining = $this->ticket->remaining(); |
|
| 149 | - if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) { |
|
| 150 | - list($min, $max) = $this->setTicketMinAndMax($remaining); |
|
| 151 | - } else { |
|
| 152 | - // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
| 153 | - $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
| 154 | - ? $this->ticket->start_date() |
|
| 155 | - : $this->required_ticket_sold_out; |
|
| 156 | - } |
|
| 157 | - list($ticket_price, $ticket_bundle) = $this->getTicketPriceDetails(); |
|
| 158 | - list($tkt_status, $ticket_status, $status_class) = $this->getTicketStatusClasses($remaining); |
|
| 159 | - /** |
|
| 160 | - * Allow plugins to hook in and abort the generation and display of this row to do |
|
| 161 | - * something else if they want. |
|
| 162 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 163 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 164 | - * current row. |
|
| 165 | - * |
|
| 166 | - * @var string|bool |
|
| 167 | - */ |
|
| 168 | - $ticket_selector_row_html = apply_filters( |
|
| 169 | - 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
| 170 | - false, |
|
| 171 | - $this->ticket, |
|
| 172 | - $max, |
|
| 173 | - $min, |
|
| 174 | - $this->required_ticket_sold_out, |
|
| 175 | - $ticket_price, |
|
| 176 | - $ticket_bundle, |
|
| 177 | - $ticket_status, |
|
| 178 | - $status_class |
|
| 179 | - ); |
|
| 180 | - if ($ticket_selector_row_html !== false) { |
|
| 181 | - return $ticket_selector_row_html; |
|
| 182 | - } |
|
| 183 | - $ticket_selector_row_html = \EEH_HTML::tr( |
|
| 184 | - '', '', |
|
| 185 | - "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
| 186 | - ); |
|
| 187 | - /** |
|
| 188 | - * Allow plugins to hook in and abort the generation and display of the contents of this |
|
| 189 | - * row to do something else if they want. |
|
| 190 | - * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 191 | - * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 192 | - * current row. |
|
| 193 | - * |
|
| 194 | - * @var string|bool |
|
| 195 | - */ |
|
| 196 | - $new_row_cells_content = apply_filters( |
|
| 197 | - 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
| 198 | - false, |
|
| 199 | - $this->ticket, |
|
| 200 | - $max, |
|
| 201 | - $min, |
|
| 202 | - $this->required_ticket_sold_out, |
|
| 203 | - $ticket_price, |
|
| 204 | - $ticket_bundle, |
|
| 205 | - $ticket_status, |
|
| 206 | - $status_class |
|
| 207 | - ); |
|
| 208 | - if ($new_row_cells_content !== false) { |
|
| 209 | - return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
| 210 | - } |
|
| 211 | - $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
|
| 212 | - |
|
| 213 | - $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
| 214 | - $ticket_selector_row_html .= $this->ticketPriceTableCell($ticket_price, $ticket_bundle); |
|
| 215 | - $ticket_selector_row_html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-qty cntr'); |
|
| 216 | - $this->setTicketStatusDisplay($tkt_status, $ticket_status, $remaining); |
|
| 217 | - if (empty($this->ticket_status_display)) { |
|
| 218 | - if ($this->max_atndz === 1) { |
|
| 219 | - // only ONE attendee is allowed to register at a time |
|
| 220 | - $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
| 221 | - } else if ($max > 0) { |
|
| 222 | - $ticket_selector_row_html .= $this->ticketQuantitySelector($min, $max); |
|
| 223 | - } |
|
| 224 | - } |
|
| 225 | - $ticket_selector_row_html .= $this->ticket_status_display; |
|
| 226 | - $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
| 227 | - $ticket_selector_row_html .= $this->ticket_details->display($ticket_price, $remaining, $this->cols); |
|
| 228 | - $ticket_selector_row_html .= \EEH_HTML::tdx(); |
|
| 229 | - $ticket_selector_row_html .= \EEH_HTML::trx(); |
|
| 230 | - |
|
| 231 | - |
|
| 232 | - $this->row++; |
|
| 233 | - return $ticket_selector_row_html; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * setTicketMinAndMax |
|
| 240 | - * |
|
| 241 | - * @param int $remaining |
|
| 242 | - * @return array |
|
| 243 | - */ |
|
| 244 | - protected function setTicketMinAndMax($remaining) |
|
| 245 | - { |
|
| 246 | - // offer the number of $tickets_remaining or $this->max_atndz, whichever is smaller |
|
| 247 | - $max = min($remaining, $this->max_atndz); |
|
| 248 | - // but... we also want to restrict the number of tickets by the ticket max setting, |
|
| 249 | - // however, the max still can't be higher than what was just set above |
|
| 250 | - $max = $this->ticket->max() > 0 ? min($this->ticket->max(), $max) : $max; |
|
| 251 | - // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
| 252 | - $min = $this->ticket->min() > 0 ? $this->ticket->min() : 0; |
|
| 253 | - // and if the ticket is required, then make sure that min qty is at least 1 |
|
| 254 | - $min = $this->ticket->required() ? max($min, 1) : $min; |
|
| 255 | - return array($min, $max); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * getTicketPriceDetails |
|
| 261 | - * |
|
| 262 | - * @return array |
|
| 263 | - */ |
|
| 264 | - protected function getTicketPriceDetails() |
|
| 265 | - { |
|
| 266 | - $ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
| 267 | - ? $this->ticket->get_ticket_total_with_taxes() |
|
| 268 | - : $this->ticket->get_ticket_subtotal(); |
|
| 269 | - $ticket_bundle = false; |
|
| 270 | - $ticket_min = $this->ticket->min(); |
|
| 271 | - // for ticket bundles, set min and max qty the same |
|
| 272 | - if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
| 273 | - $ticket_price *= $ticket_min; |
|
| 274 | - $ticket_bundle = true; |
|
| 275 | - } |
|
| 276 | - $ticket_price = apply_filters( |
|
| 277 | - 'FHEE__ticket_selector_chart_template__ticket_price', |
|
| 278 | - $ticket_price, |
|
| 279 | - $this->ticket |
|
| 280 | - ); |
|
| 281 | - return array($ticket_price, $ticket_bundle); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * getTicketStatusClasses |
|
| 288 | - * |
|
| 289 | - * @param int $remaining |
|
| 290 | - * @return array |
|
| 291 | - * @throws \EE_Error |
|
| 292 | - */ |
|
| 293 | - protected function getTicketStatusClasses($remaining = 0) |
|
| 294 | - { |
|
| 295 | - // if a previous required ticket with the same sale start date is sold out, |
|
| 296 | - // then mark this ticket as sold out as well. |
|
| 297 | - // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
| 298 | - $tkt_status = $this->required_ticket_sold_out !== false |
|
| 299 | - && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
| 300 | - ? \EE_Ticket::sold_out |
|
| 301 | - : $this->ticket->ticket_status(); |
|
| 302 | - $tkt_status = $this->event_status === \EE_Datetime::sold_out |
|
| 303 | - ? \EE_Ticket::sold_out |
|
| 304 | - : $tkt_status; |
|
| 305 | - // check ticket status |
|
| 306 | - switch ($tkt_status) { |
|
| 307 | - // sold_out |
|
| 308 | - case \EE_Ticket::sold_out : |
|
| 309 | - $ticket_status = 'ticket-sales-sold-out'; |
|
| 310 | - $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 311 | - break; |
|
| 312 | - // expired |
|
| 313 | - case \EE_Ticket::expired : |
|
| 314 | - $ticket_status = 'ticket-sales-expired'; |
|
| 315 | - $status_class = 'ticket-sales-expired lt-grey-text'; |
|
| 316 | - break; |
|
| 317 | - // archived |
|
| 318 | - case \EE_Ticket::archived : |
|
| 319 | - $ticket_status = 'archived-ticket'; |
|
| 320 | - $status_class = 'archived-ticket hidden'; |
|
| 321 | - break; |
|
| 322 | - // pending |
|
| 323 | - case \EE_Ticket::pending : |
|
| 324 | - $ticket_status = 'ticket-pending'; |
|
| 325 | - $status_class = 'ticket-pending'; |
|
| 326 | - break; |
|
| 327 | - // onsale |
|
| 328 | - case \EE_Ticket::onsale : |
|
| 329 | - default : |
|
| 330 | - $ticket_status = 'ticket-on-sale'; |
|
| 331 | - $status_class = 'ticket-on-sale'; |
|
| 332 | - break; |
|
| 333 | - } |
|
| 334 | - $ticket_status = \EEH_HTML::span($this->ticket->ticket_status(true, ($remaining > 0)), '', $ticket_status); |
|
| 335 | - return array($tkt_status, $ticket_status, $status_class); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * ticketNameTableCell |
|
| 342 | - * |
|
| 343 | - * @return string |
|
| 344 | - * @throws \EE_Error |
|
| 345 | - */ |
|
| 346 | - protected function ticketNameTableCell() |
|
| 347 | - { |
|
| 348 | - $html = \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-name'); |
|
| 349 | - $html .= \EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
| 350 | - $html .= $this->ticket_details->getShowHideLinks(); |
|
| 351 | - if ($this->ticket->required()) { |
|
| 352 | - $html .= \EEH_HTML::p( |
|
| 353 | - apply_filters( |
|
| 354 | - 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
| 355 | - esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
| 356 | - ), |
|
| 357 | - '', 'ticket-required-pg' |
|
| 358 | - ); |
|
| 359 | - } |
|
| 360 | - $html .= \EEH_HTML::tdx(); |
|
| 361 | - return $html; |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * ticketPriceTableCell |
|
| 368 | - * |
|
| 369 | - * @param float $ticket_price |
|
| 370 | - * @param bool $ticket_bundle |
|
| 371 | - * @return string |
|
| 372 | - * @throws \EE_Error |
|
| 373 | - */ |
|
| 374 | - protected function ticketPriceTableCell($ticket_price, $ticket_bundle) |
|
| 375 | - { |
|
| 376 | - $html = ''; |
|
| 377 | - if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
| 378 | - $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
|
| 379 | - $html .= \EEH_Template::format_currency($ticket_price); |
|
| 380 | - $html .= $this->ticket->taxable() |
|
| 381 | - ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
| 382 | - : ''; |
|
| 383 | - $html .= ' '; |
|
| 384 | - $html .= \EEH_HTML::span( |
|
| 385 | - $ticket_bundle |
|
| 386 | - ? apply_filters( |
|
| 387 | - 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
| 388 | - __(' / bundle', 'event_espresso') |
|
| 389 | - ) |
|
| 390 | - : apply_filters( |
|
| 391 | - 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
| 392 | - __('', 'event_espresso') |
|
| 393 | - ), |
|
| 394 | - '', 'smaller-text no-bold' |
|
| 395 | - ); |
|
| 396 | - $html .= ' '; |
|
| 397 | - $html .= \EEH_HTML::tdx(); |
|
| 398 | - $this->cols++; |
|
| 399 | - } |
|
| 400 | - return $html; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * onlyOneAttendeeCanRegister |
|
| 407 | - * |
|
| 408 | - * @return string |
|
| 409 | - */ |
|
| 410 | - protected function onlyOneAttendeeCanRegister() |
|
| 411 | - { |
|
| 412 | - // display submit button since we have tickets available |
|
| 413 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 414 | - $this->hidden_input_qty = false; |
|
| 415 | - $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 416 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 417 | - $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 418 | - $html .= $this->row === 1 ? ' checked="checked"' : ''; |
|
| 419 | - $html .= ' title=""/>'; |
|
| 420 | - return $html; |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * ticketQuantitySelector |
|
| 427 | - * |
|
| 428 | - * @param int $min |
|
| 429 | - * @param int $max |
|
| 430 | - * @return string |
|
| 431 | - */ |
|
| 432 | - protected function ticketQuantitySelector($min = 0, $max = 0) |
|
| 433 | - { |
|
| 434 | - // display submit button since we have tickets available |
|
| 435 | - add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 436 | - $this->hidden_input_qty = false; |
|
| 437 | - $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 438 | - $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 439 | - $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
| 440 | - // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
| 441 | - if ($min !== 0 && ! $this->ticket->required()) { |
|
| 442 | - $html .= '<option value="0"> 0 </option>'; |
|
| 443 | - } |
|
| 444 | - // offer ticket quantities from the min to the max |
|
| 445 | - for ($i = $min; $i <= $max; $i++) { |
|
| 446 | - $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 447 | - } |
|
| 448 | - $html .= '</select>'; |
|
| 449 | - return $html; |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - |
|
| 453 | - |
|
| 454 | - /** |
|
| 455 | - * getHiddenInputs |
|
| 456 | - * |
|
| 457 | - * @return string |
|
| 458 | - * @throws \EE_Error |
|
| 459 | - */ |
|
| 460 | - protected function ticketQtyAndIdHiddenInputs() |
|
| 461 | - { |
|
| 462 | - $html = ''; |
|
| 463 | - // depending on group reg we need to change the format for qty |
|
| 464 | - if ($this->hidden_input_qty) { |
|
| 465 | - $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 466 | - } |
|
| 467 | - $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 468 | - $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 469 | - return $html; |
|
| 470 | - } |
|
| 19 | + /** |
|
| 20 | + * @var TicketDetails $ticket_details |
|
| 21 | + */ |
|
| 22 | + protected $ticket_details; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
| 26 | + */ |
|
| 27 | + protected $template_settings; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var \EE_Tax_Config $tax_settings |
|
| 31 | + */ |
|
| 32 | + protected $tax_settings; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var boolean $required_ticket_sold_out |
|
| 36 | + */ |
|
| 37 | + protected $required_ticket_sold_out; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var boolean $prices_displayed_including_taxes |
|
| 41 | + */ |
|
| 42 | + protected $prices_displayed_including_taxes; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @var string $event_status |
|
| 46 | + */ |
|
| 47 | + protected $event_status; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @var int $row |
|
| 51 | + */ |
|
| 52 | + protected $row; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @var int $cols |
|
| 56 | + */ |
|
| 57 | + protected $cols; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @var boolean $hidden_input_qty |
|
| 61 | + */ |
|
| 62 | + protected $hidden_input_qty; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @var string $ticket_datetime_classes |
|
| 66 | + */ |
|
| 67 | + protected $ticket_datetime_classes; |
|
| 68 | + |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * TicketDetails constructor. |
|
| 73 | + * |
|
| 74 | + * @param \EE_Ticket $ticket |
|
| 75 | + * @param TicketDetails $ticket_details |
|
| 76 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
| 77 | + * @param \EE_Tax_Config $tax_settings |
|
| 78 | + * @param int $max_atndz |
|
| 79 | + * @param int $row |
|
| 80 | + * @param int $cols |
|
| 81 | + * @param boolean $required_ticket_sold_out |
|
| 82 | + * @param string $event_status |
|
| 83 | + * @param string $date_format |
|
| 84 | + * @param string $ticket_datetime_classes |
|
| 85 | + */ |
|
| 86 | + public function __construct( |
|
| 87 | + \EE_Ticket $ticket, |
|
| 88 | + TicketDetails $ticket_details, |
|
| 89 | + \EE_Ticket_Selector_Config $template_settings, |
|
| 90 | + \EE_Tax_Config $tax_settings, |
|
| 91 | + $max_atndz, |
|
| 92 | + $row, |
|
| 93 | + $cols, |
|
| 94 | + $required_ticket_sold_out, |
|
| 95 | + $event_status, |
|
| 96 | + $date_format, |
|
| 97 | + $ticket_datetime_classes |
|
| 98 | + ) { |
|
| 99 | + $this->ticket = $ticket; |
|
| 100 | + $this->ticket_details = $ticket_details; |
|
| 101 | + $this->template_settings = $template_settings; |
|
| 102 | + $this->tax_settings = $tax_settings; |
|
| 103 | + $this->max_atndz = $max_atndz; |
|
| 104 | + $this->row = $row; |
|
| 105 | + $this->cols = $cols; |
|
| 106 | + $this->required_ticket_sold_out = $required_ticket_sold_out; |
|
| 107 | + $this->event_status = $event_status; |
|
| 108 | + $this->date_format = $date_format; |
|
| 109 | + $this->ticket_datetime_classes = $ticket_datetime_classes; |
|
| 110 | + parent::__construct($ticket, $max_atndz, $date_format); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * other ticket rows will need to know if a required ticket is sold out, |
|
| 117 | + * so that they are not offered for sale |
|
| 118 | + * |
|
| 119 | + * @return boolean |
|
| 120 | + */ |
|
| 121 | + public function getRequiredTicketSoldOut() |
|
| 122 | + { |
|
| 123 | + return $this->required_ticket_sold_out; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * @return int |
|
| 130 | + */ |
|
| 131 | + public function getCols() |
|
| 132 | + { |
|
| 133 | + return $this->cols; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * getHtml |
|
| 140 | + * |
|
| 141 | + * @return string |
|
| 142 | + * @throws \EE_Error |
|
| 143 | + */ |
|
| 144 | + public function getHtml() |
|
| 145 | + { |
|
| 146 | + $min = 0; |
|
| 147 | + $max = $this->ticket->max(); |
|
| 148 | + $remaining = $this->ticket->remaining(); |
|
| 149 | + if ($this->ticket->is_on_sale() && $this->ticket->is_remaining()) { |
|
| 150 | + list($min, $max) = $this->setTicketMinAndMax($remaining); |
|
| 151 | + } else { |
|
| 152 | + // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
|
| 153 | + $this->required_ticket_sold_out = $this->ticket->required() && ! $remaining |
|
| 154 | + ? $this->ticket->start_date() |
|
| 155 | + : $this->required_ticket_sold_out; |
|
| 156 | + } |
|
| 157 | + list($ticket_price, $ticket_bundle) = $this->getTicketPriceDetails(); |
|
| 158 | + list($tkt_status, $ticket_status, $status_class) = $this->getTicketStatusClasses($remaining); |
|
| 159 | + /** |
|
| 160 | + * Allow plugins to hook in and abort the generation and display of this row to do |
|
| 161 | + * something else if they want. |
|
| 162 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 163 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 164 | + * current row. |
|
| 165 | + * |
|
| 166 | + * @var string|bool |
|
| 167 | + */ |
|
| 168 | + $ticket_selector_row_html = apply_filters( |
|
| 169 | + 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', |
|
| 170 | + false, |
|
| 171 | + $this->ticket, |
|
| 172 | + $max, |
|
| 173 | + $min, |
|
| 174 | + $this->required_ticket_sold_out, |
|
| 175 | + $ticket_price, |
|
| 176 | + $ticket_bundle, |
|
| 177 | + $ticket_status, |
|
| 178 | + $status_class |
|
| 179 | + ); |
|
| 180 | + if ($ticket_selector_row_html !== false) { |
|
| 181 | + return $ticket_selector_row_html; |
|
| 182 | + } |
|
| 183 | + $ticket_selector_row_html = \EEH_HTML::tr( |
|
| 184 | + '', '', |
|
| 185 | + "tckt-slctr-tbl-tr {$status_class}{$this->ticket_datetime_classes} " . espresso_get_object_css_class($this->ticket) |
|
| 186 | + ); |
|
| 187 | + /** |
|
| 188 | + * Allow plugins to hook in and abort the generation and display of the contents of this |
|
| 189 | + * row to do something else if they want. |
|
| 190 | + * For an addon to abort things, all they have to do is register a filter with this hook, and |
|
| 191 | + * return a value that is NOT false. Whatever is returned gets echoed instead of the |
|
| 192 | + * current row. |
|
| 193 | + * |
|
| 194 | + * @var string|bool |
|
| 195 | + */ |
|
| 196 | + $new_row_cells_content = apply_filters( |
|
| 197 | + 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', |
|
| 198 | + false, |
|
| 199 | + $this->ticket, |
|
| 200 | + $max, |
|
| 201 | + $min, |
|
| 202 | + $this->required_ticket_sold_out, |
|
| 203 | + $ticket_price, |
|
| 204 | + $ticket_bundle, |
|
| 205 | + $ticket_status, |
|
| 206 | + $status_class |
|
| 207 | + ); |
|
| 208 | + if ($new_row_cells_content !== false) { |
|
| 209 | + return $ticket_selector_row_html . $new_row_cells_content . \EEH_HTML::trx(); |
|
| 210 | + } |
|
| 211 | + $this->hidden_input_qty = $this->max_atndz > 1 ? true : false; |
|
| 212 | + |
|
| 213 | + $ticket_selector_row_html .= $this->ticketNameTableCell(); |
|
| 214 | + $ticket_selector_row_html .= $this->ticketPriceTableCell($ticket_price, $ticket_bundle); |
|
| 215 | + $ticket_selector_row_html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-qty cntr'); |
|
| 216 | + $this->setTicketStatusDisplay($tkt_status, $ticket_status, $remaining); |
|
| 217 | + if (empty($this->ticket_status_display)) { |
|
| 218 | + if ($this->max_atndz === 1) { |
|
| 219 | + // only ONE attendee is allowed to register at a time |
|
| 220 | + $ticket_selector_row_html .= $this->onlyOneAttendeeCanRegister(); |
|
| 221 | + } else if ($max > 0) { |
|
| 222 | + $ticket_selector_row_html .= $this->ticketQuantitySelector($min, $max); |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | + $ticket_selector_row_html .= $this->ticket_status_display; |
|
| 226 | + $ticket_selector_row_html .= $this->ticketQtyAndIdHiddenInputs(); |
|
| 227 | + $ticket_selector_row_html .= $this->ticket_details->display($ticket_price, $remaining, $this->cols); |
|
| 228 | + $ticket_selector_row_html .= \EEH_HTML::tdx(); |
|
| 229 | + $ticket_selector_row_html .= \EEH_HTML::trx(); |
|
| 230 | + |
|
| 231 | + |
|
| 232 | + $this->row++; |
|
| 233 | + return $ticket_selector_row_html; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * setTicketMinAndMax |
|
| 240 | + * |
|
| 241 | + * @param int $remaining |
|
| 242 | + * @return array |
|
| 243 | + */ |
|
| 244 | + protected function setTicketMinAndMax($remaining) |
|
| 245 | + { |
|
| 246 | + // offer the number of $tickets_remaining or $this->max_atndz, whichever is smaller |
|
| 247 | + $max = min($remaining, $this->max_atndz); |
|
| 248 | + // but... we also want to restrict the number of tickets by the ticket max setting, |
|
| 249 | + // however, the max still can't be higher than what was just set above |
|
| 250 | + $max = $this->ticket->max() > 0 ? min($this->ticket->max(), $max) : $max; |
|
| 251 | + // and we also want to restrict the minimum number of tickets by the ticket min setting |
|
| 252 | + $min = $this->ticket->min() > 0 ? $this->ticket->min() : 0; |
|
| 253 | + // and if the ticket is required, then make sure that min qty is at least 1 |
|
| 254 | + $min = $this->ticket->required() ? max($min, 1) : $min; |
|
| 255 | + return array($min, $max); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * getTicketPriceDetails |
|
| 261 | + * |
|
| 262 | + * @return array |
|
| 263 | + */ |
|
| 264 | + protected function getTicketPriceDetails() |
|
| 265 | + { |
|
| 266 | + $ticket_price = $this->tax_settings->prices_displayed_including_taxes |
|
| 267 | + ? $this->ticket->get_ticket_total_with_taxes() |
|
| 268 | + : $this->ticket->get_ticket_subtotal(); |
|
| 269 | + $ticket_bundle = false; |
|
| 270 | + $ticket_min = $this->ticket->min(); |
|
| 271 | + // for ticket bundles, set min and max qty the same |
|
| 272 | + if ($ticket_min !== 0 && $ticket_min === $this->ticket->max()) { |
|
| 273 | + $ticket_price *= $ticket_min; |
|
| 274 | + $ticket_bundle = true; |
|
| 275 | + } |
|
| 276 | + $ticket_price = apply_filters( |
|
| 277 | + 'FHEE__ticket_selector_chart_template__ticket_price', |
|
| 278 | + $ticket_price, |
|
| 279 | + $this->ticket |
|
| 280 | + ); |
|
| 281 | + return array($ticket_price, $ticket_bundle); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * getTicketStatusClasses |
|
| 288 | + * |
|
| 289 | + * @param int $remaining |
|
| 290 | + * @return array |
|
| 291 | + * @throws \EE_Error |
|
| 292 | + */ |
|
| 293 | + protected function getTicketStatusClasses($remaining = 0) |
|
| 294 | + { |
|
| 295 | + // if a previous required ticket with the same sale start date is sold out, |
|
| 296 | + // then mark this ticket as sold out as well. |
|
| 297 | + // tickets that go on sale at a later date than the required ticket will NOT be affected |
|
| 298 | + $tkt_status = $this->required_ticket_sold_out !== false |
|
| 299 | + && $this->required_ticket_sold_out === $this->ticket->start_date() |
|
| 300 | + ? \EE_Ticket::sold_out |
|
| 301 | + : $this->ticket->ticket_status(); |
|
| 302 | + $tkt_status = $this->event_status === \EE_Datetime::sold_out |
|
| 303 | + ? \EE_Ticket::sold_out |
|
| 304 | + : $tkt_status; |
|
| 305 | + // check ticket status |
|
| 306 | + switch ($tkt_status) { |
|
| 307 | + // sold_out |
|
| 308 | + case \EE_Ticket::sold_out : |
|
| 309 | + $ticket_status = 'ticket-sales-sold-out'; |
|
| 310 | + $status_class = 'ticket-sales-sold-out lt-grey-text'; |
|
| 311 | + break; |
|
| 312 | + // expired |
|
| 313 | + case \EE_Ticket::expired : |
|
| 314 | + $ticket_status = 'ticket-sales-expired'; |
|
| 315 | + $status_class = 'ticket-sales-expired lt-grey-text'; |
|
| 316 | + break; |
|
| 317 | + // archived |
|
| 318 | + case \EE_Ticket::archived : |
|
| 319 | + $ticket_status = 'archived-ticket'; |
|
| 320 | + $status_class = 'archived-ticket hidden'; |
|
| 321 | + break; |
|
| 322 | + // pending |
|
| 323 | + case \EE_Ticket::pending : |
|
| 324 | + $ticket_status = 'ticket-pending'; |
|
| 325 | + $status_class = 'ticket-pending'; |
|
| 326 | + break; |
|
| 327 | + // onsale |
|
| 328 | + case \EE_Ticket::onsale : |
|
| 329 | + default : |
|
| 330 | + $ticket_status = 'ticket-on-sale'; |
|
| 331 | + $status_class = 'ticket-on-sale'; |
|
| 332 | + break; |
|
| 333 | + } |
|
| 334 | + $ticket_status = \EEH_HTML::span($this->ticket->ticket_status(true, ($remaining > 0)), '', $ticket_status); |
|
| 335 | + return array($tkt_status, $ticket_status, $status_class); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * ticketNameTableCell |
|
| 342 | + * |
|
| 343 | + * @return string |
|
| 344 | + * @throws \EE_Error |
|
| 345 | + */ |
|
| 346 | + protected function ticketNameTableCell() |
|
| 347 | + { |
|
| 348 | + $html = \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-name'); |
|
| 349 | + $html .= \EEH_HTML::strong($this->ticket->get_pretty('TKT_name')); |
|
| 350 | + $html .= $this->ticket_details->getShowHideLinks(); |
|
| 351 | + if ($this->ticket->required()) { |
|
| 352 | + $html .= \EEH_HTML::p( |
|
| 353 | + apply_filters( |
|
| 354 | + 'FHEE__ticket_selector_chart_template__ticket_required_message', |
|
| 355 | + esc_html__('This ticket is required and must be purchased.', 'event_espresso') |
|
| 356 | + ), |
|
| 357 | + '', 'ticket-required-pg' |
|
| 358 | + ); |
|
| 359 | + } |
|
| 360 | + $html .= \EEH_HTML::tdx(); |
|
| 361 | + return $html; |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * ticketPriceTableCell |
|
| 368 | + * |
|
| 369 | + * @param float $ticket_price |
|
| 370 | + * @param bool $ticket_bundle |
|
| 371 | + * @return string |
|
| 372 | + * @throws \EE_Error |
|
| 373 | + */ |
|
| 374 | + protected function ticketPriceTableCell($ticket_price, $ticket_bundle) |
|
| 375 | + { |
|
| 376 | + $html = ''; |
|
| 377 | + if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
| 378 | + $html .= \EEH_HTML::td('', '', 'tckt-slctr-tbl-td-price jst-rght'); |
|
| 379 | + $html .= \EEH_Template::format_currency($ticket_price); |
|
| 380 | + $html .= $this->ticket->taxable() |
|
| 381 | + ? \EEH_HTML::span( '*', '', 'taxable-tickets-asterisk grey-text' ) |
|
| 382 | + : ''; |
|
| 383 | + $html .= ' '; |
|
| 384 | + $html .= \EEH_HTML::span( |
|
| 385 | + $ticket_bundle |
|
| 386 | + ? apply_filters( |
|
| 387 | + 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', |
|
| 388 | + __(' / bundle', 'event_espresso') |
|
| 389 | + ) |
|
| 390 | + : apply_filters( |
|
| 391 | + 'FHEE__ticket_selector_chart_template__per_ticket_text', |
|
| 392 | + __('', 'event_espresso') |
|
| 393 | + ), |
|
| 394 | + '', 'smaller-text no-bold' |
|
| 395 | + ); |
|
| 396 | + $html .= ' '; |
|
| 397 | + $html .= \EEH_HTML::tdx(); |
|
| 398 | + $this->cols++; |
|
| 399 | + } |
|
| 400 | + return $html; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * onlyOneAttendeeCanRegister |
|
| 407 | + * |
|
| 408 | + * @return string |
|
| 409 | + */ |
|
| 410 | + protected function onlyOneAttendeeCanRegister() |
|
| 411 | + { |
|
| 412 | + // display submit button since we have tickets available |
|
| 413 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 414 | + $this->hidden_input_qty = false; |
|
| 415 | + $html = '<input type="radio" name="tkt-slctr-qty-' . $this->EVT_ID . '"'; |
|
| 416 | + $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 417 | + $html .= ' class="ticket-selector-tbl-qty-slct" value="' . $this->row . '-1"'; |
|
| 418 | + $html .= $this->row === 1 ? ' checked="checked"' : ''; |
|
| 419 | + $html .= ' title=""/>'; |
|
| 420 | + return $html; |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * ticketQuantitySelector |
|
| 427 | + * |
|
| 428 | + * @param int $min |
|
| 429 | + * @param int $max |
|
| 430 | + * @return string |
|
| 431 | + */ |
|
| 432 | + protected function ticketQuantitySelector($min = 0, $max = 0) |
|
| 433 | + { |
|
| 434 | + // display submit button since we have tickets available |
|
| 435 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
| 436 | + $this->hidden_input_qty = false; |
|
| 437 | + $html = '<select name="tkt-slctr-qty-' . $this->EVT_ID . '[]"'; |
|
| 438 | + $html .= ' id="ticket-selector-tbl-qty-slct-' . $this->EVT_ID . '-' . $this->row . '"'; |
|
| 439 | + $html .= ' class="ticket-selector-tbl-qty-slct">'; |
|
| 440 | + // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
|
| 441 | + if ($min !== 0 && ! $this->ticket->required()) { |
|
| 442 | + $html .= '<option value="0"> 0 </option>'; |
|
| 443 | + } |
|
| 444 | + // offer ticket quantities from the min to the max |
|
| 445 | + for ($i = $min; $i <= $max; $i++) { |
|
| 446 | + $html .= '<option value="' . $i . '"> ' . $i . ' </option>'; |
|
| 447 | + } |
|
| 448 | + $html .= '</select>'; |
|
| 449 | + return $html; |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + |
|
| 453 | + |
|
| 454 | + /** |
|
| 455 | + * getHiddenInputs |
|
| 456 | + * |
|
| 457 | + * @return string |
|
| 458 | + * @throws \EE_Error |
|
| 459 | + */ |
|
| 460 | + protected function ticketQtyAndIdHiddenInputs() |
|
| 461 | + { |
|
| 462 | + $html = ''; |
|
| 463 | + // depending on group reg we need to change the format for qty |
|
| 464 | + if ($this->hidden_input_qty) { |
|
| 465 | + $html .= '<input type="hidden" name="tkt-slctr-qty-' . $this->EVT_ID . '[]" value="0"/>'; |
|
| 466 | + } |
|
| 467 | + $html .= '<input type="hidden" name="tkt-slctr-ticket-id-' . $this->EVT_ID . '[]"'; |
|
| 468 | + $html .= ' value="' . $this->ticket->ID() . '"/>'; |
|
| 469 | + return $html; |
|
| 470 | + } |
|
| 471 | 471 | |
| 472 | 472 | } |
| 473 | 473 | // End of file TicketSelectorRowStandard.php |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public static function instance() { |
| 43 | 43 | // check if class object is instantiated, and instantiated properly |
| 44 | - if ( ! self::$_instance instanceof EEH_HTML ) { |
|
| 44 | + if ( ! self::$_instance instanceof EEH_HTML) { |
|
| 45 | 45 | self::$_instance = new EEH_HTML(); |
| 46 | 46 | } |
| 47 | 47 | return self::$_instance; |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | $other_attributes = '', |
| 103 | 103 | $force_close = false |
| 104 | 104 | ) { |
| 105 | - $attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 106 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 107 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 108 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 109 | - $html = EEH_HTML::nl( 0, $tag ) . '<' . $tag . $attributes . '>'; |
|
| 110 | - $html .= ! empty( $content ) ? EEH_HTML::nl( 1, $tag ) . $content : ''; |
|
| 111 | - $indent = ! empty( $content ) || $force_close ? TRUE : FALSE; |
|
| 112 | - $html .= ! empty( $content ) || $force_close ? EEH_HTML::_close_tag( $tag, $id, $class, $indent ) : ''; |
|
| 105 | + $attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 106 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 107 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 108 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 109 | + $html = EEH_HTML::nl(0, $tag).'<'.$tag.$attributes.'>'; |
|
| 110 | + $html .= ! empty($content) ? EEH_HTML::nl(1, $tag).$content : ''; |
|
| 111 | + $indent = ! empty($content) || $force_close ? TRUE : FALSE; |
|
| 112 | + $html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : ''; |
|
| 113 | 113 | return $html; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | * @param bool $indent |
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | - protected static function _close_tag( $tag = 'div', $id = '', $class = '', $indent = TRUE ) { |
|
| 129 | + protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = TRUE) { |
|
| 130 | 130 | $comment = ''; |
| 131 | - if ( $id ) { |
|
| 132 | - $comment = EEH_HTML::comment( 'close ' . $id ) . EEH_HTML::nl( 0, $tag ); |
|
| 133 | - } else if ( $class ) { |
|
| 134 | - $comment = EEH_HTML::comment( 'close ' . $class ) . EEH_HTML::nl( 0, $tag ); |
|
| 131 | + if ($id) { |
|
| 132 | + $comment = EEH_HTML::comment('close '.$id).EEH_HTML::nl(0, $tag); |
|
| 133 | + } else if ($class) { |
|
| 134 | + $comment = EEH_HTML::comment('close '.$class).EEH_HTML::nl(0, $tag); |
|
| 135 | 135 | } |
| 136 | 136 | $html = $indent ? EEH_HTML::nl( -1, $tag ) : ''; |
| 137 | - $html .= '</' . $tag . '>' . $comment; |
|
| 137 | + $html .= '</'.$tag.'>'.$comment; |
|
| 138 | 138 | return $html; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | - public static function div( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 157 | - return EEH_HTML::_open_tag( 'div', $content, $id, $class, $style, $other_attributes ); |
|
| 156 | + public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 157 | + return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | * @param string $class - html class attribute |
| 168 | 168 | * @return string |
| 169 | 169 | */ |
| 170 | - public static function divx( $id = '', $class = '' ) { |
|
| 171 | - return EEH_HTML::_close_tag( 'div', $id, $class ); |
|
| 170 | + public static function divx($id = '', $class = '') { |
|
| 171 | + return EEH_HTML::_close_tag('div', $id, $class); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 185 | 185 | * @return string |
| 186 | 186 | */ |
| 187 | - public static function h1( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 188 | - return EEH_HTML::_open_tag( 'h1', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 187 | + public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 188 | + return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 202 | 202 | * @return string |
| 203 | 203 | */ |
| 204 | - public static function h2( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 205 | - return EEH_HTML::_open_tag( 'h2', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 204 | + public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 205 | + return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 219 | 219 | * @return string |
| 220 | 220 | */ |
| 221 | - public static function h3( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 222 | - return EEH_HTML::_open_tag( 'h3', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 221 | + public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 222 | + return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 236 | 236 | * @return string |
| 237 | 237 | */ |
| 238 | - public static function h4( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 239 | - return EEH_HTML::_open_tag( 'h4', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 238 | + public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 239 | + return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 253 | 253 | * @return string |
| 254 | 254 | */ |
| 255 | - public static function h5( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 256 | - return EEH_HTML::_open_tag( 'h5', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 255 | + public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 256 | + return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | - public static function h6( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 273 | - return EEH_HTML::_open_tag( 'h6', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 272 | + public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 273 | + return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 287 | 287 | * @return string |
| 288 | 288 | */ |
| 289 | - public static function p( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 290 | - return EEH_HTML::_open_tag( 'p', $content, $id, $class, $style, $other_attributes, TRUE ); |
|
| 289 | + public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 290 | + return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, TRUE); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 303 | 303 | * @return string |
| 304 | 304 | */ |
| 305 | - public static function ul( $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 306 | - return EEH_HTML::_open_tag( 'ul', '', $id, $class, $style, $other_attributes ); |
|
| 305 | + public static function ul($id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 306 | + return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | * @param string $class - html class attribute |
| 317 | 317 | * @return string |
| 318 | 318 | */ |
| 319 | - public static function ulx( $id = '', $class = '' ) { |
|
| 320 | - return EEH_HTML::_close_tag( 'ul', $id, $class ); |
|
| 319 | + public static function ulx($id = '', $class = '') { |
|
| 320 | + return EEH_HTML::_close_tag('ul', $id, $class); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 335 | 335 | * @return string |
| 336 | 336 | */ |
| 337 | - public static function li( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 338 | - return EEH_HTML::_open_tag( 'li', $content, $id, $class, $style, $other_attributes ); |
|
| 337 | + public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 338 | + return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | |
@@ -348,8 +348,8 @@ discard block |
||
| 348 | 348 | * @param string $class - html class attribute |
| 349 | 349 | * @return string |
| 350 | 350 | */ |
| 351 | - public static function lix( $id = '', $class = '' ) { |
|
| 352 | - return EEH_HTML::_close_tag( 'li', $id, $class ); |
|
| 351 | + public static function lix($id = '', $class = '') { |
|
| 352 | + return EEH_HTML::_close_tag('li', $id, $class); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 366 | 366 | * @return string |
| 367 | 367 | */ |
| 368 | - public static function table( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 369 | - return EEH_HTML::_open_tag( 'table', $content, $id, $class, $style, $other_attributes ); |
|
| 368 | + public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 369 | + return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | |
@@ -378,8 +378,8 @@ discard block |
||
| 378 | 378 | * @param string $class - html class attribute |
| 379 | 379 | * @return string |
| 380 | 380 | */ |
| 381 | - public static function tablex( $id = '', $class = '' ) { |
|
| 382 | - return EEH_HTML::_close_tag( 'table', $id, $class ); |
|
| 381 | + public static function tablex($id = '', $class = '') { |
|
| 382 | + return EEH_HTML::_close_tag('table', $id, $class); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 396 | 396 | * @return string |
| 397 | 397 | */ |
| 398 | - public static function thead( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 399 | - return EEH_HTML::_open_tag( 'thead', $content, $id, $class, $style, $other_attributes ); |
|
| 398 | + public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 399 | + return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | * @param string $class - html class attribute |
| 409 | 409 | * @return string |
| 410 | 410 | */ |
| 411 | - public static function theadx( $id = '', $class = '' ) { |
|
| 412 | - return EEH_HTML::_close_tag( 'thead', $id, $class ); |
|
| 411 | + public static function theadx($id = '', $class = '') { |
|
| 412 | + return EEH_HTML::_close_tag('thead', $id, $class); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 426 | 426 | * @return string |
| 427 | 427 | */ |
| 428 | - public static function tbody( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 429 | - return EEH_HTML::_open_tag( 'tbody', $content, $id, $class, $style, $other_attributes ); |
|
| 428 | + public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 429 | + return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | * @param string $class - html class attribute |
| 439 | 439 | * @return string |
| 440 | 440 | */ |
| 441 | - public static function tbodyx( $id = '', $class = '' ) { |
|
| 442 | - return EEH_HTML::_close_tag( 'tbody', $id, $class ); |
|
| 441 | + public static function tbodyx($id = '', $class = '') { |
|
| 442 | + return EEH_HTML::_close_tag('tbody', $id, $class); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 456 | 456 | * @return string |
| 457 | 457 | */ |
| 458 | - public static function tr( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 459 | - return EEH_HTML::_open_tag( 'tr', $content, $id, $class, $style, $other_attributes ); |
|
| 458 | + public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 459 | + return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | |
@@ -468,8 +468,8 @@ discard block |
||
| 468 | 468 | * @param string $class - html class attribute |
| 469 | 469 | * @return string |
| 470 | 470 | */ |
| 471 | - public static function trx( $id = '', $class = '' ) { |
|
| 472 | - return EEH_HTML::_close_tag( 'tr', $id, $class ); |
|
| 471 | + public static function trx($id = '', $class = '') { |
|
| 472 | + return EEH_HTML::_close_tag('tr', $id, $class); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | |
@@ -485,8 +485,8 @@ discard block |
||
| 485 | 485 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 486 | 486 | * @return string |
| 487 | 487 | */ |
| 488 | - public static function th( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 489 | - return EEH_HTML::_open_tag( 'th', $content, $id, $class, $style, $other_attributes ); |
|
| 488 | + public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 489 | + return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | * @param string $class - html class attribute |
| 499 | 499 | * @return string |
| 500 | 500 | */ |
| 501 | - public static function thx( $id = '', $class = '' ) { |
|
| 502 | - return EEH_HTML::_close_tag( 'th', $id, $class ); |
|
| 501 | + public static function thx($id = '', $class = '') { |
|
| 502 | + return EEH_HTML::_close_tag('th', $id, $class); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 516 | 516 | * @return string |
| 517 | 517 | */ |
| 518 | - public static function td( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 519 | - return EEH_HTML::_open_tag( 'td', $content, $id, $class, $style, $other_attributes ); |
|
| 518 | + public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 519 | + return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | * @param string $class - html class attribute |
| 529 | 529 | * @return string |
| 530 | 530 | */ |
| 531 | - public static function tdx( $id = '', $class = '' ) { |
|
| 532 | - return EEH_HTML::_close_tag( 'td', $id, $class ); |
|
| 531 | + public static function tdx($id = '', $class = '') { |
|
| 532 | + return EEH_HTML::_close_tag('td', $id, $class); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | |
@@ -543,10 +543,10 @@ discard block |
||
| 543 | 543 | * @param int $colspan |
| 544 | 544 | * @return string |
| 545 | 545 | */ |
| 546 | - public static function no_row( $content = '', $colspan = 2 ) { |
|
| 546 | + public static function no_row($content = '', $colspan = 2) { |
|
| 547 | 547 | return EEH_HTML::tr( |
| 548 | - EEH_HTML::td( $content, '', '', 'padding:0; border:none;', 'colspan="' . $colspan . '"' ), |
|
| 549 | - '', '', 'padding:0; border:none;' |
|
| 548 | + EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="'.$colspan.'"'), |
|
| 549 | + '', '', 'padding:0; border:none;' |
|
| 550 | 550 | ); |
| 551 | 551 | } |
| 552 | 552 | |
@@ -566,14 +566,14 @@ discard block |
||
| 566 | 566 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 567 | 567 | * @return string |
| 568 | 568 | */ |
| 569 | - public static function link( $href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 570 | - $link_text = ! empty( $link_text ) ? $link_text : $href; |
|
| 571 | - $attributes = ! empty($href ) ? ' href="' . $href . '"' : ''; |
|
| 572 | - $attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 573 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 574 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 575 | - $attributes .= ! empty( $title ) ? ' title="' . esc_attr( $title ) . '"' : ''; |
|
| 576 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 569 | + public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 570 | + $link_text = ! empty($link_text) ? $link_text : $href; |
|
| 571 | + $attributes = ! empty($href) ? ' href="'.$href.'"' : ''; |
|
| 572 | + $attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 573 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 574 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 575 | + $attributes .= ! empty($title) ? ' title="'.esc_attr($title).'"' : ''; |
|
| 576 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 577 | 577 | return "<a{$attributes}>{$link_text}</a>"; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -591,14 +591,14 @@ discard block |
||
| 591 | 591 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 592 | 592 | * @return string |
| 593 | 593 | */ |
| 594 | - public static function img( $src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 595 | - $attributes = ! empty( $src ) ? ' src="' . esc_url_raw( $src ) . '"' : ''; |
|
| 596 | - $attributes .= ! empty( $alt ) ? ' alt="' . esc_attr( $alt ) . '"' : ''; |
|
| 597 | - $attributes .= ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 598 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 599 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 600 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 601 | - return '<img' . $attributes . '/>'; |
|
| 594 | + public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 595 | + $attributes = ! empty($src) ? ' src="'.esc_url_raw($src).'"' : ''; |
|
| 596 | + $attributes .= ! empty($alt) ? ' alt="'.esc_attr($alt).'"' : ''; |
|
| 597 | + $attributes .= ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 598 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 599 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 600 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 601 | + return '<img'.$attributes.'/>'; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | |
@@ -616,12 +616,12 @@ discard block |
||
| 616 | 616 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 617 | 617 | * @return string |
| 618 | 618 | */ |
| 619 | - protected static function _inline_tag( $tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 620 | - $attributes = ! empty( $id ) ? ' id="' . EEH_HTML::sanitize_id( $id ) . '"' : ''; |
|
| 621 | - $attributes .= ! empty( $class ) ? ' class="' . $class . '"' : ''; |
|
| 622 | - $attributes .= ! empty( $style ) ? ' style="' . $style . '"' : ''; |
|
| 623 | - $attributes .= ! empty( $other_attributes ) ? ' ' . $other_attributes : ''; |
|
| 624 | - return '<' . $tag . ' ' . $attributes . '>' . $content . '</' . $tag . '>'; |
|
| 619 | + protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 620 | + $attributes = ! empty($id) ? ' id="'.EEH_HTML::sanitize_id($id).'"' : ''; |
|
| 621 | + $attributes .= ! empty($class) ? ' class="'.$class.'"' : ''; |
|
| 622 | + $attributes .= ! empty($style) ? ' style="'.$style.'"' : ''; |
|
| 623 | + $attributes .= ! empty($other_attributes) ? ' '.$other_attributes : ''; |
|
| 624 | + return '<'.$tag.' '.$attributes.'>'.$content.'</'.$tag.'>'; |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 638 | 638 | * @return string |
| 639 | 639 | */ |
| 640 | - public static function label( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 641 | - return EEH_HTML::_inline_tag( 'label', $content, $id, $class, $style, $other_attributes ); |
|
| 640 | + public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 641 | + return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
@@ -654,8 +654,8 @@ discard block |
||
| 654 | 654 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 655 | 655 | * @return string |
| 656 | 656 | */ |
| 657 | - public static function span( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 658 | - return EEH_HTML::_inline_tag( 'span', $content, $id, $class, $style, $other_attributes ); |
|
| 657 | + public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 658 | + return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | |
@@ -671,8 +671,8 @@ discard block |
||
| 671 | 671 | * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc |
| 672 | 672 | * @return string |
| 673 | 673 | */ |
| 674 | - public static function strong( $content = '', $id = '', $class = '', $style = '', $other_attributes = '' ) { |
|
| 675 | - return EEH_HTML::_inline_tag( 'strong', $content, $id, $class, $style, $other_attributes ); |
|
| 674 | + public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '') { |
|
| 675 | + return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | |
@@ -684,8 +684,8 @@ discard block |
||
| 684 | 684 | * @param string $comment |
| 685 | 685 | * @return string |
| 686 | 686 | */ |
| 687 | - public static function comment( $comment = '' ) { |
|
| 688 | - return ! empty( $comment ) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : ''; |
|
| 687 | + public static function comment($comment = '') { |
|
| 688 | + return ! empty($comment) ? EEH_HTML::nl().'<!-- '.$comment.' -->' : ''; |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | |
@@ -696,8 +696,8 @@ discard block |
||
| 696 | 696 | * @param int $nmbr - the number of line breaks to return |
| 697 | 697 | * @return string |
| 698 | 698 | */ |
| 699 | - public static function br( $nmbr = 1 ) { |
|
| 700 | - return str_repeat( '<br />', $nmbr ); |
|
| 699 | + public static function br($nmbr = 1) { |
|
| 700 | + return str_repeat('<br />', $nmbr); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | |
@@ -708,8 +708,8 @@ discard block |
||
| 708 | 708 | * @param int $nmbr - the number of non-breaking spaces to return |
| 709 | 709 | * @return string |
| 710 | 710 | */ |
| 711 | - public static function nbsp( $nmbr = 1 ) { |
|
| 712 | - return str_repeat( ' ', $nmbr ); |
|
| 711 | + public static function nbsp($nmbr = 1) { |
|
| 712 | + return str_repeat(' ', $nmbr); |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | |
@@ -723,9 +723,9 @@ discard block |
||
| 723 | 723 | * @param string $id |
| 724 | 724 | * @return string |
| 725 | 725 | */ |
| 726 | - public static function sanitize_id( $id = '' ) { |
|
| 727 | - $key = str_replace( ' ', '-', trim( $id ) ); |
|
| 728 | - return preg_replace( '/[^a-zA-Z0-9_\-]/', '', $key ); |
|
| 726 | + public static function sanitize_id($id = '') { |
|
| 727 | + $key = str_replace(' ', '-', trim($id)); |
|
| 728 | + return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key); |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | |
@@ -737,10 +737,10 @@ discard block |
||
| 737 | 737 | * @param string $tag |
| 738 | 738 | * @return string - newline character plus # of indents passed (can be + or -) |
| 739 | 739 | */ |
| 740 | - public static function nl( $indent = 0, $tag = 'none' ) { |
|
| 740 | + public static function nl($indent = 0, $tag = 'none') { |
|
| 741 | 741 | $html = "\n"; |
| 742 | - EEH_HTML::indent( $indent, $tag ); |
|
| 743 | - for ( $x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++ ) { |
|
| 742 | + EEH_HTML::indent($indent, $tag); |
|
| 743 | + for ($x = 0; $x < EEH_HTML::$_indent[$tag]; $x++) { |
|
| 744 | 744 | $html .= "\t"; |
| 745 | 745 | } |
| 746 | 746 | return $html; |
@@ -755,17 +755,17 @@ discard block |
||
| 755 | 755 | * @param int $indent can be negative to decrease the indentation level |
| 756 | 756 | * @param string $tag |
| 757 | 757 | */ |
| 758 | - public static function indent( $indent, $tag = 'none' ){ |
|
| 758 | + public static function indent($indent, $tag = 'none') { |
|
| 759 | 759 | static $default_indentation = FALSE; |
| 760 | - if ( ! $default_indentation ) { |
|
| 760 | + if ( ! $default_indentation) { |
|
| 761 | 761 | EEH_HTML::_set_default_indentation(); |
| 762 | 762 | $default_indentation = TRUE; |
| 763 | 763 | } |
| 764 | - if ( ! isset( EEH_HTML::$_indent[ $tag ] )) { |
|
| 765 | - EEH_HTML::$_indent[ $tag ] = 0; |
|
| 764 | + if ( ! isset(EEH_HTML::$_indent[$tag])) { |
|
| 765 | + EEH_HTML::$_indent[$tag] = 0; |
|
| 766 | 766 | } |
| 767 | - EEH_HTML::$_indent[ $tag ] += (int)$indent; |
|
| 768 | - EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0; |
|
| 767 | + EEH_HTML::$_indent[$tag] += (int) $indent; |
|
| 768 | + EEH_HTML::$_indent[$tag] = EEH_HTML::$_indent[$tag] >= 0 ? EEH_HTML::$_indent[$tag] : 0; |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -811,15 +811,15 @@ discard block |
||
| 811 | 811 | * @global array $allowedtags |
| 812 | 812 | * @return array |
| 813 | 813 | */ |
| 814 | - public static function get_simple_tags(){ |
|
| 814 | + public static function get_simple_tags() { |
|
| 815 | 815 | global $allowedtags; |
| 816 | 816 | $tags_we_allow = $allowedtags; |
| 817 | - $tags_we_allow['ol']=array(); |
|
| 818 | - $tags_we_allow['ul']=array(); |
|
| 819 | - $tags_we_allow['li']=array(); |
|
| 820 | - $tags_we_allow['br']=array(); |
|
| 821 | - $tags_we_allow['p']=array(); |
|
| 822 | - return apply_filters( 'FHEE__EEH_HTML__get_simple_tags', $tags_we_allow ); |
|
| 817 | + $tags_we_allow['ol'] = array(); |
|
| 818 | + $tags_we_allow['ul'] = array(); |
|
| 819 | + $tags_we_allow['li'] = array(); |
|
| 820 | + $tags_we_allow['br'] = array(); |
|
| 821 | + $tags_we_allow['p'] = array(); |
|
| 822 | + return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow); |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | |
@@ -17,158 +17,158 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var \EE_Ticket $ticket |
|
| 22 | - */ |
|
| 23 | - protected $ticket; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var \EE_Ticket_Selector_Config $template_settings |
|
| 27 | - */ |
|
| 28 | - protected $template_settings; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var string $date_format |
|
| 32 | - */ |
|
| 33 | - protected $date_format; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var string $time_format |
|
| 37 | - */ |
|
| 38 | - protected $time_format; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var boolean $event_is_expired |
|
| 42 | - */ |
|
| 43 | - protected $event_is_expired; |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * TicketDetails constructor. |
|
| 49 | - * |
|
| 50 | - * @param \EE_Ticket $ticket |
|
| 51 | - * @param \EE_Ticket_Selector_Config $template_settings |
|
| 52 | - * @param array $template_args |
|
| 53 | - */ |
|
| 54 | - public function __construct( |
|
| 55 | - \EE_Ticket $ticket, |
|
| 56 | - \EE_Ticket_Selector_Config $template_settings, |
|
| 57 | - array $template_args |
|
| 58 | - ) |
|
| 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 | - /** |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 72 | - public function showTicketDetails() |
|
| 73 | - { |
|
| 74 | - return $this->template_settings->show_ticket_details; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function getShowHideLinks() |
|
| 83 | - { |
|
| 84 | - if ( ! $this->showTicketDetails()) { |
|
| 85 | - return ''; |
|
| 86 | - } |
|
| 87 | - return \EEH_HTML::link( |
|
| 88 | - '', |
|
| 89 | - sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 90 | - esc_attr( |
|
| 91 | - apply_filters( |
|
| 92 | - 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 93 | - __('click to show additional ticket details', 'event_espresso') |
|
| 94 | - ) |
|
| 95 | - ), |
|
| 96 | - "display-{$this->cssId()}", |
|
| 97 | - 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 98 | - '', |
|
| 99 | - 'rel="' . $this->cssId() . '"' |
|
| 100 | - ) . \EEH_HTML::link( |
|
| 101 | - '', |
|
| 102 | - sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 103 | - esc_attr( |
|
| 104 | - apply_filters( |
|
| 105 | - 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 106 | - __('click to hide additional ticket details', 'event_espresso') |
|
| 107 | - ) |
|
| 108 | - ), |
|
| 109 | - "hide-{$this->cssId()}", |
|
| 110 | - 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 111 | - 'display:none;', |
|
| 112 | - 'rel="' . $this->cssId() . '"' |
|
| 113 | - ); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @return string |
|
| 120 | - */ |
|
| 121 | - public function cssId() |
|
| 122 | - { |
|
| 123 | - return apply_filters( |
|
| 124 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 125 | - "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 126 | - ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @param float $ticket_price |
|
| 133 | - * @param int $remaining |
|
| 134 | - * @param int $cols |
|
| 135 | - * @return string |
|
| 136 | - */ |
|
| 137 | - public function display( |
|
| 138 | - $ticket_price = 0.00, |
|
| 139 | - $remaining, |
|
| 140 | - $cols = 2 |
|
| 141 | - ) { |
|
| 142 | - $template_args = array(); |
|
| 143 | - $template_args['ticket'] = $this->ticket; |
|
| 144 | - $template_args['ticket_price'] = $ticket_price; |
|
| 145 | - $template_args['remaining'] = $remaining; |
|
| 146 | - $template_args['cols'] = $cols; |
|
| 147 | - $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 148 | - $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 149 | - $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 150 | - $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 151 | - $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
| 152 | - 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 153 | - true |
|
| 154 | - ); |
|
| 155 | - $template_args['price_breakdown_heading'] = apply_filters( |
|
| 156 | - 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 157 | - esc_html__('Price', 'event_espresso') |
|
| 158 | - ); |
|
| 159 | - $template_args['date_format'] = $this->date_format; |
|
| 160 | - $template_args['time_format'] = $this->time_format; |
|
| 161 | - $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 162 | - |
|
| 163 | - return \EEH_Template::locate_template( |
|
| 164 | - apply_filters( |
|
| 165 | - 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 167 | - $this->ticket |
|
| 168 | - ), |
|
| 169 | - $template_args |
|
| 170 | - ); |
|
| 171 | - } |
|
| 20 | + /** |
|
| 21 | + * @var \EE_Ticket $ticket |
|
| 22 | + */ |
|
| 23 | + protected $ticket; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var \EE_Ticket_Selector_Config $template_settings |
|
| 27 | + */ |
|
| 28 | + protected $template_settings; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var string $date_format |
|
| 32 | + */ |
|
| 33 | + protected $date_format; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var string $time_format |
|
| 37 | + */ |
|
| 38 | + protected $time_format; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var boolean $event_is_expired |
|
| 42 | + */ |
|
| 43 | + protected $event_is_expired; |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * TicketDetails constructor. |
|
| 49 | + * |
|
| 50 | + * @param \EE_Ticket $ticket |
|
| 51 | + * @param \EE_Ticket_Selector_Config $template_settings |
|
| 52 | + * @param array $template_args |
|
| 53 | + */ |
|
| 54 | + public function __construct( |
|
| 55 | + \EE_Ticket $ticket, |
|
| 56 | + \EE_Ticket_Selector_Config $template_settings, |
|
| 57 | + array $template_args |
|
| 58 | + ) |
|
| 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 | + /** |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | + public function showTicketDetails() |
|
| 73 | + { |
|
| 74 | + return $this->template_settings->show_ticket_details; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function getShowHideLinks() |
|
| 83 | + { |
|
| 84 | + if ( ! $this->showTicketDetails()) { |
|
| 85 | + return ''; |
|
| 86 | + } |
|
| 87 | + return \EEH_HTML::link( |
|
| 88 | + '', |
|
| 89 | + sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '), |
|
| 90 | + esc_attr( |
|
| 91 | + apply_filters( |
|
| 92 | + 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', |
|
| 93 | + __('click to show additional ticket details', 'event_espresso') |
|
| 94 | + ) |
|
| 95 | + ), |
|
| 96 | + "display-{$this->cssId()}", |
|
| 97 | + 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
|
| 98 | + '', |
|
| 99 | + 'rel="' . $this->cssId() . '"' |
|
| 100 | + ) . \EEH_HTML::link( |
|
| 101 | + '', |
|
| 102 | + sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
|
| 103 | + esc_attr( |
|
| 104 | + apply_filters( |
|
| 105 | + 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', |
|
| 106 | + __('click to hide additional ticket details', 'event_espresso') |
|
| 107 | + ) |
|
| 108 | + ), |
|
| 109 | + "hide-{$this->cssId()}", |
|
| 110 | + 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
|
| 111 | + 'display:none;', |
|
| 112 | + 'rel="' . $this->cssId() . '"' |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @return string |
|
| 120 | + */ |
|
| 121 | + public function cssId() |
|
| 122 | + { |
|
| 123 | + return apply_filters( |
|
| 124 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
| 125 | + "tckt-slctr-tkt-details-{$this->ticket->get_event_ID()}-{$this->ticket->ID()}" |
|
| 126 | + ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @param float $ticket_price |
|
| 133 | + * @param int $remaining |
|
| 134 | + * @param int $cols |
|
| 135 | + * @return string |
|
| 136 | + */ |
|
| 137 | + public function display( |
|
| 138 | + $ticket_price = 0.00, |
|
| 139 | + $remaining, |
|
| 140 | + $cols = 2 |
|
| 141 | + ) { |
|
| 142 | + $template_args = array(); |
|
| 143 | + $template_args['ticket'] = $this->ticket; |
|
| 144 | + $template_args['ticket_price'] = $ticket_price; |
|
| 145 | + $template_args['remaining'] = $remaining; |
|
| 146 | + $template_args['cols'] = $cols; |
|
| 147 | + $template_args['show_ticket_details'] = $this->template_settings->show_ticket_details; |
|
| 148 | + $template_args['show_ticket_sale_columns'] = $this->template_settings->show_ticket_sale_columns; |
|
| 149 | + $template_args['ticket_details_row_class'] = espresso_get_object_css_class($this->ticket, '', 'details'); |
|
| 150 | + $template_args['ticket_details_css_id'] = $this->cssId(); |
|
| 151 | + $template_args['display_ticket_price'] = $ticket_price !== 0 && apply_filters( |
|
| 152 | + 'FHEE__ticket_selector_chart_template__display_ticket_price_details', |
|
| 153 | + true |
|
| 154 | + ); |
|
| 155 | + $template_args['price_breakdown_heading'] = apply_filters( |
|
| 156 | + 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', |
|
| 157 | + esc_html__('Price', 'event_espresso') |
|
| 158 | + ); |
|
| 159 | + $template_args['date_format'] = $this->date_format; |
|
| 160 | + $template_args['time_format'] = $this->time_format; |
|
| 161 | + $template_args['event_is_expired'] = $this->event_is_expired; |
|
| 162 | + |
|
| 163 | + return \EEH_Template::locate_template( |
|
| 164 | + apply_filters( |
|
| 165 | + 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
|
| 166 | + TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 167 | + $this->ticket |
|
| 168 | + ), |
|
| 169 | + $template_args |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | 173 | } |
| 174 | 174 | // End of file TicketDetails.php |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | "display-{$this->cssId()}", |
| 97 | 97 | 'display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js', |
| 98 | 98 | '', |
| 99 | - 'rel="' . $this->cssId() . '"' |
|
| 100 | - ) . \EEH_HTML::link( |
|
| 99 | + 'rel="'.$this->cssId().'"' |
|
| 100 | + ).\EEH_HTML::link( |
|
| 101 | 101 | '', |
| 102 | 102 | sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '), |
| 103 | 103 | esc_attr( |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | "hide-{$this->cssId()}", |
| 110 | 110 | 'hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js', |
| 111 | 111 | 'display:none;', |
| 112 | - 'rel="' . $this->cssId() . '"' |
|
| 112 | + 'rel="'.$this->cssId().'"' |
|
| 113 | 113 | ); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return \EEH_Template::locate_template( |
| 164 | 164 | apply_filters( |
| 165 | 165 | 'FHEE__EventEspresso_modules_ticket_selector_TicketDetails__display__template_path', |
| 166 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_details.template.php', |
|
| 166 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_details.template.php', |
|
| 167 | 167 | $this->ticket |
| 168 | 168 | ), |
| 169 | 169 | $template_args |
@@ -6,14 +6,14 @@ discard block |
||
| 6 | 6 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
| 7 | 7 | <?php |
| 8 | 8 | if ( $ticket instanceof EE_Ticket ) { |
| 9 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 10 | - $ticket_description = $ticket->description(); |
|
| 11 | - $ticket_description .= ! empty( $ticket_description ) |
|
| 12 | - ? '<br />' . $ticket_status_display |
|
| 13 | - : $ticket_status_display; |
|
| 14 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
| 15 | - $ticket_description = "<p>{$ticket_description}</p>"; |
|
| 16 | - } |
|
| 9 | + do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 10 | + $ticket_description = $ticket->description(); |
|
| 11 | + $ticket_description .= ! empty( $ticket_description ) |
|
| 12 | + ? '<br />' . $ticket_status_display |
|
| 13 | + : $ticket_status_display; |
|
| 14 | + if ( ! strpos( $ticket_description, '<div' ) ) { |
|
| 15 | + $ticket_description = "<p>{$ticket_description}</p>"; |
|
| 16 | + } |
|
| 17 | 17 | ?> |
| 18 | 18 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
| 19 | 19 | <div class="no-tkt-slctr-ticket-content-dv"> |
@@ -23,6 +23,6 @@ discard block |
||
| 23 | 23 | <?php } ?> |
| 24 | 24 | </div> |
| 25 | 25 | <?php |
| 26 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 26 | + do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 27 | 27 | } |
| 28 | 28 | ?> |
@@ -5,24 +5,24 @@ |
||
| 5 | 5 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
| 6 | 6 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
| 7 | 7 | <?php |
| 8 | -if ( $ticket instanceof EE_Ticket ) { |
|
| 9 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
| 8 | +if ($ticket instanceof EE_Ticket) { |
|
| 9 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
| 10 | 10 | $ticket_description = $ticket->description(); |
| 11 | - $ticket_description .= ! empty( $ticket_description ) |
|
| 12 | - ? '<br />' . $ticket_status_display |
|
| 11 | + $ticket_description .= ! empty($ticket_description) |
|
| 12 | + ? '<br />'.$ticket_status_display |
|
| 13 | 13 | : $ticket_status_display; |
| 14 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
| 14 | + if ( ! strpos($ticket_description, '<div')) { |
|
| 15 | 15 | $ticket_description = "<p>{$ticket_description}</p>"; |
| 16 | 16 | } |
| 17 | 17 | ?> |
| 18 | 18 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
| 19 | 19 | <div class="no-tkt-slctr-ticket-content-dv"> |
| 20 | 20 | <h5><?php echo $ticket->name(); ?></h5> |
| 21 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
| 21 | + <?php if ( ! empty($ticket_description)) { ?> |
|
| 22 | 22 | <?php echo $ticket_description; ?> |
| 23 | 23 | <?php } ?> |
| 24 | 24 | </div> |
| 25 | 25 | <?php |
| 26 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
| 26 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
| 27 | 27 | } |
| 28 | 28 | ?> |
@@ -18,46 +18,46 @@ |
||
| 18 | 18 | class TicketSelectorSimple extends TicketSelector |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var \EE_Ticket $ticket |
|
| 23 | - */ |
|
| 24 | - protected $ticket; |
|
| 21 | + /** |
|
| 22 | + * @var \EE_Ticket $ticket |
|
| 23 | + */ |
|
| 24 | + protected $ticket; |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * TicketSelectorSimple constructor. |
|
| 30 | - * |
|
| 31 | - * @param \EE_Event $event |
|
| 32 | - * @param \EE_Ticket $ticket |
|
| 33 | - * @param int $max_attendees |
|
| 34 | - * @param array $template_args |
|
| 35 | - */ |
|
| 36 | - public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args) |
|
| 37 | - { |
|
| 38 | - $this->ticket = $ticket; |
|
| 39 | - parent::__construct($event, array($this->ticket), $max_attendees, $template_args); |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * TicketSelectorSimple constructor. |
|
| 30 | + * |
|
| 31 | + * @param \EE_Event $event |
|
| 32 | + * @param \EE_Ticket $ticket |
|
| 33 | + * @param int $max_attendees |
|
| 34 | + * @param array $template_args |
|
| 35 | + */ |
|
| 36 | + public function __construct(\EE_Event $event, \EE_Ticket $ticket, $max_attendees, array $template_args) |
|
| 37 | + { |
|
| 38 | + $this->ticket = $ticket; |
|
| 39 | + parent::__construct($event, array($this->ticket), $max_attendees, $template_args); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * sets any and all template args that are required for this Ticket Selector |
|
| 46 | - * |
|
| 47 | - * @return void |
|
| 48 | - */ |
|
| 49 | - protected function addTemplateArgs() |
|
| 50 | - { |
|
| 51 | - unset($this->template_args['tickets']); |
|
| 52 | - $this->template_args['ticket'] = $this->ticket; |
|
| 53 | - $ticket_selector_row = new TicketSelectorRowSimple( |
|
| 54 | - $this->ticket, |
|
| 55 | - $this->max_attendees, |
|
| 56 | - $this->template_args['date_format'] |
|
| 57 | - ); |
|
| 58 | - $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
| 59 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 60 | - } |
|
| 44 | + /** |
|
| 45 | + * sets any and all template args that are required for this Ticket Selector |
|
| 46 | + * |
|
| 47 | + * @return void |
|
| 48 | + */ |
|
| 49 | + protected function addTemplateArgs() |
|
| 50 | + { |
|
| 51 | + unset($this->template_args['tickets']); |
|
| 52 | + $this->template_args['ticket'] = $this->ticket; |
|
| 53 | + $ticket_selector_row = new TicketSelectorRowSimple( |
|
| 54 | + $this->ticket, |
|
| 55 | + $this->max_attendees, |
|
| 56 | + $this->template_args['date_format'] |
|
| 57 | + ); |
|
| 58 | + $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
|
| 59 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $this->template_args['date_format'] |
| 57 | 57 | ); |
| 58 | 58 | $this->template_args['ticket_status_display'] = $ticket_selector_row->getTicketStatusDisplay(); |
| 59 | - $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH . 'simple_ticket_selector.template.php'; |
|
| 59 | + $this->template_args['template_path'] = TICKET_SELECTOR_TEMPLATES_PATH.'simple_ticket_selector.template.php'; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -16,90 +16,90 @@ |
||
| 16 | 16 | abstract class TicketSelector |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var \EE_Event $event |
|
| 21 | - */ |
|
| 22 | - protected $event; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var \EE_Ticket[] $tickets |
|
| 26 | - */ |
|
| 27 | - protected $tickets; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var int max_attendees |
|
| 31 | - */ |
|
| 32 | - protected $max_attendees; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var array $template_args |
|
| 36 | - */ |
|
| 37 | - protected $template_args; |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * TicketSelectorSimple constructor. |
|
| 43 | - * |
|
| 44 | - * @param \EE_Event $event |
|
| 45 | - * @param \EE_Ticket[] $tickets |
|
| 46 | - * @param int $max_attendees |
|
| 47 | - * @param array $template_args |
|
| 48 | - */ |
|
| 49 | - public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
|
| 50 | - { |
|
| 51 | - $this->event = $event; |
|
| 52 | - $this->tickets = $tickets; |
|
| 53 | - $this->max_attendees = $max_attendees; |
|
| 54 | - $this->template_args = $template_args; |
|
| 55 | - $this->addTemplateArgs(); |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * sets any and all template args that are required for this Ticket Selector |
|
| 62 | - * |
|
| 63 | - * @return void |
|
| 64 | - */ |
|
| 65 | - abstract protected function addTemplateArgs(); |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * loadTicketSelectorTemplate |
|
| 71 | - * |
|
| 72 | - * @return string |
|
| 73 | - */ |
|
| 74 | - protected function loadTicketSelectorTemplate() |
|
| 75 | - { |
|
| 76 | - try { |
|
| 77 | - return \EEH_Template::locate_template( |
|
| 78 | - apply_filters( |
|
| 79 | - 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
|
| 80 | - $this->template_args['template_path'], |
|
| 81 | - $this->event |
|
| 82 | - ), |
|
| 83 | - $this->template_args |
|
| 84 | - ); |
|
| 85 | - } catch (\Exception $e) { |
|
| 86 | - \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 87 | - } |
|
| 88 | - return ''; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * The __toString method allows a class to decide how it will react when it is converted to a string. |
|
| 95 | - * |
|
| 96 | - * @return string |
|
| 97 | - * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
|
| 98 | - */ |
|
| 99 | - public function __toString() |
|
| 100 | - { |
|
| 101 | - return $this->loadTicketSelectorTemplate(); |
|
| 102 | - } |
|
| 19 | + /** |
|
| 20 | + * @var \EE_Event $event |
|
| 21 | + */ |
|
| 22 | + protected $event; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var \EE_Ticket[] $tickets |
|
| 26 | + */ |
|
| 27 | + protected $tickets; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var int max_attendees |
|
| 31 | + */ |
|
| 32 | + protected $max_attendees; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var array $template_args |
|
| 36 | + */ |
|
| 37 | + protected $template_args; |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * TicketSelectorSimple constructor. |
|
| 43 | + * |
|
| 44 | + * @param \EE_Event $event |
|
| 45 | + * @param \EE_Ticket[] $tickets |
|
| 46 | + * @param int $max_attendees |
|
| 47 | + * @param array $template_args |
|
| 48 | + */ |
|
| 49 | + public function __construct(\EE_Event $event, array $tickets, $max_attendees, array $template_args) |
|
| 50 | + { |
|
| 51 | + $this->event = $event; |
|
| 52 | + $this->tickets = $tickets; |
|
| 53 | + $this->max_attendees = $max_attendees; |
|
| 54 | + $this->template_args = $template_args; |
|
| 55 | + $this->addTemplateArgs(); |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * sets any and all template args that are required for this Ticket Selector |
|
| 62 | + * |
|
| 63 | + * @return void |
|
| 64 | + */ |
|
| 65 | + abstract protected function addTemplateArgs(); |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * loadTicketSelectorTemplate |
|
| 71 | + * |
|
| 72 | + * @return string |
|
| 73 | + */ |
|
| 74 | + protected function loadTicketSelectorTemplate() |
|
| 75 | + { |
|
| 76 | + try { |
|
| 77 | + return \EEH_Template::locate_template( |
|
| 78 | + apply_filters( |
|
| 79 | + 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', |
|
| 80 | + $this->template_args['template_path'], |
|
| 81 | + $this->event |
|
| 82 | + ), |
|
| 83 | + $this->template_args |
|
| 84 | + ); |
|
| 85 | + } catch (\Exception $e) { |
|
| 86 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
| 87 | + } |
|
| 88 | + return ''; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * The __toString method allows a class to decide how it will react when it is converted to a string. |
|
| 95 | + * |
|
| 96 | + * @return string |
|
| 97 | + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
|
| 98 | + */ |
|
| 99 | + public function __toString() |
|
| 100 | + { |
|
| 101 | + return $this->loadTicketSelectorTemplate(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Form constructor. |
|
| 124 | - * |
|
| 125 | - * @param string $form_name |
|
| 126 | - * @param string $admin_name |
|
| 127 | - * @param string $slug |
|
| 128 | - * @param string $form_action |
|
| 129 | - * @param string $form_config |
|
| 130 | - * @param \EE_Registry $registry |
|
| 131 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
| 132 | - * @throws \DomainException |
|
| 133 | - * @throws \InvalidArgumentException |
|
| 134 | - */ |
|
| 122 | + /** |
|
| 123 | + * Form constructor. |
|
| 124 | + * |
|
| 125 | + * @param string $form_name |
|
| 126 | + * @param string $admin_name |
|
| 127 | + * @param string $slug |
|
| 128 | + * @param string $form_action |
|
| 129 | + * @param string $form_config |
|
| 130 | + * @param \EE_Registry $registry |
|
| 131 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
| 132 | + * @throws \DomainException |
|
| 133 | + * @throws \InvalidArgumentException |
|
| 134 | + */ |
|
| 135 | 135 | public function __construct( |
| 136 | 136 | $form_name, |
| 137 | 137 | $admin_name, |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @throws \LogicException |
| 173 | 173 | */ |
| 174 | 174 | public function form( $for_display = false ) { |
| 175 | - if ( ! $this->formIsValid() ) { |
|
| 175 | + if ( ! $this->formIsValid() ) { |
|
| 176 | 176 | return null; |
| 177 | 177 | } |
| 178 | 178 | if ( $for_display ) { |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | * @throws LogicException |
| 196 | 196 | */ |
| 197 | 197 | public function formIsValid() { |
| 198 | - if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
| 198 | + if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
| 199 | 199 | static $generated = false; |
| 200 | 200 | if ( ! $generated ) { |
| 201 | 201 | $generated = true; |
| 202 | 202 | $form = $this->generate(); |
| 203 | - if ( $form instanceof \EE_Form_Section_Proper) { |
|
| 204 | - $this->setForm($form); |
|
| 205 | - } |
|
| 203 | + if ( $form instanceof \EE_Form_Section_Proper) { |
|
| 204 | + $this->setForm($form); |
|
| 205 | + } |
|
| 206 | 206 | } |
| 207 | 207 | return $this->verifyForm(); |
| 208 | 208 | } |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | |
| 339 | 339 | |
| 340 | - /** |
|
| 341 | - * @param string $submit_btn_text |
|
| 342 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
| 343 | - * @throws \InvalidArgumentException |
|
| 344 | - */ |
|
| 340 | + /** |
|
| 341 | + * @param string $submit_btn_text |
|
| 342 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
| 343 | + * @throws \InvalidArgumentException |
|
| 344 | + */ |
|
| 345 | 345 | public function setSubmitBtnText( $submit_btn_text ) { |
| 346 | 346 | if ( ! is_string( $submit_btn_text ) ) { |
| 347 | 347 | throw new InvalidDataTypeException( '$submit_btn_text', $submit_btn_text, 'string' ); |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | * @throws \EE_Error |
| 575 | 575 | */ |
| 576 | 576 | public function display() { |
| 577 | - $form_html = apply_filters( |
|
| 577 | + $form_html = apply_filters( |
|
| 578 | 578 | 'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form', |
| 579 | 579 | '' |
| 580 | 580 | ); |
@@ -613,11 +613,11 @@ discard block |
||
| 613 | 613 | */ |
| 614 | 614 | public function process( $submitted_form_data = array() ) { |
| 615 | 615 | if ( ! $this->form()->was_submitted( $submitted_form_data ) ) { |
| 616 | - throw new InvalidFormSubmissionException( $this->form_name ); |
|
| 616 | + throw new InvalidFormSubmissionException( $this->form_name ); |
|
| 617 | 617 | } |
| 618 | - $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
| 618 | + $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
| 619 | 619 | if ( ! $this->form()->is_valid() ) { |
| 620 | - throw new InvalidFormSubmissionException( |
|
| 620 | + throw new InvalidFormSubmissionException( |
|
| 621 | 621 | $this->form_name, |
| 622 | 622 | sprintf( |
| 623 | 623 | __( |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 11 | 11 | use EventEspresso\core\exceptions\InvalidFormSubmissionException; |
| 12 | 12 | |
| 13 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 14 | - exit( 'No direct script access allowed' ); |
|
| 13 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 14 | + exit('No direct script access allowed'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @author Brent Christensen |
| 28 | 28 | * @since 4.9.0 |
| 29 | 29 | */ |
| 30 | -abstract class FormHandler implements FormHandlerInterface{ |
|
| 30 | +abstract class FormHandler implements FormHandlerInterface { |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * will add opening and closing HTML form tags as well as a submit button |
@@ -140,12 +140,12 @@ discard block |
||
| 140 | 140 | $form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT, |
| 141 | 141 | \EE_Registry $registry |
| 142 | 142 | ) { |
| 143 | - $this->setFormName( $form_name ); |
|
| 144 | - $this->setAdminName( $admin_name ); |
|
| 145 | - $this->setSlug( $slug ); |
|
| 146 | - $this->setFormAction( $form_action ); |
|
| 147 | - $this->setFormConfig( $form_config ); |
|
| 148 | - $this->setSubmitBtnText( __( 'Submit', 'event_espresso' ) ); |
|
| 143 | + $this->setFormName($form_name); |
|
| 144 | + $this->setAdminName($admin_name); |
|
| 145 | + $this->setSlug($slug); |
|
| 146 | + $this->setFormAction($form_action); |
|
| 147 | + $this->setFormConfig($form_config); |
|
| 148 | + $this->setSubmitBtnText(__('Submit', 'event_espresso')); |
|
| 149 | 149 | $this->registry = $registry; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | * @throws \EE_Error |
| 172 | 172 | * @throws \LogicException |
| 173 | 173 | */ |
| 174 | - public function form( $for_display = false ) { |
|
| 175 | - if ( ! $this->formIsValid() ) { |
|
| 174 | + public function form($for_display = false) { |
|
| 175 | + if ( ! $this->formIsValid()) { |
|
| 176 | 176 | return null; |
| 177 | 177 | } |
| 178 | - if ( $for_display ) { |
|
| 178 | + if ($for_display) { |
|
| 179 | 179 | $form_config = $this->formConfig(); |
| 180 | 180 | if ( |
| 181 | 181 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
@@ -195,12 +195,12 @@ discard block |
||
| 195 | 195 | * @throws LogicException |
| 196 | 196 | */ |
| 197 | 197 | public function formIsValid() { |
| 198 | - if ( ! $this->form instanceof \EE_Form_Section_Proper ) { |
|
| 198 | + if ( ! $this->form instanceof \EE_Form_Section_Proper) { |
|
| 199 | 199 | static $generated = false; |
| 200 | - if ( ! $generated ) { |
|
| 200 | + if ( ! $generated) { |
|
| 201 | 201 | $generated = true; |
| 202 | 202 | $form = $this->generate(); |
| 203 | - if ( $form instanceof \EE_Form_Section_Proper) { |
|
| 203 | + if ($form instanceof \EE_Form_Section_Proper) { |
|
| 204 | 204 | $this->setForm($form); |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -216,12 +216,12 @@ discard block |
||
| 216 | 216 | * @throws LogicException |
| 217 | 217 | */ |
| 218 | 218 | public function verifyForm() { |
| 219 | - if ( $this->form instanceof \EE_Form_Section_Proper ) { |
|
| 219 | + if ($this->form instanceof \EE_Form_Section_Proper) { |
|
| 220 | 220 | return true; |
| 221 | 221 | } |
| 222 | 222 | throw new LogicException( |
| 223 | 223 | sprintf( |
| 224 | - __( 'The "%1$s" form is invalid or missing', 'event_espresso' ), |
|
| 224 | + __('The "%1$s" form is invalid or missing', 'event_espresso'), |
|
| 225 | 225 | $this->form_name |
| 226 | 226 | ) |
| 227 | 227 | ); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /** |
| 233 | 233 | * @param \EE_Form_Section_Proper $form |
| 234 | 234 | */ |
| 235 | - public function setForm( \EE_Form_Section_Proper $form ) { |
|
| 235 | + public function setForm(\EE_Form_Section_Proper $form) { |
|
| 236 | 236 | $this->form = $form; |
| 237 | 237 | } |
| 238 | 238 | |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | /** |
| 251 | 251 | * @param boolean $displayable |
| 252 | 252 | */ |
| 253 | - public function setDisplayable( $displayable = false ) { |
|
| 254 | - $this->displayable = filter_var( $displayable, FILTER_VALIDATE_BOOLEAN ); |
|
| 253 | + public function setDisplayable($displayable = false) { |
|
| 254 | + $this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
@@ -271,9 +271,9 @@ discard block |
||
| 271 | 271 | * @param string $form_name |
| 272 | 272 | * @throws InvalidDataTypeException |
| 273 | 273 | */ |
| 274 | - public function setFormName( $form_name ) { |
|
| 275 | - if ( ! is_string( $form_name ) ) { |
|
| 276 | - throw new InvalidDataTypeException( '$form_name', $form_name, 'string' ); |
|
| 274 | + public function setFormName($form_name) { |
|
| 275 | + if ( ! is_string($form_name)) { |
|
| 276 | + throw new InvalidDataTypeException('$form_name', $form_name, 'string'); |
|
| 277 | 277 | } |
| 278 | 278 | $this->form_name = $form_name; |
| 279 | 279 | } |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | * @param string $admin_name |
| 296 | 296 | * @throws InvalidDataTypeException |
| 297 | 297 | */ |
| 298 | - public function setAdminName( $admin_name ) { |
|
| 299 | - if ( ! is_string( $admin_name ) ) { |
|
| 300 | - throw new InvalidDataTypeException( '$admin_name', $admin_name, 'string' ); |
|
| 298 | + public function setAdminName($admin_name) { |
|
| 299 | + if ( ! is_string($admin_name)) { |
|
| 300 | + throw new InvalidDataTypeException('$admin_name', $admin_name, 'string'); |
|
| 301 | 301 | } |
| 302 | 302 | $this->admin_name = $admin_name; |
| 303 | 303 | } |
@@ -319,9 +319,9 @@ discard block |
||
| 319 | 319 | * @param string $slug |
| 320 | 320 | * @throws InvalidDataTypeException |
| 321 | 321 | */ |
| 322 | - public function setSlug( $slug ) { |
|
| 323 | - if ( ! is_string( $slug ) ) { |
|
| 324 | - throw new InvalidDataTypeException( '$slug', $slug, 'string' ); |
|
| 322 | + public function setSlug($slug) { |
|
| 323 | + if ( ! is_string($slug)) { |
|
| 324 | + throw new InvalidDataTypeException('$slug', $slug, 'string'); |
|
| 325 | 325 | } |
| 326 | 326 | $this->slug = $slug; |
| 327 | 327 | } |
@@ -342,13 +342,13 @@ discard block |
||
| 342 | 342 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
| 343 | 343 | * @throws \InvalidArgumentException |
| 344 | 344 | */ |
| 345 | - public function setSubmitBtnText( $submit_btn_text ) { |
|
| 346 | - if ( ! is_string( $submit_btn_text ) ) { |
|
| 347 | - throw new InvalidDataTypeException( '$submit_btn_text', $submit_btn_text, 'string' ); |
|
| 345 | + public function setSubmitBtnText($submit_btn_text) { |
|
| 346 | + if ( ! is_string($submit_btn_text)) { |
|
| 347 | + throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string'); |
|
| 348 | 348 | } |
| 349 | - if ( empty( $submit_btn_text ) ) { |
|
| 349 | + if (empty($submit_btn_text)) { |
|
| 350 | 350 | throw new InvalidArgumentException( |
| 351 | - __( 'Can not set Submit button text because an empty string was provided.', 'event_espresso' ) |
|
| 351 | + __('Can not set Submit button text because an empty string was provided.', 'event_espresso') |
|
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | 354 | $this->submit_btn_text = $submit_btn_text; |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | * @return string |
| 361 | 361 | */ |
| 362 | 362 | public function formAction() { |
| 363 | - return ! empty( $this->form_args ) |
|
| 364 | - ? add_query_arg( $this->form_args, $this->form_action ) |
|
| 363 | + return ! empty($this->form_args) |
|
| 364 | + ? add_query_arg($this->form_args, $this->form_action) |
|
| 365 | 365 | : $this->form_action; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -371,9 +371,9 @@ discard block |
||
| 371 | 371 | * @param string $form_action |
| 372 | 372 | * @throws InvalidDataTypeException |
| 373 | 373 | */ |
| 374 | - public function setFormAction( $form_action ) { |
|
| 375 | - if ( ! is_string( $form_action ) ) { |
|
| 376 | - throw new InvalidDataTypeException( '$form_action', $form_action, 'string' ); |
|
| 374 | + public function setFormAction($form_action) { |
|
| 375 | + if ( ! is_string($form_action)) { |
|
| 376 | + throw new InvalidDataTypeException('$form_action', $form_action, 'string'); |
|
| 377 | 377 | } |
| 378 | 378 | $this->form_action = $form_action; |
| 379 | 379 | } |
@@ -385,20 +385,20 @@ discard block |
||
| 385 | 385 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
| 386 | 386 | * @throws \InvalidArgumentException |
| 387 | 387 | */ |
| 388 | - public function addFormActionArgs( $form_args = array() ) { |
|
| 389 | - if ( is_object( $form_args ) ) { |
|
| 388 | + public function addFormActionArgs($form_args = array()) { |
|
| 389 | + if (is_object($form_args)) { |
|
| 390 | 390 | throw new InvalidDataTypeException( |
| 391 | 391 | '$form_args', |
| 392 | 392 | $form_args, |
| 393 | 393 | 'anything other than an object was expected.' |
| 394 | 394 | ); |
| 395 | 395 | } |
| 396 | - if ( empty( $form_args ) ) { |
|
| 396 | + if (empty($form_args)) { |
|
| 397 | 397 | throw new InvalidArgumentException( |
| 398 | - __( 'The redirect arguments can not be an empty array.', 'event_espresso' ) |
|
| 398 | + __('The redirect arguments can not be an empty array.', 'event_espresso') |
|
| 399 | 399 | ); |
| 400 | 400 | } |
| 401 | - $this->form_args = array_merge( $this->form_args, $form_args ); |
|
| 401 | + $this->form_args = array_merge($this->form_args, $form_args); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * @param string $form_config |
| 417 | 417 | * @throws DomainException |
| 418 | 418 | */ |
| 419 | - public function setFormConfig( $form_config ) { |
|
| 419 | + public function setFormConfig($form_config) { |
|
| 420 | 420 | if ( |
| 421 | 421 | ! in_array( |
| 422 | 422 | $form_config, |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | ) { |
| 431 | 431 | throw new DomainException( |
| 432 | 432 | sprintf( |
| 433 | - __( '"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form', 'event_espresso' ), |
|
| 433 | + __('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form', 'event_espresso'), |
|
| 434 | 434 | $form_config |
| 435 | 435 | ) |
| 436 | 436 | ); |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * @return boolean |
| 451 | 451 | */ |
| 452 | 452 | public function initialize() { |
| 453 | - $this->form_has_errors = \EE_Error::has_error( true ); |
|
| 453 | + $this->form_has_errors = \EE_Error::has_error(true); |
|
| 454 | 454 | return true; |
| 455 | 455 | } |
| 456 | 456 | |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | * @throws \EE_Error |
| 465 | 465 | */ |
| 466 | 466 | public function enqueueStylesAndScripts() { |
| 467 | - $this->form( false )->enqueue_js(); |
|
| 467 | + $this->form(false)->enqueue_js(); |
|
| 468 | 468 | |
| 469 | 469 | } |
| 470 | 470 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | * |
| 476 | 476 | * @return EE_Form_Section_Proper |
| 477 | 477 | */ |
| 478 | - abstract public function generate() ; |
|
| 478 | + abstract public function generate(); |
|
| 479 | 479 | |
| 480 | 480 | |
| 481 | 481 | |
@@ -485,15 +485,15 @@ discard block |
||
| 485 | 485 | * @param string $text |
| 486 | 486 | * @return \EE_Submit_Input |
| 487 | 487 | */ |
| 488 | - public function generateSubmitButton( $text = '' ) { |
|
| 489 | - $text = ! empty( $text ) ? $text : $this->submitBtnText(); |
|
| 488 | + public function generateSubmitButton($text = '') { |
|
| 489 | + $text = ! empty($text) ? $text : $this->submitBtnText(); |
|
| 490 | 490 | return new EE_Submit_Input( |
| 491 | 491 | array( |
| 492 | - 'html_name' => 'ee-form-submit-' . $this->slug(), |
|
| 493 | - 'html_id' => 'ee-form-submit-' . $this->slug(), |
|
| 492 | + 'html_name' => 'ee-form-submit-'.$this->slug(), |
|
| 493 | + 'html_id' => 'ee-form-submit-'.$this->slug(), |
|
| 494 | 494 | 'html_class' => 'ee-form-submit', |
| 495 | 495 | 'html_label' => ' ', |
| 496 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
| 496 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
| 497 | 497 | 'default' => $text |
| 498 | 498 | ) |
| 499 | 499 | ); |
@@ -509,12 +509,12 @@ discard block |
||
| 509 | 509 | * @throws \LogicException |
| 510 | 510 | * @throws \EE_Error |
| 511 | 511 | */ |
| 512 | - public function appendSubmitButton( $text = '' ) { |
|
| 513 | - if ( $this->form->subsection_exists( $this->slug() . '-submit-btn' ) ) { |
|
| 512 | + public function appendSubmitButton($text = '') { |
|
| 513 | + if ($this->form->subsection_exists($this->slug().'-submit-btn')) { |
|
| 514 | 514 | return; |
| 515 | 515 | } |
| 516 | 516 | $this->form->add_subsections( |
| 517 | - array( $this->slug() . '-submit-btn' => $this->generateSubmitButton( $text ) ), |
|
| 517 | + array($this->slug().'-submit-btn' => $this->generateSubmitButton($text)), |
|
| 518 | 518 | null, |
| 519 | 519 | false |
| 520 | 520 | ); |
@@ -528,18 +528,18 @@ discard block |
||
| 528 | 528 | * @param string $text |
| 529 | 529 | * @return \EE_Submit_Input |
| 530 | 530 | */ |
| 531 | - public function generateCancelButton( $text = '' ) { |
|
| 531 | + public function generateCancelButton($text = '') { |
|
| 532 | 532 | $cancel_button = new EE_Submit_Input( |
| 533 | 533 | array( |
| 534 | - 'html_name' => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!! |
|
| 535 | - 'html_id' => 'ee-cancel-form-' . $this->slug(), |
|
| 534 | + 'html_name' => 'ee-form-submit-'.$this->slug(), // YES! Same name as submit !!! |
|
| 535 | + 'html_id' => 'ee-cancel-form-'.$this->slug(), |
|
| 536 | 536 | 'html_class' => 'ee-cancel-form', |
| 537 | 537 | 'html_label' => ' ', |
| 538 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
| 539 | - 'default' => ! empty( $text ) ? $text : __( 'Cancel', 'event_espresso' ) |
|
| 538 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
| 539 | + 'default' => ! empty($text) ? $text : __('Cancel', 'event_espresso') |
|
| 540 | 540 | ) |
| 541 | 541 | ); |
| 542 | - $cancel_button->set_button_css_attributes( false ); |
|
| 542 | + $cancel_button->set_button_css_attributes(false); |
|
| 543 | 543 | return $cancel_button; |
| 544 | 544 | } |
| 545 | 545 | |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | $this->form->add_subsections( |
| 556 | 556 | array( |
| 557 | 557 | 'clear-submit-btn-float' => new \EE_Form_Section_HTML( |
| 558 | - EEH_HTML::div( '', '', 'clear-float' ) . EEH_HTML::divx() |
|
| 558 | + EEH_HTML::div('', '', 'clear-float').EEH_HTML::divx() |
|
| 559 | 559 | ) |
| 560 | 560 | ), |
| 561 | 561 | null, |
@@ -583,9 +583,9 @@ discard block |
||
| 583 | 583 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
| 584 | 584 | || $form_config === FormHandler::ADD_FORM_TAGS_ONLY |
| 585 | 585 | ) { |
| 586 | - $form_html .= $this->form()->form_open( $this->formAction() ); |
|
| 586 | + $form_html .= $this->form()->form_open($this->formAction()); |
|
| 587 | 587 | } |
| 588 | - $form_html .= $this->form( true )->get_html( $this->form_has_errors ); |
|
| 588 | + $form_html .= $this->form(true)->get_html($this->form_has_errors); |
|
| 589 | 589 | if ( |
| 590 | 590 | $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT |
| 591 | 591 | || $form_config === FormHandler::ADD_FORM_TAGS_ONLY |
@@ -611,12 +611,12 @@ discard block |
||
| 611 | 611 | * @throws \LogicException |
| 612 | 612 | * @throws InvalidFormSubmissionException |
| 613 | 613 | */ |
| 614 | - public function process( $submitted_form_data = array() ) { |
|
| 615 | - if ( ! $this->form()->was_submitted( $submitted_form_data ) ) { |
|
| 616 | - throw new InvalidFormSubmissionException( $this->form_name ); |
|
| 614 | + public function process($submitted_form_data = array()) { |
|
| 615 | + if ( ! $this->form()->was_submitted($submitted_form_data)) { |
|
| 616 | + throw new InvalidFormSubmissionException($this->form_name); |
|
| 617 | 617 | } |
| 618 | - $this->form( true )->receive_form_submission( $submitted_form_data ); |
|
| 619 | - if ( ! $this->form()->is_valid() ) { |
|
| 618 | + $this->form(true)->receive_form_submission($submitted_form_data); |
|
| 619 | + if ( ! $this->form()->is_valid()) { |
|
| 620 | 620 | throw new InvalidFormSubmissionException( |
| 621 | 621 | $this->form_name, |
| 622 | 622 | sprintf( |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 2 | - exit('No direct script access allowed'); |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | |
| 5 | 5 | |
@@ -15,231 +15,231 @@ discard block |
||
| 15 | 15 | class EE_Request |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @access private |
|
| 20 | - * @var array $_get $_GET parameters |
|
| 21 | - */ |
|
| 22 | - private $_get = array(); |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @access private |
|
| 26 | - * @var array $_post $_POST parameters |
|
| 27 | - */ |
|
| 28 | - private $_post = array(); |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @access private |
|
| 32 | - * @var array $_cookie $_COOKIE parameters |
|
| 33 | - */ |
|
| 34 | - private $_cookie = array(); |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @access private |
|
| 38 | - * @var array $_params $_REQUEST parameters |
|
| 39 | - */ |
|
| 40 | - private $_params = array(); |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * whether current request is via AJAX |
|
| 44 | - * |
|
| 45 | - * @var boolean |
|
| 46 | - * @access public |
|
| 47 | - */ |
|
| 48 | - public $ajax = false; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * whether current request is via AJAX from the frontend of the site |
|
| 52 | - * |
|
| 53 | - * @var boolean |
|
| 54 | - * @access public |
|
| 55 | - */ |
|
| 56 | - public $front_ajax = false; |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * IP address for request |
|
| 60 | - * |
|
| 61 | - * @var string $_ip_address |
|
| 62 | - */ |
|
| 63 | - private $_ip_address = ''; |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * class constructor |
|
| 69 | - * |
|
| 70 | - * @access public |
|
| 71 | - * @param array $get |
|
| 72 | - * @param array $post |
|
| 73 | - * @param array $cookie |
|
| 74 | - */ |
|
| 75 | - public function __construct($get, $post, $cookie) |
|
| 76 | - { |
|
| 77 | - // grab request vars |
|
| 78 | - $this->_get = (array)$get; |
|
| 79 | - $this->_post = (array)$post; |
|
| 80 | - $this->_cookie = (array)$cookie; |
|
| 81 | - $this->_params = array_merge($this->_get, $this->_post); |
|
| 82 | - // AJAX ??? |
|
| 83 | - $this->ajax = defined('DOING_AJAX') ? true : false; |
|
| 84 | - $this->front_ajax = $this->is_set('ee_front_ajax') && (int)$this->get('ee_front_ajax') === 1; |
|
| 85 | - // grab user IP |
|
| 86 | - $this->_ip_address = $this->_visitor_ip(); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * @return array |
|
| 93 | - */ |
|
| 94 | - public function get_params() |
|
| 95 | - { |
|
| 96 | - return $this->_get; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * @return array |
|
| 103 | - */ |
|
| 104 | - public function post_params() |
|
| 105 | - { |
|
| 106 | - return $this->_post; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @return array |
|
| 113 | - */ |
|
| 114 | - public function cookie_params() |
|
| 115 | - { |
|
| 116 | - return $this->_cookie; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * returns contents of $_REQUEST |
|
| 123 | - * |
|
| 124 | - * @return array |
|
| 125 | - */ |
|
| 126 | - public function params() |
|
| 127 | - { |
|
| 128 | - return $this->_params; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * setter |
|
| 135 | - * |
|
| 136 | - * @access public |
|
| 137 | - * @param $key |
|
| 138 | - * @param $value |
|
| 139 | - * @param bool $override_ee |
|
| 140 | - * @return void |
|
| 141 | - */ |
|
| 142 | - public function set($key, $value, $override_ee = false) |
|
| 143 | - { |
|
| 144 | - // don't allow "ee" to be overwritten unless explicitly instructed to do so |
|
| 145 | - if ( |
|
| 146 | - $key !== 'ee' |
|
| 147 | - || ($key === 'ee' && empty($this->_params['ee'])) |
|
| 148 | - || ($key === 'ee' && ! empty($this->_params['ee']) && $override_ee) |
|
| 149 | - ) { |
|
| 150 | - $this->_params[$key] = $value; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * getter |
|
| 158 | - * |
|
| 159 | - * @access public |
|
| 160 | - * @param $key |
|
| 161 | - * @param null $default |
|
| 162 | - * @return mixed |
|
| 163 | - */ |
|
| 164 | - public function get($key, $default = null) |
|
| 165 | - { |
|
| 166 | - return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * check if param exists |
|
| 173 | - * |
|
| 174 | - * @access public |
|
| 175 | - * @param $key |
|
| 176 | - * @return boolean |
|
| 177 | - */ |
|
| 178 | - public function is_set($key) |
|
| 179 | - { |
|
| 180 | - return isset($this->_params[$key]) ? true : false; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * remove param |
|
| 187 | - * |
|
| 188 | - * @access public |
|
| 189 | - * @param $key |
|
| 190 | - * @param bool $unset_from_global_too |
|
| 191 | - */ |
|
| 192 | - public function un_set($key, $unset_from_global_too = false) |
|
| 193 | - { |
|
| 194 | - unset($this->_params[$key]); |
|
| 195 | - if ($unset_from_global_too) { |
|
| 196 | - unset($_REQUEST[$key]); |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 205 | - public function ip_address() |
|
| 206 | - { |
|
| 207 | - return $this->_ip_address; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * _visitor_ip |
|
| 214 | - * attempt to get IP address of current visitor from server |
|
| 215 | - * plz see: http://stackoverflow.com/a/2031935/1475279 |
|
| 216 | - * |
|
| 217 | - * @access public |
|
| 218 | - * @return string |
|
| 219 | - */ |
|
| 220 | - private function _visitor_ip() |
|
| 221 | - { |
|
| 222 | - $visitor_ip = '0.0.0.0'; |
|
| 223 | - $server_keys = array( |
|
| 224 | - 'HTTP_CLIENT_IP', |
|
| 225 | - 'HTTP_X_FORWARDED_FOR', |
|
| 226 | - 'HTTP_X_FORWARDED', |
|
| 227 | - 'HTTP_X_CLUSTER_CLIENT_IP', |
|
| 228 | - 'HTTP_FORWARDED_FOR', |
|
| 229 | - 'HTTP_FORWARDED', |
|
| 230 | - 'REMOTE_ADDR', |
|
| 231 | - ); |
|
| 232 | - foreach ($server_keys as $key) { |
|
| 233 | - if (isset($_SERVER[$key])) { |
|
| 234 | - foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { |
|
| 235 | - if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== false) { |
|
| 236 | - $visitor_ip = $ip; |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - } |
|
| 240 | - } |
|
| 241 | - return $visitor_ip; |
|
| 242 | - } |
|
| 18 | + /** |
|
| 19 | + * @access private |
|
| 20 | + * @var array $_get $_GET parameters |
|
| 21 | + */ |
|
| 22 | + private $_get = array(); |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @access private |
|
| 26 | + * @var array $_post $_POST parameters |
|
| 27 | + */ |
|
| 28 | + private $_post = array(); |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @access private |
|
| 32 | + * @var array $_cookie $_COOKIE parameters |
|
| 33 | + */ |
|
| 34 | + private $_cookie = array(); |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @access private |
|
| 38 | + * @var array $_params $_REQUEST parameters |
|
| 39 | + */ |
|
| 40 | + private $_params = array(); |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * whether current request is via AJAX |
|
| 44 | + * |
|
| 45 | + * @var boolean |
|
| 46 | + * @access public |
|
| 47 | + */ |
|
| 48 | + public $ajax = false; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * whether current request is via AJAX from the frontend of the site |
|
| 52 | + * |
|
| 53 | + * @var boolean |
|
| 54 | + * @access public |
|
| 55 | + */ |
|
| 56 | + public $front_ajax = false; |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * IP address for request |
|
| 60 | + * |
|
| 61 | + * @var string $_ip_address |
|
| 62 | + */ |
|
| 63 | + private $_ip_address = ''; |
|
| 64 | + |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * class constructor |
|
| 69 | + * |
|
| 70 | + * @access public |
|
| 71 | + * @param array $get |
|
| 72 | + * @param array $post |
|
| 73 | + * @param array $cookie |
|
| 74 | + */ |
|
| 75 | + public function __construct($get, $post, $cookie) |
|
| 76 | + { |
|
| 77 | + // grab request vars |
|
| 78 | + $this->_get = (array)$get; |
|
| 79 | + $this->_post = (array)$post; |
|
| 80 | + $this->_cookie = (array)$cookie; |
|
| 81 | + $this->_params = array_merge($this->_get, $this->_post); |
|
| 82 | + // AJAX ??? |
|
| 83 | + $this->ajax = defined('DOING_AJAX') ? true : false; |
|
| 84 | + $this->front_ajax = $this->is_set('ee_front_ajax') && (int)$this->get('ee_front_ajax') === 1; |
|
| 85 | + // grab user IP |
|
| 86 | + $this->_ip_address = $this->_visitor_ip(); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * @return array |
|
| 93 | + */ |
|
| 94 | + public function get_params() |
|
| 95 | + { |
|
| 96 | + return $this->_get; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * @return array |
|
| 103 | + */ |
|
| 104 | + public function post_params() |
|
| 105 | + { |
|
| 106 | + return $this->_post; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @return array |
|
| 113 | + */ |
|
| 114 | + public function cookie_params() |
|
| 115 | + { |
|
| 116 | + return $this->_cookie; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * returns contents of $_REQUEST |
|
| 123 | + * |
|
| 124 | + * @return array |
|
| 125 | + */ |
|
| 126 | + public function params() |
|
| 127 | + { |
|
| 128 | + return $this->_params; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * setter |
|
| 135 | + * |
|
| 136 | + * @access public |
|
| 137 | + * @param $key |
|
| 138 | + * @param $value |
|
| 139 | + * @param bool $override_ee |
|
| 140 | + * @return void |
|
| 141 | + */ |
|
| 142 | + public function set($key, $value, $override_ee = false) |
|
| 143 | + { |
|
| 144 | + // don't allow "ee" to be overwritten unless explicitly instructed to do so |
|
| 145 | + if ( |
|
| 146 | + $key !== 'ee' |
|
| 147 | + || ($key === 'ee' && empty($this->_params['ee'])) |
|
| 148 | + || ($key === 'ee' && ! empty($this->_params['ee']) && $override_ee) |
|
| 149 | + ) { |
|
| 150 | + $this->_params[$key] = $value; |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * getter |
|
| 158 | + * |
|
| 159 | + * @access public |
|
| 160 | + * @param $key |
|
| 161 | + * @param null $default |
|
| 162 | + * @return mixed |
|
| 163 | + */ |
|
| 164 | + public function get($key, $default = null) |
|
| 165 | + { |
|
| 166 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * check if param exists |
|
| 173 | + * |
|
| 174 | + * @access public |
|
| 175 | + * @param $key |
|
| 176 | + * @return boolean |
|
| 177 | + */ |
|
| 178 | + public function is_set($key) |
|
| 179 | + { |
|
| 180 | + return isset($this->_params[$key]) ? true : false; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * remove param |
|
| 187 | + * |
|
| 188 | + * @access public |
|
| 189 | + * @param $key |
|
| 190 | + * @param bool $unset_from_global_too |
|
| 191 | + */ |
|
| 192 | + public function un_set($key, $unset_from_global_too = false) |
|
| 193 | + { |
|
| 194 | + unset($this->_params[$key]); |
|
| 195 | + if ($unset_from_global_too) { |
|
| 196 | + unset($_REQUEST[$key]); |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | + public function ip_address() |
|
| 206 | + { |
|
| 207 | + return $this->_ip_address; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * _visitor_ip |
|
| 214 | + * attempt to get IP address of current visitor from server |
|
| 215 | + * plz see: http://stackoverflow.com/a/2031935/1475279 |
|
| 216 | + * |
|
| 217 | + * @access public |
|
| 218 | + * @return string |
|
| 219 | + */ |
|
| 220 | + private function _visitor_ip() |
|
| 221 | + { |
|
| 222 | + $visitor_ip = '0.0.0.0'; |
|
| 223 | + $server_keys = array( |
|
| 224 | + 'HTTP_CLIENT_IP', |
|
| 225 | + 'HTTP_X_FORWARDED_FOR', |
|
| 226 | + 'HTTP_X_FORWARDED', |
|
| 227 | + 'HTTP_X_CLUSTER_CLIENT_IP', |
|
| 228 | + 'HTTP_FORWARDED_FOR', |
|
| 229 | + 'HTTP_FORWARDED', |
|
| 230 | + 'REMOTE_ADDR', |
|
| 231 | + ); |
|
| 232 | + foreach ($server_keys as $key) { |
|
| 233 | + if (isset($_SERVER[$key])) { |
|
| 234 | + foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { |
|
| 235 | + if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== false) { |
|
| 236 | + $visitor_ip = $ip; |
|
| 237 | + } |
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | + return $visitor_ip; |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | |
@@ -75,13 +75,13 @@ |
||
| 75 | 75 | public function __construct($get, $post, $cookie) |
| 76 | 76 | { |
| 77 | 77 | // grab request vars |
| 78 | - $this->_get = (array)$get; |
|
| 79 | - $this->_post = (array)$post; |
|
| 80 | - $this->_cookie = (array)$cookie; |
|
| 78 | + $this->_get = (array) $get; |
|
| 79 | + $this->_post = (array) $post; |
|
| 80 | + $this->_cookie = (array) $cookie; |
|
| 81 | 81 | $this->_params = array_merge($this->_get, $this->_post); |
| 82 | 82 | // AJAX ??? |
| 83 | 83 | $this->ajax = defined('DOING_AJAX') ? true : false; |
| 84 | - $this->front_ajax = $this->is_set('ee_front_ajax') && (int)$this->get('ee_front_ajax') === 1; |
|
| 84 | + $this->front_ajax = $this->is_set('ee_front_ajax') && (int) $this->get('ee_front_ajax') === 1; |
|
| 85 | 85 | // grab user IP |
| 86 | 86 | $this->_ip_address = $this->_visitor_ip(); |
| 87 | 87 | } |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
| 3 | 3 | |
| 4 | -if ( is_single() || ( is_archive() && espresso_display_datetimes_in_event_list() ) ) : |
|
| 4 | +if (is_single() || (is_archive() && espresso_display_datetimes_in_event_list())) : |
|
| 5 | 5 | global $post; |
| 6 | -do_action( 'AHEE_event_details_before_event_date', $post ); |
|
| 6 | +do_action('AHEE_event_details_before_event_date', $post); |
|
| 7 | 7 | ?> |
| 8 | 8 | <div class="event-datetimes"> |
| 9 | - <?php espresso_list_of_event_dates( $post->ID );?> |
|
| 9 | + <?php espresso_list_of_event_dates($post->ID); ?> |
|
| 10 | 10 | </div> |
| 11 | 11 | <!-- .event-datetimes --> |
| 12 | 12 | <?php |
| 13 | -do_action( 'AHEE_event_details_after_event_date', $post ); |
|
| 13 | +do_action('AHEE_event_details_after_event_date', $post); |
|
| 14 | 14 | endif; |
| 15 | 15 | ?> |
| 16 | 16 | \ No newline at end of file |