@@ -5,7 +5,9 @@ |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.5.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Use this to register or deregister a new message template pack variation for the EE messages system. |
@@ -51,26 +51,26 @@ |
||
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
54 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
55 | 55 | |
56 | 56 | //use the registration to get the transaction. |
57 | 57 | $transaction = $registration->transaction(); |
58 | 58 | |
59 | 59 | //bail early if no transaction |
60 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
61 | - throw new EE_Error( __('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso' ) ); |
|
60 | + if ( ! $transaction instanceof EE_Transaction) { |
|
61 | + throw new EE_Error(__('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso')); |
|
62 | 62 | } |
63 | 63 | |
64 | - $payment = ! empty( $id ) ? EEM_Payment::instance()->get_one( array( array( 'PAY_ID' => $id, 'TXN_ID' => $transaction->ID() ) ) ) : 0; |
|
64 | + $payment = ! empty($id) ? EEM_Payment::instance()->get_one(array(array('PAY_ID' => $id, 'TXN_ID' => $transaction->ID()))) : 0; |
|
65 | 65 | |
66 | - return array( $transaction, $payment ); |
|
66 | + return array($transaction, $payment); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - protected function _get_admin_content_events_edit_for_messenger( EE_messenger $messenger ) { |
|
71 | + protected function _get_admin_content_events_edit_for_messenger(EE_messenger $messenger) { |
|
72 | 72 | //this is just a test |
73 | - return $this->name . ' Message Type for ' . $messenger->name . ' Messenger '; |
|
73 | + return $this->name.' Message Type for '.$messenger->name.' Messenger '; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * For the constructor of this special preview class. We're either looking for an event id or empty data. If we have an event id (or ids) then we'll use that as the source for the "dummy" data. If the data is empty then we'll get the first three published events from the users database and use that as a source. |
30 | 30 | * @param array $data |
31 | 31 | */ |
32 | - public function __construct( $data = array() ) { |
|
33 | - $this->_data = isset( $data['event_ids'] ) ? $data['event_ids'] : array(); |
|
32 | + public function __construct($data = array()) { |
|
33 | + $this->_data = isset($data['event_ids']) ? $data['event_ids'] : array(); |
|
34 | 34 | $this->_setup_attendees_events(); |
35 | 35 | parent::__construct($data); |
36 | 36 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The prepped data for db |
48 | 48 | */ |
49 | - static public function convert_data_for_persistent_storage( $data ) { |
|
49 | + static public function convert_data_for_persistent_storage($data) { |
|
50 | 50 | return $data; |
51 | 51 | } |
52 | 52 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return array |
63 | 63 | */ |
64 | - static public function convert_data_from_persistent_storage( $data ) { |
|
64 | + static public function convert_data_from_persistent_storage($data) { |
|
65 | 65 | return $data; |
66 | 66 | } |
67 | 67 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $attendees = $this->_get_some_attendees(); |
79 | 79 | |
80 | 80 | //if empty $data we'll do a query to get some events from the server. otherwise we'll retrieve the event data for the given ids. |
81 | - $events = $this->_get_some_events( $this->_data ); |
|
81 | + $events = $this->_get_some_events($this->_data); |
|
82 | 82 | |
83 | 83 | $answers_n_questions = $this->_get_some_q_and_as(); |
84 | 84 | |
85 | - if ( count( $events ) < 1 ) { |
|
86 | - throw new EE_Error( __('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso' ) ); |
|
85 | + if (count($events) < 1) { |
|
86 | + throw new EE_Error(__('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | |
94 | 94 | //we'll actually use the generated line_item identifiers for our loop |
95 | 95 | $dtts = $tkts = array(); |
96 | - foreach( $events as $id => $event ) { |
|
97 | - if ( ! $event instanceof EE_Event ) { |
|
96 | + foreach ($events as $id => $event) { |
|
97 | + if ( ! $event instanceof EE_Event) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | $this->_events[$id]['ID'] = $id; |
101 | 101 | $this->_events[$id]['name'] = $event->get('EVT_name'); |
102 | 102 | $datetime = $event->get_first_related('Datetime'); |
103 | - $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none') ) : array(); |
|
103 | + $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none')) : array(); |
|
104 | 104 | $this->_events[$id]['event'] = $event; |
105 | 105 | $this->_events[$id]['reg_objs'] = array(); |
106 | 106 | $this->_events[$id]['tkt_objs'] = $tickets; |
@@ -108,51 +108,51 @@ discard block |
||
108 | 108 | |
109 | 109 | $dttcache = array(); |
110 | 110 | $tkts = array(); |
111 | - foreach ( $tickets as $ticket ) { |
|
112 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
111 | + foreach ($tickets as $ticket) { |
|
112 | + if ( ! $ticket instanceof EE_Ticket) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | $reldatetime = $ticket->datetimes(); |
116 | - $tkts[ $ticket->ID() ] = array(); |
|
117 | - $tkts[ $ticket->ID() ][ 'ticket' ] = $ticket; |
|
118 | - $tkts[ $ticket->ID() ][ 'dtt_objs' ] = $reldatetime; |
|
119 | - $tkts[ $ticket->ID() ][ 'att_objs' ] = $attendees; |
|
120 | - $tkts[ $ticket->ID() ][ 'count' ] = count( $attendees ); |
|
121 | - $tkts[ $ticket->ID() ][ 'EE_Event' ] = $event; |
|
122 | - foreach ( $reldatetime as $datetime ) { |
|
123 | - if ( $datetime instanceof EE_Datetime && ! isset( $dtts[ $datetime->ID() ] ) ) { |
|
124 | - $this->_events[ $id ][ 'dtt_objs' ][ $datetime->ID() ] = $datetime; |
|
125 | - $dtts[ $datetime->ID() ][ 'datetime' ] = $datetime; |
|
126 | - $dtts[ $datetime->ID() ][ 'tkt_objs' ][] = $ticket; |
|
127 | - $dtts[ $datetime->ID() ][ 'evt_objs' ][] = $event; |
|
128 | - $dttcache[ $datetime->ID() ] = $datetime; |
|
116 | + $tkts[$ticket->ID()] = array(); |
|
117 | + $tkts[$ticket->ID()]['ticket'] = $ticket; |
|
118 | + $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime; |
|
119 | + $tkts[$ticket->ID()]['att_objs'] = $attendees; |
|
120 | + $tkts[$ticket->ID()]['count'] = count($attendees); |
|
121 | + $tkts[$ticket->ID()]['EE_Event'] = $event; |
|
122 | + foreach ($reldatetime as $datetime) { |
|
123 | + if ($datetime instanceof EE_Datetime && ! isset($dtts[$datetime->ID()])) { |
|
124 | + $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime; |
|
125 | + $dtts[$datetime->ID()]['datetime'] = $datetime; |
|
126 | + $dtts[$datetime->ID()]['tkt_objs'][] = $ticket; |
|
127 | + $dtts[$datetime->ID()]['evt_objs'][] = $event; |
|
128 | + $dttcache[$datetime->ID()] = $datetime; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - $this->_events[$id]['total_attendees'] = count( $attendees ); |
|
133 | + $this->_events[$id]['total_attendees'] = count($attendees); |
|
134 | 134 | $this->_events[$id]['att_objs'] = $attendees; |
135 | 135 | |
136 | 136 | //let's also setup the dummy attendees property! |
137 | - foreach ( $attendees as $att_key => $attendee ) { |
|
138 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
137 | + foreach ($attendees as $att_key => $attendee) { |
|
138 | + if ( ! $attendee instanceof EE_Attendee) { |
|
139 | 139 | continue; |
140 | 140 | } |
141 | - $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
141 | + $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
142 | 142 | $this->_attendees[$att_key]['evt_objs'][] = $event; |
143 | 143 | $this->_attendees[$att_key]['att_obj'] = $attendee; |
144 | 144 | //$this->_attendees[$att_key]['registration_id'] = 0; |
145 | 145 | $this->_attendees[$att_key]['attendee_email'] = $attendee->email(); |
146 | 146 | $this->_attendees[$att_key]['tkt_objs'] = $tickets; |
147 | - if ( $att_key == 999999991 ) { |
|
147 | + if ($att_key == 999999991) { |
|
148 | 148 | $this->_attendees[$att_key]['ans_objs'][999] = $answers_n_questions['answers'][999]; |
149 | 149 | $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002]; |
150 | 150 | $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005]; |
151 | - } elseif ( $att_key == 999999992 ) { |
|
151 | + } elseif ($att_key == 999999992) { |
|
152 | 152 | $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000]; |
153 | 153 | $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003]; |
154 | 154 | $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006]; |
155 | - } elseif ( $att_key == 999999993 ) { |
|
155 | + } elseif ($att_key == 999999993) { |
|
156 | 156 | $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001]; |
157 | 157 | $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004]; |
158 | 158 | $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007]; |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | |
226 | 226 | //let's generate the attendee objects |
227 | 227 | $attendees = array(); |
228 | - $var_array = array('fname','lname','email','address','address2','city','staid','cntry','zip','phone','deleted','attid'); |
|
228 | + $var_array = array('fname', 'lname', 'email', 'address', 'address2', 'city', 'staid', 'cntry', 'zip', 'phone', 'deleted', 'attid'); |
|
229 | 229 | |
230 | 230 | //EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE ); |
231 | - foreach ( $dummy_attendees as $dummy ) { |
|
232 | - $att = array_combine( $var_array, $dummy ); |
|
231 | + foreach ($dummy_attendees as $dummy) { |
|
232 | + $att = array_combine($var_array, $dummy); |
|
233 | 233 | extract($att); |
234 | 234 | /** @var $fname string */ |
235 | 235 | /** @var $lname string */ |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | |
347 | 347 | $qsts = array(); |
348 | 348 | //first the questions |
349 | - foreach ( $quests_array as $qst ) { |
|
350 | - $qstobj = array_combine( $qst_columns, $qst ); |
|
349 | + foreach ($quests_array as $qst) { |
|
350 | + $qstobj = array_combine($qst_columns, $qst); |
|
351 | 351 | $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj); |
352 | 352 | } |
353 | 353 | |
354 | 354 | //now the answers (and we'll setup our arrays) |
355 | 355 | $q_n_as = array(); |
356 | - foreach ( $ans_array as $ans ) { |
|
357 | - $ansobj = array_combine( $ans_columns, $ans ); |
|
356 | + foreach ($ans_array as $ans) { |
|
357 | + $ansobj = array_combine($ans_columns, $ans); |
|
358 | 358 | $ansobj = EE_Answer::new_instance($ansobj); |
359 | 359 | $q_n_as['answers'][$ansobj->ID()] = $ansobj; |
360 | 360 | $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')]; |
@@ -376,25 +376,25 @@ discard block |
||
376 | 376 | * @param array $event_ids if set, this will be an array of event ids to obtain events for. |
377 | 377 | * @return array An array of event objects from the db. |
378 | 378 | */ |
379 | - private function _get_some_events( $event_ids = array() ) { |
|
379 | + private function _get_some_events($event_ids = array()) { |
|
380 | 380 | |
381 | 381 | //HEY, if we have an evt_id then we want to make sure we use that for the preview (because a specific event template is being viewed); |
382 | - $event_ids = isset( $_REQUEST['evt_id'] ) && !empty( $_REQUEST['evt_id'] ) |
|
383 | - ? array( $_REQUEST['evt_id'] ) |
|
382 | + $event_ids = isset($_REQUEST['evt_id']) && ! empty($_REQUEST['evt_id']) |
|
383 | + ? array($_REQUEST['evt_id']) |
|
384 | 384 | : $event_ids; |
385 | 385 | |
386 | - $limit = !empty( $event_ids ) |
|
386 | + $limit = ! empty($event_ids) |
|
387 | 387 | ? NULL |
388 | - : apply_filters( 'FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1' ); |
|
388 | + : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1'); |
|
389 | 389 | |
390 | - $where = ! empty( $event_ids ) |
|
390 | + $where = ! empty($event_ids) |
|
391 | 391 | ? array( |
392 | - 'EVT_ID' => array( 'IN', $event_ids ), |
|
393 | - 'Datetime.Ticket.TKT_ID' => array( '>', 1 ) |
|
392 | + 'EVT_ID' => array('IN', $event_ids), |
|
393 | + 'Datetime.Ticket.TKT_ID' => array('>', 1) |
|
394 | 394 | ) |
395 | - : array( 'Datetime.Ticket.TKT_ID' => array( '>', 1 ) ); |
|
395 | + : array('Datetime.Ticket.TKT_ID' => array('>', 1)); |
|
396 | 396 | |
397 | - $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit ) ); |
|
397 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit)); |
|
398 | 398 | |
399 | 399 | return $events; |
400 | 400 | } |
@@ -407,17 +407,17 @@ discard block |
||
407 | 407 | protected function _setup_data() { |
408 | 408 | |
409 | 409 | //need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it! |
410 | - if ( EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
411 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
410 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
411 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
412 | 412 | $session = EE_Registry::instance()->SSN; |
413 | 413 | } else { |
414 | - $session = EE_Registry::instance()->load_core( 'Session' ); |
|
414 | + $session = EE_Registry::instance()->load_core('Session'); |
|
415 | 415 | } |
416 | - $cart = EE_Cart::instance( null, $session ); |
|
416 | + $cart = EE_Cart::instance(null, $session); |
|
417 | 417 | |
418 | 418 | |
419 | 419 | //add tickets to cart |
420 | - foreach ( $this->tickets as $ticket ) { |
|
420 | + foreach ($this->tickets as $ticket) { |
|
421 | 421 | $cart->add_ticket_to_cart($ticket['ticket']); |
422 | 422 | } |
423 | 423 | |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | //note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array. |
442 | 442 | $this->reg_objs = array(); |
443 | 443 | $regid = 9999990; |
444 | - foreach ( $this->_attendees as $key => $attendee ) { |
|
444 | + foreach ($this->_attendees as $key => $attendee) { |
|
445 | 445 | //note we need to setup reg_objects for each event this attendee belongs to |
446 | 446 | $regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null; |
447 | 447 | $regtxn = $this->txn->ID(); |
448 | 448 | $regcnt = 1; |
449 | - foreach ( $attendee['line_ref'] as $evtid ) { |
|
450 | - foreach ( $this->_events[$evtid]['tkt_objs'] as $ticket ) { |
|
451 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
449 | + foreach ($attendee['line_ref'] as $evtid) { |
|
450 | + foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) { |
|
451 | + if ( ! $ticket instanceof EE_Ticket) { |
|
452 | 452 | continue; |
453 | 453 | } |
454 | 454 | $reg_array = array( |
@@ -460,14 +460,14 @@ discard block |
||
460 | 460 | 'REG_date' => time(), |
461 | 461 | 'REG_final_price' => $ticket->get('TKT_price'), |
462 | 462 | 'REG_session' => 'dummy_session_id', |
463 | - 'REG_code' => $regid . '-dummy-generated-code', |
|
464 | - 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
463 | + 'REG_code' => $regid.'-dummy-generated-code', |
|
464 | + 'REG_url_link' => $regcnt.'-daafpapasdlfakasdfpqasdfasdf', |
|
465 | 465 | 'REG_count' => $regcnt, |
466 | 466 | 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
467 | 467 | 'REG_att_is_going' => TRUE, |
468 | 468 | 'REG_ID' => $regid |
469 | 469 | ); |
470 | - $REG_OBJ = EE_Registration::new_instance( $reg_array ); |
|
470 | + $REG_OBJ = EE_Registration::new_instance($reg_array); |
|
471 | 471 | $this->_attendees[$key]['reg_objs'][$regid] = $REG_OBJ; |
472 | 472 | $this->_events[$evtid]['reg_objs'][] = $REG_OBJ; |
473 | 473 | $this->reg_objs[] = $REG_OBJ; |
@@ -483,40 +483,40 @@ discard block |
||
483 | 483 | |
484 | 484 | //setup line items! |
485 | 485 | EE_Registry::instance()->load_helper('Line_Item'); |
486 | - $line_item_total = EEH_Line_Item::create_total_line_item( $this->txn ); |
|
486 | + $line_item_total = EEH_Line_Item::create_total_line_item($this->txn); |
|
487 | 487 | |
488 | 488 | //add tickets |
489 | - foreach ( $this->tickets as $tktid => $item ) { |
|
489 | + foreach ($this->tickets as $tktid => $item) { |
|
490 | 490 | $qty = $item['count']; |
491 | 491 | $ticket = $item['ticket']; |
492 | - EEH_Line_Item::add_ticket_purchase( $line_item_total, $ticket, $qty ); |
|
492 | + EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty); |
|
493 | 493 | } |
494 | 494 | |
495 | - $shipping_line_item = EE_Line_Item::new_instance( array( |
|
496 | - 'LIN_name' => __( 'Shipping Surcharge', 'event_espresso' ), |
|
497 | - 'LIN_desc' => __( 'Sent via Millenium Falcon', 'event_espresso' ), |
|
495 | + $shipping_line_item = EE_Line_Item::new_instance(array( |
|
496 | + 'LIN_name' => __('Shipping Surcharge', 'event_espresso'), |
|
497 | + 'LIN_desc' => __('Sent via Millenium Falcon', 'event_espresso'), |
|
498 | 498 | 'LIN_unit_price' => 20, |
499 | 499 | 'LIN_quantity' => 1, |
500 | 500 | 'LIN_is_taxable' => TRUE, |
501 | 501 | 'LIN_total' => 20, |
502 | 502 | 'LIN_type' => EEM_Line_Item::type_line_item |
503 | 503 | )); |
504 | - EEH_Line_Item::add_item($line_item_total, $shipping_line_item ); |
|
505 | - $this->additional_line_items = array( $shipping_line_item ); |
|
504 | + EEH_Line_Item::add_item($line_item_total, $shipping_line_item); |
|
505 | + $this->additional_line_items = array($shipping_line_item); |
|
506 | 506 | |
507 | 507 | //now let's add taxes |
508 | - EEH_Line_Item::apply_taxes( $line_item_total ); |
|
508 | + EEH_Line_Item::apply_taxes($line_item_total); |
|
509 | 509 | |
510 | 510 | //now we should be able to get the items we need from this object |
511 | - $event_line_items = EEH_Line_Item::get_pre_tax_subtotal( $line_item_total )->children(); |
|
511 | + $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children(); |
|
512 | 512 | $line_items = array(); |
513 | - foreach ( $event_line_items as $line_id => $line_item ) { |
|
514 | - if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event' ) { |
|
513 | + foreach ($event_line_items as $line_id => $line_item) { |
|
514 | + if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') { |
|
515 | 515 | continue; |
516 | 516 | } |
517 | - $ticket_line_items = EEH_Line_Item::get_ticket_line_items( $line_item ); |
|
518 | - foreach ( $ticket_line_items as $ticket_line_id => $ticket_line_item ) { |
|
519 | - if ( ! $ticket_line_item instanceof EE_Line_Item ) { |
|
517 | + $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item); |
|
518 | + foreach ($ticket_line_items as $ticket_line_id => $ticket_line_item) { |
|
519 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | $this->tickets[$ticket_line_item->OBJ_ID()]['line_item'] = $ticket_line_item; |
@@ -532,12 +532,12 @@ discard block |
||
532 | 532 | //add proper total to transaction object. |
533 | 533 | $grand_total = $line_item_total->recalculate_total_including_taxes(); |
534 | 534 | $this->grand_total_line_item = $line_item_total; |
535 | - $this->txn->set_total( $grand_total ); |
|
535 | + $this->txn->set_total($grand_total); |
|
536 | 536 | |
537 | 537 | |
538 | 538 | //add additional details for each registration |
539 | - foreach ( $this->reg_objs as $reg ) { |
|
540 | - if ( ! $reg instanceof EE_Registration ) { |
|
539 | + foreach ($this->reg_objs as $reg) { |
|
540 | + if ( ! $reg instanceof EE_Registration) { |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | $this->_registrations[$reg->ID()]['tkt_obj'] = $this->tickets[$reg->get('TKT_ID')]['ticket']; |
@@ -562,17 +562,17 @@ discard block |
||
562 | 562 | ? $this->_attendees[999999991]['att_obj']->fname() |
563 | 563 | : '', |
564 | 564 | |
565 | - 'lname' => $this->_attendees[ 999999991 ][ 'att_obj' ] instanceof EE_Attendee |
|
565 | + 'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
566 | 566 | ? $this->_attendees[999999991]['att_obj']->lname() |
567 | 567 | : '', |
568 | 568 | |
569 | - 'email' => $this->_attendees[ 999999991 ][ 'att_obj' ] instanceof EE_Attendee |
|
569 | + 'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
570 | 570 | ? $this->_attendees[999999991]['att_obj']->email() |
571 | 571 | : '', |
572 | 572 | |
573 | 573 | 'att_obj' => $this->_attendees[999999991]['att_obj'], |
574 | 574 | |
575 | - 'reg_obj' => array_shift( $attendees_to_shift[999999991]['reg_objs'] ) |
|
575 | + 'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']) |
|
576 | 576 | ); |
577 | 577 | |
578 | 578 | //reg_info property |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $this->reg_info = array(); |
581 | 581 | |
582 | 582 | //let's set a reg_obj for messengers expecting one. |
583 | - $this->reg_obj = array_pop( $this->_attendees[999999991]['reg_objs'] ); |
|
583 | + $this->reg_obj = array_pop($this->_attendees[999999991]['reg_objs']); |
|
584 | 584 | |
585 | 585 | |
586 | 586 | //the below are just dummy items. |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | * @param EE_Registration|array $data |
30 | 30 | * @throws \EE_Error |
31 | 31 | */ |
32 | - public function __construct( $data ) { |
|
32 | + public function __construct($data) { |
|
33 | 33 | $filtered_reg_status = null; |
34 | 34 | |
35 | - if ( ! is_array( $data ) && $data instanceof EE_Registration ) { |
|
35 | + if ( ! is_array($data) && $data instanceof EE_Registration) { |
|
36 | 36 | $this->reg_obj = $data; |
37 | 37 | } else { |
38 | - $this->reg_obj = is_array( $data ) && isset( $data[0] ) && $data[0] instanceof EE_Registration ? $data[0] : null; |
|
39 | - $filtered_reg_status = is_array( $data ) && ! empty( $data[1] ) ? $data[1] : null; |
|
38 | + $this->reg_obj = is_array($data) && isset($data[0]) && $data[0] instanceof EE_Registration ? $data[0] : null; |
|
39 | + $filtered_reg_status = is_array($data) && ! empty($data[1]) ? $data[1] : null; |
|
40 | 40 | } |
41 | 41 | |
42 | - if ( ! $this->reg_obj instanceof EE_Registration ) { |
|
42 | + if ( ! $this->reg_obj instanceof EE_Registration) { |
|
43 | 43 | throw new EE_Error( |
44 | 44 | sprintf( |
45 | - __( '%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'), |
|
45 | + __('%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'), |
|
46 | 46 | 'EE_Messages_REG_incoming_data', |
47 | 47 | 'EE_Registration' |
48 | 48 | ) |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return array The prepped data for db |
66 | 66 | */ |
67 | - static public function convert_data_for_persistent_storage( $data ) { |
|
67 | + static public function convert_data_for_persistent_storage($data) { |
|
68 | 68 | $prepped_data = array(); |
69 | - if ( ! is_array( $data ) && $data instanceof EE_Registration ) { |
|
69 | + if ( ! is_array($data) && $data instanceof EE_Registration) { |
|
70 | 70 | $prepped_data['Registration'] = $data->ID(); |
71 | 71 | return $prepped_data; |
72 | - } elseif ( ! is_array( $data ) ) { |
|
72 | + } elseif ( ! is_array($data)) { |
|
73 | 73 | return array(); |
74 | 74 | } else { |
75 | - if ( $data[0] instanceof EE_Registration ) { |
|
75 | + if ($data[0] instanceof EE_Registration) { |
|
76 | 76 | $prepped_data['Registration'] = $data[0]; |
77 | 77 | } |
78 | - if ( ! empty( $data[1] ) ) { |
|
78 | + if ( ! empty($data[1])) { |
|
79 | 79 | $prepped_data['filter'] = $data[1]; |
80 | 80 | } |
81 | 81 | } |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return mixed |
93 | 93 | */ |
94 | - static public function convert_data_from_persistent_storage( $data ) { |
|
94 | + static public function convert_data_from_persistent_storage($data) { |
|
95 | 95 | $registration = null; |
96 | 96 | //$data['Registration'] could be either an ID (back compat) or a registration object (prepped using old system). |
97 | - if ( isset( $data[ 'Registration' ] ) ) { |
|
98 | - $registration = $data[ 'Registration' ] instanceof EE_Registration |
|
99 | - ? $data[ 'Registration' ] |
|
100 | - : EEM_Registration::instance()->get_one_by_ID( $data[ 'Registration' ] ); |
|
97 | + if (isset($data['Registration'])) { |
|
98 | + $registration = $data['Registration'] instanceof EE_Registration |
|
99 | + ? $data['Registration'] |
|
100 | + : EEM_Registration::instance()->get_one_by_ID($data['Registration']); |
|
101 | 101 | } |
102 | 102 | $prepped_data = array( |
103 | 103 | 0 => $registration, |
104 | - 1 => isset( $data['filter'] ) ? $data['filter'] : null |
|
104 | + 1 => isset($data['filter']) ? $data['filter'] : null |
|
105 | 105 | ); |
106 | 106 | return $prepped_data; |
107 | 107 | } |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | $this->txn = $this->reg_obj->transaction(); |
120 | 120 | //possible session stuff? |
121 | 121 | $session = $this->txn->session_data(); |
122 | - $session_data = $session instanceof EE_Session ? $session->get_session_data() : array(); |
|
122 | + $session_data = $session instanceof EE_Session ? $session->get_session_data() : array(); |
|
123 | 123 | |
124 | 124 | //other data from the session (if possible) |
125 | - $this->user_id = isset( $session_data['user_id'] ) ? $session_data['user_id'] : ''; |
|
126 | - $this->ip_address = isset( $session_data['ip_address'] ) ? $session_data['ip_address'] : ''; |
|
127 | - $this->user_agent = isset( $session_data['user_agent'] ) ? $session_data['user_agent'] : ''; |
|
125 | + $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : ''; |
|
126 | + $this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : ''; |
|
127 | + $this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : ''; |
|
128 | 128 | $this->init_access = $this->last_access = ''; |
129 | 129 | |
130 | 130 | $this->payment = $this->txn->get_first_related('Payment'); |
131 | 131 | // if there is no payments associated with the transaction |
132 | 132 | // then we just create a default payment object for potential parsing. |
133 | - $this->payment = empty( $this->payment ) |
|
133 | + $this->payment = empty($this->payment) |
|
134 | 134 | ? EE_Payment::new_instance( |
135 | 135 | array( |
136 | 136 | 'STS_ID' => EEM_Payment::status_id_pending, |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <h4><a href="[EDIT_ATTENDEE_LINK]">[FNAME] [LNAME]</a></h4> |
2 | 2 | <ul> |
3 | 3 | <li> |
4 | - <strong><?php _e( 'Registration Code:', 'event_espresso' ); ?></strong> |
|
4 | + <strong><?php _e('Registration Code:', 'event_espresso'); ?></strong> |
|
5 | 5 | <a href="[EDIT_ATTENDEE_LINK]">[REGISTRATION_CODE]</a> |
6 | 6 | </li> |
7 | 7 | <li> |
8 | - <strong><?php _e( 'Tickets:', 'event_espresso' ); ?></strong> |
|
8 | + <strong><?php _e('Tickets:', 'event_espresso'); ?></strong> |
|
9 | 9 | <ul>[TICKET_LIST]</ul> |
10 | 10 | </li> |
11 | 11 | </ul> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <tbody> |
4 | 4 | <tr> |
5 | 5 | <td> |
6 | - <p class="callout"><strong><?php _e( 'Event:', 'event_espresso' ); ?> [EVENT_LINK]</strong></p> |
|
6 | + <p class="callout"><strong><?php _e('Event:', 'event_espresso'); ?> [EVENT_LINK]</strong></p> |
|
7 | 7 | </td> |
8 | 8 | </tr> |
9 | 9 | </tbody> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | <tbody> |
17 | 17 | <tr> |
18 | 18 | <td> |
19 | - <h3><?php _e( 'Registrant(s):', 'event_espresso' ); ?></h3> |
|
19 | + <h3><?php _e('Registrant(s):', 'event_espresso'); ?></h3> |
|
20 | 20 | [ATTENDEE_LIST] |
21 | 21 | </td> |
22 | 22 | </tr> |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | protected function _set_admin_pages() { |
35 | - $this->admin_registered_pages = array( 'events_edit' => TRUE ); |
|
35 | + $this->admin_registered_pages = array('events_edit' => TRUE); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function _set_with_messengers() { |
47 | 47 | $this->_with_messengers = array( |
48 | - 'html' => array( 'pdf' ) |
|
48 | + 'html' => array('pdf') |
|
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
54 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
55 | 55 | //receipt message type data handler is 'Gateways' and it expects a transaction object. |
56 | 56 | $transaction = $registration->transaction(); |
57 | - if ( $transaction instanceof EE_Transaction ) { |
|
58 | - return array( $transaction ); |
|
57 | + if ($transaction instanceof EE_Transaction) { |
|
58 | + return array($transaction); |
|
59 | 59 | } |
60 | 60 | return array(); |
61 | 61 | } |
@@ -5,7 +5,9 @@ |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.5.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Use this to register or deregister a new message template pack variation for the EE messages system. |
@@ -87,12 +87,12 @@ |
||
87 | 87 | |
88 | 88 | |
89 | 89 | /** |
90 | - * used to set the valid shortcodes for the receipt message type |
|
91 | - * |
|
92 | - * @since 4.5.0 |
|
93 | - * |
|
94 | - * @return void |
|
95 | - */ |
|
90 | + * used to set the valid shortcodes for the receipt message type |
|
91 | + * |
|
92 | + * @since 4.5.0 |
|
93 | + * |
|
94 | + * @return void |
|
95 | + */ |
|
96 | 96 | protected function _set_valid_shortcodes() { |
97 | 97 | $this->_valid_shortcodes['purchaser'] = array( |
98 | 98 | 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment' |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |