@@ -4,45 +4,45 @@ |
||
4 | 4 | interface EnqueueAssetsInterface |
5 | 5 | { |
6 | 6 | |
7 | - /** |
|
8 | - * a place to register scripts and stylesheets with WordPress core |
|
9 | - * IMPORTANT !!! |
|
10 | - * ALL JavaScript files need to be registered for loading in the footer |
|
11 | - * by setting the 5th parameter of wp_register_script() to ` true ` |
|
12 | - * |
|
13 | - * @return void |
|
14 | - */ |
|
15 | - public function registerScriptsAndStylesheets(); |
|
7 | + /** |
|
8 | + * a place to register scripts and stylesheets with WordPress core |
|
9 | + * IMPORTANT !!! |
|
10 | + * ALL JavaScript files need to be registered for loading in the footer |
|
11 | + * by setting the 5th parameter of wp_register_script() to ` true ` |
|
12 | + * |
|
13 | + * @return void |
|
14 | + */ |
|
15 | + public function registerScriptsAndStylesheets(); |
|
16 | 16 | |
17 | - /** |
|
18 | - * a place to enqueue previously registered stylesheets |
|
19 | - * this will be called during the wp_enqueue_scripts hook for frontend requests |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function enqueueStylesheets(); |
|
17 | + /** |
|
18 | + * a place to enqueue previously registered stylesheets |
|
19 | + * this will be called during the wp_enqueue_scripts hook for frontend requests |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function enqueueStylesheets(); |
|
24 | 24 | |
25 | - /** |
|
26 | - * a place to enqueue previously registered stylesheets |
|
27 | - * this will be called during the admin_enqueue_scripts hook for admin requests |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function enqueueAdminStylesheets(); |
|
25 | + /** |
|
26 | + * a place to enqueue previously registered stylesheets |
|
27 | + * this will be called during the admin_enqueue_scripts hook for admin requests |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function enqueueAdminStylesheets(); |
|
32 | 32 | |
33 | - /** |
|
34 | - * a place to enqueue previously registered scripts for frontend requests |
|
35 | - * |
|
36 | - * @return void |
|
37 | - */ |
|
38 | - public function enqueueScripts(); |
|
33 | + /** |
|
34 | + * a place to enqueue previously registered scripts for frontend requests |
|
35 | + * |
|
36 | + * @return void |
|
37 | + */ |
|
38 | + public function enqueueScripts(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * a place to enqueue previously registered scripts for admin requests |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function enqueueAdminScripts(); |
|
40 | + /** |
|
41 | + * a place to enqueue previously registered scripts for admin requests |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function enqueueAdminScripts(); |
|
46 | 46 | } |
47 | 47 | // End of file EnqueueAssetsInterface.php |
48 | 48 | // Location: EventEspresso\core\domain/EnqueueAssetsInterface.php |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <p><strong><?php esc_html_e('Message Types', 'event_espresso'); ?></strong></p> |
2 | 2 | <p> |
3 | 3 | <?php |
4 | - printf( |
|
5 | - esc_html__( |
|
6 | - 'Messages are email notifications that are sent out by Event Espresso. Message Types are the %1$skinds%2$s of messages that get delivered. They can be thought of as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email Messenger:', |
|
7 | - 'event_espresso' |
|
8 | - ), |
|
9 | - '<em>', |
|
10 | - '</em>' |
|
11 | - ); |
|
12 | - ?> |
|
4 | + printf( |
|
5 | + esc_html__( |
|
6 | + 'Messages are email notifications that are sent out by Event Espresso. Message Types are the %1$skinds%2$s of messages that get delivered. They can be thought of as the "type" of package that is being delivered by the messenger. For example, Event Espresso comes with two Message Types attached to the Email Messenger:', |
|
7 | + 'event_espresso' |
|
8 | + ), |
|
9 | + '<em>', |
|
10 | + '</em>' |
|
11 | + ); |
|
12 | + ?> |
|
13 | 13 | </p> |
14 | 14 | <ul> |
15 | 15 | <li> |
@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | <p><strong><?php esc_html_e('Contexts', 'event_espresso'); ?></strong></p> |
25 | 25 | <p> |
26 | 26 | <?php esc_html_e( |
27 | - 'Each Message Type (kind of message) has different contexts. Contexts are dynamic and typically represent recipients (individuals receiving email notifications). For example, when the Registration Confirmation message type is triggered, it will send out a message to the following recipients: Event Administrator, Primary Registrant, and Additional Registrants. On the other hand, the Payment Message Type has only two recipients: Event Administrator and Primary Registrant.', |
|
28 | - 'event_espresso' |
|
29 | - ); ?> |
|
27 | + 'Each Message Type (kind of message) has different contexts. Contexts are dynamic and typically represent recipients (individuals receiving email notifications). For example, when the Registration Confirmation message type is triggered, it will send out a message to the following recipients: Event Administrator, Primary Registrant, and Additional Registrants. On the other hand, the Payment Message Type has only two recipients: Event Administrator and Primary Registrant.', |
|
28 | + 'event_espresso' |
|
29 | + ); ?> |
|
30 | 30 | </p> |
31 | 31 | <p> |
32 | 32 | <?php esc_html_e( |
33 | - 'A message context can be deactivated by removing a recipient from the "TO" field. This will set the field to blank and you can save changes. Deactivated message contexts will appear in grey when viewed in the Messages Overview tab. To re-activate a message context, go to that message context and setup a recipient (using one of the available shortcodes) and save changes. This will reactivate the message context and it will appear as blue in the Messages Overview tab.', |
|
34 | - 'event_espresso' |
|
35 | - ); ?> |
|
33 | + 'A message context can be deactivated by removing a recipient from the "TO" field. This will set the field to blank and you can save changes. Deactivated message contexts will appear in grey when viewed in the Messages Overview tab. To re-activate a message context, go to that message context and setup a recipient (using one of the available shortcodes) and save changes. This will reactivate the message context and it will appear as blue in the Messages Overview tab.', |
|
34 | + 'event_espresso' |
|
35 | + ); ?> |
|
36 | 36 | </p> |
37 | 37 | <p><strong><?php esc_html_e('Activation / Deactivation of Message Types', 'event_espresso'); ?></strong></p> |
38 | 38 | <p> |
39 | 39 | <?php esc_html_e( |
40 | - 'When a new install of Event Espresso is activated, all message types will be activated except for those for Cancelled and Declined registrations. The message types for Cancelled and Declined registrations can be easily activated through the Settings tab for Messages. Deactivating and re-activating Event Espresso will keep the current settings saved.', |
|
41 | - 'event_espresso' |
|
42 | - ); ?> |
|
40 | + 'When a new install of Event Espresso is activated, all message types will be activated except for those for Cancelled and Declined registrations. The message types for Cancelled and Declined registrations can be easily activated through the Settings tab for Messages. Deactivating and re-activating Event Espresso will keep the current settings saved.', |
|
41 | + 'event_espresso' |
|
42 | + ); ?> |
|
43 | 43 | </p> |
@@ -53,7 +53,7 @@ |
||
53 | 53 | 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
54 | 54 | 'event_espresso' |
55 | 55 | ), |
56 | - '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
56 | + '<img src="'.admin_url('images/media-button-image.gif').'">' |
|
57 | 57 | ); |
58 | 58 | ?> |
59 | 59 | </li> |
@@ -12,62 +12,62 @@ discard block |
||
12 | 12 | <strong><?php esc_html_e('Name', 'event_espresso'); ?></strong> |
13 | 13 | <br> |
14 | 14 | <?php esc_html_e( |
15 | - 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', |
|
16 | - 'event_espresso' |
|
17 | - ); ?> |
|
15 | + 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', |
|
16 | + 'event_espresso' |
|
17 | + ); ?> |
|
18 | 18 | </li> |
19 | 19 | <li> |
20 | 20 | <strong><?php esc_html_e('Description', 'event_espresso'); ?></strong> |
21 | 21 | <br /> |
22 | 22 | <?php esc_html_e( |
23 | - 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', |
|
24 | - 'event_espresso' |
|
25 | - ); ?> |
|
23 | + 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', |
|
24 | + 'event_espresso' |
|
25 | + ); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php esc_html_e('Admin-Only Name', 'event_espresso'); ?></strong> |
29 | 29 | <br /> |
30 | 30 | <?php esc_html_e( |
31 | - 'The name of the payment method as seen internally by site administrators and staff.', |
|
32 | - 'event_espresso' |
|
33 | - ); ?> |
|
31 | + 'The name of the payment method as seen internally by site administrators and staff.', |
|
32 | + 'event_espresso' |
|
33 | + ); ?> |
|
34 | 34 | </li> |
35 | 35 | <li> |
36 | 36 | <strong><?php esc_html_e('Admin-Only Description', 'event_espresso'); ?></strong> |
37 | 37 | <br /> |
38 | 38 | <?php esc_html_e( |
39 | - 'The description of the payment method as seen internally by site administrators and staff.', |
|
40 | - 'event_espresso' |
|
41 | - ); ?> |
|
39 | + 'The description of the payment method as seen internally by site administrators and staff.', |
|
40 | + 'event_espresso' |
|
41 | + ); ?> |
|
42 | 42 | </li> |
43 | 43 | <li> |
44 | 44 | <strong><?php esc_html_e('Debug (sandbox) Mode', 'event_espresso'); ?></strong> |
45 | 45 | <br /> |
46 | 46 | <?php esc_html_e( |
47 | - 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', |
|
48 | - 'event_espresso' |
|
49 | - ); ?> |
|
47 | + 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', |
|
48 | + 'event_espresso' |
|
49 | + ); ?> |
|
50 | 50 | </li> |
51 | 51 | <li> |
52 | 52 | <strong><?php esc_html_e('Open by Default', 'event_espresso'); ?></strong> |
53 | 53 | <br /> |
54 | 54 | <?php esc_html_e( |
55 | - 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', |
|
56 | - 'event_espresso' |
|
57 | - ); ?> |
|
55 | + 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', |
|
56 | + 'event_espresso' |
|
57 | + ); ?> |
|
58 | 58 | </li> |
59 | 59 | <li> |
60 | 60 | <strong><?php esc_html_e('Button URL', 'event_espresso'); ?></strong> |
61 | 61 | <br /> |
62 | 62 | <?php |
63 | - printf( |
|
64 | - esc_html__( |
|
65 | - 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
|
66 | - 'event_espresso' |
|
67 | - ), |
|
68 | - '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
69 | - ); |
|
70 | - ?> |
|
63 | + printf( |
|
64 | + esc_html__( |
|
65 | + 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
|
66 | + 'event_espresso' |
|
67 | + ), |
|
68 | + '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
69 | + ); |
|
70 | + ?> |
|
71 | 71 | </li> |
72 | 72 | <li><strong><?php esc_html_e('Usable From', 'event_espresso'); ?></strong> |
73 | 73 | <br /> |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | <ul> |
76 | 76 | <li> |
77 | 77 | <?php esc_html_e( |
78 | - 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', |
|
79 | - 'event_espresso' |
|
80 | - ); ?> |
|
78 | + 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', |
|
79 | + 'event_espresso' |
|
80 | + ); ?> |
|
81 | 81 | </li> |
82 | 82 | <li> |
83 | 83 | <?php esc_html_e( |
84 | - 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', |
|
85 | - 'event_espresso' |
|
86 | - ); ?> |
|
84 | + 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', |
|
85 | + 'event_espresso' |
|
86 | + ); ?> |
|
87 | 87 | </li> |
88 | 88 | </ul> |
89 | 89 | </li> |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
92 | 92 | <br /> |
93 | 93 | <?php esc_html_e( |
94 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
95 | - 'event_espresso' |
|
94 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
95 | + 'event_espresso' |
|
96 | 96 | ); ?> |
97 | 97 | <p> |
98 | 98 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
99 | 99 | <br /> |
100 | 100 | <?php esc_html_e( |
101 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
102 | - 'event_espresso' |
|
103 | - ); ?> |
|
101 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
102 | + 'event_espresso' |
|
103 | + ); ?> |
|
104 | 104 | </p> |
105 | 105 | \ No newline at end of file |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | private function _get_datetimes_from_event(EE_Event $event) |
169 | 169 | { |
170 | 170 | return isset($this->_extra_data['data']->events) |
171 | - ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs'] |
|
171 | + ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] |
|
172 | 172 | : []; |
173 | 173 | } |
174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | private function _get_datetimes_from_ticket(EE_Ticket $ticket) |
183 | 183 | { |
184 | 184 | return isset($this->_extra_data['data']->tickets) |
185 | - ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs'] |
|
185 | + ? $this->_extra_data['data']->tickets[$ticket->ID()]['dtt_objs'] |
|
186 | 186 | : []; |
187 | 187 | } |
188 | 188 | } |
@@ -18,168 +18,168 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Datetime_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - protected function _init_props() |
|
22 | - { |
|
23 | - $this->label = esc_html__('Datetime List Shortcodes', 'event_espresso'); |
|
24 | - $this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso'); |
|
25 | - $this->_shortcodes = [ |
|
26 | - '[DATETIME_LIST]' => esc_html__( |
|
27 | - 'Will output a list of datetimes according to the layout specified in the datetime list field.', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - ]; |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @throws EE_Error |
|
36 | - * @throws ReflectionException |
|
37 | - */ |
|
38 | - protected function _parser($shortcode) |
|
39 | - { |
|
40 | - switch ($shortcode) { |
|
41 | - case '[DATETIME_LIST]': |
|
42 | - return $this->_get_datetime_list(); |
|
43 | - } |
|
44 | - return ''; |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
50 | - * |
|
51 | - * @return string |
|
52 | - * @throws EE_Error |
|
53 | - * @throws EE_Error |
|
54 | - * @throws ReflectionException |
|
55 | - */ |
|
56 | - private function _get_datetime_list() |
|
57 | - { |
|
58 | - $this->_validate_list_requirements(); |
|
59 | - |
|
60 | - if ($this->_data['data'] instanceof EE_Ticket) { |
|
61 | - return $this->_get_datetime_list_for_ticket(); |
|
62 | - } |
|
63 | - if ($this->_data['data'] instanceof EE_Event) { |
|
64 | - return $this->_get_datetime_list_for_event(); |
|
65 | - } |
|
66 | - if ( |
|
67 | - $this->_data['data'] instanceof EE_Messages_Addressee |
|
68 | - && $this->_data['data']->reg_obj instanceof EE_Registration |
|
69 | - ) { |
|
70 | - return $this->_get_datetime_list_for_registration(); |
|
71 | - } |
|
72 | - // prevent recursive loop |
|
73 | - return ''; |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * return parsed list of datetimes for an event |
|
79 | - * |
|
80 | - * @return string |
|
81 | - * @throws EE_Error |
|
82 | - * @throws ReflectionException |
|
83 | - */ |
|
84 | - private function _get_datetime_list_for_event() |
|
85 | - { |
|
86 | - $event = $this->_data['data']; |
|
87 | - $valid_shortcodes = ['datetime', 'attendee']; |
|
88 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
89 | - ? $this->_data['template']['datetime_list'] |
|
90 | - : $this->_extra_data['template']['datetime_list']; |
|
91 | - |
|
92 | - // here we're setting up the datetimes for the datetime list template for THIS event. |
|
93 | - $dtt_parsed = ''; |
|
94 | - $datetimes = $this->_get_datetimes_from_event($event); |
|
95 | - |
|
96 | - // each datetime in this case should be an datetime object. |
|
97 | - foreach ($datetimes as $datetime) { |
|
98 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
99 | - $template, |
|
100 | - $datetime, |
|
101 | - $valid_shortcodes, |
|
102 | - $this->_extra_data |
|
103 | - ); |
|
104 | - } |
|
105 | - |
|
106 | - return $dtt_parsed; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * return parsed list of datetimes for an ticket |
|
112 | - * |
|
113 | - * @return string |
|
114 | - * @throws EE_Error |
|
115 | - */ |
|
116 | - private function _get_datetime_list_for_ticket() |
|
117 | - { |
|
118 | - $valid_shortcodes = ['datetime', 'attendee']; |
|
119 | - |
|
120 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
121 | - ? $this->_data['template']['datetime_list'] |
|
122 | - : $this->_extra_data['template']['datetime_list']; |
|
123 | - $ticket = $this->_data['data']; |
|
124 | - |
|
125 | - // here we're setting up the datetimes for the datetime list template for THIS ticket. |
|
126 | - $dtt_parsed = ''; |
|
127 | - $datetimes = $this->_get_datetimes_from_ticket($ticket); |
|
128 | - |
|
129 | - // each datetime in this case should be an datetime object. |
|
130 | - foreach ($datetimes as $datetime) { |
|
131 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
132 | - $template, |
|
133 | - $datetime, |
|
134 | - $valid_shortcodes, |
|
135 | - $this->_extra_data |
|
136 | - ); |
|
137 | - } |
|
138 | - |
|
139 | - return $dtt_parsed; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * return parsed list of datetimes from a given registration. |
|
145 | - * |
|
146 | - * @return string |
|
147 | - * @throws EE_Error |
|
148 | - * @throws EE_Error |
|
149 | - */ |
|
150 | - private function _get_datetime_list_for_registration() |
|
151 | - { |
|
152 | - $registration = $this->_data['data']->reg_obj; |
|
153 | - |
|
154 | - // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket(); |
|
155 | - $this->_data['data'] = $registration->ticket(); |
|
156 | - return $this->_get_datetime_list_for_ticket(); |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @param EE_Event $event |
|
162 | - * @return array|mixed |
|
163 | - * @throws EE_Error |
|
164 | - * @throws ReflectionException |
|
165 | - */ |
|
166 | - private function _get_datetimes_from_event(EE_Event $event) |
|
167 | - { |
|
168 | - return isset($this->_extra_data['data']->events) |
|
169 | - ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs'] |
|
170 | - : []; |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * @param EE_Ticket $ticket |
|
176 | - * @return array|mixed |
|
177 | - * @throws EE_Error |
|
178 | - */ |
|
179 | - private function _get_datetimes_from_ticket(EE_Ticket $ticket) |
|
180 | - { |
|
181 | - return isset($this->_extra_data['data']->tickets) |
|
182 | - ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs'] |
|
183 | - : []; |
|
184 | - } |
|
21 | + protected function _init_props() |
|
22 | + { |
|
23 | + $this->label = esc_html__('Datetime List Shortcodes', 'event_espresso'); |
|
24 | + $this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso'); |
|
25 | + $this->_shortcodes = [ |
|
26 | + '[DATETIME_LIST]' => esc_html__( |
|
27 | + 'Will output a list of datetimes according to the layout specified in the datetime list field.', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + ]; |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @throws EE_Error |
|
36 | + * @throws ReflectionException |
|
37 | + */ |
|
38 | + protected function _parser($shortcode) |
|
39 | + { |
|
40 | + switch ($shortcode) { |
|
41 | + case '[DATETIME_LIST]': |
|
42 | + return $this->_get_datetime_list(); |
|
43 | + } |
|
44 | + return ''; |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
50 | + * |
|
51 | + * @return string |
|
52 | + * @throws EE_Error |
|
53 | + * @throws EE_Error |
|
54 | + * @throws ReflectionException |
|
55 | + */ |
|
56 | + private function _get_datetime_list() |
|
57 | + { |
|
58 | + $this->_validate_list_requirements(); |
|
59 | + |
|
60 | + if ($this->_data['data'] instanceof EE_Ticket) { |
|
61 | + return $this->_get_datetime_list_for_ticket(); |
|
62 | + } |
|
63 | + if ($this->_data['data'] instanceof EE_Event) { |
|
64 | + return $this->_get_datetime_list_for_event(); |
|
65 | + } |
|
66 | + if ( |
|
67 | + $this->_data['data'] instanceof EE_Messages_Addressee |
|
68 | + && $this->_data['data']->reg_obj instanceof EE_Registration |
|
69 | + ) { |
|
70 | + return $this->_get_datetime_list_for_registration(); |
|
71 | + } |
|
72 | + // prevent recursive loop |
|
73 | + return ''; |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * return parsed list of datetimes for an event |
|
79 | + * |
|
80 | + * @return string |
|
81 | + * @throws EE_Error |
|
82 | + * @throws ReflectionException |
|
83 | + */ |
|
84 | + private function _get_datetime_list_for_event() |
|
85 | + { |
|
86 | + $event = $this->_data['data']; |
|
87 | + $valid_shortcodes = ['datetime', 'attendee']; |
|
88 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
89 | + ? $this->_data['template']['datetime_list'] |
|
90 | + : $this->_extra_data['template']['datetime_list']; |
|
91 | + |
|
92 | + // here we're setting up the datetimes for the datetime list template for THIS event. |
|
93 | + $dtt_parsed = ''; |
|
94 | + $datetimes = $this->_get_datetimes_from_event($event); |
|
95 | + |
|
96 | + // each datetime in this case should be an datetime object. |
|
97 | + foreach ($datetimes as $datetime) { |
|
98 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
99 | + $template, |
|
100 | + $datetime, |
|
101 | + $valid_shortcodes, |
|
102 | + $this->_extra_data |
|
103 | + ); |
|
104 | + } |
|
105 | + |
|
106 | + return $dtt_parsed; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * return parsed list of datetimes for an ticket |
|
112 | + * |
|
113 | + * @return string |
|
114 | + * @throws EE_Error |
|
115 | + */ |
|
116 | + private function _get_datetime_list_for_ticket() |
|
117 | + { |
|
118 | + $valid_shortcodes = ['datetime', 'attendee']; |
|
119 | + |
|
120 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
121 | + ? $this->_data['template']['datetime_list'] |
|
122 | + : $this->_extra_data['template']['datetime_list']; |
|
123 | + $ticket = $this->_data['data']; |
|
124 | + |
|
125 | + // here we're setting up the datetimes for the datetime list template for THIS ticket. |
|
126 | + $dtt_parsed = ''; |
|
127 | + $datetimes = $this->_get_datetimes_from_ticket($ticket); |
|
128 | + |
|
129 | + // each datetime in this case should be an datetime object. |
|
130 | + foreach ($datetimes as $datetime) { |
|
131 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
132 | + $template, |
|
133 | + $datetime, |
|
134 | + $valid_shortcodes, |
|
135 | + $this->_extra_data |
|
136 | + ); |
|
137 | + } |
|
138 | + |
|
139 | + return $dtt_parsed; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * return parsed list of datetimes from a given registration. |
|
145 | + * |
|
146 | + * @return string |
|
147 | + * @throws EE_Error |
|
148 | + * @throws EE_Error |
|
149 | + */ |
|
150 | + private function _get_datetime_list_for_registration() |
|
151 | + { |
|
152 | + $registration = $this->_data['data']->reg_obj; |
|
153 | + |
|
154 | + // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket(); |
|
155 | + $this->_data['data'] = $registration->ticket(); |
|
156 | + return $this->_get_datetime_list_for_ticket(); |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @param EE_Event $event |
|
162 | + * @return array|mixed |
|
163 | + * @throws EE_Error |
|
164 | + * @throws ReflectionException |
|
165 | + */ |
|
166 | + private function _get_datetimes_from_event(EE_Event $event) |
|
167 | + { |
|
168 | + return isset($this->_extra_data['data']->events) |
|
169 | + ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs'] |
|
170 | + : []; |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * @param EE_Ticket $ticket |
|
176 | + * @return array|mixed |
|
177 | + * @throws EE_Error |
|
178 | + */ |
|
179 | + private function _get_datetimes_from_ticket(EE_Ticket $ticket) |
|
180 | + { |
|
181 | + return isset($this->_extra_data['data']->tickets) |
|
182 | + ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs'] |
|
183 | + : []; |
|
184 | + } |
|
185 | 185 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | private function _get_tickets_from_event(EE_Event $event) |
203 | 203 | { |
204 | 204 | return isset($this->_extra_data['data']->events) |
205 | - ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs'] |
|
205 | + ? $this->_extra_data['data']->events[$event->ID()]['tkt_objs'] |
|
206 | 206 | : []; |
207 | 207 | } |
208 | 208 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | private function _get_ticket_list_from_registration(EE_Registration $registration) |
217 | 217 | { |
218 | 218 | return isset($this->_extra_data['data']->registrations) |
219 | - ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']] |
|
219 | + ? [$this->_extra_data['data']->registrations[$registration->ID()]['tkt_obj']] |
|
220 | 220 | : []; |
221 | 221 | } |
222 | 222 | } |
@@ -18,208 +18,208 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Ticket_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = esc_html__('Ticket List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = esc_html__('All shortcodes specific to ticket lists', 'event_espresso'); |
|
31 | - $this->_shortcodes = [ |
|
32 | - '[TICKET_LIST]' => esc_html__('Will output a list of tickets', 'event_espresso'), |
|
33 | - ]; |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @param string $shortcode |
|
39 | - * @return string |
|
40 | - * @throws EE_Error |
|
41 | - * @throws ReflectionException |
|
42 | - */ |
|
43 | - protected function _parser($shortcode) |
|
44 | - { |
|
45 | - switch ($shortcode) { |
|
46 | - case '[TICKET_LIST]': |
|
47 | - return $this->_get_ticket_list(); |
|
48 | - } |
|
49 | - return ''; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
55 | - * |
|
56 | - * @return string |
|
57 | - * @throws EE_Error |
|
58 | - * @throws ReflectionException |
|
59 | - */ |
|
60 | - private function _get_ticket_list() |
|
61 | - { |
|
62 | - $this->_validate_list_requirements(); |
|
63 | - |
|
64 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
65 | - return $this->_get_ticket_list_for_main(); |
|
66 | - } |
|
67 | - if ($this->_data['data'] instanceof EE_Registration) { |
|
68 | - return $this->_get_ticket_list_for_attendee(); |
|
69 | - } |
|
70 | - if ($this->_data['data'] instanceof EE_Event) { |
|
71 | - return $this->_get_ticket_list_for_event(); |
|
72 | - } |
|
73 | - // prevent recursive loop |
|
74 | - return ''; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * This returns the parsed ticket list for main template; |
|
80 | - */ |
|
81 | - private function _get_ticket_list_for_main() |
|
82 | - { |
|
83 | - $valid_shortcodes = [ |
|
84 | - 'ticket', |
|
85 | - 'event_list', |
|
86 | - 'attendee_list', |
|
87 | - 'datetime_list', |
|
88 | - 'attendee', |
|
89 | - 'line_item_list', |
|
90 | - 'primary_registration_details', |
|
91 | - 'recipient_details', |
|
92 | - ]; |
|
93 | - $template = $this->_data['template']; |
|
94 | - $data = $this->_data['data']; |
|
95 | - $ticket_list = ''; |
|
96 | - |
|
97 | - |
|
98 | - // now we need to loop through the ticket list and send data to the EE_Parser helper. |
|
99 | - foreach ($data->tickets as $ticket) { |
|
100 | - $ticket_list .= $this->_shortcode_helper->parse_ticket_list_template( |
|
101 | - $template, |
|
102 | - $ticket['ticket'], |
|
103 | - $valid_shortcodes, |
|
104 | - $this->_extra_data |
|
105 | - ); |
|
106 | - } |
|
107 | - |
|
108 | - return $ticket_list; |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * return parsed list of tickets for an event |
|
114 | - * |
|
115 | - * @return string |
|
116 | - * @throws EE_Error |
|
117 | - * @throws ReflectionException |
|
118 | - */ |
|
119 | - private function _get_ticket_list_for_event() |
|
120 | - { |
|
121 | - $valid_shortcodes = [ |
|
122 | - 'ticket', |
|
123 | - 'attendee_list', |
|
124 | - 'datetime_list', |
|
125 | - 'attendee', |
|
126 | - 'venue', |
|
127 | - 'line_item_list', |
|
128 | - 'primary_registration_details', |
|
129 | - 'recipient_details', |
|
130 | - ]; |
|
131 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
132 | - ? $this->_data['template']['ticket_list'] |
|
133 | - : $this->_extra_data['template']['ticket_list']; |
|
134 | - $event = $this->_data['data']; |
|
135 | - |
|
136 | - // let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion. |
|
137 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
138 | - |
|
139 | - // here we're setting up the tickets for the ticket list template for THIS event. |
|
140 | - $tkt_parsed = ''; |
|
141 | - $tickets = $this->_get_tickets_from_event($event); |
|
142 | - |
|
143 | - // each ticket in this case should be an ticket object. |
|
144 | - foreach ($tickets as $ticket) { |
|
145 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
146 | - $template, |
|
147 | - $ticket, |
|
148 | - $valid_shortcodes, |
|
149 | - $this->_extra_data |
|
150 | - ); |
|
151 | - } |
|
152 | - |
|
153 | - return $tkt_parsed; |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * return parsed list of tickets for an attendee |
|
159 | - * |
|
160 | - * @return string |
|
161 | - * @throws EE_Error |
|
162 | - * @throws ReflectionException |
|
163 | - */ |
|
164 | - private function _get_ticket_list_for_attendee() |
|
165 | - { |
|
166 | - $valid_shortcodes = [ |
|
167 | - 'ticket', |
|
168 | - 'event_list', |
|
169 | - 'datetime_list', |
|
170 | - 'attendee', |
|
171 | - 'primary_registration_details', |
|
172 | - 'recipient_details', |
|
173 | - ]; |
|
174 | - |
|
175 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
176 | - ? $this->_data['template']['ticket_list'] |
|
177 | - : $this->_extra_data['template']['ticket_list']; |
|
178 | - $registration = $this->_data['data']; |
|
179 | - |
|
180 | - // let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
181 | - $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
182 | - |
|
183 | - // here we're setting up the tickets for the ticket list template for THIS attendee. |
|
184 | - $tkt_parsed = ''; |
|
185 | - $tickets = $this->_get_ticket_list_from_registration($registration); |
|
186 | - |
|
187 | - // each ticket in this case should be an ticket object. |
|
188 | - foreach ($tickets as $ticket) { |
|
189 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
190 | - $template, |
|
191 | - $ticket, |
|
192 | - $valid_shortcodes, |
|
193 | - $this->_extra_data |
|
194 | - ); |
|
195 | - } |
|
196 | - |
|
197 | - return $tkt_parsed; |
|
198 | - } |
|
199 | - |
|
200 | - |
|
201 | - /** |
|
202 | - * @throws EE_Error |
|
203 | - * @throws ReflectionException |
|
204 | - */ |
|
205 | - private function _get_tickets_from_event(EE_Event $event) |
|
206 | - { |
|
207 | - return isset($this->_extra_data['data']->events) |
|
208 | - ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs'] |
|
209 | - : []; |
|
210 | - } |
|
211 | - |
|
212 | - |
|
213 | - /** |
|
214 | - * @param EE_Registration $registration |
|
215 | - * @return array |
|
216 | - * @throws EE_Error |
|
217 | - * @throws ReflectionException |
|
218 | - */ |
|
219 | - private function _get_ticket_list_from_registration(EE_Registration $registration) |
|
220 | - { |
|
221 | - return isset($this->_extra_data['data']->registrations) |
|
222 | - ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']] |
|
223 | - : []; |
|
224 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = esc_html__('Ticket List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = esc_html__('All shortcodes specific to ticket lists', 'event_espresso'); |
|
31 | + $this->_shortcodes = [ |
|
32 | + '[TICKET_LIST]' => esc_html__('Will output a list of tickets', 'event_espresso'), |
|
33 | + ]; |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @param string $shortcode |
|
39 | + * @return string |
|
40 | + * @throws EE_Error |
|
41 | + * @throws ReflectionException |
|
42 | + */ |
|
43 | + protected function _parser($shortcode) |
|
44 | + { |
|
45 | + switch ($shortcode) { |
|
46 | + case '[TICKET_LIST]': |
|
47 | + return $this->_get_ticket_list(); |
|
48 | + } |
|
49 | + return ''; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
55 | + * |
|
56 | + * @return string |
|
57 | + * @throws EE_Error |
|
58 | + * @throws ReflectionException |
|
59 | + */ |
|
60 | + private function _get_ticket_list() |
|
61 | + { |
|
62 | + $this->_validate_list_requirements(); |
|
63 | + |
|
64 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
65 | + return $this->_get_ticket_list_for_main(); |
|
66 | + } |
|
67 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
68 | + return $this->_get_ticket_list_for_attendee(); |
|
69 | + } |
|
70 | + if ($this->_data['data'] instanceof EE_Event) { |
|
71 | + return $this->_get_ticket_list_for_event(); |
|
72 | + } |
|
73 | + // prevent recursive loop |
|
74 | + return ''; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * This returns the parsed ticket list for main template; |
|
80 | + */ |
|
81 | + private function _get_ticket_list_for_main() |
|
82 | + { |
|
83 | + $valid_shortcodes = [ |
|
84 | + 'ticket', |
|
85 | + 'event_list', |
|
86 | + 'attendee_list', |
|
87 | + 'datetime_list', |
|
88 | + 'attendee', |
|
89 | + 'line_item_list', |
|
90 | + 'primary_registration_details', |
|
91 | + 'recipient_details', |
|
92 | + ]; |
|
93 | + $template = $this->_data['template']; |
|
94 | + $data = $this->_data['data']; |
|
95 | + $ticket_list = ''; |
|
96 | + |
|
97 | + |
|
98 | + // now we need to loop through the ticket list and send data to the EE_Parser helper. |
|
99 | + foreach ($data->tickets as $ticket) { |
|
100 | + $ticket_list .= $this->_shortcode_helper->parse_ticket_list_template( |
|
101 | + $template, |
|
102 | + $ticket['ticket'], |
|
103 | + $valid_shortcodes, |
|
104 | + $this->_extra_data |
|
105 | + ); |
|
106 | + } |
|
107 | + |
|
108 | + return $ticket_list; |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * return parsed list of tickets for an event |
|
114 | + * |
|
115 | + * @return string |
|
116 | + * @throws EE_Error |
|
117 | + * @throws ReflectionException |
|
118 | + */ |
|
119 | + private function _get_ticket_list_for_event() |
|
120 | + { |
|
121 | + $valid_shortcodes = [ |
|
122 | + 'ticket', |
|
123 | + 'attendee_list', |
|
124 | + 'datetime_list', |
|
125 | + 'attendee', |
|
126 | + 'venue', |
|
127 | + 'line_item_list', |
|
128 | + 'primary_registration_details', |
|
129 | + 'recipient_details', |
|
130 | + ]; |
|
131 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
132 | + ? $this->_data['template']['ticket_list'] |
|
133 | + : $this->_extra_data['template']['ticket_list']; |
|
134 | + $event = $this->_data['data']; |
|
135 | + |
|
136 | + // let's remove any existing [EVENT_LIST] shortcodes from the ticket list template so that we don't get recursion. |
|
137 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
138 | + |
|
139 | + // here we're setting up the tickets for the ticket list template for THIS event. |
|
140 | + $tkt_parsed = ''; |
|
141 | + $tickets = $this->_get_tickets_from_event($event); |
|
142 | + |
|
143 | + // each ticket in this case should be an ticket object. |
|
144 | + foreach ($tickets as $ticket) { |
|
145 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
146 | + $template, |
|
147 | + $ticket, |
|
148 | + $valid_shortcodes, |
|
149 | + $this->_extra_data |
|
150 | + ); |
|
151 | + } |
|
152 | + |
|
153 | + return $tkt_parsed; |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * return parsed list of tickets for an attendee |
|
159 | + * |
|
160 | + * @return string |
|
161 | + * @throws EE_Error |
|
162 | + * @throws ReflectionException |
|
163 | + */ |
|
164 | + private function _get_ticket_list_for_attendee() |
|
165 | + { |
|
166 | + $valid_shortcodes = [ |
|
167 | + 'ticket', |
|
168 | + 'event_list', |
|
169 | + 'datetime_list', |
|
170 | + 'attendee', |
|
171 | + 'primary_registration_details', |
|
172 | + 'recipient_details', |
|
173 | + ]; |
|
174 | + |
|
175 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
176 | + ? $this->_data['template']['ticket_list'] |
|
177 | + : $this->_extra_data['template']['ticket_list']; |
|
178 | + $registration = $this->_data['data']; |
|
179 | + |
|
180 | + // let's remove any existing [ATTENDEE_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
181 | + $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
182 | + |
|
183 | + // here we're setting up the tickets for the ticket list template for THIS attendee. |
|
184 | + $tkt_parsed = ''; |
|
185 | + $tickets = $this->_get_ticket_list_from_registration($registration); |
|
186 | + |
|
187 | + // each ticket in this case should be an ticket object. |
|
188 | + foreach ($tickets as $ticket) { |
|
189 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
190 | + $template, |
|
191 | + $ticket, |
|
192 | + $valid_shortcodes, |
|
193 | + $this->_extra_data |
|
194 | + ); |
|
195 | + } |
|
196 | + |
|
197 | + return $tkt_parsed; |
|
198 | + } |
|
199 | + |
|
200 | + |
|
201 | + /** |
|
202 | + * @throws EE_Error |
|
203 | + * @throws ReflectionException |
|
204 | + */ |
|
205 | + private function _get_tickets_from_event(EE_Event $event) |
|
206 | + { |
|
207 | + return isset($this->_extra_data['data']->events) |
|
208 | + ? $this->_extra_data['data']->events[ $event->ID() ]['tkt_objs'] |
|
209 | + : []; |
|
210 | + } |
|
211 | + |
|
212 | + |
|
213 | + /** |
|
214 | + * @param EE_Registration $registration |
|
215 | + * @return array |
|
216 | + * @throws EE_Error |
|
217 | + * @throws ReflectionException |
|
218 | + */ |
|
219 | + private function _get_ticket_list_from_registration(EE_Registration $registration) |
|
220 | + { |
|
221 | + return isset($this->_extra_data['data']->registrations) |
|
222 | + ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['tkt_obj']] |
|
223 | + : []; |
|
224 | + } |
|
225 | 225 | } |
@@ -163,7 +163,7 @@ |
||
163 | 163 | private function _get_events_from_registration(EE_Registration $registration) |
164 | 164 | { |
165 | 165 | return isset($this->_extra_data['data']->registrations) |
166 | - ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']] |
|
166 | + ? [$this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']] |
|
167 | 167 | : []; |
168 | 168 | } |
169 | 169 | } |
@@ -18,156 +18,156 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Event_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _init_props() |
|
28 | - { |
|
29 | - $this->label = esc_html__('Event List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso'); |
|
31 | - $this->_shortcodes = [ |
|
32 | - '[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'), |
|
33 | - ]; |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @param string $shortcode |
|
39 | - * @return string |
|
40 | - * @throws EE_Error |
|
41 | - * @throws ReflectionException |
|
42 | - */ |
|
43 | - protected function _parser($shortcode) |
|
44 | - { |
|
45 | - switch ($shortcode) { |
|
46 | - case '[EVENT_LIST]': |
|
47 | - return $this->_get_event_list(); |
|
48 | - } |
|
49 | - return ''; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
55 | - * |
|
56 | - * @return string |
|
57 | - * @throws EE_Error |
|
58 | - * @throws ReflectionException |
|
59 | - */ |
|
60 | - private function _get_event_list() |
|
61 | - { |
|
62 | - $this->_validate_list_requirements(); |
|
63 | - |
|
64 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
65 | - return $this->_get_event_list_for_main(); |
|
66 | - } |
|
67 | - if ($this->_data['data'] instanceof EE_Registration) { |
|
68 | - return $this->_get_event_list_for_registration(); |
|
69 | - } |
|
70 | - // prevent recursive loop |
|
71 | - return ''; |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * This returns the parsed event list for main template |
|
77 | - * |
|
78 | - * @return string |
|
79 | - */ |
|
80 | - private function _get_event_list_for_main() |
|
81 | - { |
|
82 | - |
|
83 | - $valid_shortcodes = [ |
|
84 | - 'event', |
|
85 | - 'attendee_list', |
|
86 | - 'ticket_list', |
|
87 | - 'datetime_list', |
|
88 | - 'venue', |
|
89 | - 'attendee', |
|
90 | - 'recipient_list', |
|
91 | - 'recipient_details', |
|
92 | - 'primary_registration_list', |
|
93 | - 'primary_registration_details', |
|
94 | - 'event_author', |
|
95 | - 'organization', |
|
96 | - ]; |
|
97 | - $template = $this->_data['template']; |
|
98 | - $data = $this->_data['data']; |
|
99 | - $events = ''; |
|
100 | - |
|
101 | - // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
102 | - foreach ($data->events as $event) { |
|
103 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
104 | - $template, |
|
105 | - $event['event'], |
|
106 | - $valid_shortcodes, |
|
107 | - $this->_extra_data |
|
108 | - ); |
|
109 | - } |
|
110 | - return $events; |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * This returns the parsed event list for an attendee |
|
116 | - * |
|
117 | - * @return string |
|
118 | - * @throws EE_Error |
|
119 | - * @throws ReflectionException |
|
120 | - */ |
|
121 | - private function _get_event_list_for_registration() |
|
122 | - { |
|
123 | - $valid_shortcodes = [ |
|
124 | - 'event', |
|
125 | - 'ticket_list', |
|
126 | - 'datetime_list', |
|
127 | - 'attendee', |
|
128 | - 'event_author', |
|
129 | - 'recipient_details', |
|
130 | - 'recipient_list', |
|
131 | - 'venue', |
|
132 | - 'organization', |
|
133 | - ]; |
|
134 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
135 | - ? $this->_data['template']['event_list'] |
|
136 | - : $this->_extra_data['template']['event_list']; |
|
137 | - $registration = $this->_data['data']; |
|
138 | - |
|
139 | - // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
140 | - $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
141 | - |
|
142 | - // here we're setting up the events for the event_list template for THIS registration. |
|
143 | - $all_events = $this->_get_events_from_registration($registration); |
|
144 | - |
|
145 | - // we're NOT going to prepare a list of attendees this time around |
|
146 | - $events = ''; |
|
147 | - |
|
148 | - foreach ($all_events as $event) { |
|
149 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
150 | - $template, |
|
151 | - $event, |
|
152 | - $valid_shortcodes, |
|
153 | - $this->_extra_data |
|
154 | - ); |
|
155 | - } |
|
156 | - |
|
157 | - return $events; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @param EE_Registration $registration |
|
163 | - * @return array |
|
164 | - * @throws EE_Error |
|
165 | - * @throws ReflectionException |
|
166 | - */ |
|
167 | - private function _get_events_from_registration(EE_Registration $registration) |
|
168 | - { |
|
169 | - return isset($this->_extra_data['data']->registrations) |
|
170 | - ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']] |
|
171 | - : []; |
|
172 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = esc_html__('Event List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso'); |
|
31 | + $this->_shortcodes = [ |
|
32 | + '[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'), |
|
33 | + ]; |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @param string $shortcode |
|
39 | + * @return string |
|
40 | + * @throws EE_Error |
|
41 | + * @throws ReflectionException |
|
42 | + */ |
|
43 | + protected function _parser($shortcode) |
|
44 | + { |
|
45 | + switch ($shortcode) { |
|
46 | + case '[EVENT_LIST]': |
|
47 | + return $this->_get_event_list(); |
|
48 | + } |
|
49 | + return ''; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
55 | + * |
|
56 | + * @return string |
|
57 | + * @throws EE_Error |
|
58 | + * @throws ReflectionException |
|
59 | + */ |
|
60 | + private function _get_event_list() |
|
61 | + { |
|
62 | + $this->_validate_list_requirements(); |
|
63 | + |
|
64 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
65 | + return $this->_get_event_list_for_main(); |
|
66 | + } |
|
67 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
68 | + return $this->_get_event_list_for_registration(); |
|
69 | + } |
|
70 | + // prevent recursive loop |
|
71 | + return ''; |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * This returns the parsed event list for main template |
|
77 | + * |
|
78 | + * @return string |
|
79 | + */ |
|
80 | + private function _get_event_list_for_main() |
|
81 | + { |
|
82 | + |
|
83 | + $valid_shortcodes = [ |
|
84 | + 'event', |
|
85 | + 'attendee_list', |
|
86 | + 'ticket_list', |
|
87 | + 'datetime_list', |
|
88 | + 'venue', |
|
89 | + 'attendee', |
|
90 | + 'recipient_list', |
|
91 | + 'recipient_details', |
|
92 | + 'primary_registration_list', |
|
93 | + 'primary_registration_details', |
|
94 | + 'event_author', |
|
95 | + 'organization', |
|
96 | + ]; |
|
97 | + $template = $this->_data['template']; |
|
98 | + $data = $this->_data['data']; |
|
99 | + $events = ''; |
|
100 | + |
|
101 | + // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
102 | + foreach ($data->events as $event) { |
|
103 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
104 | + $template, |
|
105 | + $event['event'], |
|
106 | + $valid_shortcodes, |
|
107 | + $this->_extra_data |
|
108 | + ); |
|
109 | + } |
|
110 | + return $events; |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * This returns the parsed event list for an attendee |
|
116 | + * |
|
117 | + * @return string |
|
118 | + * @throws EE_Error |
|
119 | + * @throws ReflectionException |
|
120 | + */ |
|
121 | + private function _get_event_list_for_registration() |
|
122 | + { |
|
123 | + $valid_shortcodes = [ |
|
124 | + 'event', |
|
125 | + 'ticket_list', |
|
126 | + 'datetime_list', |
|
127 | + 'attendee', |
|
128 | + 'event_author', |
|
129 | + 'recipient_details', |
|
130 | + 'recipient_list', |
|
131 | + 'venue', |
|
132 | + 'organization', |
|
133 | + ]; |
|
134 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
135 | + ? $this->_data['template']['event_list'] |
|
136 | + : $this->_extra_data['template']['event_list']; |
|
137 | + $registration = $this->_data['data']; |
|
138 | + |
|
139 | + // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
140 | + $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
141 | + |
|
142 | + // here we're setting up the events for the event_list template for THIS registration. |
|
143 | + $all_events = $this->_get_events_from_registration($registration); |
|
144 | + |
|
145 | + // we're NOT going to prepare a list of attendees this time around |
|
146 | + $events = ''; |
|
147 | + |
|
148 | + foreach ($all_events as $event) { |
|
149 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
150 | + $template, |
|
151 | + $event, |
|
152 | + $valid_shortcodes, |
|
153 | + $this->_extra_data |
|
154 | + ); |
|
155 | + } |
|
156 | + |
|
157 | + return $events; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @param EE_Registration $registration |
|
163 | + * @return array |
|
164 | + * @throws EE_Error |
|
165 | + * @throws ReflectionException |
|
166 | + */ |
|
167 | + private function _get_events_from_registration(EE_Registration $registration) |
|
168 | + { |
|
169 | + return isset($this->_extra_data['data']->registrations) |
|
170 | + ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']] |
|
171 | + : []; |
|
172 | + } |
|
173 | 173 | } |
@@ -13,381 +13,381 @@ |
||
13 | 13 | class EE_Admin_Table_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * whether to display the taxes row or not |
|
18 | - * |
|
19 | - * @type bool $_show_taxes |
|
20 | - */ |
|
21 | - protected $_show_taxes = false; |
|
22 | - |
|
23 | - /** |
|
24 | - * html for any tax rows |
|
25 | - * |
|
26 | - * @type string $_show_taxes |
|
27 | - */ |
|
28 | - protected $_taxes_html = ''; |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * total amount including tax we can bill for at this time |
|
33 | - * |
|
34 | - * @type float $_grand_total |
|
35 | - */ |
|
36 | - protected $_grand_total = 0.00; |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * @return float |
|
41 | - */ |
|
42 | - public function grand_total() |
|
43 | - { |
|
44 | - return $this->_grand_total; |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * This is used to output a single |
|
50 | - * |
|
51 | - * @param EE_Line_Item $line_item |
|
52 | - * @param array $options |
|
53 | - * @return mixed |
|
54 | - * @throws EE_Error |
|
55 | - * @throws ReflectionException |
|
56 | - */ |
|
57 | - public function display_line_item(EE_Line_Item $line_item, $options = []) |
|
58 | - { |
|
59 | - $html = ''; |
|
60 | - // set some default options and merge with incoming |
|
61 | - $default_options = [ |
|
62 | - 'odd' => true, |
|
63 | - 'use_table_wrapper' => true, |
|
64 | - 'table_css_class' => 'admin-primary-mbox-tbl', |
|
65 | - 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
|
66 | - 'total_tr_css_class' => 'admin-primary-mbox-total-tr', |
|
67 | - ]; |
|
68 | - $options = array_merge($default_options, (array) $options); |
|
69 | - |
|
70 | - switch ($line_item->type()) { |
|
71 | - case EEM_Line_Item::type_line_item: |
|
72 | - // item row |
|
73 | - $html .= $this->_item_row($line_item, $options); |
|
74 | - break; |
|
75 | - |
|
76 | - case EEM_Line_Item::type_sub_line_item: |
|
77 | - // currently not showing sub-items |
|
78 | - // $html .= $this->_sub_item_row($line_item, $options); |
|
79 | - break; |
|
80 | - |
|
81 | - case EEM_Line_Item::type_sub_total: |
|
82 | - if ($line_item->quantity() === 0) { |
|
83 | - return $html; |
|
84 | - } |
|
85 | - // loop through children |
|
86 | - $child_line_items = $line_item->children(); |
|
87 | - // loop through children |
|
88 | - foreach ($child_line_items as $child_line_item) { |
|
89 | - // recursively feed children back into this method |
|
90 | - $html .= $this->display_line_item($child_line_item, $options); |
|
91 | - } |
|
92 | - // currently not showing subtotal row |
|
93 | - // $html .= $this->_sub_total_row($line_item, $options); |
|
94 | - break; |
|
95 | - |
|
96 | - case EEM_Line_Item::type_tax: |
|
97 | - if ($this->_show_taxes) { |
|
98 | - $this->_taxes_html .= $this->_tax_row($line_item); |
|
99 | - } |
|
100 | - break; |
|
101 | - |
|
102 | - case EEM_Line_Item::type_tax_sub_total: |
|
103 | - foreach ($line_item->children() as $child_line_item) { |
|
104 | - if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
105 | - $this->display_line_item($child_line_item, $options); |
|
106 | - } |
|
107 | - } |
|
108 | - break; |
|
109 | - |
|
110 | - case EEM_Line_Item::type_total: |
|
111 | - // determine whether to display taxes or not |
|
112 | - $this->_show_taxes = $line_item->get_total_tax() > 0; |
|
113 | - // get all child line items |
|
114 | - $children = $line_item->children(); |
|
115 | - |
|
116 | - // loop thru all non-tax child line items |
|
117 | - foreach ($children as $child_line_item) { |
|
118 | - $html .= $this->display_line_item($child_line_item, $options); |
|
119 | - } |
|
120 | - |
|
121 | - $html .= $this->_taxes_html; |
|
122 | - $html .= $this->_total_row($line_item); |
|
123 | - if ($options['use_table_wrapper']) { |
|
124 | - $html = $this->_table_header($options) . $html . $this->_table_footer(); |
|
125 | - } |
|
126 | - break; |
|
127 | - } |
|
128 | - |
|
129 | - return $html; |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * Table header for display. |
|
135 | - * |
|
136 | - * @param array $options array of options for the table. |
|
137 | - * @return string |
|
138 | - * @since 4.8 |
|
139 | - */ |
|
140 | - protected function _table_header(array $options) |
|
141 | - { |
|
142 | - $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
143 | - $html .= EEH_HTML::thead(); |
|
144 | - $html .= EEH_HTML::tr(); |
|
145 | - $html .= EEH_HTML::th(esc_html__('Name', 'event_espresso'), '', 'jst-left'); |
|
146 | - $html .= EEH_HTML::th(esc_html__('Type', 'event_espresso'), '', 'jst-left'); |
|
147 | - $html .= EEH_HTML::th(esc_html__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
148 | - $html .= EEH_HTML::th(esc_html__('Qty', 'event_espresso'), '', 'jst-cntr'); |
|
149 | - $html .= EEH_HTML::th(esc_html__('Line Total', 'event_espresso'), '', 'jst-cntr'); |
|
150 | - $html .= EEH_HTML::tbody(); |
|
151 | - return $html; |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * Table footer for display |
|
157 | - * |
|
158 | - * @return string |
|
159 | - * @since 4.8 |
|
160 | - */ |
|
161 | - protected function _table_footer() |
|
162 | - { |
|
163 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * _item_row |
|
169 | - * |
|
170 | - * @param EE_Line_Item $line_item |
|
171 | - * @param array $options |
|
172 | - * @return mixed |
|
173 | - * @throws EE_Error |
|
174 | - * @throws ReflectionException |
|
175 | - */ |
|
176 | - protected function _item_row(EE_Line_Item $line_item, $options = []) |
|
177 | - { |
|
178 | - $line_item_related_object = $line_item->get_object(); |
|
179 | - $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
|
180 | - ? $line_item->parent()->get_object() |
|
181 | - : null; |
|
182 | - // start of row |
|
183 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
184 | - $html = EEH_HTML::tr('', '', $row_class); |
|
185 | - |
|
186 | - // Name Column |
|
187 | - $name_link = $line_item_related_object instanceof EEI_Admin_Links |
|
188 | - ? $line_item_related_object->get_admin_details_link() |
|
189 | - : ''; |
|
190 | - |
|
191 | - // related object scope. |
|
192 | - $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
|
193 | - ? $parent_line_item_related_object->name() |
|
194 | - : ''; |
|
195 | - $parent_related_object_name = empty($parent_related_object_name) |
|
196 | - && $line_item->parent() instanceof EE_Line_Item |
|
197 | - ? $line_item->parent()->name() |
|
198 | - : $parent_related_object_name; |
|
199 | - |
|
200 | - $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
|
201 | - ? $parent_line_item_related_object->get_admin_details_link() |
|
202 | - : ''; |
|
203 | - |
|
204 | - $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
|
205 | - ? $line_item_related_object->name() |
|
206 | - : $line_item->name(); |
|
207 | - |
|
208 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
209 | - $name_html .= $line_item->is_taxable() ? ' *' : ''; |
|
210 | - |
|
211 | - // maybe preface with icon? |
|
212 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon |
|
213 | - ? $line_item_related_object->get_icon() . $name_html |
|
214 | - : $name_html; |
|
215 | - |
|
216 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
217 | - |
|
218 | - $name_html .= sprintf( |
|
219 | - _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
220 | - '<span class="ee-line-item-related-parent-object">', |
|
221 | - $line_item->parent() instanceof EE_Line_Item |
|
222 | - ? $line_item->parent()->OBJ_type_i18n() |
|
223 | - : esc_html__('Item:', 'event_espresso'), |
|
224 | - $parent_related_object_link |
|
225 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
226 | - : $parent_related_object_name, |
|
227 | - '</span>' |
|
228 | - ); |
|
229 | - |
|
230 | - $name_html = apply_filters( |
|
231 | - 'FHEE__EE_Admin_Table_Line_Item_Display_Strategy___item_row__name_html', |
|
232 | - $name_html, |
|
233 | - $line_item, |
|
234 | - $options |
|
235 | - ); |
|
236 | - |
|
237 | - $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
238 | - |
|
239 | - // Type Column |
|
240 | - $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
|
241 | - $type_html .= $this->_get_cancellations($line_item); |
|
242 | - $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
|
243 | - $code = $line_item_related_object instanceof EEI_Has_Code |
|
244 | - ? $line_item_related_object->code() |
|
245 | - : ''; |
|
246 | - $type_html .= ! empty($code) |
|
247 | - ? '<span class="ee-line-item-id">' . sprintf(esc_html__('Code: %s', 'event_espresso'), $code) . '</span>' |
|
248 | - : ''; |
|
249 | - $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
250 | - |
|
251 | - // Amount Column |
|
252 | - $html .= $line_item->is_percent() |
|
253 | - ? EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght') |
|
254 | - : EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
255 | - |
|
256 | - // QTY column |
|
257 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght'); |
|
258 | - |
|
259 | - // total column |
|
260 | - $html .= EEH_HTML::td( |
|
261 | - EEH_Template::format_currency($line_item->total(), false, false), |
|
262 | - '', |
|
263 | - 'jst-rght' |
|
264 | - ); |
|
265 | - |
|
266 | - // finish things off and return |
|
267 | - $html .= EEH_HTML::trx(); |
|
268 | - return $html; |
|
269 | - } |
|
270 | - |
|
271 | - |
|
272 | - /** |
|
273 | - * _get_cancellations |
|
274 | - * |
|
275 | - * @param EE_Line_Item $line_item |
|
276 | - * @return string |
|
277 | - * @throws EE_Error |
|
278 | - * @throws ReflectionException |
|
279 | - */ |
|
280 | - protected function _get_cancellations(EE_Line_Item $line_item) |
|
281 | - { |
|
282 | - $html = ''; |
|
283 | - $cancellations = $line_item->get_cancellations(); |
|
284 | - $cancellation = reset($cancellations); |
|
285 | - if ($cancellation instanceof EE_Line_Item) { |
|
286 | - $html .= ' <span class="ee-line-item-id">'; |
|
287 | - $html .= sprintf( |
|
288 | - _n( |
|
289 | - '(%1$s Cancellation)', |
|
290 | - '(%1$s Cancellations)', |
|
291 | - $cancellation->quantity(), |
|
292 | - 'event_espresso' |
|
293 | - ), |
|
294 | - $cancellation->quantity() |
|
295 | - ); |
|
296 | - $html .= '</span>'; |
|
297 | - } |
|
298 | - return $html; |
|
299 | - } |
|
300 | - |
|
301 | - |
|
302 | - // /** |
|
303 | - // * _sub_item_row |
|
304 | - // * |
|
305 | - // * @param EE_Line_Item $line_item |
|
306 | - // * @param array $options |
|
307 | - // * @return mixed |
|
308 | - // */ |
|
309 | - // protected function _sub_item_row(EE_Line_Item $line_item, $options = []) |
|
310 | - // { |
|
311 | - // // for now we're not showing sub-items |
|
312 | - // return ''; |
|
313 | - // } |
|
314 | - |
|
315 | - |
|
316 | - /** |
|
317 | - * _tax_row |
|
318 | - * |
|
319 | - * @param EE_Line_Item $line_item |
|
320 | - * @return mixed |
|
321 | - * @throws EE_Error |
|
322 | - * @throws ReflectionException |
|
323 | - */ |
|
324 | - protected function _tax_row(EE_Line_Item $line_item) |
|
325 | - { |
|
326 | - // start of row |
|
327 | - $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
328 | - // name th |
|
329 | - $html .= EEH_HTML::th( |
|
330 | - $line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', |
|
331 | - '', |
|
332 | - 'jst-rght', |
|
333 | - '', |
|
334 | - ' colspan="4"' |
|
335 | - ); |
|
336 | - // total th |
|
337 | - $html .= EEH_HTML::th( |
|
338 | - EEH_Template::format_currency($line_item->total(), false, false), |
|
339 | - '', |
|
340 | - 'jst-rght' |
|
341 | - ); |
|
342 | - // end of row |
|
343 | - $html .= EEH_HTML::trx(); |
|
344 | - return $html; |
|
345 | - } |
|
346 | - |
|
347 | - |
|
348 | - // /** |
|
349 | - // * _total_row |
|
350 | - // * |
|
351 | - // * @param EE_Line_Item $line_item |
|
352 | - // * @param string $text |
|
353 | - // * @param array $options |
|
354 | - // * @return mixed |
|
355 | - // */ |
|
356 | - // protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = []) |
|
357 | - // { |
|
358 | - // // currently not showing subtotal row |
|
359 | - // return ''; |
|
360 | - // } |
|
361 | - |
|
362 | - |
|
363 | - /** |
|
364 | - * _total_row |
|
365 | - * |
|
366 | - * @param EE_Line_Item $line_item |
|
367 | - * @return mixed |
|
368 | - * @throws EE_Error |
|
369 | - * @throws ReflectionException |
|
370 | - */ |
|
371 | - protected function _total_row(EE_Line_Item $line_item) |
|
372 | - { |
|
373 | - // start of row |
|
374 | - $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
375 | - // Total th label |
|
376 | - $total_label = |
|
377 | - sprintf( |
|
378 | - esc_html__('Transaction Total %s', 'event_espresso'), |
|
379 | - '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
380 | - ); |
|
381 | - $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
382 | - // total th |
|
383 | - |
|
384 | - $html .= EEH_HTML::th( |
|
385 | - EEH_Template::format_currency($line_item->total(), false, false), |
|
386 | - '', |
|
387 | - 'jst-rght' |
|
388 | - ); |
|
389 | - // end of row |
|
390 | - $html .= EEH_HTML::trx(); |
|
391 | - return $html; |
|
392 | - } |
|
16 | + /** |
|
17 | + * whether to display the taxes row or not |
|
18 | + * |
|
19 | + * @type bool $_show_taxes |
|
20 | + */ |
|
21 | + protected $_show_taxes = false; |
|
22 | + |
|
23 | + /** |
|
24 | + * html for any tax rows |
|
25 | + * |
|
26 | + * @type string $_show_taxes |
|
27 | + */ |
|
28 | + protected $_taxes_html = ''; |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * total amount including tax we can bill for at this time |
|
33 | + * |
|
34 | + * @type float $_grand_total |
|
35 | + */ |
|
36 | + protected $_grand_total = 0.00; |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * @return float |
|
41 | + */ |
|
42 | + public function grand_total() |
|
43 | + { |
|
44 | + return $this->_grand_total; |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * This is used to output a single |
|
50 | + * |
|
51 | + * @param EE_Line_Item $line_item |
|
52 | + * @param array $options |
|
53 | + * @return mixed |
|
54 | + * @throws EE_Error |
|
55 | + * @throws ReflectionException |
|
56 | + */ |
|
57 | + public function display_line_item(EE_Line_Item $line_item, $options = []) |
|
58 | + { |
|
59 | + $html = ''; |
|
60 | + // set some default options and merge with incoming |
|
61 | + $default_options = [ |
|
62 | + 'odd' => true, |
|
63 | + 'use_table_wrapper' => true, |
|
64 | + 'table_css_class' => 'admin-primary-mbox-tbl', |
|
65 | + 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
|
66 | + 'total_tr_css_class' => 'admin-primary-mbox-total-tr', |
|
67 | + ]; |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | + |
|
70 | + switch ($line_item->type()) { |
|
71 | + case EEM_Line_Item::type_line_item: |
|
72 | + // item row |
|
73 | + $html .= $this->_item_row($line_item, $options); |
|
74 | + break; |
|
75 | + |
|
76 | + case EEM_Line_Item::type_sub_line_item: |
|
77 | + // currently not showing sub-items |
|
78 | + // $html .= $this->_sub_item_row($line_item, $options); |
|
79 | + break; |
|
80 | + |
|
81 | + case EEM_Line_Item::type_sub_total: |
|
82 | + if ($line_item->quantity() === 0) { |
|
83 | + return $html; |
|
84 | + } |
|
85 | + // loop through children |
|
86 | + $child_line_items = $line_item->children(); |
|
87 | + // loop through children |
|
88 | + foreach ($child_line_items as $child_line_item) { |
|
89 | + // recursively feed children back into this method |
|
90 | + $html .= $this->display_line_item($child_line_item, $options); |
|
91 | + } |
|
92 | + // currently not showing subtotal row |
|
93 | + // $html .= $this->_sub_total_row($line_item, $options); |
|
94 | + break; |
|
95 | + |
|
96 | + case EEM_Line_Item::type_tax: |
|
97 | + if ($this->_show_taxes) { |
|
98 | + $this->_taxes_html .= $this->_tax_row($line_item); |
|
99 | + } |
|
100 | + break; |
|
101 | + |
|
102 | + case EEM_Line_Item::type_tax_sub_total: |
|
103 | + foreach ($line_item->children() as $child_line_item) { |
|
104 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
105 | + $this->display_line_item($child_line_item, $options); |
|
106 | + } |
|
107 | + } |
|
108 | + break; |
|
109 | + |
|
110 | + case EEM_Line_Item::type_total: |
|
111 | + // determine whether to display taxes or not |
|
112 | + $this->_show_taxes = $line_item->get_total_tax() > 0; |
|
113 | + // get all child line items |
|
114 | + $children = $line_item->children(); |
|
115 | + |
|
116 | + // loop thru all non-tax child line items |
|
117 | + foreach ($children as $child_line_item) { |
|
118 | + $html .= $this->display_line_item($child_line_item, $options); |
|
119 | + } |
|
120 | + |
|
121 | + $html .= $this->_taxes_html; |
|
122 | + $html .= $this->_total_row($line_item); |
|
123 | + if ($options['use_table_wrapper']) { |
|
124 | + $html = $this->_table_header($options) . $html . $this->_table_footer(); |
|
125 | + } |
|
126 | + break; |
|
127 | + } |
|
128 | + |
|
129 | + return $html; |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * Table header for display. |
|
135 | + * |
|
136 | + * @param array $options array of options for the table. |
|
137 | + * @return string |
|
138 | + * @since 4.8 |
|
139 | + */ |
|
140 | + protected function _table_header(array $options) |
|
141 | + { |
|
142 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
143 | + $html .= EEH_HTML::thead(); |
|
144 | + $html .= EEH_HTML::tr(); |
|
145 | + $html .= EEH_HTML::th(esc_html__('Name', 'event_espresso'), '', 'jst-left'); |
|
146 | + $html .= EEH_HTML::th(esc_html__('Type', 'event_espresso'), '', 'jst-left'); |
|
147 | + $html .= EEH_HTML::th(esc_html__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
148 | + $html .= EEH_HTML::th(esc_html__('Qty', 'event_espresso'), '', 'jst-cntr'); |
|
149 | + $html .= EEH_HTML::th(esc_html__('Line Total', 'event_espresso'), '', 'jst-cntr'); |
|
150 | + $html .= EEH_HTML::tbody(); |
|
151 | + return $html; |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * Table footer for display |
|
157 | + * |
|
158 | + * @return string |
|
159 | + * @since 4.8 |
|
160 | + */ |
|
161 | + protected function _table_footer() |
|
162 | + { |
|
163 | + return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * _item_row |
|
169 | + * |
|
170 | + * @param EE_Line_Item $line_item |
|
171 | + * @param array $options |
|
172 | + * @return mixed |
|
173 | + * @throws EE_Error |
|
174 | + * @throws ReflectionException |
|
175 | + */ |
|
176 | + protected function _item_row(EE_Line_Item $line_item, $options = []) |
|
177 | + { |
|
178 | + $line_item_related_object = $line_item->get_object(); |
|
179 | + $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
|
180 | + ? $line_item->parent()->get_object() |
|
181 | + : null; |
|
182 | + // start of row |
|
183 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
184 | + $html = EEH_HTML::tr('', '', $row_class); |
|
185 | + |
|
186 | + // Name Column |
|
187 | + $name_link = $line_item_related_object instanceof EEI_Admin_Links |
|
188 | + ? $line_item_related_object->get_admin_details_link() |
|
189 | + : ''; |
|
190 | + |
|
191 | + // related object scope. |
|
192 | + $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
|
193 | + ? $parent_line_item_related_object->name() |
|
194 | + : ''; |
|
195 | + $parent_related_object_name = empty($parent_related_object_name) |
|
196 | + && $line_item->parent() instanceof EE_Line_Item |
|
197 | + ? $line_item->parent()->name() |
|
198 | + : $parent_related_object_name; |
|
199 | + |
|
200 | + $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
|
201 | + ? $parent_line_item_related_object->get_admin_details_link() |
|
202 | + : ''; |
|
203 | + |
|
204 | + $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
|
205 | + ? $line_item_related_object->name() |
|
206 | + : $line_item->name(); |
|
207 | + |
|
208 | + $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
209 | + $name_html .= $line_item->is_taxable() ? ' *' : ''; |
|
210 | + |
|
211 | + // maybe preface with icon? |
|
212 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon |
|
213 | + ? $line_item_related_object->get_icon() . $name_html |
|
214 | + : $name_html; |
|
215 | + |
|
216 | + $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
217 | + |
|
218 | + $name_html .= sprintf( |
|
219 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
220 | + '<span class="ee-line-item-related-parent-object">', |
|
221 | + $line_item->parent() instanceof EE_Line_Item |
|
222 | + ? $line_item->parent()->OBJ_type_i18n() |
|
223 | + : esc_html__('Item:', 'event_espresso'), |
|
224 | + $parent_related_object_link |
|
225 | + ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
226 | + : $parent_related_object_name, |
|
227 | + '</span>' |
|
228 | + ); |
|
229 | + |
|
230 | + $name_html = apply_filters( |
|
231 | + 'FHEE__EE_Admin_Table_Line_Item_Display_Strategy___item_row__name_html', |
|
232 | + $name_html, |
|
233 | + $line_item, |
|
234 | + $options |
|
235 | + ); |
|
236 | + |
|
237 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
238 | + |
|
239 | + // Type Column |
|
240 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
|
241 | + $type_html .= $this->_get_cancellations($line_item); |
|
242 | + $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
|
243 | + $code = $line_item_related_object instanceof EEI_Has_Code |
|
244 | + ? $line_item_related_object->code() |
|
245 | + : ''; |
|
246 | + $type_html .= ! empty($code) |
|
247 | + ? '<span class="ee-line-item-id">' . sprintf(esc_html__('Code: %s', 'event_espresso'), $code) . '</span>' |
|
248 | + : ''; |
|
249 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
250 | + |
|
251 | + // Amount Column |
|
252 | + $html .= $line_item->is_percent() |
|
253 | + ? EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght') |
|
254 | + : EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
255 | + |
|
256 | + // QTY column |
|
257 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght'); |
|
258 | + |
|
259 | + // total column |
|
260 | + $html .= EEH_HTML::td( |
|
261 | + EEH_Template::format_currency($line_item->total(), false, false), |
|
262 | + '', |
|
263 | + 'jst-rght' |
|
264 | + ); |
|
265 | + |
|
266 | + // finish things off and return |
|
267 | + $html .= EEH_HTML::trx(); |
|
268 | + return $html; |
|
269 | + } |
|
270 | + |
|
271 | + |
|
272 | + /** |
|
273 | + * _get_cancellations |
|
274 | + * |
|
275 | + * @param EE_Line_Item $line_item |
|
276 | + * @return string |
|
277 | + * @throws EE_Error |
|
278 | + * @throws ReflectionException |
|
279 | + */ |
|
280 | + protected function _get_cancellations(EE_Line_Item $line_item) |
|
281 | + { |
|
282 | + $html = ''; |
|
283 | + $cancellations = $line_item->get_cancellations(); |
|
284 | + $cancellation = reset($cancellations); |
|
285 | + if ($cancellation instanceof EE_Line_Item) { |
|
286 | + $html .= ' <span class="ee-line-item-id">'; |
|
287 | + $html .= sprintf( |
|
288 | + _n( |
|
289 | + '(%1$s Cancellation)', |
|
290 | + '(%1$s Cancellations)', |
|
291 | + $cancellation->quantity(), |
|
292 | + 'event_espresso' |
|
293 | + ), |
|
294 | + $cancellation->quantity() |
|
295 | + ); |
|
296 | + $html .= '</span>'; |
|
297 | + } |
|
298 | + return $html; |
|
299 | + } |
|
300 | + |
|
301 | + |
|
302 | + // /** |
|
303 | + // * _sub_item_row |
|
304 | + // * |
|
305 | + // * @param EE_Line_Item $line_item |
|
306 | + // * @param array $options |
|
307 | + // * @return mixed |
|
308 | + // */ |
|
309 | + // protected function _sub_item_row(EE_Line_Item $line_item, $options = []) |
|
310 | + // { |
|
311 | + // // for now we're not showing sub-items |
|
312 | + // return ''; |
|
313 | + // } |
|
314 | + |
|
315 | + |
|
316 | + /** |
|
317 | + * _tax_row |
|
318 | + * |
|
319 | + * @param EE_Line_Item $line_item |
|
320 | + * @return mixed |
|
321 | + * @throws EE_Error |
|
322 | + * @throws ReflectionException |
|
323 | + */ |
|
324 | + protected function _tax_row(EE_Line_Item $line_item) |
|
325 | + { |
|
326 | + // start of row |
|
327 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
328 | + // name th |
|
329 | + $html .= EEH_HTML::th( |
|
330 | + $line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', |
|
331 | + '', |
|
332 | + 'jst-rght', |
|
333 | + '', |
|
334 | + ' colspan="4"' |
|
335 | + ); |
|
336 | + // total th |
|
337 | + $html .= EEH_HTML::th( |
|
338 | + EEH_Template::format_currency($line_item->total(), false, false), |
|
339 | + '', |
|
340 | + 'jst-rght' |
|
341 | + ); |
|
342 | + // end of row |
|
343 | + $html .= EEH_HTML::trx(); |
|
344 | + return $html; |
|
345 | + } |
|
346 | + |
|
347 | + |
|
348 | + // /** |
|
349 | + // * _total_row |
|
350 | + // * |
|
351 | + // * @param EE_Line_Item $line_item |
|
352 | + // * @param string $text |
|
353 | + // * @param array $options |
|
354 | + // * @return mixed |
|
355 | + // */ |
|
356 | + // protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = []) |
|
357 | + // { |
|
358 | + // // currently not showing subtotal row |
|
359 | + // return ''; |
|
360 | + // } |
|
361 | + |
|
362 | + |
|
363 | + /** |
|
364 | + * _total_row |
|
365 | + * |
|
366 | + * @param EE_Line_Item $line_item |
|
367 | + * @return mixed |
|
368 | + * @throws EE_Error |
|
369 | + * @throws ReflectionException |
|
370 | + */ |
|
371 | + protected function _total_row(EE_Line_Item $line_item) |
|
372 | + { |
|
373 | + // start of row |
|
374 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
375 | + // Total th label |
|
376 | + $total_label = |
|
377 | + sprintf( |
|
378 | + esc_html__('Transaction Total %s', 'event_espresso'), |
|
379 | + '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
380 | + ); |
|
381 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
382 | + // total th |
|
383 | + |
|
384 | + $html .= EEH_HTML::th( |
|
385 | + EEH_Template::format_currency($line_item->total(), false, false), |
|
386 | + '', |
|
387 | + 'jst-rght' |
|
388 | + ); |
|
389 | + // end of row |
|
390 | + $html .= EEH_HTML::trx(); |
|
391 | + return $html; |
|
392 | + } |
|
393 | 393 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
66 | 66 | 'total_tr_css_class' => 'admin-primary-mbox-total-tr', |
67 | 67 | ]; |
68 | - $options = array_merge($default_options, (array) $options); |
|
68 | + $options = array_merge($default_options, (array) $options); |
|
69 | 69 | |
70 | 70 | switch ($line_item->type()) { |
71 | 71 | case EEM_Line_Item::type_line_item: |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $html .= $this->_taxes_html; |
122 | 122 | $html .= $this->_total_row($line_item); |
123 | 123 | if ($options['use_table_wrapper']) { |
124 | - $html = $this->_table_header($options) . $html . $this->_table_footer(); |
|
124 | + $html = $this->_table_header($options).$html.$this->_table_footer(); |
|
125 | 125 | } |
126 | 126 | break; |
127 | 127 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | protected function _table_footer() |
162 | 162 | { |
163 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
163 | + return EEH_HTML::tbodyx().EEH_HTML::tablex(); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | ? $line_item_related_object->name() |
206 | 206 | : $line_item->name(); |
207 | 207 | |
208 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
208 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html; |
|
209 | 209 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
210 | 210 | |
211 | 211 | // maybe preface with icon? |
212 | 212 | $name_html = $line_item_related_object instanceof EEI_Has_Icon |
213 | - ? $line_item_related_object->get_icon() . $name_html |
|
213 | + ? $line_item_related_object->get_icon().$name_html |
|
214 | 214 | : $name_html; |
215 | 215 | |
216 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
216 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
217 | 217 | |
218 | 218 | $name_html .= sprintf( |
219 | 219 | _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | ? $line_item->parent()->OBJ_type_i18n() |
223 | 223 | : esc_html__('Item:', 'event_espresso'), |
224 | 224 | $parent_related_object_link |
225 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
225 | + ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' |
|
226 | 226 | : $parent_related_object_name, |
227 | 227 | '</span>' |
228 | 228 | ); |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | ? $line_item_related_object->code() |
245 | 245 | : ''; |
246 | 246 | $type_html .= ! empty($code) |
247 | - ? '<span class="ee-line-item-id">' . sprintf(esc_html__('Code: %s', 'event_espresso'), $code) . '</span>' |
|
247 | + ? '<span class="ee-line-item-id">'.sprintf(esc_html__('Code: %s', 'event_espresso'), $code).'</span>' |
|
248 | 248 | : ''; |
249 | 249 | $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
250 | 250 | |
251 | 251 | // Amount Column |
252 | 252 | $html .= $line_item->is_percent() |
253 | - ? EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght') |
|
253 | + ? EEH_HTML::td($line_item->percent().'%', '', 'jst-rght') |
|
254 | 254 | : EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
255 | 255 | |
256 | 256 | // QTY column |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
328 | 328 | // name th |
329 | 329 | $html .= EEH_HTML::th( |
330 | - $line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', |
|
330 | + $line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', |
|
331 | 331 | '', |
332 | 332 | 'jst-rght', |
333 | 333 | '', |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $total_label = |
377 | 377 | sprintf( |
378 | 378 | esc_html__('Transaction Total %s', 'event_espresso'), |
379 | - '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
379 | + '('.EE_Registry::instance()->CFG->currency->code.')' |
|
380 | 380 | ); |
381 | - $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
381 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
382 | 382 | // total th |
383 | 383 | |
384 | 384 | $html .= EEH_HTML::th( |
@@ -18,87 +18,87 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @var ExtraTxnFeesDistributionStrategyInterface |
|
23 | - */ |
|
24 | - protected $extra_fees_strategy; |
|
21 | + /** |
|
22 | + * @var ExtraTxnFeesDistributionStrategyInterface |
|
23 | + */ |
|
24 | + protected $extra_fees_strategy; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @return ExtraTxnFeesDistributionStrategyInterface |
|
29 | - * @throws DomainException |
|
30 | - */ |
|
31 | - private function getExtraTxnFeesDistributionStrategy() |
|
32 | - { |
|
33 | - if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { |
|
34 | - switch ($this->getDistributionStrategy()) { |
|
35 | - case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY: |
|
36 | - $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly(); |
|
37 | - break; |
|
38 | - case ExtraTxnFeesHandler::STRATEGY_DISTRIBUTE_EVENLY: |
|
39 | - $extra_fees_strategy = new ApplyExtraFeesToAllRegistrationsEvenly(); |
|
40 | - break; |
|
41 | - default: |
|
42 | - $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly(); |
|
43 | - } |
|
44 | - $this->validateExtraTxnFeesDistributionStrategy( |
|
45 | - $extra_fees_strategy, |
|
46 | - ExtraTxnFeesDistributionStrategyInterface::class |
|
47 | - ); |
|
48 | - $this->extra_fees_strategy = $extra_fees_strategy; |
|
49 | - } |
|
50 | - return $this->extra_fees_strategy; |
|
51 | - } |
|
27 | + /** |
|
28 | + * @return ExtraTxnFeesDistributionStrategyInterface |
|
29 | + * @throws DomainException |
|
30 | + */ |
|
31 | + private function getExtraTxnFeesDistributionStrategy() |
|
32 | + { |
|
33 | + if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { |
|
34 | + switch ($this->getDistributionStrategy()) { |
|
35 | + case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY: |
|
36 | + $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly(); |
|
37 | + break; |
|
38 | + case ExtraTxnFeesHandler::STRATEGY_DISTRIBUTE_EVENLY: |
|
39 | + $extra_fees_strategy = new ApplyExtraFeesToAllRegistrationsEvenly(); |
|
40 | + break; |
|
41 | + default: |
|
42 | + $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly(); |
|
43 | + } |
|
44 | + $this->validateExtraTxnFeesDistributionStrategy( |
|
45 | + $extra_fees_strategy, |
|
46 | + ExtraTxnFeesDistributionStrategyInterface::class |
|
47 | + ); |
|
48 | + $this->extra_fees_strategy = $extra_fees_strategy; |
|
49 | + } |
|
50 | + return $this->extra_fees_strategy; |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * @param EEI_Line_Item $line_item |
|
56 | - * @param EEI_Line_Item $child_line_item |
|
57 | - * @param float $original_li_total |
|
58 | - * @param float $running_total_for_all_tickets |
|
59 | - * @param float $running_total_for_specific_ticket |
|
60 | - * @param bool $is_primary_registrant |
|
61 | - * @throws EE_Error |
|
62 | - */ |
|
63 | - public function adjustUnitPriceForNonTicketLineItem( |
|
64 | - EEI_Line_Item $line_item, |
|
65 | - EEI_Line_Item $child_line_item, |
|
66 | - $original_li_total, |
|
67 | - $running_total_for_all_tickets, |
|
68 | - $running_total_for_specific_ticket, |
|
69 | - $is_primary_registrant |
|
70 | - ) { |
|
71 | - $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy(); |
|
72 | - $extra_fees_strategy->adjustUnitPriceForNonTicketLineItem( |
|
73 | - $line_item, |
|
74 | - $child_line_item, |
|
75 | - $original_li_total, |
|
76 | - $running_total_for_all_tickets, |
|
77 | - $running_total_for_specific_ticket, |
|
78 | - $is_primary_registrant, |
|
79 | - $this->total_reg_count, |
|
80 | - $this->context |
|
81 | - ); |
|
82 | - } |
|
54 | + /** |
|
55 | + * @param EEI_Line_Item $line_item |
|
56 | + * @param EEI_Line_Item $child_line_item |
|
57 | + * @param float $original_li_total |
|
58 | + * @param float $running_total_for_all_tickets |
|
59 | + * @param float $running_total_for_specific_ticket |
|
60 | + * @param bool $is_primary_registrant |
|
61 | + * @throws EE_Error |
|
62 | + */ |
|
63 | + public function adjustUnitPriceForNonTicketLineItem( |
|
64 | + EEI_Line_Item $line_item, |
|
65 | + EEI_Line_Item $child_line_item, |
|
66 | + $original_li_total, |
|
67 | + $running_total_for_all_tickets, |
|
68 | + $running_total_for_specific_ticket, |
|
69 | + $is_primary_registrant |
|
70 | + ) { |
|
71 | + $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy(); |
|
72 | + $extra_fees_strategy->adjustUnitPriceForNonTicketLineItem( |
|
73 | + $line_item, |
|
74 | + $child_line_item, |
|
75 | + $original_li_total, |
|
76 | + $running_total_for_all_tickets, |
|
77 | + $running_total_for_specific_ticket, |
|
78 | + $is_primary_registrant, |
|
79 | + $this->total_reg_count, |
|
80 | + $this->context |
|
81 | + ); |
|
82 | + } |
|
83 | 83 | |
84 | 84 | |
85 | - /** |
|
86 | - * @param EEI_Line_Item $line_item |
|
87 | - * @param EEI_Line_Item $child_line_item |
|
88 | - * @param bool $is_primary_registrant |
|
89 | - */ |
|
90 | - public function adjustUnitPriceAndQtyForTicketLineItem( |
|
91 | - EEI_Line_Item $line_item, |
|
92 | - EEI_Line_Item $child_line_item, |
|
93 | - $is_primary_registrant |
|
94 | - ) { |
|
95 | - $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy(); |
|
96 | - $extra_fees_strategy->adjustUnitPriceAndQtyForTicketLineItem( |
|
97 | - $line_item, |
|
98 | - $child_line_item, |
|
99 | - $is_primary_registrant, |
|
100 | - $this->total_reg_count, |
|
101 | - $this->context |
|
102 | - ); |
|
103 | - } |
|
85 | + /** |
|
86 | + * @param EEI_Line_Item $line_item |
|
87 | + * @param EEI_Line_Item $child_line_item |
|
88 | + * @param bool $is_primary_registrant |
|
89 | + */ |
|
90 | + public function adjustUnitPriceAndQtyForTicketLineItem( |
|
91 | + EEI_Line_Item $line_item, |
|
92 | + EEI_Line_Item $child_line_item, |
|
93 | + $is_primary_registrant |
|
94 | + ) { |
|
95 | + $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy(); |
|
96 | + $extra_fees_strategy->adjustUnitPriceAndQtyForTicketLineItem( |
|
97 | + $line_item, |
|
98 | + $child_line_item, |
|
99 | + $is_primary_registrant, |
|
100 | + $this->total_reg_count, |
|
101 | + $this->context |
|
102 | + ); |
|
103 | + } |
|
104 | 104 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | private function getExtraTxnFeesDistributionStrategy() |
32 | 32 | { |
33 | - if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { |
|
33 | + if ( ! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { |
|
34 | 34 | switch ($this->getDistributionStrategy()) { |
35 | 35 | case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY: |
36 | 36 | $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly(); |
@@ -6,40 +6,40 @@ |
||
6 | 6 | |
7 | 7 | interface ExtraTxnFeesDistributionStrategyInterface |
8 | 8 | { |
9 | - /** |
|
10 | - * @param EEI_Line_Item $line_item |
|
11 | - * @param EEI_Line_Item $child_line_item |
|
12 | - * @param float $original_li_total |
|
13 | - * @param float $running_total_for_all_tickets |
|
14 | - * @param float $running_total_for_specific_ticket |
|
15 | - * @param bool $is_primary_registrant |
|
16 | - * @param int $total_reg_count |
|
17 | - * @param string $context |
|
18 | - */ |
|
19 | - public function adjustUnitPriceForNonTicketLineItem( |
|
20 | - EEI_Line_Item $line_item, |
|
21 | - EEI_Line_Item $child_line_item, |
|
22 | - $original_li_total, |
|
23 | - $running_total_for_all_tickets, |
|
24 | - $running_total_for_specific_ticket, |
|
25 | - $is_primary_registrant, |
|
26 | - $total_reg_count, |
|
27 | - $context |
|
28 | - ); |
|
9 | + /** |
|
10 | + * @param EEI_Line_Item $line_item |
|
11 | + * @param EEI_Line_Item $child_line_item |
|
12 | + * @param float $original_li_total |
|
13 | + * @param float $running_total_for_all_tickets |
|
14 | + * @param float $running_total_for_specific_ticket |
|
15 | + * @param bool $is_primary_registrant |
|
16 | + * @param int $total_reg_count |
|
17 | + * @param string $context |
|
18 | + */ |
|
19 | + public function adjustUnitPriceForNonTicketLineItem( |
|
20 | + EEI_Line_Item $line_item, |
|
21 | + EEI_Line_Item $child_line_item, |
|
22 | + $original_li_total, |
|
23 | + $running_total_for_all_tickets, |
|
24 | + $running_total_for_specific_ticket, |
|
25 | + $is_primary_registrant, |
|
26 | + $total_reg_count, |
|
27 | + $context |
|
28 | + ); |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @param EEI_Line_Item $line_item |
|
33 | - * @param EEI_Line_Item $child_line_item |
|
34 | - * @param bool $is_primary_registrant |
|
35 | - * @param int $total_reg_count |
|
36 | - * @param string $context |
|
37 | - */ |
|
38 | - public function adjustUnitPriceAndQtyForTicketLineItem( |
|
39 | - EEI_Line_Item $line_item, |
|
40 | - EEI_Line_Item $child_line_item, |
|
41 | - $is_primary_registrant, |
|
42 | - $total_reg_count, |
|
43 | - $context |
|
44 | - ); |
|
31 | + /** |
|
32 | + * @param EEI_Line_Item $line_item |
|
33 | + * @param EEI_Line_Item $child_line_item |
|
34 | + * @param bool $is_primary_registrant |
|
35 | + * @param int $total_reg_count |
|
36 | + * @param string $context |
|
37 | + */ |
|
38 | + public function adjustUnitPriceAndQtyForTicketLineItem( |
|
39 | + EEI_Line_Item $line_item, |
|
40 | + EEI_Line_Item $child_line_item, |
|
41 | + $is_primary_registrant, |
|
42 | + $total_reg_count, |
|
43 | + $context |
|
44 | + ); |
|
45 | 45 | } |