@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $options |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
52 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
53 | 53 | |
54 | 54 | $html = ''; |
55 | 55 | // set some default options and merge with incoming |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
61 | 61 | 'total_tr_css_class' => 'admin-primary-mbox-total-tr' |
62 | 62 | ); |
63 | - $options = array_merge( $default_options, (array)$options ); |
|
63 | + $options = array_merge($default_options, (array) $options); |
|
64 | 64 | |
65 | - switch( $line_item->type() ) { |
|
65 | + switch ($line_item->type()) { |
|
66 | 66 | |
67 | 67 | case EEM_Line_Item::type_line_item: |
68 | 68 | // item row |
69 | - $html .= $this->_item_row( $line_item, $options ); |
|
69 | + $html .= $this->_item_row($line_item, $options); |
|
70 | 70 | break; |
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_sub_line_item: |
73 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
73 | + $html .= $this->_sub_item_row($line_item, $options); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case EEM_Line_Item::type_sub_total: |
77 | - if ( $line_item->quantity() === 0 ) { |
|
77 | + if ($line_item->quantity() === 0) { |
|
78 | 78 | return $html; |
79 | 79 | } |
80 | 80 | //loop through children |
81 | 81 | $child_line_items = $line_item->children(); |
82 | 82 | //loop through children |
83 | - foreach ( $child_line_items as $child_line_item ) { |
|
83 | + foreach ($child_line_items as $child_line_item) { |
|
84 | 84 | //recursively feed children back into this method |
85 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
85 | + $html .= $this->display_line_item($child_line_item, $options); |
|
86 | 86 | } |
87 | - $html .= $this->_sub_total_row( $line_item, $options ); |
|
87 | + $html .= $this->_sub_total_row($line_item, $options); |
|
88 | 88 | break; |
89 | 89 | |
90 | 90 | case EEM_Line_Item::type_tax: |
91 | - if ( $this->_show_taxes ) { |
|
92 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
91 | + if ($this->_show_taxes) { |
|
92 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
93 | 93 | } |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case EEM_Line_Item::type_tax_sub_total: |
97 | - foreach( $line_item->children() as $child_line_item ) { |
|
98 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
99 | - $this->display_line_item( $child_line_item, $options ); |
|
97 | + foreach ($line_item->children() as $child_line_item) { |
|
98 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
99 | + $this->display_line_item($child_line_item, $options); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | break; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | $children = $line_item->children(); |
109 | 109 | |
110 | 110 | // loop thru all non-tax child line items |
111 | - foreach( $children as $child_line_item ) { |
|
112 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
111 | + foreach ($children as $child_line_item) { |
|
112 | + $html .= $this->display_line_item($child_line_item, $options); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $html .= $this->_taxes_html; |
116 | - $html .= $this->_total_row( $line_item, $options ); |
|
117 | - if ( $options['use_table_wrapper'] ) { |
|
118 | - $html = $this->_table_header( $options ) . $html . $this->_table_footer( $options ); |
|
116 | + $html .= $this->_total_row($line_item, $options); |
|
117 | + if ($options['use_table_wrapper']) { |
|
118 | + $html = $this->_table_header($options).$html.$this->_table_footer($options); |
|
119 | 119 | } |
120 | 120 | break; |
121 | 121 | |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * @param array $options |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - protected function _table_header( $options ) { |
|
136 | - $html = EEH_HTML::table( '','', $options['table_css_class'] ); |
|
135 | + protected function _table_header($options) { |
|
136 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
137 | 137 | $html .= EEH_HTML::thead(); |
138 | 138 | $html .= EEH_HTML::tr(); |
139 | - $html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' ); |
|
140 | - $html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' ); |
|
141 | - $html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' ); |
|
142 | - $html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' ); |
|
143 | - $html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' ); |
|
139 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
140 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
141 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
142 | + $html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr'); |
|
143 | + $html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr'); |
|
144 | 144 | $html .= EEH_HTML::tbody(); |
145 | 145 | return $html; |
146 | 146 | } |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * @param array $options array of options for the table. |
153 | 153 | * @return string |
154 | 154 | */ |
155 | - protected function _table_footer( $options ) { |
|
156 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
155 | + protected function _table_footer($options) { |
|
156 | + return EEH_HTML::tbodyx().EEH_HTML::tablex(); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | * @param array $options |
166 | 166 | * @return mixed |
167 | 167 | */ |
168 | - protected function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
168 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
169 | 169 | $line_item_related_object = $line_item->get_object(); |
170 | 170 | $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null; |
171 | 171 | // start of row |
172 | 172 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
173 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
173 | + $html = EEH_HTML::tr('', '', $row_class); |
|
174 | 174 | |
175 | 175 | |
176 | 176 | //Name Column |
@@ -178,45 +178,45 @@ discard block |
||
178 | 178 | |
179 | 179 | //related object scope. |
180 | 180 | $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : ''; |
181 | - $parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
181 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
182 | 182 | $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : ''; |
183 | 183 | |
184 | 184 | |
185 | 185 | $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name(); |
186 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
186 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html; |
|
187 | 187 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
188 | 188 | //maybe preface with icon? |
189 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html; |
|
190 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
191 | - $name_html .= sprintf( |
|
192 | - _x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
189 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html; |
|
190 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
191 | + $name_html .= sprintf( |
|
192 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
193 | 193 | '<span class="ee-line-item-related-parent-object">', |
194 | - $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ), |
|
195 | - $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name, |
|
194 | + $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'), |
|
195 | + $parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name, |
|
196 | 196 | '</span>' |
197 | 197 | ); |
198 | - $html .= EEH_HTML::td( $name_html, '', 'jst-left' ); |
|
198 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
199 | 199 | //Type Column |
200 | 200 | $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
201 | - $type_html .= $this->_get_cancellations( $line_item ); |
|
201 | + $type_html .= $this->_get_cancellations($line_item); |
|
202 | 202 | $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
203 | 203 | $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
204 | - $type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : ''; |
|
205 | - $html .= EEH_HTML::td( $type_html, '', 'jst-left' ); |
|
204 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : ''; |
|
205 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
206 | 206 | |
207 | 207 | |
208 | 208 | //Amount Column |
209 | - if ( $line_item->is_percent() ) { |
|
210 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' ); |
|
209 | + if ($line_item->is_percent()) { |
|
210 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght'); |
|
211 | 211 | } else { |
212 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' ); |
|
212 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | //QTY column |
216 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' ); |
|
216 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght'); |
|
217 | 217 | |
218 | 218 | //total column |
219 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
219 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
220 | 220 | |
221 | 221 | //finish things off and return |
222 | 222 | $html .= EEH_HTML::trx(); |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * @param EE_Line_Item $line_item |
232 | 232 | * @return string |
233 | 233 | */ |
234 | - protected function _get_cancellations( EE_Line_Item $line_item ) { |
|
234 | + protected function _get_cancellations(EE_Line_Item $line_item) { |
|
235 | 235 | $html = ''; |
236 | 236 | $cancellations = $line_item->get_cancellations(); |
237 | - $cancellation = reset( $cancellations ); |
|
237 | + $cancellation = reset($cancellations); |
|
238 | 238 | // \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ ); |
239 | - if ( $cancellation instanceof EE_Line_Item ) { |
|
239 | + if ($cancellation instanceof EE_Line_Item) { |
|
240 | 240 | $html .= ' <span class="ee-line-item-id">'; |
241 | 241 | $html .= sprintf( |
242 | 242 | _n( |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param array $options |
262 | 262 | * @return mixed |
263 | 263 | */ |
264 | - protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
264 | + protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
265 | 265 | //for now we're not showing sub-items |
266 | 266 | return ''; |
267 | 267 | } |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | * @param array $options |
276 | 276 | * @return mixed |
277 | 277 | */ |
278 | - protected function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
278 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
279 | 279 | // start of row |
280 | - $html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' ); |
|
280 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
281 | 281 | // name th |
282 | - $html .= EEH_HTML::th( $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '', 'jst-rght', '', ' colspan="4"' ); |
|
282 | + $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"'); |
|
283 | 283 | // total th |
284 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
284 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
285 | 285 | // end of row |
286 | 286 | $html .= EEH_HTML::trx(); |
287 | 287 | return $html; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @param array $options |
299 | 299 | * @return mixed |
300 | 300 | */ |
301 | - protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
301 | + protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
302 | 302 | //currently not showing subtotal row |
303 | 303 | return ''; |
304 | 304 | } |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | * @param array $options |
313 | 313 | * @return mixed |
314 | 314 | */ |
315 | - protected function _total_row( EE_Line_Item $line_item, $options = array() ) { |
|
315 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) { |
|
316 | 316 | // start of row |
317 | - $html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' ); |
|
317 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
318 | 318 | // Total th label |
319 | - $total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' ); |
|
320 | - $html .= EEH_HTML::th( $total_label, '', 'jst-rght', '', ' colspan="4"' ); |
|
319 | + $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
320 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
321 | 321 | // total th |
322 | 322 | |
323 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
323 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
324 | 324 | // end of row |
325 | 325 | $html .= EEH_HTML::trx(); |
326 | 326 | return $html; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use EventEspresso\core\domain\services\ticket\CancelTicketLineItemService; |
5 | 5 | |
6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
7 | - exit('No direct script access allowed'); |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | class CancelRegistrationService |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | - */ |
|
27 | - private $cancel_ticket_line_item_service; |
|
24 | + /** |
|
25 | + * @var CancelTicketLineItemService $cancel_ticket_line_item_service |
|
26 | + */ |
|
27 | + private $cancel_ticket_line_item_service; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * Command constructor |
|
33 | - * |
|
34 | - * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | - */ |
|
36 | - public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | - { |
|
38 | - $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | - } |
|
31 | + /** |
|
32 | + * Command constructor |
|
33 | + * |
|
34 | + * @param CancelTicketLineItemService $cancel_ticket_line_item_service |
|
35 | + */ |
|
36 | + public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service) |
|
37 | + { |
|
38 | + $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service; |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
@@ -44,27 +44,27 @@ discard block |
||
44 | 44 | * @param \EE_Registration $registration |
45 | 45 | * @param bool $cancel_ticket_line_item |
46 | 46 | */ |
47 | - public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
48 | - { |
|
49 | - // first cancel the original line item for the registration's ticket |
|
50 | - if ( $cancel_ticket_line_item ) { |
|
51 | - $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
52 | - } |
|
53 | - $this->cancelRegistrationOnly($registration); |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @param \EE_Registration $registration |
|
60 | - * @throws \EE_Error |
|
61 | - */ |
|
62 | - public function cancelRegistrationOnly(\EE_Registration $registration) |
|
63 | - { |
|
64 | - // now cancel the registration itself |
|
65 | - $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
66 | - $registration->save(); |
|
67 | - } |
|
47 | + public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
|
48 | + { |
|
49 | + // first cancel the original line item for the registration's ticket |
|
50 | + if ( $cancel_ticket_line_item ) { |
|
51 | + $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
52 | + } |
|
53 | + $this->cancelRegistrationOnly($registration); |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @param \EE_Registration $registration |
|
60 | + * @throws \EE_Error |
|
61 | + */ |
|
62 | + public function cancelRegistrationOnly(\EE_Registration $registration) |
|
63 | + { |
|
64 | + // now cancel the registration itself |
|
65 | + $registration->set_status(\EEM_Registration::status_id_cancelled); |
|
66 | + $registration->save(); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | 70 |
@@ -47,8 +47,8 @@ |
||
47 | 47 | public function cancelRegistrationAndTicketLineItem(\EE_Registration $registration, $cancel_ticket_line_item = true) |
48 | 48 | { |
49 | 49 | // first cancel the original line item for the registration's ticket |
50 | - if ( $cancel_ticket_line_item ) { |
|
51 | - $this->cancel_ticket_line_item_service->forRegistration( $registration ); |
|
50 | + if ($cancel_ticket_line_item) { |
|
51 | + $this->cancel_ticket_line_item_service->forRegistration($registration); |
|
52 | 52 | } |
53 | 53 | $this->cancelRegistrationOnly($registration); |
54 | 54 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <div style="float:right"> |
2 | - <?php printf( __( 'View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso' ), '<a href="' . $filtered_registrations_link . '">', '<a href="' . $filtered_transactions_link . '">', '<a href="' . $event_link . '">', '</a>' );?> |
|
2 | + <?php printf(__('View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), '<a href="'.$filtered_registrations_link.'">', '<a href="'.$filtered_transactions_link.'">', '<a href="'.$event_link.'">', '</a>'); ?> |
|
3 | 3 | </div> |
4 | -<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration . ' '; echo __( 'Registration # ', 'event_espresso' ) . $reg_nmbr['value']; echo ' ' . $next_registration; ?></h3> |
|
5 | -<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value'];?></h2> |
|
4 | +<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration.' '; echo __('Registration # ', 'event_espresso').$reg_nmbr['value']; echo ' '.$next_registration; ?></h3> |
|
5 | +<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value']; ?></h2> |
|
6 | 6 | |
7 | -<?php if ( $registration->group_size() > 1 ) : ?> |
|
8 | - <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __( 'Scroll to Other Registrations in the Same Transaction', 'event_espresso' );?></a> |
|
7 | +<?php if ($registration->group_size() > 1) : ?> |
|
8 | + <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __('Scroll to Other Registrations in the Same Transaction', 'event_espresso'); ?></a> |
|
9 | 9 | <?php endif; ?> |
10 | 10 | |
11 | -<?php do_action( 'AHEE__reg_status_change_buttons__after_header', $REG_ID ); ?> |
|
11 | +<?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?> |
|
12 | 12 |
@@ -829,11 +829,11 @@ discard block |
||
829 | 829 | if ( ! empty( $id ) ) { |
830 | 830 | $post = get_post( $id ); |
831 | 831 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
832 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
833 | - . '</a> '; |
|
832 | + . esc_html__( 'Shortcode', 'event_espresso' ) |
|
833 | + . '</a> '; |
|
834 | 834 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
835 | - . $post->ID |
|
836 | - . ']">'; |
|
835 | + . $post->ID |
|
836 | + . ']">'; |
|
837 | 837 | } |
838 | 838 | return $return; |
839 | 839 | } |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1046 | 1046 | if ( ! empty( $dtt['DTT_ID'] ) ) { |
1047 | 1047 | $DTM = EE_Registry::instance() |
1048 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1048 | + ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | + ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1050 | 1050 | $DTM->set_date_format( $incoming_date_formats[0] ); |
1051 | 1051 | $DTM->set_time_format( $incoming_date_formats[1] ); |
1052 | 1052 | foreach ( $datetime_values as $field => $value ) { |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | ) > 0 ? true : false; |
1145 | 1145 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1146 | 1146 | $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
1147 | - && ! $TKT->get( |
|
1147 | + && ! $TKT->get( |
|
1148 | 1148 | 'TKT_deleted' |
1149 | 1149 | ) ? true : false; |
1150 | 1150 | $TKT->set_date_format( $incoming_date_formats[0] ); |
@@ -1454,7 +1454,7 @@ discard block |
||
1454 | 1454 | $first_datetime = reset( $times ); |
1455 | 1455 | //do we get related tickets? |
1456 | 1456 | if ( $first_datetime instanceof EE_Datetime |
1457 | - && $first_datetime->ID() !== 0 |
|
1457 | + && $first_datetime->ID() !== 0 |
|
1458 | 1458 | ) { |
1459 | 1459 | $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
1460 | 1460 | $template_args['time'] = $first_datetime; |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1530 | 1530 | 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
1531 | 1531 | 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
1532 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1532 | + && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1533 | 1533 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1534 | 1534 | 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
1535 | 1535 | : ' disabled=disabled', |
@@ -1695,8 +1695,8 @@ discard block |
||
1695 | 1695 | $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
1696 | 1696 | $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
1697 | 1697 | $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
1698 | - ->setTime( 23, 59, 59 ) |
|
1699 | - ->format( implode( ' ', $start_formats ) ); |
|
1698 | + ->setTime( 23, 59, 59 ) |
|
1699 | + ->format( implode( ' ', $start_formats ) ); |
|
1700 | 1700 | $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
1701 | 1701 | } |
1702 | 1702 | if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | } |
1717 | 1717 | if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
1718 | 1718 | if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
1719 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1719 | + && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1720 | 1720 | ) { |
1721 | 1721 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1722 | 1722 | } |
@@ -2213,13 +2213,13 @@ discard block |
||
2213 | 2213 | protected function _template_settings() { |
2214 | 2214 | $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
2215 | 2215 | $this->_template_args['preview_img'] = '<img src="' |
2216 | - . EVENTS_ASSETS_URL |
|
2217 | - . DS |
|
2218 | - . 'images' |
|
2219 | - . DS |
|
2220 | - . 'caffeinated_template_features.jpg" alt="' |
|
2221 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2222 | - . '" />'; |
|
2216 | + . EVENTS_ASSETS_URL |
|
2217 | + . DS |
|
2218 | + . 'images' |
|
2219 | + . DS |
|
2220 | + . 'caffeinated_template_features.jpg" alt="' |
|
2221 | + . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2222 | + . '" />'; |
|
2223 | 2223 | $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
2224 | 2224 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2225 | 2225 | 'event_espresso' |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ); |
64 | 64 | add_action( |
65 | 65 | 'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', |
66 | - array( $this, 'verify_event_edit' ) |
|
66 | + array($this, 'verify_event_edit') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -79,22 +79,22 @@ discard block |
||
79 | 79 | $this->_admin_page_title = EVENTS_LABEL; |
80 | 80 | $this->_labels = array( |
81 | 81 | 'buttons' => array( |
82 | - 'add' => esc_html__( 'Add New Event', 'event_espresso' ), |
|
83 | - 'edit' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
84 | - 'delete' => esc_html__( 'Delete Event', 'event_espresso' ), |
|
85 | - 'add_category' => esc_html__( 'Add New Category', 'event_espresso' ), |
|
86 | - 'edit_category' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
87 | - 'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ), |
|
82 | + 'add' => esc_html__('Add New Event', 'event_espresso'), |
|
83 | + 'edit' => esc_html__('Edit Event', 'event_espresso'), |
|
84 | + 'delete' => esc_html__('Delete Event', 'event_espresso'), |
|
85 | + 'add_category' => esc_html__('Add New Category', 'event_espresso'), |
|
86 | + 'edit_category' => esc_html__('Edit Category', 'event_espresso'), |
|
87 | + 'delete_category' => esc_html__('Delete Category', 'event_espresso'), |
|
88 | 88 | ), |
89 | 89 | 'editor_title' => array( |
90 | - 'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ), |
|
90 | + 'espresso_events' => esc_html__('Enter event title here', 'event_espresso'), |
|
91 | 91 | ), |
92 | 92 | 'publishbox' => array( |
93 | - 'create_new' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
94 | - 'edit' => esc_html__( 'Update Event', 'event_espresso' ), |
|
95 | - 'add_category' => esc_html__( 'Save New Category', 'event_espresso' ), |
|
96 | - 'edit_category' => esc_html__( 'Update Category', 'event_espresso' ), |
|
97 | - 'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
93 | + 'create_new' => esc_html__('Save New Event', 'event_espresso'), |
|
94 | + 'edit' => esc_html__('Update Event', 'event_espresso'), |
|
95 | + 'add_category' => esc_html__('Save New Category', 'event_espresso'), |
|
96 | + 'edit_category' => esc_html__('Update Category', 'event_espresso'), |
|
97 | + 'template_settings' => esc_html__('Update Settings', 'event_espresso'), |
|
98 | 98 | ), |
99 | 99 | ); |
100 | 100 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | //load formatter helper |
106 | 106 | //load field generator helper |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) |
|
109 | 109 | ? $this->_req_data['EVT_ID'] : 0; |
110 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
110 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
111 | 111 | $this->_page_routes = array( |
112 | 112 | 'default' => array( |
113 | 113 | 'func' => '_events_overview_list_table', |
@@ -130,27 +130,27 @@ discard block |
||
130 | 130 | ), |
131 | 131 | 'trash_event' => array( |
132 | 132 | 'func' => '_trash_or_restore_event', |
133 | - 'args' => array( 'event_status' => 'trash' ), |
|
133 | + 'args' => array('event_status' => 'trash'), |
|
134 | 134 | 'capability' => 'ee_delete_event', |
135 | 135 | 'obj_id' => $evt_id, |
136 | 136 | 'noheader' => true, |
137 | 137 | ), |
138 | 138 | 'trash_events' => array( |
139 | 139 | 'func' => '_trash_or_restore_events', |
140 | - 'args' => array( 'event_status' => 'trash' ), |
|
140 | + 'args' => array('event_status' => 'trash'), |
|
141 | 141 | 'capability' => 'ee_delete_events', |
142 | 142 | 'noheader' => true, |
143 | 143 | ), |
144 | 144 | 'restore_event' => array( |
145 | 145 | 'func' => '_trash_or_restore_event', |
146 | - 'args' => array( 'event_status' => 'draft' ), |
|
146 | + 'args' => array('event_status' => 'draft'), |
|
147 | 147 | 'capability' => 'ee_delete_event', |
148 | 148 | 'obj_id' => $evt_id, |
149 | 149 | 'noheader' => true, |
150 | 150 | ), |
151 | 151 | 'restore_events' => array( |
152 | 152 | 'func' => '_trash_or_restore_events', |
153 | - 'args' => array( 'event_status' => 'draft' ), |
|
153 | + 'args' => array('event_status' => 'draft'), |
|
154 | 154 | 'capability' => 'ee_delete_events', |
155 | 155 | 'noheader' => true, |
156 | 156 | ), |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | 'add_category' => array( |
187 | 187 | 'func' => '_category_details', |
188 | 188 | 'capability' => 'ee_edit_event_category', |
189 | - 'args' => array( 'add' ), |
|
189 | + 'args' => array('add'), |
|
190 | 190 | ), |
191 | 191 | 'edit_category' => array( |
192 | 192 | 'func' => '_category_details', |
193 | 193 | 'capability' => 'ee_edit_event_category', |
194 | - 'args' => array( 'edit' ), |
|
194 | + 'args' => array('edit'), |
|
195 | 195 | ), |
196 | 196 | 'delete_categories' => array( |
197 | 197 | 'func' => '_delete_categories', |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | ), |
206 | 206 | 'insert_category' => array( |
207 | 207 | 'func' => '_insert_or_update_category', |
208 | - 'args' => array( 'new_category' => true ), |
|
208 | + 'args' => array('new_category' => true), |
|
209 | 209 | 'capability' => 'ee_edit_event_category', |
210 | 210 | 'noheader' => true, |
211 | 211 | ), |
212 | 212 | 'update_category' => array( |
213 | 213 | 'func' => '_insert_or_update_category', |
214 | - 'args' => array( 'new_category' => false ), |
|
214 | + 'args' => array('new_category' => false), |
|
215 | 215 | 'capability' => 'ee_edit_event_category', |
216 | 216 | 'noheader' => true, |
217 | 217 | ), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | $this->_page_config = array( |
229 | 229 | 'default' => array( |
230 | 230 | 'nav' => array( |
231 | - 'label' => esc_html__( 'Overview', 'event_espresso' ), |
|
231 | + 'label' => esc_html__('Overview', 'event_espresso'), |
|
232 | 232 | 'order' => 10, |
233 | 233 | ), |
234 | 234 | 'list_table' => 'Events_Admin_List_Table', |
235 | 235 | 'help_tabs' => array( |
236 | 236 | 'events_overview_help_tab' => array( |
237 | - 'title' => esc_html__( 'Events Overview', 'event_espresso' ), |
|
237 | + 'title' => esc_html__('Events Overview', 'event_espresso'), |
|
238 | 238 | 'filename' => 'events_overview', |
239 | 239 | ), |
240 | 240 | 'events_overview_table_column_headings_help_tab' => array( |
241 | - 'title' => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ), |
|
241 | + 'title' => esc_html__('Events Overview Table Column Headings', 'event_espresso'), |
|
242 | 242 | 'filename' => 'events_overview_table_column_headings', |
243 | 243 | ), |
244 | 244 | 'events_overview_filters_help_tab' => array( |
245 | - 'title' => esc_html__( 'Events Overview Filters', 'event_espresso' ), |
|
245 | + 'title' => esc_html__('Events Overview Filters', 'event_espresso'), |
|
246 | 246 | 'filename' => 'events_overview_filters', |
247 | 247 | ), |
248 | 248 | 'events_overview_view_help_tab' => array( |
249 | - 'title' => esc_html__( 'Events Overview Views', 'event_espresso' ), |
|
249 | + 'title' => esc_html__('Events Overview Views', 'event_espresso'), |
|
250 | 250 | 'filename' => 'events_overview_views', |
251 | 251 | ), |
252 | 252 | 'events_overview_other_help_tab' => array( |
253 | - 'title' => esc_html__( 'Events Overview Other', 'event_espresso' ), |
|
253 | + 'title' => esc_html__('Events Overview Other', 'event_espresso'), |
|
254 | 254 | 'filename' => 'events_overview_other', |
255 | 255 | ), |
256 | 256 | ), |
@@ -265,218 +265,218 @@ discard block |
||
265 | 265 | ), |
266 | 266 | 'create_new' => array( |
267 | 267 | 'nav' => array( |
268 | - 'label' => esc_html__( 'Add Event', 'event_espresso' ), |
|
268 | + 'label' => esc_html__('Add Event', 'event_espresso'), |
|
269 | 269 | 'order' => 5, |
270 | 270 | 'persistent' => false, |
271 | 271 | ), |
272 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
272 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
273 | 273 | 'help_tabs' => array( |
274 | 274 | 'event_editor_help_tab' => array( |
275 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
275 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
276 | 276 | 'filename' => 'event_editor', |
277 | 277 | ), |
278 | 278 | 'event_editor_title_richtexteditor_help_tab' => array( |
279 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
279 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
280 | 280 | 'filename' => 'event_editor_title_richtexteditor', |
281 | 281 | ), |
282 | 282 | 'event_editor_venue_details_help_tab' => array( |
283 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
283 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
284 | 284 | 'filename' => 'event_editor_venue_details', |
285 | 285 | ), |
286 | 286 | 'event_editor_event_datetimes_help_tab' => array( |
287 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
287 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
288 | 288 | 'filename' => 'event_editor_event_datetimes', |
289 | 289 | ), |
290 | 290 | 'event_editor_event_tickets_help_tab' => array( |
291 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
291 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
292 | 292 | 'filename' => 'event_editor_event_tickets', |
293 | 293 | ), |
294 | 294 | 'event_editor_event_registration_options_help_tab' => array( |
295 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
295 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
296 | 296 | 'filename' => 'event_editor_event_registration_options', |
297 | 297 | ), |
298 | 298 | 'event_editor_tags_categories_help_tab' => array( |
299 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
299 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
300 | 300 | 'filename' => 'event_editor_tags_categories', |
301 | 301 | ), |
302 | 302 | 'event_editor_questions_registrants_help_tab' => array( |
303 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
303 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
304 | 304 | 'filename' => 'event_editor_questions_registrants', |
305 | 305 | ), |
306 | 306 | 'event_editor_save_new_event_help_tab' => array( |
307 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
307 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
308 | 308 | 'filename' => 'event_editor_save_new_event', |
309 | 309 | ), |
310 | 310 | 'event_editor_other_help_tab' => array( |
311 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
311 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
312 | 312 | 'filename' => 'event_editor_other', |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | 'help_tour' => array( |
316 | 316 | 'Event_Editor_Help_Tour', |
317 | 317 | ), |
318 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
318 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
319 | 319 | 'require_nonce' => false, |
320 | 320 | ), |
321 | 321 | 'edit' => array( |
322 | 322 | 'nav' => array( |
323 | - 'label' => esc_html__( 'Edit Event', 'event_espresso' ), |
|
323 | + 'label' => esc_html__('Edit Event', 'event_espresso'), |
|
324 | 324 | 'order' => 5, |
325 | 325 | 'persistent' => false, |
326 | - 'url' => isset( $this->_req_data['post'] ) |
|
326 | + 'url' => isset($this->_req_data['post']) |
|
327 | 327 | ? EE_Admin_Page::add_query_args_and_nonce( |
328 | - array( 'post' => $this->_req_data['post'], 'action' => 'edit' ), |
|
328 | + array('post' => $this->_req_data['post'], 'action' => 'edit'), |
|
329 | 329 | $this->_current_page_view_url |
330 | 330 | ) |
331 | 331 | : $this->_admin_base_url, |
332 | 332 | ), |
333 | - 'metaboxes' => array( '_register_event_editor_meta_boxes' ), |
|
333 | + 'metaboxes' => array('_register_event_editor_meta_boxes'), |
|
334 | 334 | 'help_tabs' => array( |
335 | 335 | 'event_editor_help_tab' => array( |
336 | - 'title' => esc_html__( 'Event Editor', 'event_espresso' ), |
|
336 | + 'title' => esc_html__('Event Editor', 'event_espresso'), |
|
337 | 337 | 'filename' => 'event_editor', |
338 | 338 | ), |
339 | 339 | 'event_editor_title_richtexteditor_help_tab' => array( |
340 | - 'title' => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ), |
|
340 | + 'title' => esc_html__('Event Title & Rich Text Editor', 'event_espresso'), |
|
341 | 341 | 'filename' => 'event_editor_title_richtexteditor', |
342 | 342 | ), |
343 | 343 | 'event_editor_venue_details_help_tab' => array( |
344 | - 'title' => esc_html__( 'Event Venue Details', 'event_espresso' ), |
|
344 | + 'title' => esc_html__('Event Venue Details', 'event_espresso'), |
|
345 | 345 | 'filename' => 'event_editor_venue_details', |
346 | 346 | ), |
347 | 347 | 'event_editor_event_datetimes_help_tab' => array( |
348 | - 'title' => esc_html__( 'Event Datetimes', 'event_espresso' ), |
|
348 | + 'title' => esc_html__('Event Datetimes', 'event_espresso'), |
|
349 | 349 | 'filename' => 'event_editor_event_datetimes', |
350 | 350 | ), |
351 | 351 | 'event_editor_event_tickets_help_tab' => array( |
352 | - 'title' => esc_html__( 'Event Tickets', 'event_espresso' ), |
|
352 | + 'title' => esc_html__('Event Tickets', 'event_espresso'), |
|
353 | 353 | 'filename' => 'event_editor_event_tickets', |
354 | 354 | ), |
355 | 355 | 'event_editor_event_registration_options_help_tab' => array( |
356 | - 'title' => esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
356 | + 'title' => esc_html__('Event Registration Options', 'event_espresso'), |
|
357 | 357 | 'filename' => 'event_editor_event_registration_options', |
358 | 358 | ), |
359 | 359 | 'event_editor_tags_categories_help_tab' => array( |
360 | - 'title' => esc_html__( 'Event Tags & Categories', 'event_espresso' ), |
|
360 | + 'title' => esc_html__('Event Tags & Categories', 'event_espresso'), |
|
361 | 361 | 'filename' => 'event_editor_tags_categories', |
362 | 362 | ), |
363 | 363 | 'event_editor_questions_registrants_help_tab' => array( |
364 | - 'title' => esc_html__( 'Questions for Registrants', 'event_espresso' ), |
|
364 | + 'title' => esc_html__('Questions for Registrants', 'event_espresso'), |
|
365 | 365 | 'filename' => 'event_editor_questions_registrants', |
366 | 366 | ), |
367 | 367 | 'event_editor_save_new_event_help_tab' => array( |
368 | - 'title' => esc_html__( 'Save New Event', 'event_espresso' ), |
|
368 | + 'title' => esc_html__('Save New Event', 'event_espresso'), |
|
369 | 369 | 'filename' => 'event_editor_save_new_event', |
370 | 370 | ), |
371 | 371 | 'event_editor_other_help_tab' => array( |
372 | - 'title' => esc_html__( 'Event Other', 'event_espresso' ), |
|
372 | + 'title' => esc_html__('Event Other', 'event_espresso'), |
|
373 | 373 | 'filename' => 'event_editor_other', |
374 | 374 | ), |
375 | 375 | ), |
376 | 376 | /*'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ),*/ |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => false, |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
383 | 383 | 'nav' => array( |
384 | - 'label' => esc_html__( 'Default Settings', 'event_espresso' ), |
|
384 | + 'label' => esc_html__('Default Settings', 'event_espresso'), |
|
385 | 385 | 'order' => 40, |
386 | 386 | ), |
387 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
387 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
388 | 388 | 'labels' => array( |
389 | - 'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ), |
|
389 | + 'publishbox' => esc_html__('Update Settings', 'event_espresso'), |
|
390 | 390 | ), |
391 | 391 | 'help_tabs' => array( |
392 | 392 | 'default_settings_help_tab' => array( |
393 | - 'title' => esc_html__( 'Default Event Settings', 'event_espresso' ), |
|
393 | + 'title' => esc_html__('Default Event Settings', 'event_espresso'), |
|
394 | 394 | 'filename' => 'events_default_settings', |
395 | 395 | ), |
396 | 396 | 'default_settings_status_help_tab' => array( |
397 | - 'title' => esc_html__( 'Default Registration Status', 'event_espresso' ), |
|
397 | + 'title' => esc_html__('Default Registration Status', 'event_espresso'), |
|
398 | 398 | 'filename' => 'events_default_settings_status', |
399 | 399 | ), |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour' ), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => false, |
403 | 403 | ), |
404 | 404 | //template settings |
405 | 405 | 'template_settings' => array( |
406 | 406 | 'nav' => array( |
407 | - 'label' => esc_html__( 'Templates', 'event_espresso' ), |
|
407 | + 'label' => esc_html__('Templates', 'event_espresso'), |
|
408 | 408 | 'order' => 30, |
409 | 409 | ), |
410 | 410 | 'metaboxes' => $this->_default_espresso_metaboxes, |
411 | 411 | 'help_tabs' => array( |
412 | 412 | 'general_settings_templates_help_tab' => array( |
413 | - 'title' => esc_html__( 'Templates', 'event_espresso' ), |
|
413 | + 'title' => esc_html__('Templates', 'event_espresso'), |
|
414 | 414 | 'filename' => 'general_settings_templates', |
415 | 415 | ), |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => false, |
419 | 419 | ), |
420 | 420 | //event category stuff |
421 | 421 | 'add_category' => array( |
422 | 422 | 'nav' => array( |
423 | - 'label' => esc_html__( 'Add Category', 'event_espresso' ), |
|
423 | + 'label' => esc_html__('Add Category', 'event_espresso'), |
|
424 | 424 | 'order' => 15, |
425 | 425 | 'persistent' => false, |
426 | 426 | ), |
427 | 427 | 'help_tabs' => array( |
428 | 428 | 'add_category_help_tab' => array( |
429 | - 'title' => esc_html__( 'Add New Event Category', 'event_espresso' ), |
|
429 | + 'title' => esc_html__('Add New Event Category', 'event_espresso'), |
|
430 | 430 | 'filename' => 'events_add_category', |
431 | 431 | ), |
432 | 432 | ), |
433 | - 'help_tour' => array( 'Event_Add_Category_Help_Tour' ), |
|
434 | - 'metaboxes' => array( '_publish_post_box' ), |
|
433 | + 'help_tour' => array('Event_Add_Category_Help_Tour'), |
|
434 | + 'metaboxes' => array('_publish_post_box'), |
|
435 | 435 | 'require_nonce' => false, |
436 | 436 | ), |
437 | 437 | 'edit_category' => array( |
438 | 438 | 'nav' => array( |
439 | - 'label' => esc_html__( 'Edit Category', 'event_espresso' ), |
|
439 | + 'label' => esc_html__('Edit Category', 'event_espresso'), |
|
440 | 440 | 'order' => 15, |
441 | 441 | 'persistent' => false, |
442 | - 'url' => isset( $this->_req_data['EVT_CAT_ID'] ) |
|
442 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) |
|
443 | 443 | ? add_query_arg( |
444 | - array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), |
|
444 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
445 | 445 | $this->_current_page_view_url |
446 | 446 | ) |
447 | 447 | : $this->_admin_base_url, |
448 | 448 | ), |
449 | 449 | 'help_tabs' => array( |
450 | 450 | 'edit_category_help_tab' => array( |
451 | - 'title' => esc_html__( 'Edit Event Category', 'event_espresso' ), |
|
451 | + 'title' => esc_html__('Edit Event Category', 'event_espresso'), |
|
452 | 452 | 'filename' => 'events_edit_category', |
453 | 453 | ), |
454 | 454 | ), |
455 | 455 | /*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/ |
456 | - 'metaboxes' => array( '_publish_post_box' ), |
|
456 | + 'metaboxes' => array('_publish_post_box'), |
|
457 | 457 | 'require_nonce' => false, |
458 | 458 | ), |
459 | 459 | 'category_list' => array( |
460 | 460 | 'nav' => array( |
461 | - 'label' => esc_html__( 'Categories', 'event_espresso' ), |
|
461 | + 'label' => esc_html__('Categories', 'event_espresso'), |
|
462 | 462 | 'order' => 20, |
463 | 463 | ), |
464 | 464 | 'list_table' => 'Event_Categories_Admin_List_Table', |
465 | 465 | 'help_tabs' => array( |
466 | 466 | 'events_categories_help_tab' => array( |
467 | - 'title' => esc_html__( 'Event Categories', 'event_espresso' ), |
|
467 | + 'title' => esc_html__('Event Categories', 'event_espresso'), |
|
468 | 468 | 'filename' => 'events_categories', |
469 | 469 | ), |
470 | 470 | 'events_categories_table_column_headings_help_tab' => array( |
471 | - 'title' => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ), |
|
471 | + 'title' => esc_html__('Event Categories Table Column Headings', 'event_espresso'), |
|
472 | 472 | 'filename' => 'events_categories_table_column_headings', |
473 | 473 | ), |
474 | 474 | 'events_categories_view_help_tab' => array( |
475 | - 'title' => esc_html__( 'Event Categories Views', 'event_espresso' ), |
|
475 | + 'title' => esc_html__('Event Categories Views', 'event_espresso'), |
|
476 | 476 | 'filename' => 'events_categories_views', |
477 | 477 | ), |
478 | 478 | 'events_categories_other_help_tab' => array( |
479 | - 'title' => esc_html__( 'Event Categories Other', 'event_espresso' ), |
|
479 | + 'title' => esc_html__('Event Categories Other', 'event_espresso'), |
|
480 | 480 | 'filename' => 'events_categories_other', |
481 | 481 | ), |
482 | 482 | ), |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | protected function _add_screen_options_category_list() { |
507 | 507 | $page_title = $this->_admin_page_title; |
508 | - $this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' ); |
|
508 | + $this->_admin_page_title = esc_html__('Categories', 'event_espresso'); |
|
509 | 509 | $this->_per_page_screen_option(); |
510 | 510 | $this->_admin_page_title = $page_title; |
511 | 511 | } |
@@ -521,20 +521,20 @@ discard block |
||
521 | 521 | public function load_scripts_styles() { |
522 | 522 | wp_register_style( |
523 | 523 | 'events-admin-css', |
524 | - EVENTS_ASSETS_URL . 'events-admin-page.css', |
|
524 | + EVENTS_ASSETS_URL.'events-admin-page.css', |
|
525 | 525 | array(), |
526 | 526 | EVENT_ESPRESSO_VERSION |
527 | 527 | ); |
528 | - wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
529 | - wp_enqueue_style( 'events-admin-css' ); |
|
530 | - wp_enqueue_style( 'ee-cat-admin' ); |
|
528 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
529 | + wp_enqueue_style('events-admin-css'); |
|
530 | + wp_enqueue_style('ee-cat-admin'); |
|
531 | 531 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
532 | 532 | //registers for all views |
533 | 533 | //scripts |
534 | 534 | wp_register_script( |
535 | 535 | 'event_editor_js', |
536 | - EVENTS_ASSETS_URL . 'event_editor.js', |
|
537 | - array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ), |
|
536 | + EVENTS_ASSETS_URL.'event_editor.js', |
|
537 | + array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), |
|
538 | 538 | EVENT_ESPRESSO_VERSION, |
539 | 539 | true |
540 | 540 | ); |
@@ -560,22 +560,22 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function load_scripts_styles_edit() { |
562 | 562 | //styles |
563 | - wp_enqueue_style( 'espresso-ui-theme' ); |
|
563 | + wp_enqueue_style('espresso-ui-theme'); |
|
564 | 564 | wp_register_style( |
565 | 565 | 'event-editor-css', |
566 | - EVENTS_ASSETS_URL . 'event-editor.css', |
|
567 | - array( 'ee-admin-css' ), |
|
566 | + EVENTS_ASSETS_URL.'event-editor.css', |
|
567 | + array('ee-admin-css'), |
|
568 | 568 | EVENT_ESPRESSO_VERSION |
569 | 569 | ); |
570 | - wp_enqueue_style( 'event-editor-css' ); |
|
570 | + wp_enqueue_style('event-editor-css'); |
|
571 | 571 | //scripts |
572 | 572 | wp_register_script( |
573 | 573 | 'event-datetime-metabox', |
574 | - EVENTS_ASSETS_URL . 'event-datetime-metabox.js', |
|
575 | - array( 'event_editor_js', 'ee-datepicker' ), |
|
574 | + EVENTS_ASSETS_URL.'event-datetime-metabox.js', |
|
575 | + array('event_editor_js', 'ee-datepicker'), |
|
576 | 576 | EVENT_ESPRESSO_VERSION |
577 | 577 | ); |
578 | - wp_enqueue_script( 'event-datetime-metabox' ); |
|
578 | + wp_enqueue_script('event-datetime-metabox'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $this->_views = array( |
596 | 596 | 'all' => array( |
597 | 597 | 'slug' => 'all', |
598 | - 'label' => esc_html__( 'All', 'event_espresso' ), |
|
598 | + 'label' => esc_html__('All', 'event_espresso'), |
|
599 | 599 | 'count' => 0, |
600 | 600 | 'bulk_action' => array( |
601 | - 'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
601 | + 'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'), |
|
602 | 602 | ), |
603 | 603 | ), |
604 | 604 | ); |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | * @access public |
635 | 635 | * @return void |
636 | 636 | */ |
637 | - public function verify_event_edit( $event = null ) { |
|
637 | + public function verify_event_edit($event = null) { |
|
638 | 638 | // no event? |
639 | - if ( empty( $event ) ) { |
|
639 | + if (empty($event)) { |
|
640 | 640 | // set event |
641 | 641 | $event = $this->_cpt_model_obj; |
642 | 642 | } |
643 | 643 | // STILL no event? |
644 | - if ( empty ( $event ) ) { |
|
644 | + if (empty ($event)) { |
|
645 | 645 | return; |
646 | 646 | } |
647 | 647 | $orig_status = $event->status(); |
@@ -655,32 +655,32 @@ discard block |
||
655 | 655 | return; |
656 | 656 | } |
657 | 657 | //made it here so it IS active... next check that any of the tickets are sold. |
658 | - if ( $event->is_sold_out( true ) ) { |
|
659 | - if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) { |
|
658 | + if ($event->is_sold_out(true)) { |
|
659 | + if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) { |
|
660 | 660 | EE_Error::add_attention( |
661 | 661 | sprintf( |
662 | 662 | esc_html__( |
663 | 663 | 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You can change the status back to something else before updating if you wish.', |
664 | 664 | 'event_espresso' |
665 | 665 | ), |
666 | - EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' ) |
|
666 | + EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence') |
|
667 | 667 | ) |
668 | 668 | ); |
669 | 669 | } |
670 | 670 | return; |
671 | - } else if ( $orig_status === EEM_Event::sold_out ) { |
|
671 | + } else if ($orig_status === EEM_Event::sold_out) { |
|
672 | 672 | EE_Error::add_attention( |
673 | 673 | sprintf( |
674 | 674 | esc_html__( |
675 | 675 | 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets. However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.', |
676 | 676 | 'event_espresso' |
677 | 677 | ), |
678 | - EEH_Template::pretty_status( $event->status(), false, 'sentence' ) |
|
678 | + EEH_Template::pretty_status($event->status(), false, 'sentence') |
|
679 | 679 | ) |
680 | 680 | ); |
681 | 681 | } |
682 | 682 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
683 | - if ( ! $event->tickets_on_sale() ) { |
|
683 | + if ( ! $event->tickets_on_sale()) { |
|
684 | 684 | return; |
685 | 685 | } |
686 | 686 | //made it here so show warning |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | protected function _edit_event_warning() { |
700 | 700 | // we don't want to add warnings during these requests |
701 | - if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) { |
|
701 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') { |
|
702 | 702 | return; |
703 | 703 | } |
704 | 704 | EE_Error::add_attention( |
@@ -715,29 +715,29 @@ discard block |
||
715 | 715 | $this->_views = array( |
716 | 716 | 'all' => array( |
717 | 717 | 'slug' => 'all', |
718 | - 'label' => esc_html__( 'View All Events', 'event_espresso' ), |
|
718 | + 'label' => esc_html__('View All Events', 'event_espresso'), |
|
719 | 719 | 'count' => 0, |
720 | 720 | 'bulk_action' => array( |
721 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
721 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
722 | 722 | ), |
723 | 723 | ), |
724 | 724 | 'draft' => array( |
725 | 725 | 'slug' => 'draft', |
726 | - 'label' => esc_html__( 'Draft', 'event_espresso' ), |
|
726 | + 'label' => esc_html__('Draft', 'event_espresso'), |
|
727 | 727 | 'count' => 0, |
728 | 728 | 'bulk_action' => array( |
729 | - 'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ), |
|
729 | + 'trash_events' => esc_html__('Move to Trash', 'event_espresso'), |
|
730 | 730 | ), |
731 | 731 | ), |
732 | 732 | ); |
733 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
733 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
734 | 734 | $this->_views['trash'] = array( |
735 | 735 | 'slug' => 'trash', |
736 | - 'label' => esc_html__( 'Trash', 'event_espresso' ), |
|
736 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
737 | 737 | 'count' => 0, |
738 | 738 | 'bulk_action' => array( |
739 | - 'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ), |
|
740 | - 'delete_events' => esc_html__( 'Delete Permanently', 'event_espresso' ), |
|
739 | + 'restore_events' => esc_html__('Restore From Trash', 'event_espresso'), |
|
740 | + 'delete_events' => esc_html__('Delete Permanently', 'event_espresso'), |
|
741 | 741 | ), |
742 | 742 | ); |
743 | 743 | } |
@@ -752,50 +752,50 @@ discard block |
||
752 | 752 | $items = array( |
753 | 753 | 'view_details' => array( |
754 | 754 | 'class' => 'dashicons dashicons-search', |
755 | - 'desc' => esc_html__( 'View Event', 'event_espresso' ), |
|
755 | + 'desc' => esc_html__('View Event', 'event_espresso'), |
|
756 | 756 | ), |
757 | 757 | 'edit_event' => array( |
758 | 758 | 'class' => 'ee-icon ee-icon-calendar-edit', |
759 | - 'desc' => esc_html__( 'Edit Event Details', 'event_espresso' ), |
|
759 | + 'desc' => esc_html__('Edit Event Details', 'event_espresso'), |
|
760 | 760 | ), |
761 | 761 | 'view_attendees' => array( |
762 | 762 | 'class' => 'dashicons dashicons-groups', |
763 | - 'desc' => esc_html__( 'View Registrations for Event', 'event_espresso' ), |
|
763 | + 'desc' => esc_html__('View Registrations for Event', 'event_espresso'), |
|
764 | 764 | ), |
765 | 765 | ); |
766 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
766 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
767 | 767 | $statuses = array( |
768 | 768 | 'sold_out_status' => array( |
769 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
770 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ), |
|
769 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
770 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'), |
|
771 | 771 | ), |
772 | 772 | 'active_status' => array( |
773 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
774 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ), |
|
773 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
774 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'), |
|
775 | 775 | ), |
776 | 776 | 'upcoming_status' => array( |
777 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
778 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ), |
|
777 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
778 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'), |
|
779 | 779 | ), |
780 | 780 | 'postponed_status' => array( |
781 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
782 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ), |
|
781 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
782 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'), |
|
783 | 783 | ), |
784 | 784 | 'cancelled_status' => array( |
785 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
786 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ), |
|
785 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
786 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'), |
|
787 | 787 | ), |
788 | 788 | 'expired_status' => array( |
789 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
790 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ), |
|
789 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
790 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'), |
|
791 | 791 | ), |
792 | 792 | 'inactive_status' => array( |
793 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
794 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ), |
|
793 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
794 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'), |
|
795 | 795 | ), |
796 | 796 | ); |
797 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
798 | - return array_merge( $items, $statuses ); |
|
797 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
798 | + return array_merge($items, $statuses); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @return EEM_Event |
807 | 807 | */ |
808 | 808 | private function _event_model() { |
809 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
810 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
809 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
810 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
811 | 811 | } |
812 | 812 | return $this->_event_model; |
813 | 813 | } |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param string $new_slug what the slug is |
825 | 825 | * @return string The new html string for the permalink area |
826 | 826 | */ |
827 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
827 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
828 | 828 | //make sure this is only when editing |
829 | - if ( ! empty( $id ) ) { |
|
830 | - $post = get_post( $id ); |
|
829 | + if ( ! empty($id)) { |
|
830 | + $post = get_post($id); |
|
831 | 831 | $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' |
832 | - . esc_html__( 'Shortcode', 'event_espresso' ) |
|
832 | + . esc_html__('Shortcode', 'event_espresso') |
|
833 | 833 | . '</a> '; |
834 | 834 | $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' |
835 | 835 | . $post->ID |
@@ -848,14 +848,14 @@ discard block |
||
848 | 848 | * @return void |
849 | 849 | */ |
850 | 850 | protected function _events_overview_list_table() { |
851 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
851 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
852 | 852 | $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
853 | - get_post_type_archive_link( 'espresso_events' ), |
|
854 | - esc_html__( "View Event Archive Page", "event_espresso" ), |
|
853 | + get_post_type_archive_link('espresso_events'), |
|
854 | + esc_html__("View Event Archive Page", "event_espresso"), |
|
855 | 855 | 'button' |
856 | 856 | ); |
857 | - $this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() ); |
|
858 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
857 | + $this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items()); |
|
858 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
859 | 859 | 'create_new', |
860 | 860 | 'add', |
861 | 861 | array(), |
@@ -881,48 +881,48 @@ discard block |
||
881 | 881 | * @param string $post_id |
882 | 882 | * @param object $post |
883 | 883 | */ |
884 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
885 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) { |
|
884 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
885 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') { |
|
886 | 886 | //get out we're not processing an event save. |
887 | 887 | return; |
888 | 888 | } |
889 | 889 | $event_values = array( |
890 | - 'EVT_display_desc' => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
891 | - 'EVT_display_ticket_selector' => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
890 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
891 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
892 | 892 | 'EVT_additional_limit' => min( |
893 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
894 | - ! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null |
|
893 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
894 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null |
|
895 | 895 | ), |
896 | - 'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] ) |
|
896 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) |
|
897 | 897 | ? $this->_req_data['EVT_default_registration_status'] |
898 | 898 | : EE_Registry::instance()->CFG->registration->default_STS_ID, |
899 | - 'EVT_member_only' => ! empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
900 | - 'EVT_allow_overflow' => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
901 | - 'EVT_timezone_string' => ! empty( $this->_req_data['timezone_string'] ) |
|
899 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
900 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
901 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) |
|
902 | 902 | ? $this->_req_data['timezone_string'] : null, |
903 | - 'EVT_external_URL' => ! empty( $this->_req_data['externalURL'] ) |
|
903 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) |
|
904 | 904 | ? $this->_req_data['externalURL'] : null, |
905 | - 'EVT_phone' => ! empty( $this->_req_data['event_phone'] ) |
|
905 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) |
|
906 | 906 | ? $this->_req_data['event_phone'] : null, |
907 | 907 | ); |
908 | 908 | //update event |
909 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
909 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
910 | 910 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
911 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
912 | - $event = $this->_event_model()->get_one( array( $get_one_where ) ); |
|
911 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
912 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
913 | 913 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
914 | 914 | $event_update_callbacks = apply_filters( |
915 | 915 | 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
916 | - array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) ) |
|
916 | + array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')) |
|
917 | 917 | ); |
918 | 918 | $att_success = true; |
919 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
920 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
919 | + foreach ($event_update_callbacks as $e_callback) { |
|
920 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
921 | 921 | $att_success = ! $att_success ? $att_success |
922 | 922 | : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
923 | 923 | } |
924 | 924 | //any errors? |
925 | - if ( $success && false === $att_success ) { |
|
925 | + if ($success && false === $att_success) { |
|
926 | 926 | EE_Error::add_error( |
927 | 927 | esc_html__( |
928 | 928 | 'Event Details saved successfully but something went wrong with saving attachments.', |
@@ -932,9 +932,9 @@ discard block |
||
932 | 932 | __FUNCTION__, |
933 | 933 | __LINE__ |
934 | 934 | ); |
935 | - } else if ( $success === false ) { |
|
935 | + } else if ($success === false) { |
|
936 | 936 | EE_Error::add_error( |
937 | - esc_html__( 'Event Details did not save successfully.', 'event_espresso' ), |
|
937 | + esc_html__('Event Details did not save successfully.', 'event_espresso'), |
|
938 | 938 | __FILE__, |
939 | 939 | __FUNCTION__, |
940 | 940 | __LINE__ |
@@ -949,14 +949,14 @@ discard block |
||
949 | 949 | * @param int $post_id |
950 | 950 | * @param int $revision_id |
951 | 951 | */ |
952 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
952 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
953 | 953 | //copy existing event meta to new post |
954 | - $post_evt = $this->_event_model()->get_one_by_ID( $post_id ); |
|
955 | - if ( $post_evt instanceof EE_Event ) { |
|
954 | + $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
|
955 | + if ($post_evt instanceof EE_Event) { |
|
956 | 956 | //meta revision restore |
957 | - $post_evt->restore_revision( $revision_id ); |
|
957 | + $post_evt->restore_revision($revision_id); |
|
958 | 958 | //related objs restore |
959 | - $post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
959 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
960 | 960 | } |
961 | 961 | } |
962 | 962 | |
@@ -969,49 +969,49 @@ discard block |
||
969 | 969 | * @param array $data The request data from the form |
970 | 970 | * @return bool Success or fail. |
971 | 971 | */ |
972 | - protected function _default_venue_update( \EE_Event $evtobj, $data ) { |
|
973 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
974 | - $venue_model = EE_Registry::instance()->load_model( 'Venue' ); |
|
972 | + protected function _default_venue_update(\EE_Event $evtobj, $data) { |
|
973 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
974 | + $venue_model = EE_Registry::instance()->load_model('Venue'); |
|
975 | 975 | $rows_affected = null; |
976 | - $venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null; |
|
976 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
977 | 977 | // very important. If we don't have a venue name... |
978 | 978 | // then we'll get out because not necessary to create empty venue |
979 | - if ( empty( $data['venue_title'] ) ) { |
|
979 | + if (empty($data['venue_title'])) { |
|
980 | 980 | return false; |
981 | 981 | } |
982 | 982 | $venue_array = array( |
983 | - 'VNU_wp_user' => $evtobj->get( 'EVT_wp_user' ), |
|
984 | - 'VNU_name' => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null, |
|
985 | - 'VNU_desc' => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null, |
|
986 | - 'VNU_identifier' => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null, |
|
987 | - 'VNU_short_desc' => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description'] |
|
983 | + 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
|
984 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : null, |
|
985 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : null, |
|
986 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null, |
|
987 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] |
|
988 | 988 | : null, |
989 | - 'VNU_address' => ! empty( $data['address'] ) ? $data['address'] : null, |
|
990 | - 'VNU_address2' => ! empty( $data['address2'] ) ? $data['address2'] : null, |
|
991 | - 'VNU_city' => ! empty( $data['city'] ) ? $data['city'] : null, |
|
992 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : null, |
|
993 | - 'CNT_ISO' => ! empty( $data['countries'] ) ? $data['countries'] : null, |
|
994 | - 'VNU_zip' => ! empty( $data['zip'] ) ? $data['zip'] : null, |
|
995 | - 'VNU_phone' => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null, |
|
996 | - 'VNU_capacity' => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null, |
|
997 | - 'VNU_url' => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null, |
|
998 | - 'VNU_virtual_phone' => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null, |
|
999 | - 'VNU_virtual_url' => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null, |
|
1000 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
989 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : null, |
|
990 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : null, |
|
991 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : null, |
|
992 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : null, |
|
993 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : null, |
|
994 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : null, |
|
995 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : null, |
|
996 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null, |
|
997 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : null, |
|
998 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null, |
|
999 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : null, |
|
1000 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
1001 | 1001 | 'status' => 'publish', |
1002 | 1002 | ); |
1003 | 1003 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
1004 | - if ( ! empty( $venue_id ) ) { |
|
1005 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
1006 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
1004 | + if ( ! empty($venue_id)) { |
|
1005 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
1006 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
1007 | 1007 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
1008 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1008 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1009 | 1009 | return $rows_affected > 0 ? true : false; |
1010 | 1010 | } else { |
1011 | 1011 | //we insert the venue |
1012 | - $venue_id = $venue_model->insert( $venue_array ); |
|
1013 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
1014 | - return ! empty( $venue_id ) ? true : false; |
|
1012 | + $venue_id = $venue_model->insert($venue_array); |
|
1013 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
1014 | + return ! empty($venue_id) ? true : false; |
|
1015 | 1015 | } |
1016 | 1016 | //when we have the ancestor come in it's already been handled by the revision save. |
1017 | 1017 | } |
@@ -1025,51 +1025,51 @@ discard block |
||
1025 | 1025 | * @param array $data The request data from the form |
1026 | 1026 | * @return array |
1027 | 1027 | */ |
1028 | - protected function _default_tickets_update( EE_Event $evtobj, $data ) { |
|
1028 | + protected function _default_tickets_update(EE_Event $evtobj, $data) { |
|
1029 | 1029 | $success = true; |
1030 | 1030 | $saved_dtt = null; |
1031 | 1031 | $saved_tickets = array(); |
1032 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1033 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
1032 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1033 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
1034 | 1034 | //trim all values to ensure any excess whitespace is removed. |
1035 | - $dtt = array_map( 'trim', $dtt ); |
|
1036 | - $dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] |
|
1035 | + $dtt = array_map('trim', $dtt); |
|
1036 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] |
|
1037 | 1037 | : $dtt['DTT_EVT_start']; |
1038 | 1038 | $datetime_values = array( |
1039 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null, |
|
1039 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null, |
|
1040 | 1040 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
1041 | 1041 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
1042 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1042 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
1043 | 1043 | 'DTT_order' => $row, |
1044 | 1044 | ); |
1045 | 1045 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
1046 | - if ( ! empty( $dtt['DTT_ID'] ) ) { |
|
1046 | + if ( ! empty($dtt['DTT_ID'])) { |
|
1047 | 1047 | $DTM = EE_Registry::instance() |
1048 | - ->load_model( 'Datetime', array( $evtobj->get_timezone() ) ) |
|
1049 | - ->get_one_by_ID( $dtt['DTT_ID'] ); |
|
1050 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1051 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1052 | - foreach ( $datetime_values as $field => $value ) { |
|
1053 | - $DTM->set( $field, $value ); |
|
1048 | + ->load_model('Datetime', array($evtobj->get_timezone())) |
|
1049 | + ->get_one_by_ID($dtt['DTT_ID']); |
|
1050 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1051 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1052 | + foreach ($datetime_values as $field => $value) { |
|
1053 | + $DTM->set($field, $value); |
|
1054 | 1054 | } |
1055 | 1055 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
1056 | - $saved_dtts[ $DTM->ID() ] = $DTM; |
|
1056 | + $saved_dtts[$DTM->ID()] = $DTM; |
|
1057 | 1057 | } else { |
1058 | - $DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false ); |
|
1059 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
1060 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
1061 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
1062 | - foreach ( $datetime_values as $field => $value ) { |
|
1063 | - $DTM->set( $field, $value ); |
|
1058 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false); |
|
1059 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
1060 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
1061 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
1062 | + foreach ($datetime_values as $field => $value) { |
|
1063 | + $DTM->set($field, $value); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | $DTM->save(); |
1067 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
1067 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
1068 | 1068 | //load DTT helper |
1069 | 1069 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1070 | - if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) { |
|
1071 | - $DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) ); |
|
1072 | - $DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' ); |
|
1070 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
1071 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
1072 | + $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
|
1073 | 1073 | $DTT->save(); |
1074 | 1074 | } |
1075 | 1075 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
@@ -1080,20 +1080,20 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | //no dtts get deleted so we don't do any of that logic here. |
1082 | 1082 | //update tickets next |
1083 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array(); |
|
1084 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
1085 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
1083 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
1084 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
1085 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
1086 | 1086 | $update_prices = false; |
1087 | - $ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] ) |
|
1088 | - ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0; |
|
1087 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) |
|
1088 | + ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
1089 | 1089 | // trim inputs to ensure any excess whitespace is removed. |
1090 | - $tkt = array_map( 'trim', $tkt ); |
|
1091 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
1090 | + $tkt = array_map('trim', $tkt); |
|
1091 | + if (empty($tkt['TKT_start_date'])) { |
|
1092 | 1092 | //let's use now in the set timezone. |
1093 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
1094 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
1093 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
1094 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
1095 | 1095 | } |
1096 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
1096 | + if (empty($tkt['TKT_end_date'])) { |
|
1097 | 1097 | //use the start date of the first datetime |
1098 | 1098 | $dtt = $evtobj->first_datetime(); |
1099 | 1099 | $tkt['TKT_end_date'] = $dtt->start_date_and_time( |
@@ -1102,22 +1102,22 @@ discard block |
||
1102 | 1102 | ); |
1103 | 1103 | } |
1104 | 1104 | $TKT_values = array( |
1105 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null, |
|
1106 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1107 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1108 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
1105 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null, |
|
1106 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1107 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1108 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1109 | 1109 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1110 | 1110 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1111 | - 'TKT_qty' => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1112 | - 'TKT_uses' => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1113 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1114 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
1111 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
1112 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
1113 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1114 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
1115 | 1115 | 'TKT_row' => $row, |
1116 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1116 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1117 | 1117 | 'TKT_price' => $ticket_price, |
1118 | 1118 | ); |
1119 | 1119 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1120 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1120 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1121 | 1121 | $TKT_values['TKT_ID'] = 0; |
1122 | 1122 | $TKT_values['TKT_is_default'] = 0; |
1123 | 1123 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1126,110 +1126,110 @@ discard block |
||
1126 | 1126 | //if we have a TKT_ID then we need to get that existing TKT_obj and update it |
1127 | 1127 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1128 | 1128 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1129 | - if ( ! empty( $tkt['TKT_ID'] ) ) { |
|
1129 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1130 | 1130 | $TKT = EE_Registry::instance() |
1131 | - ->load_model( 'Ticket', array( $evtobj->get_timezone() ) ) |
|
1132 | - ->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1133 | - if ( $TKT instanceof EE_Ticket ) { |
|
1131 | + ->load_model('Ticket', array($evtobj->get_timezone())) |
|
1132 | + ->get_one_by_ID($tkt['TKT_ID']); |
|
1133 | + if ($TKT instanceof EE_Ticket) { |
|
1134 | 1134 | $ticket_sold = $TKT->count_related( |
1135 | 1135 | 'Registration', |
1136 | 1136 | array( |
1137 | 1137 | array( |
1138 | 1138 | 'STS_ID' => array( |
1139 | 1139 | 'NOT IN', |
1140 | - array( EEM_Registration::status_id_incomplete ), |
|
1140 | + array(EEM_Registration::status_id_incomplete), |
|
1141 | 1141 | ), |
1142 | 1142 | ), |
1143 | 1143 | ) |
1144 | 1144 | ) > 0 ? true : false; |
1145 | 1145 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1146 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) |
|
1146 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') |
|
1147 | 1147 | && ! $TKT->get( |
1148 | 1148 | 'TKT_deleted' |
1149 | 1149 | ) ? true : false; |
1150 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1151 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1150 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1151 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1152 | 1152 | //set new values |
1153 | - foreach ( $TKT_values as $field => $value ) { |
|
1154 | - if ( $field == 'TKT_qty' ) { |
|
1155 | - $TKT->set_qty( $value ); |
|
1153 | + foreach ($TKT_values as $field => $value) { |
|
1154 | + if ($field == 'TKT_qty') { |
|
1155 | + $TKT->set_qty($value); |
|
1156 | 1156 | } else { |
1157 | - $TKT->set( $field, $value ); |
|
1157 | + $TKT->set($field, $value); |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1161 | - if ( $create_new_TKT ) { |
|
1161 | + if ($create_new_TKT) { |
|
1162 | 1162 | //archive the old ticket first |
1163 | - $TKT->set( 'TKT_deleted', 1 ); |
|
1163 | + $TKT->set('TKT_deleted', 1); |
|
1164 | 1164 | $TKT->save(); |
1165 | 1165 | //make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine. |
1166 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1166 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1167 | 1167 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1168 | 1168 | $TKT = clone $TKT; |
1169 | - $TKT->set( 'TKT_ID', 0 ); |
|
1170 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1171 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1172 | - $TKT->set( 'TKT_sold', 0 ); |
|
1169 | + $TKT->set('TKT_ID', 0); |
|
1170 | + $TKT->set('TKT_deleted', 0); |
|
1171 | + $TKT->set('TKT_price', $ticket_price); |
|
1172 | + $TKT->set('TKT_sold', 0); |
|
1173 | 1173 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1174 | 1174 | $update_prices = true; |
1175 | 1175 | } |
1176 | 1176 | //make sure price is set if it hasn't been already |
1177 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1177 | + $TKT->set('TKT_price', $ticket_price); |
|
1178 | 1178 | } |
1179 | 1179 | } else { |
1180 | 1180 | //no TKT_id so a new TKT |
1181 | 1181 | $TKT_values['TKT_price'] = $ticket_price; |
1182 | - $TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false ); |
|
1183 | - if ( $TKT instanceof EE_Ticket ) { |
|
1182 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false); |
|
1183 | + if ($TKT instanceof EE_Ticket) { |
|
1184 | 1184 | //need to reset values to properly account for the date formats |
1185 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1186 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1187 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1185 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1186 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1187 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1188 | 1188 | //set new values |
1189 | - foreach ( $TKT_values as $field => $value ) { |
|
1190 | - if ( $field == 'TKT_qty' ) { |
|
1191 | - $TKT->set_qty( $value ); |
|
1189 | + foreach ($TKT_values as $field => $value) { |
|
1190 | + if ($field == 'TKT_qty') { |
|
1191 | + $TKT->set_qty($value); |
|
1192 | 1192 | } else { |
1193 | - $TKT->set( $field, $value ); |
|
1193 | + $TKT->set($field, $value); |
|
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | $update_prices = true; |
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | // cap ticket qty by datetime reg limits |
1200 | - $TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) ); |
|
1200 | + $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit'))); |
|
1201 | 1201 | //update ticket. |
1202 | 1202 | $TKT->save(); |
1203 | 1203 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1204 | - if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) { |
|
1205 | - $TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) ); |
|
1206 | - $TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' ); |
|
1204 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1205 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1206 | + $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
|
1207 | 1207 | $TKT->save(); |
1208 | 1208 | } |
1209 | 1209 | //initially let's add the ticket to the dtt |
1210 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1211 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
1210 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1211 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
1212 | 1212 | //add prices to ticket |
1213 | - $this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices ); |
|
1213 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1214 | 1214 | } |
1215 | 1215 | //however now we need to handle permanently deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db. |
1216 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1217 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1218 | - foreach ( $tickets_removed as $id ) { |
|
1219 | - $id = absint( $id ); |
|
1216 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1217 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1218 | + foreach ($tickets_removed as $id) { |
|
1219 | + $id = absint($id); |
|
1220 | 1220 | //get the ticket for this id |
1221 | - $tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id ); |
|
1221 | + $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
|
1222 | 1222 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1223 | - $dtts = $tkt_to_remove->get_many_related( 'Datetime' ); |
|
1224 | - foreach ( $dtts as $dtt ) { |
|
1225 | - $tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' ); |
|
1223 | + $dtts = $tkt_to_remove->get_many_related('Datetime'); |
|
1224 | + foreach ($dtts as $dtt) { |
|
1225 | + $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
|
1226 | 1226 | } |
1227 | 1227 | //need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
1228 | - $tkt_to_remove->delete_related_permanently( 'Price' ); |
|
1228 | + $tkt_to_remove->delete_related_permanently('Price'); |
|
1229 | 1229 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1230 | 1230 | $tkt_to_remove->delete_permanently(); |
1231 | 1231 | } |
1232 | - return array( $saved_dtt, $saved_tickets ); |
|
1232 | + return array($saved_dtt, $saved_tickets); |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | |
@@ -1246,29 +1246,29 @@ discard block |
||
1246 | 1246 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1247 | 1247 | * @return void |
1248 | 1248 | */ |
1249 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) { |
|
1250 | - foreach ( $prices as $row => $prc ) { |
|
1249 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) { |
|
1250 | + foreach ($prices as $row => $prc) { |
|
1251 | 1251 | $PRC_values = array( |
1252 | - 'PRC_ID' => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null, |
|
1253 | - 'PRT_ID' => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null, |
|
1254 | - 'PRC_amount' => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1255 | - 'PRC_name' => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1256 | - 'PRC_desc' => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1252 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null, |
|
1253 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null, |
|
1254 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1255 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1256 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1257 | 1257 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1258 | 1258 | 'PRC_order' => $row, |
1259 | 1259 | ); |
1260 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1260 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1261 | 1261 | $PRC_values['PRC_ID'] = 0; |
1262 | - $PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false ); |
|
1262 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false); |
|
1263 | 1263 | } else { |
1264 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1264 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1265 | 1265 | //update this price with new values |
1266 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1267 | - $PRC->set( $field, $newprc ); |
|
1266 | + foreach ($PRC_values as $field => $newprc) { |
|
1267 | + $PRC->set($field, $newprc); |
|
1268 | 1268 | } |
1269 | 1269 | $PRC->save(); |
1270 | 1270 | } |
1271 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1271 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | private function _generate_publish_box_extra_content() { |
1301 | 1301 | //load formatter helper |
1302 | 1302 | //args for getting related registrations |
1303 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1303 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1304 | 1304 | $not_approved_query_args = array( |
1305 | 1305 | array( |
1306 | 1306 | 'REG_deleted' => 0, |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean(); |
1372 | 1372 | // load template |
1373 | 1373 | EEH_Template::display_template( |
1374 | - EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', |
|
1374 | + EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', |
|
1375 | 1375 | $publish_box_extra_args |
1376 | 1376 | ); |
1377 | 1377 | } |
@@ -1405,16 +1405,16 @@ discard block |
||
1405 | 1405 | $this->verify_cpt_object(); |
1406 | 1406 | add_meta_box( |
1407 | 1407 | 'espresso_event_editor_tickets', |
1408 | - esc_html__( 'Event Datetime & Ticket', 'event_espresso' ), |
|
1409 | - array( $this, 'ticket_metabox' ), |
|
1408 | + esc_html__('Event Datetime & Ticket', 'event_espresso'), |
|
1409 | + array($this, 'ticket_metabox'), |
|
1410 | 1410 | $this->page_slug, |
1411 | 1411 | 'normal', |
1412 | 1412 | 'high' |
1413 | 1413 | ); |
1414 | 1414 | add_meta_box( |
1415 | 1415 | 'espresso_event_editor_event_options', |
1416 | - esc_html__( 'Event Registration Options', 'event_espresso' ), |
|
1417 | - array( $this, 'registration_options_meta_box' ), |
|
1416 | + esc_html__('Event Registration Options', 'event_espresso'), |
|
1417 | + array($this, 'registration_options_meta_box'), |
|
1418 | 1418 | $this->page_slug, |
1419 | 1419 | 'side', |
1420 | 1420 | 'default' |
@@ -1442,65 +1442,65 @@ discard block |
||
1442 | 1442 | 'trash_icon' => 'ee-lock-icon', |
1443 | 1443 | 'disabled' => '', |
1444 | 1444 | ); |
1445 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null; |
|
1446 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1445 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null; |
|
1446 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1447 | 1447 | /** |
1448 | 1448 | * 1. Start with retrieving Datetimes |
1449 | 1449 | * 2. Fore each datetime get related tickets |
1450 | 1450 | * 3. For each ticket get related prices |
1451 | 1451 | */ |
1452 | - $times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id ); |
|
1452 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1453 | 1453 | /** @type EE_Datetime $first_datetime */ |
1454 | - $first_datetime = reset( $times ); |
|
1454 | + $first_datetime = reset($times); |
|
1455 | 1455 | //do we get related tickets? |
1456 | - if ( $first_datetime instanceof EE_Datetime |
|
1456 | + if ($first_datetime instanceof EE_Datetime |
|
1457 | 1457 | && $first_datetime->ID() !== 0 |
1458 | 1458 | ) { |
1459 | - $existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' ); |
|
1459 | + $existing_datetime_ids[] = $first_datetime->get('DTT_ID'); |
|
1460 | 1460 | $template_args['time'] = $first_datetime; |
1461 | 1461 | $related_tickets = $first_datetime->tickets( |
1462 | 1462 | array( |
1463 | - array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), |
|
1463 | + array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), |
|
1464 | 1464 | 'default_where_conditions' => 'none', |
1465 | 1465 | ) |
1466 | 1466 | ); |
1467 | - if ( ! empty( $related_tickets ) ) { |
|
1468 | - $template_args['total_ticket_rows'] = count( $related_tickets ); |
|
1467 | + if ( ! empty($related_tickets)) { |
|
1468 | + $template_args['total_ticket_rows'] = count($related_tickets); |
|
1469 | 1469 | $row = 0; |
1470 | - foreach ( $related_tickets as $ticket ) { |
|
1471 | - $existing_ticket_ids[] = $ticket->get( 'TKT_ID' ); |
|
1472 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row ); |
|
1470 | + foreach ($related_tickets as $ticket) { |
|
1471 | + $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
|
1472 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row); |
|
1473 | 1473 | $row++; |
1474 | 1474 | } |
1475 | 1475 | } else { |
1476 | 1476 | $template_args['total_ticket_rows'] = 1; |
1477 | 1477 | /** @type EE_Ticket $ticket */ |
1478 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(); |
|
1479 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1478 | + $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
|
1479 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1480 | 1480 | } |
1481 | 1481 | } else { |
1482 | 1482 | $template_args['time'] = $times[0]; |
1483 | 1483 | /** @type EE_Ticket $ticket */ |
1484 | - $ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets(); |
|
1485 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); |
|
1484 | + $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
|
1485 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); |
|
1486 | 1486 | // NOTE: we're just sending the first default row |
1487 | 1487 | // (decaf can't manage default tickets so this should be sufficient); |
1488 | 1488 | } |
1489 | 1489 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link( |
1490 | 1490 | 'event_editor_event_datetimes_help_tab' |
1491 | 1491 | ); |
1492 | - $template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' ); |
|
1493 | - $template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
1494 | - $template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
1492 | + $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
|
1493 | + $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
1494 | + $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
1495 | 1495 | $template_args['ticket_js_structure'] = $this->_get_ticket_row( |
1496 | - EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(), |
|
1496 | + EE_Registry::instance()->load_model('Ticket')->create_default_object(), |
|
1497 | 1497 | true |
1498 | 1498 | ); |
1499 | 1499 | $template = apply_filters( |
1500 | 1500 | 'FHEE__Events_Admin_Page__ticket_metabox__template', |
1501 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' |
|
1501 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php' |
|
1502 | 1502 | ); |
1503 | - EEH_Template::display_template( $template, $template_args ); |
|
1503 | + EEH_Template::display_template($template, $template_args); |
|
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | |
@@ -1514,74 +1514,74 @@ discard block |
||
1514 | 1514 | * @param int $row |
1515 | 1515 | * @return string generated html for the ticket row. |
1516 | 1516 | */ |
1517 | - private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) { |
|
1517 | + private function _get_ticket_row($ticket, $skeleton = false, $row = 0) { |
|
1518 | 1518 | $template_args = array( |
1519 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1519 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1520 | 1520 | 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' |
1521 | 1521 | : '', |
1522 | 1522 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1523 | - 'TKT_ID' => $ticket->get( 'TKT_ID' ), |
|
1524 | - 'TKT_name' => $ticket->get( 'TKT_name' ), |
|
1525 | - 'TKT_start_date' => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ), |
|
1526 | - 'TKT_end_date' => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ), |
|
1527 | - 'TKT_is_default' => $ticket->get( 'TKT_is_default' ), |
|
1528 | - 'TKT_qty' => $ticket->get_pretty( 'TKT_qty', 'input' ), |
|
1523 | + 'TKT_ID' => $ticket->get('TKT_ID'), |
|
1524 | + 'TKT_name' => $ticket->get('TKT_name'), |
|
1525 | + 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
|
1526 | + 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
|
1527 | + 'TKT_is_default' => $ticket->get('TKT_is_default'), |
|
1528 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1529 | 1529 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1530 | - 'TKT_sold' => $skeleton ? 0 : $ticket->get( 'TKT_sold' ), |
|
1531 | - 'trash_icon' => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ) |
|
1532 | - && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 ) |
|
1530 | + 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
|
1531 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) |
|
1532 | + && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) |
|
1533 | 1533 | ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
1534 | - 'disabled' => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? '' |
|
1534 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' |
|
1535 | 1535 | : ' disabled=disabled', |
1536 | 1536 | ); |
1537 | 1537 | $price = $ticket->ID() !== 0 |
1538 | - ? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) ) |
|
1539 | - : EE_Registry::instance()->load_model( 'Price' )->create_default_object(); |
|
1538 | + ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) |
|
1539 | + : EE_Registry::instance()->load_model('Price')->create_default_object(); |
|
1540 | 1540 | $price_args = array( |
1541 | 1541 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1542 | - 'PRC_amount' => $price->get( 'PRC_amount' ), |
|
1543 | - 'PRT_ID' => $price->get( 'PRT_ID' ), |
|
1544 | - 'PRC_ID' => $price->get( 'PRC_ID' ), |
|
1545 | - 'PRC_is_default' => $price->get( 'PRC_is_default' ), |
|
1542 | + 'PRC_amount' => $price->get('PRC_amount'), |
|
1543 | + 'PRT_ID' => $price->get('PRT_ID'), |
|
1544 | + 'PRC_ID' => $price->get('PRC_ID'), |
|
1545 | + 'PRC_is_default' => $price->get('PRC_is_default'), |
|
1546 | 1546 | ); |
1547 | 1547 | //make sure we have default start and end dates if skeleton |
1548 | 1548 | //handle rows that should NOT be empty |
1549 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1549 | + if (empty($template_args['TKT_start_date'])) { |
|
1550 | 1550 | //if empty then the start date will be now. |
1551 | - $template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) ); |
|
1551 | + $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
|
1552 | 1552 | } |
1553 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1553 | + if (empty($template_args['TKT_end_date'])) { |
|
1554 | 1554 | //get the earliest datetime (if present); |
1555 | 1555 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 |
1556 | 1556 | ? $this->_cpt_model_obj->get_first_related( |
1557 | 1557 | 'Datetime', |
1558 | - array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) |
|
1558 | + array('order_by' => array('DTT_EVT_start' => 'ASC')) |
|
1559 | 1559 | ) |
1560 | 1560 | : null; |
1561 | - if ( ! empty( $earliest_dtt ) ) { |
|
1562 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' ); |
|
1561 | + if ( ! empty($earliest_dtt)) { |
|
1562 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1563 | 1563 | } else { |
1564 | 1564 | $template_args['TKT_end_date'] = date( |
1565 | 1565 | 'Y-m-d h:i a', |
1566 | - mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) ) |
|
1566 | + mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")) |
|
1567 | 1567 | ); |
1568 | 1568 | } |
1569 | 1569 | } |
1570 | - $template_args = array_merge( $template_args, $price_args ); |
|
1570 | + $template_args = array_merge($template_args, $price_args); |
|
1571 | 1571 | $template = apply_filters( |
1572 | 1572 | 'FHEE__Events_Admin_Page__get_ticket_row__template', |
1573 | - EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', |
|
1573 | + EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', |
|
1574 | 1574 | $ticket |
1575 | 1575 | ); |
1576 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
1576 | + return EEH_Template::display_template($template, $template_args, true); |
|
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | |
1580 | 1580 | |
1581 | 1581 | public function registration_options_meta_box() { |
1582 | 1582 | $yes_no_values = array( |
1583 | - array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ), |
|
1584 | - array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ), |
|
1583 | + array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')), |
|
1584 | + array('id' => false, 'text' => esc_html__('No', 'event_espresso')), |
|
1585 | 1585 | ); |
1586 | 1586 | $default_reg_status_values = EEM_Registration::reg_status_array( |
1587 | 1587 | array( |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | ); |
1594 | 1594 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1595 | 1595 | $template_args['_event'] = $this->_cpt_model_obj; |
1596 | - $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false ); |
|
1596 | + $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false); |
|
1597 | 1597 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
1598 | 1598 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input( |
1599 | 1599 | 'default_reg_status', |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | $default_reg_status_values |
1622 | 1622 | ); |
1623 | 1623 | EEH_Template::display_template( |
1624 | - EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php', |
|
1624 | + EVENTS_TEMPLATE_PATH.'event_registration_options.template.php', |
|
1625 | 1625 | $template_args |
1626 | 1626 | ); |
1627 | 1627 | } |
@@ -1640,97 +1640,97 @@ discard block |
||
1640 | 1640 | * that match the given _view and paging parameters. |
1641 | 1641 | * @return array an array of event objects. |
1642 | 1642 | */ |
1643 | - public function get_events( $per_page = 10, $current_page = 1, $count = false ) { |
|
1643 | + public function get_events($per_page = 10, $current_page = 1, $count = false) { |
|
1644 | 1644 | $EEME = $this->_event_model(); |
1645 | - $offset = ( $current_page - 1 ) * $per_page; |
|
1646 | - $limit = $count ? null : $offset . ',' . $per_page; |
|
1647 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1648 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC"; |
|
1649 | - if ( isset( $this->_req_data['month_range'] ) ) { |
|
1650 | - $pieces = explode( ' ', $this->_req_data['month_range'], 3 ); |
|
1651 | - $month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : ''; |
|
1652 | - $year_r = ! empty( $pieces[1] ) ? $pieces[1] : ''; |
|
1645 | + $offset = ($current_page - 1) * $per_page; |
|
1646 | + $limit = $count ? null : $offset.','.$per_page; |
|
1647 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
|
1648 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
|
1649 | + if (isset($this->_req_data['month_range'])) { |
|
1650 | + $pieces = explode(' ', $this->_req_data['month_range'], 3); |
|
1651 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1652 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1653 | 1653 | } |
1654 | 1654 | $where = array(); |
1655 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null; |
|
1655 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null; |
|
1656 | 1656 | //determine what post_status our condition will have for the query. |
1657 | - switch ( $status ) { |
|
1657 | + switch ($status) { |
|
1658 | 1658 | case 'month' : |
1659 | 1659 | case 'today' : |
1660 | 1660 | case null : |
1661 | 1661 | case 'all' : |
1662 | 1662 | break; |
1663 | 1663 | case 'draft' : |
1664 | - $where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) ); |
|
1664 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1665 | 1665 | break; |
1666 | 1666 | default : |
1667 | 1667 | $where['status'] = $status; |
1668 | 1668 | } |
1669 | 1669 | //categories? |
1670 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 |
|
1670 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 |
|
1671 | 1671 | ? $this->_req_data['EVT_CAT'] : null; |
1672 | - if ( ! empty ( $category ) ) { |
|
1672 | + if ( ! empty ($category)) { |
|
1673 | 1673 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1674 | 1674 | $where['Term_Taxonomy.term_id'] = $category; |
1675 | 1675 | } |
1676 | 1676 | //date where conditions |
1677 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1678 | - if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) { |
|
1677 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1678 | + if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
|
1679 | 1679 | $DateTime = new DateTime( |
1680 | - $year_r . '-' . $month_r . '-01 00:00:00', |
|
1681 | - new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) |
|
1680 | + $year_r.'-'.$month_r.'-01 00:00:00', |
|
1681 | + new DateTimeZone(EEM_Datetime::instance()->get_timezone()) |
|
1682 | 1682 | ); |
1683 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1684 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format( |
|
1685 | - implode( ' ', $start_formats ) |
|
1683 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1684 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format( |
|
1685 | + implode(' ', $start_formats) |
|
1686 | 1686 | ); |
1687 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1688 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) { |
|
1689 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1690 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1691 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1692 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1693 | - } else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) { |
|
1694 | - $now = date( 'Y-m-01' ); |
|
1695 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1696 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1697 | - $end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) ) |
|
1698 | - ->setTime( 23, 59, 59 ) |
|
1699 | - ->format( implode( ' ', $start_formats ) ); |
|
1700 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1687 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1688 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
|
1689 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1690 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1691 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1692 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1693 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1694 | + $now = date('Y-m-01'); |
|
1695 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1696 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1697 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t')) |
|
1698 | + ->setTime(23, 59, 59) |
|
1699 | + ->format(implode(' ', $start_formats)); |
|
1700 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1701 | 1701 | } |
1702 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1702 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1703 | 1703 | $where['EVT_wp_user'] = get_current_user_id(); |
1704 | 1704 | } else { |
1705 | - if ( ! isset( $where['status'] ) ) { |
|
1706 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1705 | + if ( ! isset($where['status'])) { |
|
1706 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1707 | 1707 | $where['OR'] = array( |
1708 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1708 | + 'status*restrict_private' => array('!=', 'private'), |
|
1709 | 1709 | 'AND' => array( |
1710 | - 'status*inclusive' => array( '=', 'private' ), |
|
1710 | + 'status*inclusive' => array('=', 'private'), |
|
1711 | 1711 | 'EVT_wp_user' => get_current_user_id(), |
1712 | 1712 | ), |
1713 | 1713 | ); |
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1718 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1719 | - && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) |
|
1717 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1718 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() |
|
1719 | + && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events') |
|
1720 | 1720 | ) { |
1721 | 1721 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1722 | 1722 | } |
1723 | 1723 | } |
1724 | 1724 | //search query handling |
1725 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1726 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1725 | + if (isset($this->_req_data['s'])) { |
|
1726 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1727 | 1727 | $where['OR'] = array( |
1728 | - 'EVT_name' => array( 'LIKE', $search_string ), |
|
1729 | - 'EVT_desc' => array( 'LIKE', $search_string ), |
|
1730 | - 'EVT_short_desc' => array( 'LIKE', $search_string ), |
|
1728 | + 'EVT_name' => array('LIKE', $search_string), |
|
1729 | + 'EVT_desc' => array('LIKE', $search_string), |
|
1730 | + 'EVT_short_desc' => array('LIKE', $search_string), |
|
1731 | 1731 | ); |
1732 | 1732 | } |
1733 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1733 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1734 | 1734 | $query_params = apply_filters( |
1735 | 1735 | 'FHEE__Events_Admin_Page__get_events__query_params', |
1736 | 1736 | array( |
@@ -1743,23 +1743,23 @@ discard block |
||
1743 | 1743 | $this->_req_data |
1744 | 1744 | ); |
1745 | 1745 | //let's first check if we have special requests coming in. |
1746 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1747 | - switch ( $this->_req_data['active_status'] ) { |
|
1746 | + if (isset($this->_req_data['active_status'])) { |
|
1747 | + switch ($this->_req_data['active_status']) { |
|
1748 | 1748 | case 'upcoming' : |
1749 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1749 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1750 | 1750 | break; |
1751 | 1751 | case 'expired' : |
1752 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1752 | + return $EEME->get_expired_events($query_params, $count); |
|
1753 | 1753 | break; |
1754 | 1754 | case 'active' : |
1755 | - return $EEME->get_active_events( $query_params, $count ); |
|
1755 | + return $EEME->get_active_events($query_params, $count); |
|
1756 | 1756 | break; |
1757 | 1757 | case 'inactive' : |
1758 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1758 | + return $EEME->get_inactive_events($query_params, $count); |
|
1759 | 1759 | break; |
1760 | 1760 | } |
1761 | 1761 | } |
1762 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1762 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1763 | 1763 | return $events; |
1764 | 1764 | } |
1765 | 1765 | |
@@ -1770,9 +1770,9 @@ discard block |
||
1770 | 1770 | * |
1771 | 1771 | * @param string $post_id |
1772 | 1772 | */ |
1773 | - public function trash_cpt_item( $post_id ) { |
|
1773 | + public function trash_cpt_item($post_id) { |
|
1774 | 1774 | $this->_req_data['EVT_ID'] = $post_id; |
1775 | - $this->_trash_or_restore_event( 'trash', false ); |
|
1775 | + $this->_trash_or_restore_event('trash', false); |
|
1776 | 1776 | } |
1777 | 1777 | |
1778 | 1778 | |
@@ -1780,9 +1780,9 @@ discard block |
||
1780 | 1780 | /** |
1781 | 1781 | * @param string $post_id |
1782 | 1782 | */ |
1783 | - public function restore_cpt_item( $post_id ) { |
|
1783 | + public function restore_cpt_item($post_id) { |
|
1784 | 1784 | $this->_req_data['EVT_ID'] = $post_id; |
1785 | - $this->_trash_or_restore_event( 'draft', false ); |
|
1785 | + $this->_trash_or_restore_event('draft', false); |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | |
@@ -1790,9 +1790,9 @@ discard block |
||
1790 | 1790 | /** |
1791 | 1791 | * @param string $post_id |
1792 | 1792 | */ |
1793 | - public function delete_cpt_item( $post_id ) { |
|
1793 | + public function delete_cpt_item($post_id) { |
|
1794 | 1794 | $this->_req_data['EVT_ID'] = $post_id; |
1795 | - $this->_delete_event( false ); |
|
1795 | + $this->_delete_event(false); |
|
1796 | 1796 | } |
1797 | 1797 | |
1798 | 1798 | |
@@ -1804,23 +1804,23 @@ discard block |
||
1804 | 1804 | * @param string $event_status |
1805 | 1805 | * @param bool $redirect_after |
1806 | 1806 | */ |
1807 | - protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) { |
|
1807 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) { |
|
1808 | 1808 | //determine the event id and set to array. |
1809 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false; |
|
1809 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false; |
|
1810 | 1810 | // loop thru events |
1811 | - if ( $EVT_ID ) { |
|
1811 | + if ($EVT_ID) { |
|
1812 | 1812 | // clean status |
1813 | - $event_status = sanitize_key( $event_status ); |
|
1813 | + $event_status = sanitize_key($event_status); |
|
1814 | 1814 | // grab status |
1815 | - if ( ! empty( $event_status ) ) { |
|
1816 | - $success = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1815 | + if ( ! empty($event_status)) { |
|
1816 | + $success = $this->_change_event_status($EVT_ID, $event_status); |
|
1817 | 1817 | } else { |
1818 | 1818 | $success = false; |
1819 | 1819 | $msg = esc_html__( |
1820 | 1820 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1821 | 1821 | 'event_espresso' |
1822 | 1822 | ); |
1823 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1823 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1824 | 1824 | } |
1825 | 1825 | } else { |
1826 | 1826 | $success = false; |
@@ -1828,11 +1828,11 @@ discard block |
||
1828 | 1828 | 'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.', |
1829 | 1829 | 'event_espresso' |
1830 | 1830 | ); |
1831 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1831 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1832 | 1832 | } |
1833 | 1833 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1834 | - if ( $redirect_after ) { |
|
1835 | - $this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) ); |
|
1834 | + if ($redirect_after) { |
|
1835 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1836 | 1836 | } |
1837 | 1837 | } |
1838 | 1838 | |
@@ -1845,18 +1845,18 @@ discard block |
||
1845 | 1845 | * @param string $event_status |
1846 | 1846 | * @return void |
1847 | 1847 | */ |
1848 | - protected function _trash_or_restore_events( $event_status = 'trash' ) { |
|
1848 | + protected function _trash_or_restore_events($event_status = 'trash') { |
|
1849 | 1849 | // clean status |
1850 | - $event_status = sanitize_key( $event_status ); |
|
1850 | + $event_status = sanitize_key($event_status); |
|
1851 | 1851 | // grab status |
1852 | - if ( ! empty( $event_status ) ) { |
|
1852 | + if ( ! empty($event_status)) { |
|
1853 | 1853 | $success = true; |
1854 | 1854 | //determine the event id and set to array. |
1855 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1855 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
1856 | 1856 | // loop thru events |
1857 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
1858 | - if ( $EVT_ID = absint( $EVT_ID ) ) { |
|
1859 | - $results = $this->_change_event_status( $EVT_ID, $event_status ); |
|
1857 | + foreach ($EVT_IDs as $EVT_ID) { |
|
1858 | + if ($EVT_ID = absint($EVT_ID)) { |
|
1859 | + $results = $this->_change_event_status($EVT_ID, $event_status); |
|
1860 | 1860 | $success = $results !== false ? $success : false; |
1861 | 1861 | } else { |
1862 | 1862 | $msg = sprintf( |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | ), |
1867 | 1867 | $EVT_ID |
1868 | 1868 | ); |
1869 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1869 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1870 | 1870 | $success = false; |
1871 | 1871 | } |
1872 | 1872 | } |
@@ -1876,12 +1876,12 @@ discard block |
||
1876 | 1876 | 'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.', |
1877 | 1877 | 'event_espresso' |
1878 | 1878 | ); |
1879 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1879 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1880 | 1880 | } |
1881 | 1881 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
1882 | 1882 | $success = $success ? 2 : false; |
1883 | 1883 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1884 | - $this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) ); |
|
1884 | + $this->_redirect_after_action($success, 'Events', $action, array('action' => 'default')); |
|
1885 | 1885 | } |
1886 | 1886 | |
1887 | 1887 | |
@@ -1894,30 +1894,30 @@ discard block |
||
1894 | 1894 | * @param string $event_status |
1895 | 1895 | * @return bool |
1896 | 1896 | */ |
1897 | - private function _change_event_status( $EVT_ID = 0, $event_status = '' ) { |
|
1897 | + private function _change_event_status($EVT_ID = 0, $event_status = '') { |
|
1898 | 1898 | // grab event id |
1899 | - if ( ! $EVT_ID ) { |
|
1899 | + if ( ! $EVT_ID) { |
|
1900 | 1900 | $msg = esc_html__( |
1901 | 1901 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
1902 | 1902 | 'event_espresso' |
1903 | 1903 | ); |
1904 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1904 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1905 | 1905 | return false; |
1906 | 1906 | } |
1907 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1907 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1908 | 1908 | // clean status |
1909 | - $event_status = sanitize_key( $event_status ); |
|
1909 | + $event_status = sanitize_key($event_status); |
|
1910 | 1910 | // grab status |
1911 | - if ( empty( $event_status ) ) { |
|
1911 | + if (empty($event_status)) { |
|
1912 | 1912 | $msg = esc_html__( |
1913 | 1913 | 'An error occurred. No Event Status or an invalid Event Status was received.', |
1914 | 1914 | 'event_espresso' |
1915 | 1915 | ); |
1916 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1916 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1917 | 1917 | return false; |
1918 | 1918 | } |
1919 | 1919 | // was event trashed or restored ? |
1920 | - switch ( $event_status ) { |
|
1920 | + switch ($event_status) { |
|
1921 | 1921 | case 'draft' : |
1922 | 1922 | $action = 'restored from the trash'; |
1923 | 1923 | $hook = 'AHEE_event_restored_from_trash'; |
@@ -1931,15 +1931,15 @@ discard block |
||
1931 | 1931 | $hook = false; |
1932 | 1932 | } |
1933 | 1933 | //use class to change status |
1934 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1934 | + $this->_cpt_model_obj->set_status($event_status); |
|
1935 | 1935 | $success = $this->_cpt_model_obj->save(); |
1936 | - if ( $success === false ) { |
|
1937 | - $msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action ); |
|
1938 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1936 | + if ($success === false) { |
|
1937 | + $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action); |
|
1938 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1939 | 1939 | return false; |
1940 | 1940 | } |
1941 | - if ( $hook ) { |
|
1942 | - do_action( $hook ); |
|
1941 | + if ($hook) { |
|
1942 | + do_action($hook); |
|
1943 | 1943 | } |
1944 | 1944 | return true; |
1945 | 1945 | } |
@@ -1952,34 +1952,34 @@ discard block |
||
1952 | 1952 | * @access protected |
1953 | 1953 | * @param bool $redirect_after |
1954 | 1954 | */ |
1955 | - protected function _delete_event( $redirect_after = true ) { |
|
1955 | + protected function _delete_event($redirect_after = true) { |
|
1956 | 1956 | //determine the event id and set to array. |
1957 | - $EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null; |
|
1958 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1957 | + $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null; |
|
1958 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1959 | 1959 | // loop thru events |
1960 | - if ( $EVT_ID ) { |
|
1961 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1960 | + if ($EVT_ID) { |
|
1961 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1962 | 1962 | // get list of events with no prices |
1963 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1963 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1964 | 1964 | // remove this event from the list of events with no prices |
1965 | - if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) { |
|
1966 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
1965 | + if (isset($espresso_no_ticket_prices[$EVT_ID])) { |
|
1966 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
1967 | 1967 | } |
1968 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
1968 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
1969 | 1969 | } else { |
1970 | 1970 | $success = false; |
1971 | 1971 | $msg = esc_html__( |
1972 | 1972 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
1973 | 1973 | 'event_espresso' |
1974 | 1974 | ); |
1975 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1975 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1976 | 1976 | } |
1977 | - if ( $redirect_after ) { |
|
1977 | + if ($redirect_after) { |
|
1978 | 1978 | $this->_redirect_after_action( |
1979 | 1979 | $success, |
1980 | 1980 | 'Event', |
1981 | 1981 | 'deleted', |
1982 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
1982 | + array('action' => 'default', 'status' => 'trash') |
|
1983 | 1983 | ); |
1984 | 1984 | } |
1985 | 1985 | } |
@@ -1995,30 +1995,30 @@ discard block |
||
1995 | 1995 | protected function _delete_events() { |
1996 | 1996 | $success = true; |
1997 | 1997 | // get list of events with no prices |
1998 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() ); |
|
1998 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
|
1999 | 1999 | //determine the event id and set to array. |
2000 | - $EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2000 | + $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
|
2001 | 2001 | // loop thru events |
2002 | - foreach ( $EVT_IDs as $EVT_ID ) { |
|
2003 | - $EVT_ID = absint( $EVT_ID ); |
|
2004 | - if ( $EVT_ID ) { |
|
2005 | - $results = $this->_permanently_delete_event( $EVT_ID ); |
|
2002 | + foreach ($EVT_IDs as $EVT_ID) { |
|
2003 | + $EVT_ID = absint($EVT_ID); |
|
2004 | + if ($EVT_ID) { |
|
2005 | + $results = $this->_permanently_delete_event($EVT_ID); |
|
2006 | 2006 | $success = $results !== false ? $success : false; |
2007 | 2007 | // remove this event from the list of events with no prices |
2008 | - unset( $espresso_no_ticket_prices[ $EVT_ID ] ); |
|
2008 | + unset($espresso_no_ticket_prices[$EVT_ID]); |
|
2009 | 2009 | } else { |
2010 | 2010 | $success = false; |
2011 | 2011 | $msg = esc_html__( |
2012 | 2012 | 'An error occurred. An event could not be deleted because a valid event ID was not not supplied.', |
2013 | 2013 | 'event_espresso' |
2014 | 2014 | ); |
2015 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2015 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2016 | 2016 | } |
2017 | 2017 | } |
2018 | - update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices ); |
|
2018 | + update_option('ee_no_ticket_prices', $espresso_no_ticket_prices); |
|
2019 | 2019 | // in order to force a pluralized result message we need to send back a success status greater than 1 |
2020 | 2020 | $success = $success ? 2 : false; |
2021 | - $this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) ); |
|
2021 | + $this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default')); |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | |
@@ -2030,70 +2030,70 @@ discard block |
||
2030 | 2030 | * @param int $EVT_ID |
2031 | 2031 | * @return bool |
2032 | 2032 | */ |
2033 | - private function _permanently_delete_event( $EVT_ID = 0 ) { |
|
2033 | + private function _permanently_delete_event($EVT_ID = 0) { |
|
2034 | 2034 | // grab event id |
2035 | - if ( ! $EVT_ID ) { |
|
2035 | + if ( ! $EVT_ID) { |
|
2036 | 2036 | $msg = esc_html__( |
2037 | 2037 | 'An error occurred. No Event ID or an invalid Event ID was received.', |
2038 | 2038 | 'event_espresso' |
2039 | 2039 | ); |
2040 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2040 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2041 | 2041 | return false; |
2042 | 2042 | } |
2043 | 2043 | if ( |
2044 | 2044 | ! $this->_cpt_model_obj instanceof EE_Event |
2045 | 2045 | || $this->_cpt_model_obj->ID() !== $EVT_ID |
2046 | 2046 | ) { |
2047 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
2047 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
2048 | 2048 | } |
2049 | - if ( ! $this->_cpt_model_obj instanceof EE_Event ) { |
|
2049 | + if ( ! $this->_cpt_model_obj instanceof EE_Event) { |
|
2050 | 2050 | return false; |
2051 | 2051 | } |
2052 | 2052 | //need to delete related tickets and prices first. |
2053 | - $datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' ); |
|
2054 | - foreach ( $datetimes as $datetime ) { |
|
2055 | - $this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' ); |
|
2056 | - $tickets = $datetime->get_many_related( 'Ticket' ); |
|
2057 | - foreach ( $tickets as $ticket ) { |
|
2058 | - $ticket->_remove_relation_to( $datetime, 'Datetime' ); |
|
2059 | - $ticket->delete_related_permanently( 'Price' ); |
|
2053 | + $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
|
2054 | + foreach ($datetimes as $datetime) { |
|
2055 | + $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
|
2056 | + $tickets = $datetime->get_many_related('Ticket'); |
|
2057 | + foreach ($tickets as $ticket) { |
|
2058 | + $ticket->_remove_relation_to($datetime, 'Datetime'); |
|
2059 | + $ticket->delete_related_permanently('Price'); |
|
2060 | 2060 | $ticket->delete_permanently(); |
2061 | 2061 | } |
2062 | 2062 | $datetime->delete(); |
2063 | 2063 | } |
2064 | 2064 | //what about related venues or terms? |
2065 | - $venues = $this->_cpt_model_obj->get_many_related( 'Venue' ); |
|
2066 | - foreach ( $venues as $venue ) { |
|
2067 | - $this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' ); |
|
2065 | + $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
|
2066 | + foreach ($venues as $venue) { |
|
2067 | + $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
|
2068 | 2068 | } |
2069 | 2069 | //any attached question groups? |
2070 | - $question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' ); |
|
2071 | - if ( ! empty( $question_groups ) ) { |
|
2072 | - foreach ( $question_groups as $question_group ) { |
|
2073 | - $this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' ); |
|
2070 | + $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
|
2071 | + if ( ! empty($question_groups)) { |
|
2072 | + foreach ($question_groups as $question_group) { |
|
2073 | + $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
|
2074 | 2074 | } |
2075 | 2075 | } |
2076 | 2076 | //Message Template Groups |
2077 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
2077 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
2078 | 2078 | /** @type EE_Term_Taxonomy[] $term_taxonomies */ |
2079 | 2079 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
2080 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
2081 | - $this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy ); |
|
2080 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
2081 | + $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
|
2082 | 2082 | } |
2083 | 2083 | $success = $this->_cpt_model_obj->delete_permanently(); |
2084 | 2084 | // did it all go as planned ? |
2085 | - if ( $success ) { |
|
2086 | - $msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID ); |
|
2087 | - EE_Error::add_success( $msg ); |
|
2085 | + if ($success) { |
|
2086 | + $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID); |
|
2087 | + EE_Error::add_success($msg); |
|
2088 | 2088 | } else { |
2089 | 2089 | $msg = sprintf( |
2090 | - esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ), |
|
2090 | + esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'), |
|
2091 | 2091 | $EVT_ID |
2092 | 2092 | ); |
2093 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2093 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2094 | 2094 | return false; |
2095 | 2095 | } |
2096 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID ); |
|
2096 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID); |
|
2097 | 2097 | return true; |
2098 | 2098 | } |
2099 | 2099 | |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | * @return int |
2107 | 2107 | */ |
2108 | 2108 | public function total_events() { |
2109 | - $count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2109 | + $count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true); |
|
2110 | 2110 | return $count; |
2111 | 2111 | } |
2112 | 2112 | |
@@ -2120,9 +2120,9 @@ discard block |
||
2120 | 2120 | */ |
2121 | 2121 | public function total_events_draft() { |
2122 | 2122 | $where = array( |
2123 | - 'status' => array( 'IN', array( 'draft', 'auto-draft' ) ), |
|
2123 | + 'status' => array('IN', array('draft', 'auto-draft')), |
|
2124 | 2124 | ); |
2125 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2125 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2126 | 2126 | return $count; |
2127 | 2127 | } |
2128 | 2128 | |
@@ -2138,7 +2138,7 @@ discard block |
||
2138 | 2138 | $where = array( |
2139 | 2139 | 'status' => 'trash', |
2140 | 2140 | ); |
2141 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
2141 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
2142 | 2142 | return $count; |
2143 | 2143 | } |
2144 | 2144 | |
@@ -2169,12 +2169,12 @@ discard block |
||
2169 | 2169 | EE_Registry::instance()->CFG->registration->default_STS_ID, |
2170 | 2170 | $this->_template_args['reg_status_array'] |
2171 | 2171 | ) |
2172 | - ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) |
|
2172 | + ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) |
|
2173 | 2173 | : EEM_Registration::status_id_pending_payment; |
2174 | - $this->_set_add_edit_form_tags( 'update_default_event_settings' ); |
|
2175 | - $this->_set_publish_post_box_vars( null, false, false, null, false ); |
|
2174 | + $this->_set_add_edit_form_tags('update_default_event_settings'); |
|
2175 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
2176 | 2176 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2177 | - EVENTS_TEMPLATE_PATH . 'event_settings.template.php', |
|
2177 | + EVENTS_TEMPLATE_PATH.'event_settings.template.php', |
|
2178 | 2178 | $this->_template_args, |
2179 | 2179 | true |
2180 | 2180 | ); |
@@ -2190,8 +2190,8 @@ discard block |
||
2190 | 2190 | * @return void |
2191 | 2191 | */ |
2192 | 2192 | protected function _update_default_event_settings() { |
2193 | - EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] ) |
|
2194 | - ? sanitize_text_field( $this->_req_data['default_reg_status'] ) |
|
2193 | + EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status']) |
|
2194 | + ? sanitize_text_field($this->_req_data['default_reg_status']) |
|
2195 | 2195 | : EEM_Registration::status_id_pending_payment; |
2196 | 2196 | $what = 'Default Event Settings'; |
2197 | 2197 | $success = $this->_update_espresso_configuration( |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | __FUNCTION__, |
2202 | 2202 | __LINE__ |
2203 | 2203 | ); |
2204 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) ); |
|
2204 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings')); |
|
2205 | 2205 | } |
2206 | 2206 | |
2207 | 2207 | |
@@ -2211,20 +2211,20 @@ discard block |
||
2211 | 2211 | |
2212 | 2212 | |
2213 | 2213 | protected function _template_settings() { |
2214 | - $this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' ); |
|
2214 | + $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso'); |
|
2215 | 2215 | $this->_template_args['preview_img'] = '<img src="' |
2216 | 2216 | . EVENTS_ASSETS_URL |
2217 | 2217 | . DS |
2218 | 2218 | . 'images' |
2219 | 2219 | . DS |
2220 | 2220 | . 'caffeinated_template_features.jpg" alt="' |
2221 | - . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) |
|
2221 | + . esc_attr__('Template Settings Preview screenshot', 'event_espresso') |
|
2222 | 2222 | . '" />'; |
2223 | - $this->_template_args['preview_text'] = '<strong>' . esc_html__( |
|
2223 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__( |
|
2224 | 2224 | 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', |
2225 | 2225 | 'event_espresso' |
2226 | - ) . '</strong>'; |
|
2227 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2226 | + ).'</strong>'; |
|
2227 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2228 | 2228 | } |
2229 | 2229 | |
2230 | 2230 | |
@@ -2236,18 +2236,18 @@ discard block |
||
2236 | 2236 | * @return void |
2237 | 2237 | */ |
2238 | 2238 | private function _set_category_object() { |
2239 | - if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) { |
|
2239 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
2240 | 2240 | return; |
2241 | 2241 | } //already have the category object so get out. |
2242 | 2242 | //set default category object |
2243 | 2243 | $this->_set_empty_category_object(); |
2244 | 2244 | //only set if we've got an id |
2245 | - if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) { |
|
2245 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2246 | 2246 | return; |
2247 | 2247 | } |
2248 | - $category_id = absint( $this->_req_data['EVT_CAT_ID'] ); |
|
2249 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2250 | - if ( ! empty( $term ) ) { |
|
2248 | + $category_id = absint($this->_req_data['EVT_CAT_ID']); |
|
2249 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2250 | + if ( ! empty($term)) { |
|
2251 | 2251 | $this->_category->category_name = $term->name; |
2252 | 2252 | $this->_category->category_identifier = $term->slug; |
2253 | 2253 | $this->_category->category_desc = $term->description; |
@@ -2267,9 +2267,9 @@ discard block |
||
2267 | 2267 | |
2268 | 2268 | |
2269 | 2269 | protected function _category_list_table() { |
2270 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2271 | - $this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' ); |
|
2272 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
2270 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2271 | + $this->_search_btn_label = esc_html__('Categories', 'event_espresso'); |
|
2272 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
2273 | 2273 | 'add_category', |
2274 | 2274 | 'add_category', |
2275 | 2275 | array(), |
@@ -2283,20 +2283,20 @@ discard block |
||
2283 | 2283 | /** |
2284 | 2284 | * @param $view |
2285 | 2285 | */ |
2286 | - protected function _category_details( $view ) { |
|
2286 | + protected function _category_details($view) { |
|
2287 | 2287 | //load formatter helper |
2288 | 2288 | //load field generator helper |
2289 | 2289 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2290 | - $this->_set_add_edit_form_tags( $route ); |
|
2290 | + $this->_set_add_edit_form_tags($route); |
|
2291 | 2291 | $this->_set_category_object(); |
2292 | - $id = ! empty( $this->_category->id ) ? $this->_category->id : ''; |
|
2292 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2293 | 2293 | $delete_action = 'delete_category'; |
2294 | 2294 | //custom redirect |
2295 | 2295 | $redirect = EE_Admin_Page::add_query_args_and_nonce( |
2296 | - array( 'action' => 'category_list' ), |
|
2296 | + array('action' => 'category_list'), |
|
2297 | 2297 | $this->_admin_base_url |
2298 | 2298 | ); |
2299 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2299 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2300 | 2300 | //take care of contents |
2301 | 2301 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
2302 | 2302 | $this->display_admin_page_with_sidebar(); |
@@ -2310,21 +2310,21 @@ discard block |
||
2310 | 2310 | protected function _category_details_content() { |
2311 | 2311 | $editor_args['category_desc'] = array( |
2312 | 2312 | 'type' => 'wp_editor', |
2313 | - 'value' => EEH_Formatter::admin_format_content( $this->_category->category_desc ), |
|
2313 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
2314 | 2314 | 'class' => 'my_editor_custom', |
2315 | - 'wpeditor_args' => array( 'media_buttons' => false ), |
|
2315 | + 'wpeditor_args' => array('media_buttons' => false), |
|
2316 | 2316 | ); |
2317 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2317 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2318 | 2318 | $all_terms = get_terms( |
2319 | - array( 'espresso_event_categories' ), |
|
2320 | - array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) |
|
2319 | + array('espresso_event_categories'), |
|
2320 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
2321 | 2321 | ); |
2322 | 2322 | //setup category select for term parents. |
2323 | 2323 | $category_select_values[] = array( |
2324 | - 'text' => esc_html__( 'No Parent', 'event_espresso' ), |
|
2324 | + 'text' => esc_html__('No Parent', 'event_espresso'), |
|
2325 | 2325 | 'id' => 0, |
2326 | 2326 | ); |
2327 | - foreach ( $all_terms as $term ) { |
|
2327 | + foreach ($all_terms as $term) { |
|
2328 | 2328 | $category_select_values[] = array( |
2329 | 2329 | 'text' => $term->name, |
2330 | 2330 | 'id' => $term->term_id, |
@@ -2338,28 +2338,28 @@ discard block |
||
2338 | 2338 | $template_args = array( |
2339 | 2339 | 'category' => $this->_category, |
2340 | 2340 | 'category_select' => $category_select, |
2341 | - 'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ), |
|
2341 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
2342 | 2342 | 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
2343 | 2343 | 'disable' => '', |
2344 | 2344 | 'disabled_message' => false, |
2345 | 2345 | ); |
2346 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2347 | - return EEH_Template::display_template( $template, $template_args, true ); |
|
2346 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2347 | + return EEH_Template::display_template($template, $template_args, true); |
|
2348 | 2348 | } |
2349 | 2349 | |
2350 | 2350 | |
2351 | 2351 | |
2352 | 2352 | protected function _delete_categories() { |
2353 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2353 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] |
|
2354 | 2354 | : (array) $this->_req_data['category_id']; |
2355 | - foreach ( $cat_ids as $cat_id ) { |
|
2356 | - $this->_delete_category( $cat_id ); |
|
2355 | + foreach ($cat_ids as $cat_id) { |
|
2356 | + $this->_delete_category($cat_id); |
|
2357 | 2357 | } |
2358 | 2358 | //doesn't matter what page we're coming from... we're going to the same place after delete. |
2359 | 2359 | $query_args = array( |
2360 | 2360 | 'action' => 'category_list', |
2361 | 2361 | ); |
2362 | - $this->_redirect_after_action( 0, '', '', $query_args ); |
|
2362 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2363 | 2363 | } |
2364 | 2364 | |
2365 | 2365 | |
@@ -2367,9 +2367,9 @@ discard block |
||
2367 | 2367 | /** |
2368 | 2368 | * @param $cat_id |
2369 | 2369 | */ |
2370 | - protected function _delete_category( $cat_id ) { |
|
2371 | - $cat_id = absint( $cat_id ); |
|
2372 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2370 | + protected function _delete_category($cat_id) { |
|
2371 | + $cat_id = absint($cat_id); |
|
2372 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2373 | 2373 | } |
2374 | 2374 | |
2375 | 2375 | |
@@ -2377,18 +2377,18 @@ discard block |
||
2377 | 2377 | /** |
2378 | 2378 | * @param $new_category |
2379 | 2379 | */ |
2380 | - protected function _insert_or_update_category( $new_category ) { |
|
2381 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true ); |
|
2380 | + protected function _insert_or_update_category($new_category) { |
|
2381 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
2382 | 2382 | $success = 0; //we already have a success message so lets not send another. |
2383 | - if ( $cat_id ) { |
|
2383 | + if ($cat_id) { |
|
2384 | 2384 | $query_args = array( |
2385 | 2385 | 'action' => 'edit_category', |
2386 | 2386 | 'EVT_CAT_ID' => $cat_id, |
2387 | 2387 | ); |
2388 | 2388 | } else { |
2389 | - $query_args = array( 'action' => 'add_category' ); |
|
2389 | + $query_args = array('action' => 'add_category'); |
|
2390 | 2390 | } |
2391 | - $this->_redirect_after_action( $success, '', '', $query_args, true ); |
|
2391 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
2392 | 2392 | } |
2393 | 2393 | |
2394 | 2394 | |
@@ -2397,14 +2397,14 @@ discard block |
||
2397 | 2397 | * @param bool $update |
2398 | 2398 | * @return bool|mixed|string |
2399 | 2399 | */ |
2400 | - private function _insert_category( $update = false ) { |
|
2400 | + private function _insert_category($update = false) { |
|
2401 | 2401 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2402 | - $category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2403 | - $category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2404 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2405 | - if ( empty( $category_name ) ) { |
|
2406 | - $msg = esc_html__( 'You must add a name for the category.', 'event_espresso' ); |
|
2407 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2402 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2403 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2404 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2405 | + if (empty($category_name)) { |
|
2406 | + $msg = esc_html__('You must add a name for the category.', 'event_espresso'); |
|
2407 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2408 | 2408 | return false; |
2409 | 2409 | } |
2410 | 2410 | $term_args = array( |
@@ -2413,22 +2413,22 @@ discard block |
||
2413 | 2413 | 'parent' => $category_parent, |
2414 | 2414 | ); |
2415 | 2415 | //was the category_identifier input disabled? |
2416 | - if ( isset( $this->_req_data['category_identifier'] ) ) { |
|
2416 | + if (isset($this->_req_data['category_identifier'])) { |
|
2417 | 2417 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2418 | 2418 | } |
2419 | 2419 | $insert_ids = $update |
2420 | - ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) |
|
2421 | - : wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2422 | - if ( ! is_array( $insert_ids ) ) { |
|
2420 | + ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) |
|
2421 | + : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2422 | + if ( ! is_array($insert_ids)) { |
|
2423 | 2423 | $msg = esc_html__( |
2424 | 2424 | 'An error occurred and the category has not been saved to the database.', |
2425 | 2425 | 'event_espresso' |
2426 | 2426 | ); |
2427 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2427 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2428 | 2428 | } else { |
2429 | 2429 | $cat_id = $insert_ids['term_id']; |
2430 | - $msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name ); |
|
2431 | - EE_Error::add_success( $msg ); |
|
2430 | + $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name); |
|
2431 | + EE_Error::add_success($msg); |
|
2432 | 2432 | } |
2433 | 2433 | return $cat_id; |
2434 | 2434 | } |
@@ -2441,28 +2441,28 @@ discard block |
||
2441 | 2441 | * @param bool $count |
2442 | 2442 | * @return \EE_Base_Class[]|int |
2443 | 2443 | */ |
2444 | - public function get_categories( $per_page = 10, $current_page = 1, $count = false ) { |
|
2444 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) { |
|
2445 | 2445 | //testing term stuff |
2446 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2447 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2448 | - $limit = ( $current_page - 1 ) * $per_page; |
|
2449 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2450 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2451 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2446 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2447 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2448 | + $limit = ($current_page - 1) * $per_page; |
|
2449 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2450 | + if (isset($this->_req_data['s'])) { |
|
2451 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2452 | 2452 | $where['OR'] = array( |
2453 | - 'Term.name' => array( 'LIKE', $sstr ), |
|
2454 | - 'description' => array( 'LIKE', $sstr ), |
|
2453 | + 'Term.name' => array('LIKE', $sstr), |
|
2454 | + 'description' => array('LIKE', $sstr), |
|
2455 | 2455 | ); |
2456 | 2456 | } |
2457 | 2457 | $query_params = array( |
2458 | 2458 | $where, |
2459 | - 'order_by' => array( $orderby => $order ), |
|
2460 | - 'limit' => $limit . ',' . $per_page, |
|
2461 | - 'force_join' => array( 'Term' ), |
|
2459 | + 'order_by' => array($orderby => $order), |
|
2460 | + 'limit' => $limit.','.$per_page, |
|
2461 | + 'force_join' => array('Term'), |
|
2462 | 2462 | ); |
2463 | 2463 | $categories = $count |
2464 | - ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) |
|
2465 | - : EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2464 | + ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
2465 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2466 | 2466 | return $categories; |
2467 | 2467 | } |
2468 | 2468 |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | * This just returns whatever is set as the _event object property |
1383 | 1383 | * //todo this will become obsolete once the models are in place |
1384 | 1384 | * |
1385 | - * @return object |
|
1385 | + * @return EE_Event |
|
1386 | 1386 | */ |
1387 | 1387 | public function get_event_object() { |
1388 | 1388 | return $this->_cpt_model_obj; |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | |
2306 | 2306 | |
2307 | 2307 | /** |
2308 | - * @return mixed |
|
2308 | + * @return string |
|
2309 | 2309 | */ |
2310 | 2310 | protected function _category_details_content() { |
2311 | 2311 | $editor_args['category_desc'] = array( |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function instance() { |
42 | 42 | // check if class object is instantiated |
43 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
43 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
44 | 44 | self::$_instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$_instance; |
@@ -57,30 +57,30 @@ discard block |
||
57 | 57 | // define global EE_Admin constants |
58 | 58 | $this->_define_all_constants(); |
59 | 59 | // set autoloaders for our admin page classes based on included path information |
60 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
60 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
61 | 61 | // admin hooks |
62 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
62 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
63 | 63 | // load EE_Request_Handler early |
64 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
65 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
64 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
65 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
66 | 66 | // post shortcode tracking |
67 | 67 | add_action( |
68 | 68 | 'AHEE__EE_System__initialize_last', |
69 | - array( 'EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin' ) |
|
69 | + array('EventEspresso\core\admin\PostShortcodeTracking', 'set_hooks_admin') |
|
70 | 70 | ); |
71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
79 | 79 | |
80 | 80 | //reset Environment config (we only do this on admin page loads); |
81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
82 | 82 | |
83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
83 | + do_action('AHEE__EE_Admin__loaded'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function _define_all_constants() { |
98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | * @param string $plugin |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function filter_plugin_actions( $links, $plugin ) { |
|
115 | + public function filter_plugin_actions($links, $plugin) { |
|
116 | 116 | // set $main_file in stone |
117 | 117 | static $main_file; |
118 | 118 | // if $main_file is not set yet |
119 | - if ( ! $main_file ) { |
|
120 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
119 | + if ( ! $main_file) { |
|
120 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
121 | 121 | } |
122 | - if ( $plugin === $main_file ) { |
|
122 | + if ($plugin === $main_file) { |
|
123 | 123 | // compare current plugin to this one |
124 | - if ( EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
125 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
126 | - array_unshift( $links, $maintenance_link ); |
|
124 | + if (EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
125 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
126 | + array_unshift($links, $maintenance_link); |
|
127 | 127 | } else { |
128 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
129 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
128 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
129 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
130 | 130 | // add before other links |
131 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
131 | + array_unshift($links, $org_settings_link, $events_link); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $links; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function get_request() { |
146 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
147 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
146 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
147 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @param array $admin_page_folder_names |
157 | 157 | * @return array |
158 | 158 | */ |
159 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
159 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
160 | 160 | return array( |
161 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
162 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
163 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
161 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
162 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
163 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | |
@@ -174,31 +174,31 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function init() { |
176 | 176 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
177 | - if ( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
177 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
178 | 178 | //ok so we want to enable the entire admin |
179 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
180 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
181 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
179 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
180 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
181 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
182 | 182 | //at a glance dashboard widget |
183 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items' ), 10 ); |
|
183 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
184 | 184 | //filter for get_edit_post_link used on comments for custom post types |
185 | - add_filter( 'get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 2 ); |
|
185 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 2); |
|
186 | 186 | } |
187 | 187 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
188 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
188 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
189 | 189 | try { |
190 | 190 | //this loads the controller for the admin pages which will setup routing etc |
191 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
192 | - } catch ( EE_Error $e ) { |
|
191 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
192 | + } catch (EE_Error $e) { |
|
193 | 193 | $e->get_error(); |
194 | 194 | } |
195 | 195 | } |
196 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
196 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
197 | 197 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
198 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
199 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
198 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
199 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
200 | 200 | //exclude EE critical pages from all nav menus and wp_list_pages |
201 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
201 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * @param object $post_type WP post type object |
212 | 212 | * @return object WP post type object |
213 | 213 | */ |
214 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
214 | + public function remove_pages_from_nav_menu($post_type) { |
|
215 | 215 | //if this isn't the "pages" post type let's get out |
216 | - if ( $post_type->name !== 'page' ) { |
|
216 | + if ($post_type->name !== 'page') { |
|
217 | 217 | return $post_type; |
218 | 218 | } |
219 | 219 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -233,28 +233,28 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function enable_hidden_ee_nav_menu_metaboxes() { |
235 | 235 | global $wp_meta_boxes, $pagenow; |
236 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
236 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | $user = wp_get_current_user(); |
240 | 240 | //has this been done yet? |
241 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
241 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
245 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
246 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
245 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
246 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
247 | 247 | |
248 | - if ( is_array( $hidden_meta_boxes ) ) { |
|
249 | - foreach ( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
250 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
251 | - unset( $hidden_meta_boxes[ $key ] ); |
|
248 | + if (is_array($hidden_meta_boxes)) { |
|
249 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
250 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
251 | + unset($hidden_meta_boxes[$key]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
257 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
256 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
257 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | public function register_custom_nav_menu_boxes() { |
276 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
276 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return string the (maybe) modified link |
291 | 291 | */ |
292 | - public function modify_edit_post_link( $link, $id ) { |
|
293 | - if ( ! $post = get_post( $id ) ){ |
|
292 | + public function modify_edit_post_link($link, $id) { |
|
293 | + if ( ! $post = get_post($id)) { |
|
294 | 294 | return $link; |
295 | 295 | } |
296 | - if ( $post->post_type === 'espresso_attendees' ) { |
|
296 | + if ($post->post_type === 'espresso_attendees') { |
|
297 | 297 | $query_args = array( |
298 | 298 | 'action' => 'edit_attendee', |
299 | 299 | 'post' => $id |
300 | 300 | ); |
301 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
301 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
302 | 302 | } |
303 | 303 | return $link; |
304 | 304 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | global $nav_menu_selected_id; |
311 | 311 | |
312 | 312 | $db_fields = false; |
313 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
313 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
314 | 314 | $current_tab = 'event-archives'; |
315 | 315 | |
316 | 316 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
331 | 331 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
332 | - <li <?php echo ( 'event-archives' === $current_tab ? ' class="tabs"' : '' ); ?>> |
|
333 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));} ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
332 | + <li <?php echo ('event-archives' === $current_tab ? ' class="tabs"' : ''); ?>> |
|
333 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) {echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); } ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
334 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
335 | 335 | </a> |
336 | 336 | </li> |
337 | 337 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | <?php */ ?> |
350 | 350 | |
351 | 351 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
352 | - echo ( 'event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
352 | + echo ('event-archives' === $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
353 | 353 | ?>"> |
354 | 354 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
355 | 355 | <?php |
356 | 356 | $pages = $this->_get_extra_nav_menu_pages_items(); |
357 | 357 | $args['walker'] = $walker; |
358 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
358 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
359 | 359 | ?> |
360 | 360 | </ul> |
361 | 361 | </div><!-- /.tabs-panel --> |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | <p class="button-controls"> |
364 | 364 | <span class="list-controls"> |
365 | 365 | <a href="<?php |
366 | - echo esc_url( add_query_arg( |
|
366 | + echo esc_url(add_query_arg( |
|
367 | 367 | array( |
368 | 368 | 'extra-nav-menu-pages-tab' => 'event-archives', |
369 | 369 | 'selectall' => 1, |
370 | 370 | ), |
371 | - remove_query_arg( $removed_args ) |
|
371 | + remove_query_arg($removed_args) |
|
372 | 372 | )); |
373 | 373 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
374 | 374 | </span> |
375 | 375 | |
376 | 376 | <span class="add-to-menu"> |
377 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
377 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
378 | 378 | <span class="spinner"></span> |
379 | 379 | </span> |
380 | 380 | </p> |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | private function _get_extra_nav_menu_pages_items() { |
396 | 396 | $menuitems[] = array( |
397 | 397 | 'title' => __('Event List', 'event_espresso'), |
398 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
398 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
399 | 399 | 'description' => __('Archive page for all events.', 'event_espresso') |
400 | 400 | ); |
401 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
401 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param $menu_item_values |
411 | 411 | * @return stdClass |
412 | 412 | */ |
413 | - private function _setup_extra_nav_menu_pages_items( $menu_item_values ) { |
|
413 | + private function _setup_extra_nav_menu_pages_items($menu_item_values) { |
|
414 | 414 | $menu_item = new stdClass(); |
415 | 415 | $keys = array( |
416 | 416 | 'ID' => 0, |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'xfn' => '' |
431 | 431 | ); |
432 | 432 | |
433 | - foreach ( $keys as $key => $value) { |
|
434 | - $menu_item->{$key} = isset( $menu_item_values[ $key]) ? $menu_item_values[ $key] : $value; |
|
433 | + foreach ($keys as $key => $value) { |
|
434 | + $menu_item->{$key} = isset($menu_item_values[$key]) ? $menu_item_values[$key] : $value; |
|
435 | 435 | } |
436 | 436 | return $menu_item; |
437 | 437 | } |
@@ -470,9 +470,9 @@ discard block |
||
470 | 470 | * - check if doing post processing of one of EE CPTs |
471 | 471 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
472 | 472 | */ |
473 | - if ( isset( $_POST['action'], $_POST['post_type'] ) && $_POST['action'] === 'editpost' ) { |
|
474 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
475 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
473 | + if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') { |
|
474 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
475 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
482 | 482 | */ |
483 | 483 | global $pagenow; |
484 | - if ( $pagenow === 'options-reading.php' ) { |
|
485 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
484 | + if ($pagenow === 'options-reading.php') { |
|
485 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -494,25 +494,25 @@ discard block |
||
494 | 494 | * @param string $output Current output. |
495 | 495 | * @return string |
496 | 496 | */ |
497 | - public function modify_dropdown_pages( $output ) { |
|
497 | + public function modify_dropdown_pages($output) { |
|
498 | 498 | //get critical pages |
499 | 499 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
500 | 500 | |
501 | 501 | //split current output by line break for easier parsing. |
502 | - $split_output = explode( "\n", $output ); |
|
502 | + $split_output = explode("\n", $output); |
|
503 | 503 | |
504 | 504 | //loop through to remove any critical pages from the array. |
505 | - foreach ( $critical_pages as $page_id ) { |
|
506 | - $needle = 'value="' . $page_id . '"'; |
|
507 | - foreach( $split_output as $key => $haystack ) { |
|
508 | - if( strpos( $haystack, $needle ) !== false ) { |
|
509 | - unset( $split_output[$key] ); |
|
505 | + foreach ($critical_pages as $page_id) { |
|
506 | + $needle = 'value="'.$page_id.'"'; |
|
507 | + foreach ($split_output as $key => $haystack) { |
|
508 | + if (strpos($haystack, $needle) !== false) { |
|
509 | + unset($split_output[$key]); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | //replace output with the new contents |
515 | - return implode( "\n", $split_output ); |
|
515 | + return implode("\n", $split_output); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -526,36 +526,36 @@ discard block |
||
526 | 526 | public function enqueue_admin_scripts() { |
527 | 527 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
528 | 528 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
529 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
529 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
530 | 530 | // register cookie script for future dependencies |
531 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
531 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
532 | 532 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
533 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
533 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
534 | 534 | // register jQuery Validate |
535 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
535 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
536 | 536 | } |
537 | 537 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
538 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
538 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
539 | 539 | //joyride style |
540 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
542 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
540 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
541 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
542 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
543 | 543 | //joyride JS |
544 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
544 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
545 | 545 | // wanna go for a joyride? |
546 | 546 | wp_enqueue_style('ee-joyride-css'); |
547 | 547 | wp_enqueue_script('jquery-joyride'); |
548 | 548 | } |
549 | 549 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
550 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
550 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
551 | 551 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
552 | 552 | } |
553 | 553 | //accounting.js library |
554 | 554 | // @link http://josscrowcroft.github.io/accounting.js/ |
555 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
556 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
557 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
558 | - wp_enqueue_script( 'ee-accounting' ); |
|
555 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
556 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
557 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
558 | + wp_enqueue_script('ee-accounting'); |
|
559 | 559 | // array of settings to get converted to JSON array via wp_localize_script |
560 | 560 | $currency_config = array( |
561 | 561 | 'currency' => array( |
@@ -602,11 +602,11 @@ discard block |
||
602 | 602 | public function get_persistent_admin_notices() { |
603 | 603 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
604 | 604 | $args = array( |
605 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
606 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
605 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
606 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
607 | 607 | ); |
608 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
609 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
608 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
609 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | |
@@ -627,26 +627,26 @@ discard block |
||
627 | 627 | * @param $elements |
628 | 628 | * @return array |
629 | 629 | */ |
630 | - public function dashboard_glance_items( $elements ) { |
|
630 | + public function dashboard_glance_items($elements) { |
|
631 | 631 | $events = EEM_Event::instance()->count(); |
632 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
633 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
632 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
633 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
634 | 634 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
635 | 635 | $registrations = EEM_Registration::instance()->count( |
636 | 636 | array( |
637 | 637 | array( |
638 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
638 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
642 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
643 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
642 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
643 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
644 | 644 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
645 | 645 | |
646 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
646 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
647 | 647 | |
648 | - foreach ( $items as $type => $item_properties ) { |
|
649 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
648 | + foreach ($items as $type => $item_properties) { |
|
649 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
650 | 650 | } |
651 | 651 | return $elements; |
652 | 652 | } |
@@ -663,31 +663,31 @@ discard block |
||
663 | 663 | * @throws EE_Error |
664 | 664 | * @return string |
665 | 665 | */ |
666 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
666 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
667 | 667 | // check for date_format or time_format |
668 | - switch ( $option ) { |
|
668 | + switch ($option) { |
|
669 | 669 | case 'date_format' : |
670 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
670 | + $date_time_format = $value.' '.get_option('time_format'); |
|
671 | 671 | break; |
672 | 672 | case 'time_format' : |
673 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
673 | + $date_time_format = get_option('date_format').' '.$value; |
|
674 | 674 | break; |
675 | 675 | default : |
676 | 676 | $date_time_format = FALSE; |
677 | 677 | } |
678 | 678 | // do we have a date_time format to check ? |
679 | - if ( $date_time_format ) { |
|
680 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
679 | + if ($date_time_format) { |
|
680 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
681 | 681 | |
682 | - if ( is_array( $error_msg ) ) { |
|
683 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
682 | + if (is_array($error_msg)) { |
|
683 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
684 | 684 | |
685 | 685 | |
686 | - foreach ( $error_msg as $error ) { |
|
687 | - $msg .= '<li>' . $error . '</li>'; |
|
686 | + foreach ($error_msg as $error) { |
|
687 | + $msg .= '<li>'.$error.'</li>'; |
|
688 | 688 | } |
689 | 689 | |
690 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
690 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
691 | 691 | |
692 | 692 | // trigger WP settings error |
693 | 693 | add_settings_error( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ); |
698 | 698 | |
699 | 699 | // set format to something valid |
700 | - switch ( $option ) { |
|
700 | + switch ($option) { |
|
701 | 701 | case 'date_format' : |
702 | 702 | $value = 'F j, Y'; |
703 | 703 | break; |
@@ -719,8 +719,8 @@ discard block |
||
719 | 719 | * @param $content |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function its_eSpresso( $content ) { |
|
723 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
722 | + public function its_eSpresso($content) { |
|
723 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @return string |
733 | 733 | */ |
734 | 734 | public function espresso_admin_footer() { |
735 | - return \EEH_Template::powered_by_event_espresso( 'aln-cntr' ); |
|
735 | + return \EEH_Template::powered_by_event_espresso('aln-cntr'); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | * @param array $config |
752 | 752 | * @return void |
753 | 753 | */ |
754 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
755 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
756 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
754 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
755 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
756 | + if (class_exists('EE_Register_Admin_Page')) { |
|
757 | 757 | $config['page_path'] = $page_path; |
758 | 758 | } |
759 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
759 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param \WP_Post $post |
770 | 770 | * @return void |
771 | 771 | */ |
772 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
772 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
773 | 773 | EE_Error::doing_it_wrong( |
774 | 774 | __METHOD__, |
775 | 775 | __( |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | ), |
779 | 779 | '4.8.41' |
780 | 780 | ); |
781 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save( $post_ID, $post ); |
|
781 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($post_ID, $post); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @param $value |
792 | 792 | * @return void |
793 | 793 | */ |
794 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
794 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
795 | 795 | EE_Error::doing_it_wrong( |
796 | 796 | __METHOD__, |
797 | 797 | __( |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ), |
801 | 801 | '4.8.41' |
802 | 802 | ); |
803 | - EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change( $option, $old_value, $value ); |
|
803 | + EventEspresso\core\admin\PostShortcodeTracking::reset_page_for_posts_on_change($option, $old_value, $value); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param EE_Registration[] $registrations |
52 | 52 | */ |
53 | - public function __construct( $registrations ) { |
|
53 | + public function __construct($registrations) { |
|
54 | 54 | $this->_registrations = $registrations; |
55 | - $this->_calculate_registrations_per_line_item_code( $registrations ); |
|
55 | + $this->_calculate_registrations_per_line_item_code($registrations); |
|
56 | 56 | // these reg statuses should NOT increment the line item quantity |
57 | 57 | $this->_closed_reg_statuses = EEM_Registration::closed_reg_statuses(); |
58 | 58 | } |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | * @param EE_Registration[] $registrations |
66 | 66 | * @return void |
67 | 67 | */ |
68 | - protected function _calculate_registrations_per_line_item_code( $registrations ) { |
|
69 | - foreach ( $registrations as $registration ) { |
|
68 | + protected function _calculate_registrations_per_line_item_code($registrations) { |
|
69 | + foreach ($registrations as $registration) { |
|
70 | 70 | $line_item_code = EEM_Line_Item::instance()->get_var( |
71 | 71 | EEM_Line_Item::instance()->line_item_for_registration_query_params( |
72 | 72 | $registration, |
73 | - array( 'limit' => 1 ) |
|
73 | + array('limit' => 1) |
|
74 | 74 | ), |
75 | 75 | 'LIN_code' |
76 | 76 | ); |
77 | - if ( $line_item_code ) { |
|
78 | - if ( ! isset( $this->_line_item_registrations[ $line_item_code ] ) ) { |
|
79 | - $this->_line_item_registrations[ $line_item_code ] = array(); |
|
77 | + if ($line_item_code) { |
|
78 | + if ( ! isset($this->_line_item_registrations[$line_item_code])) { |
|
79 | + $this->_line_item_registrations[$line_item_code] = array(); |
|
80 | 80 | } |
81 | - $this->_line_item_registrations[ $line_item_code ][ $registration->ID() ] = $registration; |
|
81 | + $this->_line_item_registrations[$line_item_code][$registration->ID()] = $registration; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * @param EEI_Line_Item $line_item |
93 | 93 | * @return \EEI_Line_Item |
94 | 94 | */ |
95 | - public function process( EEI_Line_Item $line_item ) { |
|
96 | - $this->_adjust_line_item_quantity( $line_item ); |
|
97 | - if ( ! $line_item->children() ) { |
|
95 | + public function process(EEI_Line_Item $line_item) { |
|
96 | + $this->_adjust_line_item_quantity($line_item); |
|
97 | + if ( ! $line_item->children()) { |
|
98 | 98 | return $line_item; |
99 | 99 | } |
100 | 100 | //the original running total (taking ALL tickets into account) |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $running_total_of_children_under_consideration = 0; |
104 | 104 | // let's also track the quantity of tickets that pertain to the registrations |
105 | 105 | $total_child_ticket_quantity = 0; |
106 | - foreach ( $line_item->children() as $child_line_item ) { |
|
106 | + foreach ($line_item->children() as $child_line_item) { |
|
107 | 107 | $original_li_total = $child_line_item->is_percent() |
108 | 108 | ? $running_total_of_children * $child_line_item->percent() / 100 |
109 | 109 | : $child_line_item->unit_price() * $child_line_item->quantity(); |
110 | - $this->process( $child_line_item ); |
|
110 | + $this->process($child_line_item); |
|
111 | 111 | // If this line item is a normal line item that isn't for a ticket, |
112 | 112 | // we want to modify its total (and unit price if not a percentage line item) |
113 | 113 | // so it reflects only that portion of the surcharge/discount shared by these registrations |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $child_line_item->set_total( |
122 | 122 | $running_total_of_children_under_consideration * $percent_of_running_total |
123 | 123 | ); |
124 | - if ( ! $child_line_item->is_percent() ) { |
|
125 | - $child_line_item->set_unit_price( $child_line_item->total() / $child_line_item->quantity() ); |
|
124 | + if ( ! $child_line_item->is_percent()) { |
|
125 | + $child_line_item->set_unit_price($child_line_item->total() / $child_line_item->quantity()); |
|
126 | 126 | } |
127 | 127 | } else if ( |
128 | 128 | $line_item->type() === EEM_Line_Item::type_line_item |
@@ -139,28 +139,28 @@ discard block |
||
139 | 139 | // unless it IS a cancellation and the current registration is cancelled |
140 | 140 | $child_line_item->is_cancelled() |
141 | 141 | && $this->_current_registration instanceof EE_Registration |
142 | - && in_array( $this->_current_registration->status_ID(), $this->_closed_reg_statuses ) |
|
142 | + && in_array($this->_current_registration->status_ID(), $this->_closed_reg_statuses) |
|
143 | 143 | ) |
144 | 144 | ) |
145 | 145 | ) { |
146 | - $child_line_item->set_quantity( $line_item->quantity() ); |
|
147 | - $child_line_item->set_total( $child_line_item->unit_price() * $child_line_item->quantity() ); |
|
146 | + $child_line_item->set_quantity($line_item->quantity()); |
|
147 | + $child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity()); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | $running_total_of_children += $original_li_total; |
151 | 151 | $running_total_of_children_under_consideration += $child_line_item->total(); |
152 | - if ( $child_line_item->OBJ_type() == 'Ticket' ) { |
|
152 | + if ($child_line_item->OBJ_type() == 'Ticket') { |
|
153 | 153 | $total_child_ticket_quantity += $child_line_item->quantity(); |
154 | 154 | } |
155 | 155 | } |
156 | - $line_item->set_total( $running_total_of_children_under_consideration ); |
|
157 | - if ( $line_item->quantity() ) { |
|
158 | - $line_item->set_unit_price( $running_total_of_children_under_consideration / $line_item->quantity() ); |
|
156 | + $line_item->set_total($running_total_of_children_under_consideration); |
|
157 | + if ($line_item->quantity()) { |
|
158 | + $line_item->set_unit_price($running_total_of_children_under_consideration / $line_item->quantity()); |
|
159 | 159 | } else { |
160 | - $line_item->set_unit_price( 0 ); |
|
160 | + $line_item->set_unit_price(0); |
|
161 | 161 | } |
162 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
163 | - $line_item->set_quantity( $total_child_ticket_quantity ); |
|
162 | + if ($line_item->OBJ_type() == 'Event') { |
|
163 | + $line_item->set_quantity($total_child_ticket_quantity); |
|
164 | 164 | } |
165 | 165 | return $line_item; |
166 | 166 | } |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | * @param EEI_Line_Item $line_item |
175 | 175 | * @return EEI_Line_Item |
176 | 176 | */ |
177 | - protected function _adjust_line_item_quantity( EEI_Line_Item $line_item ) { |
|
177 | + protected function _adjust_line_item_quantity(EEI_Line_Item $line_item) { |
|
178 | 178 | // is this a ticket ? |
179 | - if ( $line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket' ) { |
|
179 | + if ($line_item->type() === EEM_Line_Item::type_line_item && $line_item->OBJ_type() == 'Ticket') { |
|
180 | 180 | $this->_current_registration = null; |
181 | 181 | $quantity = 0; |
182 | 182 | // if this ticket is billable at this moment, then we should have a positive quantity |
183 | 183 | if ( |
184 | - isset( $this->_line_item_registrations[ $line_item->code() ] ) |
|
185 | - && is_array( $this->_line_item_registrations[ $line_item->code() ] ) |
|
184 | + isset($this->_line_item_registrations[$line_item->code()]) |
|
185 | + && is_array($this->_line_item_registrations[$line_item->code()]) |
|
186 | 186 | ) { |
187 | 187 | // set quantity based on number of open registrations for this ticket |
188 | - foreach ( $this->_line_item_registrations[ $line_item->code() ] as $registration ) { |
|
188 | + foreach ($this->_line_item_registrations[$line_item->code()] as $registration) { |
|
189 | 189 | if ( |
190 | 190 | $registration instanceof EE_Registration |
191 | 191 | ) { |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | } |
196 | 196 | } |
197 | - $line_item->set_quantity( $quantity ); |
|
198 | - $line_item->set_total( $line_item->unit_price() * $line_item->quantity() ); |
|
197 | + $line_item->set_quantity($quantity); |
|
198 | + $line_item->set_total($line_item->unit_price() * $line_item->quantity()); |
|
199 | 199 | } |
200 | 200 | return $line_item; |
201 | 201 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * date_format and the second value is the time format |
51 | 51 | * @return EE_Line_Item |
52 | 52 | */ |
53 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
54 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
55 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
53 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
54 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
55 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * the website will be used. |
64 | 64 | * @return EE_Line_Item |
65 | 65 | */ |
66 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
67 | - return new self( $props_n_values, TRUE, $timezone ); |
|
66 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
67 | + return new self($props_n_values, TRUE, $timezone); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * @param bool $bydb |
76 | 76 | * @param string $timezone |
77 | 77 | */ |
78 | - protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) { |
|
79 | - parent::__construct( $fieldValues, $bydb, $timezone ); |
|
80 | - if ( ! $this->get( 'LIN_code' ) ) { |
|
81 | - $this->set_code( $this->generate_code() ); |
|
78 | + protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') { |
|
79 | + parent::__construct($fieldValues, $bydb, $timezone); |
|
80 | + if ( ! $this->get('LIN_code')) { |
|
81 | + $this->set_code($this->generate_code()); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return int |
90 | 90 | */ |
91 | 91 | public function ID() { |
92 | - return $this->get( 'LIN_ID' ); |
|
92 | + return $this->get('LIN_ID'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int |
100 | 100 | */ |
101 | 101 | public function TXN_ID() { |
102 | - return $this->get( 'TXN_ID' ); |
|
102 | + return $this->get('TXN_ID'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * Sets TXN_ID |
109 | 109 | * @param int $TXN_ID |
110 | 110 | */ |
111 | - public function set_TXN_ID( $TXN_ID ) { |
|
112 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
111 | + public function set_TXN_ID($TXN_ID) { |
|
112 | + $this->set('TXN_ID', $TXN_ID); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | public function name() { |
122 | - $name = $this->get( 'LIN_name' ); |
|
123 | - if( ! $name ){ |
|
124 | - $name = ucwords( str_replace( '-', ' ', $this->type() ) ); |
|
122 | + $name = $this->get('LIN_name'); |
|
123 | + if ( ! $name) { |
|
124 | + $name = ucwords(str_replace('-', ' ', $this->type())); |
|
125 | 125 | } |
126 | 126 | return $name; |
127 | 127 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * Sets name |
133 | 133 | * @param string $name |
134 | 134 | */ |
135 | - public function set_name( $name ) { |
|
136 | - $this->set( 'LIN_name', $name ); |
|
135 | + public function set_name($name) { |
|
136 | + $this->set('LIN_name', $name); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return string |
144 | 144 | */ |
145 | 145 | public function desc() { |
146 | - return $this->get( 'LIN_desc' ); |
|
146 | + return $this->get('LIN_desc'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * Sets desc |
153 | 153 | * @param string $desc |
154 | 154 | */ |
155 | - public function set_desc( $desc ) { |
|
156 | - $this->set( 'LIN_desc', $desc ); |
|
155 | + public function set_desc($desc) { |
|
156 | + $this->set('LIN_desc', $desc); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @return int |
164 | 164 | */ |
165 | 165 | public function quantity() { |
166 | - return $this->get( 'LIN_quantity' ); |
|
166 | + return $this->get('LIN_quantity'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * Sets quantity |
173 | 173 | * @param int $quantity |
174 | 174 | */ |
175 | - function set_quantity( $quantity ) { |
|
176 | - $this->set( 'LIN_quantity', max( $quantity, 0 ) ); |
|
175 | + function set_quantity($quantity) { |
|
176 | + $this->set('LIN_quantity', max($quantity, 0)); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return string |
184 | 184 | */ |
185 | 185 | public function OBJ_ID() { |
186 | - return $this->get( 'OBJ_ID' ); |
|
186 | + return $this->get('OBJ_ID'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * Sets item_id |
193 | 193 | * @param string $item_id |
194 | 194 | */ |
195 | - public function set_OBJ_ID( $item_id ) { |
|
196 | - $this->set( 'OBJ_ID', $item_id ); |
|
195 | + public function set_OBJ_ID($item_id) { |
|
196 | + $this->set('OBJ_ID', $item_id); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string |
204 | 204 | */ |
205 | 205 | public function OBJ_type() { |
206 | - return $this->get( 'OBJ_type' ); |
|
206 | + return $this->get('OBJ_type'); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * Sets item_type |
241 | 241 | * @param string $OBJ_type |
242 | 242 | */ |
243 | - public function set_OBJ_type( $OBJ_type ) { |
|
244 | - $this->set( 'OBJ_type', $OBJ_type ); |
|
243 | + public function set_OBJ_type($OBJ_type) { |
|
244 | + $this->set('OBJ_type', $OBJ_type); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return float |
252 | 252 | */ |
253 | 253 | public function unit_price() { |
254 | - return $this->get( 'LIN_unit_price' ); |
|
254 | + return $this->get('LIN_unit_price'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @param float $unit_price |
263 | 263 | */ |
264 | - public function set_unit_price( $unit_price ) { |
|
265 | - $this->set( 'LIN_unit_price', $unit_price ); |
|
264 | + public function set_unit_price($unit_price) { |
|
265 | + $this->set('LIN_unit_price', $unit_price); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -273,19 +273,19 @@ discard block |
||
273 | 273 | * @return boolean |
274 | 274 | */ |
275 | 275 | public function is_percent() { |
276 | - if( $this->is_tax_sub_total() ) { |
|
276 | + if ($this->is_tax_sub_total()) { |
|
277 | 277 | //tax subtotals HAVE a percent on them, that percentage only applies |
278 | 278 | //to taxable items, so its' an exception. Treat it like a flat line item |
279 | 279 | return false; |
280 | 280 | } |
281 | - $unit_price = abs( $this->get( 'LIN_unit_price' ) ); |
|
282 | - $percent = abs( $this->get( 'LIN_percent' ) ); |
|
283 | - if ( $unit_price < .001 && $percent ) { |
|
281 | + $unit_price = abs($this->get('LIN_unit_price')); |
|
282 | + $percent = abs($this->get('LIN_percent')); |
|
283 | + if ($unit_price < .001 && $percent) { |
|
284 | 284 | return TRUE; |
285 | - } elseif ( $unit_price >= .001 && !$percent ) { |
|
285 | + } elseif ($unit_price >= .001 && ! $percent) { |
|
286 | 286 | return FALSE; |
287 | - } elseif ( $unit_price >= .001 && $percent ) { |
|
288 | - throw new EE_Error( sprintf( __( "A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso" ), $unit_price, $percent ) ); |
|
287 | + } elseif ($unit_price >= .001 && $percent) { |
|
288 | + throw new EE_Error(sprintf(__("A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso"), $unit_price, $percent)); |
|
289 | 289 | } else { |
290 | 290 | // if they're both 0, assume its not a percent item |
291 | 291 | return FALSE; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return float |
300 | 300 | */ |
301 | 301 | public function percent() { |
302 | - return $this->get( 'LIN_percent' ); |
|
302 | + return $this->get('LIN_percent'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | * Sets percent (between 100-0.01) |
309 | 309 | * @param float $percent |
310 | 310 | */ |
311 | - public function set_percent( $percent ) { |
|
312 | - $this->set( 'LIN_percent', $percent ); |
|
311 | + public function set_percent($percent) { |
|
312 | + $this->set('LIN_percent', $percent); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return float |
320 | 320 | */ |
321 | 321 | public function total() { |
322 | - return $this->get( 'LIN_total' ); |
|
322 | + return $this->get('LIN_total'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * Sets total |
329 | 329 | * @param float $total |
330 | 330 | */ |
331 | - public function set_total( $total ) { |
|
332 | - $this->set( 'LIN_total', $total ); |
|
331 | + public function set_total($total) { |
|
332 | + $this->set('LIN_total', $total); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @return int |
340 | 340 | */ |
341 | 341 | public function order() { |
342 | - return $this->get( 'LIN_order' ); |
|
342 | + return $this->get('LIN_order'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | * Sets order |
349 | 349 | * @param int $order |
350 | 350 | */ |
351 | - public function set_order( $order ) { |
|
352 | - $this->set( 'LIN_order', $order ); |
|
351 | + public function set_order($order) { |
|
352 | + $this->set('LIN_order', $order); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @return int |
360 | 360 | */ |
361 | 361 | public function parent_ID() { |
362 | - return $this->get( 'LIN_parent' ); |
|
362 | + return $this->get('LIN_parent'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | * Sets parent |
369 | 369 | * @param int $parent |
370 | 370 | */ |
371 | - public function set_parent_ID( $parent ) { |
|
372 | - $this->set( 'LIN_parent', $parent ); |
|
371 | + public function set_parent_ID($parent) { |
|
372 | + $this->set('LIN_parent', $parent); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @return string |
380 | 380 | */ |
381 | 381 | public function type() { |
382 | - return $this->get( 'LIN_type' ); |
|
382 | + return $this->get('LIN_type'); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | * Sets type |
389 | 389 | * @param string $type |
390 | 390 | */ |
391 | - public function set_type( $type ) { |
|
392 | - $this->set( 'LIN_type', $type ); |
|
391 | + public function set_type($type) { |
|
392 | + $this->set('LIN_type', $type); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -402,8 +402,8 @@ discard block |
||
402 | 402 | * @return EE_Line_Item |
403 | 403 | */ |
404 | 404 | public function parent() { |
405 | - if( $this->ID() ) { |
|
406 | - return $this->get_model()->get_one_by_ID( $this->parent_ID() ); |
|
405 | + if ($this->ID()) { |
|
406 | + return $this->get_model()->get_one_by_ID($this->parent_ID()); |
|
407 | 407 | } else { |
408 | 408 | return $this->_parent; |
409 | 409 | } |
@@ -416,13 +416,13 @@ discard block |
||
416 | 416 | * @return EE_Line_Item[] |
417 | 417 | */ |
418 | 418 | public function children() { |
419 | - if ( $this->ID() ) { |
|
419 | + if ($this->ID()) { |
|
420 | 420 | return $this->get_model()->get_all( |
421 | 421 | array( |
422 | - array( 'LIN_parent' => $this->ID() ), |
|
423 | - 'order_by' => array( 'LIN_order' => 'ASC' ) ) ); |
|
422 | + array('LIN_parent' => $this->ID()), |
|
423 | + 'order_by' => array('LIN_order' => 'ASC') ) ); |
|
424 | 424 | } else { |
425 | - if ( ! is_array( $this->_children ) ) { |
|
425 | + if ( ! is_array($this->_children)) { |
|
426 | 426 | $this->_children = array(); |
427 | 427 | } |
428 | 428 | return $this->_children; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * @return string |
437 | 437 | */ |
438 | 438 | public function code() { |
439 | - return $this->get( 'LIN_code' ); |
|
439 | + return $this->get('LIN_code'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | * Sets code |
446 | 446 | * @param string $code |
447 | 447 | */ |
448 | - public function set_code( $code ) { |
|
449 | - $this->set( 'LIN_code', $code ); |
|
448 | + public function set_code($code) { |
|
449 | + $this->set('LIN_code', $code); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @return boolean |
457 | 457 | */ |
458 | 458 | public function is_taxable() { |
459 | - return $this->get( 'LIN_is_taxable' ); |
|
459 | + return $this->get('LIN_is_taxable'); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * Sets is_taxable |
466 | 466 | * @param boolean $is_taxable |
467 | 467 | */ |
468 | - public function set_is_taxable( $is_taxable ) { |
|
469 | - $this->set( 'LIN_is_taxable', $is_taxable ); |
|
468 | + public function set_is_taxable($is_taxable) { |
|
469 | + $this->set('LIN_is_taxable', $is_taxable); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | */ |
482 | 482 | public function get_object() { |
483 | 483 | $model_name_of_related_obj = $this->OBJ_type(); |
484 | - return $this->get_model()->has_relation( $model_name_of_related_obj ) ? $this->get_first_related( $model_name_of_related_obj ) : NULL; |
|
484 | + return $this->get_model()->has_relation($model_name_of_related_obj) ? $this->get_first_related($model_name_of_related_obj) : NULL; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | * @param array $query_params |
493 | 493 | * @return EE_Ticket |
494 | 494 | */ |
495 | - public function ticket( $query_params = array() ) { |
|
495 | + public function ticket($query_params = array()) { |
|
496 | 496 | //we're going to assume that when this method is called we always want to receive the attached ticket EVEN if that ticket is archived. This can be overridden via the incoming $query_params argument |
497 | - $remove_defaults = array( 'default_where_conditions' => 'none' ); |
|
498 | - $query_params = array_merge( $remove_defaults, $query_params ); |
|
499 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
497 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
498 | + $query_params = array_merge($remove_defaults, $query_params); |
|
499 | + return $this->get_first_related('Ticket', $query_params); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | * @return EE_Datetime | NULL |
507 | 507 | */ |
508 | 508 | public function get_ticket_datetime() { |
509 | - if ( $this->OBJ_type() === 'Ticket' ) { |
|
509 | + if ($this->OBJ_type() === 'Ticket') { |
|
510 | 510 | $ticket = $this->ticket(); |
511 | - if ( $ticket instanceof EE_Ticket ) { |
|
511 | + if ($ticket instanceof EE_Ticket) { |
|
512 | 512 | $datetime = $ticket->first_datetime(); |
513 | - if ( $datetime instanceof EE_Datetime ) { |
|
513 | + if ($datetime instanceof EE_Datetime) { |
|
514 | 514 | return $datetime; |
515 | 515 | } |
516 | 516 | } |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | * @return string |
527 | 527 | */ |
528 | 528 | public function ticket_event_name() { |
529 | - $event_name = __( "Unknown", "event_espresso" ); |
|
529 | + $event_name = __("Unknown", "event_espresso"); |
|
530 | 530 | $event = $this->ticket_event(); |
531 | - if ( $event instanceof EE_Event ) { |
|
531 | + if ($event instanceof EE_Event) { |
|
532 | 532 | $event_name = $event->name(); |
533 | 533 | } |
534 | 534 | return $event_name; |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | public function ticket_event() { |
543 | 543 | $event = null; |
544 | 544 | $ticket = $this->ticket(); |
545 | - if ( $ticket instanceof EE_Ticket ) { |
|
545 | + if ($ticket instanceof EE_Ticket) { |
|
546 | 546 | $datetime = $ticket->first_datetime(); |
547 | - if ( $datetime instanceof EE_Datetime ) { |
|
547 | + if ($datetime instanceof EE_Datetime) { |
|
548 | 548 | $event = $datetime->event(); |
549 | 549 | } |
550 | 550 | } |
@@ -559,11 +559,11 @@ discard block |
||
559 | 559 | * @param string $time_format |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - public function ticket_datetime_start( $date_format = '', $time_format = '' ) { |
|
563 | - $first_datetime_string = __( "Unknown", "event_espresso" ); |
|
562 | + public function ticket_datetime_start($date_format = '', $time_format = '') { |
|
563 | + $first_datetime_string = __("Unknown", "event_espresso"); |
|
564 | 564 | $datetime = $this->get_ticket_datetime(); |
565 | - if ( $datetime ) { |
|
566 | - $first_datetime_string = $datetime->start_date_and_time( $date_format, $time_format ); |
|
565 | + if ($datetime) { |
|
566 | + $first_datetime_string = $datetime->start_date_and_time($date_format, $time_format); |
|
567 | 567 | } |
568 | 568 | return $first_datetime_string; |
569 | 569 | } |
@@ -578,26 +578,26 @@ discard block |
||
578 | 578 | * @return bool success |
579 | 579 | * @throws \EE_Error |
580 | 580 | */ |
581 | - public function add_child_line_item( EEI_Line_Item $line_item, $set_order = true ) { |
|
581 | + public function add_child_line_item(EEI_Line_Item $line_item, $set_order = true) { |
|
582 | 582 | // should we calculate the LIN_order for this line item ? |
583 | - if ( $set_order || $line_item->order() === null ) { |
|
584 | - $line_item->set_order( count( $this->children() ) ); |
|
583 | + if ($set_order || $line_item->order() === null) { |
|
584 | + $line_item->set_order(count($this->children())); |
|
585 | 585 | } |
586 | - if ( $this->ID() ) { |
|
586 | + if ($this->ID()) { |
|
587 | 587 | //check for any duplicate line items (with the same code), if so, this replaces it |
588 | - $line_item_with_same_code = $this->get_child_line_item( $line_item->code() ); |
|
589 | - if( $line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item ) { |
|
590 | - $this->delete_child_line_item( $line_item_with_same_code->code() ); |
|
588 | + $line_item_with_same_code = $this->get_child_line_item($line_item->code()); |
|
589 | + if ($line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item) { |
|
590 | + $this->delete_child_line_item($line_item_with_same_code->code()); |
|
591 | 591 | } |
592 | - $line_item->set_parent_ID( $this->ID() ); |
|
593 | - if( $this->TXN_ID() ){ |
|
594 | - $line_item->set_TXN_ID( $this->TXN_ID() ); |
|
592 | + $line_item->set_parent_ID($this->ID()); |
|
593 | + if ($this->TXN_ID()) { |
|
594 | + $line_item->set_TXN_ID($this->TXN_ID()); |
|
595 | 595 | } |
596 | 596 | return $line_item->save(); |
597 | 597 | } else { |
598 | - $this->_children[ $line_item->code() ] = $line_item; |
|
599 | - if( $line_item->parent() != $this ) { |
|
600 | - $line_item->set_parent( $this ); |
|
598 | + $this->_children[$line_item->code()] = $line_item; |
|
599 | + if ($line_item->parent() != $this) { |
|
600 | + $line_item->set_parent($this); |
|
601 | 601 | } |
602 | 602 | return TRUE; |
603 | 603 | } |
@@ -611,16 +611,16 @@ discard block |
||
611 | 611 | * @param EE_Line_Item $line_item |
612 | 612 | * |
613 | 613 | */ |
614 | - public function set_parent( $line_item ) { |
|
615 | - if ( $this->ID() ) { |
|
616 | - if( ! $line_item->ID() ) { |
|
614 | + public function set_parent($line_item) { |
|
615 | + if ($this->ID()) { |
|
616 | + if ( ! $line_item->ID()) { |
|
617 | 617 | $line_item->save(); |
618 | 618 | } |
619 | - $this->set_parent_ID( $line_item->ID() ); |
|
619 | + $this->set_parent_ID($line_item->ID()); |
|
620 | 620 | $this->save(); |
621 | 621 | } else { |
622 | 622 | $this->_parent = $line_item; |
623 | - $this->set_parent_ID( $line_item->ID() ); |
|
623 | + $this->set_parent_ID($line_item->ID()); |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
@@ -633,11 +633,11 @@ discard block |
||
633 | 633 | * @param string $code |
634 | 634 | * @return EE_Line_Item |
635 | 635 | */ |
636 | - public function get_child_line_item( $code ) { |
|
637 | - if ( $this->ID() ) { |
|
638 | - return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) ); |
|
636 | + public function get_child_line_item($code) { |
|
637 | + if ($this->ID()) { |
|
638 | + return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code))); |
|
639 | 639 | } else { |
640 | - return isset( $this->_children[ $code ] ) ? $this->_children[ $code ] : null; |
|
640 | + return isset($this->_children[$code]) ? $this->_children[$code] : null; |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | * @return int |
649 | 649 | */ |
650 | 650 | public function delete_children_line_items() { |
651 | - if ( $this->ID() ) { |
|
652 | - return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) ); |
|
651 | + if ($this->ID()) { |
|
652 | + return $this->get_model()->delete(array(array('LIN_parent' => $this->ID()))); |
|
653 | 653 | } else { |
654 | - $count = count( $this->_children ); |
|
654 | + $count = count($this->_children); |
|
655 | 655 | $this->_children = array(); |
656 | 656 | return $count; |
657 | 657 | } |
@@ -668,25 +668,25 @@ discard block |
||
668 | 668 | * @param bool $stop_search_once_found |
669 | 669 | * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet) |
670 | 670 | */ |
671 | - public function delete_child_line_item( $code, $stop_search_once_found = true ) { |
|
672 | - if ( $this->ID() ) { |
|
671 | + public function delete_child_line_item($code, $stop_search_once_found = true) { |
|
672 | + if ($this->ID()) { |
|
673 | 673 | $items_deleted = 0; |
674 | - if( $this->code() == $code ) { |
|
675 | - $items_deleted += EEH_Line_Item::delete_all_child_items( $this ); |
|
674 | + if ($this->code() == $code) { |
|
675 | + $items_deleted += EEH_Line_Item::delete_all_child_items($this); |
|
676 | 676 | $items_deleted += (int) $this->delete(); |
677 | - if( $stop_search_once_found ){ |
|
677 | + if ($stop_search_once_found) { |
|
678 | 678 | return $items_deleted; |
679 | 679 | } |
680 | 680 | } |
681 | - foreach( $this->children() as $child_line_item ) { |
|
682 | - $items_deleted += $child_line_item->delete_child_line_item( $code, $stop_search_once_found ); |
|
681 | + foreach ($this->children() as $child_line_item) { |
|
682 | + $items_deleted += $child_line_item->delete_child_line_item($code, $stop_search_once_found); |
|
683 | 683 | } |
684 | 684 | return $items_deleted; |
685 | 685 | } else { |
686 | - if( isset( $this->_children[ $code ] ) ) { |
|
687 | - unset( $this->_children[ $code ] ); |
|
686 | + if (isset($this->_children[$code])) { |
|
687 | + unset($this->_children[$code]); |
|
688 | 688 | return 1; |
689 | - }else{ |
|
689 | + } else { |
|
690 | 690 | return 0; |
691 | 691 | } |
692 | 692 | } |
@@ -699,9 +699,9 @@ discard block |
||
699 | 699 | * @return boolean |
700 | 700 | */ |
701 | 701 | public function delete_if_childless_subtotal() { |
702 | - if( $this->ID() && |
|
702 | + if ($this->ID() && |
|
703 | 703 | $this->type() == EEM_Line_Item::type_sub_total && |
704 | - ! $this->children() ) { |
|
704 | + ! $this->children()) { |
|
705 | 705 | return $this->delete(); |
706 | 706 | } else { |
707 | 707 | return false; |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | public function generate_code() { |
718 | 718 | // each line item in the cart requires a unique identifier |
719 | - return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . microtime() ); |
|
719 | + return md5($this->get('OBJ_type').$this->get('OBJ_ID').microtime()); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | * @return string like '2, 004.00', formatted according to the localized currency |
800 | 800 | */ |
801 | 801 | public function unit_price_no_code() { |
802 | - return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' ); |
|
802 | + return $this->get_pretty('LIN_unit_price', 'no_currency_code'); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | * @return string like '2, 004.00', formatted according to the localized currency |
810 | 810 | */ |
811 | 811 | public function total_no_code() { |
812 | - return $this->get_pretty( 'LIN_total', 'no_currency_code' ); |
|
812 | + return $this->get_pretty('LIN_total', 'no_currency_code'); |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | |
@@ -829,17 +829,17 @@ discard block |
||
829 | 829 | $tax_total = $this->recalculate_taxes_and_tax_total(); |
830 | 830 | $total = $pre_tax_total + $tax_total; |
831 | 831 | // no negative totals plz |
832 | - $total = max( $total, 0 ); |
|
833 | - $this->set_total( $total ); |
|
832 | + $total = max($total, 0); |
|
833 | + $this->set_total($total); |
|
834 | 834 | //only update the related transaction's total |
835 | 835 | //if we intend to save this line item and its a grand total |
836 | - if( |
|
836 | + if ( |
|
837 | 837 | $this->allow_persist() && |
838 | 838 | $this->type() === EEM_Line_Item::type_total && |
839 | 839 | $this->transaction() instanceof EE_Transaction |
840 | - ){ |
|
841 | - $this->transaction()->set_total( $total ); |
|
842 | - if ( $this->transaction()->ID() ) { |
|
840 | + ) { |
|
841 | + $this->transaction()->set_total($total); |
|
842 | + if ($this->transaction()->ID()) { |
|
843 | 843 | $this->transaction()->save(); |
844 | 844 | } |
845 | 845 | } |
@@ -858,47 +858,47 @@ discard block |
||
858 | 858 | public function recalculate_pre_tax_total() { |
859 | 859 | $total = 0; |
860 | 860 | $my_children = $this->children(); |
861 | - $has_children = ! empty( $my_children ); |
|
862 | - if ( $has_children && $this->is_line_item() ) { |
|
863 | - $total = $this->_recalculate_pretax_total_for_line_item( $total, $my_children ); |
|
864 | - } elseif ( ! $has_children && ( $this->is_sub_line_item() || $this->is_line_item() ) ) { |
|
861 | + $has_children = ! empty($my_children); |
|
862 | + if ($has_children && $this->is_line_item()) { |
|
863 | + $total = $this->_recalculate_pretax_total_for_line_item($total, $my_children); |
|
864 | + } elseif ( ! $has_children && ($this->is_sub_line_item() || $this->is_line_item())) { |
|
865 | 865 | $total = $this->unit_price() * $this->quantity(); |
866 | - } elseif( $this->is_sub_total() || $this->is_total() ) { |
|
867 | - $total = $this->_recalculate_pretax_total_for_subtotal( $total, $my_children ); |
|
868 | - } elseif ( $this->is_tax_sub_total() || $this->is_tax() || $this->is_cancelled() ) { |
|
866 | + } elseif ($this->is_sub_total() || $this->is_total()) { |
|
867 | + $total = $this->_recalculate_pretax_total_for_subtotal($total, $my_children); |
|
868 | + } elseif ($this->is_tax_sub_total() || $this->is_tax() || $this->is_cancelled()) { |
|
869 | 869 | // completely ignore tax totals, tax sub-totals, and cancelled line items, when calculating the pre-tax-total |
870 | 870 | return 0; |
871 | 871 | } |
872 | 872 | // ensure all non-line items and non-sub-line-items have a quantity of 1 (except for Events) |
873 | - if( |
|
873 | + if ( |
|
874 | 874 | ! $this->is_line_item() && |
875 | 875 | ! $this->is_sub_line_item() && |
876 | 876 | ! $this->is_cancellation() |
877 | 877 | ) { |
878 | - if ( $this->OBJ_type() !== 'Event' ) { |
|
879 | - $this->set_quantity( 1 ); |
|
878 | + if ($this->OBJ_type() !== 'Event') { |
|
879 | + $this->set_quantity(1); |
|
880 | 880 | } |
881 | - if( ! $this->is_percent() ) { |
|
882 | - $this->set_unit_price( $this->total() ); |
|
881 | + if ( ! $this->is_percent()) { |
|
882 | + $this->set_unit_price($this->total()); |
|
883 | 883 | } |
884 | 884 | } |
885 | 885 | |
886 | 886 | //we don't want to bother saving grand totals, because that needs to factor in taxes anyways |
887 | 887 | //so it ought to be |
888 | - if( ! $this->is_total() ) { |
|
889 | - $this->set_total( $total ); |
|
888 | + if ( ! $this->is_total()) { |
|
889 | + $this->set_total($total); |
|
890 | 890 | //if not a percent line item, make sure we keep the unit price in sync |
891 | - if( |
|
891 | + if ( |
|
892 | 892 | $has_children |
893 | 893 | && $this->is_line_item() |
894 | 894 | && ! $this->is_percent() |
895 | 895 | ) { |
896 | - if( $this->quantity() === 0 ){ |
|
896 | + if ($this->quantity() === 0) { |
|
897 | 897 | $new_unit_price = 0; |
898 | 898 | } else { |
899 | 899 | $new_unit_price = $this->total() / $this->quantity(); |
900 | 900 | } |
901 | - $this->set_unit_price( $new_unit_price ); |
|
901 | + $this->set_unit_price($new_unit_price); |
|
902 | 902 | } |
903 | 903 | $this->maybe_save(); |
904 | 904 | } |
@@ -918,39 +918,39 @@ discard block |
||
918 | 918 | * @return float |
919 | 919 | * @throws \EE_Error |
920 | 920 | */ |
921 | - protected function _recalculate_pretax_total_for_subtotal( $calculated_total_so_far, $my_children = null ) { |
|
922 | - if( $my_children === null ) { |
|
921 | + protected function _recalculate_pretax_total_for_subtotal($calculated_total_so_far, $my_children = null) { |
|
922 | + if ($my_children === null) { |
|
923 | 923 | $my_children = $this->children(); |
924 | 924 | } |
925 | 925 | //get the total of all its children |
926 | - foreach ( $my_children as $child_line_item ) { |
|
927 | - if ( $child_line_item instanceof EE_Line_Item && ! $child_line_item->is_cancellation() ) { |
|
926 | + foreach ($my_children as $child_line_item) { |
|
927 | + if ($child_line_item instanceof EE_Line_Item && ! $child_line_item->is_cancellation()) { |
|
928 | 928 | // percentage line items are based on total so far |
929 | - if ( $child_line_item->is_percent() ) { |
|
929 | + if ($child_line_item->is_percent()) { |
|
930 | 930 | //round as we go so that the line items add up ok |
931 | 931 | $percent_total = round( |
932 | 932 | $calculated_total_so_far * $child_line_item->percent() / 100, |
933 | 933 | EE_Registry::instance()->CFG->currency->dec_plc |
934 | 934 | ); |
935 | - $child_line_item->set_total( $percent_total ); |
|
935 | + $child_line_item->set_total($percent_total); |
|
936 | 936 | //so far all percent line items should have a quantity of 1 |
937 | 937 | //(ie, no double percent discounts. Although that might be requested someday) |
938 | - $child_line_item->set_quantity( 1 ); |
|
938 | + $child_line_item->set_quantity(1); |
|
939 | 939 | $child_line_item->maybe_save(); |
940 | 940 | $calculated_total_so_far += $percent_total; |
941 | 941 | } else { |
942 | 942 | //verify flat sub-line-item quantities match their parent |
943 | - if( $child_line_item->is_sub_line_item() ) { |
|
944 | - $child_line_item->set_quantity( $this->quantity() ); |
|
943 | + if ($child_line_item->is_sub_line_item()) { |
|
944 | + $child_line_item->set_quantity($this->quantity()); |
|
945 | 945 | } |
946 | 946 | $calculated_total_so_far += $child_line_item->recalculate_pre_tax_total(); |
947 | 947 | } |
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | - if( $this->is_sub_total() ){ |
|
951 | + if ($this->is_sub_total()) { |
|
952 | 952 | // no negative totals plz |
953 | - $calculated_total_so_far = max( $calculated_total_so_far, 0 ); |
|
953 | + $calculated_total_so_far = max($calculated_total_so_far, 0); |
|
954 | 954 | } |
955 | 955 | return $calculated_total_so_far; |
956 | 956 | } |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | * @return float |
969 | 969 | * @throws \EE_Error |
970 | 970 | */ |
971 | - protected function _recalculate_pretax_total_for_line_item( $calculated_total_so_far, $my_children = null ) { |
|
972 | - if( $my_children === null ) { |
|
971 | + protected function _recalculate_pretax_total_for_line_item($calculated_total_so_far, $my_children = null) { |
|
972 | + if ($my_children === null) { |
|
973 | 973 | $my_children = $this->children(); |
974 | 974 | } |
975 | 975 | //we need to keep track of the running total for a single item, |
@@ -977,10 +977,10 @@ discard block |
||
977 | 977 | $unit_price_for_total = 0; |
978 | 978 | $quantity_for_total = 1; |
979 | 979 | //get the total of all its children |
980 | - foreach ( $my_children as $child_line_item ) { |
|
981 | - if ( $child_line_item instanceof EE_Line_Item && |
|
980 | + foreach ($my_children as $child_line_item) { |
|
981 | + if ($child_line_item instanceof EE_Line_Item && |
|
982 | 982 | ! $child_line_item->is_cancellation()) { |
983 | - if ( $child_line_item->is_percent() ) { |
|
983 | + if ($child_line_item->is_percent()) { |
|
984 | 984 | //it should be the unit-price-so-far multiplied by teh percent multiplied by the quantity |
985 | 985 | //not total multiplied by percent, because that ignores rounding along-the-way |
986 | 986 | $percent_unit_price = round( |
@@ -988,17 +988,17 @@ discard block |
||
988 | 988 | EE_Registry::instance()->CFG->currency->dec_plc |
989 | 989 | ); |
990 | 990 | $percent_total = $percent_unit_price * $quantity_for_total; |
991 | - $child_line_item->set_total( $percent_total ); |
|
991 | + $child_line_item->set_total($percent_total); |
|
992 | 992 | //so far all percent line items should have a quantity of 1 |
993 | 993 | //(ie, no double percent discounts. Although that might be requested someday) |
994 | - $child_line_item->set_quantity( 1 ); |
|
994 | + $child_line_item->set_quantity(1); |
|
995 | 995 | $child_line_item->maybe_save(); |
996 | 996 | $calculated_total_so_far += $percent_total; |
997 | 997 | $unit_price_for_total += $percent_unit_price; |
998 | 998 | } else { |
999 | 999 | //verify flat sub-line-item quantities match their parent |
1000 | - if( $child_line_item->is_sub_line_item() ) { |
|
1001 | - $child_line_item->set_quantity( $this->quantity() ); |
|
1000 | + if ($child_line_item->is_sub_line_item()) { |
|
1001 | + $child_line_item->set_quantity($this->quantity()); |
|
1002 | 1002 | } |
1003 | 1003 | $quantity_for_total = $child_line_item->quantity(); |
1004 | 1004 | $calculated_total_so_far += $child_line_item->recalculate_pre_tax_total(); |
@@ -1022,10 +1022,10 @@ discard block |
||
1022 | 1022 | //calculate the pretax total |
1023 | 1023 | $taxable_total = $this->taxable_total(); |
1024 | 1024 | $tax_total = 0; |
1025 | - foreach ( $taxes as $tax ) { |
|
1025 | + foreach ($taxes as $tax) { |
|
1026 | 1026 | $total_on_this_tax = $taxable_total * $tax->percent() / 100; |
1027 | 1027 | //remember the total on this line item |
1028 | - $tax->set_total( $total_on_this_tax ); |
|
1028 | + $tax->set_total($total_on_this_tax); |
|
1029 | 1029 | $tax_total += $tax->total(); |
1030 | 1030 | } |
1031 | 1031 | $this->_recalculate_tax_sub_total(); |
@@ -1039,21 +1039,21 @@ discard block |
||
1039 | 1039 | * @return void |
1040 | 1040 | */ |
1041 | 1041 | private function _recalculate_tax_sub_total() { |
1042 | - if ( $this->is_tax_sub_total() ) { |
|
1042 | + if ($this->is_tax_sub_total()) { |
|
1043 | 1043 | $total = 0; |
1044 | 1044 | $total_percent = 0; |
1045 | 1045 | //simply loop through all its children (which should be taxes) and sum their total |
1046 | - foreach ( $this->children() as $child_tax ) { |
|
1047 | - if ( $child_tax instanceof EE_Line_Item ) { |
|
1046 | + foreach ($this->children() as $child_tax) { |
|
1047 | + if ($child_tax instanceof EE_Line_Item) { |
|
1048 | 1048 | $total += $child_tax->total(); |
1049 | 1049 | $total_percent += $child_tax->percent(); |
1050 | 1050 | } |
1051 | 1051 | } |
1052 | - $this->set_total( $total ); |
|
1053 | - $this->set_percent( $total_percent ); |
|
1054 | - } elseif ( $this->is_total() ) { |
|
1055 | - foreach ( $this->children() as $maybe_tax_subtotal ) { |
|
1056 | - if ( $maybe_tax_subtotal instanceof EE_Line_Item ) { |
|
1052 | + $this->set_total($total); |
|
1053 | + $this->set_percent($total_percent); |
|
1054 | + } elseif ($this->is_total()) { |
|
1055 | + foreach ($this->children() as $maybe_tax_subtotal) { |
|
1056 | + if ($maybe_tax_subtotal instanceof EE_Line_Item) { |
|
1057 | 1057 | $maybe_tax_subtotal->_recalculate_tax_sub_total(); |
1058 | 1058 | } |
1059 | 1059 | } |
@@ -1069,8 +1069,8 @@ discard block |
||
1069 | 1069 | public function get_total_tax() { |
1070 | 1070 | $this->_recalculate_tax_sub_total(); |
1071 | 1071 | $total = 0; |
1072 | - foreach ( $this->tax_descendants() as $tax_line_item ) { |
|
1073 | - if ( $tax_line_item instanceof EE_Line_Item ) { |
|
1072 | + foreach ($this->tax_descendants() as $tax_line_item) { |
|
1073 | + if ($tax_line_item instanceof EE_Line_Item) { |
|
1074 | 1074 | $total += $tax_line_item->total(); |
1075 | 1075 | } |
1076 | 1076 | } |
@@ -1084,15 +1084,15 @@ discard block |
||
1084 | 1084 | */ |
1085 | 1085 | public function get_items_total() { |
1086 | 1086 | //by default, let's make sure we're consistent with the existing line item |
1087 | - if( $this->is_total() ) { |
|
1088 | - $pretax_subtotal_li = EEH_Line_Item::get_pre_tax_subtotal( $this ); |
|
1089 | - if( $pretax_subtotal_li instanceof EE_Line_Item ) { |
|
1087 | + if ($this->is_total()) { |
|
1088 | + $pretax_subtotal_li = EEH_Line_Item::get_pre_tax_subtotal($this); |
|
1089 | + if ($pretax_subtotal_li instanceof EE_Line_Item) { |
|
1090 | 1090 | return $pretax_subtotal_li->total(); |
1091 | 1091 | } |
1092 | 1092 | } |
1093 | 1093 | $total = 0; |
1094 | - foreach ( $this->get_items() as $item ) { |
|
1095 | - if ( $item instanceof EE_Line_Item ) { |
|
1094 | + foreach ($this->get_items() as $item) { |
|
1095 | + if ($item instanceof EE_Line_Item) { |
|
1096 | 1096 | $total += $item->total(); |
1097 | 1097 | } |
1098 | 1098 | } |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | * @return EE_Line_Item[] |
1108 | 1108 | */ |
1109 | 1109 | public function tax_descendants() { |
1110 | - return EEH_Line_Item::get_tax_descendants( $this ); |
|
1110 | + return EEH_Line_Item::get_tax_descendants($this); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | * @return EE_Line_Item[] |
1118 | 1118 | */ |
1119 | 1119 | public function get_items() { |
1120 | - return EEH_Line_Item::get_line_item_descendants( $this ); |
|
1120 | + return EEH_Line_Item::get_line_item_descendants($this); |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | |
@@ -1133,22 +1133,22 @@ discard block |
||
1133 | 1133 | */ |
1134 | 1134 | public function taxable_total() { |
1135 | 1135 | $total = 0; |
1136 | - if ( $this->children() ) { |
|
1137 | - foreach ( $this->children() as $child_line_item ) { |
|
1138 | - if ( $child_line_item->type() === EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
1136 | + if ($this->children()) { |
|
1137 | + foreach ($this->children() as $child_line_item) { |
|
1138 | + if ($child_line_item->type() === EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
1139 | 1139 | //if it's a percent item, only take into account the percent |
1140 | 1140 | //that's taxable too (the taxable total so far) |
1141 | - if( $child_line_item->is_percent() ) { |
|
1142 | - $total = $total + ( $total * $child_line_item->percent() / 100 ); |
|
1143 | - }else{ |
|
1141 | + if ($child_line_item->is_percent()) { |
|
1142 | + $total = $total + ($total * $child_line_item->percent() / 100); |
|
1143 | + } else { |
|
1144 | 1144 | $total += $child_line_item->total(); |
1145 | 1145 | } |
1146 | - }elseif( $child_line_item->type() === EEM_Line_Item::type_sub_total ){ |
|
1146 | + }elseif ($child_line_item->type() === EEM_Line_Item::type_sub_total) { |
|
1147 | 1147 | $total += $child_line_item->taxable_total(); |
1148 | 1148 | } |
1149 | 1149 | } |
1150 | 1150 | } |
1151 | - return max( $total, 0 ); |
|
1151 | + return max($total, 0); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | * @return EE_Transaction |
1159 | 1159 | */ |
1160 | 1160 | public function transaction() { |
1161 | - return $this->get_first_related( 'Transaction' ); |
|
1161 | + return $this->get_first_related('Transaction'); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | |
@@ -1171,18 +1171,18 @@ discard block |
||
1171 | 1171 | * @param int $txn_id if none is provided, assumes $this->TXN_ID() |
1172 | 1172 | * @return int count of items saved |
1173 | 1173 | */ |
1174 | - public function save_this_and_descendants_to_txn( $txn_id = NULL ) { |
|
1174 | + public function save_this_and_descendants_to_txn($txn_id = NULL) { |
|
1175 | 1175 | $count = 0; |
1176 | - if ( ! $txn_id ) { |
|
1176 | + if ( ! $txn_id) { |
|
1177 | 1177 | $txn_id = $this->TXN_ID(); |
1178 | 1178 | } |
1179 | - $this->set_TXN_ID( $txn_id ); |
|
1179 | + $this->set_TXN_ID($txn_id); |
|
1180 | 1180 | $children = $this->children(); |
1181 | 1181 | $count += $this->save() ? 1 : 0; |
1182 | - foreach ( $children as $child_line_item ) { |
|
1183 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
1184 | - $child_line_item->set_parent_ID( $this->ID() ); |
|
1185 | - $count += $child_line_item->save_this_and_descendants_to_txn( $txn_id ); |
|
1182 | + foreach ($children as $child_line_item) { |
|
1183 | + if ($child_line_item instanceof EE_Line_Item) { |
|
1184 | + $child_line_item->set_parent_ID($this->ID()); |
|
1185 | + $count += $child_line_item->save_this_and_descendants_to_txn($txn_id); |
|
1186 | 1186 | } |
1187 | 1187 | } |
1188 | 1188 | return $count; |
@@ -1199,9 +1199,9 @@ discard block |
||
1199 | 1199 | $count = 0; |
1200 | 1200 | $children = $this->children(); |
1201 | 1201 | $count += $this->save() ? 1 : 0; |
1202 | - foreach ( $children as $child_line_item ) { |
|
1203 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
1204 | - $child_line_item->set_parent_ID( $this->ID() ); |
|
1202 | + foreach ($children as $child_line_item) { |
|
1203 | + if ($child_line_item instanceof EE_Line_Item) { |
|
1204 | + $child_line_item->set_parent_ID($this->ID()); |
|
1205 | 1205 | $count += $child_line_item->save_this_and_descendants(); |
1206 | 1206 | } |
1207 | 1207 | } |
@@ -1215,8 +1215,8 @@ discard block |
||
1215 | 1215 | * @return EE_Line_Item[] |
1216 | 1216 | */ |
1217 | 1217 | function get_cancellations() { |
1218 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
1219 | - return EEH_Line_Item::get_descendants_of_type( $this, EEM_Line_Item::type_cancellation ); |
|
1218 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
1219 | + return EEH_Line_Item::get_descendants_of_type($this, EEM_Line_Item::type_cancellation); |
|
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | |
@@ -1226,9 +1226,9 @@ discard block |
||
1226 | 1226 | * @param string $type one of the constants on EEM_Line_Item |
1227 | 1227 | * @return EE_Line_Item[] |
1228 | 1228 | */ |
1229 | - protected function _get_descendants_of_type( $type ) { |
|
1230 | - EE_Error::doing_it_wrong( 'EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0' ); |
|
1231 | - return EEH_Line_Item::get_descendants_of_type( $this, $type ); |
|
1229 | + protected function _get_descendants_of_type($type) { |
|
1230 | + EE_Error::doing_it_wrong('EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0'); |
|
1231 | + return EEH_Line_Item::get_descendants_of_type($this, $type); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | |
@@ -1238,9 +1238,9 @@ discard block |
||
1238 | 1238 | * @param string $type like one of the EEM_Line_Item::type_* |
1239 | 1239 | * @return EE_Line_Item |
1240 | 1240 | */ |
1241 | - public function get_nearest_descendant_of_type( $type ) { |
|
1242 | - EE_Error::doing_it_wrong( 'EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0' ); |
|
1243 | - return EEH_Line_Item::get_nearest_descendant_of_type( $this, $type ); |
|
1241 | + public function get_nearest_descendant_of_type($type) { |
|
1242 | + EE_Error::doing_it_wrong('EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0'); |
|
1243 | + return EEH_Line_Item::get_nearest_descendant_of_type($this, $type); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | 1246 | |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | * @return int count of items saved |
1252 | 1252 | */ |
1253 | 1253 | public function maybe_save() { |
1254 | - if ( $this->ID() ) { |
|
1254 | + if ($this->ID()) { |
|
1255 | 1255 | return $this->save(); |
1256 | 1256 | } |
1257 | 1257 | return false; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * EEH_Line_Item |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @return boolean success |
46 | 46 | * @throws \EE_Error |
47 | 47 | */ |
48 | - public static function add_unrelated_item( EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL ){ |
|
49 | - $items_subtotal = self::get_pre_tax_subtotal( $parent_line_item ); |
|
48 | + public static function add_unrelated_item(EE_Line_Item $parent_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) { |
|
49 | + $items_subtotal = self::get_pre_tax_subtotal($parent_line_item); |
|
50 | 50 | $line_item = EE_Line_Item::new_instance(array( |
51 | 51 | 'LIN_name' => $name, |
52 | 52 | 'LIN_desc' => $description, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'LIN_quantity' => $quantity, |
55 | 55 | 'LIN_percent' => null, |
56 | 56 | 'LIN_is_taxable' => $taxable, |
57 | - 'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0, |
|
57 | + 'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0, |
|
58 | 58 | 'LIN_total' => (float) $unit_price * (int) $quantity, |
59 | 59 | 'LIN_type'=> EEM_Line_Item::type_line_item, |
60 | 60 | 'LIN_code' => $code, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $line_item, |
65 | 65 | $parent_line_item |
66 | 66 | ); |
67 | - return self::add_item( $parent_line_item, $line_item ); |
|
67 | + return self::add_item($parent_line_item, $line_item); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return boolean success |
87 | 87 | * @throws \EE_Error |
88 | 88 | */ |
89 | - public static function add_percentage_based_item( EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE ){ |
|
89 | + public static function add_percentage_based_item(EE_Line_Item $parent_line_item, $name, $percentage_amount, $description = '', $taxable = FALSE) { |
|
90 | 90 | $line_item = EE_Line_Item::new_instance(array( |
91 | 91 | 'LIN_name' => $name, |
92 | 92 | 'LIN_desc' => $description, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'LIN_percent' => $percentage_amount, |
95 | 95 | 'LIN_quantity' => NULL, |
96 | 96 | 'LIN_is_taxable' => $taxable, |
97 | - 'LIN_total' => (float) ( $percentage_amount * ( $parent_line_item->total() / 100 ) ), |
|
97 | + 'LIN_total' => (float) ($percentage_amount * ($parent_line_item->total() / 100)), |
|
98 | 98 | 'LIN_type'=> EEM_Line_Item::type_line_item, |
99 | 99 | 'LIN_parent' => $parent_line_item->ID() |
100 | 100 | )); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'FHEE__EEH_Line_Item__add_percentage_based_item__line_item', |
103 | 103 | $line_item |
104 | 104 | ); |
105 | - return self::add_item( $parent_line_item, $line_item ); |
|
105 | + return self::add_item($parent_line_item, $line_item); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | * @return \EE_Line_Item |
124 | 124 | * @throws \EE_Error |
125 | 125 | */ |
126 | - public static function add_ticket_purchase( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){ |
|
127 | - if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total() ) { |
|
128 | - throw new EE_Error( sprintf( __( 'A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso' ), $ticket->ID(), $total_line_item->ID() ) ); |
|
126 | + public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) { |
|
127 | + if ( ! $total_line_item instanceof EE_Line_Item || ! $total_line_item->is_total()) { |
|
128 | + throw new EE_Error(sprintf(__('A valid line item total is required in order to add tickets. A line item of type "%s" was passed.', 'event_espresso'), $ticket->ID(), $total_line_item->ID())); |
|
129 | 129 | } |
130 | 130 | // either increment the qty for an existing ticket |
131 | - $line_item = self::increment_ticket_qty_if_already_in_cart( $total_line_item, $ticket, $qty ); |
|
131 | + $line_item = self::increment_ticket_qty_if_already_in_cart($total_line_item, $ticket, $qty); |
|
132 | 132 | // or add a new one |
133 | - if ( ! $line_item instanceof EE_Line_Item ) { |
|
134 | - $line_item = self::create_ticket_line_item( $total_line_item, $ticket, $qty ); |
|
133 | + if ( ! $line_item instanceof EE_Line_Item) { |
|
134 | + $line_item = self::create_ticket_line_item($total_line_item, $ticket, $qty); |
|
135 | 135 | } |
136 | 136 | $total_line_item->recalculate_total_including_taxes(); |
137 | 137 | return $line_item; |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | * @return \EE_Line_Item |
148 | 148 | * @throws \EE_Error |
149 | 149 | */ |
150 | - public static function increment_ticket_qty_if_already_in_cart( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) { |
|
150 | + public static function increment_ticket_qty_if_already_in_cart(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) { |
|
151 | 151 | $line_item = null; |
152 | - if ( $total_line_item instanceof EE_Line_Item && $total_line_item->is_total() ) { |
|
153 | - $ticket_line_items = EEH_Line_Item::get_ticket_line_items( $total_line_item ); |
|
154 | - foreach ( (array)$ticket_line_items as $ticket_line_item ) { |
|
152 | + if ($total_line_item instanceof EE_Line_Item && $total_line_item->is_total()) { |
|
153 | + $ticket_line_items = EEH_Line_Item::get_ticket_line_items($total_line_item); |
|
154 | + foreach ((array) $ticket_line_items as $ticket_line_item) { |
|
155 | 155 | if ( |
156 | 156 | $ticket_line_item instanceof EE_Line_Item |
157 | 157 | && (int) $ticket_line_item->OBJ_ID() === (int) $ticket->ID() |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
164 | - if ( $line_item instanceof EE_Line_Item ) { |
|
165 | - EEH_Line_Item::increment_quantity( $line_item, $qty ); |
|
164 | + if ($line_item instanceof EE_Line_Item) { |
|
165 | + EEH_Line_Item::increment_quantity($line_item, $qty); |
|
166 | 166 | return $line_item; |
167 | 167 | } |
168 | 168 | return null; |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | * @return void |
180 | 180 | * @throws \EE_Error |
181 | 181 | */ |
182 | - public static function increment_quantity( EE_Line_Item $line_item, $qty = 1 ) { |
|
183 | - if( ! $line_item->is_percent() ) { |
|
182 | + public static function increment_quantity(EE_Line_Item $line_item, $qty = 1) { |
|
183 | + if ( ! $line_item->is_percent()) { |
|
184 | 184 | $qty += $line_item->quantity(); |
185 | - $line_item->set_quantity( $qty ); |
|
186 | - $line_item->set_total( $line_item->unit_price() * $qty ); |
|
185 | + $line_item->set_quantity($qty); |
|
186 | + $line_item->set_total($line_item->unit_price() * $qty); |
|
187 | 187 | $line_item->save(); |
188 | 188 | } |
189 | - foreach( $line_item->children() as $child ) { |
|
190 | - if( $child->is_sub_line_item() ) { |
|
191 | - EEH_Line_Item::update_quantity( $child, $qty ); |
|
189 | + foreach ($line_item->children() as $child) { |
|
190 | + if ($child->is_sub_line_item()) { |
|
191 | + EEH_Line_Item::update_quantity($child, $qty); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
@@ -204,17 +204,17 @@ discard block |
||
204 | 204 | * @return void |
205 | 205 | * @throws \EE_Error |
206 | 206 | */ |
207 | - public static function decrement_quantity( EE_Line_Item $line_item, $qty = 1 ) { |
|
208 | - if( ! $line_item->is_percent() ) { |
|
207 | + public static function decrement_quantity(EE_Line_Item $line_item, $qty = 1) { |
|
208 | + if ( ! $line_item->is_percent()) { |
|
209 | 209 | $qty = $line_item->quantity() - $qty; |
210 | - $qty = max( $qty, 0 ); |
|
211 | - $line_item->set_quantity( $qty ); |
|
212 | - $line_item->set_total( $line_item->unit_price() * $qty ); |
|
210 | + $qty = max($qty, 0); |
|
211 | + $line_item->set_quantity($qty); |
|
212 | + $line_item->set_total($line_item->unit_price() * $qty); |
|
213 | 213 | $line_item->save(); |
214 | 214 | } |
215 | - foreach( $line_item->children() as $child ) { |
|
216 | - if( $child->is_sub_line_item() ) { |
|
217 | - EEH_Line_Item::update_quantity( $child, $qty ); |
|
215 | + foreach ($line_item->children() as $child) { |
|
216 | + if ($child->is_sub_line_item()) { |
|
217 | + EEH_Line_Item::update_quantity($child, $qty); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | * @param int $new_quantity |
230 | 230 | * @throws \EE_Error |
231 | 231 | */ |
232 | - public static function update_quantity( EE_Line_Item $line_item, $new_quantity ) { |
|
233 | - if( ! $line_item->is_percent() ) { |
|
234 | - $line_item->set_quantity( $new_quantity ); |
|
235 | - $line_item->set_total( $line_item->unit_price() * $new_quantity ); |
|
232 | + public static function update_quantity(EE_Line_Item $line_item, $new_quantity) { |
|
233 | + if ( ! $line_item->is_percent()) { |
|
234 | + $line_item->set_quantity($new_quantity); |
|
235 | + $line_item->set_total($line_item->unit_price() * $new_quantity); |
|
236 | 236 | $line_item->save(); |
237 | 237 | } |
238 | - foreach( $line_item->children() as $child ) { |
|
239 | - if( $child->is_sub_line_item() ) { |
|
240 | - EEH_Line_Item::update_quantity( $child, $new_quantity ); |
|
238 | + foreach ($line_item->children() as $child) { |
|
239 | + if ($child->is_sub_line_item()) { |
|
240 | + EEH_Line_Item::update_quantity($child, $new_quantity); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } |
@@ -252,43 +252,43 @@ discard block |
||
252 | 252 | * @return \EE_Line_Item |
253 | 253 | * @throws \EE_Error |
254 | 254 | */ |
255 | - public static function create_ticket_line_item( EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ) { |
|
255 | + public static function create_ticket_line_item(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) { |
|
256 | 256 | $datetimes = $ticket->datetimes(); |
257 | - $first_datetime = reset( $datetimes ); |
|
258 | - if( $first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event ) { |
|
257 | + $first_datetime = reset($datetimes); |
|
258 | + if ($first_datetime instanceof EE_Datetime && $first_datetime->event() instanceof EE_Event) { |
|
259 | 259 | $first_datetime_name = $first_datetime->event()->name(); |
260 | 260 | } else { |
261 | - $first_datetime_name = __( 'Event', 'event_espresso' ); |
|
261 | + $first_datetime_name = __('Event', 'event_espresso'); |
|
262 | 262 | } |
263 | - $event = sprintf( _x( '(For %1$s)', '(For Event Name)', 'event_espresso' ), $first_datetime_name ); |
|
263 | + $event = sprintf(_x('(For %1$s)', '(For Event Name)', 'event_espresso'), $first_datetime_name); |
|
264 | 264 | // get event subtotal line |
265 | - $events_sub_total = self::get_event_line_item_for_ticket( $total_line_item, $ticket ); |
|
265 | + $events_sub_total = self::get_event_line_item_for_ticket($total_line_item, $ticket); |
|
266 | 266 | // add $ticket to cart |
267 | - $line_item = EE_Line_Item::new_instance( array( |
|
267 | + $line_item = EE_Line_Item::new_instance(array( |
|
268 | 268 | 'LIN_name' => $ticket->name(), |
269 | - 'LIN_desc' => $ticket->description() !== '' ? $ticket->description() . ' ' . $event : $event, |
|
269 | + 'LIN_desc' => $ticket->description() !== '' ? $ticket->description().' '.$event : $event, |
|
270 | 270 | 'LIN_unit_price' => $ticket->price(), |
271 | 271 | 'LIN_quantity' => $qty, |
272 | 272 | 'LIN_is_taxable' => $ticket->taxable(), |
273 | - 'LIN_order' => count( $events_sub_total->children() ), |
|
273 | + 'LIN_order' => count($events_sub_total->children()), |
|
274 | 274 | 'LIN_total' => $ticket->price() * $qty, |
275 | 275 | 'LIN_type' => EEM_Line_Item::type_line_item, |
276 | 276 | 'OBJ_ID' => $ticket->ID(), |
277 | 277 | 'OBJ_type' => 'Ticket' |
278 | - ) ); |
|
278 | + )); |
|
279 | 279 | $line_item = apply_filters( |
280 | 280 | 'FHEE__EEH_Line_Item__create_ticket_line_item__line_item', |
281 | 281 | $line_item |
282 | 282 | ); |
283 | - $events_sub_total->add_child_line_item( $line_item ); |
|
283 | + $events_sub_total->add_child_line_item($line_item); |
|
284 | 284 | //now add the sub-line items |
285 | 285 | $running_total_for_ticket = 0; |
286 | - foreach ( $ticket->prices( array( 'order_by' => array( 'PRC_order' => 'ASC' ) ) ) as $price ) { |
|
286 | + foreach ($ticket->prices(array('order_by' => array('PRC_order' => 'ASC'))) as $price) { |
|
287 | 287 | $sign = $price->is_discount() ? -1 : 1; |
288 | 288 | $price_total = $price->is_percent() |
289 | 289 | ? $running_total_for_ticket * $price->amount() / 100 |
290 | 290 | : $price->amount() * $qty; |
291 | - $sub_line_item = EE_Line_Item::new_instance( array( |
|
291 | + $sub_line_item = EE_Line_Item::new_instance(array( |
|
292 | 292 | 'LIN_name' => $price->name(), |
293 | 293 | 'LIN_desc' => $price->desc(), |
294 | 294 | 'LIN_quantity' => $price->is_percent() ? null : $qty, |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | 'LIN_type' => EEM_Line_Item::type_sub_line_item, |
299 | 299 | 'OBJ_ID' => $price->ID(), |
300 | 300 | 'OBJ_type' => 'Price' |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | $sub_line_item = apply_filters( |
303 | 303 | 'FHEE__EEH_Line_Item__create_ticket_line_item__sub_line_item', |
304 | 304 | $sub_line_item |
305 | 305 | ); |
306 | - if ( $price->is_percent() ) { |
|
307 | - $sub_line_item->set_percent( $sign * $price->amount() ); |
|
306 | + if ($price->is_percent()) { |
|
307 | + $sub_line_item->set_percent($sign * $price->amount()); |
|
308 | 308 | } else { |
309 | - $sub_line_item->set_unit_price( $sign * $price->amount() ); |
|
309 | + $sub_line_item->set_unit_price($sign * $price->amount()); |
|
310 | 310 | } |
311 | 311 | $running_total_for_ticket += $price_total; |
312 | - $line_item->add_child_line_item( $sub_line_item ); |
|
312 | + $line_item->add_child_line_item($sub_line_item); |
|
313 | 313 | } |
314 | 314 | return $line_item; |
315 | 315 | } |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | * @return boolean |
330 | 330 | * @throws \EE_Error |
331 | 331 | */ |
332 | - public static function add_item( EE_Line_Item $total_line_item, EE_Line_Item $item ){ |
|
333 | - $pre_tax_subtotal = self::get_pre_tax_subtotal( $total_line_item ); |
|
334 | - if ( $pre_tax_subtotal instanceof EE_Line_Item ){ |
|
332 | + public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) { |
|
333 | + $pre_tax_subtotal = self::get_pre_tax_subtotal($total_line_item); |
|
334 | + if ($pre_tax_subtotal instanceof EE_Line_Item) { |
|
335 | 335 | $success = $pre_tax_subtotal->add_child_line_item($item); |
336 | - }else{ |
|
336 | + } else { |
|
337 | 337 | return FALSE; |
338 | 338 | } |
339 | 339 | $total_line_item->recalculate_total_including_taxes(); |
@@ -352,34 +352,34 @@ discard block |
||
352 | 352 | * @return bool success |
353 | 353 | * @throws \EE_Error |
354 | 354 | */ |
355 | - public static function cancel_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) { |
|
355 | + public static function cancel_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) { |
|
356 | 356 | // validate incoming line_item |
357 | - if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) { |
|
357 | + if ($ticket_line_item->OBJ_type() !== 'Ticket') { |
|
358 | 358 | throw new EE_Error( |
359 | 359 | sprintf( |
360 | - __( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ), |
|
360 | + __('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'), |
|
361 | 361 | $ticket_line_item->type() |
362 | 362 | ) |
363 | 363 | ); |
364 | 364 | } |
365 | - if ( $ticket_line_item->quantity() < $qty ) { |
|
365 | + if ($ticket_line_item->quantity() < $qty) { |
|
366 | 366 | throw new EE_Error( |
367 | 367 | sprintf( |
368 | - __( 'Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso' ), |
|
368 | + __('Can not cancel %1$d ticket(s) because the supplied line item has a quantity of %2$d.', 'event_espresso'), |
|
369 | 369 | $qty, |
370 | 370 | $ticket_line_item->quantity() |
371 | 371 | ) |
372 | 372 | ); |
373 | 373 | } |
374 | 374 | // decrement ticket quantity; don't rely on auto-fixing when recalculating totals to do this |
375 | - $ticket_line_item->set_quantity( $ticket_line_item->quantity() - $qty ); |
|
376 | - foreach( $ticket_line_item->children() as $child_line_item ) { |
|
377 | - if( |
|
375 | + $ticket_line_item->set_quantity($ticket_line_item->quantity() - $qty); |
|
376 | + foreach ($ticket_line_item->children() as $child_line_item) { |
|
377 | + if ( |
|
378 | 378 | $child_line_item->is_sub_line_item() |
379 | 379 | && ! $child_line_item->is_percent() |
380 | 380 | && ! $child_line_item->is_cancellation() |
381 | 381 | ) { |
382 | - $child_line_item->set_quantity( $child_line_item->quantity() - $qty ); |
|
382 | + $child_line_item->set_quantity($child_line_item->quantity() - $qty); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | // get cancellation sub line item |
@@ -387,37 +387,37 @@ discard block |
||
387 | 387 | $ticket_line_item, |
388 | 388 | EEM_Line_Item::type_cancellation |
389 | 389 | ); |
390 | - $cancellation_line_item = reset( $cancellation_line_item ); |
|
390 | + $cancellation_line_item = reset($cancellation_line_item); |
|
391 | 391 | // verify that this ticket was indeed previously cancelled |
392 | - if ( $cancellation_line_item instanceof EE_Line_Item ) { |
|
392 | + if ($cancellation_line_item instanceof EE_Line_Item) { |
|
393 | 393 | // increment cancelled quantity |
394 | - $cancellation_line_item->set_quantity( $cancellation_line_item->quantity() + $qty ); |
|
394 | + $cancellation_line_item->set_quantity($cancellation_line_item->quantity() + $qty); |
|
395 | 395 | } else { |
396 | 396 | // create cancellation sub line item |
397 | - $cancellation_line_item = EE_Line_Item::new_instance( array( |
|
398 | - 'LIN_name' => __( 'Cancellation', 'event_espresso' ), |
|
397 | + $cancellation_line_item = EE_Line_Item::new_instance(array( |
|
398 | + 'LIN_name' => __('Cancellation', 'event_espresso'), |
|
399 | 399 | 'LIN_desc' => sprintf( |
400 | - _x( 'Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso' ), |
|
400 | + _x('Cancelled %1$s : %2$s', 'Cancelled Ticket Name : 2015-01-01 11:11', 'event_espresso'), |
|
401 | 401 | $ticket_line_item->name(), |
402 | - current_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) |
|
402 | + current_time(get_option('date_format').' '.get_option('time_format')) |
|
403 | 403 | ), |
404 | 404 | 'LIN_unit_price' => 0, // $ticket_line_item->unit_price() |
405 | 405 | 'LIN_quantity' => $qty, |
406 | 406 | 'LIN_is_taxable' => $ticket_line_item->is_taxable(), |
407 | - 'LIN_order' => count( $ticket_line_item->children() ), |
|
407 | + 'LIN_order' => count($ticket_line_item->children()), |
|
408 | 408 | 'LIN_total' => 0, // $ticket_line_item->unit_price() |
409 | 409 | 'LIN_type' => EEM_Line_Item::type_cancellation, |
410 | - ) ); |
|
411 | - $ticket_line_item->add_child_line_item( $cancellation_line_item ); |
|
410 | + )); |
|
411 | + $ticket_line_item->add_child_line_item($cancellation_line_item); |
|
412 | 412 | } |
413 | - if ( $ticket_line_item->save_this_and_descendants() > 0 ) { |
|
413 | + if ($ticket_line_item->save_this_and_descendants() > 0) { |
|
414 | 414 | // decrement parent line item quantity |
415 | 415 | $event_line_item = $ticket_line_item->parent(); |
416 | - if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) { |
|
417 | - $event_line_item->set_quantity( $event_line_item->quantity() - $qty ); |
|
416 | + if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') { |
|
417 | + $event_line_item->set_quantity($event_line_item->quantity() - $qty); |
|
418 | 418 | $event_line_item->save(); |
419 | 419 | } |
420 | - EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item ); |
|
420 | + EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item); |
|
421 | 421 | return true; |
422 | 422 | } |
423 | 423 | return false; |
@@ -435,12 +435,12 @@ discard block |
||
435 | 435 | * @return bool success |
436 | 436 | * @throws \EE_Error |
437 | 437 | */ |
438 | - public static function reinstate_canceled_ticket_line_item( EE_Line_Item $ticket_line_item, $qty = 1 ) { |
|
438 | + public static function reinstate_canceled_ticket_line_item(EE_Line_Item $ticket_line_item, $qty = 1) { |
|
439 | 439 | // validate incoming line_item |
440 | - if ( $ticket_line_item->OBJ_type() !== 'Ticket' ) { |
|
440 | + if ($ticket_line_item->OBJ_type() !== 'Ticket') { |
|
441 | 441 | throw new EE_Error( |
442 | 442 | sprintf( |
443 | - __( 'The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso' ), |
|
443 | + __('The supplied line item must have an Object Type of "Ticket", not %1$s.', 'event_espresso'), |
|
444 | 444 | $ticket_line_item->type() |
445 | 445 | ) |
446 | 446 | ); |
@@ -450,42 +450,42 @@ discard block |
||
450 | 450 | $ticket_line_item, |
451 | 451 | EEM_Line_Item::type_cancellation |
452 | 452 | ); |
453 | - $cancellation_line_item = reset( $cancellation_line_item ); |
|
453 | + $cancellation_line_item = reset($cancellation_line_item); |
|
454 | 454 | // verify that this ticket was indeed previously cancelled |
455 | - if ( ! $cancellation_line_item instanceof EE_Line_Item ) { |
|
455 | + if ( ! $cancellation_line_item instanceof EE_Line_Item) { |
|
456 | 456 | return false; |
457 | 457 | } |
458 | - if ( $cancellation_line_item->quantity() > $qty ) { |
|
458 | + if ($cancellation_line_item->quantity() > $qty) { |
|
459 | 459 | // decrement cancelled quantity |
460 | - $cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty ); |
|
461 | - } else if ( $cancellation_line_item->quantity() == $qty ) { |
|
460 | + $cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty); |
|
461 | + } else if ($cancellation_line_item->quantity() == $qty) { |
|
462 | 462 | // decrement cancelled quantity in case anyone still has the object kicking around |
463 | - $cancellation_line_item->set_quantity( $cancellation_line_item->quantity() - $qty ); |
|
463 | + $cancellation_line_item->set_quantity($cancellation_line_item->quantity() - $qty); |
|
464 | 464 | // delete because quantity will end up as 0 |
465 | 465 | $cancellation_line_item->delete(); |
466 | 466 | // and attempt to destroy the object, |
467 | 467 | // even though PHP won't actually destroy it until it needs the memory |
468 | - unset( $cancellation_line_item ); |
|
468 | + unset($cancellation_line_item); |
|
469 | 469 | } else { |
470 | 470 | // what ?!?! negative quantity ?!?! |
471 | 471 | throw new EE_Error( |
472 | 472 | sprintf( |
473 | - __( 'Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.', |
|
474 | - 'event_espresso' ), |
|
473 | + __('Can not reinstate %1$d cancelled ticket(s) because the cancelled ticket quantity is only %2$d.', |
|
474 | + 'event_espresso'), |
|
475 | 475 | $qty, |
476 | 476 | $cancellation_line_item->quantity() |
477 | 477 | ) |
478 | 478 | ); |
479 | 479 | } |
480 | 480 | // increment ticket quantity |
481 | - $ticket_line_item->set_quantity( $ticket_line_item->quantity() + $qty ); |
|
482 | - if ( $ticket_line_item->save_this_and_descendants() > 0 ) { |
|
481 | + $ticket_line_item->set_quantity($ticket_line_item->quantity() + $qty); |
|
482 | + if ($ticket_line_item->save_this_and_descendants() > 0) { |
|
483 | 483 | // increment parent line item quantity |
484 | 484 | $event_line_item = $ticket_line_item->parent(); |
485 | - if ( $event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event' ) { |
|
486 | - $event_line_item->set_quantity( $event_line_item->quantity() + $qty ); |
|
485 | + if ($event_line_item instanceof EE_Line_Item && $event_line_item->OBJ_type() === 'Event') { |
|
486 | + $event_line_item->set_quantity($event_line_item->quantity() + $qty); |
|
487 | 487 | } |
488 | - EEH_Line_Item::get_grand_total_and_recalculate_everything( $ticket_line_item ); |
|
488 | + EEH_Line_Item::get_grand_total_and_recalculate_everything($ticket_line_item); |
|
489 | 489 | return true; |
490 | 490 | } |
491 | 491 | return false; |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | * @param EE_Line_Item $line_item |
501 | 501 | * @return \EE_Line_Item |
502 | 502 | */ |
503 | - public static function get_grand_total_and_recalculate_everything( EE_Line_Item $line_item ){ |
|
504 | - $grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item ); |
|
503 | + public static function get_grand_total_and_recalculate_everything(EE_Line_Item $line_item) { |
|
504 | + $grand_total_line_item = EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item); |
|
505 | 505 | return $grand_total_line_item->recalculate_total_including_taxes(); |
506 | 506 | } |
507 | 507 | |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | * @return \EE_Line_Item |
515 | 515 | * @throws \EE_Error |
516 | 516 | */ |
517 | - public static function get_pre_tax_subtotal( EE_Line_Item $total_line_item ){ |
|
518 | - $pre_tax_subtotal = $total_line_item->get_child_line_item( 'pre-tax-subtotal' ); |
|
517 | + public static function get_pre_tax_subtotal(EE_Line_Item $total_line_item) { |
|
518 | + $pre_tax_subtotal = $total_line_item->get_child_line_item('pre-tax-subtotal'); |
|
519 | 519 | return $pre_tax_subtotal instanceof EE_Line_Item |
520 | 520 | ? $pre_tax_subtotal |
521 | - : self::create_pre_tax_subtotal( $total_line_item ); |
|
521 | + : self::create_pre_tax_subtotal($total_line_item); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | * @return \EE_Line_Item |
531 | 531 | * @throws \EE_Error |
532 | 532 | */ |
533 | - public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){ |
|
534 | - $taxes = $total_line_item->get_child_line_item( 'taxes' ); |
|
535 | - return $taxes ? $taxes : self::create_taxes_subtotal( $total_line_item ); |
|
533 | + public static function get_taxes_subtotal(EE_Line_Item $total_line_item) { |
|
534 | + $taxes = $total_line_item->get_child_line_item('taxes'); |
|
535 | + return $taxes ? $taxes : self::create_taxes_subtotal($total_line_item); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -545,12 +545,12 @@ discard block |
||
545 | 545 | * @return void |
546 | 546 | * @throws \EE_Error |
547 | 547 | */ |
548 | - public static function set_TXN_ID( EE_Line_Item $line_item, $transaction = NULL ){ |
|
549 | - if( $transaction ){ |
|
548 | + public static function set_TXN_ID(EE_Line_Item $line_item, $transaction = NULL) { |
|
549 | + if ($transaction) { |
|
550 | 550 | /** @type EEM_Transaction $EEM_Transaction */ |
551 | - $EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' ); |
|
552 | - $TXN_ID = $EEM_Transaction->ensure_is_ID( $transaction ); |
|
553 | - $line_item->set_TXN_ID( $TXN_ID ); |
|
551 | + $EEM_Transaction = EE_Registry::instance()->load_model('Transaction'); |
|
552 | + $TXN_ID = $EEM_Transaction->ensure_is_ID($transaction); |
|
553 | + $line_item->set_TXN_ID($TXN_ID); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | * @return \EE_Line_Item of type total |
566 | 566 | * @throws \EE_Error |
567 | 567 | */ |
568 | - public static function create_total_line_item( $transaction = NULL ){ |
|
569 | - $total_line_item = EE_Line_Item::new_instance( array( |
|
568 | + public static function create_total_line_item($transaction = NULL) { |
|
569 | + $total_line_item = EE_Line_Item::new_instance(array( |
|
570 | 570 | 'LIN_code' => 'total', |
571 | 571 | 'LIN_name' => __('Grand Total', 'event_espresso'), |
572 | 572 | 'LIN_type' => EEM_Line_Item::type_total, |
@@ -576,9 +576,9 @@ discard block |
||
576 | 576 | 'FHEE__EEH_Line_Item__create_total_line_item__total_line_item', |
577 | 577 | $total_line_item |
578 | 578 | ); |
579 | - self::set_TXN_ID( $total_line_item, $transaction ); |
|
580 | - self::create_pre_tax_subtotal( $total_line_item, $transaction ); |
|
581 | - self::create_taxes_subtotal( $total_line_item, $transaction ); |
|
579 | + self::set_TXN_ID($total_line_item, $transaction); |
|
580 | + self::create_pre_tax_subtotal($total_line_item, $transaction); |
|
581 | + self::create_taxes_subtotal($total_line_item, $transaction); |
|
582 | 582 | return $total_line_item; |
583 | 583 | } |
584 | 584 | |
@@ -592,19 +592,19 @@ discard block |
||
592 | 592 | * @return EE_Line_Item |
593 | 593 | * @throws \EE_Error |
594 | 594 | */ |
595 | - protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
|
596 | - $pre_tax_line_item = EE_Line_Item::new_instance( array( |
|
595 | + protected static function create_pre_tax_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
596 | + $pre_tax_line_item = EE_Line_Item::new_instance(array( |
|
597 | 597 | 'LIN_code' => 'pre-tax-subtotal', |
598 | - 'LIN_name' => __( 'Pre-Tax Subtotal', 'event_espresso' ), |
|
598 | + 'LIN_name' => __('Pre-Tax Subtotal', 'event_espresso'), |
|
599 | 599 | 'LIN_type' => EEM_Line_Item::type_sub_total |
600 | - ) ); |
|
600 | + )); |
|
601 | 601 | $pre_tax_line_item = apply_filters( |
602 | 602 | 'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item', |
603 | 603 | $pre_tax_line_item |
604 | 604 | ); |
605 | - self::set_TXN_ID( $pre_tax_line_item, $transaction ); |
|
606 | - $total_line_item->add_child_line_item( $pre_tax_line_item ); |
|
607 | - self::create_event_subtotal( $pre_tax_line_item, $transaction ); |
|
605 | + self::set_TXN_ID($pre_tax_line_item, $transaction); |
|
606 | + $total_line_item->add_child_line_item($pre_tax_line_item); |
|
607 | + self::create_event_subtotal($pre_tax_line_item, $transaction); |
|
608 | 608 | return $pre_tax_line_item; |
609 | 609 | } |
610 | 610 | |
@@ -619,21 +619,21 @@ discard block |
||
619 | 619 | * @return EE_Line_Item |
620 | 620 | * @throws \EE_Error |
621 | 621 | */ |
622 | - protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
|
622 | + protected static function create_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
623 | 623 | $tax_line_item = EE_Line_Item::new_instance(array( |
624 | 624 | 'LIN_code' => 'taxes', |
625 | 625 | 'LIN_name' => __('Taxes', 'event_espresso'), |
626 | 626 | 'LIN_type' => EEM_Line_Item::type_tax_sub_total, |
627 | - 'LIN_order' => 1000,//this should always come last |
|
627 | + 'LIN_order' => 1000, //this should always come last |
|
628 | 628 | )); |
629 | 629 | $tax_line_item = apply_filters( |
630 | 630 | 'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item', |
631 | 631 | $tax_line_item |
632 | 632 | ); |
633 | - self::set_TXN_ID( $tax_line_item, $transaction ); |
|
634 | - $total_line_item->add_child_line_item( $tax_line_item ); |
|
633 | + self::set_TXN_ID($tax_line_item, $transaction); |
|
634 | + $total_line_item->add_child_line_item($tax_line_item); |
|
635 | 635 | //and lastly, add the actual taxes |
636 | - self::apply_taxes( $total_line_item ); |
|
636 | + self::apply_taxes($total_line_item); |
|
637 | 637 | return $tax_line_item; |
638 | 638 | } |
639 | 639 | |
@@ -648,11 +648,11 @@ discard block |
||
648 | 648 | * @return EE_Line_Item |
649 | 649 | * @throws \EE_Error |
650 | 650 | */ |
651 | - public static function create_event_subtotal( EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL ){ |
|
651 | + public static function create_event_subtotal(EE_Line_Item $pre_tax_line_item, $transaction = NULL, $event = NULL) { |
|
652 | 652 | $event_line_item = EE_Line_Item::new_instance(array( |
653 | - 'LIN_code' => self::get_event_code( $event ), |
|
654 | - 'LIN_name' => self::get_event_name( $event ), |
|
655 | - 'LIN_desc' => self::get_event_desc( $event ), |
|
653 | + 'LIN_code' => self::get_event_code($event), |
|
654 | + 'LIN_name' => self::get_event_name($event), |
|
655 | + 'LIN_desc' => self::get_event_desc($event), |
|
656 | 656 | 'LIN_type' => EEM_Line_Item::type_sub_total, |
657 | 657 | 'OBJ_type' => 'Event', |
658 | 658 | 'OBJ_ID' => $event instanceof EE_Event ? $event->ID() : 0 |
@@ -661,8 +661,8 @@ discard block |
||
661 | 661 | 'FHEE__EEH_Line_Item__create_event_subtotal__event_line_item', |
662 | 662 | $event_line_item |
663 | 663 | ); |
664 | - self::set_TXN_ID( $event_line_item, $transaction ); |
|
665 | - $pre_tax_line_item->add_child_line_item( $event_line_item ); |
|
664 | + self::set_TXN_ID($event_line_item, $transaction); |
|
665 | + $pre_tax_line_item->add_child_line_item($event_line_item); |
|
666 | 666 | return $event_line_item; |
667 | 667 | } |
668 | 668 | |
@@ -675,8 +675,8 @@ discard block |
||
675 | 675 | * @return string |
676 | 676 | * @throws \EE_Error |
677 | 677 | */ |
678 | - public static function get_event_code( $event ) { |
|
679 | - return 'event-' . ( $event instanceof EE_Event ? $event->ID() : '0' ); |
|
678 | + public static function get_event_code($event) { |
|
679 | + return 'event-'.($event instanceof EE_Event ? $event->ID() : '0'); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | * @param EE_Event $event |
685 | 685 | * @return string |
686 | 686 | */ |
687 | - public static function get_event_name( $event ) { |
|
688 | - return $event instanceof EE_Event ? $event->name() : __( 'Event', 'event_espresso' ); |
|
687 | + public static function get_event_name($event) { |
|
688 | + return $event instanceof EE_Event ? $event->name() : __('Event', 'event_espresso'); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | /** |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | * @param EE_Event $event |
694 | 694 | * @return string |
695 | 695 | */ |
696 | - public static function get_event_desc( $event ) { |
|
696 | + public static function get_event_desc($event) { |
|
697 | 697 | return $event instanceof EE_Event ? $event->short_description() : ''; |
698 | 698 | } |
699 | 699 | |
@@ -707,27 +707,27 @@ discard block |
||
707 | 707 | * @throws \EE_Error |
708 | 708 | * @return EE_Line_Item |
709 | 709 | */ |
710 | - public static function get_event_line_item_for_ticket( EE_Line_Item $grand_total, EE_Ticket $ticket ) { |
|
710 | + public static function get_event_line_item_for_ticket(EE_Line_Item $grand_total, EE_Ticket $ticket) { |
|
711 | 711 | $first_datetime = $ticket->first_datetime(); |
712 | - if ( ! $first_datetime instanceof EE_Datetime ) { |
|
712 | + if ( ! $first_datetime instanceof EE_Datetime) { |
|
713 | 713 | throw new EE_Error( |
714 | - sprintf( __( 'The supplied ticket (ID %d) has no datetimes', 'event_espresso' ), $ticket->ID() ) |
|
714 | + sprintf(__('The supplied ticket (ID %d) has no datetimes', 'event_espresso'), $ticket->ID()) |
|
715 | 715 | ); |
716 | 716 | } |
717 | 717 | $event = $first_datetime->event(); |
718 | - if ( ! $event instanceof EE_Event ) { |
|
718 | + if ( ! $event instanceof EE_Event) { |
|
719 | 719 | throw new EE_Error( |
720 | 720 | sprintf( |
721 | - __( 'The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso' ), |
|
721 | + __('The supplied ticket (ID %d) has no event data associated with it.', 'event_espresso'), |
|
722 | 722 | $ticket->ID() |
723 | 723 | ) |
724 | 724 | ); |
725 | 725 | } |
726 | - $events_sub_total = EEH_Line_Item::get_event_line_item( $grand_total, $event ); |
|
727 | - if ( ! $events_sub_total instanceof EE_Line_Item ) { |
|
726 | + $events_sub_total = EEH_Line_Item::get_event_line_item($grand_total, $event); |
|
727 | + if ( ! $events_sub_total instanceof EE_Line_Item) { |
|
728 | 728 | throw new EE_Error( |
729 | 729 | sprintf( |
730 | - __( 'There is no events sub-total for ticket %s on total line item %d', 'event_espresso' ), |
|
730 | + __('There is no events sub-total for ticket %s on total line item %d', 'event_espresso'), |
|
731 | 731 | $ticket->ID(), |
732 | 732 | $grand_total->ID() |
733 | 733 | ) |
@@ -746,31 +746,31 @@ discard block |
||
746 | 746 | * @return EE_Line_Item for the event subtotal which is a child of $grand_total |
747 | 747 | * @throws \EE_Error |
748 | 748 | */ |
749 | - public static function get_event_line_item( EE_Line_Item $grand_total, $event ) { |
|
749 | + public static function get_event_line_item(EE_Line_Item $grand_total, $event) { |
|
750 | 750 | /** @type EE_Event $event */ |
751 | - $event = EEM_Event::instance()->ensure_is_obj( $event, true ); |
|
751 | + $event = EEM_Event::instance()->ensure_is_obj($event, true); |
|
752 | 752 | $event_line_item = NULL; |
753 | 753 | $found = false; |
754 | - foreach ( EEH_Line_Item::get_event_subtotals( $grand_total ) as $event_line_item ) { |
|
754 | + foreach (EEH_Line_Item::get_event_subtotals($grand_total) as $event_line_item) { |
|
755 | 755 | // default event subtotal, we should only ever find this the first time this method is called |
756 | - if ( ! $event_line_item->OBJ_ID() ) { |
|
756 | + if ( ! $event_line_item->OBJ_ID()) { |
|
757 | 757 | // let's use this! but first... set the event details |
758 | - EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event ); |
|
758 | + EEH_Line_Item::set_event_subtotal_details($event_line_item, $event); |
|
759 | 759 | $found = true; |
760 | 760 | break; |
761 | - } else if ( $event_line_item->OBJ_ID() === $event->ID() ) { |
|
761 | + } else if ($event_line_item->OBJ_ID() === $event->ID()) { |
|
762 | 762 | // found existing line item for this event in the cart, so break out of loop and use this one |
763 | 763 | $found = true; |
764 | 764 | break; |
765 | 765 | } |
766 | 766 | } |
767 | - if ( ! $found ) { |
|
767 | + if ( ! $found) { |
|
768 | 768 | //there is no event sub-total yet, so add it |
769 | - $pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total ); |
|
769 | + $pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal($grand_total); |
|
770 | 770 | // create a new "event" subtotal below that |
771 | - $event_line_item = EEH_Line_Item::create_event_subtotal( $pre_tax_subtotal, null, $event ); |
|
771 | + $event_line_item = EEH_Line_Item::create_event_subtotal($pre_tax_subtotal, null, $event); |
|
772 | 772 | // and set the event details |
773 | - EEH_Line_Item::set_event_subtotal_details( $event_line_item, $event ); |
|
773 | + EEH_Line_Item::set_event_subtotal_details($event_line_item, $event); |
|
774 | 774 | } |
775 | 775 | return $event_line_item; |
776 | 776 | } |
@@ -791,13 +791,13 @@ discard block |
||
791 | 791 | EE_Event $event, |
792 | 792 | $transaction = null |
793 | 793 | ) { |
794 | - if ( $event instanceof EE_Event ) { |
|
795 | - $event_line_item->set_code( self::get_event_code( $event ) ); |
|
796 | - $event_line_item->set_name( self::get_event_name( $event ) ); |
|
797 | - $event_line_item->set_desc( self::get_event_desc( $event ) ); |
|
798 | - $event_line_item->set_OBJ_ID( $event->ID() ); |
|
794 | + if ($event instanceof EE_Event) { |
|
795 | + $event_line_item->set_code(self::get_event_code($event)); |
|
796 | + $event_line_item->set_name(self::get_event_name($event)); |
|
797 | + $event_line_item->set_desc(self::get_event_desc($event)); |
|
798 | + $event_line_item->set_OBJ_ID($event->ID()); |
|
799 | 799 | } |
800 | - self::set_TXN_ID( $event_line_item, $transaction ); |
|
800 | + self::set_TXN_ID($event_line_item, $transaction); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | |
@@ -810,19 +810,19 @@ discard block |
||
810 | 810 | * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total |
811 | 811 | * @throws \EE_Error |
812 | 812 | */ |
813 | - public static function apply_taxes( EE_Line_Item $total_line_item ){ |
|
813 | + public static function apply_taxes(EE_Line_Item $total_line_item) { |
|
814 | 814 | /** @type EEM_Price $EEM_Price */ |
815 | - $EEM_Price = EE_Registry::instance()->load_model( 'Price' ); |
|
815 | + $EEM_Price = EE_Registry::instance()->load_model('Price'); |
|
816 | 816 | // get array of taxes via Price Model |
817 | 817 | $ordered_taxes = $EEM_Price->get_all_prices_that_are_taxes(); |
818 | - ksort( $ordered_taxes ); |
|
819 | - $taxes_line_item = self::get_taxes_subtotal( $total_line_item ); |
|
818 | + ksort($ordered_taxes); |
|
819 | + $taxes_line_item = self::get_taxes_subtotal($total_line_item); |
|
820 | 820 | //just to be safe, remove its old tax line items |
821 | 821 | $taxes_line_item->delete_children_line_items(); |
822 | 822 | //loop thru taxes |
823 | - foreach ( $ordered_taxes as $order => $taxes ) { |
|
824 | - foreach ( $taxes as $tax ) { |
|
825 | - if ( $tax instanceof EE_Price ) { |
|
823 | + foreach ($ordered_taxes as $order => $taxes) { |
|
824 | + foreach ($taxes as $tax) { |
|
825 | + if ($tax instanceof EE_Price) { |
|
826 | 826 | $tax_line_item = EE_Line_Item::new_instance( |
827 | 827 | array( |
828 | 828 | 'LIN_name' => $tax->name(), |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | 'FHEE__EEH_Line_Item__apply_taxes__tax_line_item', |
841 | 841 | $tax_line_item |
842 | 842 | ); |
843 | - $taxes_line_item->add_child_line_item( $tax_line_item ); |
|
843 | + $taxes_line_item->add_child_line_item($tax_line_item); |
|
844 | 844 | } |
845 | 845 | } |
846 | 846 | } |
@@ -857,10 +857,10 @@ discard block |
||
857 | 857 | * @return float |
858 | 858 | * @throws \EE_Error |
859 | 859 | */ |
860 | - public static function ensure_taxes_applied( $total_line_item ){ |
|
861 | - $taxes_subtotal = self::get_taxes_subtotal( $total_line_item ); |
|
862 | - if( ! $taxes_subtotal->children()){ |
|
863 | - self::apply_taxes( $total_line_item ); |
|
860 | + public static function ensure_taxes_applied($total_line_item) { |
|
861 | + $taxes_subtotal = self::get_taxes_subtotal($total_line_item); |
|
862 | + if ( ! $taxes_subtotal->children()) { |
|
863 | + self::apply_taxes($total_line_item); |
|
864 | 864 | } |
865 | 865 | return $taxes_subtotal->total(); |
866 | 866 | } |
@@ -874,16 +874,16 @@ discard block |
||
874 | 874 | * @return bool |
875 | 875 | * @throws \EE_Error |
876 | 876 | */ |
877 | - public static function delete_all_child_items( EE_Line_Item $parent_line_item ) { |
|
877 | + public static function delete_all_child_items(EE_Line_Item $parent_line_item) { |
|
878 | 878 | $deleted = 0; |
879 | - foreach ( $parent_line_item->children() as $child_line_item ) { |
|
880 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
881 | - $deleted += EEH_Line_Item::delete_all_child_items( $child_line_item ); |
|
882 | - if ( $child_line_item->ID() ) { |
|
879 | + foreach ($parent_line_item->children() as $child_line_item) { |
|
880 | + if ($child_line_item instanceof EE_Line_Item) { |
|
881 | + $deleted += EEH_Line_Item::delete_all_child_items($child_line_item); |
|
882 | + if ($child_line_item->ID()) { |
|
883 | 883 | $child_line_item->delete(); |
884 | - unset( $child_line_item ); |
|
884 | + unset($child_line_item); |
|
885 | 885 | } else { |
886 | - $parent_line_item->delete_child_line_item( $child_line_item->code() ); |
|
886 | + $parent_line_item->delete_child_line_item($child_line_item->code()); |
|
887 | 887 | } |
888 | 888 | $deleted++; |
889 | 889 | } |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | * @param array|bool|string $line_item_codes |
906 | 906 | * @return int number of items successfully removed |
907 | 907 | */ |
908 | - public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) { |
|
908 | + public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) { |
|
909 | 909 | |
910 | - if( $total_line_item->type() !== EEM_Line_Item::type_total ){ |
|
910 | + if ($total_line_item->type() !== EEM_Line_Item::type_total) { |
|
911 | 911 | EE_Error::doing_it_wrong( |
912 | 912 | 'EEH_Line_Item::delete_items', |
913 | 913 | __( |
@@ -917,20 +917,20 @@ discard block |
||
917 | 917 | '4.6.18' |
918 | 918 | ); |
919 | 919 | } |
920 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
920 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
921 | 921 | |
922 | 922 | // check if only a single line_item_id was passed |
923 | - if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) { |
|
923 | + if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) { |
|
924 | 924 | // place single line_item_id in an array to appear as multiple line_item_ids |
925 | - $line_item_codes = array ( $line_item_codes ); |
|
925 | + $line_item_codes = array($line_item_codes); |
|
926 | 926 | } |
927 | 927 | $removals = 0; |
928 | 928 | // cycle thru line_item_ids |
929 | - foreach ( $line_item_codes as $line_item_id ) { |
|
929 | + foreach ($line_item_codes as $line_item_id) { |
|
930 | 930 | $removals += $total_line_item->delete_child_line_item($line_item_id); |
931 | 931 | } |
932 | 932 | |
933 | - if ( $removals > 0 ) { |
|
933 | + if ($removals > 0) { |
|
934 | 934 | $total_line_item->recalculate_taxes_and_tax_total(); |
935 | 935 | return $removals; |
936 | 936 | } else { |
@@ -963,33 +963,33 @@ discard block |
||
963 | 963 | $code = null, |
964 | 964 | $add_to_existing_line_item = false |
965 | 965 | ) { |
966 | - $tax_subtotal = self::get_taxes_subtotal( $total_line_item ); |
|
966 | + $tax_subtotal = self::get_taxes_subtotal($total_line_item); |
|
967 | 967 | $taxable_total = $total_line_item->taxable_total(); |
968 | 968 | |
969 | - if( $add_to_existing_line_item ) { |
|
970 | - $new_tax = $tax_subtotal->get_child_line_item( $code ); |
|
969 | + if ($add_to_existing_line_item) { |
|
970 | + $new_tax = $tax_subtotal->get_child_line_item($code); |
|
971 | 971 | EEM_Line_Item::instance()->delete( |
972 | - array( array( 'LIN_code' => array( '!=', $code ), 'LIN_parent' => $tax_subtotal->ID() ) ) |
|
972 | + array(array('LIN_code' => array('!=', $code), 'LIN_parent' => $tax_subtotal->ID())) |
|
973 | 973 | ); |
974 | 974 | } else { |
975 | 975 | $new_tax = null; |
976 | 976 | $tax_subtotal->delete_children_line_items(); |
977 | 977 | } |
978 | - if( $new_tax ) { |
|
979 | - $new_tax->set_total( $new_tax->total() + $amount ); |
|
980 | - $new_tax->set_percent( $taxable_total ? $new_tax->total() / $taxable_total * 100 : 0 ); |
|
978 | + if ($new_tax) { |
|
979 | + $new_tax->set_total($new_tax->total() + $amount); |
|
980 | + $new_tax->set_percent($taxable_total ? $new_tax->total() / $taxable_total * 100 : 0); |
|
981 | 981 | } else { |
982 | 982 | //no existing tax item. Create it |
983 | - $new_tax = EE_Line_Item::new_instance( array( |
|
983 | + $new_tax = EE_Line_Item::new_instance(array( |
|
984 | 984 | 'TXN_ID' => $total_line_item->TXN_ID(), |
985 | - 'LIN_name' => $name ? $name : __( 'Tax', 'event_espresso' ), |
|
985 | + 'LIN_name' => $name ? $name : __('Tax', 'event_espresso'), |
|
986 | 986 | 'LIN_desc' => $description ? $description : '', |
987 | - 'LIN_percent' => $taxable_total ? ( $amount / $taxable_total * 100 ) : 0, |
|
987 | + 'LIN_percent' => $taxable_total ? ($amount / $taxable_total * 100) : 0, |
|
988 | 988 | 'LIN_total' => $amount, |
989 | 989 | 'LIN_parent' => $tax_subtotal->ID(), |
990 | 990 | 'LIN_type' => EEM_Line_Item::type_tax, |
991 | 991 | 'LIN_code' => $code |
992 | - ) ); |
|
992 | + )); |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | $new_tax = apply_filters( |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | $total_line_item |
999 | 999 | ); |
1000 | 1000 | $new_tax->save(); |
1001 | - $tax_subtotal->set_total( $new_tax->total() ); |
|
1001 | + $tax_subtotal->set_total($new_tax->total()); |
|
1002 | 1002 | $tax_subtotal->save(); |
1003 | 1003 | $total_line_item->recalculate_total_including_taxes(); |
1004 | 1004 | return $new_tax; |
@@ -1020,14 +1020,14 @@ discard block |
||
1020 | 1020 | $code_substring_for_whitelist = null |
1021 | 1021 | ) { |
1022 | 1022 | $whitelisted = false; |
1023 | - if( $code_substring_for_whitelist !== null ) { |
|
1024 | - $whitelisted = strpos( $line_item->code(), $code_substring_for_whitelist ) !== false ? true : false; |
|
1023 | + if ($code_substring_for_whitelist !== null) { |
|
1024 | + $whitelisted = strpos($line_item->code(), $code_substring_for_whitelist) !== false ? true : false; |
|
1025 | 1025 | } |
1026 | - if( ! $whitelisted && $line_item->is_line_item() ) { |
|
1027 | - $line_item->set_is_taxable( $taxable ); |
|
1026 | + if ( ! $whitelisted && $line_item->is_line_item()) { |
|
1027 | + $line_item->set_is_taxable($taxable); |
|
1028 | 1028 | } |
1029 | - foreach( $line_item->children() as $child_line_item ) { |
|
1030 | - EEH_Line_Item::set_line_items_taxable( $child_line_item, $taxable, $code_substring_for_whitelist ); |
|
1029 | + foreach ($line_item->children() as $child_line_item) { |
|
1030 | + EEH_Line_Item::set_line_items_taxable($child_line_item, $taxable, $code_substring_for_whitelist); |
|
1031 | 1031 | } |
1032 | 1032 | } |
1033 | 1033 | |
@@ -1040,8 +1040,8 @@ discard block |
||
1040 | 1040 | * @param \EE_Line_Item $parent_line_item - the line item to find descendants of |
1041 | 1041 | * @return EE_Line_Item[] |
1042 | 1042 | */ |
1043 | - public static function get_event_subtotals( EE_Line_Item $parent_line_item ) { |
|
1044 | - return self::get_subtotals_of_object_type( $parent_line_item, 'Event' ); |
|
1043 | + public static function get_event_subtotals(EE_Line_Item $parent_line_item) { |
|
1044 | + return self::get_subtotals_of_object_type($parent_line_item, 'Event'); |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | * @param string $obj_type |
1055 | 1055 | * @return EE_Line_Item[] |
1056 | 1056 | */ |
1057 | - public static function get_subtotals_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) { |
|
1057 | + public static function get_subtotals_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') { |
|
1058 | 1058 | return self::_get_descendants_by_type_and_object_type( |
1059 | 1059 | $parent_line_item, |
1060 | 1060 | EEM_Line_Item::type_sub_total, |
@@ -1071,8 +1071,8 @@ discard block |
||
1071 | 1071 | * @param \EE_Line_Item $parent_line_item - the line item to find descendants of |
1072 | 1072 | * @return EE_Line_Item[] |
1073 | 1073 | */ |
1074 | - public static function get_ticket_line_items( EE_Line_Item $parent_line_item ) { |
|
1075 | - return self::get_line_items_of_object_type( $parent_line_item, 'Ticket' ); |
|
1074 | + public static function get_ticket_line_items(EE_Line_Item $parent_line_item) { |
|
1075 | + return self::get_line_items_of_object_type($parent_line_item, 'Ticket'); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | |
@@ -1085,8 +1085,8 @@ discard block |
||
1085 | 1085 | * @param string $obj_type |
1086 | 1086 | * @return EE_Line_Item[] |
1087 | 1087 | */ |
1088 | - public static function get_line_items_of_object_type( EE_Line_Item $parent_line_item, $obj_type = '' ) { |
|
1089 | - return self::_get_descendants_by_type_and_object_type( $parent_line_item, EEM_Line_Item::type_line_item, $obj_type ); |
|
1088 | + public static function get_line_items_of_object_type(EE_Line_Item $parent_line_item, $obj_type = '') { |
|
1089 | + return self::_get_descendants_by_type_and_object_type($parent_line_item, EEM_Line_Item::type_line_item, $obj_type); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | |
@@ -1097,8 +1097,8 @@ discard block |
||
1097 | 1097 | * @param \EE_Line_Item $parent_line_item - the line item to find descendants of |
1098 | 1098 | * @return EE_Line_Item[] |
1099 | 1099 | */ |
1100 | - public static function get_tax_descendants( EE_Line_Item $parent_line_item ) { |
|
1101 | - return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_tax ); |
|
1100 | + public static function get_tax_descendants(EE_Line_Item $parent_line_item) { |
|
1101 | + return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_tax); |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | |
@@ -1109,8 +1109,8 @@ discard block |
||
1109 | 1109 | * @param \EE_Line_Item $parent_line_item - the line item to find descendants of |
1110 | 1110 | * @return EE_Line_Item[] |
1111 | 1111 | */ |
1112 | - public static function get_line_item_descendants( EE_Line_Item $parent_line_item ) { |
|
1113 | - return EEH_Line_Item::get_descendants_of_type( $parent_line_item, EEM_Line_Item::type_line_item ); |
|
1112 | + public static function get_line_item_descendants(EE_Line_Item $parent_line_item) { |
|
1113 | + return EEH_Line_Item::get_descendants_of_type($parent_line_item, EEM_Line_Item::type_line_item); |
|
1114 | 1114 | } |
1115 | 1115 | |
1116 | 1116 | |
@@ -1123,8 +1123,8 @@ discard block |
||
1123 | 1123 | * @param string $line_item_type one of the EEM_Line_Item constants |
1124 | 1124 | * @return EE_Line_Item[] |
1125 | 1125 | */ |
1126 | - public static function get_descendants_of_type( EE_Line_Item $parent_line_item, $line_item_type ) { |
|
1127 | - return self::_get_descendants_by_type_and_object_type( $parent_line_item, $line_item_type, NULL ); |
|
1126 | + public static function get_descendants_of_type(EE_Line_Item $parent_line_item, $line_item_type) { |
|
1127 | + return self::_get_descendants_by_type_and_object_type($parent_line_item, $line_item_type, NULL); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | |
@@ -1143,8 +1143,8 @@ discard block |
||
1143 | 1143 | $obj_type = null |
1144 | 1144 | ) { |
1145 | 1145 | $objects = array(); |
1146 | - foreach ( $parent_line_item->children() as $child_line_item ) { |
|
1147 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
1146 | + foreach ($parent_line_item->children() as $child_line_item) { |
|
1147 | + if ($child_line_item instanceof EE_Line_Item) { |
|
1148 | 1148 | if ( |
1149 | 1149 | $child_line_item->type() === $line_item_type |
1150 | 1150 | && ( |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | $OBJ_type = '', |
1185 | 1185 | $OBJ_IDs = array() |
1186 | 1186 | ) { |
1187 | - return self::_get_descendants_by_object_type_and_object_ID( $parent_line_item, $OBJ_type, $OBJ_IDs ); |
|
1187 | + return self::_get_descendants_by_object_type_and_object_ID($parent_line_item, $OBJ_type, $OBJ_IDs); |
|
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | |
@@ -1203,12 +1203,12 @@ discard block |
||
1203 | 1203 | $OBJ_IDs |
1204 | 1204 | ) { |
1205 | 1205 | $objects = array(); |
1206 | - foreach ( $parent_line_item->children() as $child_line_item ) { |
|
1207 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
1206 | + foreach ($parent_line_item->children() as $child_line_item) { |
|
1207 | + if ($child_line_item instanceof EE_Line_Item) { |
|
1208 | 1208 | if ( |
1209 | - is_array( $OBJ_IDs ) |
|
1209 | + is_array($OBJ_IDs) |
|
1210 | 1210 | && $child_line_item->OBJ_type() === $OBJ_type |
1211 | - && in_array( $child_line_item->OBJ_ID(), $OBJ_IDs ) |
|
1211 | + && in_array($child_line_item->OBJ_ID(), $OBJ_IDs) |
|
1212 | 1212 | ) { |
1213 | 1213 | $objects[] = $child_line_item; |
1214 | 1214 | } else { |
@@ -1238,8 +1238,8 @@ discard block |
||
1238 | 1238 | * @param string $type like one of the EEM_Line_Item::type_* |
1239 | 1239 | * @return EE_Line_Item |
1240 | 1240 | */ |
1241 | - public static function get_nearest_descendant_of_type( EE_Line_Item $parent_line_item, $type ) { |
|
1242 | - return self::_get_nearest_descendant( $parent_line_item, 'LIN_type' , $type ); |
|
1241 | + public static function get_nearest_descendant_of_type(EE_Line_Item $parent_line_item, $type) { |
|
1242 | + return self::_get_nearest_descendant($parent_line_item, 'LIN_type', $type); |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | |
@@ -1253,8 +1253,8 @@ discard block |
||
1253 | 1253 | * @param string $code any value used for LIN_code |
1254 | 1254 | * @return EE_Line_Item |
1255 | 1255 | */ |
1256 | - public static function get_nearest_descendant_having_code( EE_Line_Item $parent_line_item, $code ) { |
|
1257 | - return self::_get_nearest_descendant( $parent_line_item, 'LIN_code' , $code ); |
|
1256 | + public static function get_nearest_descendant_having_code(EE_Line_Item $parent_line_item, $code) { |
|
1257 | + return self::_get_nearest_descendant($parent_line_item, 'LIN_code', $code); |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | |
@@ -1268,15 +1268,15 @@ discard block |
||
1268 | 1268 | * @param string $value any value stored in $search_field |
1269 | 1269 | * @return EE_Line_Item |
1270 | 1270 | */ |
1271 | - protected static function _get_nearest_descendant( EE_Line_Item $parent_line_item, $search_field, $value ) { |
|
1272 | - foreach( $parent_line_item->children() as $child ){ |
|
1273 | - if ( $child->get( $search_field ) == $value ){ |
|
1271 | + protected static function _get_nearest_descendant(EE_Line_Item $parent_line_item, $search_field, $value) { |
|
1272 | + foreach ($parent_line_item->children() as $child) { |
|
1273 | + if ($child->get($search_field) == $value) { |
|
1274 | 1274 | return $child; |
1275 | 1275 | } |
1276 | 1276 | } |
1277 | - foreach( $parent_line_item->children() as $child ){ |
|
1278 | - $descendant_found = self::_get_nearest_descendant( $child, $search_field, $value ); |
|
1279 | - if ( $descendant_found ){ |
|
1277 | + foreach ($parent_line_item->children() as $child) { |
|
1278 | + $descendant_found = self::_get_nearest_descendant($child, $search_field, $value); |
|
1279 | + if ($descendant_found) { |
|
1280 | 1280 | return $descendant_found; |
1281 | 1281 | } |
1282 | 1282 | } |
@@ -1293,24 +1293,24 @@ discard block |
||
1293 | 1293 | * @return \EE_Line_Item |
1294 | 1294 | * @throws \EE_Error |
1295 | 1295 | */ |
1296 | - public static function find_transaction_grand_total_for_line_item( EE_Line_Item $line_item ){ |
|
1297 | - if ( $line_item->TXN_ID() ) { |
|
1298 | - $total_line_item = $line_item->transaction()->total_line_item( false ); |
|
1299 | - if ( $total_line_item instanceof EE_Line_Item ) { |
|
1296 | + public static function find_transaction_grand_total_for_line_item(EE_Line_Item $line_item) { |
|
1297 | + if ($line_item->TXN_ID()) { |
|
1298 | + $total_line_item = $line_item->transaction()->total_line_item(false); |
|
1299 | + if ($total_line_item instanceof EE_Line_Item) { |
|
1300 | 1300 | return $total_line_item; |
1301 | 1301 | } |
1302 | 1302 | } else { |
1303 | 1303 | $line_item_parent = $line_item->parent(); |
1304 | - if ( $line_item_parent instanceof EE_Line_Item ) { |
|
1305 | - if ( $line_item_parent->is_total() ) { |
|
1304 | + if ($line_item_parent instanceof EE_Line_Item) { |
|
1305 | + if ($line_item_parent->is_total()) { |
|
1306 | 1306 | return $line_item_parent; |
1307 | 1307 | } |
1308 | - return EEH_Line_Item::find_transaction_grand_total_for_line_item( $line_item_parent ); |
|
1308 | + return EEH_Line_Item::find_transaction_grand_total_for_line_item($line_item_parent); |
|
1309 | 1309 | } |
1310 | 1310 | } |
1311 | 1311 | throw new EE_Error( |
1312 | 1312 | sprintf( |
1313 | - __( 'A valid grand total for line item %1$d was not found.', 'event_espresso' ), |
|
1313 | + __('A valid grand total for line item %1$d was not found.', 'event_espresso'), |
|
1314 | 1314 | $line_item->ID() |
1315 | 1315 | ) |
1316 | 1316 | ); |
@@ -1327,31 +1327,31 @@ discard block |
||
1327 | 1327 | * @return void |
1328 | 1328 | * @throws \EE_Error |
1329 | 1329 | */ |
1330 | - public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){ |
|
1330 | + public static function visualize(EE_Line_Item $line_item, $indentation = 0) { |
|
1331 | 1331 | echo defined('EE_TESTS_DIR') ? "\n" : '<br />'; |
1332 | - if ( ! $indentation ) { |
|
1333 | - echo defined( 'EE_TESTS_DIR' ) ? "\n" : '<br />'; |
|
1332 | + if ( ! $indentation) { |
|
1333 | + echo defined('EE_TESTS_DIR') ? "\n" : '<br />'; |
|
1334 | 1334 | } |
1335 | - for( $i = 0; $i < $indentation; $i++ ){ |
|
1335 | + for ($i = 0; $i < $indentation; $i++) { |
|
1336 | 1336 | echo ". "; |
1337 | 1337 | } |
1338 | 1338 | $breakdown = ''; |
1339 | - if ( $line_item->is_line_item()){ |
|
1340 | - if ( $line_item->is_percent() ) { |
|
1339 | + if ($line_item->is_line_item()) { |
|
1340 | + if ($line_item->is_percent()) { |
|
1341 | 1341 | $breakdown = "{$line_item->percent()}%"; |
1342 | 1342 | } else { |
1343 | - $breakdown = '$' . "{$line_item->unit_price()} x {$line_item->quantity()}"; |
|
1343 | + $breakdown = '$'."{$line_item->unit_price()} x {$line_item->quantity()}"; |
|
1344 | 1344 | } |
1345 | 1345 | } |
1346 | - echo $line_item->name() . " [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : " . '$' . "{$line_item->total()}"; |
|
1347 | - if ( $breakdown ) { |
|
1346 | + echo $line_item->name()." [ ID:{$line_item->ID()} | qty:{$line_item->quantity()} ] {$line_item->type()} : ".'$'."{$line_item->total()}"; |
|
1347 | + if ($breakdown) { |
|
1348 | 1348 | echo " ( {$breakdown} )"; |
1349 | 1349 | } |
1350 | - if( $line_item->is_taxable() ){ |
|
1350 | + if ($line_item->is_taxable()) { |
|
1351 | 1351 | echo " * taxable"; |
1352 | 1352 | } |
1353 | - if( $line_item->children() ){ |
|
1354 | - foreach($line_item->children() as $child){ |
|
1353 | + if ($line_item->children()) { |
|
1354 | + foreach ($line_item->children() as $child) { |
|
1355 | 1355 | self::visualize($child, $indentation + 1); |
1356 | 1356 | } |
1357 | 1357 | } |
@@ -1392,97 +1392,97 @@ discard block |
||
1392 | 1392 | * is theirs, which can be done with |
1393 | 1393 | * `EEM_Line_Item::instance()->get_line_item_for_registration( $registration );` |
1394 | 1394 | */ |
1395 | - public static function calculate_reg_final_prices_per_line_item( EE_Line_Item $line_item, $billable_ticket_quantities = array() ) { |
|
1395 | + public static function calculate_reg_final_prices_per_line_item(EE_Line_Item $line_item, $billable_ticket_quantities = array()) { |
|
1396 | 1396 | //init running grand total if not already |
1397 | - if ( ! isset( $running_totals[ 'total' ] ) ) { |
|
1398 | - $running_totals[ 'total' ] = 0; |
|
1397 | + if ( ! isset($running_totals['total'])) { |
|
1398 | + $running_totals['total'] = 0; |
|
1399 | 1399 | } |
1400 | - if( ! isset( $running_totals[ 'taxable' ] ) ) { |
|
1401 | - $running_totals[ 'taxable' ] = array( 'total' => 0 ); |
|
1400 | + if ( ! isset($running_totals['taxable'])) { |
|
1401 | + $running_totals['taxable'] = array('total' => 0); |
|
1402 | 1402 | } |
1403 | - foreach ( $line_item->children() as $child_line_item ) { |
|
1404 | - switch ( $child_line_item->type() ) { |
|
1403 | + foreach ($line_item->children() as $child_line_item) { |
|
1404 | + switch ($child_line_item->type()) { |
|
1405 | 1405 | |
1406 | 1406 | case EEM_Line_Item::type_sub_total : |
1407 | - $running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $child_line_item, $billable_ticket_quantities ); |
|
1407 | + $running_totals_from_subtotal = EEH_Line_Item::calculate_reg_final_prices_per_line_item($child_line_item, $billable_ticket_quantities); |
|
1408 | 1408 | //combine arrays but preserve numeric keys |
1409 | - $running_totals = array_replace_recursive( $running_totals_from_subtotal, $running_totals ); |
|
1410 | - $running_totals[ 'total' ] += $running_totals_from_subtotal[ 'total' ]; |
|
1411 | - $running_totals[ 'taxable'][ 'total' ] += $running_totals_from_subtotal[ 'taxable' ][ 'total' ]; |
|
1409 | + $running_totals = array_replace_recursive($running_totals_from_subtotal, $running_totals); |
|
1410 | + $running_totals['total'] += $running_totals_from_subtotal['total']; |
|
1411 | + $running_totals['taxable']['total'] += $running_totals_from_subtotal['taxable']['total']; |
|
1412 | 1412 | break; |
1413 | 1413 | |
1414 | 1414 | case EEM_Line_Item::type_tax_sub_total : |
1415 | 1415 | |
1416 | 1416 | //find how much the taxes percentage is |
1417 | - if ( $child_line_item->percent() !== 0 ) { |
|
1417 | + if ($child_line_item->percent() !== 0) { |
|
1418 | 1418 | $tax_percent_decimal = $child_line_item->percent() / 100; |
1419 | 1419 | } else { |
1420 | 1420 | $tax_percent_decimal = EE_Taxes::get_total_taxes_percentage() / 100; |
1421 | 1421 | } |
1422 | 1422 | //and apply to all the taxable totals, and add to the pretax totals |
1423 | - foreach ( $running_totals as $line_item_id => $this_running_total ) { |
|
1423 | + foreach ($running_totals as $line_item_id => $this_running_total) { |
|
1424 | 1424 | //"total" and "taxable" array key is an exception |
1425 | - if ( $line_item_id === 'taxable' ) { |
|
1425 | + if ($line_item_id === 'taxable') { |
|
1426 | 1426 | continue; |
1427 | 1427 | } |
1428 | - $taxable_total = $running_totals[ 'taxable' ][ $line_item_id ]; |
|
1429 | - $running_totals[ $line_item_id ] += ( $taxable_total * $tax_percent_decimal ); |
|
1428 | + $taxable_total = $running_totals['taxable'][$line_item_id]; |
|
1429 | + $running_totals[$line_item_id] += ($taxable_total * $tax_percent_decimal); |
|
1430 | 1430 | } |
1431 | 1431 | break; |
1432 | 1432 | |
1433 | 1433 | case EEM_Line_Item::type_line_item : |
1434 | 1434 | |
1435 | 1435 | // ticket line items or ???? |
1436 | - if ( $child_line_item->OBJ_type() === 'Ticket' ) { |
|
1436 | + if ($child_line_item->OBJ_type() === 'Ticket') { |
|
1437 | 1437 | // kk it's a ticket |
1438 | - if ( isset( $running_totals[ $child_line_item->ID() ] ) ) { |
|
1438 | + if (isset($running_totals[$child_line_item->ID()])) { |
|
1439 | 1439 | //huh? that shouldn't happen. |
1440 | - $running_totals[ 'total' ] += $child_line_item->total(); |
|
1440 | + $running_totals['total'] += $child_line_item->total(); |
|
1441 | 1441 | } else { |
1442 | 1442 | //its not in our running totals yet. great. |
1443 | - if ( $child_line_item->is_taxable() ) { |
|
1443 | + if ($child_line_item->is_taxable()) { |
|
1444 | 1444 | $taxable_amount = $child_line_item->unit_price(); |
1445 | 1445 | } else { |
1446 | 1446 | $taxable_amount = 0; |
1447 | 1447 | } |
1448 | 1448 | // are we only calculating totals for some tickets? |
1449 | - if ( isset( $billable_ticket_quantities[ $child_line_item->OBJ_ID() ] ) ) { |
|
1450 | - $quantity = $billable_ticket_quantities[ $child_line_item->OBJ_ID() ]; |
|
1451 | - $running_totals[ $child_line_item->ID() ] = $quantity |
|
1449 | + if (isset($billable_ticket_quantities[$child_line_item->OBJ_ID()])) { |
|
1450 | + $quantity = $billable_ticket_quantities[$child_line_item->OBJ_ID()]; |
|
1451 | + $running_totals[$child_line_item->ID()] = $quantity |
|
1452 | 1452 | ? $child_line_item->unit_price() |
1453 | 1453 | : 0; |
1454 | - $running_totals[ 'taxable' ][ $child_line_item->ID() ] = $quantity |
|
1454 | + $running_totals['taxable'][$child_line_item->ID()] = $quantity |
|
1455 | 1455 | ? $taxable_amount |
1456 | 1456 | : 0; |
1457 | 1457 | } else { |
1458 | 1458 | $quantity = $child_line_item->quantity(); |
1459 | - $running_totals[ $child_line_item->ID() ] = $child_line_item->unit_price(); |
|
1460 | - $running_totals[ 'taxable' ][ $child_line_item->ID() ] = $taxable_amount; |
|
1459 | + $running_totals[$child_line_item->ID()] = $child_line_item->unit_price(); |
|
1460 | + $running_totals['taxable'][$child_line_item->ID()] = $taxable_amount; |
|
1461 | 1461 | } |
1462 | - $running_totals[ 'taxable' ][ 'total' ] += $taxable_amount * $quantity; |
|
1463 | - $running_totals[ 'total' ] += $child_line_item->unit_price() * $quantity; |
|
1462 | + $running_totals['taxable']['total'] += $taxable_amount * $quantity; |
|
1463 | + $running_totals['total'] += $child_line_item->unit_price() * $quantity; |
|
1464 | 1464 | } |
1465 | 1465 | } else { |
1466 | 1466 | // it's some other type of item added to the cart |
1467 | 1467 | // it should affect the running totals |
1468 | 1468 | // basically we want to convert it into a PERCENT modifier. Because |
1469 | 1469 | // more clearly affect all registration's final price equally |
1470 | - $line_items_percent_of_running_total = $running_totals[ 'total' ] > 0 |
|
1471 | - ? ( $child_line_item->total() / $running_totals[ 'total' ] ) + 1 |
|
1470 | + $line_items_percent_of_running_total = $running_totals['total'] > 0 |
|
1471 | + ? ($child_line_item->total() / $running_totals['total']) + 1 |
|
1472 | 1472 | : 1; |
1473 | - foreach ( $running_totals as $line_item_id => $this_running_total ) { |
|
1473 | + foreach ($running_totals as $line_item_id => $this_running_total) { |
|
1474 | 1474 | //the "taxable" array key is an exception |
1475 | - if ( $line_item_id === 'taxable' ) { |
|
1475 | + if ($line_item_id === 'taxable') { |
|
1476 | 1476 | continue; |
1477 | 1477 | } |
1478 | 1478 | // update the running totals |
1479 | 1479 | // yes this actually even works for the running grand total! |
1480 | - $running_totals[ $line_item_id ] = |
|
1480 | + $running_totals[$line_item_id] = |
|
1481 | 1481 | $line_items_percent_of_running_total * $this_running_total; |
1482 | 1482 | |
1483 | - if ( $child_line_item->is_taxable() ) { |
|
1484 | - $running_totals[ 'taxable' ][ $line_item_id ] = |
|
1485 | - $line_items_percent_of_running_total * $running_totals[ 'taxable' ][ $line_item_id ]; |
|
1483 | + if ($child_line_item->is_taxable()) { |
|
1484 | + $running_totals['taxable'][$line_item_id] = |
|
1485 | + $line_items_percent_of_running_total * $running_totals['taxable'][$line_item_id]; |
|
1486 | 1486 | } |
1487 | 1487 | } |
1488 | 1488 | } |
@@ -1500,16 +1500,16 @@ discard block |
||
1500 | 1500 | * @return float | null |
1501 | 1501 | * @throws \OutOfRangeException |
1502 | 1502 | */ |
1503 | - public static function calculate_final_price_for_ticket_line_item( \EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item ) { |
|
1503 | + public static function calculate_final_price_for_ticket_line_item(\EE_Line_Item $total_line_item, \EE_Line_Item $ticket_line_item) { |
|
1504 | 1504 | static $final_prices_per_ticket_line_item = array(); |
1505 | - if ( empty( $final_prices_per_ticket_line_item ) ) { |
|
1505 | + if (empty($final_prices_per_ticket_line_item)) { |
|
1506 | 1506 | $final_prices_per_ticket_line_item = \EEH_Line_Item::calculate_reg_final_prices_per_line_item( |
1507 | 1507 | $total_line_item |
1508 | 1508 | ); |
1509 | 1509 | } |
1510 | 1510 | //ok now find this new registration's final price |
1511 | - if ( isset( $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ] ) ) { |
|
1512 | - return $final_prices_per_ticket_line_item[ $ticket_line_item->ID() ]; |
|
1511 | + if (isset($final_prices_per_ticket_line_item[$ticket_line_item->ID()])) { |
|
1512 | + return $final_prices_per_ticket_line_item[$ticket_line_item->ID()]; |
|
1513 | 1513 | } |
1514 | 1514 | $message = sprintf( |
1515 | 1515 | __( |
@@ -1518,10 +1518,10 @@ discard block |
||
1518 | 1518 | ), |
1519 | 1519 | $ticket_line_item->ID() |
1520 | 1520 | ); |
1521 | - if ( WP_DEBUG ) { |
|
1522 | - throw new \OutOfRangeException( $message ); |
|
1521 | + if (WP_DEBUG) { |
|
1522 | + throw new \OutOfRangeException($message); |
|
1523 | 1523 | } else { |
1524 | - EE_Log::instance()->log( __CLASS__, __FUNCTION__, $message ); |
|
1524 | + EE_Log::instance()->log(__CLASS__, __FUNCTION__, $message); |
|
1525 | 1525 | } |
1526 | 1526 | return null; |
1527 | 1527 | } |
@@ -1537,15 +1537,15 @@ discard block |
||
1537 | 1537 | * @return \EE_Line_Item |
1538 | 1538 | * @throws \EE_Error |
1539 | 1539 | */ |
1540 | - public static function billable_line_item_tree( EE_Line_Item $line_item, $registrations ) { |
|
1541 | - $copy_li = EEH_Line_Item::billable_line_item( $line_item, $registrations ); |
|
1542 | - foreach ( $line_item->children() as $child_li ) { |
|
1543 | - $copy_li->add_child_line_item( EEH_Line_Item::billable_line_item_tree( $child_li, $registrations ) ); |
|
1540 | + public static function billable_line_item_tree(EE_Line_Item $line_item, $registrations) { |
|
1541 | + $copy_li = EEH_Line_Item::billable_line_item($line_item, $registrations); |
|
1542 | + foreach ($line_item->children() as $child_li) { |
|
1543 | + $copy_li->add_child_line_item(EEH_Line_Item::billable_line_item_tree($child_li, $registrations)); |
|
1544 | 1544 | } |
1545 | 1545 | //if this is the grand total line item, make sure the totals all add up |
1546 | 1546 | //(we could have duplicated this logic AS we copied the line items, but |
1547 | 1547 | //it seems DRYer this way) |
1548 | - if ( $copy_li->type() === EEM_Line_Item::type_total ) { |
|
1548 | + if ($copy_li->type() === EEM_Line_Item::type_total) { |
|
1549 | 1549 | $copy_li->recalculate_total_including_taxes(); |
1550 | 1550 | } |
1551 | 1551 | return $copy_li; |
@@ -1562,24 +1562,24 @@ discard block |
||
1562 | 1562 | * @throws \EE_Error |
1563 | 1563 | * @param EE_Registration[] $registrations |
1564 | 1564 | */ |
1565 | - public static function billable_line_item( EE_Line_Item $line_item, $registrations ) { |
|
1565 | + public static function billable_line_item(EE_Line_Item $line_item, $registrations) { |
|
1566 | 1566 | $new_li_fields = $line_item->model_field_array(); |
1567 | - if ( $line_item->type() === EEM_Line_Item::type_line_item && |
|
1567 | + if ($line_item->type() === EEM_Line_Item::type_line_item && |
|
1568 | 1568 | $line_item->OBJ_type() === 'Ticket' |
1569 | 1569 | ) { |
1570 | 1570 | $count = 0; |
1571 | - foreach ( $registrations as $registration ) { |
|
1572 | - if ( $line_item->OBJ_ID() === $registration->ticket_ID() && |
|
1573 | - in_array( $registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment() ) |
|
1571 | + foreach ($registrations as $registration) { |
|
1572 | + if ($line_item->OBJ_ID() === $registration->ticket_ID() && |
|
1573 | + in_array($registration->status_ID(), EEM_Registration::reg_statuses_that_allow_payment()) |
|
1574 | 1574 | ) { |
1575 | 1575 | $count++; |
1576 | 1576 | } |
1577 | 1577 | } |
1578 | - $new_li_fields[ 'LIN_quantity' ] = $count; |
|
1578 | + $new_li_fields['LIN_quantity'] = $count; |
|
1579 | 1579 | } |
1580 | 1580 | //don't set the total. We'll leave that up to the code that calculates it |
1581 | - unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ], $new_li_fields[ 'LIN_total' ] ); |
|
1582 | - return EE_Line_Item::new_instance( $new_li_fields ); |
|
1581 | + unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent'], $new_li_fields['LIN_total']); |
|
1582 | + return EE_Line_Item::new_instance($new_li_fields); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | |
@@ -1592,19 +1592,19 @@ discard block |
||
1592 | 1592 | * @return \EE_Line_Item|null |
1593 | 1593 | * @throws \EE_Error |
1594 | 1594 | */ |
1595 | - public static function non_empty_line_items( EE_Line_Item $line_item ) { |
|
1596 | - $copied_li = EEH_Line_Item::non_empty_line_item( $line_item ); |
|
1597 | - if ( $copied_li === null ) { |
|
1595 | + public static function non_empty_line_items(EE_Line_Item $line_item) { |
|
1596 | + $copied_li = EEH_Line_Item::non_empty_line_item($line_item); |
|
1597 | + if ($copied_li === null) { |
|
1598 | 1598 | return null; |
1599 | 1599 | } |
1600 | 1600 | //if this is an event subtotal, we want to only include it if it |
1601 | 1601 | //has a non-zero total and at least one ticket line item child |
1602 | 1602 | $ticket_children = 0; |
1603 | - foreach ( $line_item->children() as $child_li ) { |
|
1604 | - $child_li_copy = EEH_Line_Item::non_empty_line_items( $child_li ); |
|
1605 | - if ( $child_li_copy !== null ) { |
|
1606 | - $copied_li->add_child_line_item( $child_li_copy ); |
|
1607 | - if ( $child_li_copy->type() === EEM_Line_Item::type_line_item && |
|
1603 | + foreach ($line_item->children() as $child_li) { |
|
1604 | + $child_li_copy = EEH_Line_Item::non_empty_line_items($child_li); |
|
1605 | + if ($child_li_copy !== null) { |
|
1606 | + $copied_li->add_child_line_item($child_li_copy); |
|
1607 | + if ($child_li_copy->type() === EEM_Line_Item::type_line_item && |
|
1608 | 1608 | $child_li_copy->OBJ_type() === 'Ticket' |
1609 | 1609 | ) { |
1610 | 1610 | $ticket_children++; |
@@ -1634,8 +1634,8 @@ discard block |
||
1634 | 1634 | * @return EE_Line_Item |
1635 | 1635 | * @throws \EE_Error |
1636 | 1636 | */ |
1637 | - public static function non_empty_line_item( EE_Line_Item $line_item ) { |
|
1638 | - if ( $line_item->type() === EEM_Line_Item::type_line_item && |
|
1637 | + public static function non_empty_line_item(EE_Line_Item $line_item) { |
|
1638 | + if ($line_item->type() === EEM_Line_Item::type_line_item && |
|
1639 | 1639 | $line_item->OBJ_type() === 'Ticket' && |
1640 | 1640 | $line_item->quantity() === 0 |
1641 | 1641 | ) { |
@@ -1643,8 +1643,8 @@ discard block |
||
1643 | 1643 | } |
1644 | 1644 | $new_li_fields = $line_item->model_field_array(); |
1645 | 1645 | //don't set the total. We'll leave that up to the code that calculates it |
1646 | - unset( $new_li_fields[ 'LIN_ID' ], $new_li_fields[ 'LIN_parent' ] ); |
|
1647 | - return EE_Line_Item::new_instance( $new_li_fields ); |
|
1646 | + unset($new_li_fields['LIN_ID'], $new_li_fields['LIN_parent']); |
|
1647 | + return EE_Line_Item::new_instance($new_li_fields); |
|
1648 | 1648 | } |
1649 | 1649 | |
1650 | 1650 | |
@@ -1656,9 +1656,9 @@ discard block |
||
1656 | 1656 | * @return \EE_Line_Item |
1657 | 1657 | * @throws \EE_Error |
1658 | 1658 | */ |
1659 | - public static function get_items_subtotal( EE_Line_Item $total_line_item ){ |
|
1660 | - EE_Error::doing_it_wrong( 'EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0' ); |
|
1661 | - return self::get_pre_tax_subtotal( $total_line_item ); |
|
1659 | + public static function get_items_subtotal(EE_Line_Item $total_line_item) { |
|
1660 | + EE_Error::doing_it_wrong('EEH_Line_Item::get_items_subtotal()', __('Method replaced with EEH_Line_Item::get_pre_tax_subtotal()', 'event_espresso'), '4.6.0'); |
|
1661 | + return self::get_pre_tax_subtotal($total_line_item); |
|
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | |
@@ -1669,9 +1669,9 @@ discard block |
||
1669 | 1669 | * @return \EE_Line_Item |
1670 | 1670 | * @throws \EE_Error |
1671 | 1671 | */ |
1672 | - public static function create_default_total_line_item( $transaction = NULL) { |
|
1673 | - EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0' ); |
|
1674 | - return self::create_total_line_item( $transaction ); |
|
1672 | + public static function create_default_total_line_item($transaction = NULL) { |
|
1673 | + EE_Error::doing_it_wrong('EEH_Line_Item::create_default_total_line_item()', __('Method replaced with EEH_Line_Item::create_total_line_item()', 'event_espresso'), '4.6.0'); |
|
1674 | + return self::create_total_line_item($transaction); |
|
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | |
@@ -1683,9 +1683,9 @@ discard block |
||
1683 | 1683 | * @return \EE_Line_Item |
1684 | 1684 | * @throws \EE_Error |
1685 | 1685 | */ |
1686 | - public static function create_default_tickets_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) { |
|
1687 | - EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0' ); |
|
1688 | - return self::create_pre_tax_subtotal( $total_line_item, $transaction ); |
|
1686 | + public static function create_default_tickets_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
1687 | + EE_Error::doing_it_wrong('EEH_Line_Item::create_default_tickets_subtotal()', __('Method replaced with EEH_Line_Item::create_pre_tax_subtotal()', 'event_espresso'), '4.6.0'); |
|
1688 | + return self::create_pre_tax_subtotal($total_line_item, $transaction); |
|
1689 | 1689 | } |
1690 | 1690 | |
1691 | 1691 | |
@@ -1697,9 +1697,9 @@ discard block |
||
1697 | 1697 | * @return \EE_Line_Item |
1698 | 1698 | * @throws \EE_Error |
1699 | 1699 | */ |
1700 | - public static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) { |
|
1701 | - EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0' ); |
|
1702 | - return self::create_taxes_subtotal( $total_line_item, $transaction ); |
|
1700 | + public static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
1701 | + EE_Error::doing_it_wrong('EEH_Line_Item::create_default_taxes_subtotal()', __('Method replaced with EEH_Line_Item::create_taxes_subtotal()', 'event_espresso'), '4.6.0'); |
|
1702 | + return self::create_taxes_subtotal($total_line_item, $transaction); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | |
@@ -1711,9 +1711,9 @@ discard block |
||
1711 | 1711 | * @return \EE_Line_Item |
1712 | 1712 | * @throws \EE_Error |
1713 | 1713 | */ |
1714 | - public static function create_default_event_subtotal( EE_Line_Item $total_line_item, $transaction = NULL) { |
|
1715 | - EE_Error::doing_it_wrong( 'EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0' ); |
|
1716 | - return self::create_event_subtotal( $total_line_item, $transaction ); |
|
1714 | + public static function create_default_event_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
1715 | + EE_Error::doing_it_wrong('EEH_Line_Item::create_default_event_subtotal()', __('Method replaced with EEH_Line_Item::create_event_subtotal()', 'event_espresso'), '4.6.0'); |
|
1716 | + return self::create_event_subtotal($total_line_item, $transaction); |
|
1717 | 1717 | } |
1718 | 1718 | |
1719 | 1719 |
@@ -36,53 +36,53 @@ discard block |
||
36 | 36 | <h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2> |
37 | 37 | <h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3> |
38 | 38 | <h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3> |
39 | - <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3> |
|
39 | + <h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3> |
|
40 | 40 | </div> |
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | </table> |
44 | 44 | <div class="events"> |
45 | - <?php foreach($events_for_txn as $event_id => $event){ |
|
46 | - ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | - <?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
45 | + <?php foreach ($events_for_txn as $event_id => $event) { |
|
46 | + ?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3> |
|
47 | + <?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?> |
|
48 | 48 | <ul class="tickets-per-event"> |
49 | - <?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){ |
|
49 | + <?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) { |
|
50 | 50 | $ticket = $line_item->ticket(); |
51 | - $taxable_html = $ticket->taxable() ? '*': ''; |
|
51 | + $taxable_html = $ticket->taxable() ? '*' : ''; |
|
52 | 52 | $subitems = $line_item->children(); |
53 | - $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
53 | + $ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso")); |
|
54 | 54 | ?> |
55 | 55 | <li class="event-ticket"> |
56 | 56 | <div class="ticket-details"> |
57 | 57 | <table class="invoice-amount"> |
58 | 58 | <thead> |
59 | 59 | <tr class="header_row"> |
60 | - <th class="name-column"><?php _e("Ticket", "event_espresso");?></th> |
|
61 | - <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th> |
|
62 | - <th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th> |
|
63 | - <th class="number-column item_c"><?php _e("Price", "event_espresso");?></th> |
|
64 | - <th class="number-column item_r"><?php _e("Total", "event_espresso");?></th> |
|
60 | + <th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th> |
|
61 | + <th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th> |
|
62 | + <th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th> |
|
63 | + <th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th> |
|
64 | + <th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if( count($subitems) < 2){?> |
|
68 | + <?php if (count($subitems) < 2) {?> |
|
69 | 69 | <tr class="item"> |
70 | 70 | <td><?php echo $line_item->name().$taxable_html?></td> |
71 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
71 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
72 | 72 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
73 | 73 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
74 | 74 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
75 | 75 | </tr> |
76 | - <?php }else{?> |
|
76 | + <?php } else {?> |
|
77 | 77 | <tr class="item"> |
78 | 78 | <td class="aln-left"><?php echo $line_item->name().$taxable_html?></td> |
79 | - <td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
79 | + <td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td> |
|
80 | 80 | <td class="item_c"><?php echo $line_item->quantity()?></td> |
81 | 81 | <td class="item_c"><?php echo $line_item->unit_price_no_code()?></td> |
82 | 82 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
83 | 83 | </tr> |
84 | - <?php foreach($subitems as $sub_line_item){ |
|
85 | - $is_percent = $sub_line_item->is_percent();?> |
|
84 | + <?php foreach ($subitems as $sub_line_item) { |
|
85 | + $is_percent = $sub_line_item->is_percent(); ?> |
|
86 | 86 | <tr class="subitem-row"> |
87 | 87 | <td class="subitem"><?php echo $sub_line_item->name()?></td> |
88 | 88 | <td colspan="2"><?php echo $sub_line_item->desc()?></td> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <?php } ?> |
94 | 94 | <tr class="total_tr odd"> |
95 | 95 | <td colspan="4"></td> |
96 | - <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td> |
|
96 | + <td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td> |
|
97 | 97 | <td class="item_r"><?php echo $line_item->total_no_code()?></td> |
98 | 98 | </tr> |
99 | 99 | <?php }?> |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | <div class="reg-details-for-ticket"> |
105 | 105 | <div class="ticket-time-and-place-details"> |
106 | 106 | <div class="ticket-time-details"> |
107 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4> |
|
107 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4> |
|
108 | 108 | <ul class="event-dates"> |
109 | - <?php foreach($ticket->datetimes_ordered() as $datetime){ |
|
109 | + <?php foreach ($ticket->datetimes_ordered() as $datetime) { |
|
110 | 110 | /* @var $datetime EE_Datetime */ ?> |
111 | 111 | <li><?php |
112 | - echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ; |
|
113 | - echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone()); |
|
112 | + echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : ''; |
|
113 | + echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone()); |
|
114 | 114 | echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li> |
115 | 115 | <?php }?> |
116 | 116 | </ul> |
117 | 117 | </div> |
118 | - <?php if ($event->venues()){?> |
|
118 | + <?php if ($event->venues()) {?> |
|
119 | 119 | <div class="ticket-place-details"> |
120 | - <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4> |
|
120 | + <h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4> |
|
121 | 121 | <ul class="event-venues"> |
122 | - <?php foreach($event->venues() as $venue){?> |
|
122 | + <?php foreach ($event->venues() as $venue) {?> |
|
123 | 123 | <li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li> |
124 | 124 | <?php } ?> |
125 | 125 | </ul> |
@@ -127,34 +127,34 @@ discard block |
||
127 | 127 | <?php }?> |
128 | 128 | </div> |
129 | 129 | <div class="ticket-registrations-area"> |
130 | - <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
130 | + <h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4> |
|
131 | 131 | <ul class="ticket-registrations-list"> |
132 | - <?php foreach($registrations_per_line_item[$line_item_id] as $registration){ |
|
132 | + <?php foreach ($registrations_per_line_item[$line_item_id] as $registration) { |
|
133 | 133 | /* @var $registration EE_Registration */ |
134 | 134 | $attendee = $registration->attendee(); |
135 | - $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?> |
|
135 | + $answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?> |
|
136 | 136 | <li class="ticket-registration"> |
137 | 137 | <table class="registration-details"> |
138 | 138 | <tr class="odd"> |
139 | - <th><?php echo _e("Registration Code:", "event_espresso");?></th> |
|
140 | - <td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
139 | + <th><?php echo _e("Registration Code:", "event_espresso"); ?></th> |
|
140 | + <td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td> |
|
141 | 141 | </tr> |
142 | 142 | <?php |
143 | - foreach($event->question_groups() as $question_group){ |
|
144 | - ?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php |
|
143 | + foreach ($event->question_groups() as $question_group) { |
|
144 | + ?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php |
|
145 | 145 | $has_personal_info = false; |
146 | - foreach($question_group->questions() as $question){ |
|
147 | - if( in_array($question->system_ID(),$questions_to_skip)){ |
|
146 | + foreach ($question_group->questions() as $question) { |
|
147 | + if (in_array($question->system_ID(), $questions_to_skip)) { |
|
148 | 148 | $has_personal_info = true; |
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | ?><tr> |
152 | 152 | <th><?php echo $question->display_text()?></th> |
153 | - <td><?php echo $registration->answer_value_to_question($question);?></td> |
|
153 | + <td><?php echo $registration->answer_value_to_question($question); ?></td> |
|
154 | 154 | </tr><?php |
155 | 155 | } |
156 | - if($has_personal_info){ |
|
157 | - ?><tr><th><?php _e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php |
|
156 | + if ($has_personal_info) { |
|
157 | + ?><tr><th><?php _e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | ?> |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | <?php }?> |
172 | 172 | </div> |
173 | 173 | <div class="taxes"> |
174 | - <?php if ($tax_total_line_item && $tax_total_line_item->children()){?> |
|
175 | - <h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3> |
|
174 | + <?php if ($tax_total_line_item && $tax_total_line_item->children()) {?> |
|
175 | + <h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3> |
|
176 | 176 | <table class="invoice-amount"> |
177 | 177 | |
178 | 178 | <thead> |
179 | 179 | <tr class="header_row"> |
180 | - <th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th> |
|
181 | - <th class="left"><?php _e('Description', 'event_espresso');?></th> |
|
180 | + <th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th> |
|
181 | + <th class="left"><?php _e('Description', 'event_espresso'); ?></th> |
|
182 | 182 | <th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th> |
183 | 183 | <th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th> |
184 | 184 | </tr> |
185 | 185 | </thead> |
186 | 186 | <tbody> |
187 | 187 | <?php |
188 | - foreach($tax_total_line_item->children() as $child_tax){?> |
|
188 | + foreach ($tax_total_line_item->children() as $child_tax) {?> |
|
189 | 189 | <tr> |
190 | 190 | <td><?php echo $child_tax->name()?></td> |
191 | 191 | <td><?php echo $child_tax->desc()?></td> |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | <?php } ?> |
196 | 196 | <tr class="total_tr odd"> |
197 | 197 | <td class="total_tr" colspan="2"></td> |
198 | - <td class="total"><?php _e("Tax Total:", "event_espresso");?></td> |
|
198 | + <td class="total"><?php _e("Tax Total:", "event_espresso"); ?></td> |
|
199 | 199 | <td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td> |
200 | 200 | </tr> |
201 | 201 | </tbody> |
202 | 202 | |
203 | 203 | </table> |
204 | 204 | <?php }?> |
205 | - <p><?php _e("* taxable items", "event_espresso");?></p> |
|
205 | + <p><?php _e("* taxable items", "event_espresso"); ?></p> |
|
206 | 206 | </div> |
207 | 207 | <div class="grand-total-dv"> |
208 | - <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2> |
|
208 | + <h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2> |
|
209 | 209 | </div> |
210 | 210 | <div class="payment-dv"> |
211 | - <h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3> |
|
211 | + <h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3> |
|
212 | 212 | <p>[instructions]</p> |
213 | 213 | <table class="invoice-amount"> |
214 | 214 | <thead> |
215 | 215 | <tr class="header_row"> |
216 | 216 | <th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th> |
217 | - <th class='left datetime_th'><?php _e("Date",'event_espresso')?></th> |
|
217 | + <th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th> |
|
218 | 218 | <th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th> |
219 | 219 | <th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th> |
220 | 220 | <th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th> |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | 226 | $c = false; |
227 | - if(!empty($payments)){ |
|
227 | + if ( ! empty($payments)) { |
|
228 | 228 | |
229 | - foreach($payments as $payment){ |
|
229 | + foreach ($payments as $payment) { |
|
230 | 230 | /* @var $payment EE_Payment */?> |
231 | - <tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'> |
|
231 | + <tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'> |
|
232 | 232 | <td><?php $payment->e('PAY_gateway')?></td> |
233 | 233 | <td><?php echo $payment->timestamp()?></td> |
234 | 234 | <td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td> |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | <td class='item_r'><?php echo $payment->amount_no_code()?></td> |
238 | 238 | </tr> |
239 | 239 | <?php } |
240 | - }else{?> |
|
240 | + } else {?> |
|
241 | 241 | <tr class='item'> |
242 | - <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td> |
|
242 | + <td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td> |
|
243 | 243 | </tr> |
244 | 244 | <?php } |
245 | - ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr> |
|
245 | + ?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr> |
|
246 | 246 | </tbody> |
247 | 247 | <tfoot> |
248 | 248 | <tr class='total_tr'><td colspan="4"> </td> |
249 | - <td class="item_r"><?php _e('Total Paid','event_espresso')?></td> |
|
250 | - <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td> |
|
249 | + <td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td> |
|
250 | + <td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td> |
|
251 | 251 | </tr> |
252 | 252 | <?php //echo $discount; ?> |
253 | 253 | <tr class="total_tr odd"> |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | </table> |
260 | 260 | </div> |
261 | 261 | <div class="additional-info-dv"> |
262 | - <h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3> |
|
262 | + <h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3> |
|
263 | 263 | <div class="additional-info"> |
264 | - <?php if($venues_for_events){?> |
|
265 | - <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2> |
|
264 | + <?php if ($venues_for_events) {?> |
|
265 | + <h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2> |
|
266 | 266 | <table class="venue-list"> |
267 | - <?php foreach($venues_for_events as $venue){?> |
|
267 | + <?php foreach ($venues_for_events as $venue) {?> |
|
268 | 268 | <tr class="venue-details"> |
269 | 269 | <td class="venue-details-part venue-address-dv"> |
270 | 270 | <h3><a href='<?php echo $venue->get_permalink()?>'><?php |
271 | 271 | echo $venue->name() |
272 | 272 | ?></a></h3> |
273 | 273 | <p><?php echo $venue->description()?></p> |
274 | - <?php echo EEH_Address::format($venue);?></td> |
|
275 | - <?php if($venue->enable_for_gmap()){?> |
|
274 | + <?php echo EEH_Address::format($venue); ?></td> |
|
275 | + <?php if ($venue->enable_for_gmap()) {?> |
|
276 | 276 | <td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td> |
277 | 277 | <?php } ?> |
278 | 278 | </tr> |