@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.82.rc.014'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.82.rc.014'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @param EE_Line_Item $line_item |
71 | 71 | * @param array $options |
72 | - * @return mixed |
|
72 | + * @return string |
|
73 | 73 | * @throws EE_Error |
74 | 74 | * @throws InvalidArgumentException |
75 | 75 | * @throws InvalidDataTypeException |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @param EE_Line_Item $line_item |
170 | 170 | * @param array $options |
171 | - * @return mixed |
|
171 | + * @return string |
|
172 | 172 | */ |
173 | 173 | protected function _tax_row(EE_Line_Item $line_item, $options = array()) |
174 | 174 | { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param EE_Line_Item $line_item |
194 | 194 | * @param array $options |
195 | - * @return mixed |
|
195 | + * @return string |
|
196 | 196 | */ |
197 | 197 | protected function _total_row(EE_Line_Item $line_item, $options = array()) |
198 | 198 | { |
@@ -17,216 +17,216 @@ |
||
17 | 17 | class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * Table header for display. |
|
22 | - * @since 4.8 |
|
23 | - * @param array $options |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - protected function _table_header($options) |
|
27 | - { |
|
28 | - $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
29 | - $html .= EEH_HTML::thead(); |
|
30 | - $html .= EEH_HTML::tr(); |
|
31 | - $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
32 | - $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
33 | - $html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left'); |
|
34 | - $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
35 | - $html .= EEH_HTML::tbody(); |
|
36 | - return $html; |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @param EE_Registration $registration |
|
42 | - * @param EE_Base_Class $line_item_object |
|
43 | - * @param EE_Base_Class $parent_line_item_object |
|
44 | - * @return bool |
|
45 | - * @throws EE_Error |
|
46 | - * @throws InvalidArgumentException |
|
47 | - * @throws ReflectionException |
|
48 | - * @throws InvalidDataTypeException |
|
49 | - * @throws InvalidInterfaceException |
|
50 | - */ |
|
51 | - private function shouldSkipLineItemRow($registration, $line_item_object, $parent_line_item_object) |
|
52 | - { |
|
53 | - return ! $registration instanceof EE_Registration |
|
54 | - || ($line_item_object instanceof EE_Ticket && $line_item_object->ID() !== $registration->ticket_ID()) |
|
55 | - || ($line_item_object instanceof EE_Event && $line_item_object->ID() !== $registration->event_ID()) |
|
56 | - || ( |
|
57 | - $parent_line_item_object instanceof EE_Ticket |
|
58 | - && $parent_line_item_object->ID() !== $registration->ticket_ID() |
|
59 | - ) |
|
60 | - || ( |
|
61 | - $parent_line_item_object instanceof EE_Event |
|
62 | - && $parent_line_item_object->ID() !== $registration->event_ID() |
|
63 | - ); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * _item_row |
|
69 | - * |
|
70 | - * @param EE_Line_Item $line_item |
|
71 | - * @param array $options |
|
72 | - * @return mixed |
|
73 | - * @throws EE_Error |
|
74 | - * @throws InvalidArgumentException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws InvalidInterfaceException |
|
77 | - * @throws ReflectionException |
|
78 | - */ |
|
79 | - protected function _item_row(EE_Line_Item $line_item, $options = array()) |
|
80 | - { |
|
81 | - $line_item_related_object = $line_item->get_object(); |
|
82 | - $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
83 | - $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
|
84 | - ? $line_item->parent()->get_object() |
|
85 | - : null; |
|
86 | - if ($this->shouldSkipLineItemRow($registration, $line_item_related_object, $parent_line_item_related_object)) { |
|
87 | - return ''; |
|
88 | - } |
|
89 | - // start of row |
|
90 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
91 | - $html = EEH_HTML::tr('', '', $row_class); |
|
92 | - |
|
93 | - |
|
94 | - // Name Column |
|
95 | - $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : ''; |
|
96 | - |
|
97 | - // related object scope. |
|
98 | - $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
|
99 | - ? $parent_line_item_related_object->name() |
|
100 | - : ''; |
|
101 | - $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item |
|
102 | - ? $line_item->parent()->name() |
|
103 | - : $parent_related_object_name; |
|
104 | - $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
|
105 | - ? $parent_line_item_related_object->get_admin_details_link() |
|
106 | - : ''; |
|
107 | - |
|
108 | - |
|
109 | - $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
|
110 | - ? $line_item_related_object->name() : $line_item->name(); |
|
111 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' |
|
112 | - : $name_html; |
|
113 | - $name_html .= $line_item->is_taxable() ? ' *' : ''; |
|
114 | - // maybe preface with icon? |
|
115 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon |
|
116 | - ? $line_item_related_object->get_icon() . $name_html |
|
117 | - : $name_html; |
|
118 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
119 | - $name_html .= sprintf( |
|
120 | - _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
121 | - '<span class="ee-line-item-related-parent-object">', |
|
122 | - $line_item->parent() instanceof EE_Line_Item |
|
123 | - ? $line_item->parent()->OBJ_type_i18n() |
|
124 | - : __('Item:', 'event_espresso'), |
|
125 | - $parent_related_object_link |
|
126 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
127 | - : $parent_related_object_name, |
|
128 | - '</span>' |
|
129 | - ); |
|
130 | - $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
131 | - // Type Column |
|
132 | - $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
|
133 | - $type_html .= $this->_get_cancellations($line_item); |
|
134 | - $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
|
135 | - $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
|
136 | - $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; |
|
137 | - $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
138 | - |
|
139 | - // Date column |
|
140 | - $datetime_content = ''; |
|
141 | - if ($line_item_related_object instanceof EE_Ticket) { |
|
142 | - $datetimes = $line_item_related_object->datetimes(); |
|
143 | - foreach ($datetimes as $datetime) { |
|
144 | - if ($datetime instanceof EE_Datetime) { |
|
145 | - $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; |
|
146 | - } |
|
147 | - } |
|
148 | - } |
|
149 | - $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); |
|
150 | - |
|
151 | - // Amount Column |
|
152 | - if ($line_item->is_percent()) { |
|
153 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); |
|
154 | - } else { |
|
155 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - // finish things off and return |
|
160 | - $html .= EEH_HTML::trx(); |
|
161 | - return $html; |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * _tax_row |
|
168 | - * |
|
169 | - * @param EE_Line_Item $line_item |
|
170 | - * @param array $options |
|
171 | - * @return mixed |
|
172 | - */ |
|
173 | - protected function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
174 | - { |
|
175 | - // start of row |
|
176 | - $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
177 | - // name th |
|
178 | - $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="3"'); |
|
179 | - // total th |
|
180 | - $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
181 | - // end of row |
|
182 | - $html .= EEH_HTML::trx(); |
|
183 | - return $html; |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * _total_row |
|
192 | - * |
|
193 | - * @param EE_Line_Item $line_item |
|
194 | - * @param array $options |
|
195 | - * @return mixed |
|
196 | - */ |
|
197 | - protected function _total_row(EE_Line_Item $line_item, $options = array()) |
|
198 | - { |
|
199 | - |
|
200 | - $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
201 | - $registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0; |
|
202 | - // if no valid registration object then we're not going to show the approximate text. |
|
203 | - $total_match = $registration instanceof EE_Registration |
|
204 | - ? $registration->final_price() === $line_item->total() |
|
205 | - : true; |
|
206 | - |
|
207 | - // start of row |
|
208 | - $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
209 | - // Total th label |
|
210 | - if ($total_match) { |
|
211 | - $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
212 | - } else { |
|
213 | - $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
214 | - $total_label .= '<br>'; |
|
215 | - $total_label .= '<p class="ee-footnote-text">' |
|
216 | - . sprintf( |
|
217 | - __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others. This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'), |
|
218 | - '<strong>', |
|
219 | - $registration_total, |
|
220 | - '</strong>' |
|
221 | - ) |
|
222 | - . '</p>'; |
|
223 | - } |
|
224 | - $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"'); |
|
225 | - // total th |
|
226 | - |
|
227 | - $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
228 | - // end of row |
|
229 | - $html .= EEH_HTML::trx(); |
|
230 | - return $html; |
|
231 | - } |
|
20 | + /** |
|
21 | + * Table header for display. |
|
22 | + * @since 4.8 |
|
23 | + * @param array $options |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + protected function _table_header($options) |
|
27 | + { |
|
28 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
29 | + $html .= EEH_HTML::thead(); |
|
30 | + $html .= EEH_HTML::tr(); |
|
31 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
32 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
33 | + $html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left'); |
|
34 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
35 | + $html .= EEH_HTML::tbody(); |
|
36 | + return $html; |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @param EE_Registration $registration |
|
42 | + * @param EE_Base_Class $line_item_object |
|
43 | + * @param EE_Base_Class $parent_line_item_object |
|
44 | + * @return bool |
|
45 | + * @throws EE_Error |
|
46 | + * @throws InvalidArgumentException |
|
47 | + * @throws ReflectionException |
|
48 | + * @throws InvalidDataTypeException |
|
49 | + * @throws InvalidInterfaceException |
|
50 | + */ |
|
51 | + private function shouldSkipLineItemRow($registration, $line_item_object, $parent_line_item_object) |
|
52 | + { |
|
53 | + return ! $registration instanceof EE_Registration |
|
54 | + || ($line_item_object instanceof EE_Ticket && $line_item_object->ID() !== $registration->ticket_ID()) |
|
55 | + || ($line_item_object instanceof EE_Event && $line_item_object->ID() !== $registration->event_ID()) |
|
56 | + || ( |
|
57 | + $parent_line_item_object instanceof EE_Ticket |
|
58 | + && $parent_line_item_object->ID() !== $registration->ticket_ID() |
|
59 | + ) |
|
60 | + || ( |
|
61 | + $parent_line_item_object instanceof EE_Event |
|
62 | + && $parent_line_item_object->ID() !== $registration->event_ID() |
|
63 | + ); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * _item_row |
|
69 | + * |
|
70 | + * @param EE_Line_Item $line_item |
|
71 | + * @param array $options |
|
72 | + * @return mixed |
|
73 | + * @throws EE_Error |
|
74 | + * @throws InvalidArgumentException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws InvalidInterfaceException |
|
77 | + * @throws ReflectionException |
|
78 | + */ |
|
79 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) |
|
80 | + { |
|
81 | + $line_item_related_object = $line_item->get_object(); |
|
82 | + $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
83 | + $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
|
84 | + ? $line_item->parent()->get_object() |
|
85 | + : null; |
|
86 | + if ($this->shouldSkipLineItemRow($registration, $line_item_related_object, $parent_line_item_related_object)) { |
|
87 | + return ''; |
|
88 | + } |
|
89 | + // start of row |
|
90 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
91 | + $html = EEH_HTML::tr('', '', $row_class); |
|
92 | + |
|
93 | + |
|
94 | + // Name Column |
|
95 | + $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : ''; |
|
96 | + |
|
97 | + // related object scope. |
|
98 | + $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
|
99 | + ? $parent_line_item_related_object->name() |
|
100 | + : ''; |
|
101 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item |
|
102 | + ? $line_item->parent()->name() |
|
103 | + : $parent_related_object_name; |
|
104 | + $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
|
105 | + ? $parent_line_item_related_object->get_admin_details_link() |
|
106 | + : ''; |
|
107 | + |
|
108 | + |
|
109 | + $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
|
110 | + ? $line_item_related_object->name() : $line_item->name(); |
|
111 | + $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' |
|
112 | + : $name_html; |
|
113 | + $name_html .= $line_item->is_taxable() ? ' *' : ''; |
|
114 | + // maybe preface with icon? |
|
115 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon |
|
116 | + ? $line_item_related_object->get_icon() . $name_html |
|
117 | + : $name_html; |
|
118 | + $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
119 | + $name_html .= sprintf( |
|
120 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
121 | + '<span class="ee-line-item-related-parent-object">', |
|
122 | + $line_item->parent() instanceof EE_Line_Item |
|
123 | + ? $line_item->parent()->OBJ_type_i18n() |
|
124 | + : __('Item:', 'event_espresso'), |
|
125 | + $parent_related_object_link |
|
126 | + ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
127 | + : $parent_related_object_name, |
|
128 | + '</span>' |
|
129 | + ); |
|
130 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
131 | + // Type Column |
|
132 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
|
133 | + $type_html .= $this->_get_cancellations($line_item); |
|
134 | + $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
|
135 | + $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
|
136 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; |
|
137 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
138 | + |
|
139 | + // Date column |
|
140 | + $datetime_content = ''; |
|
141 | + if ($line_item_related_object instanceof EE_Ticket) { |
|
142 | + $datetimes = $line_item_related_object->datetimes(); |
|
143 | + foreach ($datetimes as $datetime) { |
|
144 | + if ($datetime instanceof EE_Datetime) { |
|
145 | + $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; |
|
146 | + } |
|
147 | + } |
|
148 | + } |
|
149 | + $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); |
|
150 | + |
|
151 | + // Amount Column |
|
152 | + if ($line_item->is_percent()) { |
|
153 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); |
|
154 | + } else { |
|
155 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + // finish things off and return |
|
160 | + $html .= EEH_HTML::trx(); |
|
161 | + return $html; |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * _tax_row |
|
168 | + * |
|
169 | + * @param EE_Line_Item $line_item |
|
170 | + * @param array $options |
|
171 | + * @return mixed |
|
172 | + */ |
|
173 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
174 | + { |
|
175 | + // start of row |
|
176 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
177 | + // name th |
|
178 | + $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="3"'); |
|
179 | + // total th |
|
180 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
181 | + // end of row |
|
182 | + $html .= EEH_HTML::trx(); |
|
183 | + return $html; |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * _total_row |
|
192 | + * |
|
193 | + * @param EE_Line_Item $line_item |
|
194 | + * @param array $options |
|
195 | + * @return mixed |
|
196 | + */ |
|
197 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) |
|
198 | + { |
|
199 | + |
|
200 | + $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
201 | + $registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0; |
|
202 | + // if no valid registration object then we're not going to show the approximate text. |
|
203 | + $total_match = $registration instanceof EE_Registration |
|
204 | + ? $registration->final_price() === $line_item->total() |
|
205 | + : true; |
|
206 | + |
|
207 | + // start of row |
|
208 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
209 | + // Total th label |
|
210 | + if ($total_match) { |
|
211 | + $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
212 | + } else { |
|
213 | + $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
214 | + $total_label .= '<br>'; |
|
215 | + $total_label .= '<p class="ee-footnote-text">' |
|
216 | + . sprintf( |
|
217 | + __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others. This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'), |
|
218 | + '<strong>', |
|
219 | + $registration_total, |
|
220 | + '</strong>' |
|
221 | + ) |
|
222 | + . '</p>'; |
|
223 | + } |
|
224 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"'); |
|
225 | + // total th |
|
226 | + |
|
227 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
228 | + // end of row |
|
229 | + $html .= EEH_HTML::trx(); |
|
230 | + return $html; |
|
231 | + } |
|
232 | 232 | } |